@mappedin/mappedin-js 6.21.0 → 6.21.1
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/esm/{GLTFExporter-TPBX6R3U.js → GLTFExporter-V762TD2A.js} +1 -1
- package/lib/esm/{GLTFLoader-MAX3PCDM.js → GLTFLoader-HBT4C4QX.js} +1 -1
- package/lib/esm/{chunk-S3S2TZVB.js → chunk-23SDKQLF.js} +55 -55
- package/lib/esm/{chunk-3IQDSCDT.js → chunk-73NFNZ3A.js} +1 -1
- package/lib/esm/{chunk-LJC6K2N5.js → chunk-B5PVUD5J.js} +12 -12
- package/lib/esm/{chunk-F4OI5ZPF.js → chunk-DEPTGCUS.js} +1 -1
- package/lib/esm/{chunk-VJT5KQYB.js → chunk-HQ5BIBGU.js} +3 -3
- package/lib/esm/index.d.ts +12 -3
- package/lib/esm/index.js +1 -1
- package/lib/esm/{inspector-2HI72MBL.js → inspector-FCMDYYIP.js} +2 -2
- package/lib/esm/{internal-I5R5O5YO.js → internal-GPY5MCOX.js} +1 -1
- package/lib/esm/{src-5XG5YVCF.js → src-QYUMVA7Q.js} +1 -1
- package/lib/esm/{text3d-ZRFQLWHM.js → text3d-TJVE4VTW.js} +1 -1
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import{a as Jn,b as qn,c as Vr,d as qt,e as Ao,f as Ul,g as bo,h as qo,i as Qo,j as Hl,k as zl,l as ua,m as Xl,n as $l,o as fa,p as Yl,q as Zl,r as Jl,s as va,y as cc}from"./chunk-
|
|
1
|
+
import{a as Jn,b as qn,c as Vr,d as qt,e as Ao,f as Ul,g as bo,h as qo,i as Qo,j as Hl,k as zl,l as ua,m as Xl,n as $l,o as fa,p as Yl,q as Zl,r as Jl,s as va,y as cc}from"./chunk-B5PVUD5J.js";import{A as Oe,B as Wl,Bc as lc,E as ha,Ga as sc,I as ql,J as Ql,K as Kl,L as ec,O as ao,P as Ko,Q as ga,R as tc,S as oc,T as rc,U as ma,V as ya,W as ba,X as Ta,_ as nc,ba as Qn,d as C,e as ee,ea as Ia,f as $n,fa as Sa,g as Nl,ga as ic,ha as ac,i as Mt,ja as mh,k as Zo,ka as Ea,l as Yn,m as Br,p as Zn,q as Bl,s as Vl,t as Jt,u as da,w as jl,x as Gl,y as Jo}from"./chunk-23SDKQLF.js";import{a as f,b as S}from"./chunk-73NFNZ3A.js";import{b as Se,d as Xn}from"./chunk-PWEV3AFA.js";var ss=Se((is,as)=>{f();(function(o,e){typeof is=="object"&&typeof as<"u"?as.exports=e():typeof define=="function"&&define.amd?define(e):(o=typeof globalThis<"u"?globalThis:o||self,o.polygonClipping=e())})(is,(function(){"use strict";function o(M,d){var u={label:0,sent:function(){if(y[0]&1)throw y[1];return y[1]},trys:[],ops:[]},m,b,y,O;return O={next:_(0),throw:_(1),return:_(2)},typeof Symbol=="function"&&(O[Symbol.iterator]=function(){return this}),O;function _(w){return function(W){return F([w,W])}}function F(w){if(m)throw new TypeError("Generator is already executing.");for(;u;)try{if(m=1,b&&(y=w[0]&2?b.return:w[0]?b.throw||((y=b.return)&&y.call(b),0):b.next)&&!(y=y.call(b,w[1])).done)return y;switch(b=0,y&&(w=[w[0]&2,y.value]),w[0]){case 0:case 1:y=w;break;case 4:return u.label++,{value:w[1],done:!1};case 5:u.label++,b=w[1],w=[0];continue;case 7:w=u.ops.pop(),u.trys.pop();continue;default:if(y=u.trys,!(y=y.length>0&&y[y.length-1])&&(w[0]===6||w[0]===2)){u=0;continue}if(w[0]===3&&(!y||w[1]>y[0]&&w[1]<y[3])){u.label=w[1];break}if(w[0]===6&&u.label<y[1]){u.label=y[1],y=w;break}if(y&&u.label<y[2]){u.label=y[2],u.ops.push(w);break}y[2]&&u.ops.pop(),u.trys.pop();continue}w=d.call(M,u)}catch(W){w=[6,W],b=0}finally{m=y=0}if(w[0]&5)throw w[1];return{value:w[0]?w[1]:void 0,done:!0}}}var e=(function(){function M(d,u){this.next=null,this.key=d,this.data=u,this.left=null,this.right=null}return M})();function t(M,d){return M>d?1:M<d?-1:0}function r(M,d,u){for(var m=new e(null,null),b=m,y=m;;){var O=u(M,d.key);if(O<0){if(d.left===null)break;if(u(M,d.left.key)<0){var _=d.left;if(d.left=_.right,_.right=d,d=_,d.left===null)break}y.left=d,y=d,d=d.left}else if(O>0){if(d.right===null)break;if(u(M,d.right.key)>0){var _=d.right;if(d.right=_.left,_.left=d,d=_,d.right===null)break}b.right=d,b=d,d=d.right}else break}return b.right=d.left,y.left=d.right,d.left=m.right,d.right=m.left,d}function n(M,d,u,m){var b=new e(M,d);if(u===null)return b.left=b.right=null,b;u=r(M,u,m);var y=m(M,u.key);return y<0?(b.left=u.left,b.right=u,u.left=null):y>=0&&(b.right=u.right,b.left=u,u.right=null),b}function i(M,d,u){var m=null,b=null;if(d){d=r(M,d,u);var y=u(d.key,M);y===0?(m=d.left,b=d.right):y<0?(b=d.right,d.right=null,m=d):(m=d.left,d.left=null,b=d)}return{left:m,right:b}}function a(M,d,u){return d===null?M:(M===null||(d=r(M.key,d,u),d.left=M),d)}function s(M,d,u,m,b){if(M){m(""+d+(u?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+b(M)+`
|
|
2
2
|
`);var y=d+(u?" ":"\u2502 ");M.left&&s(M.left,y,!1,m,b),M.right&&s(M.right,y,!0,m,b)}}var l=(function(){function M(d){d===void 0&&(d=t),this._root=null,this._size=0,this._comparator=d}return M.prototype.insert=function(d,u){return this._size++,this._root=n(d,u,this._root,this._comparator)},M.prototype.add=function(d,u){var m=new e(d,u);this._root===null&&(m.left=m.right=null,this._size++,this._root=m);var b=this._comparator,y=r(d,this._root,b),O=b(d,y.key);return O===0?this._root=y:(O<0?(m.left=y.left,m.right=y,y.left=null):O>0&&(m.right=y.right,m.left=y,y.right=null),this._size++,this._root=m),this._root},M.prototype.remove=function(d){this._root=this._remove(d,this._root,this._comparator)},M.prototype._remove=function(d,u,m){var b;if(u===null)return null;u=r(d,u,m);var y=m(d,u.key);return y===0?(u.left===null?b=u.right:(b=r(d,u.left,m),b.right=u.right),this._size--,b):u},M.prototype.pop=function(){var d=this._root;if(d){for(;d.left;)d=d.left;return this._root=r(d.key,this._root,this._comparator),this._root=this._remove(d.key,this._root,this._comparator),{key:d.key,data:d.data}}return null},M.prototype.findStatic=function(d){for(var u=this._root,m=this._comparator;u;){var b=m(d,u.key);if(b===0)return u;b<0?u=u.left:u=u.right}return null},M.prototype.find=function(d){return this._root&&(this._root=r(d,this._root,this._comparator),this._comparator(d,this._root.key)!==0)?null:this._root},M.prototype.contains=function(d){for(var u=this._root,m=this._comparator;u;){var b=m(d,u.key);if(b===0)return!0;b<0?u=u.left:u=u.right}return!1},M.prototype.forEach=function(d,u){for(var m=this._root,b=[],y=!1;!y;)m!==null?(b.push(m),m=m.left):b.length!==0?(m=b.pop(),d.call(u,m),m=m.right):y=!0;return this},M.prototype.range=function(d,u,m,b){for(var y=[],O=this._comparator,_=this._root,F;y.length!==0||_;)if(_)y.push(_),_=_.left;else{if(_=y.pop(),F=O(_.key,u),F>0)break;if(O(_.key,d)>=0&&m.call(b,_))return this;_=_.right}return this},M.prototype.keys=function(){var d=[];return this.forEach(function(u){var m=u.key;return d.push(m)}),d},M.prototype.values=function(){var d=[];return this.forEach(function(u){var m=u.data;return d.push(m)}),d},M.prototype.min=function(){return this._root?this.minNode(this._root).key:null},M.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},M.prototype.minNode=function(d){if(d===void 0&&(d=this._root),d)for(;d.left;)d=d.left;return d},M.prototype.maxNode=function(d){if(d===void 0&&(d=this._root),d)for(;d.right;)d=d.right;return d},M.prototype.at=function(d){for(var u=this._root,m=!1,b=0,y=[];!m;)if(u)y.push(u),u=u.left;else if(y.length>0){if(u=y.pop(),b===d)return u;b++,u=u.right}else m=!0;return null},M.prototype.next=function(d){var u=this._root,m=null;if(d.right){for(m=d.right;m.left;)m=m.left;return m}for(var b=this._comparator;u;){var y=b(d.key,u.key);if(y===0)break;y<0?(m=u,u=u.left):u=u.right}return m},M.prototype.prev=function(d){var u=this._root,m=null;if(d.left!==null){for(m=d.left;m.right;)m=m.right;return m}for(var b=this._comparator;u;){var y=b(d.key,u.key);if(y===0)break;y<0?u=u.left:(m=u,u=u.right)}return m},M.prototype.clear=function(){return this._root=null,this._size=0,this},M.prototype.toList=function(){return h(this._root)},M.prototype.load=function(d,u,m){u===void 0&&(u=[]),m===void 0&&(m=!1);var b=d.length,y=this._comparator;if(m&&I(d,u,0,b-1,y),this._root===null)this._root=c(d,u,0,b),this._size=b;else{var O=T(this.toList(),p(d,u),y);b=this._size+b,this._root=g({head:O},0,b)}return this},M.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(M.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),M.prototype.toString=function(d){d===void 0&&(d=function(m){return String(m.key)});var u=[];return s(this._root,"",!0,function(m){return u.push(m)},d),u.join("")},M.prototype.update=function(d,u,m){var b=this._comparator,y=i(d,this._root,b),O=y.left,_=y.right;b(d,u)<0?_=n(u,m,_,b):O=n(u,m,O,b),this._root=a(O,_,b)},M.prototype.split=function(d){return i(d,this._root,this._comparator)},M.prototype[Symbol.iterator]=function(){var d,u,m;return o(this,function(b){switch(b.label){case 0:d=this._root,u=[],m=!1,b.label=1;case 1:return m?[3,6]:d===null?[3,2]:(u.push(d),d=d.left,[3,5]);case 2:return u.length===0?[3,4]:(d=u.pop(),[4,d]);case 3:return b.sent(),d=d.right,[3,5];case 4:m=!0,b.label=5;case 5:return[3,1];case 6:return[2]}})},M})();function c(M,d,u,m){var b=m-u;if(b>0){var y=u+Math.floor(b/2),O=M[y],_=d[y],F=new e(O,_);return F.left=c(M,d,u,y),F.right=c(M,d,y+1,m),F}return null}function p(M,d){for(var u=new e(null,null),m=u,b=0;b<M.length;b++)m=m.next=new e(M[b],d[b]);return m.next=null,u.next}function h(M){for(var d=M,u=[],m=!1,b=new e(null,null),y=b;!m;)d?(u.push(d),d=d.left):u.length>0?(d=y=y.next=u.pop(),d=d.right):m=!0;return y.next=null,b.next}function g(M,d,u){var m=u-d;if(m>0){var b=d+Math.floor(m/2),y=g(M,d,b),O=M.head;return O.left=y,M.head=M.head.next,O.right=g(M,b+1,u),O}return null}function T(M,d,u){for(var m=new e(null,null),b=m,y=M,O=d;y!==null&&O!==null;)u(y.key,O.key)<0?(b.next=y,y=y.next):(b.next=O,O=O.next),b=b.next;return y!==null?b.next=y:O!==null&&(b.next=O),m.next}function I(M,d,u,m,b){if(!(u>=m)){for(var y=M[u+m>>1],O=u-1,_=m+1;;){do O++;while(b(M[O],y)<0);do _--;while(b(M[_],y)>0);if(O>=_)break;var F=M[O];M[O]=M[_],M[_]=F,F=d[O],d[O]=d[_],d[_]=F}I(M,d,u,_,b),I(M,d,_+1,m,b)}}let E=(M,d)=>M.ll.x<=d.x&&d.x<=M.ur.x&&M.ll.y<=d.y&&d.y<=M.ur.y,D=(M,d)=>{if(d.ur.x<M.ll.x||M.ur.x<d.ll.x||d.ur.y<M.ll.y||M.ur.y<d.ll.y)return null;let u=M.ll.x<d.ll.x?d.ll.x:M.ll.x,m=M.ur.x<d.ur.x?M.ur.x:d.ur.x,b=M.ll.y<d.ll.y?d.ll.y:M.ll.y,y=M.ur.y<d.ur.y?M.ur.y:d.ur.y;return{ll:{x:u,y:b},ur:{x:m,y}}},x=Number.EPSILON;x===void 0&&(x=Math.pow(2,-52));let A=x*x,U=(M,d)=>{if(-x<M&&M<x&&-x<d&&d<x)return 0;let u=M-d;return u*u<A*M*d?0:M<d?-1:1};class R{constructor(){this.reset()}reset(){this.xRounder=new B,this.yRounder=new B}round(d,u){return{x:this.xRounder.round(d),y:this.yRounder.round(u)}}}class B{constructor(){this.tree=new l,this.round(0)}round(d){let u=this.tree.add(d),m=this.tree.prev(u);if(m!==null&&U(u.key,m.key)===0)return this.tree.remove(d),m.key;let b=this.tree.next(u);return b!==null&&U(u.key,b.key)===0?(this.tree.remove(d),b.key):d}}let V=new R,L=11102230246251565e-32,j=134217729,te=(3+8*L)*L;function ie(M,d,u,m,b){let y,O,_,F,w=d[0],W=m[0],P=0,k=0;W>w==W>-w?(y=w,w=d[++P]):(y=W,W=m[++k]);let G=0;if(P<M&&k<u)for(W>w==W>-w?(O=w+y,_=y-(O-w),w=d[++P]):(O=W+y,_=y-(O-W),W=m[++k]),y=O,_!==0&&(b[G++]=_);P<M&&k<u;)W>w==W>-w?(O=y+w,F=O-y,_=y-(O-F)+(w-F),w=d[++P]):(O=y+W,F=O-y,_=y-(O-F)+(W-F),W=m[++k]),y=O,_!==0&&(b[G++]=_);for(;P<M;)O=y+w,F=O-y,_=y-(O-F)+(w-F),w=d[++P],y=O,_!==0&&(b[G++]=_);for(;k<u;)O=y+W,F=O-y,_=y-(O-F)+(W-F),W=m[++k],y=O,_!==0&&(b[G++]=_);return(y!==0||G===0)&&(b[G++]=y),G}function oe(M,d){let u=d[0];for(let m=1;m<M;m++)u+=d[m];return u}function ce(M){return new Float64Array(M)}let Te=(3+16*L)*L,xe=(2+12*L)*L,Re=(9+64*L)*L*L,re=ce(4),Yt=ce(8),it=ce(12),Zt=ce(16),ue=ce(4);function ge(M,d,u,m,b,y,O){let _,F,w,W,P,k,G,J,z,K,q,fe,_e,ve,we,Ne,me,ye,at=M-b,st=u-b,Qe=d-y,Ke=m-y;ve=at*Ke,k=j*at,G=k-(k-at),J=at-G,k=j*Ke,z=k-(k-Ke),K=Ke-z,we=J*K-(ve-G*z-J*z-G*K),Ne=Qe*st,k=j*Qe,G=k-(k-Qe),J=Qe-G,k=j*st,z=k-(k-st),K=st-z,me=J*K-(Ne-G*z-J*z-G*K),q=we-me,P=we-q,re[0]=we-(q+P)+(P-me),fe=ve+q,P=fe-ve,_e=ve-(fe-P)+(q-P),q=_e-Ne,P=_e-q,re[1]=_e-(q+P)+(P-Ne),ye=fe+q,P=ye-fe,re[2]=fe-(ye-P)+(q-P),re[3]=ye;let Ae=oe(4,re),yo=xe*O;if(Ae>=yo||-Ae>=yo||(P=M-at,_=M-(at+P)+(P-b),P=u-st,w=u-(st+P)+(P-b),P=d-Qe,F=d-(Qe+P)+(P-y),P=m-Ke,W=m-(Ke+P)+(P-y),_===0&&F===0&&w===0&&W===0)||(yo=Re*O+te*Math.abs(Ae),Ae+=at*W+Ke*_-(Qe*w+st*F),Ae>=yo||-Ae>=yo))return Ae;ve=_*Ke,k=j*_,G=k-(k-_),J=_-G,k=j*Ke,z=k-(k-Ke),K=Ke-z,we=J*K-(ve-G*z-J*z-G*K),Ne=F*st,k=j*F,G=k-(k-F),J=F-G,k=j*st,z=k-(k-st),K=st-z,me=J*K-(Ne-G*z-J*z-G*K),q=we-me,P=we-q,ue[0]=we-(q+P)+(P-me),fe=ve+q,P=fe-ve,_e=ve-(fe-P)+(q-P),q=_e-Ne,P=_e-q,ue[1]=_e-(q+P)+(P-Ne),ye=fe+q,P=ye-fe,ue[2]=fe-(ye-P)+(q-P),ue[3]=ye;let Wn=ie(4,re,4,ue,Yt);ve=at*W,k=j*at,G=k-(k-at),J=at-G,k=j*W,z=k-(k-W),K=W-z,we=J*K-(ve-G*z-J*z-G*K),Ne=Qe*w,k=j*Qe,G=k-(k-Qe),J=Qe-G,k=j*w,z=k-(k-w),K=w-z,me=J*K-(Ne-G*z-J*z-G*K),q=we-me,P=we-q,ue[0]=we-(q+P)+(P-me),fe=ve+q,P=fe-ve,_e=ve-(fe-P)+(q-P),q=_e-Ne,P=_e-q,ue[1]=_e-(q+P)+(P-Ne),ye=fe+q,P=ye-fe,ue[2]=fe-(ye-P)+(q-P),ue[3]=ye;let ca=ie(Wn,Yt,4,ue,it);ve=_*W,k=j*_,G=k-(k-_),J=_-G,k=j*W,z=k-(k-W),K=W-z,we=J*K-(ve-G*z-J*z-G*K),Ne=F*w,k=j*F,G=k-(k-F),J=F-G,k=j*w,z=k-(k-w),K=w-z,me=J*K-(Ne-G*z-J*z-G*K),q=we-me,P=we-q,ue[0]=we-(q+P)+(P-me),fe=ve+q,P=fe-ve,_e=ve-(fe-P)+(q-P),q=_e-Ne,P=_e-q,ue[1]=_e-(q+P)+(P-Ne),ye=fe+q,P=ye-fe,ue[2]=fe-(ye-P)+(q-P),ue[3]=ye;let zn=ie(ca,it,4,ue,Zt);return Zt[zn-1]}function vt(M,d,u,m,b,y){let O=(d-y)*(u-b),_=(M-b)*(m-y),F=O-_,w=Math.abs(O+_);return Math.abs(F)>=Te*w?F:-ge(M,d,u,m,b,y,w)}let pe=(M,d)=>M.x*d.y-M.y*d.x,It=(M,d)=>M.x*d.x+M.y*d.y,le=(M,d,u)=>{let m=vt(M.x,M.y,d.x,d.y,u.x,u.y);return m>0?-1:m<0?1:0},Je=M=>Math.sqrt(It(M,M)),Dt=(M,d,u)=>{let m={x:d.x-M.x,y:d.y-M.y},b={x:u.x-M.x,y:u.y-M.y};return pe(b,m)/Je(b)/Je(m)},qe=(M,d,u)=>{let m={x:d.x-M.x,y:d.y-M.y},b={x:u.x-M.x,y:u.y-M.y};return It(b,m)/Je(b)/Je(m)},Oo=(M,d,u)=>d.y===0?null:{x:M.x+d.x/d.y*(u-M.y),y:u},mo=(M,d,u)=>d.x===0?null:{x:u,y:M.y+d.y/d.x*(u-M.x)},Xo=(M,d,u,m)=>{if(d.x===0)return mo(u,m,M.x);if(m.x===0)return mo(M,d,u.x);if(d.y===0)return Oo(u,m,M.y);if(m.y===0)return Oo(M,d,u.y);let b=pe(d,m);if(b==0)return null;let y={x:u.x-M.x,y:u.y-M.y},O=pe(y,d)/b,_=pe(y,m)/b,F=M.x+_*d.x,w=u.x+O*m.x,W=M.y+_*d.y,P=u.y+O*m.y,k=(F+w)/2,G=(W+P)/2;return{x:k,y:G}};class He{static compare(d,u){let m=He.comparePoints(d.point,u.point);return m!==0?m:(d.point!==u.point&&d.link(u),d.isLeft!==u.isLeft?d.isLeft?1:-1:$e.compare(d.segment,u.segment))}static comparePoints(d,u){return d.x<u.x?-1:d.x>u.x?1:d.y<u.y?-1:d.y>u.y?1:0}constructor(d,u){d.events===void 0?d.events=[this]:d.events.push(this),this.point=d,this.isLeft=u}link(d){if(d.point===this.point)throw new Error("Tried to link already linked events");let u=d.point.events;for(let m=0,b=u.length;m<b;m++){let y=u[m];this.point.events.push(y),y.point=this.point}this.checkForConsuming()}checkForConsuming(){let d=this.point.events.length;for(let u=0;u<d;u++){let m=this.point.events[u];if(m.segment.consumedBy===void 0)for(let b=u+1;b<d;b++){let y=this.point.events[b];y.consumedBy===void 0&&m.otherSE.point.events===y.otherSE.point.events&&m.segment.consume(y.segment)}}}getAvailableLinkedEvents(){let d=[];for(let u=0,m=this.point.events.length;u<m;u++){let b=this.point.events[u];b!==this&&!b.segment.ringOut&&b.segment.isInResult()&&d.push(b)}return d}getLeftmostComparator(d){let u=new Map,m=b=>{let y=b.otherSE;u.set(b,{sine:Dt(this.point,d.point,y.point),cosine:qe(this.point,d.point,y.point)})};return(b,y)=>{u.has(b)||m(b),u.has(y)||m(y);let{sine:O,cosine:_}=u.get(b),{sine:F,cosine:w}=u.get(y);return O>=0&&F>=0?_<w?1:_>w?-1:0:O<0&&F<0?_<w?-1:_>w?1:0:F<O?-1:F>O?1:0}}}let wt=0;class $e{static compare(d,u){let m=d.leftSE.point.x,b=u.leftSE.point.x,y=d.rightSE.point.x,O=u.rightSE.point.x;if(O<m)return 1;if(y<b)return-1;let _=d.leftSE.point.y,F=u.leftSE.point.y,w=d.rightSE.point.y,W=u.rightSE.point.y;if(m<b){if(F<_&&F<w)return 1;if(F>_&&F>w)return-1;let P=d.comparePoint(u.leftSE.point);if(P<0)return 1;if(P>0)return-1;let k=u.comparePoint(d.rightSE.point);return k!==0?k:-1}if(m>b){if(_<F&&_<W)return-1;if(_>F&&_>W)return 1;let P=u.comparePoint(d.leftSE.point);if(P!==0)return P;let k=d.comparePoint(u.rightSE.point);return k<0?1:k>0?-1:1}if(_<F)return-1;if(_>F)return 1;if(y<O){let P=u.comparePoint(d.rightSE.point);if(P!==0)return P}if(y>O){let P=d.comparePoint(u.rightSE.point);if(P<0)return 1;if(P>0)return-1}if(y!==O){let P=w-_,k=y-m,G=W-F,J=O-b;if(P>k&&G<J)return 1;if(P<k&&G>J)return-1}return y>O?1:y<O||w<W?-1:w>W?1:d.id<u.id?-1:d.id>u.id?1:0}constructor(d,u,m,b){this.id=++wt,this.leftSE=d,d.segment=this,d.otherSE=u,this.rightSE=u,u.segment=this,u.otherSE=d,this.rings=m,this.windings=b}static fromRing(d,u,m){let b,y,O,_=He.comparePoints(d,u);if(_<0)b=d,y=u,O=1;else if(_>0)b=u,y=d,O=-1;else throw new Error(`Tried to create degenerate segment at [${d.x}, ${d.y}]`);let F=new He(b,!0),w=new He(y,!1);return new $e(F,w,[m],[O])}replaceRightSE(d){this.rightSE=d,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}bbox(){let d=this.leftSE.point.y,u=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:d<u?d:u},ur:{x:this.rightSE.point.x,y:d>u?d:u}}}vector(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}isAnEndpoint(d){return d.x===this.leftSE.point.x&&d.y===this.leftSE.point.y||d.x===this.rightSE.point.x&&d.y===this.rightSE.point.y}comparePoint(d){if(this.isAnEndpoint(d))return 0;let u=this.leftSE.point,m=this.rightSE.point,b=this.vector();if(u.x===m.x)return d.x===u.x?0:d.x<u.x?1:-1;let y=(d.y-u.y)/b.y,O=u.x+y*b.x;if(d.x===O)return 0;let _=(d.x-u.x)/b.x,F=u.y+_*b.y;return d.y===F?0:d.y<F?-1:1}getIntersection(d){let u=this.bbox(),m=d.bbox(),b=D(u,m);if(b===null)return null;let y=this.leftSE.point,O=this.rightSE.point,_=d.leftSE.point,F=d.rightSE.point,w=E(u,_)&&this.comparePoint(_)===0,W=E(m,y)&&d.comparePoint(y)===0,P=E(u,F)&&this.comparePoint(F)===0,k=E(m,O)&&d.comparePoint(O)===0;if(W&&w)return k&&!P?O:!k&&P?F:null;if(W)return P&&y.x===F.x&&y.y===F.y?null:y;if(w)return k&&O.x===_.x&&O.y===_.y?null:_;if(k&&P)return null;if(k)return O;if(P)return F;let G=Xo(y,this.vector(),_,d.vector());return G===null||!E(b,G)?null:V.round(G.x,G.y)}split(d){let u=[],m=d.events!==void 0,b=new He(d,!0),y=new He(d,!1),O=this.rightSE;this.replaceRightSE(y),u.push(y),u.push(b);let _=new $e(b,O,this.rings.slice(),this.windings.slice());return He.comparePoints(_.leftSE.point,_.rightSE.point)>0&&_.swapEvents(),He.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),m&&(b.checkForConsuming(),y.checkForConsuming()),u}swapEvents(){let d=this.rightSE;this.rightSE=this.leftSE,this.leftSE=d,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(let u=0,m=this.windings.length;u<m;u++)this.windings[u]*=-1}consume(d){let u=this,m=d;for(;u.consumedBy;)u=u.consumedBy;for(;m.consumedBy;)m=m.consumedBy;let b=$e.compare(u,m);if(b!==0){if(b>0){let y=u;u=m,m=y}if(u.prev===m){let y=u;u=m,m=y}for(let y=0,O=m.rings.length;y<O;y++){let _=m.rings[y],F=m.windings[y],w=u.rings.indexOf(_);w===-1?(u.rings.push(_),u.windings.push(F)):u.windings[w]+=F}m.rings=null,m.windings=null,m.consumedBy=u,m.leftSE.consumedBy=u.leftSE,m.rightSE.consumedBy=u.rightSE}}prevInResult(){return this._prevInResult!==void 0?this._prevInResult:(this.prev?this.prev.isInResult()?this._prevInResult=this.prev:this._prevInResult=this.prev.prevInResult():this._prevInResult=null,this._prevInResult)}beforeState(){if(this._beforeState!==void 0)return this._beforeState;if(!this.prev)this._beforeState={rings:[],windings:[],multiPolys:[]};else{let d=this.prev.consumedBy||this.prev;this._beforeState=d.afterState()}return this._beforeState}afterState(){if(this._afterState!==void 0)return this._afterState;let d=this.beforeState();this._afterState={rings:d.rings.slice(0),windings:d.windings.slice(0),multiPolys:[]};let u=this._afterState.rings,m=this._afterState.windings,b=this._afterState.multiPolys;for(let _=0,F=this.rings.length;_<F;_++){let w=this.rings[_],W=this.windings[_],P=u.indexOf(w);P===-1?(u.push(w),m.push(W)):m[P]+=W}let y=[],O=[];for(let _=0,F=u.length;_<F;_++){if(m[_]===0)continue;let w=u[_],W=w.poly;if(O.indexOf(W)===-1)if(w.isExterior)y.push(W);else{O.indexOf(W)===-1&&O.push(W);let P=y.indexOf(w.poly);P!==-1&&y.splice(P,1)}}for(let _=0,F=y.length;_<F;_++){let w=y[_].multiPoly;b.indexOf(w)===-1&&b.push(w)}return this._afterState}isInResult(){if(this.consumedBy)return!1;if(this._isInResult!==void 0)return this._isInResult;let d=this.beforeState().multiPolys,u=this.afterState().multiPolys;switch(We.type){case"union":{let m=d.length===0,b=u.length===0;this._isInResult=m!==b;break}case"intersection":{let m,b;d.length<u.length?(m=d.length,b=u.length):(m=u.length,b=d.length),this._isInResult=b===We.numMultiPolys&&m<b;break}case"xor":{let m=Math.abs(d.length-u.length);this._isInResult=m%2===1;break}case"difference":{let m=b=>b.length===1&&b[0].isSubject;this._isInResult=m(d)!==m(u);break}default:throw new Error(`Unrecognized operation type found ${We.type}`)}return this._isInResult}}class St{constructor(d,u,m){if(!Array.isArray(d)||d.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=u,this.isExterior=m,this.segments=[],typeof d[0][0]!="number"||typeof d[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let b=V.round(d[0][0],d[0][1]);this.bbox={ll:{x:b.x,y:b.y},ur:{x:b.x,y:b.y}};let y=b;for(let O=1,_=d.length;O<_;O++){if(typeof d[O][0]!="number"||typeof d[O][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let F=V.round(d[O][0],d[O][1]);F.x===y.x&&F.y===y.y||(this.segments.push($e.fromRing(y,F,this)),F.x<this.bbox.ll.x&&(this.bbox.ll.x=F.x),F.y<this.bbox.ll.y&&(this.bbox.ll.y=F.y),F.x>this.bbox.ur.x&&(this.bbox.ur.x=F.x),F.y>this.bbox.ur.y&&(this.bbox.ur.y=F.y),y=F)}(b.x!==y.x||b.y!==y.y)&&this.segments.push($e.fromRing(y,b,this))}getSweepEvents(){let d=[];for(let u=0,m=this.segments.length;u<m;u++){let b=this.segments[u];d.push(b.leftSE),d.push(b.rightSE)}return d}}class Lr{constructor(d,u){if(!Array.isArray(d))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new St(d[0],this,!0),this.bbox={ll:{x:this.exteriorRing.bbox.ll.x,y:this.exteriorRing.bbox.ll.y},ur:{x:this.exteriorRing.bbox.ur.x,y:this.exteriorRing.bbox.ur.y}},this.interiorRings=[];for(let m=1,b=d.length;m<b;m++){let y=new St(d[m],this,!1);y.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=y.bbox.ll.x),y.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=y.bbox.ll.y),y.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=y.bbox.ur.x),y.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=y.bbox.ur.y),this.interiorRings.push(y)}this.multiPoly=u}getSweepEvents(){let d=this.exteriorRing.getSweepEvents();for(let u=0,m=this.interiorRings.length;u<m;u++){let b=this.interiorRings[u].getSweepEvents();for(let y=0,O=b.length;y<O;y++)d.push(b[y])}return d}}class $o{constructor(d,u){if(!Array.isArray(d))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");try{typeof d[0][0][0]=="number"&&(d=[d])}catch{}this.polys=[],this.bbox={ll:{x:Number.POSITIVE_INFINITY,y:Number.POSITIVE_INFINITY},ur:{x:Number.NEGATIVE_INFINITY,y:Number.NEGATIVE_INFINITY}};for(let m=0,b=d.length;m<b;m++){let y=new Lr(d[m],this);y.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=y.bbox.ll.x),y.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=y.bbox.ll.y),y.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=y.bbox.ur.x),y.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=y.bbox.ur.y),this.polys.push(y)}this.isSubject=u}getSweepEvents(){let d=[];for(let u=0,m=this.polys.length;u<m;u++){let b=this.polys[u].getSweepEvents();for(let y=0,O=b.length;y<O;y++)d.push(b[y])}return d}}class At{static factory(d){let u=[];for(let m=0,b=d.length;m<b;m++){let y=d[m];if(!y.isInResult()||y.ringOut)continue;let O=null,_=y.leftSE,F=y.rightSE,w=[_],W=_.point,P=[];for(;O=_,_=F,w.push(_),_.point!==W;)for(;;){let k=_.getAvailableLinkedEvents();if(k.length===0){let z=w[0].point,K=w[w.length-1].point;throw new Error(`Unable to complete output ring starting at [${z.x}, ${z.y}]. Last matching segment found ends at [${K.x}, ${K.y}].`)}if(k.length===1){F=k[0].otherSE;break}let G=null;for(let z=0,K=P.length;z<K;z++)if(P[z].point===_.point){G=z;break}if(G!==null){let z=P.splice(G)[0],K=w.splice(z.index);K.unshift(K[0].otherSE),u.push(new At(K.reverse()));continue}P.push({index:w.length,point:_.point});let J=_.getLeftmostComparator(O);F=k.sort(J)[0].otherSE;break}u.push(new At(w))}return u}constructor(d){this.events=d;for(let u=0,m=d.length;u<m;u++)d[u].segment.ringOut=this;this.poly=null}getGeom(){let d=this.events[0].point,u=[d];for(let w=1,W=this.events.length-1;w<W;w++){let P=this.events[w].point,k=this.events[w+1].point;le(P,d,k)!==0&&(u.push(P),d=P)}if(u.length===1)return null;let m=u[0],b=u[1];le(m,d,b)===0&&u.shift(),u.push(u[0]);let y=this.isExteriorRing()?1:-1,O=this.isExteriorRing()?0:u.length-1,_=this.isExteriorRing()?u.length:-1,F=[];for(let w=O;w!=_;w+=y)F.push([u[w].x,u[w].y]);return F}isExteriorRing(){if(this._isExteriorRing===void 0){let d=this.enclosingRing();this._isExteriorRing=d?!d.isExteriorRing():!0}return this._isExteriorRing}enclosingRing(){return this._enclosingRing===void 0&&(this._enclosingRing=this._calcEnclosingRing()),this._enclosingRing}_calcEnclosingRing(){let d=this.events[0];for(let b=1,y=this.events.length;b<y;b++){let O=this.events[b];He.compare(d,O)>0&&(d=O)}let u=d.segment.prevInResult(),m=u?u.prevInResult():null;for(;;){if(!u)return null;if(!m)return u.ringOut;if(m.ringOut!==u.ringOut)return m.ringOut.enclosingRing()!==u.ringOut?u.ringOut:u.ringOut.enclosingRing();u=m.prevInResult(),m=u?u.prevInResult():null}}}class Do{constructor(d){this.exteriorRing=d,d.poly=this,this.interiorRings=[]}addInterior(d){this.interiorRings.push(d),d.poly=this}getGeom(){let d=[this.exteriorRing.getGeom()];if(d[0]===null)return null;for(let u=0,m=this.interiorRings.length;u<m;u++){let b=this.interiorRings[u].getGeom();b!==null&&d.push(b)}return d}}class Yo{constructor(d){this.rings=d,this.polys=this._composePolys(d)}getGeom(){let d=[];for(let u=0,m=this.polys.length;u<m;u++){let b=this.polys[u].getGeom();b!==null&&d.push(b)}return d}_composePolys(d){let u=[];for(let m=0,b=d.length;m<b;m++){let y=d[m];if(!y.poly)if(y.isExteriorRing())u.push(new Do(y));else{let O=y.enclosingRing();O.poly||u.push(new Do(O)),O.poly.addInterior(y)}}return u}}class jn{constructor(d){let u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:$e.compare;this.queue=d,this.tree=new l(u),this.segments=[]}process(d){let u=d.segment,m=[];if(d.consumedBy)return d.isLeft?this.queue.remove(d.otherSE):this.tree.remove(u),m;let b=d.isLeft?this.tree.add(u):this.tree.find(u);if(!b)throw new Error(`Unable to find segment #${u.id} [${u.leftSE.point.x}, ${u.leftSE.point.y}] -> [${u.rightSE.point.x}, ${u.rightSE.point.y}] in SweepLine tree.`);let y=b,O=b,_,F;for(;_===void 0;)y=this.tree.prev(y),y===null?_=null:y.key.consumedBy===void 0&&(_=y.key);for(;F===void 0;)O=this.tree.next(O),O===null?F=null:O.key.consumedBy===void 0&&(F=O.key);if(d.isLeft){let w=null;if(_){let P=_.getIntersection(u);if(P!==null&&(u.isAnEndpoint(P)||(w=P),!_.isAnEndpoint(P))){let k=this._splitSafely(_,P);for(let G=0,J=k.length;G<J;G++)m.push(k[G])}}let W=null;if(F){let P=F.getIntersection(u);if(P!==null&&(u.isAnEndpoint(P)||(W=P),!F.isAnEndpoint(P))){let k=this._splitSafely(F,P);for(let G=0,J=k.length;G<J;G++)m.push(k[G])}}if(w!==null||W!==null){let P=null;w===null?P=W:W===null?P=w:P=He.comparePoints(w,W)<=0?w:W,this.queue.remove(u.rightSE),m.push(u.rightSE);let k=u.split(P);for(let G=0,J=k.length;G<J;G++)m.push(k[G])}m.length>0?(this.tree.remove(u),m.push(d)):(this.segments.push(u),u.prev=_)}else{if(_&&F){let w=_.getIntersection(F);if(w!==null){if(!_.isAnEndpoint(w)){let W=this._splitSafely(_,w);for(let P=0,k=W.length;P<k;P++)m.push(W[P])}if(!F.isAnEndpoint(w)){let W=this._splitSafely(F,w);for(let P=0,k=W.length;P<k;P++)m.push(W[P])}}}this.tree.remove(u)}return m}_splitSafely(d,u){this.tree.remove(d);let m=d.rightSE;this.queue.remove(m);let b=d.split(u);return b.push(m),d.consumedBy===void 0&&this.tree.add(d),b}}let Rr=typeof S<"u"&&S.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,Gn=typeof S<"u"&&S.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Nr{run(d,u,m){We.type=d,V.reset();let b=[new $o(u,!0)];for(let P=0,k=m.length;P<k;P++)b.push(new $o(m[P],!1));if(We.numMultiPolys=b.length,We.type==="difference"){let P=b[0],k=1;for(;k<b.length;)D(b[k].bbox,P.bbox)!==null?k++:b.splice(k,1)}if(We.type==="intersection")for(let P=0,k=b.length;P<k;P++){let G=b[P];for(let J=P+1,z=b.length;J<z;J++)if(D(G.bbox,b[J].bbox)===null)return[]}let y=new l(He.compare);for(let P=0,k=b.length;P<k;P++){let G=b[P].getSweepEvents();for(let J=0,z=G.length;J<z;J++)if(y.insert(G[J]),y.size>Rr)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let O=new jn(y),_=y.size,F=y.pop();for(;F;){let P=F.key;if(y.size===_){let G=P.segment;throw new Error(`Unable to pop() ${P.isLeft?"left":"right"} SweepEvent [${P.point.x}, ${P.point.y}] from segment #${G.id} [${G.leftSE.point.x}, ${G.leftSE.point.y}] -> [${G.rightSE.point.x}, ${G.rightSE.point.y}] from queue.`)}if(y.size>Rr)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(O.segments.length>Gn)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let k=O.process(P);for(let G=0,J=k.length;G<J;G++){let z=k[G];z.consumedBy===void 0&&y.insert(z)}_=y.size,F=y.pop()}V.reset();let w=At.factory(O.segments);return new Yo(w).getGeom()}}let We=new Nr;var Hn={union:function(M){for(var d=arguments.length,u=new Array(d>1?d-1:0),m=1;m<d;m++)u[m-1]=arguments[m];return We.run("union",M,u)},intersection:function(M){for(var d=arguments.length,u=new Array(d>1?d-1:0),m=1;m<d;m++)u[m-1]=arguments[m];return We.run("intersection",M,u)},xor:function(M){for(var d=arguments.length,u=new Array(d>1?d-1:0),m=1;m<d;m++)u[m-1]=arguments[m];return We.run("xor",M,u)},difference:function(M){for(var d=arguments.length,u=new Array(d>1?d-1:0),m=1;m<d;m++)u[m-1]=arguments[m];return We.run("difference",M,u)}};return Hn}))});var $t=Se(Tt=>{"use strict";f();Tt.__esModule=!0;Tt.extend=Au;Tt.indexOf=zm;Tt.escapeExpression=Xm;Tt.isEmpty=$m;Tt.createFrame=Ym;Tt.blockParams=Zm;Tt.appendContextPath=Jm;var Gm={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","=":"="},Um=/[&<>"'`=]/g,Hm=/[&<>"'`=]/;function Wm(o){return Gm[o]}function Au(o){for(var e=1;e<arguments.length;e++)for(var t in arguments[e])Object.prototype.hasOwnProperty.call(arguments[e],t)&&(o[t]=arguments[e][t]);return o}var tl=Object.prototype.toString;Tt.toString=tl;var el=function(e){return typeof e=="function"};el(/x/)&&(Tt.isFunction=el=function(o){return typeof o=="function"&&tl.call(o)==="[object Function]"});Tt.isFunction=el;var Fu=Array.isArray||function(o){return o&&typeof o=="object"?tl.call(o)==="[object Array]":!1};Tt.isArray=Fu;function zm(o,e){for(var t=0,r=o.length;t<r;t++)if(o[t]===e)return t;return-1}function Xm(o){if(typeof o!="string"){if(o&&o.toHTML)return o.toHTML();if(o==null)return"";if(!o)return o+"";o=""+o}return Hm.test(o)?o.replace(Um,Wm):o}function $m(o){return!o&&o!==0?!0:!!(Fu(o)&&o.length===0)}function Ym(o){var e=Au({},o);return e._parent=o,e}function Zm(o,e){return o.path=e,o}function Jm(o,e){return(o?o+".":"")+e}});var _o=Se((ji,ku)=>{"use strict";f();ji.__esModule=!0;var ol=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function rl(o,e){var t=e&&e.loc,r=void 0,n=void 0,i=void 0,a=void 0;t&&(r=t.start.line,n=t.end.line,i=t.start.column,a=t.end.column,o+=" - "+r+":"+i);for(var s=Error.prototype.constructor.call(this,o),l=0;l<ol.length;l++)this[ol[l]]=s[ol[l]];Error.captureStackTrace&&Error.captureStackTrace(this,rl);try{t&&(this.lineNumber=r,this.endLineNumber=n,Object.defineProperty?(Object.defineProperty(this,"column",{value:i,enumerable:!0}),Object.defineProperty(this,"endColumn",{value:a,enumerable:!0})):(this.column=i,this.endColumn=a))}catch{}}rl.prototype=new Error;ji.default=rl;ku.exports=ji.default});var Ru=Se((Gi,Lu)=>{"use strict";f();Gi.__esModule=!0;var nl=$t();Gi.default=function(o){o.registerHelper("blockHelperMissing",function(e,t){var r=t.inverse,n=t.fn;if(e===!0)return n(this);if(e===!1||e==null)return r(this);if(nl.isArray(e))return e.length>0?(t.ids&&(t.ids=[t.name]),o.helpers.each(e,t)):r(this);if(t.data&&t.ids){var i=nl.createFrame(t.data);i.contextPath=nl.appendContextPath(t.data.contextPath,t.name),t={data:i}}return n(e,t)})};Lu.exports=Gi.default});var Bu=Se((Ui,Nu)=>{"use strict";f();Ui.__esModule=!0;function qm(o){return o&&o.__esModule?o:{default:o}}var Pn=$t(),Qm=_o(),Km=qm(Qm);Ui.default=function(o){o.registerHelper("each",function(e,t){if(!t)throw new Km.default("Must pass iterator to #each");var r=t.fn,n=t.inverse,i=0,a="",s=void 0,l=void 0;t.data&&t.ids&&(l=Pn.appendContextPath(t.data.contextPath,t.ids[0])+"."),Pn.isFunction(e)&&(e=e.call(this)),t.data&&(s=Pn.createFrame(t.data));function c(I,E,D){s&&(s.key=I,s.index=E,s.first=E===0,s.last=!!D,l&&(s.contextPath=l+I)),a=a+r(e[I],{data:s,blockParams:Pn.blockParams([e[I],I],[l+I,null])})}if(e&&typeof e=="object")if(Pn.isArray(e))for(var p=e.length;i<p;i++)i in e&&c(i,i,i===e.length-1);else if(typeof Symbol=="function"&&e[Symbol.iterator]){for(var h=[],g=e[Symbol.iterator](),T=g.next();!T.done;T=g.next())h.push(T.value);e=h;for(var p=e.length;i<p;i++)c(i,i,i===e.length-1)}else(function(){var I=void 0;Object.keys(e).forEach(function(E){I!==void 0&&c(I,i-1),I=E,i++}),I!==void 0&&c(I,i-1,!0)})();return i===0&&(a=n(this)),a})};Nu.exports=Ui.default});var ju=Se((Hi,Vu)=>{"use strict";f();Hi.__esModule=!0;function ey(o){return o&&o.__esModule?o:{default:o}}var ty=_o(),oy=ey(ty);Hi.default=function(o){o.registerHelper("helperMissing",function(){if(arguments.length!==1)throw new oy.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})};Vu.exports=Hi.default});var Wu=Se((Wi,Hu)=>{"use strict";f();Wi.__esModule=!0;function ry(o){return o&&o.__esModule?o:{default:o}}var Gu=$t(),ny=_o(),Uu=ry(ny);Wi.default=function(o){o.registerHelper("if",function(e,t){if(arguments.length!=2)throw new Uu.default("#if requires exactly one argument");return Gu.isFunction(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||Gu.isEmpty(e)?t.inverse(this):t.fn(this)}),o.registerHelper("unless",function(e,t){if(arguments.length!=2)throw new Uu.default("#unless requires exactly one argument");return o.helpers.if.call(this,e,{fn:t.inverse,inverse:t.fn,hash:t.hash})})};Hu.exports=Wi.default});var Xu=Se((zi,zu)=>{"use strict";f();zi.__esModule=!0;zi.default=function(o){o.registerHelper("log",function(){for(var e=[void 0],t=arguments[arguments.length-1],r=0;r<arguments.length-1;r++)e.push(arguments[r]);var n=1;t.hash.level!=null?n=t.hash.level:t.data&&t.data.level!=null&&(n=t.data.level),e[0]=n,o.log.apply(o,e)})};zu.exports=zi.default});var Yu=Se((Xi,$u)=>{"use strict";f();Xi.__esModule=!0;Xi.default=function(o){o.registerHelper("lookup",function(e,t,r){return e&&r.lookupProperty(e,t)})};$u.exports=Xi.default});var Ju=Se(($i,Zu)=>{"use strict";f();$i.__esModule=!0;function iy(o){return o&&o.__esModule?o:{default:o}}var On=$t(),ay=_o(),sy=iy(ay);$i.default=function(o){o.registerHelper("with",function(e,t){if(arguments.length!=2)throw new sy.default("#with requires exactly one argument");On.isFunction(e)&&(e=e.call(this));var r=t.fn;if(On.isEmpty(e))return t.inverse(this);var n=t.data;return t.data&&t.ids&&(n=On.createFrame(t.data),n.contextPath=On.appendContextPath(t.data.contextPath,t.ids[0])),r(e,{data:n,blockParams:On.blockParams([e],[n&&n.contextPath])})})};Zu.exports=$i.default});var il=Se(Yi=>{"use strict";f();Yi.__esModule=!0;Yi.registerDefaultHelpers=Sy;Yi.moveHelperToHooks=Ey;function Ho(o){return o&&o.__esModule?o:{default:o}}var ly=Ru(),cy=Ho(ly),py=Bu(),dy=Ho(py),uy=ju(),fy=Ho(uy),hy=Wu(),gy=Ho(hy),my=Xu(),yy=Ho(my),by=Yu(),Ty=Ho(by),vy=Ju(),Iy=Ho(vy);function Sy(o){cy.default(o),dy.default(o),fy.default(o),gy.default(o),yy.default(o),Ty.default(o),Iy.default(o)}function Ey(o,e,t){o.helpers[e]&&(o.hooks[e]=o.helpers[e],t||(o.helpers[e]=void 0))}});var Qu=Se((Zi,qu)=>{"use strict";f();Zi.__esModule=!0;var My=$t();Zi.default=function(o){o.registerDecorator("inline",function(e,t,r,n){var i=e;return t.partials||(t.partials={},i=function(a,s){var l=r.partials;r.partials=My.extend({},l,t.partials);var c=e(a,s);return r.partials=l,c}),t.partials[n.args[0]]=n.fn,i})};qu.exports=Zi.default});var Ku=Se(al=>{"use strict";f();al.__esModule=!0;al.registerDefaultDecorators=Py;function xy(o){return o&&o.__esModule?o:{default:o}}var Cy=Qu(),_y=xy(Cy);function Py(o){_y.default(o)}});var sl=Se((Ji,ef)=>{"use strict";f();Ji.__esModule=!0;var Oy=$t(),_r={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(e){if(typeof e=="string"){var t=Oy.indexOf(_r.methodMap,e.toLowerCase());t>=0?e=t:e=parseInt(e,10)}return e},log:function(e){if(e=_r.lookupLevel(e),typeof console<"u"&&_r.lookupLevel(_r.level)<=e){var t=_r.methodMap[e];console[t]||(t="log");for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++)n[i-1]=arguments[i];console[t].apply(console,n)}}};Ji.default=_r;ef.exports=Ji.default});var ll=Se(Dn=>{"use strict";f();Dn.__esModule=!0;Dn.createProtoAccessControl=Fy;Dn.resultIsAllowed=ky;Dn.resetLoggedProperties=Ry;function Dy(o){return o&&o.__esModule?o:{default:o}}var tf=$t(),wy=sl(),Ay=Dy(wy),qi=Object.create(null);function Fy(o){var e=Object.create(null);e.__proto__=!1,tf.extend(e,o.allowedProtoProperties);var t=Object.create(null);return t.constructor=!1,t.__defineGetter__=!1,t.__defineSetter__=!1,t.__lookupGetter__=!1,t.__lookupSetter__=!1,tf.extend(t,o.allowedProtoMethods),{properties:{whitelist:e,defaultValue:o.allowProtoPropertiesByDefault},methods:{whitelist:t,defaultValue:o.allowProtoMethodsByDefault}}}function ky(o,e,t){return of(typeof o=="function"?e.methods:e.properties,t)}function of(o,e){return o.whitelist[e]!==void 0?o.whitelist[e]===!0:o.defaultValue!==void 0?o.defaultValue:(Ly(e),!1)}function Ly(o){qi[o]!==!0&&(qi[o]=!0,Ay.default.log("error",'Handlebars: Access has been denied to resolve the property "'+o+`" because it is not an "own property" of its parent.
|
|
3
3
|
You can add a runtime option to disable the check or this warning:
|
|
4
4
|
See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-control-prototype-access for details`))}function Ry(){Object.keys(qi).forEach(function(o){delete qi[o]})}});var ul=Se(io=>{"use strict";f();io.__esModule=!0;io.HandlebarsEnvironment=dl;function rf(o){return o&&o.__esModule?o:{default:o}}var Wo=$t(),Ny=_o(),cl=rf(Ny),By=il(),Vy=Ku(),jy=sl(),Qi=rf(jy),Gy=ll(),Uy="4.7.9";io.VERSION=Uy;var Hy=8;io.COMPILER_REVISION=Hy;var Wy=7;io.LAST_COMPATIBLE_COMPILER_REVISION=Wy;var zy={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1",7:">= 4.0.0 <4.3.0",8:">= 4.3.0"};io.REVISION_CHANGES=zy;var pl="[object Object]";function dl(o,e,t){this.helpers=o||{},this.partials=e||{},this.decorators=t||{},By.registerDefaultHelpers(this),Vy.registerDefaultDecorators(this)}dl.prototype={constructor:dl,logger:Qi.default,log:Qi.default.log,registerHelper:function(e,t){if(Wo.toString.call(e)===pl){if(t)throw new cl.default("Arg not supported with multiple helpers");Wo.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if(Wo.toString.call(e)===pl)Wo.extend(this.partials,e);else{if(typeof t>"u")throw new cl.default('Attempting to register a partial called "'+e+'" as undefined');this.partials[e]=t}},unregisterPartial:function(e){delete this.partials[e]},registerDecorator:function(e,t){if(Wo.toString.call(e)===pl){if(t)throw new cl.default("Arg not supported with multiple decorators");Wo.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]},resetLoggedPropertyAccesses:function(){Gy.resetLoggedProperties()}};var Xy=Qi.default.log;io.log=Xy;io.createFrame=Wo.createFrame;io.logger=Qi.default});var af=Se((Ki,nf)=>{"use strict";f();Ki.__esModule=!0;function fl(o){this.string=o}fl.prototype.toString=fl.prototype.toHTML=function(){return""+this.string};Ki.default=fl;nf.exports=Ki.default});var sf=Se(hl=>{"use strict";f();hl.__esModule=!0;hl.wrapHelper=$y;function $y(o,e){if(typeof o!="function")return o;var t=function(){var n=arguments[arguments.length-1];return arguments[arguments.length-1]=e(n),o.apply(this,arguments)};return t}});var ff=Se(Po=>{"use strict";f();Po.__esModule=!0;Po.checkRevision=Ky;Po.template=e1;Po.wrapProgram=ea;Po.resolvePartial=t1;Po.invokePartial=o1;Po.noop=df;function Yy(o){return o&&o.__esModule?o:{default:o}}function Zy(o){if(o&&o.__esModule)return o;var e={};if(o!=null)for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t]);return e.default=o,e}var Jy=$t(),Pr=Zy(Jy),qy=_o(),ho=Yy(qy),go=ul(),lf=il(),Qy=sf(),cf=ll();function Ky(o){var e=o&&o[0]||1,t=go.COMPILER_REVISION;if(!(e>=go.LAST_COMPATIBLE_COMPILER_REVISION&&e<=go.COMPILER_REVISION))if(e<go.LAST_COMPATIBLE_COMPILER_REVISION){var r=go.REVISION_CHANGES[t],n=go.REVISION_CHANGES[e];throw new ho.default("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+r+") or downgrade your runtime to an older version ("+n+").")}else throw new ho.default("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+o[1]+").")}function e1(o,e){if(!e)throw new ho.default("No environment passed to template");if(!o||!o.main)throw new ho.default("Unknown template object: "+typeof o);o.main.decorator=o.main_d,e.VM.checkRevision(o.compiler);var t=o.compiler&&o.compiler[0]===7;function r(a,s,l){l.hash&&(s=Pr.extend({},s,l.hash),l.ids&&(l.ids[0]=!0)),a=e.VM.resolvePartial.call(this,a,s,l),l.hooks=this.hooks,l.protoAccessControl=this.protoAccessControl;var c=e.VM.invokePartial.call(this,a,s,l);if(c==null&&e.compile&&(l.partials[l.name]=e.compile(a,o.compilerOptions,e),c=l.partials[l.name](s,l)),c!=null){if(l.indent){for(var p=c.split(`
|
|
5
5
|
`),h=0,g=p.length;h<g&&!(!p[h]&&h+1===g);h++)p[h]=l.indent+p[h];c=p.join(`
|
|
6
|
-
`)}return c}else throw new ho.default("The partial "+l.name+" could not be compiled when running in runtime-only mode")}var n={strict:function(s,l,c){if(!s||!(l in s))throw new ho.default('"'+l+'" not defined in '+s,{loc:c});return n.lookupProperty(s,l)},lookupProperty:function(s,l){var c=s[l];if(c==null||Object.prototype.hasOwnProperty.call(s,l)||cf.resultIsAllowed(c,n.protoAccessControl,l))return c},lookup:function(s,l){for(var c=s.length,p=0;p<c;p++){var h=s[p]&&n.lookupProperty(s[p],l);if(h!=null)return h}},lambda:function(s,l){return typeof s=="function"?s.call(l):s},escapeExpression:Pr.escapeExpression,invokePartial:r,fn:function(s){var l=o[s];return l.decorator=o[s+"_d"],l},programs:[],program:function(s,l,c,p,h){var g=this.programs[s],T=this.fn(s);return l||h||p||c?g=ea(this,s,T,l,c,p,h):g||(g=this.programs[s]=ea(this,s,T)),g},data:function(s,l){for(;s&&l--;)s=s._parent;return s},mergeIfNeeded:function(s,l){var c=s||l;return s&&l&&s!==l&&(c=Pr.extend({},l,s)),c},nullContext:Object.seal({}),noop:e.VM.noop,compilerInfo:o.compiler};function i(a){var s=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],l=s.data;i._setup(s),!s.partial&&o.useData&&(l=r1(a,l));var c=void 0,p=o.useBlockParams?[]:void 0;o.useDepths&&(s.depths?c=a!=s.depths[0]?[a].concat(s.depths):s.depths:c=[a]);function h(g){return""+o.main(n,g,n.helpers,n.partials,l,p,c)}return h=uf(o.main,h,n,s.depths||[],l,p),h(a,s)}return i.isTop=!0,i._setup=function(a){if(a.partial)n.protoAccessControl=a.protoAccessControl,n.helpers=a.helpers,n.partials=a.partials,n.decorators=a.decorators,n.hooks=a.hooks;else{var s={};pf(s,e.helpers,n),pf(s,a.helpers,n),n.helpers=s,o.usePartial&&(n.partials=n.mergeIfNeeded(a.partials,e.partials)),(o.usePartial||o.useDecorators)&&(n.decorators=Pr.extend({},e.decorators,a.decorators)),n.hooks={},n.protoAccessControl=cf.createProtoAccessControl(a);var l=a.allowCallsToHelperMissing||t;lf.moveHelperToHooks(n,"helperMissing",l),lf.moveHelperToHooks(n,"blockHelperMissing",l)}},i._child=function(a,s,l,c){if(o.useBlockParams&&!l)throw new ho.default("must pass block params");if(o.useDepths&&!c)throw new ho.default("must pass parent depths");return ea(n,a,o[a],s,0,l,c)},i}function ea(o,e,t,r,n,i,a){function s(l){var c=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],p=a;return a&&l!=a[0]&&!(l===o.nullContext&&a[0]===null)&&(p=[l].concat(a)),t(o,l,o.helpers,o.partials,c.data||r,i&&[c.blockParams].concat(i),p)}return s=uf(t,s,o,a,r,i),s.program=e,s.depth=a?a.length:0,s.blockParams=n||0,s}function t1(o,e,t){return o?!o.call&&!t.name&&(t.name=o,o=ta(t.partials,o)):t.name==="@partial-block"?o=ta(t.data,"partial-block"):o=ta(t.partials,t.name),o}function o1(o,e,t){var r=ta(t.data,"partial-block");t.partial=!0,t.ids&&(t.data.contextPath=t.ids[0]||t.data.contextPath);var n=void 0;if(t.fn&&t.fn!==df&&(function(){t.data=go.createFrame(t.data);var i=t.fn;n=t.data["partial-block"]=function(s){var l=arguments.length<=1||arguments[1]===void 0?{}:arguments[1];return l.data=go.createFrame(l.data),l.data["partial-block"]=r,i(s,l)},i.partials&&(t.partials=Pr.extend({},t.partials,i.partials))})(),o===void 0&&n&&(o=n),o===void 0)throw new ho.default("The partial "+t.name+" could not be found");if(o instanceof Function)return o(e,t)}function df(){return""}function ta(o,e){if(o&&Object.prototype.hasOwnProperty.call(o,e))return o[e]}function r1(o,e){return(!e||!("root"in e))&&(e=e?go.createFrame(e):{},e.root=o),e}function uf(o,e,t,r,n,i){if(o.decorator){var a={};e=o.decorator(e,a,t,r&&r[0],n,i,r),Pr.extend(e,a)}return e}function pf(o,e,t){e&&Object.keys(e).forEach(function(r){var n=e[r];o[r]=n1(n,t)})}function n1(o,e){var t=e.lookupProperty;return Qy.wrapHelper(o,function(r){return r.lookupProperty=t,r})}});var gf=Se((oa,hf)=>{"use strict";f();oa.__esModule=!0;oa.default=function(o){(function(){typeof globalThis!="object"&&(Object.prototype.__defineGetter__("__magic__",function(){return this}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var e=globalThis.Handlebars;o.noConflict=function(){return globalThis.Handlebars===o&&(globalThis.Handlebars=e),o}};hf.exports=oa.default});var vf=Se((ra,Tf)=>{"use strict";f();ra.__esModule=!0;function ml(o){return o&&o.__esModule?o:{default:o}}function yl(o){if(o&&o.__esModule)return o;var e={};if(o!=null)for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t]);return e.default=o,e}var i1=ul(),mf=yl(i1),a1=af(),s1=ml(a1),l1=_o(),c1=ml(l1),p1=$t(),gl=yl(p1),d1=ff(),yf=yl(d1),u1=gf(),f1=ml(u1);function bf(){var o=new mf.HandlebarsEnvironment;return gl.extend(o,mf),o.SafeString=s1.default,o.Exception=c1.default,o.Utils=gl,o.escapeExpression=gl.escapeExpression,o.VM=yf,o.template=function(e){return yf.template(e,o)},o}var wn=bf();wn.create=bf;f1.default(wn);wn.default=wn;ra.default=wn;Tf.exports=ra.default});var Sf=Se((d_,If)=>{f();If.exports=vf().default});f();f();f();f();f();var pc="mi-session-data",dc="mi-local-data",Kn="id",ei="deviceId",Lt=class o{static#e;#t;#o;constructor(){try{let e=sessionStorage.getItem(pc);e?this.#t=JSON.parse(e):this.#t={[Kn]:ee()}}catch{this.#t={[Kn]:ee()}}try{let e=localStorage.getItem(dc);e?this.#o=JSON.parse(e):this.#o={[ei]:ee()}}catch{this.#o={[ei]:ee()}}this.#t[Kn]||(this.#t[Kn]=ee()),this.#o[ei]||(this.#o[ei]=ee())}static getInstance(){return this.#e||(this.#e=new o),this.#e}static ___clearInstance(){this.#e=void 0}saveSessionData(e,t){this.#t[e]=t;try{return sessionStorage.setItem(pc,JSON.stringify(this.#t)),!0}catch{return!1}}loadSessionData(e){let t=this.#t[e];if(t!=null)return t}saveLocalData(e,t){this.#o[e]=t;try{return localStorage.setItem(dc,JSON.stringify(this.#o)),!0}catch{return!1}}loadLocalData(e){let t=this.#o[e];if(t!=null)return t}};f();f();var er=o=>o!=null;var yh=(function(){let e=globalThis.fetch;return{fetch(...t){if(!er(e))throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return e?.(...t)},setFetch(t){e=t}}})(),uc=yh.fetch;var yc=["websdk","web","webv2","kiosk","kiosk-v2","mobile","iossdk","androidsdk","reactnativesdk","gen7","bespoke","reactsdk","minimap"],fc=yc[0],bc="https://api-gateway.mappedin.com/track-analytics/a/",Tc="deny-watchposition",vc="load-mapview",Ic="load-mapdata",Sc="change-language",Ec="query-directions";var tr=class{#e=Object.freeze({});#t;oneTimeEventsSent=new Set;constructor(){this.#t=this.#r(this.#e)}init(e){this.reset(),this.updateStateWithOptions(e)}reset(){this.#e={},this.#t=this.#r({}),this.oneTimeEventsSent.clear()}updateStateWithOptions(e){return this.#e=Object.freeze(Object.assign({},this.#e,e)),this.#t=this.#r(e),this.#o(this.#t),this.#t}#o(e){e.sessionId&&Lt.getInstance().saveSessionData("id",e.sessionId),e.deviceId&&Lt.getInstance().saveLocalData("deviceId",e.deviceId)}#r(e){let t=e.baseUri??bc;return{baseUri:t,analyticsBaseUrl:Ma({...e,baseUri:t}),version:e.version||S?.env?.npm_package_version||"v6",deviceId:e.deviceId||hc(),accessToken:e.accessToken,mapId:e.mapId,sessionId:e.sessionId||gc(),platformString:e.platformString||"",context:mc(e.context)||fc,geolocationMode:!1,sendEvents:e.sendEvents??!0,logEvents:e.logEvents??!1,noAuth:e.noAuth||!1,key:e.key,secret:e.secret,enterprise:e.enterprise??!1,externalId:e.externalId}}updateState(e){let t={...e};t.mapId&&(t.analyticsBaseUrl=Ma({...this.#t,mapId:t.mapId})),t.context&&(t.context=mc(t.context)),t.baseUri&&(t.analyticsBaseUrl=Ma({baseUri:t.baseUri,mapId:this.#t.mapId})),Object.assign(this.#t,t),this.handleStateUpdate(e),this.#o(t)}handleStateUpdate(e){e.userPosition?.floorLevel?this.sendBlueDotEvents("found-floor"):e.userPosition&&this.sendBlueDotEvents("found-position")}get authReady(){let{key:e,secret:t,accessToken:r}=this.getState();return!!(e&&t)||!!r}getState(){return this.#t}getContext(){return this.getState().context||this.#e.context||fc}getSessionId(){return this.getState().sessionId||this.#e.sessionId||gc()}getDeviceId(){return this.getState().deviceId||this.#e.deviceId||hc()}sendAnalyticEvent(e,t={}){let r=this.getState(),n=bh(r.analyticsBaseUrl,e),i={"mi-context":this.getContext(),"mi-session":this.getSessionId(),"mi-device":this.getDeviceId()};if(r.logEvents&&C.log("Analytics.track",n,i),!r.sendEvents)return Promise.resolve();if(!this.authReady)return!r.key&&!r.secret&&!r.accessToken?void 0:C.warn("Auth needs to be ready to send analytics.");let a={...t,g:r.geolocationMode,sdk_version:r.version,...r.externalId?{externalId:r.externalId}:{}};return r.userPosition&&Object.assign(a,r.userPosition),i["Content-Type"]="application/json",!r.noAuth&&r.enterprise&&r.secret&&r.key?(i["x-mappedin-key"]=btoa(r.key),i["x-mappedin-secret"]=btoa(r.secret)):r.accessToken&&(i.Authorization=`Bearer ${r.accessToken}`),uc(n,{method:"POST",mode:"cors",headers:i,body:JSON.stringify(a)})}capture(e,t){if(vh.includes(e))return C.warn(`${e} event is sent internally.`),Promise.resolve();let r=Th.includes(e)?e.slice(1):e;return this.sendAnalyticEvent(r,t)}sendGetMapDataEvent(e){return this.sendAnalyticEvent(Ic,e)}sendChangeLanguageEvent(e){return this.sendAnalyticEvent(Sc,e)}sendWatchPositionDenied(){return this.sendAnalyticEvent(Tc)}sendMapViewLoadedEvent({firstRenderDuration:e,dimension:t,collisionWorkerDisabled:r,outdoorsWorkerDisabled:n}){return this.sendAnalyticEvent(vc,{type:"3d",firstRenderDuration:e,width:t.width,height:t.height,devicePixelRatio:globalThis.devicePixelRatio||1,collisionWorkerDisabled:r,outdoorsWorkerDisabled:n})}sendGetDirectionsEvent=Nl((e,t,r)=>{let n={start:e,end:t,type:"location_to_location"};return r!==void 0&&(n.accessible=r),this.sendAnalyticEvent(Ec,n)},2500);sendBlueDotEvents(e){if(!((e==="found-floor"||e==="found-position")&&this.oneTimeEventsSent.has(e)))return this.oneTimeEventsSent.add(e),this.sendAnalyticEvent(e)}};function Ma({mapId:o,baseUri:e=bc}){return`${e}${o}/`}function hc(){return Lt.getInstance().loadLocalData("deviceId")}function gc(){return Lt.getInstance().loadSessionData("id")}function bh(o,e){return o+e}function mc(o){return yc.find(e=>e===o)}var Th=["$select-location","$select-category","$query-suggest","$query-search"],vh=[vc,Ic,Ec,Tc,Sc],Ob=new tr,jr=class{#e;constructor(e){this.#e=e,this.capture=this.#e.capture.bind(this.#e),this.updateState=this.#e.updateState.bind(this.#e)}capture;updateState;getState(){let{sessionId:e,deviceId:t,...r}=this.#e.getState();return r}getContext(){return this.#e.getContext()}getSessionId(){return this.#e.getSessionId()}getDeviceId(){return this.#e.getDeviceId()}};f();f();var Gr=class{#e;searchInstance;#t;#o;enabled=!1;constructor(e,t,{enabled:r=!1}={}){this.#e=e,this.#t=t,this.#o=()=>{this.searchInstance?.then(n=>n.populate())},r&&this.enable()}async query(e,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return C.error("Search should be enabled by now"),{places:[],enterpriseLocations:[],enterpriseCategories:[]};try{return await(await this.searchInstance).search(e,t)}catch(r){return C.error("Search.query failed due to",r),{places:[],enterpriseLocations:[],enterpriseCategories:[]}}}async suggest(e,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return C.error("Search should be enabled by now"),[];try{return await(await this.searchInstance).suggest(e,t)}catch(r){return C.error("Search.suggest failed due to",r),[]}}async enable(){this.enabled||(this.enabled=!0,this.searchInstance||(this.searchInstance=import("./internal-I5R5O5YO.js").then(({InternalSearch:e})=>new e(this.#e))),this.#t.on("language-change",this.#o),await this.searchInstance)}};var Mc={"enterprise-location":"location-profile","enterprise-category":"location-category"},xc={"location-profile":"enterprise-location","location-category":"enterprise-category"},Cc=new WeakMap,xa=class{#e;#t;Analytics;Search;Query;internal;constructor(e,{search:t}={}){this.#e=new Mt,this.#t=e,Cc.set(this,e),this.Analytics=new jr(e.Analytics),this.Query=e.Query,this.internal=e,this.Search=new Gr(this,e,{enabled:t?.enabled}),this.#t.on("language-change",r=>{this.#e.publish("language-change",r)})}on=(e,t)=>{this.#e.on(e,t)};off=(e,t)=>{this.#e.off(e,t)};getEnv(){return this.#t.getEnv()}getAccessToken(){return this.#t.tokenManager?.getAccessToken().token}get mapName(){return this.#t.mapName}get mapId(){return this.#t.getMapDataOptions?.mapId}get isEnterpriseMode(){return this.#t.enterpriseMode}get mapCenter(){return this.#t.mapCenter}get organizationId(){return this.#t.organizationId}get outdoorViewToken(){return this.#t.outdoorViewToken}getByType(e){let t=this.#t.getByType(e);if(Array.isArray(t)&&t.length===0){let r=this.isEnterpriseMode;!r&&e in Mc?C.warn(`MappedinSDK: getByType('${e}') returned 0 results. This is a Maker map (API key starts with 'mik_'). Use '${Mc[e]}' instead. See https://developer.mappedin.com/web-sdk/getting-started`):r&&e in xc&&C.warn(`MappedinSDK: getByType('${e}') returned 0 results. This is an Enterprise map. Use '${xc[e]}' instead. See https://developer.mappedin.com/web-sdk/getting-started`)}return t}getById(e,t){return this.#t.getById(e,t)}getByExternalId(e,t){return this.#t.getByExternalId(e,t)}getGeoJSON(e){return e.geoJSON}async changeLanguage(e){return this.#t.changeLanguage(e)}get currentLanguage(){return this.#t.currentLanguage}get naturalBearing(){return this.#t.naturalBearing??0}__LEGACY_GET_DIRECTIONS_SYNC=(e,t,r)=>this.#t.__LEGACY_GET_DIRECTIONS_SYNC(e,t,r);getDirections=(e,t,r)=>this.#t.getDirections(e,t,r);__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC=(e,t,r)=>this.#t.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(e,t,r);getDirectionsMultiDestination=(e,t,r)=>this.#t.getDirectionsMultiDestination(e,t,r);getDistance(e,t){return this.#t.getDistance(e,t)}toBinaryBundle({downloadLanguagePacks:e=!0}={}){return this.#t.toBinaryBundle({downloadLanguagePacks:e})}toJSONBundle({downloadLanguagePacks:e=!0}={}){return this.#t.toJSONBundle({downloadLanguagePacks:e})}},Ur=xa;function Hr(o){let e=Cc.get(o);if(!e)throw new Error("MapDataInternal not found");return e}f();f();f();f();f();function or(o){return o.endsWith("/")?o:`${o}/`}f();var rr="https://app.mappedin.com/",_c="https://auth.mappedin.com/",Pc=Object.freeze({baseUri:"https://app.mappedin.com/",baseAuthUri:"https://app.mappedin.com/",analyticsBaseUri:"https://api-gateway.mappedin.com/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),Ih=Object.freeze({...Pc,baseUri:"https://api-gateway.mappedin.com/",baseAuthUri:"https://auth.mappedin.com/"}),Sh=Object.freeze({baseUri:"https://api-gateway.eu.mappedin.com/",baseAuthUri:"https://auth.eu.mappedin.com/",analyticsBaseUri:"https://api-gateway.eu.mappedin.com/track-analytics/a/",tileServerUri:"https://tiles-cdn.eu.mappedin.com/styles/mappedin/style.json"}),Eh=Object.freeze({baseUri:"https://api-gateway-staging.mappedin.net/",baseAuthUri:"https://auth-staging.mappedin.net/",analyticsBaseUri:"https://api-gateway-staging.mappedin.net/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),Mh=Object.freeze({baseUri:"https://app-staging.mappedin.net/",baseAuthUri:"https://app-staging.mappedin.net/",analyticsBaseUri:"https://api-gateway-staging.mappedin.net/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),xh={eu:Sh,us:Pc,"us-enterprise":Ih,"us-staging-enterprise":Eh,"us-staging-self-serve":Mh};function Oc(o){return xh[o]}f();f();var Ch=o=>{let e=Date.now();return o-e},ti=(o,e)=>Ch(o)<=e*60*1e3;var wc=10,Ac=wc*60*1e3,Dc="accessTokens",_h="mik_";function Fc(o){return typeof o=="string"&&o.startsWith(_h)}async function Wr(o,e=!1){let t=`${o.key}`,r=Lt.getInstance(),n=r?.loadSessionData(Dc)||{},i=Math.floor(Date.now()/1e3);if(n[t]&&!ti(n[t].expiresTimestamp*1e3,wc))return n[t];let a=e?await Ph(o,i):await Oh(o,i),s={...n,[t]:a};return r?.saveSessionData(Dc,s),a}async function Ph(o,e){let t;o.customAuthUri?t=o.customAuthUri:t=`${o.baseAuthUri??_c}oauth2/token`;let r;try{r=await ht()(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"client_credentials",client_id:o.key,client_secret:o.secret})})}catch(i){let a=i instanceof Error?i.message:String(i);throw new Error(`Failed to fetch enterprise access token from ${t}: ${a}`)}if(!r.ok)throw new Error(`${r.status} ${r.statusText}: ${await r.text()}`);let n=await r.json();return{accessToken:n.access_token,expiresTimestamp:e+n.expires_in}}async function Oh(o,e){let t;o.customAuthUri?t=o.customAuthUri:t=`${o.baseAuthUri?or(o.baseAuthUri):rr}api/v1/api-key/token`;let r;try{r=await ht()(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:o.key,secret:o.secret})})}catch(i){let a=i instanceof Error?i.message:String(i);throw new Error(`Failed to fetch access token from ${t}: ${a}`)}if(!r.ok)throw new Error(`${r.status} ${r.statusText}: ${await r.text()}`);let n=await r.json();return{accessToken:n.access_token,expiresTimestamp:e+n.expires_in}}f();var Lc=10,Rc=Lc*60*1e3,kc="miSasTokens";async function Ca(o,e){let t=`${e}__${o.mapId}`,r=Lt.getInstance(),n=r?.loadSessionData(kc)||{};if(n[t]&&!ti(n[t].expires,Lc))return n[t];let i=await Dh(o,e),a={...n,[t]:{token:i.token,expires:new Date(i.expires).getTime()}};return r?.saveSessionData(kc,a),i}async function Dh(o,e){let t=`${o.baseUri?or(o.baseUri):rr}api/v1/venue/${o.mapId}/sas-token`,r=await ht()(t,{method:"GET",headers:{Authorization:`Bearer ${e}`}});if(!r.ok)throw new Error(`${r.status} ${r.statusText}: ${await r.text()}`);let n=await r.json();return{token:n.token,expires:new Date(n.expires).getTime()}}f();var gt=Uint8Array,Fo=Uint16Array,Nc=Uint32Array,Bc=new gt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Vc=new gt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),wh=new gt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jc=function(o,e){for(var t=new Fo(31),r=0;r<31;++r)t[r]=e+=1<<o[r-1];for(var n=new Nc(t[30]),r=1;r<30;++r)for(var i=t[r];i<t[r+1];++i)n[i]=i-t[r]<<5|r;return[t,n]},Gc=jc(Bc,2),Uc=Gc[0],Ah=Gc[1];Uc[28]=258,Ah[258]=28;var Hc=jc(Vc,0),Fh=Hc[0],g0=Hc[1],Da=new Fo(32768);for(ae=0;ae<32768;++ae)so=(ae&43690)>>>1|(ae&21845)<<1,so=(so&52428)>>>2|(so&13107)<<2,so=(so&61680)>>>4|(so&3855)<<4,Da[ae]=((so&65280)>>>8|(so&255)<<8)>>>1;var so,ae,zr=(function(o,e,t){for(var r=o.length,n=0,i=new Fo(e);n<r;++n)o[n]&&++i[o[n]-1];var a=new Fo(e);for(n=0;n<e;++n)a[n]=a[n-1]+i[n-1]<<1;var s;if(t){s=new Fo(1<<e);var l=15-e;for(n=0;n<r;++n)if(o[n])for(var c=n<<4|o[n],p=e-o[n],h=a[o[n]-1]++<<p,g=h|(1<<p)-1;h<=g;++h)s[Da[h]>>>l]=c}else for(s=new Fo(r),n=0;n<r;++n)o[n]&&(s[n]=Da[a[o[n]-1]++]>>>15-o[n]);return s}),Xr=new gt(288);for(ae=0;ae<144;++ae)Xr[ae]=8;var ae;for(ae=144;ae<256;++ae)Xr[ae]=9;var ae;for(ae=256;ae<280;++ae)Xr[ae]=7;var ae;for(ae=280;ae<288;++ae)Xr[ae]=8;var ae,Wc=new gt(32);for(ae=0;ae<32;++ae)Wc[ae]=5;var ae;var kh=zr(Xr,9,1);var Lh=zr(Wc,5,1),_a=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},Rt=function(o,e,t){var r=e/8|0;return(o[r]|o[r+1]<<8)>>(e&7)&t},Pa=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},Rh=function(o){return(o+7)/8|0},Aa=function(o,e,t){(e==null||e<0)&&(e=0),(t==null||t>o.length)&&(t=o.length);var r=new(o.BYTES_PER_ELEMENT==2?Fo:o.BYTES_PER_ELEMENT==4?Nc:gt)(t-e);return r.set(o.subarray(e,t)),r};var Nh=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Nt=function(o,e,t){var r=new Error(e||Nh[o]);if(r.code=o,Error.captureStackTrace&&Error.captureStackTrace(r,Nt),!t)throw r;return r},Bh=function(o,e,t){var r=o.length;if(!r||t&&t.f&&!t.l)return e||new gt(0);var n=!e||t,i=!t||t.i;t||(t={}),e||(e=new gt(r*3));var a=function(Je){var Dt=e.length;if(Je>Dt){var qe=new gt(Math.max(Dt*2,Je));qe.set(e),e=qe}},s=t.f||0,l=t.p||0,c=t.b||0,p=t.l,h=t.d,g=t.m,T=t.n,I=r*8;do{if(!p){s=Rt(o,l,1);var E=Rt(o,l+1,3);if(l+=3,E)if(E==1)p=kh,h=Lh,g=9,T=5;else if(E==2){var U=Rt(o,l,31)+257,R=Rt(o,l+10,15)+4,B=U+Rt(o,l+5,31)+1;l+=14;for(var V=new gt(B),L=new gt(19),j=0;j<R;++j)L[wh[j]]=Rt(o,l+j*3,7);l+=R*3;for(var te=_a(L),ie=(1<<te)-1,oe=zr(L,te,1),j=0;j<B;){var ce=oe[Rt(o,l,ie)];l+=ce&15;var D=ce>>>4;if(D<16)V[j++]=D;else{var Te=0,xe=0;for(D==16?(xe=3+Rt(o,l,3),l+=2,Te=V[j-1]):D==17?(xe=3+Rt(o,l,7),l+=3):D==18&&(xe=11+Rt(o,l,127),l+=7);xe--;)V[j++]=Te}}var Re=V.subarray(0,U),re=V.subarray(U);g=_a(Re),T=_a(re),p=zr(Re,g,1),h=zr(re,T,1)}else Nt(1);else{var D=Rh(l)+4,x=o[D-4]|o[D-3]<<8,A=D+x;if(A>r){i&&Nt(0);break}n&&a(c+x),e.set(o.subarray(D,A),c),t.b=c+=x,t.p=l=A*8,t.f=s;continue}if(l>I){i&&Nt(0);break}}n&&a(c+131072);for(var Yt=(1<<g)-1,it=(1<<T)-1,Zt=l;;Zt=l){var Te=p[Pa(o,l)&Yt],ue=Te>>>4;if(l+=Te&15,l>I){i&&Nt(0);break}if(Te||Nt(2),ue<256)e[c++]=ue;else if(ue==256){Zt=l,p=null;break}else{var ge=ue-254;if(ue>264){var j=ue-257,vt=Bc[j];ge=Rt(o,l,(1<<vt)-1)+Uc[j],l+=vt}var pe=h[Pa(o,l)&it],It=pe>>>4;pe||Nt(3),l+=pe&15;var re=Fh[It];if(It>3){var vt=Vc[It];re+=Pa(o,l)&(1<<vt)-1,l+=vt}if(l>I){i&&Nt(0);break}n&&a(c+131072);for(var le=c+ge;c<le;c+=4)e[c]=e[c-re],e[c+1]=e[c+1-re],e[c+2]=e[c+2-re],e[c+3]=e[c+3-re];c=le}}t.l=p,t.p=Zt,t.b=c,t.f=s,p&&(s=1,t.m=g,t.d=h,t.n=T)}while(!s);return c==e.length?e:Aa(e,0,c)};var Vh=new gt(0);var Qt=function(o,e){return o[e]|o[e+1]<<8},Bt=function(o,e){return(o[e]|o[e+1]<<8|o[e+2]<<16|o[e+3]<<24)>>>0},Oa=function(o,e){return Bt(o,e)+Bt(o,e+4)*4294967296};function jh(o,e){return Bh(o,e)}var wa=typeof TextDecoder<"u"&&new TextDecoder,Gh=0;try{wa.decode(Vh,{stream:!0}),Gh=1}catch{}var Uh=function(o){for(var e="",t=0;;){var r=o[t++],n=(r>127)+(r>223)+(r>239);if(t+n>o.length)return[e,Aa(o,t-1)];n?n==3?(r=((r&15)<<18|(o[t++]&63)<<12|(o[t++]&63)<<6|o[t++]&63)-65536,e+=String.fromCharCode(55296|r>>10,56320|r&1023)):n&1?e+=String.fromCharCode((r&31)<<6|o[t++]&63):e+=String.fromCharCode((r&15)<<12|(o[t++]&63)<<6|o[t++]&63):e+=String.fromCharCode(r)}};function Hh(o,e){if(e){for(var t="",r=0;r<o.length;r+=16384)t+=String.fromCharCode.apply(null,o.subarray(r,r+16384));return t}else{if(wa)return wa.decode(o);var n=Uh(o),i=n[0],a=n[1];return a.length&&Nt(8),i}}var Wh=function(o,e){return e+30+Qt(o,e+26)+Qt(o,e+28)},zh=function(o,e,t){var r=Qt(o,e+28),n=Hh(o.subarray(e+46,e+46+r),!(Qt(o,e+8)&2048)),i=e+46+r,a=Bt(o,e+20),s=t&&a==4294967295?Xh(o,i):[a,Bt(o,e+24),Bt(o,e+42)],l=s[0],c=s[1],p=s[2];return[Qt(o,e+10),l,c,n,i+Qt(o,e+30)+Qt(o,e+32),p]},Xh=function(o,e){for(;Qt(o,e)!=1;e+=4+Qt(o,e+2));return[Oa(o,e+12),Oa(o,e+4),Oa(o,e+20)]};function Fa(o,e){for(var t={},r=o.length-22;Bt(o,r)!=101010256;--r)(!r||o.length-r>65558)&&Nt(13);var n=Qt(o,r+8);if(!n)return{};var i=Bt(o,r+16),a=i==4294967295||n==65535;if(a){var s=Bt(o,r-12);a=Bt(o,s)==101075792,a&&(n=Bt(o,s+32),i=Bt(o,s+48))}for(var l=e&&e.filter,c=0;c<n;++c){var p=zh(o,i,a),h=p[0],g=p[1],T=p[2],I=p[3],E=p[4],D=p[5],x=Wh(o,D);i=E,(!l||l({name:I,size:g,originalSize:T,compression:h}))&&(h?h==8?t[I]=jh(o.subarray(x,x+g),new gt(T)):Nt(14,"unknown compression type "+h):t[I]=Aa(o,x,x+g))}return t}var zc=globalThis.fetch,Yh=S?.env?.npm_package_version;function ht(){if(zc==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return zc}var ka={supplementaryUrl:"https://api-gateway.mappedin.com/analytics/",headers:{},accessToken:"",clientId:"",noAuth:!1,includeHidden:!0,clientSecret:"",apiGateway:"",authorization:"",perspective:"Website",language:"",venue:""};function $c(o){let e={...ka,...o};return e.headers={...e.headers,"mappedin-sdk-version":Yh},e.things=[],"platformString"in o&&(e.headers={...e.headers,"mappedin-platform-version":o.platformString}),e.noAuth||(e.accessToken?e.authorization=`Bearer ${e.accessToken}`:e.clientId&&e.clientSecret&&(e.authorization=`Basic ${globalThis.btoa(`${e.clientId}:${e.clientSecret}`)}`)),e.language=e.language?.toLowerCase(),e}function Zh(o,e,t=!1){let r={language:o.language,clientId:o.clientId,clientSecret:o.clientSecret};t&&delete r.language;let{headers:n}=o;n["Content-Type"]=n["Content-Type"]||"text/json",o.accessToken?n.Authorization=`Bearer ${o.accessToken}`:o.noAuth||o.clientId&&o.clientSecret&&(n["x-mappedin-key"]=btoa(o.clientId),n["x-mappedin-secret"]=btoa(o.clientSecret));let i={method:"GET",headers:n};return o.secure&&(e+="&withcdntoken"),{req:i,url:e}}async function Jh(o,e,t=!1){let r=Zh(o,e,t),n=await ht()(r.url,r.req);if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);return n.json()}var qh=o=>{let e=o!=null&&typeof o=="object"&&"perspectives"in o&&o.perspectives!=null&&typeof o.perspectives=="object"?o.perspectives:null;if(e==null||Object.keys(e).length===0)return C.warn("No perspectives available in response!"),null;let t={};for(let[r,n]of Object.entries(e)){let i="url"in n&&typeof n.url=="string"?n.url:null,a="locale_packs"in n&&typeof n.locale_packs=="object"?n.locale_packs:null;if(i==null||a==null){C.warn(`Perspective ${r} is missing url or locale_packs!`);continue}t[r]={url:i,locale_packs:a}}return t};async function Qh(o,e="exports/mvf/1/bundle"){let t=$c({baseUri:"https://api-gateway.mappedin.com/",...ka,...o}),r=`${t.baseUri+e}?venue=${t.venue}&version=${t.version??"2.0.0"}`;t.headers["Content-Type"]="application/zip";let n=await Jh(t,r),i=n.url,a=n.locale_packs,s=t.perspective??ka.perspective,l=qh(n);if(s!=null&&s!==""&&l!=null){let c=l[s];c==null?C.warn(`Perspective ${s} not found in response! Loading default perspective instead.`):(C.log(`Loading perspective "${s}"`),i=c.url,a=c.locale_packs)}return{url:i,localePacks:a,updated_at:n.updated_at}}var nr=(function(){let o;return()=>(o||(o=new TextDecoder),o)})();async function La(o,{signal:e}){let t=await(await ht()(o,{signal:e})).arrayBuffer();return new Uint8Array(t)}async function ir(o){let e=Fa(o),t={};if(e["enterprise/"]!=null){t.enterprise={};let r=e["enterprise/locations.json"];r&&(t.enterprise.locations=JSON.parse(nr().decode(r)));let n=e["enterprise/locationInstances.json"];n&&(t.enterprise.locationInstances=JSON.parse(nr().decode(n)));let i=e["enterprise/categories.json"];i&&(t.enterprise.categories=JSON.parse(nr().decode(i)))}return e["floorstack.json"]&&(t["floorstack.json"]=JSON.parse(nr().decode(e["floorstack.json"]))),e["floor.geojson"]&&(t["floor.geojson"]=JSON.parse(nr().decode(e["floor.geojson"]))),e["manifest.json"]&&(t["manifest.geojson"]=JSON.parse(nr().decode(e["manifest.json"]))),t}async function Yc(o,{signal:e}){try{let t=await(await ht()(o,{signal:e})).arrayBuffer();if(e.aborted)return;let r=new Uint8Array(t);return await ir(r)}catch(t){let r=new Error("downloadLanguagePack failed");throw r.cause=t,r}}function Kh(o){let{mvfVersion:e,useDraftData:t}=o;if(e==="3.0.0")return t?"exports/mvf3-draft/1/bundle":"exports/mvf3/1/bundle";if(e==null||e==="2.0.0")return t?"exports/mvf2-draft/1/bundle":"exports/mvf2/1/bundle";if(e==="2.0.0-c")return t?"exports/mvf2c-draft/1/bundle":"exports/mvf2c/1/bundle";throw new Error(`Unsupported MVF version: ${e}`)}async function Ra(o){return new Promise(async(e,t)=>{try{let r=Kh(o),{url:n,localePacks:i}=await Qh(o,r),a=await ht()(n).then(l=>l.arrayBuffer()),s=new Uint8Array(a);e({compressed:s,localePacks:i})}catch(r){t(r)}})}async function Na(o,e){return new Promise(async(t,r)=>{try{let{url:n}=await eg(o,e),i=await ht()(n).then(s=>s.arrayBuffer()),a=new Uint8Array(i);t(a)}catch(n){r(n)}})}async function eg(o,e){let t=new URL(`${o.baseUri?or(o.baseUri):rr}api/v1/venue/${o.mapId}/mvf`);o.viewId&&t.searchParams.set("configId",o.viewId),o.mvfVersion&&t.searchParams.set("version",o.mvfVersion);let r=await ht()(t.toString(),{headers:{Authorization:`Bearer ${e}`}});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);return r.json()}function Zc(o){return ua(o)}function tg(o){if(o==null||typeof o!="object")return!1;let e=["connection.json","manifest.geojson","floor.geojson"in o?"floor.geojson":"map.geojson","node.geojson","floorstack.json"in o?"floorstack.json":"mapstack.json"in o?"mapstack.json":"mapstack.geojson"];"styles.json"in o&&e.push("styles.json"),"shapes.json"in o&&e.push("shapes.json"),"navigationFlags.json"in o&&e.push("navigationFlags.json"),"annotation-symbols.json"in o&&e.push("annotation-symbols.json");for(let t of e)if(o[t]==null||o[t][Symbol.toStringTag]!=="Uint8Array")return!1;return!0}async function Ba(o){return new Promise(async(e,t)=>{try{if(o==null||typeof o!="object")throw new Error("Error parsing data! Unzipping failed.");if(o[Symbol.toStringTag]!=="Uint8Array")throw new Error("Unexpected file type! Unzipping failed.");let r=Fa(o);if(!tg(r))throw new Error("MVF is missing some expect static files. Unzipping failed.");let n={},i=Object.keys(r);for(let a of i){if(r[a].length===0)continue;let s=a.split("/");if(s.length<0)throw new Error("Encounted a file with no name! Unzipping failed.");if(s.length>2)throw new Error("Encountered unexpected nesting in MVF! Unzipping failed.");if(s.length===1){n[s[0]]=r[a];continue}if(s[0]==="image"){C.warn("MVF unzipping encountered an image. Ignoring as this case has not been implemented.");continue}else n[s[0]]==null&&(n[s[0]]={}),n[s[0]][s[1]]=r[a]}e(n)}catch(r){t(r)}})}function To(){let o="us",e={};function t(){return og(Oc(o),e)}return{updateByUserOption(r){r.environment&&(o=r.environment),r.baseUri&&(e.baseUri=r.baseUri),r.baseAuthUri&&(e.baseAuthUri=r.baseAuthUri),r.analytics?.baseUri&&(e.analyticsBaseUri=r.analytics?.baseUri)},updateTileServerBaseUrl(r){e.tileServerUri=r},updateEnvironment(r){o=r},setEnterprise(r){(o==="us"||o==="us-enterprise")&&(o=r?"us-enterprise":"us")},getBaseUri(){return t().baseUri},getBaseAuthUri(){return t().baseAuthUri},getAnalyticsBaseUri(){return t().analyticsBaseUri},getTileServerUri(){return t().tileServerUri},reset(){o="us",e={}},__getState:t}}function og(o,e){return{...o,...e}}var oi=o=>{let e=Object.values(o["floorstack.json"]??o["mapstack.json"]??{});return e.length===1?[]:e.filter(t=>t.type!=="Outdoor").map(t=>t.id.replace("fs_","").replace("ms_",""))},Xc=async o=>{let e=performance.now(),t,r=$l.decompressUnsafeSync(o);r.isOk()?t=r.unwrap():C.error("MVFv3 decompression failed!");let n;if(t)try{n=Xl(t)}catch(i){C.error("MVFv3 to MVFv2 conversion failed!",i)}if(C.log(`Parsed MVFv3 in ${performance.now()-e}ms`),!n)throw new Error("Failed to parse MVFv2 from MVFv3!");return{mvf2:n,mvf3:t}};async function ri(o,e="2.0.0"){switch(e){case"2.0.0":case"2.0.0-c":try{let t=performance.now(),r=await Ba(o),n=ua(r);return C.log(`Parsed MVFv2 in ${performance.now()-t}ms`),{mvf2:n}}catch{return C.error("MVFv2 parsing failed! Trying MVFv3."),Xc(o)}case"3.0.0":return Xc(o);default:throw new Error(`Unsupported MVF version: ${e}`)}}f();f();function rg(o,e,t){t===void 0&&(t={});for(var r=bo(o),n=qo(e),i=0;i<n.length-1;i++){var a=!1;if(t.ignoreEndVertices&&(i===0&&(a="start"),i===n.length-2&&(a="end"),i===0&&i+1===n.length-1&&(a="both")),ng(n[i],n[i+1],r,a,typeof t.epsilon>"u"?null:t.epsilon))return!0}return!1}function ng(o,e,t,r,n){var i=t[0],a=t[1],s=o[0],l=o[1],c=e[0],p=e[1],h=t[0]-s,g=t[1]-l,T=c-s,I=p-l,E=h*I-g*T;if(n!==null){if(Math.abs(E)>n)return!1}else if(E!==0)return!1;if(r){if(r==="start")return Math.abs(T)>=Math.abs(I)?T>0?s<i&&i<=c:c<=i&&i<s:I>0?l<a&&a<=p:p<=a&&a<l;if(r==="end")return Math.abs(T)>=Math.abs(I)?T>0?s<=i&&i<c:c<i&&i<=s:I>0?l<=a&&a<p:p<a&&a<=l;if(r==="both")return Math.abs(T)>=Math.abs(I)?T>0?s<i&&i<c:c<i&&i<s:I>0?l<a&&a<p:p<a&&a<l}else return Math.abs(T)>=Math.abs(I)?T>0?s<=i&&i<=c:c<=i&&i<=s:I>0?l<=a&&a<=p:p<=a&&a<=l;return!1}var Jc=rg;f();function ig(o,e){e===void 0&&(e={});var t=Jo(o),r=(t[0]+t[2])/2,n=(t[1]+t[3])/2;return Zo([r,n],e.properties,e)}var ar=ig;f();f();function ag(o,e,t){t===void 0&&(t={});var r=bo(o),n=bo(e),i=Jt(n[1]-r[1]),a=Jt(n[0]-r[0]),s=Jt(r[1]),l=Jt(n[1]),c=Math.pow(Math.sin(i/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(s)*Math.cos(l);return Bl(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),t.units)}var vo=ag;function ni(o,e){return e===void 0&&(e={}),Gl(o,function(t,r){var n=r.geometry.coordinates;return t+vo(n[0],n[1],e)},0)}f();f();f();function ii(o,e,t){if(t===void 0&&(t={}),t.final===!0)return sg(o,e);var r=bo(o),n=bo(e),i=Jt(r[0]),a=Jt(n[0]),s=Jt(r[1]),l=Jt(n[1]),c=Math.sin(a-i)*Math.cos(l),p=Math.cos(s)*Math.sin(l)-Math.sin(s)*Math.cos(l)*Math.cos(a-i);return Vl(Math.atan2(c,p))}function sg(o,e){var t=ii(e,o);return t=(t+180)%360,t}function lg(o,e,t){t===void 0&&(t={});var r=Zo([1/0,1/0],{dist:1/0}),n=0;return jl(o,function(i){for(var a=qo(i),s=0;s<a.length-1;s++){var l=Zo(a[s]);l.properties.dist=vo(e,l,t);var c=Zo(a[s+1]);c.properties.dist=vo(e,c,t);var p=vo(l,c,t),h=Math.max(l.properties.dist,c.properties.dist),g=ii(l,c),T=fa(e,h,g+90,t),I=fa(e,h,g-90,t),E=Yl(Br([T.geometry.coordinates,I.geometry.coordinates]),Br([l.geometry.coordinates,c.geometry.coordinates])),D=null;E.features.length>0&&(D=E.features[0],D.properties.dist=vo(e,D,t),D.properties.location=n+vo(l,D,t)),l.properties.dist<r.properties.dist&&(r=l,r.properties.index=s,r.properties.location=n),c.properties.dist<r.properties.dist&&(r=c,r.properties.index=s+1,r.properties.location=n+p),D&&D.properties.dist<r.properties.dist&&(r=D,r.properties.index=s),n+=p}}),r}var $r=lg;function cg(o,e,t){var r=qo(t);if(Hl(t)!=="LineString")throw new Error("line must be a LineString");var n=$r(t,o),i=$r(t,e),a;n.properties.index<=i.properties.index?a=[n,i]:a=[i,n];for(var s=[a[0].geometry.coordinates],l=a[0].properties.index+1;l<a[1].properties.index+1;l++)s.push(r[l]);return s.push(a[1].geometry.coordinates),Br(s,t.properties)}var Va=cg;var pg=1e-7;function ja(o){return{type:"Point",coordinates:o}}function dg(o,e){let{coordinates:t}=e.geometry,{coordinates:r}=o.geometry,n=t.map(i=>$r(o,ja(i)));return r.reduce((i,a)=>{let s=Va(ja(a),n[0],o),l=Va(ja(a),n[1],o),c=ni(s)<ni(l)?s:l;return c.properties={...o.properties,entrances:[]},i.concat([c])},[])}function Ga(o,e){return e.reduce((t,r)=>{let n={epsilon:pg},i=t.obstructions.findIndex(s=>Jc(ar(r),s,n)),a=t.obstructions[i];if(a){let[s,l]=dg(a,r);t.entrances.push(r),t.obstructions.splice(i,1,s,l)}return t},{obstructions:[o],entrances:[]})}f();f();f();var Fe=class{id;constructor(e){this.id=e}};f();f();var Ua=class o{static __type="coordinate";__type=o.__type;id=ee();latitude;longitude;floorId;verticalOffset;#e={};static is(e){return e.__type===o.__type}constructor(e,t,r){if(typeof e=="object")this.latitude=e.latitude,this.longitude=e.longitude,this.floorId=e.floorId,this.verticalOffset=e.verticalOffset??0;else{if(t==null)throw new Error("Coordinate longitude is required.");this.latitude=e,this.longitude=t,this.floorId=r,this.verticalOffset=0}}get anchorTarget(){return this}get focusTarget(){return this}get navigationTarget(){return this}isEqual(e){return this.latitude===e.latitude&&this.longitude===e.longitude&&this.floorId===e.floorId}toJSON(){return{__type:o.__type,latitude:this.latitude,longitude:this.longitude,floorId:this.floorId,verticalOffset:this.verticalOffset}}get geoJSON(){if(this.#e.geoJSON!=null)return this.#e.geoJSON;let e=[this.longitude,this.latitude];return this.verticalOffset!==0&&e.push(this.verticalOffset),this.#e.geoJSON={type:"Feature",properties:null,geometry:{type:"Point",coordinates:e}},this.#e.geoJSON}toGeoJSON(){return this.geoJSON.geometry}destroy(){for(let e of globalThis.Object.keys(this.#e))delete this.#e[e]}},H=Ua;function Ha(o){let e=o.enterprise?.locations?.reduce((n,i)=>(n[i.id]=i,n),{})||{};for(let n of o.enterprise?.locationInstances||[])e[n.id]=n;let t={};for(let n of o["floorstack.json"]||[])t[n.id]=n;let r={};for(let n of o["floor.geojson"]?.features||[])n.properties&&n.properties.id&&(r[n.properties.id]=n.properties);return{type:"downloaded",data:o,optimized:{"enterprise-location":e,"enterprise-category":o.enterprise?.categories?.reduce((n,i)=>(n[i.id]=i,n),{})||{},"floor-stack":t,floor:r}}}var ug=/^https?:\/\/cdn(-staging)?\.mappedin\.com(\/|$)/;function qc(o){return ug.test(o)}function Qc(o){return!!o.split("?")[1]?.includes("sv=")}function Ze(o,e){let t=o?.properties?.id||"unknown";if(o.geometry==null)return C.error(`Cannot get the center coordinate for "${t}" because it has no geometry.`),new H({latitude:0,longitude:0,floorId:e});try{if(o.geometry.type==="LineString"){let[[r,n],[i,a]]=o.geometry.coordinates,s=(r+i)/2,l=(n+a)/2;return new H({latitude:l,longitude:s,floorId:e})}else if(o.geometry.type==="Point"){let[r,n]=o.geometry.coordinates;return new H({latitude:n,longitude:r,floorId:e})}else if(o.geometry.type==="Polygon"){let r=o;if(r.properties.center!=null){let[n,i]=r.properties.center;return new H({latitude:i,longitude:n,floorId:e})}}}catch{}try{let[r,n]=ar(o).geometry.coordinates;return new H({latitude:n,longitude:r,floorId:e})}catch(r){return C.error(`Failed to get center coordinate for "${t}" ${r instanceof Error?r.stack:""}`),new H({latitude:0,longitude:0,floorId:e})}}function Kc(o,e){return e&&(o.flags[e.index]&1<<e.bit)!==0}function ai(o,e){let t=o.instanceLocationsByPolygonId?.[e];if(t)return[t];let r=[],n=o.mvfLocationsByGeometryId[e];if(n)for(let i of n){let a=o.getById("enterprise-location",i.id);a&&r.push(a)}return r}var Wa=class o extends Fe{static __type="node";__type=o.__type;#e;#t={};#o;#r;static is(e){return e.__type===o.__type}constructor(e,t){super(t.mvfData.properties.id),this.#e=e,this.#o=t.floorId,this.#r=t.mvfData}get locations(){return this.#t.locations?this.#t.locations:(this.#t.locations=(this.#e.locationIdsByNodeId[this.id]||[]).map(e=>this.#e.getById("enterprise-location",e)).filter(Boolean),this.#t.locations)}get space(){return this.#e.getById("space",this.#e.spaceIdsByNodeId[this.id]?.[0])}get object(){return this.#e.getById("object",this.#e.objectIdsByNodeId[this.id]?.[0])}get floor(){let e=this.#e.getById("floor",this.#o);if(e==null)throw new Error(`Floor ${this.#o} not found!`);return e}get coordinate(){return this.#t.coordinate==null&&(this.#t.coordinate=Ze(this.#r,this.#o)),this.#t.coordinate}get externalId(){return this.#r.properties.externalId??""}get neighbors(){if(this.#t.neighbors==null){let e=this.#r.properties.neighbors.map(t=>{let r=this.#e.getById("node",t.id);if(r==null)throw new Error(`Node ${t.id} not found!`);return r});this.#t.neighbors=e}return this.#t.neighbors}get navigationFlags(){if(this.#t.navigationFlags==null){let e=[],t=this.#r.properties.flags;if(t!=null&&t.length>0)for(let[r,n]of Object.entries(this.#e.navigationFlags))t.length>n.index&&t[n.index]!=null&&Kc({flags:t},n)&&e.push(r);this.#t.navigationFlags=Object.freeze(e)}return this.#t.navigationFlags}get geoJSON(){return{...this.#r,properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}get navigationTarget(){return this}toJSON(){return{__type:o.__type,id:this.id,floor:this.floor.id,coordinate:this.coordinate.toJSON(),neighbors:this.neighbors.map(e=>e.id)}}destroy(){for(let e of Object.keys(this.#t))delete this.#t[e]}},xt=Wa;f();f();f();f();var za=class o extends Fe{static __type="hyperlink";__type=o.__type;#e={};#t;static is(e){return e.__type===o.__type}constructor(e){super(String(ee())),this.#t=e.mvfData}get url(){return this.#t.url}get name(){if("displayName"in this.#t)return this.#t.displayName;if("label"in this.#t)return this.#t.label}toJSON(){return{__type:o.__type,id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(this.#e))delete this.#e[e]}},ko=za;f();f();function Yr(o){return typeof o=="string"?o:o?.id??""}function ep(o){return Array.isArray(o)&&Number.isFinite(o[0])&&Number.isFinite(o[1])}var fg=/^https:\/\/cdn\.mappedin\.com\/category-symbols\/.+$/,hg=/^https:\/\/cdn-staging\.mappedin\.net\/category-symbols\/.+$/,gg=o=>fg.test(o)||hg.test(o),mg=/^https:\/\/cdn\.mappedin\.com\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,yg=/^https:\/\/cdn-staging\.mappedin\.com\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,bg=o=>gg(o)?!1:mg.test(o)||yg.test(o),sr=o=>{if(!bg(o))return null;let e="";o.startsWith("https://")?(e="https://",o=o.slice(8)):o.startsWith("http://")&&(e="http://",o=o.slice(7));let[t,r,n]=o.split("/"),i=n.split(".").pop()??"";return{origin:e+t,mapId:r,fileName:n,fileType:i}};function Xa(o){return o.reduce((e,t,r)=>r===0?e:e+qt(o[r-1].toGeoJSON().coordinates,t.toGeoJSON().coordinates),0)}function lo(o){return o!=null&&typeof o=="object"&&"__type"in o&&o.__type!==null&&typeof o.__type=="string"}function $a(o){return o!=null&&typeof o=="object"&&"name"in o&&o.name!=null&&typeof o.name=="string"&&o.name!==""}function tp(o){return lo(o)&&$a(o)}var Ya=class o extends Fe{static __type="image";__type=o.__type;#e={};#t;#o;static is(e){return e.__type===o.__type}constructor(e){super(String(ee())),this.#t=e.mvfData,this.#o=e.mapData}get url(){let e=this.#t.url;if(this.#o.tokenManager==null)return e;let t=sr(this.#t.url);if(t==null)return e;let r=t.mapId;try{if(this.#o.tokenManager.isEnterpriseMode())return e;let n=this.#o.tokenManager.getSasToken(r).token;if(n==null||n==="")throw new Error("SAS token empty!");return`${e}?${n}`}catch(n){return t.fileType!=="svg"&&C.error("Error getting SAS token for image",{error:n,url:e}),e}}get name(){return this.#t.altText}get altText(){return this.#t.altText}toJSON(){return{__type:o.__type,id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(this.#e))delete this.#e[e]}},Kt=Ya;f();var Vt=class{id;constructor(e,t){this.id=e}#e=void 0;get geoJSONBoundingBox(){return this.#e?this.#e:"bbox"in this.geoJSON.geometry&&this.geoJSON.geometry.bbox?this.geoJSON.geometry.bbox:(this.#e=Jo(this.geoJSON),this.#e)}get geoJSON(){return{properties:null,type:"Feature",geometry:{type:"Polygon",coordinates:[[]]}}}};var ke=class extends Vt{#e;#t;#o={};constructor(e,t){super(t.properties.id,e),this.#e=e,this.#t=t}get externalId(){return this.#t.properties.externalId??""}get name(){let e=this.#t.properties.details?.name??"";return e===""&&(e=this.locationProfiles.find(t=>t.name&&t.name.length>0)?.name??""),e}get icon(){return this.locationProfiles.find(e=>e.icon!=null&&e.icon.url!=null&&e.icon.url.length>0)?.icon}get description(){let e=this.#t.properties.details?.description??"";return e===""&&(e=this.locationProfiles.find(t=>t.description&&t.description.length>0)?.description??""),e}get images(){if(this.#o.images!=null)return this.#o.images;let e=this.#t.properties.details?.images?.map(t=>new Kt({mvfData:t,mapData:this.#e}))??[];return(e==null||e.length===0)&&(e=this.locationProfiles.find(t=>t.images.length>0)?.images??[]),this.#o.images=e,e}get links(){if(this.#o.links!=null)return this.#o.links;let e=this.#t.properties.details?.links?.map(t=>new ko({mvfData:t}))??[];return(e==null||e.length===0)&&(e=this.locationProfiles.find(t=>t.links.length>0)?.links??[]),this.#o.links=e,e}get locationProfiles(){return this.#e.locationProfilesByAttachedFeatureId[this.id]??[]}_serializeDetailedMapData(){return{externalId:this.externalId,name:this.name,description:this.description,images:this.images,links:this.links,locationProfiles:this.locationProfiles}}};f();var mt=class o{#e;#t;#o;target;static __type="image-3d";__type=o.__type;static is(e){return e.__type===o.__type}constructor(e,t,r,n){this.#e=e,this.#t=t,this.target=r,this.#o=n}get id(){return this.#e}get url(){if(this.#o==null)return this.#t;let e=sr(this.#t);if(e==null)return this.#t;let t=e.mapId;try{if(this.#o.isEnterpriseMode())return this.#t;let r=this.#o.getSasToken(t).token;if(r==null||r==="")throw new Error("SAS token empty!");return`${this.#t}?${r}`}catch(r){return e.fileType!=="svg"&&C.error("Error getting SAS token for image",{error:r,url:this.#t}),this.#t}}};f();f();function Io(o){let e;if(H.is(o))e=o;else if(ct.is(o))e=o.coordinates[0];else if(co.is(o))if(o.spaces.length>0)e=o.spaces[0].center;else return;else if(ze.is(o))if(o.coordinates.length>0)e=o.coordinates[0];else return;else if("center"in o&&H.is(o.center))e=o.center;else if("coordinate"in o&&H.is(o.coordinate))e=o.coordinate;else return;return e}f();f();var Zr={debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building-outline","building-top","building","building-wall","building-buffer"]},imagePlacementOptions:{mode:"default"},flipImagesToFaceCamera:!0,multiFloorView:{enabled:!0,floorGap:"auto",footprintColor:"#ffffff"},disableUpdateStateValidation:!1},eo="ExteriorWalls",So="Walls",op=0,lr="InteriorDoors",cr="ExteriorDoors",pr="InteriorDoorsLayer",dr="ExteriorDoorsLayer",Ee="GeometryLayer",Jr="Focusable-",to="LabelsLayer",jt="MarkersLayer",qr="FootprintLayer",Lo="OcclusionLayer",Ro="AreasLayer",ur="ImagesLayer",No="FacadesLayer",oo="PathsLayer",Gt="ModelsLayer";var rp=["https://mappedin.auth0.com","https://mappedin-staging.auth0.com","https://staging.mappedin.com","https://mappedin-staging.auth0.com/userinfo","https://mappedin.com","https://mappedin.auth0.com/userinfo"],Tg={orange:"#F26336",teal:"#057685",lightTeal:"#5DC7D0"};var vg=new Set(["outdoorView","bearing","pitch","zoomLevel","screenOffsets","debug","initialFloor","shadingAndOutlines","wallTopColor","style","multiFloorView","occlusion","imagePlacementOptions","flipImagesToFaceCamera","injectStyles","useStandaloneCamera","preloadFloors"]),Ig=new Set(["style","enabled","layersHiddenByGeometry","lowDpi"]);function Za(o){o.outdoorView?.enabled&&!o.outdoorView?.token&&C.error("Enable outdoor view requires a token. Provide token in `options.outdoorView.token`")}function Ja(o,e){let t=o?.outdoorView?.token||e.outdoorViewToken,r={...Zr,...o,outdoorView:{enabled:o?.outdoorView?.enabled===void 0?!!t:o?.outdoorView?.enabled,layersHiddenByGeometry:Zr.outdoorView?.layersHiddenByGeometry,...o?.outdoorView},bearing:o?.bearing??e.naturalBearing??0,imagePlacementOptions:{...Zr.imagePlacementOptions,...o?.imagePlacementOptions},multiFloorView:{...Zr.multiFloorView,...o?.multiFloorView},disableUpdateStateValidation:o?.disableUpdateStateValidation??!1};return t&&r.outdoorView&&(r.outdoorView.token=t),r}function np(o){let e={remove_watermark:!1};if(o)try{let t=Jn(o);Object.assign(e,t.capabilities)}catch(t){C.error("Error decoding capabilities from token",t)}return e}function ip(o){let e=Object.fromEntries(Object.entries(o).filter(([t])=>vg.has(t)));return e.outdoorView&&(e.outdoorView=Object.fromEntries(Object.entries(e.outdoorView).filter(([t])=>Ig.has(t)))),e}var qa=class o extends ke{static __type="area";__type=o.__type;#e;#t;#o={};#r;static is(e){return e.__type===o.__type}constructor(e,t){super(e,t.mvfData),this.#e=e,this.#t=t.floorId,this.#r=t.mvfData}get center(){return this.#o.center==null&&(this.#o.center=Ze(this.#r,this.#t)),this.#o.center}get floor(){let e=this.#e.getById("floor",this.#t);if(e==null)throw new Error(`Floor ${this.#t} not found!`);return e}get images3D(){let e=this.#e.floorImagesByAnchorId.get(this.id)??[],t=this.#i();return t?[...e,t]:e}#i(){let e=this.#r.properties;if(e.image!=null)return this.#o.polygonImage==null&&(this.#o.polygonImage=new mt(`${this.id}-polygon-image-${ee()}`,e.image.path,this,this.#e.tokenManager)),this.#o.polygonImage}get geoJSON(){return{...this.#r,properties:null}}get focusTarget(){return this}get anchorTarget(){return this.center}get navigationTarget(){return this}toJSON(){return{__type:o.__type,id:this.id,name:this.name,floor:this.floor.id}}destroy(){}},Ct=qa;f();var Qa=class o extends ke{static __type="door";__type=o.__type;#e;#t;#o;#r;static is(e){return e.__type===o.__type}constructor(e,t){super(e,t.mvfData),this.#t={},this.#r=t.mvfData,this.#e=e,this.#o=t.floorId}get floor(){let e=this.#e.getById("floor",this.#o);if(e==null)throw new Error(`Floor ${this.#o} not found!`);return e}get center(){return this.#t.center==null&&(this.#t.center=Ze(this.#r,this.#o)),this.#t.center}get isExterior(){if(this.#r.properties.isExterior!==void 0)return this.#r.properties.isExterior;let e=this.#e.obstructionIdByEntranceId[this.id];return this.#e.getMVFFeatureById("obstruction",e)?.properties.footprintComponent??!1}get geoJSON(){return{...this.#r,properties:null}}get focusTarget(){return this.center}get anchorTarget(){return this.center}get navigationTarget(){return this}toJSON(){return{__type:o.__type,id:this.id,name:this.name,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of Object.keys(this.#t))delete this.#t[e]}},et=Qa;f();var Ka=class o extends ke{static __type="space";__type=o.__type;#e;#t;#o={};#r;static is(e){return e.__type===o.__type}constructor(e,t){super(e,t.mvfData),this.#e=e,this.#t=t.floorId,this.#r=t.mvfData}get type(){return Eg(this.#r.properties.kind)}get enterpriseLocations(){return this.#o.enterpriseLocations!=null?this.#o.enterpriseLocations:(this.#o.enterpriseLocations=ai(this.#e,this.id),this.#o.enterpriseLocations)}get locations(){return this.enterpriseLocations}get floor(){let e=this.#e.getById("floor",this.#t);if(e==null)throw new Error(`Floor ${this.#t} not found!`);return e}get doors(){if(this.#o.doors)return this.#o.doors;this.#o.doors=[];let e=this.#e.entranceNodeIdsBySpaceId?.[this.id]??[];for(let t of e){let r=this.#e.doorsByNodeId[t];r&&this.#o.doors.push(r)}return this.#o.doors}get images3D(){let e=this.#e.floorImagesByAnchorId.get(this.id)??[],t=this.#i();return t?[...e,t]:e}#i(){let e=this.#r.properties;if(e.image!=null)return this.#o.polygonImage==null&&(this.#o.polygonImage=new mt(`${this.id}-polygon-image-${ee()}`,e.image.path,this,this.#e.tokenManager)),this.#o.polygonImage}get center(){return this.#o.center==null&&(this.#o.center=Ze(this.#r,this.#t)),this.#o.center}get geoJSON(){return{...this.#r,properties:null}}get focusTarget(){return this.geoJSON.geometry.type==="Polygon"?this:this.center}get anchorTarget(){return this.center}get navigationTarget(){return this}toJSON(){return{__type:o.__type,id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of Object.keys(this.#o))delete this.#o[e]}},Sg=["room","hallway","exterior","void","gate","otb"];function Eg(o){if(o==null||o==="default")return"room";let e=o.toLowerCase();return Sg.includes(e)?e:"room"}var Ie=Ka;f();var es=class o extends Vt{static __type="floor";__type=o.__type;#e;#t={};#o;static is(e){return e.__type===o.__type}constructor(e,t){super(t.mvfData.properties.id,e),this.#e=e,this.#o=t.mvfData}#r(e){let t=this.#o.properties[e];return this.#e.getPropTranslation(this.__type,e,this.id,t)}get focusTarget(){return this}get name(){if(!("name"in this.#o.properties))return this.#o.properties.externalId??"";let e=this.#r("name");return typeof e=="string"?e:""}get shortName(){if(!("shortName"in this.#o.properties))return this.#o.properties.externalId??"";let e=this.#r("shortName");return typeof e=="string"?e:""}get subtitle(){let e=this.#r("subtitle");return typeof e=="string"?e:""}get externalId(){return this.#o.properties.externalId??""}get elevation(){return this.#o.properties.elevation}get maxHeight(){return this.#o.properties.maxHeight}get spaces(){if(this.#t.spaces==null){let e=this.#e.spaces.filter(t=>t.floor.id===this.id);this.#t.spaces=e}return this.#t.spaces}get spacesOpenToBelow(){if(this.#t.spacesOpenToBelow==null){let e=[];for(let t of this.spaces)(t.type==="void"||t.type==="otb")&&e.push(t);this.#t.spacesOpenToBelow=e}return this.#t.spacesOpenToBelow}get geoJSON(){return{type:"Feature",properties:null,geometry:this.#o.geometry??{type:"Polygon",coordinates:[]}}}get objects(){if(this.#t.objects==null){let e=this.#e.objects.filter(t=>t.floor.id===this.id);this.#t.objects=e}return this.#t.objects}get connections(){if(this.#t.connections==null){let e=this.#e.connections.filter(t=>t.floors.includes(this));this.#t.connections=e}return this.#t.connections}get doors(){if(this.#t.doors==null){let e=this.#e.doors.filter(t=>t.floor.id===this.id);this.#t.doors=e}return this.#t.doors}get annotations(){if(this.#t.annotations==null){let e=this.#e.annotations.filter(t=>t.floor.id===this.id);this.#t.annotations=e}return this.#t.annotations}get pois(){if(this.#t.pois==null){let e=this.#e.pointsOfInterest.filter(t=>t.floor.id===this.id);this.#t.pois=e}return this.#t.pois}get floorStack(){if(this.#t.floorStack==null){let e=this.#e.floorStacks.find(t=>t.floors.includes(this));this.#t.floorStack=e}return this.#t.floorStack}get center(){return this.#t.center==null&&(this.#t.center=Ze(this.#o,this.id)),this.#t.center}toJSON(){return{__type:o.__type,id:this.id,name:this.name,shortName:this.shortName,subtitle:this.subtitle,elevation:this.elevation,maxHeight:this.maxHeight,spaces:this.spaces.map(e=>e.id),objects:this.objects.map(e=>e.id),connections:this.connections.map(e=>e.id),doors:this.doors.map(e=>e.id),annotations:this.annotations.map(e=>e.id),pois:this.pois.map(e=>e.id)}}destroy(){for(let e of globalThis.Object.keys(this.#t))delete this.#t[e]}},pt=es;f();var ts=class o extends ke{static __type="connection";__type=o.__type;#e;#t;#o;static is(e){return e.__type===o.__type}constructor(e,t){super(e,{type:"Feature",geometry:{type:"Point",coordinates:[0,0]},properties:t.mvfData}),this.#t={},this.#e=e,this.#o=t.mvfData}get accessible(){return this.#o.accessible??!1}get type(){return this.#o.type??"unknown"}get extra(){return this.#o.extra}get coordinates(){if(this.#t.coordinates==null){this.#t.coordinates=[];for(let e of this.nodes)this.#t.coordinates.some(t=>t.isEqual(e.coordinate))||this.#t.coordinates.push(e.coordinate)}return this.#t.coordinates}get nodes(){return this.#o.nodes.map(e=>this.#e.getById("node",e)).filter(er)}get floors(){return this.coordinates.map(e=>e.floorId?this.#e.getById("floor",e.floorId):void 0).filter(er)}get focusTarget(){return this.coordinates}get navigationTarget(){return this.coordinates}toJSON(){return{__type:o.__type,id:this.id,name:this.name,type:this.type,externalId:this.externalId,coordinates:this.coordinates.map(e=>e.toJSON()),floors:this.floors.map(e=>e.id),extra:this.extra}}destroy(){for(let e of Object.keys(this.#t))delete this.#t[e]}},ze=ts;f();var os=class o extends ke{static __type="object";__type=o.__type;#e;#t;#o={};#r;static is(e){return e.__type===o.__type}constructor(e,t){super(e,t.mvfData),this.#e=e,this.#t=t.floorId,this.#r=t.mvfData}get type(){let e=this.#r.properties.kind;return e==null&&(e="object"),e==="Desks"&&(e="desk"),e.toLowerCase()}get enterpriseLocations(){return this.#o.enterpriseLocations!=null?this.#o.enterpriseLocations:(this.#o.enterpriseLocations=ai(this.#e,this.id),this.#o.enterpriseLocations)}get locations(){return this.enterpriseLocations}get floor(){let e=this.#e.getById("floor",this.#t);if(e==null)throw new Error(`Floor ${this.#t} not found!`);return e}get center(){return this.#o.center==null&&(this.#o.center=Ze(this.#r,this.#t)),this.#o.center}get images3D(){let e=this.#e.floorImagesByAnchorId.get(this.id)??[],t=this.#i();return t?[...e,t]:e}#i(){let e=this.#r.properties;if(e.image!=null)return this.#o.polygonImage==null&&(this.#o.polygonImage=new mt(`${this.id}-polygon-image-${ee()}`,e.image.path,this,this.#e.tokenManager)),this.#o.polygonImage}get geoJSON(){return{...this.#r,properties:null}}get anchorTarget(){return this.center}get focusTarget(){return this.geoJSON.geometry.type==="Polygon"?this:this.center}get navigationTarget(){return this}toJSON(){return{__type:o.__type,id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of globalThis.Object.keys(this.#o))this.#o[e]=null}},dt=os;f();var rs=class o extends ke{static __type="point-of-interest";__type=o.__type;#e;#t;#o={};#r;static is(e){return e.__type===o.__type}get navigationTarget(){return this.coordinate}constructor(e,t){super(e,t.mvfData),this.#e=e,this.#r=t.mvfData,this.#t=t.floorId}get floor(){let e=this.#e.getById("floor",this.#t);if(e==null)throw new Error(`Floor ${this.#t} not found!`);return e}get coordinate(){return this.#o.coordinate==null&&(this.#o.coordinate=Ze(this.#r,this.#t)),this.#o.coordinate}get geoJSON(){return{...this.#r,properties:null}}get images3D(){return this.#e.floorImagesByAnchorId.get(this.id)??[]}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:o.__type,id:this.id,name:this.name,floor:this.floor.id,coordinate:this.coordinate.toJSON()}}destroy(){for(let e in this.#o)this.#o[e]=null}},yt=rs;f();var ns=class o extends ke{static __type="annotation";__type=o.__type;#e;#t;#o={};#r;#i;static is(e){return e.__type===o.__type}constructor(e,t){super(e,t.mvfData),this.#e=e,this.#t=t.floorId,this.#r=t.mvfData,this.#i=t.symbol??{url:"",name:""}}#n(){let[e,t]=this.#r.properties.symbolId.split("--");return{group:e,type:t}}get group(){return this.#n().group}get type(){return this.#n().type}get coordinate(){return this.#o.coordinate==null&&(this.#o.coordinate=Ze(this.#r,this.#t)),this.#o.coordinate}get floor(){let e=this.#e.getById("floor",this.#t);if(e==null)throw new Error(`Floor ${this.#t} not found!`);return e}get name(){return super.name||this.#i.name||""}get icon(){return this.#o.icon==null&&(this.#o.icon=super.icon||new Kt({mvfData:{url:this.#i.url,altText:this.#i.name},mapData:this.#e})),this.#o.icon}get geoJSON(){return{...this.#r,properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}get navigationTarget(){return this.coordinate}toJSON(){return{__type:o.__type,id:this.id,group:this.group,type:this.type,coordinate:this.coordinate.toJSON()}}destroy(){for(let e of Object.keys(this.#o))delete this.#o[e]}},Ut=ns;f();f();var ap=Xn(ss(),1);function Mg(o,e,t){t===void 0&&(t={});var r=Qo(o),n=Qo(e),i=ap.default.union(r.coordinates,n.coordinates);return i.length===0?null:i.length===1?Yn(i[0],t.properties):Zn(i,t.properties)}var si=Mg;var ls=class o extends Vt{static __type="floor-stack";__type=o.__type;#e;#t={};#o;#r;static is(e){return e.__type===o.__type}constructor(e,t){super(t.mvfData.id,e),this.#e=e,this.#o=t.mvfData,this.#r=t.facadeId}#i(e){return this.#e.getPropTranslation(this.__type,e,this.id,this.#o[e])}get type(){return this.#o.type}get name(){let e=this.#i("name");return typeof e=="string"?e:""}get shortName(){let e=this.#i("shortName");return typeof e=="string"?e:""}get externalId(){return this.#o.externalId??""}get floors(){if(this.#t.floors==null){let e=(this.#o.floors??this.#o.maps??[]).reduce((t,r)=>{let n=this.#e.floorsById[r];return n&&t.push(n),t},[]);e.length===0&&C.error(`Floor stack ${this.id} has no floors`),this.#t.floors=e.sort((t,r)=>t.elevation-r.elevation)}return this.#t.floors}get defaultFloor(){if(this.#t.defaultFloor!=null)return this.#t.defaultFloor;let e=this.#o.defaultFloor?this.#e.getById("floor",this.#o.defaultFloor):void 0;if(e)return this.#t.defaultFloor=e,this.#t.defaultFloor;let t=this.floors;if(t.length!==0)return this.#t.defaultFloor=t.reduce((r,n)=>Math.abs(n.elevation)<Math.abs(r.elevation)?n:r),this.#t.defaultFloor}get facade(){return this.#r?this.#e.facadesById[this.#r]:void 0}get focusTarget(){return this}get geoJSON(){if(this.#t.geoJSON!=null)return this.#t.geoJSON;let e=null;for(let t of this.floors){let r=t.geoJSON;e==null?e=r:e=si(e,r)}return this.#t.geoJSON=e??{type:"Feature",properties:null,geometry:{type:"Polygon",coordinates:[]}},this.#t.geoJSON}toJSON(){return{__type:o.__type,id:this.id,name:this.name,shortName:this.shortName,type:this.type,floors:this.floors.map(e=>e.id)}}destroy(){for(let e of globalThis.Object.keys(this.#t))delete this.#t[e]}},fr=ls;f();var cs=class o extends Vt{static __type="facade";__type=o.__type;static is(e){return e.__type===o.__type}#e;#t;#o;#r={};constructor(e,t){super(t.mvfData.id,e),this.#e=t.mvfData,this.#t=e,this.#o=t.floorStackId}get floorStack(){return this.#t.getById("floor-stack",this.#o)}get spaces(){if(!this.#r.spaces){this.#r.spaces=[];for(let e of this.#e.spaces){let t=this.#t.getById("space",e.spaceId);t&&this.#r.spaces.push(t)}}return this.#r.spaces}get center(){if(!this.#r.center){let e={type:"FeatureCollection",features:[]};for(let r of this.spaces){let n=this.#t.mvfSpacesById[r.id];n&&e.features.push(n)}if(e.features.length===0)throw new Oe("No geometry found for facade!");let t=ar(e);this.#r.center=new H({latitude:t.geometry.coordinates[1],longitude:t.geometry.coordinates[0],floorId:this.#e.spaces[0].floorId})}return this.#r.center}get focusTarget(){return this.spaces}get anchorTarget(){return this.center}get navigationTarget(){return this}toJSON(){return{id:this.id,__type:o.__type,floorStackId:this.#o,floorStack:this.floorStack,spaces:this.spaces}}},Ve=cs;f();var xg=new Set(["wall","area"]),Cg=new Set(["desk-entrance"]),_g=o=>{let e={};for(let t of o?.locations??[])e[t.id]=t;return{mvf3LocationsById:e}},Pg=(o,e,t)=>{let r={},n={},i={},a={},s={},l={};for(let c of e["location.json"]||[]){let p=new co(o,{mvf2Data:c,mvf3Data:t[c.id]});if(r[c.id]=p,c.externalId&&(a[c.externalId]==null&&(a[c.externalId]=[]),a[c.externalId].push(p)),c.categories)for(let g of c.categories)s[g]==null&&(s[g]=[]),s[g].push(p);let h=[...c.obstructions?.map(g=>g.id)??[],...c.spaces?.map(g=>g.id)??[],...c.annotations?.map(g=>g.id)??[],...c.connections??[],...c.entrances?.map(g=>g.id)??[],...c.areas?.map(g=>g.id)??[]];for(let g of h)g&&(l[g]==null&&(l[g]=[]),l[g].push(p))}for(let c of e["category.json"]||[]){let p=new ci(o,{mvfData:c});n[c.id]=p,c.parent&&(i[c.parent]==null&&(i[c.parent]=[]),i[c.parent].push(p))}return{locationCategoriesByParentId:i,locationProfilesById:r,locationCategoriesById:n,locationProfilesByExternalId:a,locationProfilesByCategoryId:s,locationProfilesByAttachedFeatureId:l}},Og=(o,e)=>{let t={},r={},n={},i={},a={},s={},l={},c={},p={},h=globalThis.Object.keys(o.space);for(let g of h){let T=o.space[g];if(T!=null){for(let I of T.features)if(p[I.properties.id]=g,s[I.properties.id]=I,I.properties.kind==="desk-entrance"&&(a[I.properties.externalId]==null&&(a[I.properties.externalId]=[]),a[I.properties.externalId].push(...I.properties.destinationNodes)),!Hg(I))if(I.properties.kind==="poi"||I.geometry.type==="Point"&&I.properties.kind==null){let E=new yt(e,{floorId:g,mvfData:I});n[I.properties.id]=E,c[g]||(c[g]=[]),c[g].push(I),I.properties.externalId&&(i[I.properties.externalId]==null&&(i[I.properties.externalId]=[]),i[I.properties.externalId].push(E))}else if(I.geometry.type==="Point")C.warn("Encountered a point space with an unknown kind!",I.properties.kind);else{let E=new Ie(e,{floorId:g,mvfData:I});t[I.properties.id]=E,I.properties.externalId&&(r[I.properties.externalId]==null&&(r[I.properties.externalId]=[]),r[I.properties.externalId].push(E)),l[g]||(l[g]=[]),l[g].push(I)}}}return{spacesById:t,spacesByExternalId:r,poisById:n,poisByExternalId:i,objectEntranceNodeIdsByObstructionId:a,mvfSpacesById:s,mvfSpacesByFloorId:l,mvfPoisByFloorId:c}},Dg=(o,e)=>{let t={},r={},n={},i={};for(let a of o["node.geojson"].features){n[a.properties.id]=a;let s=new xt(e,{mvfData:a,floorId:a.properties.floor??a.properties.map});t[a.properties.id]=s,a.properties.externalId&&(r[a.properties.externalId]==null&&(r[a.properties.externalId]=[]),r[a.properties.externalId].push(s));let l=a.properties.floor??a.properties.map;i[l]||(i[l]=[]),i[l].push(a)}return{nodesById:t,nodesByExternalId:r,mvfNodesById:n,mvfNodesByFloorId:i}},wg=(o,e)=>{let t={},r={},n={},i={},a=globalThis.Object.keys(o.obstruction);for(let s of a){let l=o.obstruction[s];if(l!=null)for(let c of l.features){n[c.properties.id]=c;for(let h of c.properties.entrances)i[h]=c.properties.id;if(xg.has(c.properties.kind?.toLowerCase()??""))continue;let p=new dt(e,{floorId:s,mvfData:c});t[c.properties.id]=p,c.properties.externalId&&(r[c.properties.externalId]==null&&(r[c.properties.externalId]=[]),r[c.properties.externalId].push(p))}}return{objectsById:t,objectsByExternalId:r,mvfObstructionById:n,obstructionIdByEntranceId:i}},Ag=(o,e)=>{let t={},r={},n={};if("floor.geojson"in o&&o["floor.geojson"]!=null)for(let i of o["floor.geojson"].features){n[i.properties.id]=i.properties;let a=new pt(e,{mvfData:i});t[i.properties.id]=a,i.properties.externalId&&(r[i.properties.externalId]==null&&(r[i.properties.externalId]=[]),r[i.properties.externalId].push(a))}else for(let i of o["map.geojson"]){n[i.id]=i;let a=new pt(e,{mvfData:{properties:i}});t[i.id]=a}return{floorsById:t,floorsByExternalId:r,mvfFloorsById:n}},Fg=(o,e)=>{let t={},r={},n={},i={},a={},s=o["floorstack.json"]||o["mapstack.json"]||o["mapstack.geojson"];if(s!=null)for(let l of s){let c=o.facade?.[l.id],p=new fr(e,{mvfData:l,facadeId:c?.id});if(t[l.id]=p,l.externalId&&(r[l.externalId]==null&&(r[l.externalId]=[]),r[l.externalId].push(p)),n[l.id]=l,c){let h=new Ve(e,{mvfData:c,floorStackId:l.id});i[c.id]=h;for(let g of c.spaces)a[g.spaceId]=h}}return{floorStacksById:t,floorStacksByExternalId:r,mvfFloorStacksById:n,facadesById:i,facadesBySpaceId:a}},kg=(o,e)=>{let t={},r={},n=o["connection.json"].reduce((i,a)=>{if(a.nodes.forEach(l=>i[l]=a),r[a.id]=a,a.type==="door")return i;let s=new ze(e,{mvfData:a});return t[a.id]=s,i},{});return{connectionsById:t,mvfConnectionsById:r,mvfConnectionsByNodeId:n}},Lg=(o,e)=>{let t={},r={},n={},i={},a={},s=globalThis.Object.keys(o.entrance);for(let l of s){let c=o.entrance[l];if(c!=null)for(let p of c.features){i[p.properties.id]=p;let h=new et(e,{floorId:l,mvfData:p});p.properties.node&&(n[p.properties.node]=h),t[p.properties.id]=h,p.properties.externalId&&(r[p.properties.externalId]==null&&(r[p.properties.externalId]=[]),r[p.properties.externalId].push(h)),a[l]||(a[l]=[]),a[l].push(p)}}return{doorsById:t,doorsByExternalId:r,doorsByNodeId:n,mvfEntrancesById:i,mvfEntrancesByFloorId:a}},Rg=(o,e,t)=>{if(o.textAreas!=null)for(let r in o.textAreas){let n=o.textAreas[r]?.features;if(n!=null){for(let i of n)if("anchorId"in i.properties){let a=i?.properties,s=e[a.anchorId]||t[a.anchorId];if(s!=null&&a!=null){let l=s.properties;l.textArea=a,l.textArea&&(l.textArea.position=i.geometry.coordinates)}}}}},Ng=(o,e,t,r)=>{if(o.floorImages!=null)for(let n in o.floorImages){let i=o.floorImages[n]?.features;if(i!=null){for(let a of i)if("anchorId"in a.properties){let s=a?.properties,l=e[s.anchorId]||t[s.anchorId]||r[s.anchorId];if(l!=null&&s!=null){let c=l.properties;c.image=s,c.image&&(c.image.position=a.geometry.coordinates)}}}}},Bg=(o,e)=>{if(o.enterprise?.enterpriseStyles==null)return;let t=o.enterprise?.enterpriseStyles;for(let r in t){let n=t[r];n.geometryAnchors.forEach(i=>{let a=e[i.geometryId];if(a!=null){let s=a.properties;s.style={styleId:r,edgeOffset:n.edgeOffset}}})}},Vg=(o,e,t)=>{if(!(o.enterprise==null||o.enterprise.textures==null))for(let r of o.enterprise.textures)for(let n of r.geometryAnchors){let i=e[n.geometryId]||t[n.geometryId];if(i!=null){let a=i.properties;a.textures==null&&(a.textures=[]),a.textures.push(r)}}},jg=(o,e)=>{let t={},r={},n={};if(o.annotation==null)return{annotationsById:t,mvfAnnotationsById:r,mvfAnnotationsByFloorId:n};let i=o["annotation-symbols.json"]||{},a=globalThis.Object.keys(o.annotation);for(let s of a){let l=o.annotation[s];if(l!=null)for(let c of l.features){r[c.properties.id]=c;let p=new Ut(e,{floorId:s,mvfData:c,symbol:i[c.properties.symbolId]});t[c.properties.id]=p,n[s]||(n[s]=[]),n[s].push(c)}}return{annotationsById:t,mvfAnnotationsById:r,mvfAnnotationsByFloorId:n}},Gg=(o,e)=>{let t={},r={},n={};if(o.area==null)return{areasById:t,areasByExternalId:r,mvfAreasById:n};let i=globalThis.Object.keys(o.area);for(let a of i){let s=o.area[a];if(s!=null)for(let l of s.features){n[l.properties.id]=l;let c=new Ct(e,{floorId:a,mvfData:l});t[l.properties.id]=c,l.properties.externalId&&(r[l.properties.externalId]==null&&(r[l.properties.externalId]=[]),r[l.properties.externalId].push(c))}}return{areasById:t,areasByExternalId:r,mvfAreasById:n}},Ug=(o,e)=>{let t={},r={},n={},i={};for(let a in o){let s=o[a];if(s==null)continue;let l=s.properties.destinationNodes??[];if(l.length<1)continue;let c=[];for(let p of l)e[p]!=null&&c.push(p),r[p]==null&&(r[p]=[]),r[p].push(s.properties.id),s.properties.kind==="desk-entrance"&&(n[p]==null&&(n[p]=[]),n[p].push(s.properties.externalId));c.length>0&&(t[a]=c),i[a]=l}return{entranceNodeIdsBySpaceId:t,spaceIdsByNodeId:r,objectIdsByNodeId:n,destinationNodesIdsBySpaceId:i}},sp=(o,e)=>{let t={},r={},n={},i={},a=(o.enterprise?.locations??[]).reduce((A,U)=>(A[U.id]=U,A),{}),s={},l={},c={},p={},h={},g={},T=o.enterprise?.venue||{},I={},E={},D={};for(let A of o.enterprise?.categories??[]){let U=new li(e,{mvfData:A});s[A.id]=U,A.externalId&&(l[A.externalId]==null&&(l[A.externalId]=[]),l[A.externalId].push(U)),c[A.id]=A,A.locations.forEach(R=>{h[R]==null&&(h[R]=[]),h[R].push(A.id)})}let x={};for(let A of o.enterprise?.locationInstances??[]){let U=a[A.parent],R=Object.keys(U),B={};for(let j of R)B[j]=void 0;let V={...B,polygons:[],nodes:[],...A};x[V.parent]==null&&(x[V.parent]=[]);let L=new ct(e,{mvfData:V,categoryIds:o.enterprise?.categoryPriorities?.[V.id]||h[V.id],parentId:A.parent});x[V.parent].push(L);for(let j of A.polygons??[])D[j.id]=L;I[V.id]=A,E[V.id]=L,A.externalId&&(i[A.externalId]==null&&(i[A.externalId]=[]),i[A.externalId].push(L))}for(let A of o.enterprise?.locations??[]){let U=new ct(e,{mvfData:A,categoryIds:o.enterprise?.categoryPriorities?.[A.id]||h[A.id],locationInstances:x[A.id]});n[A.id]=U,A.externalId&&(i[A.externalId]==null&&(i[A.externalId]=[]),i[A.externalId].push(U)),A.nodes.forEach(R=>{g[R.id]==null&&(g[R.id]=[]),g[R.id].push(A.id)});for(let R of A.polygons)p[R.id]==null&&(p[R.id]=[]),p[R.id].push(A)}if(e.enterpriseMode===!0){for(let A in e.mvfConnectionsById){let U={},R=e.mvfConnectionsById[A],B={id:A,externalId:R.externalId,kind:"enterprise."+R.type,destinationNodes:[],flags:R.flags,type:R.type,nodes:R.nodes,accessible:R.accessible,extra:R.extra,details:R.details};for(let V of e.mvfConnectionsById[A].nodes){let L=e.nodesById[V];L!=null&&(U[L.floor.id]={type:"Feature",geometry:{type:"Point",coordinates:[L.coordinate.longitude,L.coordinate.latitude]},properties:B})}Object.keys(U).length>0&&(t[A]=new ze(e,{mvfData:B}),R.externalId&&(r[R.externalId]==null&&(r[R.externalId]=[]),r[R.externalId].push(t[A])))}e.connectionsById=t}return{connectionsByExternalId:r,locationIdsByNodeId:g,mvfLocationsByGeometryId:p,mvfLocationsById:a,mvfCategoriesById:c,locationsById:n,locationInstancesById:E,instanceLocationsByPolygonId:D,locationsByExternalId:i,mvfLocationInstancesById:I,categoriesById:s,categoriesByExternalId:l,venue:T}},lp=(o,e,t)=>{let{nodesById:r,nodesByExternalId:n,mvfNodesById:i,mvfNodesByFloorId:a}=Dg(e,o),{connectionsById:s,mvfConnectionsById:l,mvfConnectionsByNodeId:c}=kg(e,o),{spacesById:p,spacesByExternalId:h,poisById:g,poisByExternalId:T,mvfSpacesById:I,objectEntranceNodeIdsByObstructionId:E,mvfSpacesByFloorId:D,mvfPoisByFloorId:x}=Og(e,o),{objectsById:A,objectsByExternalId:U,mvfObstructionById:R,obstructionIdByEntranceId:B}=wg(e,o),{floorsById:V,floorsByExternalId:L,mvfFloorsById:j}=Ag(e,o),{floorStacksById:te,floorStacksByExternalId:ie,mvfFloorStacksById:oe,facadesById:ce,facadesBySpaceId:Te}=Fg(e,o),{doorsById:xe,doorsByExternalId:Re,doorsByNodeId:re,mvfEntrancesById:Yt,mvfEntrancesByFloorId:it}=Lg(e,o),{annotationsById:Zt,mvfAnnotationsById:ue,mvfAnnotationsByFloorId:ge}=jg(e,o),{areasById:vt,areasByExternalId:pe,mvfAreasById:It}=Gg(e,o);Ng(e,I,R,It),Rg(e,I,R),Bg(e,I),Vg(e,I,R);let{mvf3LocationsById:le}=_g(t),{locationCategoriesByParentId:Je,locationProfilesById:Dt,locationCategoriesById:qe,locationProfilesByExternalId:Oo,locationProfilesByCategoryId:mo,locationProfilesByAttachedFeatureId:Xo}=Pg(o,e,le),{entranceNodeIdsBySpaceId:He,spaceIdsByNodeId:wt,objectIdsByNodeId:$e,destinationNodesIdsBySpaceId:St}=Ug(I,re);return{spacesById:p,spacesByExternalId:h,nodesById:r,nodesByExternalId:n,objectsById:A,objectsByExternalId:U,floorsById:V,floorsByExternalId:L,floorStacksById:te,floorStacksByExternalId:ie,facadesById:ce,facadesBySpaceId:Te,connectionsById:s,doorsById:xe,doorsByExternalId:Re,doorsByNodeId:re,poisById:g,poisByExternalId:T,annotationsById:Zt,areasById:vt,areasByExternalId:pe,objectEntranceNodeIdsByObstructionId:E,obstructionIdByEntranceId:B,locationProfilesById:Dt,locationCategoriesById:qe,locationProfilesByExternalId:Oo,locationProfilesByCategoryId:mo,locationCategoriesByParentId:Je,mvfSpacesById:I,mvfNodesById:i,mvfObstructionById:R,mvfFloorsById:j,mvfFloorStacksById:oe,mvfConnectionsById:l,mvfConnectionsByNodeId:c,mvfEntrancesById:Yt,mvfAnnotationsById:ue,mvfNodesByFloorId:a,mvfSpacesByFloorId:D,mvfPoisByFloorId:x,mvfAreasById:It,mvfEntrancesByFloorId:it,mvfAnnotationsByFloorId:ge,locationProfilesByAttachedFeatureId:Xo,entranceNodeIdsBySpaceId:He,spaceIdsByNodeId:wt,objectIdsByNodeId:$e,destinationNodesIdsBySpaceId:St,mvf3LocationsById:le}};function Hg(o){return!["Polygon","MultiPolygon"].includes(o.geometry.type)&&"kind"in o.properties&&o.properties.kind==null||o.properties.kind?.includes("connection")||Cg.has(o.properties.kind??"")}f();var Wg=new Set(["polygons"]),ps=class o extends Fe{static __type="enterprise-location";__type=o.__type;description;name="";amenity;externalId="";extra;gallery;instances;logo;operationHours;phone;picture;shortName;showFloatingLabelWhenImagePresent;showLogo;siblingGroups;social;sortOrder=-1;states;tags;type="";hidden=!1;primaryCategory;#e;#t={};#o;#r;static is(e){return e.__type===o.__type}constructor(e,t){super(t.mvfData.externalId),this.#e=e,this.#o=t.mvfData,this.#r=t.categoryIds||[],this.instances=t.locationInstances||[];for(let r in t.mvfData)!Wg.has(r)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),r)&&Object.defineProperty(this,r,{enumerable:!0,get(){if(t.parentId){let n=this.#e.locationsById[t.parentId];return this.#o[r]!=null?this.#e.getPropTranslation(this.__type,r,this.#o.id,this.#o[r]):this.#e.getPropTranslation(this.__type,r,this.#o.id,n[r])}return this.#e.getPropTranslation(this.__type,r,this.#o.id,this.#o[r])}})}get focusTarget(){return this.spaces.length>0?this.spaces:this.coordinates}get navigationTarget(){return this.spaces}get categories(){return this.#t.categories?this.#t.categories:(this.#t.categories=(this.#r.map(e=>this.#e.getById("enterprise-category",e))||[]).filter(Boolean),this.#t.categories)}get coordinates(){if(this.#t.coordinates)return this.#t.coordinates;this.#t.coordinates=[];for(let e=0;e<this.nodes.length;e++)this.#t.coordinates.push(this.nodes[e].coordinate);return this.#t.coordinates}get nodes(){if(this.#t.nodes)return this.#t.nodes;this.#t.nodes=[];for(let e=0;e<this.#o.nodes.length;e++){let t=this.#e.getById("node",this.#o.nodes[e].id);t&&this.#t.nodes.push(t)}return this.#t.nodes}get points(){if(this.#t.points)return this.#t.points;this.#t.points=[];for(let e=0;e<this.#o.spaces.length;e++){let t=this.#e.getById("point-of-interest",this.#o.spaces[e].id);t&&this.#t.points.push(t)}return this.#t.points}get spaces(){if(this.#t.spaces)return this.#t.spaces;this.#t.spaces=[];let e=Array.isArray(this.#o.spaces)?this.#o.spaces:this.#o.polygons;for(let t=0;t<e.length;t++){let r=this.#e.getById("space",e[t].id);r&&this.#t.spaces.push(r)}return this.#t.spaces}get objects(){if(this.#t.objects)return this.#t.objects;this.#t.objects=[];for(let e=0;e<this.#o.polygons.length;e++){let t=this.#e.getById("object",this.#o.polygons[e].id);t&&this.#t.objects.push(t)}return this.#t.objects}toJSON(){return{__type:o.__type,id:this.id,name:this.name}}destroy(){for(let e of Object.keys(this.#t))delete this.#t[e]}},ct=ps;f();var zg=new Set,ds=class o extends Fe{static __type="enterprise-category";__type=o.__type;name="";color;externalId="";extra;icon;iconFromDefaultList;sortOrder=-1;picture;#e;#t={};#o;static is(e){return e.__type===o.__type}constructor(e,t){super(t.mvfData.externalId),this.#e=e,this.#o=t.mvfData;for(let r in t.mvfData)!zg.has(r)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),r)&&Object.defineProperty(this,r,{get(){return this.#e.getPropTranslation(this.__type,r,this.#o.id,this.#o[r])}})}get children(){if(this.#t.children)return this.#t.children;this.#t.children=[];for(let e=0;e<this.#o.children.length;e++){let t=this.#e.getById("enterprise-category",this.#o.children[e]);t&&this.#t.children.push(t)}return this.#t.children}get locations(){if(this.#t.locations)return this.#t.locations;this.#t.locations=[];for(let e=0;e<this.#o.locations.length;e++){let t=this.#e.getById("enterprise-location",this.#o.locations[e]);t&&this.#t.locations.push(t)}return this.#t.locations}toJSON(){return{__type:o.__type,id:this.id,name:this.name}}destroy(){for(let e of Object.keys(this.#t))delete this.#t[e]}},li=ds;f();var Xg=new Set,us=class o extends Fe{static __type="enterprise-venue";__type=o.__type;countrycode;coverImage;externalId="";defaultLanguage={code:"en",name:"English"};defaultFloor;extra;icon;languages=[];links=[];logo;mappedinWebUrl;operationHours;slug="";topLocations;tzid;#e={};#t;static is(e){return e.__type===o.__type}constructor(e,t){super(t.mvfData.externalId),this.#t=t.mvfData;for(let r in t.mvfData)!Xg.has(r)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),r)&&(this[r]=t.mvfData[r])}get name(){return this.#t.name??""}get defaultMap(){return this.#t.defaultMap??this.defaultFloor??""}get enterpriseType(){return this.#t.type??void 0}toJSON(){return{__type:o.__type,id:this.id,name:this.name}}destroy(){for(let e of Object.keys(this.#e))delete this.#e[e]}},fs=us;f();f();f();f();f();var cp=(i=>(i.Departure="Departure",i.TakeConnection="TakeConnection",i.ExitConnection="ExitConnection",i.Turn="Turn",i.Arrival="Arrival",i))(cp||{}),hs=(a=>(a.Straight="Straight",a.Right="Right",a.SlightRight="SlightRight",a.Left="Left",a.SlightLeft="SlightLeft",a.Back="Back",a))(hs||{}),pp=(p=>(p.stairs="stairs",p.elevator="elevator",p.escalator="escalator",p.door="door",p.ramp="ramp",p.slide="slide",p.portal="portal",p.security="security",p.shuttle="shuttle",p.ladder="ladder",p))(pp||{}),pi=(t=>(t.Exterior="exterior-walls",t.Interior="interior-walls",t))(pi||{}),di=(t=>(t.Interior="interior-doors",t.Exterior="exterior-doors",t))(di||{});f();function dp(o){let{fromPosition:e,toPosition:t,junctionInset:r,fromAltitude:n,toAltitude:i}=o;if(r<=0)return null;let a=(e[1]+t[1])/2,{toCartesian:s,toGeographic:l}=Ul(a),c=s(e),p=s(t),h=p.x-c.x,g=p.y-c.y,T=i-n,I=Math.sqrt(h*h+g*g+T*T);if(I<=r*2)return null;let E=r/I,D={x:c.x+h*E,y:c.y+g*E},x=l(D.x,D.y),A=e[2]!==void 0?e[2]+T*E:void 0,U={x:p.x-h*E,y:p.y-g*E},R=l(U.x,U.y),B=t[2]!==void 0?t[2]-T*E:void 0;return{fromPosition:A!==void 0?[x.lon,x.lat,A]:[x.lon,x.lat],toPosition:B!==void 0?[R.lon,R.lat,B]:[R.lon,R.lat]}}function gs(o,e,t,r,n){let i=dp({fromPosition:o,toPosition:e,junctionInset:t,fromAltitude:r,toAltitude:n});return i?(o[0]=i.fromPosition[0],o[1]=i.fromPosition[1],o[2]!==void 0&&i.fromPosition[2]!==void 0&&(o[2]=i.fromPosition[2]),e[0]=i.toPosition[0],e[1]=i.toPosition[1],e[2]!==void 0&&i.toPosition[2]!==void 0&&(e[2]=i.toPosition[2]),!0):!1}function bt(o){return o.verticalOffset===0?[o.longitude,o.latitude]:[o.longitude,o.latitude,o.verticalOffset]}function Zg(o){return new Map(o.map(e=>{let{properties:t}=e,{id:r}=t;return[r,e]}))}var bs=(o,e)=>{let t=Zg(e),r={entrances:{type:"FeatureCollection",features:[]},walls:{type:"Feature",properties:{id:o[0].properties.id},geometry:{type:"MultiLineString",coordinates:[]}}};for(let n of o){let i=[n.geometry.coordinates],a=(n.properties.entrances||[]).reduce((s,l)=>(t.has(l)&&s.push(t.get(l)),s),[]);if(a.length){let{entrances:s,obstructions:l}=Ga(n,a);i=l.map(c=>c.geometry.coordinates),r.entrances.features.push(...s)}r.walls.geometry.coordinates.push(...i)}return r};function fp(o,e){return((e-o+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI}function hp(o,e){let t="Left";return o<=-Math.PI/4?t="Right":o<=-e?t="SlightRight":o<=e?t="Straight":o<=Math.PI/4?t="SlightLeft":t="Left",t}function gp(o){let e={};for(let t in o){let r=o[t];if(r!=null){if(r.id=t,"polygons"in r)for(let n of r.polygons)e[n]=r;else if("lineStrings"in r)for(let n of r.lineStrings)e[n]=r;else if("points"in r)for(let n of r.points)e[n]=r}}return e}function mp(o,e){return o.reduce((t,r)=>{let n=e[r.properties.id];if(n==null)return t;if("textures"in r.properties&&Array.isArray(r.properties.textures)&&r.properties.textures.length>0){let i={...n,id:n.id+"-textures"};t.set(i,[r])}else t.has(n)||t.set(n,[]),t.get(n).push(r);return t},new Map)}function hr(o,e={}){let t={...o,flipImageToFaceCamera:e?.flipImagesToFaceCamera??!0},r=e?.style?.shading??e?.shadingAndOutlines;r===!0?t.shading={start:.1,end:.15,intensity:.4}:typeof r=="object"&&(t.shading={start:r.start,end:r.end,intensity:r.intensity});let n=e?.style?.outlines??e?.shadingAndOutlines;if(t.outline=typeof n=="object"?!0:n,"lineStrings"in o){let i=e?.style?.wallTopColor??e?.wallTopColor;i!=null&&(t.topColor=i)}return t}var Ts=(o,e)=>{let r=(e.currentMap?.currentFloor).layers.get(Ee);switch(o){case"interior-walls":return r?.layers.get(So);case"exterior-walls":return r?.layers.get(eo);case"interior-doors":return r?.layers.get(lr);case"exterior-doors":return r?.layers.get(cr);default:return typeof o=="string"?o:o?.id}};function vs(o){return new Promise(e=>{o.onComplete(e),o.onStop(e)})}function yp(o){return o.bbox?o.bbox:Jo(o)}function gr(o,e,t){return o.floorId&&e.has(o.floorId)?e.get(o.floorId):t}function mr(o){if(Ie.is(o)||dt.is(o))return o.id}function bp(o,e,t){let r=o.coordinates.length===2&&o.coordinates[0].floorId!==o.coordinates[1].floorId,n=!0;if(r&&o.coordinates[0].floorId!=null&&o.coordinates[1].floorId!=null){let i=e?.getById("floor",o.coordinates[0].floorId),a=e?.getById("floor",o.coordinates[1].floorId);if(i&&a){let s=t.getState(i),l=t.getState(a);s!=null&&l!=null&&(n=s.visible&&l.visible&&s.altitude!==l.altitude)}}else{let i=o.coordinates[0].floorId!=null?e?.getById("floor",o.coordinates[0].floorId):void 0;n=i?t.getState(i)?.visible??!0:!0}return n}function Tp(o,e){let t=o.properties.path.split("/"),r=t[t.length-1].split(".")[0],n=atob(r);return"img_"+$n(n).toString()+"-"+e}function ms(o="auto",e,t=1,r){return o!=="auto"?o*t:e!=null?e*t:r!=null?r*t:3*t}function up(o,e,t,r){if(o.maxHeight!=null&&o.maxHeight>0)return ms(e,o.maxHeight,t,r);let n=ms(e,void 0,t,r);if(e==="auto"&&"geometryMaxHeight"in o){let i=o.geometryMaxHeight;if(i!=null&&i>0){let a=Math.ceil(i*1.1);if(a>n)return a}}return n}function vp(o,e="auto",t=1,r,n){if(!o.length)return new Map;let i=o.sort((p,h)=>p.elevation-h.elevation),a=i.findIndex(p=>p.elevation>=0);a===-1&&(a=i.length);let s=0,l=new Map,c=-1;for(let p=a;p<i.length;p+=1){let h=i[p],g=up(h,e,t,r);if(!n){let T=h.elevation-c-1;T>0&&(s+=T*g)}l.set(h.elevation,{altitude:s,visualHeight:g}),s+=g,c=h.elevation}s=0;for(let p=a-1;p>=0;p-=1){let h=i[p],g=up(h,e,t,r),T=-(s+g);l.set(h.elevation,{altitude:T,visualHeight:g}),s+=g}return l}function Ip(o,e,t="auto",r=1,n){let i=[...o].sort((c,p)=>c.elevation-p.elevation),a=i.findIndex(c=>c.elevation>=0);if(a===-1)return[];let s=[],l=-1;for(let c=a;c<i.length;c+=1){let p=i[c],h=p.elevation-l-1;if(h>0){let g=e.get(p.elevation),T=g?.visualHeight??ms(t,void 0,r,n),I=h*T,E=g?.altitude??0;s.push({altitude:E-I,height:I,floorAboveElevation:p.elevation,missingCount:h})}l=p.elevation}return s}function ui(o,e){let t=e(o.center);return{center:new H({latitude:t[1],longitude:t[0]}),radius:o.radius}}function Sp(o){if(o.geometry.type==="Polygon")return{type:"Feature",geometry:{type:"Polygon",coordinates:[o.geometry.coordinates[0]]},properties:o.properties};let e=[];for(let t of o.geometry.coordinates)e.push([t[0]]);return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:e},properties:o.properties}}var Ep=Math.PI*.1,Eo=class{id;#e={};#t;#o;constructor(e,t,r,n,i){this.id=i?.id??ee(),this.#t=t,this.#o=e.features,this.departure=r,this.destination=n}get path(){return this.#o.map(e=>this.#t.getById("node",e.properties.id)).filter(Boolean)}departure;destination;get coordinates(){return this.#e.coordinates?this.#e.coordinates:(this.#e.coordinates=this.#o.map(e=>new H(e.geometry.coordinates[1],e.geometry.coordinates[0],e.properties.groupBy)),this.#e.coordinates)}get distance(){return this.#e.distance?this.#e.distance:(this.#e.distance=this.#o.reduce((e,t)=>e+(t.properties.distance||0),0),this.#e.distance)}get instructions(){if(this.#o.length<2)return[];if(this.#e.instructions)return this.#e.instructions;let e=[],t=0;for(let r=0;r<this.#o.length;r++){let n=this.#o[r],i=this.#o[r-1],a=this.#o[r+1],s=new H(n.geometry.coordinates[1],n.geometry.coordinates[0],n.properties.groupBy),l=this.#s({prevDirection:i,direction:n,nextDirection:a});t+=i?.properties.distance||0;for(let c of l)c&&(e.push({action:c,distance:t,coordinate:s,node:this.#t.getById("node",n.properties.id)}),t=0)}return this.#e.instructions=e,this.#e.instructions}#r;#i;#n;#s(e){let{prevDirection:t,direction:r,nextDirection:n}=e,i=t&&this.#t.getById("floor",t.properties.groupBy),a=this.#t.getById("floor",r.properties.groupBy),s=n&&this.#t.getById("floor",n.properties.groupBy),l=[];t||l.push({type:"Departure"});let c=this.#t.getMVFFeatureByNodeId("connection",r.properties.id),p=c?this.#t.getById("connection",c.id):void 0,h=c&&c.nodes.length>1,g=this.#t.enterpriseMode&&(!r.properties.destination||!c?.nodes.includes(r.properties.destination)||!c?.nodes.includes(r.properties.id));if(c&&!(!h||g))if(!this.#r||this.#r==="exit")l.push(this.#c("TakeConnection",a,s,p,c)),this.#r="take",this.#i=p,this.#n=c;else{let I=this.#t.getMVFFeatureByNodeId("connection",t?.properties.id??""),E=this.#t.getById("connection",I?.id??"");l.push(this.#c("ExitConnection",a,i,E,I)),this.#r="exit",this.#i=p,this.#n=c}else this.#r==="take"?(l.push(this.#c("ExitConnection",a,i,this.#i,this.#n)),this.#r="exit",this.#i=p):s&&a?.id!==s.id?l.push(this.#c("TakeConnection",a,s,p)):i&&i.id!==a?.id?l.push(this.#c("ExitConnection",a,i,p)):l.push(this.#a(t,r));return n||l.push({type:"Arrival"}),l}#c(e,t,r,n,i){let a="none",s=t?t.elevation:0;if(s!=null&&r?.elevation!=null){let c=s-r.elevation;c>0?a="down":c<0&&(a="up")}let l=n?.type??i?.type??"stairs";return{type:e,fromFloor:t,toFloor:r,direction:a,connection:n,connectionType:l}}#a(e,t){let r=t.properties.edges;if(!r||r.filter(a=>a.destination.properties.id!==e?.properties.id&&a.destination.properties.id!==t.properties.destination).length===0)return null;let i=e?-fp(e.properties.angle,t.properties.angle):0;return Math.abs(i)>=Ep?{type:"Turn",bearing:hp(i,Ep),referencePosition:"At"}:null}toJSON(){return{id:this.id,directions:this.#o,__type:"directions",from:this.departure,to:this.destination,coordinates:this.coordinates,distance:this.distance,instructions:this.instructions}}};f();f();f();function Mp(o){return lo(o)?"navigationTarget"in o&&o.navigationTarget!=null:!1}var Jg={lineOfSight:!0,mode:"absolute-distance",maxResults:1};function xp(o){return{...Jg,lineOfSight:!o}}var he=new WeakMap;function fi(o,e,t){let r=xp(t),i=e.Query.__LEGACY_NEAREST_SYNC(o,e.getByType("node"),r)?.[0]?.feature.id;return i?[i]:[]}async function hi(o,e,t){let r=xp(t),i=(await e.Query.nearest(o,e.getByType("node"),r))?.[0]?.feature.id;return i?[i]:[]}function qg(o,e,t){let r=[];for(let n of o.navigationTarget){let i=yr(n,e,t);r.push(...i)}return r}async function Qg(o,e,t){let r=[];for(let n of o.navigationTarget){let i=await Mo(n,e,t);r.push(...i)}return r}function Cp(o,e){let r=e?.getMVFFeatureById("entrance",o.id)?.properties.node;return r?[r]:[]}function _p(o,e){return e?.getMVFFeatureById("area",o.id)?.properties.destinationNodes??[]}function Pp(o,e){let t=e?.getMVFFeatureById("space",o.id);if(t==null)return[];let r=e.entranceNodeIdsBySpaceId?.[o.id];return r&&r.length>0?r:t.properties.destinationNodes??[]}function Kg(o,e,t){let r=[];for(let n of o.coordinates){let i=fi(n,e,t);i.length>0&&r.push(i[0])}return r}async function em(o,e,t){let r=[];for(let n of o.coordinates){let i=await hi(n,e,t);i.length>0&&r.push(i[0])}return r}function Op(o,e){return e?.objectEntranceNodeIdsByObstructionId[o.id]??[]}function Dp(o,e){return o.spaces.flatMap(t=>e?.getMVFFeatureById("space",t.id)?.properties.destinationNodes??[]).filter(t=>typeof t=="string")}function wp(o){return o.nodes.map(e=>e.id)}function yr(o,e,t){if(he.has(o))return he.get(o);if(co.is(o)){let r=qg(o,e,t);return he.set(o,r),r}else if(Ut.is(o)){let r=fi(o,e,t);return he.set(o,r),r}else if(H.is(o)){let r=fi(o,e,t);return he.set(o,r),r}else{if(yt.is(o))return fi(o,e,t);if(et.is(o)){let r=Cp(o,e);return he.set(o,r),r}else if(Ct.is(o)){let r=_p(o,e);return he.set(o,r),r}else if(Ie.is(o)){let r=Pp(o,e);return he.set(o,r),r}else if(ze.is(o)){let r=Kg(o,e,t);return he.set(o,r),r}else if(dt.is(o)){let r=Op(o,e);return he.set(o,r),r}else if(Ve.is(o)){let r=Dp(o,e);return he.set(o,r),r}else if(ct.is(o)){let r=wp(o);return he.set(o,r),r}else if(xt.is(o)){let r=[o.id];return he.set(o,r),r}else return[]}}async function Mo(o,e,t){if(he.has(o))return he.get(o);if(co.is(o)){let r=await Qg(o,e,t);return he.set(o,r),r}else if(Ut.is(o)){let r=await hi(o,e,t);return he.set(o,r),r}else if(H.is(o)){let r=await hi(o,e,t);return he.set(o,r),r}else if(yt.is(o)){let r=await hi(o,e,t);return he.set(o,r),r}else if(et.is(o)){let r=Cp(o,e);return he.set(o,r),r}else if(Ct.is(o)){let r=_p(o,e);return he.set(o,r),r}else if(Ie.is(o)){let r=Pp(o,e);return he.set(o,r),r}else if(ze.is(o)){let r=await em(o,e,t);return he.set(o,r),r}else if(dt.is(o)){let r=Op(o,e);return he.set(o,r),r}else{if(Ve.is(o))return Dp(o,e);if(ct.is(o)){let r=wp(o);return he.set(o,r),r}else if(xt.is(o)){let r=[o.id];return he.set(o,r),r}else return[]}}function Ap(o,e){if(!o.instances||o.instances.length===0)return o;for(let t of o.instances)if(t.nodes.map(n=>n.id).includes(e))return t;return o}function Fp(o,e,t){let r=o.features[0]?.properties.id,n=e[0];if(e.length>1){for(let i of e)if((t.get(i)??[]).includes(r)){n=i;break}}return ct.is(n)&&(n=Ap(n,r)),n}function kp(o,e,t){let r=o.features[o.features.length-1]?.properties.id,n=e[0];if(e.length>1){for(let i of e)if((t.get(i)??[]).includes(r)){n=i;break}}return ct.is(n)&&(n=Ap(n,r)),n}function Is(o){if(H.is(o))return o;if(!(!Mp(o)||Array.isArray(o.navigationTarget)||!H.is(o.navigationTarget)))return o.navigationTarget}var br=class{navigator;connections;constructor({nodes:e,geojsonCollection:t,connections:r,groupBy:n,multiplicativeDistanceWeightScaling:i,flagDeclarations:a,getDoorByNodeId:s}){this.navigator=new Jl({nodes:e,geojsonCollection:this.createCollection(t),groupBy:n,multiplicativeDistanceWeightScaling:i,flagDeclarations:a,getDoorByNodeId:s}),this.connections=r}processTargets(e,t,r){let n=[],i=[],a=new Map,s=new Set,l=new Set;for(let[c,p]of e){let h=a.get(c);h||(h=[],a.set(c,h)),Ie.is(c)&&s.add(c.id);for(let g of p)h.push(g),n.push(g)}for(let[c,p]of t){let h=a.get(c);h||(h=[],a.set(c,h)),Ie.is(c)&&l.add(c.id);for(let g of p)h.push(g),i.push(g)}if(s.size===0&&l.size===0)return{originIds:n,destinationNodeIds:i,featureToNodeIdsMap:a};for(let c of n){let p=r.spaceIdsByNodeId[c]||[];for(let h of p)if(l.has(h)){i.push(c);break}}for(let c of i){let p=r.spaceIdsByNodeId[c]||[];for(let h of p)if(s.has(h)){n.push(c);break}}return{originIds:n,destinationNodeIds:i,featureToNodeIdsMap:a}}getDirections=async(e,t,r,n)=>{let i=new Map,a=new Map;for(let p of e)i.set(p,await Mo(p,n,n.enterpriseMode));for(let p of t)a.set(p,await Mo(p,n,n.enterpriseMode));let{originIds:s,destinationNodeIds:l,featureToNodeIdsMap:c}=this.processTargets(i,a,n);return this.#e(e,t,s,l,r,n,c)};getDirectionsSync=(e,t,r,n)=>{let i=new Map(e.map(p=>[p,yr(p,n,n.enterpriseMode)])),a=new Map(t.map(p=>[p,yr(p,n,n.enterpriseMode)])),{originIds:s,destinationNodeIds:l,featureToNodeIdsMap:c}=this.processTargets(i,a,n);return this.#e(e,t,s,l,r,n,c)};#e=(e,t,r,n,i,a,s)=>{let l=this.getDisabledConnectionNodeIds(i.accessible).filter(x=>!r.includes(x)&&!n.includes(x)),c=new Map,p={...i.connectionIdWeightMap};for(let x of i.excludedConnections)p[x.id]=1/0;for(let x in p){let A=a.getById("connection",x);A&&this.#t(A,p[x],c)}let g=(i.smoothing.__EXPERIMENTAL_METHOD??"greedy-los")!=="greedy-los",T=this.navigator.getDirections({zones:i.zones.map(x=>({geometry:x.geometry,cost:x.cost,map:x.floor?.id})),originIds:r,from:g?Lp(e):[],to:g?Lp(t):[],destinationNodeIds:n,disabledConnectionNodeIds:l,simplify:i.smoothing,overrideEdgeWeights:c,multiplicativeDistanceWeightScaling:!a.enterpriseMode,includeNonPublic:i.includeNonPublic});this.addCoordinateDirections(T,e,t);let I=Fp(T,e,s),E=kp(T,t,s),D=new Eo(T,a,I,E);if(!(D.distance===0&&new Set([...r,...n]).size===r.length+n.length))return D};getDisabledConnectionNodeIds=e=>e===!1?[]:this.connections.reduce((t,r)=>r.accessible?t:t.concat(r.nodes),[]);#t=(e,t,r)=>{if(e.nodes.length<2)return;let n=new Set(e.nodes.map(i=>i.id));for(let i of e.nodes){let a=this.navigator.graph.edges[i.id];if(a)for(let s of a)n.has(s.destination.properties.id)&&r.set(s,t)}};addCoordinateDirections=(e,[t],[r])=>{if(!e.features.length)return;let n=Is(t);if(n){let a=this.createDirectionFeature(n,this.navigator.getAngle([n.longitude,n.latitude],e.features[0].geometry.coordinates),this.navigator.getDistance([n.longitude,n.latitude],e.features[0].geometry.coordinates));e.features.splice(0,0,a)}let i=Is(r);if(i){let a=this.createDirectionFeature(i,0,0),s=e.features[e.features.length-1];s.properties.distance=this.navigator.getDistance(s.geometry.coordinates,[i.longitude,i.latitude]),s.properties.angle=this.navigator.getAngle(s.geometry.coordinates,[i.longitude,i.latitude]),e.features.push(a)}};createCollection(e){return{type:"FeatureCollection",features:Object.entries(e).reduce((t,[r,n])=>t.concat(n.features.map(i=>(i.properties.map=r,i))),[])}}createDirectionFeature=(e,t,r)=>({type:"Feature",geometry:{type:"Point",coordinates:[e.longitude,e.latitude]},properties:{groupBy:e.floorId,id:e.id,angle:t,distance:r,edges:[]}})};function tm(o){if(H.is(o))return o.floorId;if(Ie.is(o)||et.is(o)||yt.is(o)||Ut.is(o)||dt.is(o)||Ct.is(o)||xt.is(o))return o.floor.id;if((ze.is(o)||ct.is(o))&&o.coordinates.length>0)return o.coordinates[0].floorId;if(Ve.is(o)&&o.spaces.length>0)return o.spaces[0].floor.id}function Lp(o){return o.reduce((e,t)=>{let r=Io(t);if(!r)return e;let n=tm(t);return e.push({type:"Feature",geometry:{type:"Point",coordinates:[r.longitude,r.latitude]},properties:{id:t.id,neighbors:[],map:n}}),e},[])}f();f();f();import Bo from"zod";var Tr=50,Ss=1,Es=!1,Rp=Bo.object({limit:Bo.enum(["same-floor","same-elevation","all-floors"]).optional(),mode:Bo.enum(["travel-distance","absolute-distance"]).optional(),lineOfSight:Bo.boolean().optional().or(Bo.literal("auto")),maxDistance:Bo.number().optional(),maxResults:Bo.number().optional()}),Np={lineOfSight:Es,mode:"travel-distance",maxDistance:Tr,limit:"same-floor",maxResults:Ss},Qr=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}__LEGACY_NEAREST_SYNC=(e,t,r)=>{let n={...Np,...r};try{Rp.parse(n)}catch(p){C.error(p);return}let i=Io(e);if(!i)return;let a=this.#o(i,n),s=[],l={},c=[];for(let p of t){let h=yr(p,this.#e,this.#e.enterpriseMode);if(h)for(let g of h)l[g]||(l[g]=[]),l[g].push(p),c.push(g)}return r?.mode==="absolute-distance"?s=this.#r(i,a,t,n):s=this.#n(e,a,c,l,n),s.sort((p,h)=>p.distance-h.distance)};async nearest(e,t,r){let n={...Np,...r};try{Rp.parse(n)}catch(h){C.error(h);return}let i=Io(e);if(!i)return;let a=this.#o(i,n),s=[],l={},c=[],p=[];if(r?.mode==="absolute-distance")s=this.#r(i,a,t,n);else{for(let h of t)p.push(Mo(h,this.#e,this.#e.enterpriseMode).then(g=>{if(g)for(let T of g)l[T]||(l[T]=[]),l[T].push(h),c.push(T)}));await Promise.all(p),s=await this.#i(e,a,c,l,n)}return s.sort((h,g)=>h.distance-g.distance)}#o(e,t){let r=e.floorId?[e.floorId]:[];if(t?.limit==="all-floors")r=this.#e.getByType("floor").map(n=>n.id);else if(e.floorId==null)for(let n of this.#e.getByType("floor-stack")){let i=n.defaultFloor;i&&r.push(i.id)}else if(t?.limit==="same-elevation"){let n=this.#e.floorsById[e.floorId];if(n){let i=n?.elevation;i!=null&&(r=this.#e.getByType("floor-stack").map(a=>a.floors.find(s=>s.elevation===i)?.id).filter(Boolean))}}return r}#r=(e,t,r,n)=>{let i=[],a=new Set(r.map(s=>s.__type));for(let s of t)for(let l of a){let c=this.#t.searchWithIncludedIds([e.longitude,e.latitude],l,this.#e.mapName,s,r.filter(p=>p.__type===l).map(p=>p.id),n?.maxDistance??Tr,n?.lineOfSight==="auto"?Es:n?.lineOfSight,n?.maxResults??1);if(c)for(let p of c)i.push({distance:p.distance,feature:this.#e.getById(l,p.node.properties.parentId)||this.#e.getById(l,p.node.properties.id)})}return i};#i=async(e,t,r,n,i)=>{let a=[];for(let s of t){let l,c=0;if(!xt.is(e)){let p=this.#r(e.anchorTarget,[s],this.#e.getByType("node").filter(h=>h.floor.id===s),{limit:"same-floor",lineOfSight:i?.lineOfSight??!0,mode:"absolute-distance",maxDistance:i?.maxDistance??Tr,maxResults:1});p.length>0&&(l=p[0].feature,c=p[0].distance)}if(l){let p=new Set,h=this.#e.directions.navigator.findNearestNodesOnGraph(l.id,(i?.maxDistance??Tr)-c,s,r,!1,i?.maxResults??Ss);for(let g of h)for(let T of n[g.feature.properties.id])p.has(T.id)||(a.push({distance:g.distance+c,feature:T}),p.add(T.id))}}return a};#n=(e,t,r,n,i)=>{let a=[];for(let s of t){let l;if(xt.is(e)||(l=this.__LEGACY_NEAREST_SYNC(e,this.#e.getByType("node"),{lineOfSight:i?.lineOfSight??!0,mode:"absolute-distance",maxDistance:i?.maxDistance??Tr,maxResults:1})?.[0].feature),l){let c=this.#e.directions.navigator.findNearestNodesOnGraph(l.id,i?.maxDistance??Tr,s,r,i?.lineOfSight==="auto"?Es:i?.lineOfSight,i?.maxResults??Ss);for(let p of c)for(let h of n[p.feature.properties.id])a.push({distance:p.distance,feature:h})}}return a}};f();var gi=class{#e;constructor(e){this.#e=e}at(e){let t=[],r=[e.longitude,e.latitude],n=e.floorId?[e.floorId]:this.#e.getAllFloorIds();for(let i of n){let a=this.#e.searchAtCoordinate(e,i);for(let s of a)this.#t(r,s)&&t.push(s)}return t}#t(e,t){let r=t.geoJSON;if(!r||!r.geometry)return!1;let n=r.geometry.type;return n==="Point"?e[0]===r.geometry.coordinates[0]&&e[1]===r.geometry.coordinates[1]:n!=="Polygon"&&n!=="MultiPolygon"?!1:Zl(e,r)}};f();f();f();f();function Bp(o){let e=+this._x.call(null,o),t=+this._y.call(null,o);return Vp(this.cover(e,t),e,t,o)}function Vp(o,e,t,r){if(isNaN(e)||isNaN(t))return o;var n,i=o._root,a={data:r},s=o._x0,l=o._y0,c=o._x1,p=o._y1,h,g,T,I,E,D,x,A;if(!i)return o._root=a,o;for(;i.length;)if((E=e>=(h=(s+c)/2))?s=h:c=h,(D=t>=(g=(l+p)/2))?l=g:p=g,n=i,!(i=i[x=D<<1|E]))return n[x]=a,o;if(T=+o._x.call(null,i.data),I=+o._y.call(null,i.data),e===T&&t===I)return a.next=i,n?n[x]=a:o._root=a,o;do n=n?n[x]=new Array(4):o._root=new Array(4),(E=e>=(h=(s+c)/2))?s=h:c=h,(D=t>=(g=(l+p)/2))?l=g:p=g;while((x=D<<1|E)===(A=(I>=g)<<1|T>=h));return n[A]=i,n[x]=a,o}function jp(o){var e,t,r=o.length,n,i,a=new Array(r),s=new Array(r),l=1/0,c=1/0,p=-1/0,h=-1/0;for(t=0;t<r;++t)isNaN(n=+this._x.call(null,e=o[t]))||isNaN(i=+this._y.call(null,e))||(a[t]=n,s[t]=i,n<l&&(l=n),n>p&&(p=n),i<c&&(c=i),i>h&&(h=i));if(l>p||c>h)return this;for(this.cover(l,c).cover(p,h),t=0;t<r;++t)Vp(this,a[t],s[t],o[t]);return this}f();function Gp(o,e){if(isNaN(o=+o)||isNaN(e=+e))return this;var t=this._x0,r=this._y0,n=this._x1,i=this._y1;if(isNaN(t))n=(t=Math.floor(o))+1,i=(r=Math.floor(e))+1;else{for(var a=n-t||1,s=this._root,l,c;t>o||o>=n||r>e||e>=i;)switch(c=(e<r)<<1|o<t,l=new Array(4),l[c]=s,s=l,a*=2,c){case 0:n=t+a,i=r+a;break;case 1:t=n-a,i=r+a;break;case 2:n=t+a,r=i-a;break;case 3:t=n-a,r=i-a;break}this._root&&this._root.length&&(this._root=s)}return this._x0=t,this._y0=r,this._x1=n,this._y1=i,this}f();function Up(){var o=[];return this.visit(function(e){if(!e.length)do o.push(e.data);while(e=e.next)}),o}f();function Hp(o){return arguments.length?this.cover(+o[0][0],+o[0][1]).cover(+o[1][0],+o[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}f();f();function je(o,e,t,r,n){this.node=o,this.x0=e,this.y0=t,this.x1=r,this.y1=n}function Wp(o,e,t){var r,n=this._x0,i=this._y0,a,s,l,c,p=this._x1,h=this._y1,g=[],T=this._root,I,E;for(T&&g.push(new je(T,n,i,p,h)),t==null?t=1/0:(n=o-t,i=e-t,p=o+t,h=e+t,t*=t);I=g.pop();)if(!(!(T=I.node)||(a=I.x0)>p||(s=I.y0)>h||(l=I.x1)<n||(c=I.y1)<i))if(T.length){var D=(a+l)/2,x=(s+c)/2;g.push(new je(T[3],D,x,l,c),new je(T[2],a,x,D,c),new je(T[1],D,s,l,x),new je(T[0],a,s,D,x)),(E=(e>=x)<<1|o>=D)&&(I=g[g.length-1],g[g.length-1]=g[g.length-1-E],g[g.length-1-E]=I)}else{var A=o-+this._x.call(null,T.data),U=e-+this._y.call(null,T.data),R=A*A+U*U;if(R<t){var B=Math.sqrt(t=R);n=o-B,i=e-B,p=o+B,h=e+B,r=T.data}}return r}f();function zp(o){if(isNaN(p=+this._x.call(null,o))||isNaN(h=+this._y.call(null,o)))return this;var e,t=this._root,r,n,i,a=this._x0,s=this._y0,l=this._x1,c=this._y1,p,h,g,T,I,E,D,x;if(!t)return this;if(t.length)for(;;){if((I=p>=(g=(a+l)/2))?a=g:l=g,(E=h>=(T=(s+c)/2))?s=T:c=T,e=t,!(t=t[D=E<<1|I]))return this;if(!t.length)break;(e[D+1&3]||e[D+2&3]||e[D+3&3])&&(r=e,x=D)}for(;t.data!==o;)if(n=t,!(t=t.next))return this;return(i=t.next)&&delete t.next,n?(i?n.next=i:delete n.next,this):e?(i?e[D]=i:delete e[D],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(r?r[x]=t:this._root=t),this):(this._root=i,this)}function Xp(o){for(var e=0,t=o.length;e<t;++e)this.remove(o[e]);return this}f();function $p(){return this._root}f();function Yp(){var o=0;return this.visit(function(e){if(!e.length)do++o;while(e=e.next)}),o}f();function Zp(o){var e=[],t,r=this._root,n,i,a,s,l;for(r&&e.push(new je(r,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!o(r=t.node,i=t.x0,a=t.y0,s=t.x1,l=t.y1)&&r.length){var c=(i+s)/2,p=(a+l)/2;(n=r[3])&&e.push(new je(n,c,p,s,l)),(n=r[2])&&e.push(new je(n,i,p,c,l)),(n=r[1])&&e.push(new je(n,c,a,s,p)),(n=r[0])&&e.push(new je(n,i,a,c,p))}return this}f();function Jp(o){var e=[],t=[],r;for(this._root&&e.push(new je(this._root,this._x0,this._y0,this._x1,this._y1));r=e.pop();){var n=r.node;if(n.length){var i,a=r.x0,s=r.y0,l=r.x1,c=r.y1,p=(a+l)/2,h=(s+c)/2;(i=n[0])&&e.push(new je(i,a,s,p,h)),(i=n[1])&&e.push(new je(i,p,s,l,h)),(i=n[2])&&e.push(new je(i,a,h,p,c)),(i=n[3])&&e.push(new je(i,p,h,l,c))}t.push(r)}for(;r=t.pop();)o(r.node,r.x0,r.y0,r.x1,r.y1);return this}f();function qp(o){return o[0]}function Qp(o){return arguments.length?(this._x=o,this):this._x}f();function Kp(o){return o[1]}function ed(o){return arguments.length?(this._y=o,this):this._y}function Kr(o,e,t){var r=new Ms(e??qp,t??Kp,NaN,NaN,NaN,NaN);return o==null?r:r.addAll(o)}function Ms(o,e,t,r,n,i){this._x=o,this._y=e,this._x0=t,this._y0=r,this._x1=n,this._y1=i,this._root=void 0}function td(o){for(var e={data:o.data},t=e;o=o.next;)t=t.next={data:o.data};return e}var tt=Kr.prototype=Ms.prototype;tt.copy=function(){var o=new Ms(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,r;if(!e)return o;if(!e.length)return o._root=td(e),o;for(t=[{source:e,target:o._root=new Array(4)}];e=t.pop();)for(var n=0;n<4;++n)(r=e.source[n])&&(r.length?t.push({source:r,target:e.target[n]=new Array(4)}):e.target[n]=td(r));return o};tt.add=Bp;tt.addAll=jp;tt.cover=Gp;tt.data=Up;tt.extent=Hp;tt.find=Wp;tt.remove=zp;tt.removeAll=Xp;tt.root=$p;tt.size=Yp;tt.visit=Zp;tt.visitAfter=Jp;tt.x=Qp;tt.y=ed;f();function xs(o,e,t,r=0,n=0,i=0,a=0){if(t===void 0){t=o.root();let l=o.extent();if(l&&([[r,n],[i,a]]=l,e(t,r,n,i,a)))return!0;if(!t)return!1}let s=[[r,n,(i+r)/2,(a+n)/2],[(i+r)/2,n,i,(a+n)/2],[r,(a+n)/2,(i+r)/2,a],[(i+r)/2,(a+n)/2,i,a]];for(let l=0;l<4;l++){let c=t[l];if(c){let[p,h,g,T]=s[l];e(c,p,h,g,T)||xs(o,e,c,p,h,g,T)}}return!1}var od=1e3,om=.1,rm=5,nm=1.5,mi=class{#e={};#t=new Map;getMaxSearchRadiusForFloorId=(e,t)=>{let r=this.#t.get(this.#r.mapName)?.get(t);if(r)return r;let n=this.getNodeTreeByTypeAndFloorId(e,this.#r.mapName,t);if(typeof n.extent=="function")if(n.extent()){let[[i,a],[s,l]]=n.extent(),c=s-i,p=l-a;r=Math.max(c,p)}else r=od;else r=od;return this.#t.set(this.#r.mapName,new Map([[t,r]])),r};searchWithIncludedIds(e,t,r,n,i,a,s=!1,l=1/0){let c=this.getNodeTreeByTypeAndFloorId(t,r,n),p=new Set,h=[],g=rm,T=Math.max(a,this.getMaxSearchRadiusForFloorId(t,n));for(;h.length<l&&g<=T;){let I=this.#o(e,c,i,g,a,p);I.sort((E,D)=>E.distance-D.distance);for(let E of I){if(h.length>=l)break;s?this.#r.directions.navigator.hasLineOfSight(e,E.node.geometry.coordinates,n,om)&&h.push(E):h.push(E)}g=g*nm}return h}#o(e,t,r,n,i,a){let{x:s,y:l}=this.#i(e[0],e[1]),c=s-n,p=s+n,h=l-n,g=l+n,T=[];return xs(t,(I,E,D,x,A)=>{let U=E>=p||D>=g||x<c||A<h;if("data"in I){let R=I.data,B=R.properties.parentId||R.properties.id;if(r.includes(B)&&!a.has(B)){a.add(B);let V=qt(e,R.geometry.coordinates);V<=i&&T.push({node:R,distance:V})}}return U}),T}#r;getNodeTreeByTypeAndFloorId(e,t,r){if(this.#e[e]||(this.#e[e]={}),this.#e[e][t]?.[r])return this.#e[e][t][r];this.#e[e][t]||(this.#e[e][t]={}),this.#e[e][t][r]=Kr();let n=this.#e[e][t][r];n.x(a=>{let s=a.geometry.coordinates;return this.#i(s[0],s[1]).x}),n.y(a=>{let s=a.geometry.coordinates;return this.#i(s[0],s[1]).y});let i=[];switch(e){case"space":i=this.#r.mvfSpacesByFloorId[r].flatMap(c=>c.properties.destinationNodes).map(c=>{let p=this.#r.mvfNodesById[c];return p?{...p,properties:{id:p.properties.id,parentId:p.properties.space[0]}}:null});break;case"node":i=this.#r.mvfNodesByFloorId[r]?.filter(c=>c.properties.neighbors.length>0)||[];break;case"point-of-interest":i=this.#r.mvfPoisByFloorId[r]||[];break;case"door":i=this.#r.mvfEntrancesByFloorId[r]||[];break;case"annotation":i=this.#r.mvfAnnotationsByFloorId[r]||[];break;case"enterprise-location":let s=this.#r.mvfNodesByFloorId[r]||[],l=this.#r.locationIdsByNodeId;i=[];for(let c=0;c<s.length;c++){let p=s[c],h=l[p.properties.id];h?.length>0&&i.push({...p,properties:{id:p.properties.id,parentId:h[0]}})}break}return i?.length>0&&n.addAll(i),n}#i;constructor(e,t){this.#r=e,this.#i=t}};f();f();f();f();function yi(o,e,t=0,r=o.length-1,n=im){for(;r>t;){if(r-t>600){let l=r-t+1,c=e-t+1,p=Math.log(l),h=.5*Math.exp(2*p/3),g=.5*Math.sqrt(p*h*(l-h)/l)*(c-l/2<0?-1:1),T=Math.max(t,Math.floor(e-c*h/l+g)),I=Math.min(r,Math.floor(e+(l-c)*h/l+g));yi(o,e,T,I,n)}let i=o[e],a=t,s=r;for(en(o,t,e),n(o[r],i)>0&&en(o,t,r);a<s;){for(en(o,a,s),a++,s--;n(o[a],i)<0;)a++;for(;n(o[s],i)>0;)s--}n(o[t],i)===0?en(o,t,s):(s++,en(o,s,r)),s<=e&&(t=s+1),e<=s&&(r=s-1)}}function en(o,e,t){let r=o[e];o[e]=o[t],o[t]=r}function im(o,e){return o<e?-1:o>e?1:0}var rn=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,r=[];if(!Ti(e,t))return r;let n=this.toBBox,i=[];for(;t;){for(let a=0;a<t.children.length;a++){let s=t.children[a],l=t.leaf?n(s):s;Ti(e,l)&&(t.leaf?r.push(s):_s(e,l)?this._all(s,r):i.push(s))}t=i.pop()}return r}collides(e){let t=this.data;if(!Ti(e,t))return!1;let r=[];for(;t;){for(let n=0;n<t.children.length;n++){let i=t.children[n],a=t.leaf?this.toBBox(i):i;if(Ti(e,a)){if(t.leaf||_s(e,a))return!0;r.push(i)}}t=r.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let r=0;r<e.length;r++)this.insert(e[r]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let r=this.data;this.data=t,t=r}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Ir([]),this}remove(e,t){if(!e)return this;let r=this.data,n=this.toBBox(e),i=[],a=[],s,l,c;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],s=a.pop(),c=!0),r.leaf){let p=am(e,r.children,t);if(p!==-1)return r.children.splice(p,1),i.push(r),this._condense(i),this}!c&&!r.leaf&&_s(r,n)?(i.push(r),a.push(s),s=0,l=r,r=r.children[0]):l?(s++,r=l.children[s],c=!1):r=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let r=[];for(;e;)e.leaf?t.push(...e.children):r.push(...e.children),e=r.pop();return t}_build(e,t,r,n){let i=r-t+1,a=this._maxEntries,s;if(i<=a)return s=Ir(e.slice(t,r+1)),vr(s,this.toBBox),s;n||(n=Math.ceil(Math.log(i)/Math.log(a)),a=Math.ceil(i/Math.pow(a,n-1))),s=Ir([]),s.leaf=!1,s.height=n;let l=Math.ceil(i/a),c=l*Math.ceil(Math.sqrt(a));rd(e,t,r,c,this.compareMinX);for(let p=t;p<=r;p+=c){let h=Math.min(p+c-1,r);rd(e,p,h,l,this.compareMinY);for(let g=p;g<=h;g+=l){let T=Math.min(g+l-1,h);s.children.push(this._build(e,g,T,n-1))}}return vr(s,this.toBBox),s}_chooseSubtree(e,t,r,n){for(;n.push(t),!(t.leaf||n.length-1===r);){let i=1/0,a=1/0,s;for(let l=0;l<t.children.length;l++){let c=t.children[l],p=Cs(c),h=cm(e,c)-p;h<a?(a=h,i=p<i?p:i,s=c):h===a&&p<i&&(i=p,s=c)}t=s||t.children[0]}return t}_insert(e,t,r){let n=r?e:this.toBBox(e),i=[],a=this._chooseSubtree(n,this.data,t,i);for(a.children.push(e),on(a,n);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(n,i,t)}_split(e,t){let r=e[t],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);let a=this._chooseSplitIndex(r,i,n),s=Ir(r.children.splice(a,r.children.length-a));s.height=r.height,s.leaf=r.leaf,vr(r,this.toBBox),vr(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(r,s)}_splitRoot(e,t){this.data=Ir([e,t]),this.data.height=e.height+1,this.data.leaf=!1,vr(this.data,this.toBBox)}_chooseSplitIndex(e,t,r){let n,i=1/0,a=1/0;for(let s=t;s<=r-t;s++){let l=tn(e,0,s,this.toBBox),c=tn(e,s,r,this.toBBox),p=pm(l,c),h=Cs(l)+Cs(c);p<i?(i=p,n=s,a=h<a?h:a):p===i&&h<a&&(a=h,n=s)}return n||r-t}_chooseSplitAxis(e,t,r){let n=e.leaf?this.compareMinX:sm,i=e.leaf?this.compareMinY:lm,a=this._allDistMargin(e,t,r,n),s=this._allDistMargin(e,t,r,i);a<s&&e.children.sort(n)}_allDistMargin(e,t,r,n){e.children.sort(n);let i=this.toBBox,a=tn(e,0,t,i),s=tn(e,r-t,r,i),l=bi(a)+bi(s);for(let c=t;c<r-t;c++){let p=e.children[c];on(a,e.leaf?i(p):p),l+=bi(a)}for(let c=r-t-1;c>=t;c--){let p=e.children[c];on(s,e.leaf?i(p):p),l+=bi(s)}return l}_adjustParentBBoxes(e,t,r){for(let n=r;n>=0;n--)on(t[n],e)}_condense(e){for(let t=e.length-1,r;t>=0;t--)e[t].children.length===0?t>0?(r=e[t-1].children,r.splice(r.indexOf(e[t]),1)):this.clear():vr(e[t],this.toBBox)}};function am(o,e,t){if(!t)return e.indexOf(o);for(let r=0;r<e.length;r++)if(t(o,e[r]))return r;return-1}function vr(o,e){tn(o,0,o.children.length,e,o)}function tn(o,e,t,r,n){n||(n=Ir(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(let i=e;i<t;i++){let a=o.children[i];on(n,o.leaf?r(a):a)}return n}function on(o,e){return o.minX=Math.min(o.minX,e.minX),o.minY=Math.min(o.minY,e.minY),o.maxX=Math.max(o.maxX,e.maxX),o.maxY=Math.max(o.maxY,e.maxY),o}function sm(o,e){return o.minX-e.minX}function lm(o,e){return o.minY-e.minY}function Cs(o){return(o.maxX-o.minX)*(o.maxY-o.minY)}function bi(o){return o.maxX-o.minX+(o.maxY-o.minY)}function cm(o,e){return(Math.max(e.maxX,o.maxX)-Math.min(e.minX,o.minX))*(Math.max(e.maxY,o.maxY)-Math.min(e.minY,o.minY))}function pm(o,e){let t=Math.max(o.minX,e.minX),r=Math.max(o.minY,e.minY),n=Math.min(o.maxX,e.maxX),i=Math.min(o.maxY,e.maxY);return Math.max(0,n-t)*Math.max(0,i-r)}function _s(o,e){return o.minX<=e.minX&&o.minY<=e.minY&&e.maxX<=o.maxX&&e.maxY<=o.maxY}function Ti(o,e){return e.minX<=o.maxX&&e.minY<=o.maxY&&e.maxX>=o.minX&&e.maxY>=o.minY}function Ir(o){return{children:o,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function rd(o,e,t,r,n){let i=[e,t];for(;i.length;){if(t=i.pop(),e=i.pop(),t-e<=r)continue;let a=e+Math.ceil((t-e)/r/2)*r;yi(o,a,e,t,n),i.push(e,a,a,t)}}var vi=class extends rn{#e;constructor(e){super(),this.#e=e}toBBox=e=>{let t=e.geoJSONBoundingBox;t==null&&C.warn(`Item "${e.id}" has no geoJSONBoundingBox; falling back to zero-size bbox at origin.`);let r=t!=null&&t.length===6,n=t?.[0]??0,i=t?.[1]??0,a=(r?t?.[3]:t?.[2])??0,s=(r?t?.[4]:t?.[3])??0,l=this.#e(n,i),c=this.#e(a,s);return{minX:l.x,minY:l.y,maxX:c.x,maxY:c.y}};compareMinX=(e,t)=>{let r=this.toBBox(e),n=this.toBBox(t);return r.minX-n.minX};compareMinY=(e,t)=>{let r=this.toBBox(e),n=this.toBBox(t);return r.minY-n.minY};search(e,t,r,n){if(typeof e=="object")return super.search(e);let i=this.#e(e,t),a=this.#e(r,n);return super.search({minX:i.x,minY:i.y,maxX:a.x,maxY:a.y})}searchCoordinate(e){return this.search(e.longitude,e.latitude,e.longitude,e.latitude)}};var Ii=class{#e;#t;#o=new Map;constructor(e,t){this.#e=e,this.#t=t}getTreeByFloorId(e){let t=this.#o.get(e);if(t)return t;let r=new vi(this.#t),n=this.#e.floorsById[e];if(n){let i=[n,...n.spaces,...n.objects];for(let a of this.#e.areas)a.floor.id===e&&i.push(a);r.load(i)}return this.#o.set(e,r),r}searchAtCoordinate(e,t){return this.getTreeByFloorId(t).searchCoordinate(e)}getAllFloorIds(){return this.#e.floors.map(e=>e.id)}};f();function nd(o,e){let t=111319.9*Math.cos(e*Math.PI/180);return(r,n)=>({x:(r-o)*t,y:(n-e)*111319.9})}var nn=class{#e;#t;#o;#r;constructor(e){let t=nd(e.mapCenter.longitude,e.mapCenter.latitude);this.#o=new mi(e,t),this.#r=new Ii(e,t),this.#e=new Qr(e,this.#o),this.#t=new gi(this.#r)}__LEGACY_NEAREST_SYNC=(e,t,r)=>this.#e.__LEGACY_NEAREST_SYNC(e,t,r);async nearest(e,t,r){return this.#e.nearest(e,t,r)}async at(e){return this.#t.at(e)}};f();f();var Si=class{#e;constructor(e){this.#e=e||[]}get raw(){return this.#e}};var Ps=class o extends Fe{static is(e){return e.__type===o.__type}static __type="location-profile";__type=o.__type;id="loc_";name="";externalId;description;logo;logoImage;phone;social=[];images=[];links=[];website;icon;extra;searchTags;#e;#t={};#o;#r;constructor(e,t){super(t.mvf2Data.id),this.#e=e,this.#o=t.mvf2Data,this.#r=t.mvf3Data;for(let r in t.mvf2Data)r==="links"?this.links=t.mvf2Data.links.map(n=>new ko({mvfData:n})):r==="pictures"?this.images=t.mvf2Data.pictures.map(n=>n.url?new Kt({mvfData:{...n,url:n.url??""},mapData:this.#e}):void 0).filter(n=>n!=null):r==="website"?t.mvf2Data.website&&(this.website=new ko({mvfData:t.mvf2Data.website})):r==="icon"?t.mvf2Data.icon&&(this.icon=new Kt({mvfData:{url:t.mvf2Data.icon},mapData:this.#e})):r==="logo"?t.mvf2Data.logo&&(this.logoImage=new Kt({mvfData:{url:t.mvf2Data.logo},mapData:this.#e}),Object.defineProperty(this,"logo",{get(){return this.logoImage?.url}})):Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),r)||Object.defineProperty(this,r,{enumerable:!0,get(){return this.#o[r]}});this.#r&&(this.extra=this.#r.extra)}get spaces(){if(this.#t.spaces)return this.#t.spaces;if(this.#o.spaces==null)return this.#t.spaces=[],this.#t.spaces;this.#t.spaces=[];for(let e=0;e<this.#o.spaces.length;e++){let t=this.#e.getById("space",this.#o.spaces[e].id);t&&this.#t.spaces.push(t)}return this.#t.spaces}get points(){if(this.#t.points)return this.#t.points;if(this.#o.spaces==null)return this.#t.points=[],this.#t.points;this.#t.points=[];for(let e=0;e<this.#o.spaces.length;e++){let t=this.#e.getById("point-of-interest",this.#o.spaces[e].id);t&&this.#t.points.push(t)}return this.#t.points}get doors(){if(this.#t.doors)return this.#t.doors;if(this.#o.entrances==null)return this.#t.doors=[],this.#t.doors;this.#t.doors=[];for(let e=0;e<this.#o.entrances.length;e++){let t=this.#e.getById("door",this.#o.entrances[e].id);t&&this.#t.doors.push(t)}return this.#t.doors}get connections(){if(this.#t.connections)return this.#t.connections;if(this.#o.connections==null)return this.#t.connections=[],this.#t.connections;this.#t.connections=[];for(let e of this.#o.connections){let t=this.#e.getById("connection",e);t&&this.#t.connections.push(t)}return this.#t.connections}get annotations(){if(this.#t.annotations)return this.#t.annotations;if(this.#o.annotations==null)return this.#t.annotations=[],this.#t.annotations;this.#t.annotations=[];for(let e=0;e<this.#o.annotations.length;e++){let t=this.#e.getById("annotation",this.#o.annotations[e].id);t&&this.#t.annotations.push(t)}return this.#t.annotations}get categories(){return this.#t.categories?this.#t.categories:this.#o.categories==null?(this.#t.categories=[],this.#t.categories):(this.#t.categories=this.#o.categories.map(e=>this.#e.getById("location-category",e)).filter(e=>e!=null),this.#t.categories)}get mapObjects(){return this.#t.mapObjects?this.#t.mapObjects:this.#o.obstructions==null?(this.#t.mapObjects=[],this.#t.mapObjects):(this.#t.mapObjects=this.#o.obstructions.map(e=>this.#e.getById("object",e.id)).filter(e=>e!=null),this.#t.mapObjects)}get areas(){return this.#t.areas?this.#t.areas:this.#o.areas==null?(this.#t.areas=[],this.#t.areas):(this.#t.areas=this.#o.areas.map(e=>this.#e.getById("area",e.id)).filter(e=>e!=null),this.#t.areas)}get focusTarget(){if(this.#t.focusTarget)return this.#t.focusTarget;let e=[];for(let t of this.spaces)e.push(t);for(let t of this.connections)e.push(...t.coordinates);for(let t of this.doors)e.push(t.focusTarget);for(let t of this.mapObjects)e.push(t.focusTarget);for(let t of this.annotations)e.push(t.focusTarget);for(let t of this.points)e.push(t.focusTarget);for(let t of this.areas)e.push(t.focusTarget);return this.#t.focusTarget=e,e}get openingHours(){return this.#t.openingHours?this.#t.openingHours:(this.#t.openingHours=new Si(this.#o.openingHoursSpecification??[]),this.#t.openingHours)}get navigationTarget(){if(this.#t.navigationTarget)return this.#t.navigationTarget;let e=[];for(let t of this.spaces)e.push(t);for(let t of this.connections)e.push(...t.coordinates);for(let t of this.doors)e.push(t.focusTarget);for(let t of this.mapObjects)e.push(t.focusTarget);for(let t of this.annotations)e.push(t.focusTarget);for(let t of this.points)e.push(t.focusTarget);return this.#t.navigationTarget=e,e}toJSON(){return{__type:o.__type,id:this.id,name:this.name}}},co=Ps;f();var Os=class o extends Fe{static is(e){return e.__type===o.__type}static __type="location-category";__type=o.__type;id="cat_";name="";icon="";#e;#t={};#o;constructor(e,t){super(t.mvfData.id),this.#e=e,this.#o=t.mvfData;for(let r in t.mvfData)Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),r)||Object.defineProperty(this,r,{enumerable:!0,get(){return this.#o[r]}})}get parent(){return this.#t.parent?this.#t.parent:(this.#t.parent=this.#o.parent?this.#e.getById("location-category",this.#o.parent):void 0,this.#t.parent)}get children(){return this.#t.children?this.#t.children:(this.#t.children=this.#e.locationCategoriesByParentId[this.id]||[],this.#t.children)}get locationProfiles(){if(this.#t.locationProfiles)return this.#t.locationProfiles;let e=[];for(let t of this.#e.locationProfilesByCategoryId[this.id]||[]){let r=this.#e.getById("location-profile",t.id);r&&e.push(r)}return this.#t.locationProfiles=e,e}toJSON(){return{__type:o.__type,id:this.id,name:this.name}}},ci=Os;var Ds=.75;function dm(o){let e=[];if(o.geometry.type==="Polygon")for(let t=1;t<o.geometry.coordinates.length;t++)e.push({type:"Feature",geometry:{type:"Polygon",coordinates:[o.geometry.coordinates[t]]},properties:{...o.properties,id:ee()}});else if(o.geometry.type==="MultiPolygon")for(let t of o.geometry.coordinates)for(let r=1;r<t.length;r++)e.push({type:"Feature",geometry:{type:"Polygon",coordinates:[t[r]]},properties:{...o.properties,id:ee()}});return e}function um(o){let e={},t=o["floor.geojson"]?.features??[];for(let r of t){let n=r.properties.id;if(!n)continue;let i=[];if(r.geometry!=null&&r.geometry.coordinates.length>0){let a=dm(r);for(let s of a)i.push(s)}e[n]={voids:{type:"FeatureCollection",features:i}}}return e}var Vo=class extends Mt{Analytics;#e={};Query;mvf;outdoorViewToken;objectEntranceNodeIdsByObstructionId;obstructionIdByEntranceId;venue;tokenManager;directions;enterpriseMode=!1;nodesById;spacesById;floorsById;floorStacksById;facadesById;facadesBySpaceId;connectionsById;objectsById;doorsById;pointsOfInterestById;annotationsById;areasById;locationProfilesById;locationCategoriesById;locationProfilesByExternalId;locationProfilesByCategoryId;locationCategoriesByParentId;doorsByNodeId;mvfAnnotationsById;mvfConnectionsById;mvfConnectionsByNodeId;mvfEntrancesById;mvfNodesById;mvfObstructionById;mvfSpacesById;mvfFloorsById;mvfFloorStacksById;mvfAreasById;spacesByExternalId;nodesByExternalId;objectsByExternalId;poisByExternalId;floorsByExternalId;floorStacksByExternalId;doorsByExternalId;areasByExternalId;locationProfilesByAttachedFeatureId={};entranceNodeIdsBySpaceId={};locationsById={};locationInstancesById={};instanceLocationsByPolygonId={};categoriesById={};mvfLocationsByGeometryId={};locationIdsByNodeId={};spaceIdsByNodeId={};objectIdsByNodeId={};connectionsByExternalId={};locationsByExternalId={};categoriesByExternalId={};destinationNodesIdsBySpaceId={};mvfNodesByFloorId;mvfSpacesByFloorId;mvfPoisByFloorId;mvfEntrancesByFloorId;mvfAnnotationsByFloorId;voidsByFloorId={};floorImagesByAnchorId=new Map;localePacksUrls;currentLanguage;languagePacks={};tilesets={};navigationFlags;binaryBundle;envControl;getMapDataOptions;#t;constructor(e,t){super();let r=t?.env??To();if(this.envControl=r,this.binaryBundle=t?.binaryBundle,this.Analytics=new tr,this.localePacksUrls=t?.localePacksUrls??{},this.mvf=e,this.outdoorViewToken=t?.outdoorViewToken,this.getMapDataOptions=t?.getMapDataOptions,this.#t=t?.mvf3,e["tileset.json"]?.default!=null&&(this.tilesets[e["tileset.json"].default.key]=e["tileset.json"].default,r.updateTileServerBaseUrl(e["tileset.json"].default.url),e["tileset.json"].others!=null))for(let i of e["tileset.json"].others)this.tilesets[i.key]=i;this.navigationFlags=e["navigationFlags.json"]??{},this.enterpriseMode=t?.enterprise??!1,this.tokenManager=t?.tokenManager;let n=lp(this,e,t?.mvf3);if(this.nodesById=n.nodesById,this.spacesById=n.spacesById,this.floorsById=n.floorsById,this.floorStacksById=n.floorStacksById,this.facadesById=n.facadesById,this.facadesBySpaceId=n.facadesBySpaceId,this.connectionsById=n.connectionsById,this.objectsById=n.objectsById,this.doorsById=n.doorsById,this.pointsOfInterestById=n.poisById,this.annotationsById=n.annotationsById,this.areasById=n.areasById,this.locationProfilesById=n.locationProfilesById,this.locationCategoriesById=n.locationCategoriesById,this.locationProfilesByCategoryId=n.locationProfilesByCategoryId,this.locationCategoriesByParentId=n.locationCategoriesByParentId,this.spacesByExternalId=n.spacesByExternalId,this.nodesByExternalId=n.nodesByExternalId,this.objectsByExternalId=n.objectsByExternalId,this.floorsByExternalId=n.floorsByExternalId,this.locationProfilesByExternalId=n.locationProfilesByExternalId,this.floorStacksByExternalId=n.floorStacksByExternalId,this.poisByExternalId=n.poisByExternalId,this.doorsByExternalId=n.doorsByExternalId,this.areasByExternalId=n.areasByExternalId,this.mvfAnnotationsById=n.mvfAnnotationsById,this.mvfConnectionsById=n.mvfConnectionsById,this.mvfConnectionsByNodeId=n.mvfConnectionsByNodeId,this.mvfEntrancesById=n.mvfEntrancesById,this.mvfNodesById=n.mvfNodesById,this.mvfObstructionById=n.mvfObstructionById,this.mvfSpacesById=n.mvfSpacesById,this.mvfFloorsById=n.mvfFloorsById,this.mvfFloorStacksById=n.mvfFloorStacksById,this.mvfNodesByFloorId=n.mvfNodesByFloorId,this.mvfSpacesByFloorId=n.mvfSpacesByFloorId,this.mvfPoisByFloorId=n.mvfPoisByFloorId,this.mvfEntrancesByFloorId=n.mvfEntrancesByFloorId,this.mvfAnnotationsByFloorId=n.mvfAnnotationsByFloorId,this.mvfAreasById=n.mvfAreasById,this.doorsByNodeId=n.doorsByNodeId,this.objectEntranceNodeIdsByObstructionId=n.objectEntranceNodeIdsByObstructionId,this.obstructionIdByEntranceId=n.obstructionIdByEntranceId,this.locationProfilesByAttachedFeatureId=n.locationProfilesByAttachedFeatureId,this.entranceNodeIdsBySpaceId=n.entranceNodeIdsBySpaceId,this.spaceIdsByNodeId=n.spaceIdsByNodeId,this.objectIdsByNodeId=n.objectIdsByNodeId,this.destinationNodesIdsBySpaceId=n.destinationNodesIdsBySpaceId,this.voidsByFloorId=um(e),this.enterpriseMode||an()){let i=sp(e,this);if(this.locationsById=i.locationsById,this.locationInstancesById=i.locationInstancesById,this.instanceLocationsByPolygonId=i.instanceLocationsByPolygonId,this.categoriesById=i.categoriesById,this.mvfLocationsByGeometryId=i.mvfLocationsByGeometryId,this.locationIdsByNodeId=i.locationIdsByNodeId,this.connectionsByExternalId=i.connectionsByExternalId,this.locationsByExternalId=i.locationsByExternalId,this.categoriesByExternalId=i.categoriesByExternalId,i.venue.name!=null){this.venue=new fs(this,{mvfData:i.venue});let a={};for(let s in i.mvfLocationsById)a[s]=i.mvfLocationsById[s];for(let s in i.mvfLocationInstancesById)a[s]=i.mvfLocationInstancesById[s];this.languagePacks[this.venue.defaultLanguage.code]={type:"initial",optimized:{"enterprise-location":a,"enterprise-category":i.mvfCategoriesById,"floor-stack":n.mvfFloorStacksById,floor:n.mvfFloorsById}},t?.languagePacks?.forEach(({language:s,localePack:l})=>{this.languagePacks[s.code]=Ha(l)}),this.currentLanguage=this.venue.defaultLanguage}}this.directions=new br({nodes:e["node.geojson"],geojsonCollection:this.enterpriseMode&&e.enterprise?e.space:e.obstruction,connections:e["connection.json"],groupBy:"map",multiplicativeDistanceWeightScaling:!this.enterpriseMode,flagDeclarations:e["navigationFlags.json"],getDoorByNodeId:(i=>{let a=this.doorsByNodeId[i];if(a!=null)return{geoJSON:a.geoJSON}})}),this.Query=new nn(this)}getEnv(){let e=this;return{get baseUri(){return e.envControl.getBaseUri()},get baseAuthUri(){return e.envControl.getBaseAuthUri()},get analyticsBaseUri(){return e.envControl.getAnalyticsBaseUri()},get tileServerUri(){return e.envControl.getTileServerUri()}}}get mapName(){return this.mvf["manifest.geojson"].features[0].properties.name}get organizationId(){return this.mvf["manifest.geojson"].features[0].properties.org_id??""}#o=new H(0,0,"initializing");get mapCenter(){return this.#o.floorId==="initializing"&&(this.#o=new H(this.mvf["manifest.geojson"].features[0].geometry.coordinates[1],this.mvf["manifest.geojson"].features[0].geometry.coordinates[0])),this.#o}get naturalBearing(){return this.mvf["manifest.geojson"].features[0].properties.naturalBearing??0}get spaces(){return this.#e.spaces==null&&(this.#e.spaces=globalThis.Object.values(this.spacesById)),this.#e.spaces}get objects(){return this.#e.objects==null&&(this.#e.objects=globalThis.Object.values(this.objectsById)),this.#e.objects}get connections(){return this.#e.connections==null&&(this.#e.connections=globalThis.Object.values(this.connectionsById)),this.#e.connections}get floors(){return this.#e.floors==null&&(this.#e.floors=globalThis.Object.values(this.floorsById)),this.#e.floors}get floorStacks(){return this.#e.floorStacks==null&&(this.#e.floorStacks=globalThis.Object.values(this.floorStacksById)),this.#e.floorStacks}get facades(){return this.#e.facades==null&&(this.#e.facades=globalThis.Object.values(this.facadesById)),this.#e.facades}get doors(){return this.#e.doors==null&&(this.#e.doors=globalThis.Object.values(this.doorsById)),this.#e.doors}get pointsOfInterest(){return this.#e.pointsOfInterest==null&&(this.#e.pointsOfInterest=globalThis.Object.values(this.pointsOfInterestById)),this.#e.pointsOfInterest}get annotations(){return this.#e.annotations==null&&(this.#e.annotations=globalThis.Object.values(this.annotationsById)),this.#e.annotations}get areas(){return this.#e.areas==null&&(this.#e.areas=globalThis.Object.values(this.areasById)),this.#e.areas}get nodes(){return this.#e.nodes==null&&(this.#e.nodes=globalThis.Object.values(this.nodesById)),this.#e.nodes}get locations(){return this.#e.locations==null&&(this.#e.locations=globalThis.Object.values(this.locationsById)),globalThis.Object.values(this.locationsById)}get categories(){return this.#e.categories==null&&(this.#e.categories=globalThis.Object.values(this.categoriesById)),globalThis.Object.values(this.categoriesById)}get locationProfiles(){return this.#e.locationProfiles==null&&(this.#e.locationProfiles=globalThis.Object.values(this.locationProfilesById)),this.#e.locationProfiles}get locationCategories(){return this.#e.locationCategories==null&&(this.#e.locationCategories=globalThis.Object.values(this.locationCategoriesById)),this.#e.locationCategories}get mvfFloors(){return this.#e.mvfFloors==null&&(this.#e.mvfFloors=globalThis.Object.values(this.mvfFloorsById)),this.#e.mvfFloors}get mvfFloorStacks(){return this.#e.mvfFloorStacks==null&&(this.#e.mvfFloorStacks=globalThis.Object.values(this.mvfFloorStacksById)),this.#e.mvfFloorStacks}getByType(e){switch(e){case"location-profile":return this.locationProfiles;case"location-category":return this.locationCategories;case"area":return this.areas;case"node":return this.nodes;case"space":return this.spaces;case"door":return this.doors;case"floor":return this.floors;case"floor-stack":return this.floorStacks;case"connection":return this.connections;case"object":return this.objects;case"point-of-interest":return this.pointsOfInterest;case"annotation":return this.annotations;case"enterprise-location":return this.locations;case"enterprise-category":return this.categories;case"enterprise-venue":return this.venue;case"facade":return this.facades;default:return[]}}getAllOfTypes(e,t){let r=e instanceof Set?e:new Set(e);return t!=null&&Array.isArray(t)?t.filter(n=>r.has(n.__type)):Array.from(r).flatMap(n=>this.getByType(n))}getById(e,t){let r={"location-profile":this.locationProfilesById,"location-category":this.locationCategoriesById,space:this.spacesById,floor:this.floorsById,"floor-stack":this.floorStacksById,facade:this.facadesById,node:this.nodesById,door:this.doorsById,connection:this.connectionsById,"mvf-connection":this.mvfConnectionsById,object:this.objectsById,"point-of-interest":this.pointsOfInterestById,annotation:this.annotationsById,area:this.areasById,"enterprise-location":a=>this.locationsById[a]??this.locationInstancesById[a],"enterprise-category":this.categoriesById},n=a=>{let s=r[a];if(s!=null)return typeof s=="function"?s(t):s[t]},i=()=>{for(let a of Object.keys(r)){let s=n(a);if(s!=null)return s}};return e==="unknown"?i():n(e)}getByExternalId(e,t){switch(e){case"location-profile":return this.locationProfilesByExternalId[t]??[];case"location-category":return[];case"space":return this.spacesByExternalId[t]??[];case"floor":return this.floorsByExternalId[t]??[];case"floor-stack":return this.floorStacksByExternalId[t]??[];case"node":return this.nodesByExternalId[t]??[];case"door":return this.doorsByExternalId[t]??[];case"connection":return this.connectionsByExternalId[t]??[];case"object":return this.objectsByExternalId[t]??[];case"point-of-interest":return this.poisByExternalId[t]??[];case"area":return this.areasByExternalId[t]??[];case"enterprise-location":return this.locationsByExternalId[t]??[];case"enterprise-category":return this.categoriesByExternalId[t]??[];default:return[]}}getMapDataById(e){return this.spacesById[e]??this.floorsById[e]??this.floorStacksById[e]??this.facadesById[e]??this.nodesById[e]??this.doorsById[e]??this.connectionsById[e]??this.objectsById[e]??this.pointsOfInterestById[e]??this.annotationsById[e]??this.areasById[e]}getMVFFeatureById(e,t){switch(e){case"space":return this.mvfSpacesById[t];case"node":return this.mvfNodesById[t];case"obstruction":return this.mvfObstructionById[t];case"floor":return this.mvfFloorsById[t];case"floor-stack":return this.mvfFloorStacksById[t];case"connection":return this.mvfConnectionsById[t];case"entrance":return this.mvfEntrancesById[t];case"annotation":return this.mvfAnnotationsById[t];case"area":return this.mvfAreasById[t];default:throw new Error(`Unknown MVF feature type: ${e}`)}}getMVFFeatureByNodeId(e,t){switch(e){case"connection":return this.mvfConnectionsByNodeId[t];default:throw new Error(`Unsupported MVF feature type: ${e}`)}}getMVFFeatureByType(e){switch(e){case"floor-stack":return this.mvfFloorStacks;case"floor":return this.mvfFloors;default:throw new Error(`Unsupported MVF feature type: ${e}`)}}propTranslationCache=new Map;getPropTranslation(e,t,r,n){if(!this.currentLanguage)return n;let{code:i}=this.currentLanguage,a=this.languagePacks[i]?.optimized?.[e];if(a){let s=a[r];if(s!=null&&s[t]!==void 0){let l=s[t];if(l!=null&&typeof l=="object"){if(typeof n=="object"&&typeof l=="object"&&!Array.isArray(l)){let c=$n(i+e+r+t.toString());if(this.propTranslationCache.has(c))return this.propTranslationCache.get(c);let p=zl(n,l,["id"]);return this.propTranslationCache.set(c,p),p}return l}return l}}return n}findPreferredLanguage(e){if(!this.venue)return;let t=ws(this.venue,e);return e?.languageCode!=null&&e.languageCode.toLowerCase()!==t.code.toLowerCase()&&C.warn(`Language code "${e.languageCode}" could not be found in the venue. Using "${t.code}" instead.`),t}#r;async changeLanguage(e){let t=e.toLowerCase();if(!t){C.error("Language code must be defined.");return}if(!this.currentLanguage||!this.venue){C.error("Changing the language is not supported for this map.");return}let r=this.currentLanguage.code,n=this.venue?.languages.find(({code:a})=>a.toLowerCase()===t.toLowerCase());if(!n){C.warn(`Language code "${t}" could not be found in the venue.`);return}if(r===n.code)return;let i=this.languagePacks[n.code];if(!i){let a=this.localePacksUrls[n.code];if(!a){C.error(`Locale pack URL not found for language code "${n.code}".`);return}this.#r&&this.#r.abort();let s=new AbortController;this.#r=s;let l;try{l=await Yc(a,{signal:s.signal})}catch(c){C.error(`Failed to download language pack for language code "${n.code}".`,c);return}if(!l||s.signal.aborted)return;i=Ha(l),this.languagePacks[n.code]=i}this.Analytics.sendChangeLanguageEvent({fromLanguage:this.currentLanguage.code}),this.currentLanguage=n,this.publish("language-change",this.currentLanguage)}__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC=(e,t,r)=>this.__LEGACY_GET_DIRECTIONS_SYNC(e,t,{...r,multiDestination:!0});__LEGACY_GET_DIRECTIONS_SYNC=(e,t,r)=>{let{accessible:n=!1,multiDestination:i=!1}=r||{},a=id(this.enterpriseMode,r),s=r?.zones||[],l={accessible:n,zones:s,smoothing:a,excludedConnections:r?.excludedConnections||[],connectionIdWeightMap:r?.connectionIdWeightMap||{},includeNonPublic:r?.includeNonPublic??!1};if(i&&Array.isArray(t)){let c=Array.isArray(e)?e:[e],p=[];for(let h of t){let g=Array.isArray(h)?h:[h],T=this.directions.getDirectionsSync(c,g,l,this);if(!T){C.error("getDirections failed due to missing directions for one of the segments");return}c=g,p.push(T)}return p}else{let c=Array.isArray(e)?e:[e],p=Array.isArray(t)?t:[t];if(Array.isArray(p[0])){C.error("getDirections does not support multi-destination without multisegment option");return}c[0].id&&p[0].id&&this.Analytics.sendGetDirectionsEvent(c[0].id,p[0].id,n);try{return this.directions.getDirectionsSync(c,p,l,this)}catch(h){C.error("Unable to get directions",h);return}}};getDirections=async(e,t,r)=>{let{accessible:n=!1}=r||{},i=id(this.enterpriseMode,r),a=r?.zones||[],s={accessible:n,zones:a,smoothing:i,excludedConnections:r?.excludedConnections||[],connectionIdWeightMap:r?.connectionIdWeightMap||{},includeNonPublic:r?.includeNonPublic??!1},l=Array.isArray(e)?e:[e],c=Array.isArray(t)?t:[t];if(Array.isArray(c[0])){C.error("getDirections does not support multi-destination without multisegment option");return}l[0].id&&c[0].id&&this.Analytics.sendGetDirectionsEvent(l[0].id,c[0].id,n);try{return this.directions.getDirections(l,c,s,this)}catch(p){C.error("Unable to get directions",p);return}};getDirectionsMultiDestination=async(e,t,r)=>Promise.resolve(this.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(e,t,r));getDistance(e,t){let r=Io(e),n=Io(t);return qt([r.longitude,r.latitude],[n.longitude,n.latitude])}getDoorByNodeId=e=>this.doorsByNodeId[e];transformImageRequest=async e=>{if(this.enterpriseMode||!this.getMapDataOptions)return{url:e};if(!qc(e))return{url:e};if(Qc(e))return{url:e};let t=sr(e);if(!t)return{url:e};try{let n=(await this.tokenManager?.getSasTokensAsync())?.tokens?.[t.mapId];if(n==null)throw new Error("SAS token not found");let[i]=e.split("?");return{url:`${i}?${n.token}`}}catch(r){return C.error("Failed to append SAS token to image request. Requests for private images may fail.",r),{url:e}}};async toJSONBundle({downloadLanguagePacks:e=!0}={}){let t=[];if(e&&this.enterpriseMode){let r=new AbortController;for(let n of this.venue?.languages||[])try{if(this.localePacksUrls[n.code]){let i=await La(this.localePacksUrls[n.code],{signal:r.signal}),a=await ir(i);a&&t.push({language:{code:n.code,name:n.name},localePack:a})}}catch(i){C.warn("failed downloading language pack",i)}}return{type:"json",options:{enterprise:this.enterpriseMode,mvf3:this.#t},languagePacks:t,main:this.mvf}}async toBinaryBundle({downloadLanguagePacks:e=!0}={}){if(!this.binaryBundle){C.error("binary bundle not found");return}let t=[];if(e&&this.enterpriseMode){let r=new AbortController;for(let n of this.venue?.languages||[])try{if(this.localePacksUrls[n.code]){let i=await La(this.localePacksUrls[n.code],{signal:r.signal});i&&t.push({language:{code:n.code,name:n.name},localePack:i})}}catch(i){C.warn("failed downloading language pack",i)}}return{type:"binary",options:{enterprise:this.enterpriseMode},languagePacks:t,main:this.binaryBundle}}destroy(){for(let e of globalThis.Object.keys(this.#e))this.#e[e]=null;this.propTranslationCache.clear()}};var id=(o,e)=>{let t=!o,r=e?.smoothing,i=r!=null?typeof r=="object"?r.enabled??t:r:t,a=typeof r=="object"?r.radius:void 0,s=typeof r=="object"?r.__EXPERIMENTAL_METHOD??"greedy-los":"greedy-los";return s==="dp-optimal"?{enabled:i,radius:a??Ds,__EXPERIMENTAL_METHOD:"dp-optimal",includeDoorBufferNodes:typeof r=="object"&&r.__EXPERIMENTAL_METHOD==="dp-optimal"?r.__EXPERIMENTAL_INCLUDE_DOOR_BUFFER_NODES:void 0}:s==="rdp"?{enabled:i,radius:a??Ds,__EXPERIMENTAL_METHOD:"rdp",mustIncludeDoorBufferNodes:typeof r=="object"&&r.__EXPERIMENTAL_METHOD==="rdp"?r.__EXPERIMENTAL_MUST_INCLUDE_DOOR_BUFFER_NODES:void 0}:{enabled:i,radius:a??Ds,__EXPERIMENTAL_METHOD:s}};f();f();f();f();f();var po=class o{id;text;target;static __type="label";__type=o.__type;static is(e){return e.__type===o.__type}get focusTarget(){return this.target.anchorTarget}constructor(e,t,r){this.id=e,this.text=t,this.target=r}get navigationTarget(){return this.target.anchorTarget}};f();var ro=class o{id;static __type="marker";#e;get target(){return this.#e}get coordinate(){return this.#e.anchorTarget}get navigationTarget(){return this.target.anchorTarget}toJSON(){return{id:this.id,__type:o.__type,target:this.target,coordinate:this.coordinate}}__type=o.__type;contentEl;static is(e){return e.__type===o.__type}constructor(e,t,r){this.id=e,this.contentEl=t,this.#e=r}get focusTarget(){return this.target.anchorTarget}updateTarget(e){this.#e=e}};f();var jo=class o{id;groupId;static __type="model";__type=o.__type;#e;get target(){return this.#e}static is(e){return e.__type===o.__type}constructor(e,t,r){this.id=e,this.groupId=t,this.#e=r}updateTarget(e){this.#e=e}toJSON(){return{id:this.id,__type:o.__type,groupId:this.groupId,target:this.#e}}get navigationTarget(){return this.#e.anchorTarget}};f();var xo=class o{id;coordinates;#e;static __type="path-segment";__type=o.__type;static is(e){return e.__type===o.__type}constructor(e,t){this.id=e,this.coordinates=t}get isConnectionSegment(){return this.coordinates.length===2&&this.coordinates[0].floorId!==this.coordinates[1].floorId}get distance(){return this.#e?this.#e:(this.#e=Xa(this.coordinates),this.#e)}get focusTarget(){return this.coordinates}},_t=class o{id;animation;coordinates;segments;#e;static __type="path";__type=o.__type;static is(e){return e.__type===o.__type}get focusTarget(){return this.coordinates}constructor(e,t,r,n){this.id=e,this.animation=t,this.coordinates=r,this.segments=n.map(({id:i,coordinates:a})=>new xo(i.toString(),a))}get distance(){return this.#e?this.#e:(this.#e=Xa(this.coordinates),this.#e)}toJSON(){return{__type:o.__type,id:this.id,coordinates:this.coordinates,segments:this.segments}}};f();var fm=7,sn=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t?.precision??fm}toJSON(){return{center:this.center,bearing:this.bearing,pitch:this.pitch,zoomLevel:this.zoomLevel}}get center(){let e=this.#e.center;if(this.#t===-1)return e;let t=qn(e.latitude,this.#t),r=qn(e.longitude,this.#t);return new H({latitude:t,longitude:r,floorId:e.floorId,verticalOffset:e.verticalOffset})}get bearing(){return this.#e.bearing}get pitch(){return this.#e.pitch}get zoomLevel(){return qn(this.#e.zoomLevel,5)}};f();var uo=class o{id;static __type="shape";__type=o.__type;static is(e){return e.__type===o.__type}get focusTarget(){return this}constructor(e){this.id=e}};f();var fo=class o{id;constructor(e,t){this.id=e,this.target=t}target;static __type="text-3d";__type=o.__type;static is(e){return e.__type===o.__type}};f();f();f();var hm=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
|
|
6
|
+
`)}return c}else throw new ho.default("The partial "+l.name+" could not be compiled when running in runtime-only mode")}var n={strict:function(s,l,c){if(!s||!(l in s))throw new ho.default('"'+l+'" not defined in '+s,{loc:c});return n.lookupProperty(s,l)},lookupProperty:function(s,l){var c=s[l];if(c==null||Object.prototype.hasOwnProperty.call(s,l)||cf.resultIsAllowed(c,n.protoAccessControl,l))return c},lookup:function(s,l){for(var c=s.length,p=0;p<c;p++){var h=s[p]&&n.lookupProperty(s[p],l);if(h!=null)return h}},lambda:function(s,l){return typeof s=="function"?s.call(l):s},escapeExpression:Pr.escapeExpression,invokePartial:r,fn:function(s){var l=o[s];return l.decorator=o[s+"_d"],l},programs:[],program:function(s,l,c,p,h){var g=this.programs[s],T=this.fn(s);return l||h||p||c?g=ea(this,s,T,l,c,p,h):g||(g=this.programs[s]=ea(this,s,T)),g},data:function(s,l){for(;s&&l--;)s=s._parent;return s},mergeIfNeeded:function(s,l){var c=s||l;return s&&l&&s!==l&&(c=Pr.extend({},l,s)),c},nullContext:Object.seal({}),noop:e.VM.noop,compilerInfo:o.compiler};function i(a){var s=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],l=s.data;i._setup(s),!s.partial&&o.useData&&(l=r1(a,l));var c=void 0,p=o.useBlockParams?[]:void 0;o.useDepths&&(s.depths?c=a!=s.depths[0]?[a].concat(s.depths):s.depths:c=[a]);function h(g){return""+o.main(n,g,n.helpers,n.partials,l,p,c)}return h=uf(o.main,h,n,s.depths||[],l,p),h(a,s)}return i.isTop=!0,i._setup=function(a){if(a.partial)n.protoAccessControl=a.protoAccessControl,n.helpers=a.helpers,n.partials=a.partials,n.decorators=a.decorators,n.hooks=a.hooks;else{var s={};pf(s,e.helpers,n),pf(s,a.helpers,n),n.helpers=s,o.usePartial&&(n.partials=n.mergeIfNeeded(a.partials,e.partials)),(o.usePartial||o.useDecorators)&&(n.decorators=Pr.extend({},e.decorators,a.decorators)),n.hooks={},n.protoAccessControl=cf.createProtoAccessControl(a);var l=a.allowCallsToHelperMissing||t;lf.moveHelperToHooks(n,"helperMissing",l),lf.moveHelperToHooks(n,"blockHelperMissing",l)}},i._child=function(a,s,l,c){if(o.useBlockParams&&!l)throw new ho.default("must pass block params");if(o.useDepths&&!c)throw new ho.default("must pass parent depths");return ea(n,a,o[a],s,0,l,c)},i}function ea(o,e,t,r,n,i,a){function s(l){var c=arguments.length<=1||arguments[1]===void 0?{}:arguments[1],p=a;return a&&l!=a[0]&&!(l===o.nullContext&&a[0]===null)&&(p=[l].concat(a)),t(o,l,o.helpers,o.partials,c.data||r,i&&[c.blockParams].concat(i),p)}return s=uf(t,s,o,a,r,i),s.program=e,s.depth=a?a.length:0,s.blockParams=n||0,s}function t1(o,e,t){return o?!o.call&&!t.name&&(t.name=o,o=ta(t.partials,o)):t.name==="@partial-block"?o=ta(t.data,"partial-block"):o=ta(t.partials,t.name),o}function o1(o,e,t){var r=ta(t.data,"partial-block");t.partial=!0,t.ids&&(t.data.contextPath=t.ids[0]||t.data.contextPath);var n=void 0;if(t.fn&&t.fn!==df&&(function(){t.data=go.createFrame(t.data);var i=t.fn;n=t.data["partial-block"]=function(s){var l=arguments.length<=1||arguments[1]===void 0?{}:arguments[1];return l.data=go.createFrame(l.data),l.data["partial-block"]=r,i(s,l)},i.partials&&(t.partials=Pr.extend({},t.partials,i.partials))})(),o===void 0&&n&&(o=n),o===void 0)throw new ho.default("The partial "+t.name+" could not be found");if(o instanceof Function)return o(e,t)}function df(){return""}function ta(o,e){if(o&&Object.prototype.hasOwnProperty.call(o,e))return o[e]}function r1(o,e){return(!e||!("root"in e))&&(e=e?go.createFrame(e):{},e.root=o),e}function uf(o,e,t,r,n,i){if(o.decorator){var a={};e=o.decorator(e,a,t,r&&r[0],n,i,r),Pr.extend(e,a)}return e}function pf(o,e,t){e&&Object.keys(e).forEach(function(r){var n=e[r];o[r]=n1(n,t)})}function n1(o,e){var t=e.lookupProperty;return Qy.wrapHelper(o,function(r){return r.lookupProperty=t,r})}});var gf=Se((oa,hf)=>{"use strict";f();oa.__esModule=!0;oa.default=function(o){(function(){typeof globalThis!="object"&&(Object.prototype.__defineGetter__("__magic__",function(){return this}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var e=globalThis.Handlebars;o.noConflict=function(){return globalThis.Handlebars===o&&(globalThis.Handlebars=e),o}};hf.exports=oa.default});var vf=Se((ra,Tf)=>{"use strict";f();ra.__esModule=!0;function ml(o){return o&&o.__esModule?o:{default:o}}function yl(o){if(o&&o.__esModule)return o;var e={};if(o!=null)for(var t in o)Object.prototype.hasOwnProperty.call(o,t)&&(e[t]=o[t]);return e.default=o,e}var i1=ul(),mf=yl(i1),a1=af(),s1=ml(a1),l1=_o(),c1=ml(l1),p1=$t(),gl=yl(p1),d1=ff(),yf=yl(d1),u1=gf(),f1=ml(u1);function bf(){var o=new mf.HandlebarsEnvironment;return gl.extend(o,mf),o.SafeString=s1.default,o.Exception=c1.default,o.Utils=gl,o.escapeExpression=gl.escapeExpression,o.VM=yf,o.template=function(e){return yf.template(e,o)},o}var wn=bf();wn.create=bf;f1.default(wn);wn.default=wn;ra.default=wn;Tf.exports=ra.default});var Sf=Se((d_,If)=>{f();If.exports=vf().default});f();f();f();f();f();var pc="mi-session-data",dc="mi-local-data",Kn="id",ei="deviceId",Lt=class o{static#e;#t;#o;constructor(){try{let e=sessionStorage.getItem(pc);e?this.#t=JSON.parse(e):this.#t={[Kn]:ee()}}catch{this.#t={[Kn]:ee()}}try{let e=localStorage.getItem(dc);e?this.#o=JSON.parse(e):this.#o={[ei]:ee()}}catch{this.#o={[ei]:ee()}}this.#t[Kn]||(this.#t[Kn]=ee()),this.#o[ei]||(this.#o[ei]=ee())}static getInstance(){return this.#e||(this.#e=new o),this.#e}static ___clearInstance(){this.#e=void 0}saveSessionData(e,t){this.#t[e]=t;try{return sessionStorage.setItem(pc,JSON.stringify(this.#t)),!0}catch{return!1}}loadSessionData(e){let t=this.#t[e];if(t!=null)return t}saveLocalData(e,t){this.#o[e]=t;try{return localStorage.setItem(dc,JSON.stringify(this.#o)),!0}catch{return!1}}loadLocalData(e){let t=this.#o[e];if(t!=null)return t}};f();f();var er=o=>o!=null;var yh=(function(){let e=globalThis.fetch;return{fetch(...t){if(!er(e))throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return e?.(...t)},setFetch(t){e=t}}})(),uc=yh.fetch;var yc=["websdk","web","webv2","kiosk","kiosk-v2","mobile","iossdk","androidsdk","reactnativesdk","gen7","bespoke","reactsdk","minimap"],fc=yc[0],bc="https://api-gateway.mappedin.com/track-analytics/a/",Tc="deny-watchposition",vc="load-mapview",Ic="load-mapdata",Sc="change-language",Ec="query-directions";var tr=class{#e=Object.freeze({});#t;oneTimeEventsSent=new Set;constructor(){this.#t=this.#r(this.#e)}init(e){this.reset(),this.updateStateWithOptions(e)}reset(){this.#e={},this.#t=this.#r({}),this.oneTimeEventsSent.clear()}updateStateWithOptions(e){return this.#e=Object.freeze(Object.assign({},this.#e,e)),this.#t=this.#r(e),this.#o(this.#t),this.#t}#o(e){e.sessionId&&Lt.getInstance().saveSessionData("id",e.sessionId),e.deviceId&&Lt.getInstance().saveLocalData("deviceId",e.deviceId)}#r(e){let t=e.baseUri??bc;return{baseUri:t,analyticsBaseUrl:Ma({...e,baseUri:t}),version:e.version||S?.env?.npm_package_version||"v6",deviceId:e.deviceId||hc(),accessToken:e.accessToken,mapId:e.mapId,sessionId:e.sessionId||gc(),platformString:e.platformString||"",context:mc(e.context)||fc,geolocationMode:!1,sendEvents:e.sendEvents??!0,logEvents:e.logEvents??!1,noAuth:e.noAuth||!1,key:e.key,secret:e.secret,enterprise:e.enterprise??!1,externalId:e.externalId}}updateState(e){let t={...e};t.mapId&&(t.analyticsBaseUrl=Ma({...this.#t,mapId:t.mapId})),t.context&&(t.context=mc(t.context)),t.baseUri&&(t.analyticsBaseUrl=Ma({baseUri:t.baseUri,mapId:this.#t.mapId})),Object.assign(this.#t,t),this.handleStateUpdate(e),this.#o(t)}handleStateUpdate(e){e.userPosition?.floorLevel?this.sendBlueDotEvents("found-floor"):e.userPosition&&this.sendBlueDotEvents("found-position")}get authReady(){let{key:e,secret:t,accessToken:r}=this.getState();return!!(e&&t)||!!r}getState(){return this.#t}getContext(){return this.getState().context||this.#e.context||fc}getSessionId(){return this.getState().sessionId||this.#e.sessionId||gc()}getDeviceId(){return this.getState().deviceId||this.#e.deviceId||hc()}sendAnalyticEvent(e,t={}){let r=this.getState(),n=bh(r.analyticsBaseUrl,e),i={"mi-context":this.getContext(),"mi-session":this.getSessionId(),"mi-device":this.getDeviceId()};if(r.logEvents&&C.log("Analytics.track",n,i),!r.sendEvents)return Promise.resolve();if(!this.authReady)return!r.key&&!r.secret&&!r.accessToken?void 0:C.warn("Auth needs to be ready to send analytics.");let a={...t,g:r.geolocationMode,sdk_version:r.version,...r.externalId?{externalId:r.externalId}:{}};return r.userPosition&&Object.assign(a,r.userPosition),i["Content-Type"]="application/json",!r.noAuth&&r.enterprise&&r.secret&&r.key?(i["x-mappedin-key"]=btoa(r.key),i["x-mappedin-secret"]=btoa(r.secret)):r.accessToken&&(i.Authorization=`Bearer ${r.accessToken}`),uc(n,{method:"POST",mode:"cors",headers:i,body:JSON.stringify(a)})}capture(e,t){if(vh.includes(e))return C.warn(`${e} event is sent internally.`),Promise.resolve();let r=Th.includes(e)?e.slice(1):e;return this.sendAnalyticEvent(r,t)}sendGetMapDataEvent(e){return this.sendAnalyticEvent(Ic,e)}sendChangeLanguageEvent(e){return this.sendAnalyticEvent(Sc,e)}sendWatchPositionDenied(){return this.sendAnalyticEvent(Tc)}sendMapViewLoadedEvent({firstRenderDuration:e,dimension:t,collisionWorkerDisabled:r,outdoorsWorkerDisabled:n}){return this.sendAnalyticEvent(vc,{type:"3d",firstRenderDuration:e,width:t.width,height:t.height,devicePixelRatio:globalThis.devicePixelRatio||1,collisionWorkerDisabled:r,outdoorsWorkerDisabled:n})}sendGetDirectionsEvent=Nl((e,t,r)=>{let n={start:e,end:t,type:"location_to_location"};return r!==void 0&&(n.accessible=r),this.sendAnalyticEvent(Ec,n)},2500);sendBlueDotEvents(e){if(!((e==="found-floor"||e==="found-position")&&this.oneTimeEventsSent.has(e)))return this.oneTimeEventsSent.add(e),this.sendAnalyticEvent(e)}};function Ma({mapId:o,baseUri:e=bc}){return`${e}${o}/`}function hc(){return Lt.getInstance().loadLocalData("deviceId")}function gc(){return Lt.getInstance().loadSessionData("id")}function bh(o,e){return o+e}function mc(o){return yc.find(e=>e===o)}var Th=["$select-location","$select-category","$query-suggest","$query-search"],vh=[vc,Ic,Ec,Tc,Sc],Ob=new tr,jr=class{#e;constructor(e){this.#e=e,this.capture=this.#e.capture.bind(this.#e),this.updateState=this.#e.updateState.bind(this.#e)}capture;updateState;getState(){let{sessionId:e,deviceId:t,...r}=this.#e.getState();return r}getContext(){return this.#e.getContext()}getSessionId(){return this.#e.getSessionId()}getDeviceId(){return this.#e.getDeviceId()}};f();f();var Gr=class{#e;searchInstance;#t;#o;enabled=!1;constructor(e,t,{enabled:r=!1}={}){this.#e=e,this.#t=t,this.#o=()=>{this.searchInstance?.then(n=>n.populate())},r&&this.enable()}async query(e,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return C.error("Search should be enabled by now"),{places:[],enterpriseLocations:[],enterpriseCategories:[]};try{return await(await this.searchInstance).search(e,t)}catch(r){return C.error("Search.query failed due to",r),{places:[],enterpriseLocations:[],enterpriseCategories:[]}}}async suggest(e,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return C.error("Search should be enabled by now"),[];try{return await(await this.searchInstance).suggest(e,t)}catch(r){return C.error("Search.suggest failed due to",r),[]}}async enable(){this.enabled||(this.enabled=!0,this.searchInstance||(this.searchInstance=import("./internal-GPY5MCOX.js").then(({InternalSearch:e})=>new e(this.#e))),this.#t.on("language-change",this.#o),await this.searchInstance)}};var Mc={"enterprise-location":"location-profile","enterprise-category":"location-category"},xc={"location-profile":"enterprise-location","location-category":"enterprise-category"},Cc=new WeakMap,xa=class{#e;#t;Analytics;Search;Query;internal;constructor(e,{search:t}={}){this.#e=new Mt,this.#t=e,Cc.set(this,e),this.Analytics=new jr(e.Analytics),this.Query=e.Query,this.internal=e,this.Search=new Gr(this,e,{enabled:t?.enabled}),this.#t.on("language-change",r=>{this.#e.publish("language-change",r)})}on=(e,t)=>{this.#e.on(e,t)};off=(e,t)=>{this.#e.off(e,t)};getEnv(){return this.#t.getEnv()}getAccessToken(){return this.#t.tokenManager?.getAccessToken().token}get mapName(){return this.#t.mapName}get mapId(){return this.#t.getMapDataOptions?.mapId}get isEnterpriseMode(){return this.#t.enterpriseMode}get mapCenter(){return this.#t.mapCenter}get organizationId(){return this.#t.organizationId}get outdoorViewToken(){return this.#t.outdoorViewToken}getByType(e){let t=this.#t.getByType(e);if(Array.isArray(t)&&t.length===0){let r=this.isEnterpriseMode;!r&&e in Mc?C.warn(`MappedinSDK: getByType('${e}') returned 0 results. This is a Maker map (API key starts with 'mik_'). Use '${Mc[e]}' instead. See https://developer.mappedin.com/web-sdk/getting-started`):r&&e in xc&&C.warn(`MappedinSDK: getByType('${e}') returned 0 results. This is an Enterprise map. Use '${xc[e]}' instead. See https://developer.mappedin.com/web-sdk/getting-started`)}return t}getById(e,t){return this.#t.getById(e,t)}getByExternalId(e,t){return this.#t.getByExternalId(e,t)}getGeoJSON(e){return e.geoJSON}async changeLanguage(e){return this.#t.changeLanguage(e)}get currentLanguage(){return this.#t.currentLanguage}get naturalBearing(){return this.#t.naturalBearing??0}__LEGACY_GET_DIRECTIONS_SYNC=(e,t,r)=>this.#t.__LEGACY_GET_DIRECTIONS_SYNC(e,t,r);getDirections=(e,t,r)=>this.#t.getDirections(e,t,r);__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC=(e,t,r)=>this.#t.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(e,t,r);getDirectionsMultiDestination=(e,t,r)=>this.#t.getDirectionsMultiDestination(e,t,r);getDistance(e,t){return this.#t.getDistance(e,t)}toBinaryBundle({downloadLanguagePacks:e=!0}={}){return this.#t.toBinaryBundle({downloadLanguagePacks:e})}toJSONBundle({downloadLanguagePacks:e=!0}={}){return this.#t.toJSONBundle({downloadLanguagePacks:e})}},Ur=xa;function Hr(o){let e=Cc.get(o);if(!e)throw new Error("MapDataInternal not found");return e}f();f();f();f();f();function or(o){return o.endsWith("/")?o:`${o}/`}f();var rr="https://app.mappedin.com/",_c="https://auth.mappedin.com/",Pc=Object.freeze({baseUri:"https://app.mappedin.com/",baseAuthUri:"https://app.mappedin.com/",analyticsBaseUri:"https://api-gateway.mappedin.com/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),Ih=Object.freeze({...Pc,baseUri:"https://api-gateway.mappedin.com/",baseAuthUri:"https://auth.mappedin.com/"}),Sh=Object.freeze({baseUri:"https://api-gateway.eu.mappedin.com/",baseAuthUri:"https://auth.eu.mappedin.com/",analyticsBaseUri:"https://api-gateway.eu.mappedin.com/track-analytics/a/",tileServerUri:"https://tiles-cdn.eu.mappedin.com/styles/mappedin/style.json"}),Eh=Object.freeze({baseUri:"https://api-gateway-staging.mappedin.net/",baseAuthUri:"https://auth-staging.mappedin.net/",analyticsBaseUri:"https://api-gateway-staging.mappedin.net/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),Mh=Object.freeze({baseUri:"https://app-staging.mappedin.net/",baseAuthUri:"https://app-staging.mappedin.net/",analyticsBaseUri:"https://api-gateway-staging.mappedin.net/track-analytics/a/",tileServerUri:"https://tiles-cdn.mappedin.com/styles/mappedin/style.json"}),xh={eu:Sh,us:Pc,"us-enterprise":Ih,"us-staging-enterprise":Eh,"us-staging-self-serve":Mh};function Oc(o){return xh[o]}f();f();var Ch=o=>{let e=Date.now();return o-e},ti=(o,e)=>Ch(o)<=e*60*1e3;var wc=10,Ac=wc*60*1e3,Dc="accessTokens",_h="mik_";function Fc(o){return typeof o=="string"&&o.startsWith(_h)}async function Wr(o,e=!1){let t=`${o.key}`,r=Lt.getInstance(),n=r?.loadSessionData(Dc)||{},i=Math.floor(Date.now()/1e3);if(n[t]&&!ti(n[t].expiresTimestamp*1e3,wc))return n[t];let a=e?await Ph(o,i):await Oh(o,i),s={...n,[t]:a};return r?.saveSessionData(Dc,s),a}async function Ph(o,e){let t;o.customAuthUri?t=o.customAuthUri:t=`${o.baseAuthUri??_c}oauth2/token`;let r;try{r=await ht()(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({grant_type:"client_credentials",client_id:o.key,client_secret:o.secret})})}catch(i){let a=i instanceof Error?i.message:String(i);throw new Error(`Failed to fetch enterprise access token from ${t}: ${a}`)}if(!r.ok)throw new Error(`${r.status} ${r.statusText}: ${await r.text()}`);let n=await r.json();return{accessToken:n.access_token,expiresTimestamp:e+n.expires_in}}async function Oh(o,e){let t;o.customAuthUri?t=o.customAuthUri:t=`${o.baseAuthUri?or(o.baseAuthUri):rr}api/v1/api-key/token`;let r;try{r=await ht()(t,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({key:o.key,secret:o.secret})})}catch(i){let a=i instanceof Error?i.message:String(i);throw new Error(`Failed to fetch access token from ${t}: ${a}`)}if(!r.ok)throw new Error(`${r.status} ${r.statusText}: ${await r.text()}`);let n=await r.json();return{accessToken:n.access_token,expiresTimestamp:e+n.expires_in}}f();var Lc=10,Rc=Lc*60*1e3,kc="miSasTokens";async function Ca(o,e){let t=`${e}__${o.mapId}`,r=Lt.getInstance(),n=r?.loadSessionData(kc)||{};if(n[t]&&!ti(n[t].expires,Lc))return n[t];let i=await Dh(o,e),a={...n,[t]:{token:i.token,expires:new Date(i.expires).getTime()}};return r?.saveSessionData(kc,a),i}async function Dh(o,e){let t=`${o.baseUri?or(o.baseUri):rr}api/v1/venue/${o.mapId}/sas-token`,r=await ht()(t,{method:"GET",headers:{Authorization:`Bearer ${e}`}});if(!r.ok)throw new Error(`${r.status} ${r.statusText}: ${await r.text()}`);let n=await r.json();return{token:n.token,expires:new Date(n.expires).getTime()}}f();var gt=Uint8Array,Fo=Uint16Array,Nc=Uint32Array,Bc=new gt([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Vc=new gt([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),wh=new gt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),jc=function(o,e){for(var t=new Fo(31),r=0;r<31;++r)t[r]=e+=1<<o[r-1];for(var n=new Nc(t[30]),r=1;r<30;++r)for(var i=t[r];i<t[r+1];++i)n[i]=i-t[r]<<5|r;return[t,n]},Gc=jc(Bc,2),Uc=Gc[0],Ah=Gc[1];Uc[28]=258,Ah[258]=28;var Hc=jc(Vc,0),Fh=Hc[0],g0=Hc[1],Da=new Fo(32768);for(ae=0;ae<32768;++ae)so=(ae&43690)>>>1|(ae&21845)<<1,so=(so&52428)>>>2|(so&13107)<<2,so=(so&61680)>>>4|(so&3855)<<4,Da[ae]=((so&65280)>>>8|(so&255)<<8)>>>1;var so,ae,zr=(function(o,e,t){for(var r=o.length,n=0,i=new Fo(e);n<r;++n)o[n]&&++i[o[n]-1];var a=new Fo(e);for(n=0;n<e;++n)a[n]=a[n-1]+i[n-1]<<1;var s;if(t){s=new Fo(1<<e);var l=15-e;for(n=0;n<r;++n)if(o[n])for(var c=n<<4|o[n],p=e-o[n],h=a[o[n]-1]++<<p,g=h|(1<<p)-1;h<=g;++h)s[Da[h]>>>l]=c}else for(s=new Fo(r),n=0;n<r;++n)o[n]&&(s[n]=Da[a[o[n]-1]++]>>>15-o[n]);return s}),Xr=new gt(288);for(ae=0;ae<144;++ae)Xr[ae]=8;var ae;for(ae=144;ae<256;++ae)Xr[ae]=9;var ae;for(ae=256;ae<280;++ae)Xr[ae]=7;var ae;for(ae=280;ae<288;++ae)Xr[ae]=8;var ae,Wc=new gt(32);for(ae=0;ae<32;++ae)Wc[ae]=5;var ae;var kh=zr(Xr,9,1);var Lh=zr(Wc,5,1),_a=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},Rt=function(o,e,t){var r=e/8|0;return(o[r]|o[r+1]<<8)>>(e&7)&t},Pa=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},Rh=function(o){return(o+7)/8|0},Aa=function(o,e,t){(e==null||e<0)&&(e=0),(t==null||t>o.length)&&(t=o.length);var r=new(o.BYTES_PER_ELEMENT==2?Fo:o.BYTES_PER_ELEMENT==4?Nc:gt)(t-e);return r.set(o.subarray(e,t)),r};var Nh=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],Nt=function(o,e,t){var r=new Error(e||Nh[o]);if(r.code=o,Error.captureStackTrace&&Error.captureStackTrace(r,Nt),!t)throw r;return r},Bh=function(o,e,t){var r=o.length;if(!r||t&&t.f&&!t.l)return e||new gt(0);var n=!e||t,i=!t||t.i;t||(t={}),e||(e=new gt(r*3));var a=function(Je){var Dt=e.length;if(Je>Dt){var qe=new gt(Math.max(Dt*2,Je));qe.set(e),e=qe}},s=t.f||0,l=t.p||0,c=t.b||0,p=t.l,h=t.d,g=t.m,T=t.n,I=r*8;do{if(!p){s=Rt(o,l,1);var E=Rt(o,l+1,3);if(l+=3,E)if(E==1)p=kh,h=Lh,g=9,T=5;else if(E==2){var U=Rt(o,l,31)+257,R=Rt(o,l+10,15)+4,B=U+Rt(o,l+5,31)+1;l+=14;for(var V=new gt(B),L=new gt(19),j=0;j<R;++j)L[wh[j]]=Rt(o,l+j*3,7);l+=R*3;for(var te=_a(L),ie=(1<<te)-1,oe=zr(L,te,1),j=0;j<B;){var ce=oe[Rt(o,l,ie)];l+=ce&15;var D=ce>>>4;if(D<16)V[j++]=D;else{var Te=0,xe=0;for(D==16?(xe=3+Rt(o,l,3),l+=2,Te=V[j-1]):D==17?(xe=3+Rt(o,l,7),l+=3):D==18&&(xe=11+Rt(o,l,127),l+=7);xe--;)V[j++]=Te}}var Re=V.subarray(0,U),re=V.subarray(U);g=_a(Re),T=_a(re),p=zr(Re,g,1),h=zr(re,T,1)}else Nt(1);else{var D=Rh(l)+4,x=o[D-4]|o[D-3]<<8,A=D+x;if(A>r){i&&Nt(0);break}n&&a(c+x),e.set(o.subarray(D,A),c),t.b=c+=x,t.p=l=A*8,t.f=s;continue}if(l>I){i&&Nt(0);break}}n&&a(c+131072);for(var Yt=(1<<g)-1,it=(1<<T)-1,Zt=l;;Zt=l){var Te=p[Pa(o,l)&Yt],ue=Te>>>4;if(l+=Te&15,l>I){i&&Nt(0);break}if(Te||Nt(2),ue<256)e[c++]=ue;else if(ue==256){Zt=l,p=null;break}else{var ge=ue-254;if(ue>264){var j=ue-257,vt=Bc[j];ge=Rt(o,l,(1<<vt)-1)+Uc[j],l+=vt}var pe=h[Pa(o,l)&it],It=pe>>>4;pe||Nt(3),l+=pe&15;var re=Fh[It];if(It>3){var vt=Vc[It];re+=Pa(o,l)&(1<<vt)-1,l+=vt}if(l>I){i&&Nt(0);break}n&&a(c+131072);for(var le=c+ge;c<le;c+=4)e[c]=e[c-re],e[c+1]=e[c+1-re],e[c+2]=e[c+2-re],e[c+3]=e[c+3-re];c=le}}t.l=p,t.p=Zt,t.b=c,t.f=s,p&&(s=1,t.m=g,t.d=h,t.n=T)}while(!s);return c==e.length?e:Aa(e,0,c)};var Vh=new gt(0);var Qt=function(o,e){return o[e]|o[e+1]<<8},Bt=function(o,e){return(o[e]|o[e+1]<<8|o[e+2]<<16|o[e+3]<<24)>>>0},Oa=function(o,e){return Bt(o,e)+Bt(o,e+4)*4294967296};function jh(o,e){return Bh(o,e)}var wa=typeof TextDecoder<"u"&&new TextDecoder,Gh=0;try{wa.decode(Vh,{stream:!0}),Gh=1}catch{}var Uh=function(o){for(var e="",t=0;;){var r=o[t++],n=(r>127)+(r>223)+(r>239);if(t+n>o.length)return[e,Aa(o,t-1)];n?n==3?(r=((r&15)<<18|(o[t++]&63)<<12|(o[t++]&63)<<6|o[t++]&63)-65536,e+=String.fromCharCode(55296|r>>10,56320|r&1023)):n&1?e+=String.fromCharCode((r&31)<<6|o[t++]&63):e+=String.fromCharCode((r&15)<<12|(o[t++]&63)<<6|o[t++]&63):e+=String.fromCharCode(r)}};function Hh(o,e){if(e){for(var t="",r=0;r<o.length;r+=16384)t+=String.fromCharCode.apply(null,o.subarray(r,r+16384));return t}else{if(wa)return wa.decode(o);var n=Uh(o),i=n[0],a=n[1];return a.length&&Nt(8),i}}var Wh=function(o,e){return e+30+Qt(o,e+26)+Qt(o,e+28)},zh=function(o,e,t){var r=Qt(o,e+28),n=Hh(o.subarray(e+46,e+46+r),!(Qt(o,e+8)&2048)),i=e+46+r,a=Bt(o,e+20),s=t&&a==4294967295?Xh(o,i):[a,Bt(o,e+24),Bt(o,e+42)],l=s[0],c=s[1],p=s[2];return[Qt(o,e+10),l,c,n,i+Qt(o,e+30)+Qt(o,e+32),p]},Xh=function(o,e){for(;Qt(o,e)!=1;e+=4+Qt(o,e+2));return[Oa(o,e+12),Oa(o,e+4),Oa(o,e+20)]};function Fa(o,e){for(var t={},r=o.length-22;Bt(o,r)!=101010256;--r)(!r||o.length-r>65558)&&Nt(13);var n=Qt(o,r+8);if(!n)return{};var i=Bt(o,r+16),a=i==4294967295||n==65535;if(a){var s=Bt(o,r-12);a=Bt(o,s)==101075792,a&&(n=Bt(o,s+32),i=Bt(o,s+48))}for(var l=e&&e.filter,c=0;c<n;++c){var p=zh(o,i,a),h=p[0],g=p[1],T=p[2],I=p[3],E=p[4],D=p[5],x=Wh(o,D);i=E,(!l||l({name:I,size:g,originalSize:T,compression:h}))&&(h?h==8?t[I]=jh(o.subarray(x,x+g),new gt(T)):Nt(14,"unknown compression type "+h):t[I]=Aa(o,x,x+g))}return t}var zc=globalThis.fetch,Yh=S?.env?.npm_package_version;function ht(){if(zc==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return zc}var ka={supplementaryUrl:"https://api-gateway.mappedin.com/analytics/",headers:{},accessToken:"",clientId:"",noAuth:!1,includeHidden:!0,clientSecret:"",apiGateway:"",authorization:"",perspective:"Website",language:"",venue:""};function $c(o){let e={...ka,...o};return e.headers={...e.headers,"mappedin-sdk-version":Yh},e.things=[],"platformString"in o&&(e.headers={...e.headers,"mappedin-platform-version":o.platformString}),e.noAuth||(e.accessToken?e.authorization=`Bearer ${e.accessToken}`:e.clientId&&e.clientSecret&&(e.authorization=`Basic ${globalThis.btoa(`${e.clientId}:${e.clientSecret}`)}`)),e.language=e.language?.toLowerCase(),e}function Zh(o,e,t=!1){let r={language:o.language,clientId:o.clientId,clientSecret:o.clientSecret};t&&delete r.language;let{headers:n}=o;n["Content-Type"]=n["Content-Type"]||"text/json",o.accessToken?n.Authorization=`Bearer ${o.accessToken}`:o.noAuth||o.clientId&&o.clientSecret&&(n["x-mappedin-key"]=btoa(o.clientId),n["x-mappedin-secret"]=btoa(o.clientSecret));let i={method:"GET",headers:n};return o.secure&&(e+="&withcdntoken"),{req:i,url:e}}async function Jh(o,e,t=!1){let r=Zh(o,e,t),n=await ht()(r.url,r.req);if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);return n.json()}var qh=o=>{let e=o!=null&&typeof o=="object"&&"perspectives"in o&&o.perspectives!=null&&typeof o.perspectives=="object"?o.perspectives:null;if(e==null||Object.keys(e).length===0)return C.warn("No perspectives available in response!"),null;let t={};for(let[r,n]of Object.entries(e)){let i="url"in n&&typeof n.url=="string"?n.url:null,a="locale_packs"in n&&typeof n.locale_packs=="object"?n.locale_packs:null;if(i==null||a==null){C.warn(`Perspective ${r} is missing url or locale_packs!`);continue}t[r]={url:i,locale_packs:a}}return t};async function Qh(o,e="exports/mvf/1/bundle"){let t=$c({baseUri:"https://api-gateway.mappedin.com/",...ka,...o}),r=`${t.baseUri+e}?venue=${t.venue}&version=${t.version??"2.0.0"}`;t.headers["Content-Type"]="application/zip";let n=await Jh(t,r),i=n.url,a=n.locale_packs,s=t.perspective??ka.perspective,l=qh(n);if(s!=null&&s!==""&&l!=null){let c=l[s];c==null?C.warn(`Perspective ${s} not found in response! Loading default perspective instead.`):(C.log(`Loading perspective "${s}"`),i=c.url,a=c.locale_packs)}return{url:i,localePacks:a,updated_at:n.updated_at}}var nr=(function(){let o;return()=>(o||(o=new TextDecoder),o)})();async function La(o,{signal:e}){let t=await(await ht()(o,{signal:e})).arrayBuffer();return new Uint8Array(t)}async function ir(o){let e=Fa(o),t={};if(e["enterprise/"]!=null){t.enterprise={};let r=e["enterprise/locations.json"];r&&(t.enterprise.locations=JSON.parse(nr().decode(r)));let n=e["enterprise/locationInstances.json"];n&&(t.enterprise.locationInstances=JSON.parse(nr().decode(n)));let i=e["enterprise/categories.json"];i&&(t.enterprise.categories=JSON.parse(nr().decode(i)))}return e["floorstack.json"]&&(t["floorstack.json"]=JSON.parse(nr().decode(e["floorstack.json"]))),e["floor.geojson"]&&(t["floor.geojson"]=JSON.parse(nr().decode(e["floor.geojson"]))),e["manifest.json"]&&(t["manifest.geojson"]=JSON.parse(nr().decode(e["manifest.json"]))),t}async function Yc(o,{signal:e}){try{let t=await(await ht()(o,{signal:e})).arrayBuffer();if(e.aborted)return;let r=new Uint8Array(t);return await ir(r)}catch(t){let r=new Error("downloadLanguagePack failed");throw r.cause=t,r}}function Kh(o){let{mvfVersion:e,useDraftData:t}=o;if(e==="3.0.0")return t?"exports/mvf3-draft/1/bundle":"exports/mvf3/1/bundle";if(e==null||e==="2.0.0")return t?"exports/mvf2-draft/1/bundle":"exports/mvf2/1/bundle";if(e==="2.0.0-c")return t?"exports/mvf2c-draft/1/bundle":"exports/mvf2c/1/bundle";throw new Error(`Unsupported MVF version: ${e}`)}async function Ra(o){return new Promise(async(e,t)=>{try{let r=Kh(o),{url:n,localePacks:i}=await Qh(o,r),a=await ht()(n).then(l=>l.arrayBuffer()),s=new Uint8Array(a);e({compressed:s,localePacks:i})}catch(r){t(r)}})}async function Na(o,e){return new Promise(async(t,r)=>{try{let{url:n}=await eg(o,e),i=await ht()(n).then(s=>s.arrayBuffer()),a=new Uint8Array(i);t(a)}catch(n){r(n)}})}async function eg(o,e){let t=new URL(`${o.baseUri?or(o.baseUri):rr}api/v1/venue/${o.mapId}/mvf`);o.viewId&&t.searchParams.set("configId",o.viewId),o.mvfVersion&&t.searchParams.set("version",o.mvfVersion);let r=await ht()(t.toString(),{headers:{Authorization:`Bearer ${e}`}});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);return r.json()}function Zc(o){return ua(o)}function tg(o){if(o==null||typeof o!="object")return!1;let e=["connection.json","manifest.geojson","floor.geojson"in o?"floor.geojson":"map.geojson","node.geojson","floorstack.json"in o?"floorstack.json":"mapstack.json"in o?"mapstack.json":"mapstack.geojson"];"styles.json"in o&&e.push("styles.json"),"shapes.json"in o&&e.push("shapes.json"),"navigationFlags.json"in o&&e.push("navigationFlags.json"),"annotation-symbols.json"in o&&e.push("annotation-symbols.json");for(let t of e)if(o[t]==null||o[t][Symbol.toStringTag]!=="Uint8Array")return!1;return!0}async function Ba(o){return new Promise(async(e,t)=>{try{if(o==null||typeof o!="object")throw new Error("Error parsing data! Unzipping failed.");if(o[Symbol.toStringTag]!=="Uint8Array")throw new Error("Unexpected file type! Unzipping failed.");let r=Fa(o);if(!tg(r))throw new Error("MVF is missing some expect static files. Unzipping failed.");let n={},i=Object.keys(r);for(let a of i){if(r[a].length===0)continue;let s=a.split("/");if(s.length<0)throw new Error("Encounted a file with no name! Unzipping failed.");if(s.length>2)throw new Error("Encountered unexpected nesting in MVF! Unzipping failed.");if(s.length===1){n[s[0]]=r[a];continue}if(s[0]==="image"){C.warn("MVF unzipping encountered an image. Ignoring as this case has not been implemented.");continue}else n[s[0]]==null&&(n[s[0]]={}),n[s[0]][s[1]]=r[a]}e(n)}catch(r){t(r)}})}function To(){let o="us",e={};function t(){return og(Oc(o),e)}return{updateByUserOption(r){r.environment&&(o=r.environment),r.baseUri&&(e.baseUri=r.baseUri),r.baseAuthUri&&(e.baseAuthUri=r.baseAuthUri),r.analytics?.baseUri&&(e.analyticsBaseUri=r.analytics?.baseUri)},updateTileServerBaseUrl(r){e.tileServerUri=r},updateEnvironment(r){o=r},setEnterprise(r){(o==="us"||o==="us-enterprise")&&(o=r?"us-enterprise":"us")},getBaseUri(){return t().baseUri},getBaseAuthUri(){return t().baseAuthUri},getAnalyticsBaseUri(){return t().analyticsBaseUri},getTileServerUri(){return t().tileServerUri},reset(){o="us",e={}},__getState:t}}function og(o,e){return{...o,...e}}var oi=o=>{let e=Object.values(o["floorstack.json"]??o["mapstack.json"]??{});return e.length===1?[]:e.filter(t=>t.type!=="Outdoor").map(t=>t.id.replace("fs_","").replace("ms_",""))},Xc=async o=>{let e=performance.now(),t,r=$l.decompressUnsafeSync(o);r.isOk()?t=r.unwrap():C.error("MVFv3 decompression failed!");let n;if(t)try{n=Xl(t)}catch(i){C.error("MVFv3 to MVFv2 conversion failed!",i)}if(C.log(`Parsed MVFv3 in ${performance.now()-e}ms`),!n)throw new Error("Failed to parse MVFv2 from MVFv3!");return{mvf2:n,mvf3:t}};async function ri(o,e="2.0.0"){switch(e){case"2.0.0":case"2.0.0-c":try{let t=performance.now(),r=await Ba(o),n=ua(r);return C.log(`Parsed MVFv2 in ${performance.now()-t}ms`),{mvf2:n}}catch{return C.error("MVFv2 parsing failed! Trying MVFv3."),Xc(o)}case"3.0.0":return Xc(o);default:throw new Error(`Unsupported MVF version: ${e}`)}}f();f();function rg(o,e,t){t===void 0&&(t={});for(var r=bo(o),n=qo(e),i=0;i<n.length-1;i++){var a=!1;if(t.ignoreEndVertices&&(i===0&&(a="start"),i===n.length-2&&(a="end"),i===0&&i+1===n.length-1&&(a="both")),ng(n[i],n[i+1],r,a,typeof t.epsilon>"u"?null:t.epsilon))return!0}return!1}function ng(o,e,t,r,n){var i=t[0],a=t[1],s=o[0],l=o[1],c=e[0],p=e[1],h=t[0]-s,g=t[1]-l,T=c-s,I=p-l,E=h*I-g*T;if(n!==null){if(Math.abs(E)>n)return!1}else if(E!==0)return!1;if(r){if(r==="start")return Math.abs(T)>=Math.abs(I)?T>0?s<i&&i<=c:c<=i&&i<s:I>0?l<a&&a<=p:p<=a&&a<l;if(r==="end")return Math.abs(T)>=Math.abs(I)?T>0?s<=i&&i<c:c<i&&i<=s:I>0?l<=a&&a<p:p<a&&a<=l;if(r==="both")return Math.abs(T)>=Math.abs(I)?T>0?s<i&&i<c:c<i&&i<s:I>0?l<a&&a<p:p<a&&a<l}else return Math.abs(T)>=Math.abs(I)?T>0?s<=i&&i<=c:c<=i&&i<=s:I>0?l<=a&&a<=p:p<=a&&a<=l;return!1}var Jc=rg;f();function ig(o,e){e===void 0&&(e={});var t=Jo(o),r=(t[0]+t[2])/2,n=(t[1]+t[3])/2;return Zo([r,n],e.properties,e)}var ar=ig;f();f();function ag(o,e,t){t===void 0&&(t={});var r=bo(o),n=bo(e),i=Jt(n[1]-r[1]),a=Jt(n[0]-r[0]),s=Jt(r[1]),l=Jt(n[1]),c=Math.pow(Math.sin(i/2),2)+Math.pow(Math.sin(a/2),2)*Math.cos(s)*Math.cos(l);return Bl(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),t.units)}var vo=ag;function ni(o,e){return e===void 0&&(e={}),Gl(o,function(t,r){var n=r.geometry.coordinates;return t+vo(n[0],n[1],e)},0)}f();f();f();function ii(o,e,t){if(t===void 0&&(t={}),t.final===!0)return sg(o,e);var r=bo(o),n=bo(e),i=Jt(r[0]),a=Jt(n[0]),s=Jt(r[1]),l=Jt(n[1]),c=Math.sin(a-i)*Math.cos(l),p=Math.cos(s)*Math.sin(l)-Math.sin(s)*Math.cos(l)*Math.cos(a-i);return Vl(Math.atan2(c,p))}function sg(o,e){var t=ii(e,o);return t=(t+180)%360,t}function lg(o,e,t){t===void 0&&(t={});var r=Zo([1/0,1/0],{dist:1/0}),n=0;return jl(o,function(i){for(var a=qo(i),s=0;s<a.length-1;s++){var l=Zo(a[s]);l.properties.dist=vo(e,l,t);var c=Zo(a[s+1]);c.properties.dist=vo(e,c,t);var p=vo(l,c,t),h=Math.max(l.properties.dist,c.properties.dist),g=ii(l,c),T=fa(e,h,g+90,t),I=fa(e,h,g-90,t),E=Yl(Br([T.geometry.coordinates,I.geometry.coordinates]),Br([l.geometry.coordinates,c.geometry.coordinates])),D=null;E.features.length>0&&(D=E.features[0],D.properties.dist=vo(e,D,t),D.properties.location=n+vo(l,D,t)),l.properties.dist<r.properties.dist&&(r=l,r.properties.index=s,r.properties.location=n),c.properties.dist<r.properties.dist&&(r=c,r.properties.index=s+1,r.properties.location=n+p),D&&D.properties.dist<r.properties.dist&&(r=D,r.properties.index=s),n+=p}}),r}var $r=lg;function cg(o,e,t){var r=qo(t);if(Hl(t)!=="LineString")throw new Error("line must be a LineString");var n=$r(t,o),i=$r(t,e),a;n.properties.index<=i.properties.index?a=[n,i]:a=[i,n];for(var s=[a[0].geometry.coordinates],l=a[0].properties.index+1;l<a[1].properties.index+1;l++)s.push(r[l]);return s.push(a[1].geometry.coordinates),Br(s,t.properties)}var Va=cg;var pg=1e-7;function ja(o){return{type:"Point",coordinates:o}}function dg(o,e){let{coordinates:t}=e.geometry,{coordinates:r}=o.geometry,n=t.map(i=>$r(o,ja(i)));return r.reduce((i,a)=>{let s=Va(ja(a),n[0],o),l=Va(ja(a),n[1],o),c=ni(s)<ni(l)?s:l;return c.properties={...o.properties,entrances:[]},i.concat([c])},[])}function Ga(o,e){return e.reduce((t,r)=>{let n={epsilon:pg},i=t.obstructions.findIndex(s=>Jc(ar(r),s,n)),a=t.obstructions[i];if(a){let[s,l]=dg(a,r);t.entrances.push(r),t.obstructions.splice(i,1,s,l)}return t},{obstructions:[o],entrances:[]})}f();f();f();var Fe=class{id;constructor(e){this.id=e}};f();f();var Ua=class o{static __type="coordinate";__type=o.__type;id=ee();latitude;longitude;floorId;verticalOffset;#e={};static is(e){return e.__type===o.__type}constructor(e,t,r){if(typeof e=="object")this.latitude=e.latitude,this.longitude=e.longitude,this.floorId=e.floorId,this.verticalOffset=e.verticalOffset??0;else{if(t==null)throw new Error("Coordinate longitude is required.");this.latitude=e,this.longitude=t,this.floorId=r,this.verticalOffset=0}}get anchorTarget(){return this}get focusTarget(){return this}get navigationTarget(){return this}isEqual(e){return this.latitude===e.latitude&&this.longitude===e.longitude&&this.floorId===e.floorId}toJSON(){return{__type:o.__type,latitude:this.latitude,longitude:this.longitude,floorId:this.floorId,verticalOffset:this.verticalOffset}}get geoJSON(){if(this.#e.geoJSON!=null)return this.#e.geoJSON;let e=[this.longitude,this.latitude];return this.verticalOffset!==0&&e.push(this.verticalOffset),this.#e.geoJSON={type:"Feature",properties:null,geometry:{type:"Point",coordinates:e}},this.#e.geoJSON}toGeoJSON(){return this.geoJSON.geometry}destroy(){for(let e of globalThis.Object.keys(this.#e))delete this.#e[e]}},H=Ua;function Ha(o){let e=o.enterprise?.locations?.reduce((n,i)=>(n[i.id]=i,n),{})||{};for(let n of o.enterprise?.locationInstances||[])e[n.id]=n;let t={};for(let n of o["floorstack.json"]||[])t[n.id]=n;let r={};for(let n of o["floor.geojson"]?.features||[])n.properties&&n.properties.id&&(r[n.properties.id]=n.properties);return{type:"downloaded",data:o,optimized:{"enterprise-location":e,"enterprise-category":o.enterprise?.categories?.reduce((n,i)=>(n[i.id]=i,n),{})||{},"floor-stack":t,floor:r}}}var ug=/^https?:\/\/cdn(-staging)?\.mappedin\.com(\/|$)/;function qc(o){return ug.test(o)}function Qc(o){return!!o.split("?")[1]?.includes("sv=")}function Ze(o,e){let t=o?.properties?.id||"unknown";if(o.geometry==null)return C.error(`Cannot get the center coordinate for "${t}" because it has no geometry.`),new H({latitude:0,longitude:0,floorId:e});try{if(o.geometry.type==="LineString"){let[[r,n],[i,a]]=o.geometry.coordinates,s=(r+i)/2,l=(n+a)/2;return new H({latitude:l,longitude:s,floorId:e})}else if(o.geometry.type==="Point"){let[r,n]=o.geometry.coordinates;return new H({latitude:n,longitude:r,floorId:e})}else if(o.geometry.type==="Polygon"){let r=o;if(r.properties.center!=null){let[n,i]=r.properties.center;return new H({latitude:i,longitude:n,floorId:e})}}}catch{}try{let[r,n]=ar(o).geometry.coordinates;return new H({latitude:n,longitude:r,floorId:e})}catch(r){return C.error(`Failed to get center coordinate for "${t}" ${r instanceof Error?r.stack:""}`),new H({latitude:0,longitude:0,floorId:e})}}function Kc(o,e){return e&&(o.flags[e.index]&1<<e.bit)!==0}function ai(o,e){let t=o.instanceLocationsByPolygonId?.[e];if(t)return[t];let r=[],n=o.mvfLocationsByGeometryId[e];if(n)for(let i of n){let a=o.getById("enterprise-location",i.id);a&&r.push(a)}return r}var Wa=class o extends Fe{static __type="node";__type=o.__type;#e;#t={};#o;#r;static is(e){return e.__type===o.__type}constructor(e,t){super(t.mvfData.properties.id),this.#e=e,this.#o=t.floorId,this.#r=t.mvfData}get locations(){return this.#t.locations?this.#t.locations:(this.#t.locations=(this.#e.locationIdsByNodeId[this.id]||[]).map(e=>this.#e.getById("enterprise-location",e)).filter(Boolean),this.#t.locations)}get space(){return this.#e.getById("space",this.#e.spaceIdsByNodeId[this.id]?.[0])}get object(){return this.#e.getById("object",this.#e.objectIdsByNodeId[this.id]?.[0])}get floor(){let e=this.#e.getById("floor",this.#o);if(e==null)throw new Error(`Floor ${this.#o} not found!`);return e}get coordinate(){return this.#t.coordinate==null&&(this.#t.coordinate=Ze(this.#r,this.#o)),this.#t.coordinate}get externalId(){return this.#r.properties.externalId??""}get neighbors(){if(this.#t.neighbors==null){let e=this.#r.properties.neighbors.map(t=>{let r=this.#e.getById("node",t.id);if(r==null)throw new Error(`Node ${t.id} not found!`);return r});this.#t.neighbors=e}return this.#t.neighbors}get navigationFlags(){if(this.#t.navigationFlags==null){let e=[],t=this.#r.properties.flags;if(t!=null&&t.length>0)for(let[r,n]of Object.entries(this.#e.navigationFlags))t.length>n.index&&t[n.index]!=null&&Kc({flags:t},n)&&e.push(r);this.#t.navigationFlags=Object.freeze(e)}return this.#t.navigationFlags}get geoJSON(){return{...this.#r,properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}get navigationTarget(){return this}toJSON(){return{__type:o.__type,id:this.id,floor:this.floor.id,coordinate:this.coordinate.toJSON(),neighbors:this.neighbors.map(e=>e.id)}}destroy(){for(let e of Object.keys(this.#t))delete this.#t[e]}},xt=Wa;f();f();f();f();var za=class o extends Fe{static __type="hyperlink";__type=o.__type;#e={};#t;static is(e){return e.__type===o.__type}constructor(e){super(String(ee())),this.#t=e.mvfData}get url(){return this.#t.url}get name(){if("displayName"in this.#t)return this.#t.displayName;if("label"in this.#t)return this.#t.label}toJSON(){return{__type:o.__type,id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(this.#e))delete this.#e[e]}},ko=za;f();f();function Yr(o){return typeof o=="string"?o:o?.id??""}function ep(o){return Array.isArray(o)&&Number.isFinite(o[0])&&Number.isFinite(o[1])}var fg=/^https:\/\/cdn\.mappedin\.com\/category-symbols\/.+$/,hg=/^https:\/\/cdn-staging\.mappedin\.net\/category-symbols\/.+$/,gg=o=>fg.test(o)||hg.test(o),mg=/^https:\/\/cdn\.mappedin\.com\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,yg=/^https:\/\/cdn-staging\.mappedin\.com\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,bg=o=>gg(o)?!1:mg.test(o)||yg.test(o),sr=o=>{if(!bg(o))return null;let e="";o.startsWith("https://")?(e="https://",o=o.slice(8)):o.startsWith("http://")&&(e="http://",o=o.slice(7));let[t,r,n]=o.split("/"),i=n.split(".").pop()??"";return{origin:e+t,mapId:r,fileName:n,fileType:i}};function Xa(o){return o.reduce((e,t,r)=>r===0?e:e+qt(o[r-1].toGeoJSON().coordinates,t.toGeoJSON().coordinates),0)}function lo(o){return o!=null&&typeof o=="object"&&"__type"in o&&o.__type!==null&&typeof o.__type=="string"}function $a(o){return o!=null&&typeof o=="object"&&"name"in o&&o.name!=null&&typeof o.name=="string"&&o.name!==""}function tp(o){return lo(o)&&$a(o)}var Ya=class o extends Fe{static __type="image";__type=o.__type;#e={};#t;#o;static is(e){return e.__type===o.__type}constructor(e){super(String(ee())),this.#t=e.mvfData,this.#o=e.mapData}get url(){let e=this.#t.url;if(this.#o.tokenManager==null)return e;let t=sr(this.#t.url);if(t==null)return e;let r=t.mapId;try{if(this.#o.tokenManager.isEnterpriseMode())return e;let n=this.#o.tokenManager.getSasToken(r).token;if(n==null||n==="")throw new Error("SAS token empty!");return`${e}?${n}`}catch(n){return t.fileType!=="svg"&&C.error("Error getting SAS token for image",{error:n,url:e}),e}}get name(){return this.#t.altText}get altText(){return this.#t.altText}toJSON(){return{__type:o.__type,id:this.id,url:this.url,name:this.name}}destroy(){for(let e of globalThis.Object.keys(this.#e))delete this.#e[e]}},Kt=Ya;f();var Vt=class{id;constructor(e,t){this.id=e}#e=void 0;get geoJSONBoundingBox(){return this.#e?this.#e:"bbox"in this.geoJSON.geometry&&this.geoJSON.geometry.bbox?this.geoJSON.geometry.bbox:(this.#e=Jo(this.geoJSON),this.#e)}get geoJSON(){return{properties:null,type:"Feature",geometry:{type:"Polygon",coordinates:[[]]}}}};var ke=class extends Vt{#e;#t;#o={};constructor(e,t){super(t.properties.id,e),this.#e=e,this.#t=t}get externalId(){return this.#t.properties.externalId??""}get name(){let e=this.#t.properties.details?.name??"";return e===""&&(e=this.locationProfiles.find(t=>t.name&&t.name.length>0)?.name??""),e}get icon(){return this.locationProfiles.find(e=>e.icon!=null&&e.icon.url!=null&&e.icon.url.length>0)?.icon}get description(){let e=this.#t.properties.details?.description??"";return e===""&&(e=this.locationProfiles.find(t=>t.description&&t.description.length>0)?.description??""),e}get images(){if(this.#o.images!=null)return this.#o.images;let e=this.#t.properties.details?.images?.map(t=>new Kt({mvfData:t,mapData:this.#e}))??[];return(e==null||e.length===0)&&(e=this.locationProfiles.find(t=>t.images.length>0)?.images??[]),this.#o.images=e,e}get links(){if(this.#o.links!=null)return this.#o.links;let e=this.#t.properties.details?.links?.map(t=>new ko({mvfData:t}))??[];return(e==null||e.length===0)&&(e=this.locationProfiles.find(t=>t.links.length>0)?.links??[]),this.#o.links=e,e}get locationProfiles(){return this.#e.locationProfilesByAttachedFeatureId[this.id]??[]}_serializeDetailedMapData(){return{externalId:this.externalId,name:this.name,description:this.description,images:this.images,links:this.links,locationProfiles:this.locationProfiles}}};f();var mt=class o{#e;#t;#o;target;static __type="image-3d";__type=o.__type;static is(e){return e.__type===o.__type}constructor(e,t,r,n){this.#e=e,this.#t=t,this.target=r,this.#o=n}get id(){return this.#e}get url(){if(this.#o==null)return this.#t;let e=sr(this.#t);if(e==null)return this.#t;let t=e.mapId;try{if(this.#o.isEnterpriseMode())return this.#t;let r=this.#o.getSasToken(t).token;if(r==null||r==="")throw new Error("SAS token empty!");return`${this.#t}?${r}`}catch(r){return e.fileType!=="svg"&&C.error("Error getting SAS token for image",{error:r,url:this.#t}),this.#t}}};f();f();function Io(o){let e;if(H.is(o))e=o;else if(ct.is(o))e=o.coordinates[0];else if(co.is(o))if(o.spaces.length>0)e=o.spaces[0].center;else return;else if(ze.is(o))if(o.coordinates.length>0)e=o.coordinates[0];else return;else if("center"in o&&H.is(o.center))e=o.center;else if("coordinate"in o&&H.is(o.coordinate))e=o.coordinate;else return;return e}f();f();var Zr={debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building-outline","building-top","building","building-wall","building-buffer"]},imagePlacementOptions:{mode:"default"},flipImagesToFaceCamera:!0,multiFloorView:{enabled:!0,floorGap:"auto",footprintColor:"#ffffff"},disableUpdateStateValidation:!1},eo="ExteriorWalls",So="Walls",op=0,lr="InteriorDoors",cr="ExteriorDoors",pr="InteriorDoorsLayer",dr="ExteriorDoorsLayer",Ee="GeometryLayer",Jr="Focusable-",to="LabelsLayer",jt="MarkersLayer",qr="FootprintLayer",Lo="OcclusionLayer",Ro="AreasLayer",ur="ImagesLayer",No="FacadesLayer",oo="PathsLayer",Gt="ModelsLayer";var rp=["https://mappedin.auth0.com","https://mappedin-staging.auth0.com","https://staging.mappedin.com","https://mappedin-staging.auth0.com/userinfo","https://mappedin.com","https://mappedin.auth0.com/userinfo"],Tg={orange:"#F26336",teal:"#057685",lightTeal:"#5DC7D0"};var vg=new Set(["outdoorView","bearing","pitch","zoomLevel","screenOffsets","debug","initialFloor","shadingAndOutlines","wallTopColor","style","multiFloorView","occlusion","imagePlacementOptions","flipImagesToFaceCamera","injectStyles","useStandaloneCamera","preloadFloors"]),Ig=new Set(["style","enabled","layersHiddenByGeometry","lowDpi"]);function Za(o){o.outdoorView?.enabled&&!o.outdoorView?.token&&C.error("Enable outdoor view requires a token. Provide token in `options.outdoorView.token`")}function Ja(o,e){let t=o?.outdoorView?.token||e.outdoorViewToken,r={...Zr,...o,outdoorView:{enabled:o?.outdoorView?.enabled===void 0?!!t:o?.outdoorView?.enabled,layersHiddenByGeometry:Zr.outdoorView?.layersHiddenByGeometry,...o?.outdoorView},bearing:o?.bearing??e.naturalBearing??0,imagePlacementOptions:{...Zr.imagePlacementOptions,...o?.imagePlacementOptions},multiFloorView:{...Zr.multiFloorView,...o?.multiFloorView},disableUpdateStateValidation:o?.disableUpdateStateValidation??!1};return t&&r.outdoorView&&(r.outdoorView.token=t),r}function np(o){let e={remove_watermark:!1};if(o)try{let t=Jn(o);Object.assign(e,t.capabilities)}catch(t){C.error("Error decoding capabilities from token",t)}return e}function ip(o){let e=Object.fromEntries(Object.entries(o).filter(([t])=>vg.has(t)));return e.outdoorView&&(e.outdoorView=Object.fromEntries(Object.entries(e.outdoorView).filter(([t])=>Ig.has(t)))),e}var qa=class o extends ke{static __type="area";__type=o.__type;#e;#t;#o={};#r;static is(e){return e.__type===o.__type}constructor(e,t){super(e,t.mvfData),this.#e=e,this.#t=t.floorId,this.#r=t.mvfData}get center(){return this.#o.center==null&&(this.#o.center=Ze(this.#r,this.#t)),this.#o.center}get floor(){let e=this.#e.getById("floor",this.#t);if(e==null)throw new Error(`Floor ${this.#t} not found!`);return e}get images3D(){let e=this.#e.floorImagesByAnchorId.get(this.id)??[],t=this.#i();return t?[...e,t]:e}#i(){let e=this.#r.properties;if(e.image!=null)return this.#o.polygonImage==null&&(this.#o.polygonImage=new mt(`${this.id}-polygon-image-${ee()}`,e.image.path,this,this.#e.tokenManager)),this.#o.polygonImage}get geoJSON(){return{...this.#r,properties:null}}get focusTarget(){return this}get anchorTarget(){return this.center}get navigationTarget(){return this}toJSON(){return{__type:o.__type,id:this.id,name:this.name,floor:this.floor.id}}destroy(){}},Ct=qa;f();var Qa=class o extends ke{static __type="door";__type=o.__type;#e;#t;#o;#r;static is(e){return e.__type===o.__type}constructor(e,t){super(e,t.mvfData),this.#t={},this.#r=t.mvfData,this.#e=e,this.#o=t.floorId}get floor(){let e=this.#e.getById("floor",this.#o);if(e==null)throw new Error(`Floor ${this.#o} not found!`);return e}get center(){return this.#t.center==null&&(this.#t.center=Ze(this.#r,this.#o)),this.#t.center}get isExterior(){if(this.#r.properties.isExterior!==void 0)return this.#r.properties.isExterior;let e=this.#e.obstructionIdByEntranceId[this.id];return this.#e.getMVFFeatureById("obstruction",e)?.properties.footprintComponent??!1}get geoJSON(){return{...this.#r,properties:null}}get focusTarget(){return this.center}get anchorTarget(){return this.center}get navigationTarget(){return this}toJSON(){return{__type:o.__type,id:this.id,name:this.name,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of Object.keys(this.#t))delete this.#t[e]}},et=Qa;f();var Ka=class o extends ke{static __type="space";__type=o.__type;#e;#t;#o={};#r;static is(e){return e.__type===o.__type}constructor(e,t){super(e,t.mvfData),this.#e=e,this.#t=t.floorId,this.#r=t.mvfData}get type(){return Eg(this.#r.properties.kind)}get enterpriseLocations(){return this.#o.enterpriseLocations!=null?this.#o.enterpriseLocations:(this.#o.enterpriseLocations=ai(this.#e,this.id),this.#o.enterpriseLocations)}get locations(){return this.enterpriseLocations}get floor(){let e=this.#e.getById("floor",this.#t);if(e==null)throw new Error(`Floor ${this.#t} not found!`);return e}get doors(){if(this.#o.doors)return this.#o.doors;this.#o.doors=[];let e=this.#e.entranceNodeIdsBySpaceId?.[this.id]??[];for(let t of e){let r=this.#e.doorsByNodeId[t];r&&this.#o.doors.push(r)}return this.#o.doors}get images3D(){let e=this.#e.floorImagesByAnchorId.get(this.id)??[],t=this.#i();return t?[...e,t]:e}#i(){let e=this.#r.properties;if(e.image!=null)return this.#o.polygonImage==null&&(this.#o.polygonImage=new mt(`${this.id}-polygon-image-${ee()}`,e.image.path,this,this.#e.tokenManager)),this.#o.polygonImage}get center(){return this.#o.center==null&&(this.#o.center=Ze(this.#r,this.#t)),this.#o.center}get geoJSON(){return{...this.#r,properties:null}}get focusTarget(){return this.geoJSON.geometry.type==="Polygon"?this:this.center}get anchorTarget(){return this.center}get navigationTarget(){return this}toJSON(){return{__type:o.__type,id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of Object.keys(this.#o))delete this.#o[e]}},Sg=["room","hallway","exterior","void","gate","otb"];function Eg(o){if(o==null||o==="default")return"room";let e=o.toLowerCase();return Sg.includes(e)?e:"room"}var Ie=Ka;f();var es=class o extends Vt{static __type="floor";__type=o.__type;#e;#t={};#o;static is(e){return e.__type===o.__type}constructor(e,t){super(t.mvfData.properties.id,e),this.#e=e,this.#o=t.mvfData}#r(e){let t=this.#o.properties[e];return this.#e.getPropTranslation(this.__type,e,this.id,t)}get focusTarget(){return this}get name(){if(!("name"in this.#o.properties))return this.#o.properties.externalId??"";let e=this.#r("name");return typeof e=="string"?e:""}get shortName(){if(!("shortName"in this.#o.properties))return this.#o.properties.externalId??"";let e=this.#r("shortName");return typeof e=="string"?e:""}get subtitle(){let e=this.#r("subtitle");return typeof e=="string"?e:""}get externalId(){return this.#o.properties.externalId??""}get elevation(){return this.#o.properties.elevation}get maxHeight(){return this.#o.properties.maxHeight}get spaces(){if(this.#t.spaces==null){let e=this.#e.spaces.filter(t=>t.floor.id===this.id);this.#t.spaces=e}return this.#t.spaces}get spacesOpenToBelow(){if(this.#t.spacesOpenToBelow==null){let e=[];for(let t of this.spaces)(t.type==="void"||t.type==="otb")&&e.push(t);this.#t.spacesOpenToBelow=e}return this.#t.spacesOpenToBelow}get geoJSON(){return{type:"Feature",properties:null,geometry:this.#o.geometry??{type:"Polygon",coordinates:[]}}}get objects(){if(this.#t.objects==null){let e=this.#e.objects.filter(t=>t.floor.id===this.id);this.#t.objects=e}return this.#t.objects}get connections(){if(this.#t.connections==null){let e=this.#e.connections.filter(t=>t.floors.includes(this));this.#t.connections=e}return this.#t.connections}get doors(){if(this.#t.doors==null){let e=this.#e.doors.filter(t=>t.floor.id===this.id);this.#t.doors=e}return this.#t.doors}get annotations(){if(this.#t.annotations==null){let e=this.#e.annotations.filter(t=>t.floor.id===this.id);this.#t.annotations=e}return this.#t.annotations}get pois(){if(this.#t.pois==null){let e=this.#e.pointsOfInterest.filter(t=>t.floor.id===this.id);this.#t.pois=e}return this.#t.pois}get floorStack(){if(this.#t.floorStack==null){let e=this.#e.floorStacks.find(t=>t.floors.includes(this));this.#t.floorStack=e}return this.#t.floorStack}get center(){return this.#t.center==null&&(this.#t.center=Ze(this.#o,this.id)),this.#t.center}toJSON(){return{__type:o.__type,id:this.id,name:this.name,shortName:this.shortName,subtitle:this.subtitle,elevation:this.elevation,maxHeight:this.maxHeight,spaces:this.spaces.map(e=>e.id),objects:this.objects.map(e=>e.id),connections:this.connections.map(e=>e.id),doors:this.doors.map(e=>e.id),annotations:this.annotations.map(e=>e.id),pois:this.pois.map(e=>e.id)}}destroy(){for(let e of globalThis.Object.keys(this.#t))delete this.#t[e]}},pt=es;f();var ts=class o extends ke{static __type="connection";__type=o.__type;#e;#t;#o;static is(e){return e.__type===o.__type}constructor(e,t){super(e,{type:"Feature",geometry:{type:"Point",coordinates:[0,0]},properties:t.mvfData}),this.#t={},this.#e=e,this.#o=t.mvfData}get accessible(){return this.#o.accessible??!1}get type(){return this.#o.type??"unknown"}get extra(){return this.#o.extra}get coordinates(){if(this.#t.coordinates==null){this.#t.coordinates=[];for(let e of this.nodes)this.#t.coordinates.some(t=>t.isEqual(e.coordinate))||this.#t.coordinates.push(e.coordinate)}return this.#t.coordinates}get nodes(){return this.#o.nodes.map(e=>this.#e.getById("node",e)).filter(er)}get floors(){return this.coordinates.map(e=>e.floorId?this.#e.getById("floor",e.floorId):void 0).filter(er)}get focusTarget(){return this.coordinates}get navigationTarget(){return this.coordinates}toJSON(){return{__type:o.__type,id:this.id,name:this.name,type:this.type,externalId:this.externalId,coordinates:this.coordinates.map(e=>e.toJSON()),floors:this.floors.map(e=>e.id),extra:this.extra}}destroy(){for(let e of Object.keys(this.#t))delete this.#t[e]}},ze=ts;f();var os=class o extends ke{static __type="object";__type=o.__type;#e;#t;#o={};#r;static is(e){return e.__type===o.__type}constructor(e,t){super(e,t.mvfData),this.#e=e,this.#t=t.floorId,this.#r=t.mvfData}get type(){let e=this.#r.properties.kind;return e==null&&(e="object"),e==="Desks"&&(e="desk"),e.toLowerCase()}get enterpriseLocations(){return this.#o.enterpriseLocations!=null?this.#o.enterpriseLocations:(this.#o.enterpriseLocations=ai(this.#e,this.id),this.#o.enterpriseLocations)}get locations(){return this.enterpriseLocations}get floor(){let e=this.#e.getById("floor",this.#t);if(e==null)throw new Error(`Floor ${this.#t} not found!`);return e}get center(){return this.#o.center==null&&(this.#o.center=Ze(this.#r,this.#t)),this.#o.center}get images3D(){let e=this.#e.floorImagesByAnchorId.get(this.id)??[],t=this.#i();return t?[...e,t]:e}#i(){let e=this.#r.properties;if(e.image!=null)return this.#o.polygonImage==null&&(this.#o.polygonImage=new mt(`${this.id}-polygon-image-${ee()}`,e.image.path,this,this.#e.tokenManager)),this.#o.polygonImage}get geoJSON(){return{...this.#r,properties:null}}get anchorTarget(){return this.center}get focusTarget(){return this.geoJSON.geometry.type==="Polygon"?this:this.center}get navigationTarget(){return this}toJSON(){return{__type:o.__type,id:this.id,name:this.name,type:this.type,floor:this.floor.id,center:this.center.toJSON()}}destroy(){for(let e of globalThis.Object.keys(this.#o))this.#o[e]=null}},dt=os;f();var rs=class o extends ke{static __type="point-of-interest";__type=o.__type;#e;#t;#o={};#r;static is(e){return e.__type===o.__type}get navigationTarget(){return this.coordinate}constructor(e,t){super(e,t.mvfData),this.#e=e,this.#r=t.mvfData,this.#t=t.floorId}get floor(){let e=this.#e.getById("floor",this.#t);if(e==null)throw new Error(`Floor ${this.#t} not found!`);return e}get coordinate(){return this.#o.coordinate==null&&(this.#o.coordinate=Ze(this.#r,this.#t)),this.#o.coordinate}get geoJSON(){return{...this.#r,properties:null}}get images3D(){return this.#e.floorImagesByAnchorId.get(this.id)??[]}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}toJSON(){return{__type:o.__type,id:this.id,name:this.name,floor:this.floor.id,coordinate:this.coordinate.toJSON()}}destroy(){for(let e in this.#o)this.#o[e]=null}},yt=rs;f();var ns=class o extends ke{static __type="annotation";__type=o.__type;#e;#t;#o={};#r;#i;static is(e){return e.__type===o.__type}constructor(e,t){super(e,t.mvfData),this.#e=e,this.#t=t.floorId,this.#r=t.mvfData,this.#i=t.symbol??{url:"",name:""}}#n(){let[e,t]=this.#r.properties.symbolId.split("--");return{group:e,type:t}}get group(){return this.#n().group}get type(){return this.#n().type}get coordinate(){return this.#o.coordinate==null&&(this.#o.coordinate=Ze(this.#r,this.#t)),this.#o.coordinate}get floor(){let e=this.#e.getById("floor",this.#t);if(e==null)throw new Error(`Floor ${this.#t} not found!`);return e}get name(){return super.name||this.#i.name||""}get icon(){return this.#o.icon==null&&(this.#o.icon=super.icon||new Kt({mvfData:{url:this.#i.url,altText:this.#i.name},mapData:this.#e})),this.#o.icon}get geoJSON(){return{...this.#r,properties:null}}get focusTarget(){return this.coordinate}get anchorTarget(){return this.coordinate}get navigationTarget(){return this.coordinate}toJSON(){return{__type:o.__type,id:this.id,group:this.group,type:this.type,coordinate:this.coordinate.toJSON()}}destroy(){for(let e of Object.keys(this.#o))delete this.#o[e]}},Ut=ns;f();f();var ap=Xn(ss(),1);function Mg(o,e,t){t===void 0&&(t={});var r=Qo(o),n=Qo(e),i=ap.default.union(r.coordinates,n.coordinates);return i.length===0?null:i.length===1?Yn(i[0],t.properties):Zn(i,t.properties)}var si=Mg;var ls=class o extends Vt{static __type="floor-stack";__type=o.__type;#e;#t={};#o;#r;static is(e){return e.__type===o.__type}constructor(e,t){super(t.mvfData.id,e),this.#e=e,this.#o=t.mvfData,this.#r=t.facadeId}#i(e){return this.#e.getPropTranslation(this.__type,e,this.id,this.#o[e])}get type(){return this.#o.type}get name(){let e=this.#i("name");return typeof e=="string"?e:""}get shortName(){let e=this.#i("shortName");return typeof e=="string"?e:""}get externalId(){return this.#o.externalId??""}get floors(){if(this.#t.floors==null){let e=(this.#o.floors??this.#o.maps??[]).reduce((t,r)=>{let n=this.#e.floorsById[r];return n&&t.push(n),t},[]);e.length===0&&C.error(`Floor stack ${this.id} has no floors`),this.#t.floors=e.sort((t,r)=>t.elevation-r.elevation)}return this.#t.floors}get defaultFloor(){if(this.#t.defaultFloor!=null)return this.#t.defaultFloor;let e=this.#o.defaultFloor?this.#e.getById("floor",this.#o.defaultFloor):void 0;if(e)return this.#t.defaultFloor=e,this.#t.defaultFloor;let t=this.floors;if(t.length!==0)return this.#t.defaultFloor=t.reduce((r,n)=>Math.abs(n.elevation)<Math.abs(r.elevation)?n:r),this.#t.defaultFloor}get facade(){return this.#r?this.#e.facadesById[this.#r]:void 0}get focusTarget(){return this}get geoJSON(){if(this.#t.geoJSON!=null)return this.#t.geoJSON;let e=null;for(let t of this.floors){let r=t.geoJSON;e==null?e=r:e=si(e,r)}return this.#t.geoJSON=e??{type:"Feature",properties:null,geometry:{type:"Polygon",coordinates:[]}},this.#t.geoJSON}toJSON(){return{__type:o.__type,id:this.id,name:this.name,shortName:this.shortName,type:this.type,floors:this.floors.map(e=>e.id)}}destroy(){for(let e of globalThis.Object.keys(this.#t))delete this.#t[e]}},fr=ls;f();var cs=class o extends Vt{static __type="facade";__type=o.__type;static is(e){return e.__type===o.__type}#e;#t;#o;#r={};constructor(e,t){super(t.mvfData.id,e),this.#e=t.mvfData,this.#t=e,this.#o=t.floorStackId}get floorStack(){return this.#t.getById("floor-stack",this.#o)}get spaces(){if(!this.#r.spaces){this.#r.spaces=[];for(let e of this.#e.spaces){let t=this.#t.getById("space",e.spaceId);t&&this.#r.spaces.push(t)}}return this.#r.spaces}get center(){if(!this.#r.center){let e={type:"FeatureCollection",features:[]};for(let r of this.spaces){let n=this.#t.mvfSpacesById[r.id];n&&e.features.push(n)}if(e.features.length===0)throw new Oe("No geometry found for facade!");let t=ar(e);this.#r.center=new H({latitude:t.geometry.coordinates[1],longitude:t.geometry.coordinates[0],floorId:this.#e.spaces[0].floorId})}return this.#r.center}get focusTarget(){return this.spaces}get anchorTarget(){return this.center}get navigationTarget(){return this}toJSON(){return{id:this.id,__type:o.__type,floorStackId:this.#o,floorStack:this.floorStack,spaces:this.spaces}}},Ve=cs;f();var xg=new Set(["wall","area"]),Cg=new Set(["desk-entrance"]),_g=o=>{let e={};for(let t of o?.locations??[])e[t.id]=t;return{mvf3LocationsById:e}},Pg=(o,e,t)=>{let r={},n={},i={},a={},s={},l={};for(let c of e["location.json"]||[]){let p=new co(o,{mvf2Data:c,mvf3Data:t[c.id]});if(r[c.id]=p,c.externalId&&(a[c.externalId]==null&&(a[c.externalId]=[]),a[c.externalId].push(p)),c.categories)for(let g of c.categories)s[g]==null&&(s[g]=[]),s[g].push(p);let h=[...c.obstructions?.map(g=>g.id)??[],...c.spaces?.map(g=>g.id)??[],...c.annotations?.map(g=>g.id)??[],...c.connections??[],...c.entrances?.map(g=>g.id)??[],...c.areas?.map(g=>g.id)??[]];for(let g of h)g&&(l[g]==null&&(l[g]=[]),l[g].push(p))}for(let c of e["category.json"]||[]){let p=new ci(o,{mvfData:c});n[c.id]=p,c.parent&&(i[c.parent]==null&&(i[c.parent]=[]),i[c.parent].push(p))}return{locationCategoriesByParentId:i,locationProfilesById:r,locationCategoriesById:n,locationProfilesByExternalId:a,locationProfilesByCategoryId:s,locationProfilesByAttachedFeatureId:l}},Og=(o,e)=>{let t={},r={},n={},i={},a={},s={},l={},c={},p={},h=globalThis.Object.keys(o.space);for(let g of h){let T=o.space[g];if(T!=null){for(let I of T.features)if(p[I.properties.id]=g,s[I.properties.id]=I,I.properties.kind==="desk-entrance"&&(a[I.properties.externalId]==null&&(a[I.properties.externalId]=[]),a[I.properties.externalId].push(...I.properties.destinationNodes)),!Hg(I))if(I.properties.kind==="poi"||I.geometry.type==="Point"&&I.properties.kind==null){let E=new yt(e,{floorId:g,mvfData:I});n[I.properties.id]=E,c[g]||(c[g]=[]),c[g].push(I),I.properties.externalId&&(i[I.properties.externalId]==null&&(i[I.properties.externalId]=[]),i[I.properties.externalId].push(E))}else if(I.geometry.type==="Point")C.warn("Encountered a point space with an unknown kind!",I.properties.kind);else{let E=new Ie(e,{floorId:g,mvfData:I});t[I.properties.id]=E,I.properties.externalId&&(r[I.properties.externalId]==null&&(r[I.properties.externalId]=[]),r[I.properties.externalId].push(E)),l[g]||(l[g]=[]),l[g].push(I)}}}return{spacesById:t,spacesByExternalId:r,poisById:n,poisByExternalId:i,objectEntranceNodeIdsByObstructionId:a,mvfSpacesById:s,mvfSpacesByFloorId:l,mvfPoisByFloorId:c}},Dg=(o,e)=>{let t={},r={},n={},i={};for(let a of o["node.geojson"].features){n[a.properties.id]=a;let s=new xt(e,{mvfData:a,floorId:a.properties.floor??a.properties.map});t[a.properties.id]=s,a.properties.externalId&&(r[a.properties.externalId]==null&&(r[a.properties.externalId]=[]),r[a.properties.externalId].push(s));let l=a.properties.floor??a.properties.map;i[l]||(i[l]=[]),i[l].push(a)}return{nodesById:t,nodesByExternalId:r,mvfNodesById:n,mvfNodesByFloorId:i}},wg=(o,e)=>{let t={},r={},n={},i={},a=globalThis.Object.keys(o.obstruction);for(let s of a){let l=o.obstruction[s];if(l!=null)for(let c of l.features){n[c.properties.id]=c;for(let h of c.properties.entrances)i[h]=c.properties.id;if(xg.has(c.properties.kind?.toLowerCase()??""))continue;let p=new dt(e,{floorId:s,mvfData:c});t[c.properties.id]=p,c.properties.externalId&&(r[c.properties.externalId]==null&&(r[c.properties.externalId]=[]),r[c.properties.externalId].push(p))}}return{objectsById:t,objectsByExternalId:r,mvfObstructionById:n,obstructionIdByEntranceId:i}},Ag=(o,e)=>{let t={},r={},n={};if("floor.geojson"in o&&o["floor.geojson"]!=null)for(let i of o["floor.geojson"].features){n[i.properties.id]=i.properties;let a=new pt(e,{mvfData:i});t[i.properties.id]=a,i.properties.externalId&&(r[i.properties.externalId]==null&&(r[i.properties.externalId]=[]),r[i.properties.externalId].push(a))}else for(let i of o["map.geojson"]){n[i.id]=i;let a=new pt(e,{mvfData:{properties:i}});t[i.id]=a}return{floorsById:t,floorsByExternalId:r,mvfFloorsById:n}},Fg=(o,e)=>{let t={},r={},n={},i={},a={},s=o["floorstack.json"]||o["mapstack.json"]||o["mapstack.geojson"];if(s!=null)for(let l of s){let c=o.facade?.[l.id],p=new fr(e,{mvfData:l,facadeId:c?.id});if(t[l.id]=p,l.externalId&&(r[l.externalId]==null&&(r[l.externalId]=[]),r[l.externalId].push(p)),n[l.id]=l,c){let h=new Ve(e,{mvfData:c,floorStackId:l.id});i[c.id]=h;for(let g of c.spaces)a[g.spaceId]=h}}return{floorStacksById:t,floorStacksByExternalId:r,mvfFloorStacksById:n,facadesById:i,facadesBySpaceId:a}},kg=(o,e)=>{let t={},r={},n=o["connection.json"].reduce((i,a)=>{if(a.nodes.forEach(l=>i[l]=a),r[a.id]=a,a.type==="door")return i;let s=new ze(e,{mvfData:a});return t[a.id]=s,i},{});return{connectionsById:t,mvfConnectionsById:r,mvfConnectionsByNodeId:n}},Lg=(o,e)=>{let t={},r={},n={},i={},a={},s=globalThis.Object.keys(o.entrance);for(let l of s){let c=o.entrance[l];if(c!=null)for(let p of c.features){i[p.properties.id]=p;let h=new et(e,{floorId:l,mvfData:p});p.properties.node&&(n[p.properties.node]=h),t[p.properties.id]=h,p.properties.externalId&&(r[p.properties.externalId]==null&&(r[p.properties.externalId]=[]),r[p.properties.externalId].push(h)),a[l]||(a[l]=[]),a[l].push(p)}}return{doorsById:t,doorsByExternalId:r,doorsByNodeId:n,mvfEntrancesById:i,mvfEntrancesByFloorId:a}},Rg=(o,e,t)=>{if(o.textAreas!=null)for(let r in o.textAreas){let n=o.textAreas[r]?.features;if(n!=null){for(let i of n)if("anchorId"in i.properties){let a=i?.properties,s=e[a.anchorId]||t[a.anchorId];if(s!=null&&a!=null){let l=s.properties;l.textArea=a,l.textArea&&(l.textArea.position=i.geometry.coordinates)}}}}},Ng=(o,e,t,r)=>{if(o.floorImages!=null)for(let n in o.floorImages){let i=o.floorImages[n]?.features;if(i!=null){for(let a of i)if("anchorId"in a.properties){let s=a?.properties,l=e[s.anchorId]||t[s.anchorId]||r[s.anchorId];if(l!=null&&s!=null){let c=l.properties;c.image=s,c.image&&(c.image.position=a.geometry.coordinates)}}}}},Bg=(o,e)=>{if(o.enterprise?.enterpriseStyles==null)return;let t=o.enterprise?.enterpriseStyles;for(let r in t){let n=t[r];n.geometryAnchors.forEach(i=>{let a=e[i.geometryId];if(a!=null){let s=a.properties;s.style={styleId:r,edgeOffset:n.edgeOffset}}})}},Vg=(o,e,t)=>{if(!(o.enterprise==null||o.enterprise.textures==null))for(let r of o.enterprise.textures)for(let n of r.geometryAnchors){let i=e[n.geometryId]||t[n.geometryId];if(i!=null){let a=i.properties;a.textures==null&&(a.textures=[]),a.textures.push(r)}}},jg=(o,e)=>{let t={},r={},n={};if(o.annotation==null)return{annotationsById:t,mvfAnnotationsById:r,mvfAnnotationsByFloorId:n};let i=o["annotation-symbols.json"]||{},a=globalThis.Object.keys(o.annotation);for(let s of a){let l=o.annotation[s];if(l!=null)for(let c of l.features){r[c.properties.id]=c;let p=new Ut(e,{floorId:s,mvfData:c,symbol:i[c.properties.symbolId]});t[c.properties.id]=p,n[s]||(n[s]=[]),n[s].push(c)}}return{annotationsById:t,mvfAnnotationsById:r,mvfAnnotationsByFloorId:n}},Gg=(o,e)=>{let t={},r={},n={};if(o.area==null)return{areasById:t,areasByExternalId:r,mvfAreasById:n};let i=globalThis.Object.keys(o.area);for(let a of i){let s=o.area[a];if(s!=null)for(let l of s.features){n[l.properties.id]=l;let c=new Ct(e,{floorId:a,mvfData:l});t[l.properties.id]=c,l.properties.externalId&&(r[l.properties.externalId]==null&&(r[l.properties.externalId]=[]),r[l.properties.externalId].push(c))}}return{areasById:t,areasByExternalId:r,mvfAreasById:n}},Ug=(o,e)=>{let t={},r={},n={},i={};for(let a in o){let s=o[a];if(s==null)continue;let l=s.properties.destinationNodes??[];if(l.length<1)continue;let c=[];for(let p of l)e[p]!=null&&c.push(p),r[p]==null&&(r[p]=[]),r[p].push(s.properties.id),s.properties.kind==="desk-entrance"&&(n[p]==null&&(n[p]=[]),n[p].push(s.properties.externalId));c.length>0&&(t[a]=c),i[a]=l}return{entranceNodeIdsBySpaceId:t,spaceIdsByNodeId:r,objectIdsByNodeId:n,destinationNodesIdsBySpaceId:i}},sp=(o,e)=>{let t={},r={},n={},i={},a=(o.enterprise?.locations??[]).reduce((A,U)=>(A[U.id]=U,A),{}),s={},l={},c={},p={},h={},g={},T=o.enterprise?.venue||{},I={},E={},D={};for(let A of o.enterprise?.categories??[]){let U=new li(e,{mvfData:A});s[A.id]=U,A.externalId&&(l[A.externalId]==null&&(l[A.externalId]=[]),l[A.externalId].push(U)),c[A.id]=A,A.locations.forEach(R=>{h[R]==null&&(h[R]=[]),h[R].push(A.id)})}let x={};for(let A of o.enterprise?.locationInstances??[]){let U=a[A.parent],R=Object.keys(U),B={};for(let j of R)B[j]=void 0;let V={...B,polygons:[],nodes:[],...A};x[V.parent]==null&&(x[V.parent]=[]);let L=new ct(e,{mvfData:V,categoryIds:o.enterprise?.categoryPriorities?.[V.id]||h[V.id],parentId:A.parent});x[V.parent].push(L);for(let j of A.polygons??[])D[j.id]=L;I[V.id]=A,E[V.id]=L,A.externalId&&(i[A.externalId]==null&&(i[A.externalId]=[]),i[A.externalId].push(L))}for(let A of o.enterprise?.locations??[]){let U=new ct(e,{mvfData:A,categoryIds:o.enterprise?.categoryPriorities?.[A.id]||h[A.id],locationInstances:x[A.id]});n[A.id]=U,A.externalId&&(i[A.externalId]==null&&(i[A.externalId]=[]),i[A.externalId].push(U)),A.nodes.forEach(R=>{g[R.id]==null&&(g[R.id]=[]),g[R.id].push(A.id)});for(let R of A.polygons)p[R.id]==null&&(p[R.id]=[]),p[R.id].push(A)}if(e.enterpriseMode===!0){for(let A in e.mvfConnectionsById){let U={},R=e.mvfConnectionsById[A],B={id:A,externalId:R.externalId,kind:"enterprise."+R.type,destinationNodes:[],flags:R.flags,type:R.type,nodes:R.nodes,accessible:R.accessible,extra:R.extra,details:R.details};for(let V of e.mvfConnectionsById[A].nodes){let L=e.nodesById[V];L!=null&&(U[L.floor.id]={type:"Feature",geometry:{type:"Point",coordinates:[L.coordinate.longitude,L.coordinate.latitude]},properties:B})}Object.keys(U).length>0&&(t[A]=new ze(e,{mvfData:B}),R.externalId&&(r[R.externalId]==null&&(r[R.externalId]=[]),r[R.externalId].push(t[A])))}e.connectionsById=t}return{connectionsByExternalId:r,locationIdsByNodeId:g,mvfLocationsByGeometryId:p,mvfLocationsById:a,mvfCategoriesById:c,locationsById:n,locationInstancesById:E,instanceLocationsByPolygonId:D,locationsByExternalId:i,mvfLocationInstancesById:I,categoriesById:s,categoriesByExternalId:l,venue:T}},lp=(o,e,t)=>{let{nodesById:r,nodesByExternalId:n,mvfNodesById:i,mvfNodesByFloorId:a}=Dg(e,o),{connectionsById:s,mvfConnectionsById:l,mvfConnectionsByNodeId:c}=kg(e,o),{spacesById:p,spacesByExternalId:h,poisById:g,poisByExternalId:T,mvfSpacesById:I,objectEntranceNodeIdsByObstructionId:E,mvfSpacesByFloorId:D,mvfPoisByFloorId:x}=Og(e,o),{objectsById:A,objectsByExternalId:U,mvfObstructionById:R,obstructionIdByEntranceId:B}=wg(e,o),{floorsById:V,floorsByExternalId:L,mvfFloorsById:j}=Ag(e,o),{floorStacksById:te,floorStacksByExternalId:ie,mvfFloorStacksById:oe,facadesById:ce,facadesBySpaceId:Te}=Fg(e,o),{doorsById:xe,doorsByExternalId:Re,doorsByNodeId:re,mvfEntrancesById:Yt,mvfEntrancesByFloorId:it}=Lg(e,o),{annotationsById:Zt,mvfAnnotationsById:ue,mvfAnnotationsByFloorId:ge}=jg(e,o),{areasById:vt,areasByExternalId:pe,mvfAreasById:It}=Gg(e,o);Ng(e,I,R,It),Rg(e,I,R),Bg(e,I),Vg(e,I,R);let{mvf3LocationsById:le}=_g(t),{locationCategoriesByParentId:Je,locationProfilesById:Dt,locationCategoriesById:qe,locationProfilesByExternalId:Oo,locationProfilesByCategoryId:mo,locationProfilesByAttachedFeatureId:Xo}=Pg(o,e,le),{entranceNodeIdsBySpaceId:He,spaceIdsByNodeId:wt,objectIdsByNodeId:$e,destinationNodesIdsBySpaceId:St}=Ug(I,re);return{spacesById:p,spacesByExternalId:h,nodesById:r,nodesByExternalId:n,objectsById:A,objectsByExternalId:U,floorsById:V,floorsByExternalId:L,floorStacksById:te,floorStacksByExternalId:ie,facadesById:ce,facadesBySpaceId:Te,connectionsById:s,doorsById:xe,doorsByExternalId:Re,doorsByNodeId:re,poisById:g,poisByExternalId:T,annotationsById:Zt,areasById:vt,areasByExternalId:pe,objectEntranceNodeIdsByObstructionId:E,obstructionIdByEntranceId:B,locationProfilesById:Dt,locationCategoriesById:qe,locationProfilesByExternalId:Oo,locationProfilesByCategoryId:mo,locationCategoriesByParentId:Je,mvfSpacesById:I,mvfNodesById:i,mvfObstructionById:R,mvfFloorsById:j,mvfFloorStacksById:oe,mvfConnectionsById:l,mvfConnectionsByNodeId:c,mvfEntrancesById:Yt,mvfAnnotationsById:ue,mvfNodesByFloorId:a,mvfSpacesByFloorId:D,mvfPoisByFloorId:x,mvfAreasById:It,mvfEntrancesByFloorId:it,mvfAnnotationsByFloorId:ge,locationProfilesByAttachedFeatureId:Xo,entranceNodeIdsBySpaceId:He,spaceIdsByNodeId:wt,objectIdsByNodeId:$e,destinationNodesIdsBySpaceId:St,mvf3LocationsById:le}};function Hg(o){return!["Polygon","MultiPolygon"].includes(o.geometry.type)&&"kind"in o.properties&&o.properties.kind==null||o.properties.kind?.includes("connection")||Cg.has(o.properties.kind??"")}f();var Wg=new Set(["polygons"]),ps=class o extends Fe{static __type="enterprise-location";__type=o.__type;description;name="";amenity;externalId="";extra;gallery;instances;logo;operationHours;phone;picture;shortName;showFloatingLabelWhenImagePresent;showLogo;siblingGroups;social;sortOrder=-1;states;tags;type="";hidden=!1;primaryCategory;#e;#t={};#o;#r;static is(e){return e.__type===o.__type}constructor(e,t){super(t.mvfData.externalId),this.#e=e,this.#o=t.mvfData,this.#r=t.categoryIds||[],this.instances=t.locationInstances||[];for(let r in t.mvfData)!Wg.has(r)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),r)&&Object.defineProperty(this,r,{enumerable:!0,get(){if(t.parentId){let n=this.#e.locationsById[t.parentId];return this.#o[r]!=null?this.#e.getPropTranslation(this.__type,r,this.#o.id,this.#o[r]):this.#e.getPropTranslation(this.__type,r,this.#o.id,n[r])}return this.#e.getPropTranslation(this.__type,r,this.#o.id,this.#o[r])}})}get focusTarget(){return this.spaces.length>0?this.spaces:this.coordinates}get navigationTarget(){return this.spaces}get categories(){return this.#t.categories?this.#t.categories:(this.#t.categories=(this.#r.map(e=>this.#e.getById("enterprise-category",e))||[]).filter(Boolean),this.#t.categories)}get coordinates(){if(this.#t.coordinates)return this.#t.coordinates;this.#t.coordinates=[];for(let e=0;e<this.nodes.length;e++)this.#t.coordinates.push(this.nodes[e].coordinate);return this.#t.coordinates}get nodes(){if(this.#t.nodes)return this.#t.nodes;this.#t.nodes=[];for(let e=0;e<this.#o.nodes.length;e++){let t=this.#e.getById("node",this.#o.nodes[e].id);t&&this.#t.nodes.push(t)}return this.#t.nodes}get points(){if(this.#t.points)return this.#t.points;this.#t.points=[];for(let e=0;e<this.#o.spaces.length;e++){let t=this.#e.getById("point-of-interest",this.#o.spaces[e].id);t&&this.#t.points.push(t)}return this.#t.points}get spaces(){if(this.#t.spaces)return this.#t.spaces;this.#t.spaces=[];let e=Array.isArray(this.#o.spaces)?this.#o.spaces:this.#o.polygons;for(let t=0;t<e.length;t++){let r=this.#e.getById("space",e[t].id);r&&this.#t.spaces.push(r)}return this.#t.spaces}get objects(){if(this.#t.objects)return this.#t.objects;this.#t.objects=[];for(let e=0;e<this.#o.polygons.length;e++){let t=this.#e.getById("object",this.#o.polygons[e].id);t&&this.#t.objects.push(t)}return this.#t.objects}toJSON(){return{__type:o.__type,id:this.id,name:this.name}}destroy(){for(let e of Object.keys(this.#t))delete this.#t[e]}},ct=ps;f();var zg=new Set,ds=class o extends Fe{static __type="enterprise-category";__type=o.__type;name="";color;externalId="";extra;icon;iconFromDefaultList;sortOrder=-1;picture;#e;#t={};#o;static is(e){return e.__type===o.__type}constructor(e,t){super(t.mvfData.externalId),this.#e=e,this.#o=t.mvfData;for(let r in t.mvfData)!zg.has(r)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),r)&&Object.defineProperty(this,r,{get(){return this.#e.getPropTranslation(this.__type,r,this.#o.id,this.#o[r])}})}get children(){if(this.#t.children)return this.#t.children;this.#t.children=[];for(let e=0;e<this.#o.children.length;e++){let t=this.#e.getById("enterprise-category",this.#o.children[e]);t&&this.#t.children.push(t)}return this.#t.children}get locations(){if(this.#t.locations)return this.#t.locations;this.#t.locations=[];for(let e=0;e<this.#o.locations.length;e++){let t=this.#e.getById("enterprise-location",this.#o.locations[e]);t&&this.#t.locations.push(t)}return this.#t.locations}toJSON(){return{__type:o.__type,id:this.id,name:this.name}}destroy(){for(let e of Object.keys(this.#t))delete this.#t[e]}},li=ds;f();var Xg=new Set,us=class o extends Fe{static __type="enterprise-venue";__type=o.__type;countrycode;coverImage;externalId="";defaultLanguage={code:"en",name:"English"};defaultFloor;extra;icon;languages=[];links=[];logo;mappedinWebUrl;operationHours;slug="";topLocations;tzid;#e={};#t;static is(e){return e.__type===o.__type}constructor(e,t){super(t.mvfData.externalId),this.#t=t.mvfData;for(let r in t.mvfData)!Xg.has(r)&&!Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),r)&&(this[r]=t.mvfData[r])}get name(){return this.#t.name??""}get defaultMap(){return this.#t.defaultMap??this.defaultFloor??""}get enterpriseType(){return this.#t.type??void 0}toJSON(){return{__type:o.__type,id:this.id,name:this.name}}destroy(){for(let e of Object.keys(this.#e))delete this.#e[e]}},fs=us;f();f();f();f();f();var cp=(i=>(i.Departure="Departure",i.TakeConnection="TakeConnection",i.ExitConnection="ExitConnection",i.Turn="Turn",i.Arrival="Arrival",i))(cp||{}),hs=(a=>(a.Straight="Straight",a.Right="Right",a.SlightRight="SlightRight",a.Left="Left",a.SlightLeft="SlightLeft",a.Back="Back",a))(hs||{}),pp=(p=>(p.stairs="stairs",p.elevator="elevator",p.escalator="escalator",p.door="door",p.ramp="ramp",p.slide="slide",p.portal="portal",p.security="security",p.shuttle="shuttle",p.ladder="ladder",p))(pp||{}),pi=(t=>(t.Exterior="exterior-walls",t.Interior="interior-walls",t))(pi||{}),di=(t=>(t.Interior="interior-doors",t.Exterior="exterior-doors",t))(di||{});f();function dp(o){let{fromPosition:e,toPosition:t,junctionInset:r,fromAltitude:n,toAltitude:i}=o;if(r<=0)return null;let a=(e[1]+t[1])/2,{toCartesian:s,toGeographic:l}=Ul(a),c=s(e),p=s(t),h=p.x-c.x,g=p.y-c.y,T=i-n,I=Math.sqrt(h*h+g*g+T*T);if(I<=r*2)return null;let E=r/I,D={x:c.x+h*E,y:c.y+g*E},x=l(D.x,D.y),A=e[2]!==void 0?e[2]+T*E:void 0,U={x:p.x-h*E,y:p.y-g*E},R=l(U.x,U.y),B=t[2]!==void 0?t[2]-T*E:void 0;return{fromPosition:A!==void 0?[x.lon,x.lat,A]:[x.lon,x.lat],toPosition:B!==void 0?[R.lon,R.lat,B]:[R.lon,R.lat]}}function gs(o,e,t,r,n){let i=dp({fromPosition:o,toPosition:e,junctionInset:t,fromAltitude:r,toAltitude:n});return i?(o[0]=i.fromPosition[0],o[1]=i.fromPosition[1],o[2]!==void 0&&i.fromPosition[2]!==void 0&&(o[2]=i.fromPosition[2]),e[0]=i.toPosition[0],e[1]=i.toPosition[1],e[2]!==void 0&&i.toPosition[2]!==void 0&&(e[2]=i.toPosition[2]),!0):!1}function bt(o){return o.verticalOffset===0?[o.longitude,o.latitude]:[o.longitude,o.latitude,o.verticalOffset]}function Zg(o){return new Map(o.map(e=>{let{properties:t}=e,{id:r}=t;return[r,e]}))}var bs=(o,e)=>{let t=Zg(e),r={entrances:{type:"FeatureCollection",features:[]},walls:{type:"Feature",properties:{id:o[0].properties.id},geometry:{type:"MultiLineString",coordinates:[]}}};for(let n of o){let i=[n.geometry.coordinates],a=(n.properties.entrances||[]).reduce((s,l)=>(t.has(l)&&s.push(t.get(l)),s),[]);if(a.length){let{entrances:s,obstructions:l}=Ga(n,a);i=l.map(c=>c.geometry.coordinates),r.entrances.features.push(...s)}r.walls.geometry.coordinates.push(...i)}return r};function fp(o,e){return((e-o+Math.PI)%(Math.PI*2)+Math.PI*2)%(Math.PI*2)-Math.PI}function hp(o,e){let t="Left";return o<=-Math.PI/4?t="Right":o<=-e?t="SlightRight":o<=e?t="Straight":o<=Math.PI/4?t="SlightLeft":t="Left",t}function gp(o){let e={};for(let t in o){let r=o[t];if(r!=null){if(r.id=t,"polygons"in r)for(let n of r.polygons)e[n]=r;else if("lineStrings"in r)for(let n of r.lineStrings)e[n]=r;else if("points"in r)for(let n of r.points)e[n]=r}}return e}function mp(o,e){return o.reduce((t,r)=>{let n=e[r.properties.id];if(n==null)return t;if("textures"in r.properties&&Array.isArray(r.properties.textures)&&r.properties.textures.length>0){let i={...n,id:n.id+"-textures"};t.set(i,[r])}else t.has(n)||t.set(n,[]),t.get(n).push(r);return t},new Map)}function hr(o,e={}){let t={...o,flipImageToFaceCamera:e?.flipImagesToFaceCamera??!0},r=e?.style?.shading??e?.shadingAndOutlines;r===!0?t.shading={start:.1,end:.15,intensity:.4}:typeof r=="object"&&(t.shading={start:r.start,end:r.end,intensity:r.intensity});let n=e?.style?.outlines??e?.shadingAndOutlines;if(t.outline=typeof n=="object"?!0:n,"lineStrings"in o){let i=e?.style?.wallTopColor??e?.wallTopColor;i!=null&&(t.topColor=i)}return t}var Ts=(o,e)=>{let r=(e.currentMap?.currentFloor).layers.get(Ee);switch(o){case"interior-walls":return r?.layers.get(So);case"exterior-walls":return r?.layers.get(eo);case"interior-doors":return r?.layers.get(lr);case"exterior-doors":return r?.layers.get(cr);default:return typeof o=="string"?o:o?.id}};function vs(o){return new Promise(e=>{o.onComplete(e),o.onStop(e)})}function yp(o){return o.bbox?o.bbox:Jo(o)}function gr(o,e,t){return o.floorId&&e.has(o.floorId)?e.get(o.floorId):t}function mr(o){if(Ie.is(o)||dt.is(o))return o.id}function bp(o,e,t){let r=o.coordinates.length===2&&o.coordinates[0].floorId!==o.coordinates[1].floorId,n=!0;if(r&&o.coordinates[0].floorId!=null&&o.coordinates[1].floorId!=null){let i=e?.getById("floor",o.coordinates[0].floorId),a=e?.getById("floor",o.coordinates[1].floorId);if(i&&a){let s=t.getState(i),l=t.getState(a);s!=null&&l!=null&&(n=s.visible&&l.visible&&s.altitude!==l.altitude)}}else{let i=o.coordinates[0].floorId!=null?e?.getById("floor",o.coordinates[0].floorId):void 0;n=i?t.getState(i)?.visible??!0:!0}return n}function Tp(o,e){let t=o.properties.path.split("/"),r=t[t.length-1].split(".")[0],n=atob(r);return"img_"+$n(n).toString()+"-"+e}function ms(o="auto",e,t=1,r){return o!=="auto"?o*t:e!=null?e*t:r!=null?r*t:3*t}function up(o,e,t,r){if(o.maxHeight!=null&&o.maxHeight>0)return ms(e,o.maxHeight,t,r);let n=ms(e,void 0,t,r);if(e==="auto"&&"geometryMaxHeight"in o){let i=o.geometryMaxHeight;if(i!=null&&i>0){let a=Math.ceil(i*1.1);if(a>n)return a}}return n}function vp(o,e="auto",t=1,r,n){if(!o.length)return new Map;let i=o.sort((p,h)=>p.elevation-h.elevation),a=i.findIndex(p=>p.elevation>=0);a===-1&&(a=i.length);let s=0,l=new Map,c=-1;for(let p=a;p<i.length;p+=1){let h=i[p],g=up(h,e,t,r);if(!n){let T=h.elevation-c-1;T>0&&(s+=T*g)}l.set(h.elevation,{altitude:s,visualHeight:g}),s+=g,c=h.elevation}s=0;for(let p=a-1;p>=0;p-=1){let h=i[p],g=up(h,e,t,r),T=-(s+g);l.set(h.elevation,{altitude:T,visualHeight:g}),s+=g}return l}function Ip(o,e,t="auto",r=1,n){let i=[...o].sort((c,p)=>c.elevation-p.elevation),a=i.findIndex(c=>c.elevation>=0);if(a===-1)return[];let s=[],l=-1;for(let c=a;c<i.length;c+=1){let p=i[c],h=p.elevation-l-1;if(h>0){let g=e.get(p.elevation),T=g?.visualHeight??ms(t,void 0,r,n),I=h*T,E=g?.altitude??0;s.push({altitude:E-I,height:I,floorAboveElevation:p.elevation,missingCount:h})}l=p.elevation}return s}function ui(o,e){let t=e(o.center);return{center:new H({latitude:t[1],longitude:t[0]}),radius:o.radius}}function Sp(o){if(o.geometry.type==="Polygon")return{type:"Feature",geometry:{type:"Polygon",coordinates:[o.geometry.coordinates[0]]},properties:o.properties};let e=[];for(let t of o.geometry.coordinates)e.push([t[0]]);return{type:"Feature",geometry:{type:"MultiPolygon",coordinates:e},properties:o.properties}}var Ep=Math.PI*.1,Eo=class{id;#e={};#t;#o;constructor(e,t,r,n,i){this.id=i?.id??ee(),this.#t=t,this.#o=e.features,this.departure=r,this.destination=n}get path(){return this.#o.map(e=>this.#t.getById("node",e.properties.id)).filter(Boolean)}departure;destination;get coordinates(){return this.#e.coordinates?this.#e.coordinates:(this.#e.coordinates=this.#o.map(e=>new H(e.geometry.coordinates[1],e.geometry.coordinates[0],e.properties.groupBy)),this.#e.coordinates)}get distance(){return this.#e.distance?this.#e.distance:(this.#e.distance=this.#o.reduce((e,t)=>e+(t.properties.distance||0),0),this.#e.distance)}get instructions(){if(this.#o.length<2)return[];if(this.#e.instructions)return this.#e.instructions;let e=[],t=0;for(let r=0;r<this.#o.length;r++){let n=this.#o[r],i=this.#o[r-1],a=this.#o[r+1],s=new H(n.geometry.coordinates[1],n.geometry.coordinates[0],n.properties.groupBy),l=this.#s({prevDirection:i,direction:n,nextDirection:a});t+=i?.properties.distance||0;for(let c of l)c&&(e.push({action:c,distance:t,coordinate:s,node:this.#t.getById("node",n.properties.id)}),t=0)}return this.#e.instructions=e,this.#e.instructions}#r;#i;#n;#s(e){let{prevDirection:t,direction:r,nextDirection:n}=e,i=t&&this.#t.getById("floor",t.properties.groupBy),a=this.#t.getById("floor",r.properties.groupBy),s=n&&this.#t.getById("floor",n.properties.groupBy),l=[];t||l.push({type:"Departure"});let c=this.#t.getMVFFeatureByNodeId("connection",r.properties.id),p=c?this.#t.getById("connection",c.id):void 0,h=c&&c.nodes.length>1,g=this.#t.enterpriseMode&&(!r.properties.destination||!c?.nodes.includes(r.properties.destination)||!c?.nodes.includes(r.properties.id));if(c&&!(!h||g))if(!this.#r||this.#r==="exit")l.push(this.#c("TakeConnection",a,s,p,c)),this.#r="take",this.#i=p,this.#n=c;else{let I=this.#t.getMVFFeatureByNodeId("connection",t?.properties.id??""),E=this.#t.getById("connection",I?.id??"");l.push(this.#c("ExitConnection",a,i,E,I)),this.#r="exit",this.#i=p,this.#n=c}else this.#r==="take"?(l.push(this.#c("ExitConnection",a,i,this.#i,this.#n)),this.#r="exit",this.#i=p):s&&a?.id!==s.id?l.push(this.#c("TakeConnection",a,s,p)):i&&i.id!==a?.id?l.push(this.#c("ExitConnection",a,i,p)):l.push(this.#a(t,r));return n||l.push({type:"Arrival"}),l}#c(e,t,r,n,i){let a="none",s=t?t.elevation:0;if(s!=null&&r?.elevation!=null){let c=s-r.elevation;c>0?a="down":c<0&&(a="up")}let l=n?.type??i?.type??"stairs";return{type:e,fromFloor:t,toFloor:r,direction:a,connection:n,connectionType:l}}#a(e,t){let r=t.properties.edges;if(!r||r.filter(a=>a.destination.properties.id!==e?.properties.id&&a.destination.properties.id!==t.properties.destination).length===0)return null;let i=e?-fp(e.properties.angle,t.properties.angle):0;return Math.abs(i)>=Ep?{type:"Turn",bearing:hp(i,Ep),referencePosition:"At"}:null}toJSON(){return{id:this.id,directions:this.#o,__type:"directions",from:this.departure,to:this.destination,coordinates:this.coordinates,distance:this.distance,instructions:this.instructions}}};f();f();f();function Mp(o){return lo(o)?"navigationTarget"in o&&o.navigationTarget!=null:!1}var Jg={lineOfSight:!0,mode:"absolute-distance",maxResults:1};function xp(o){return{...Jg,lineOfSight:!o}}var he=new WeakMap;function fi(o,e,t){let r=xp(t),i=e.Query.__LEGACY_NEAREST_SYNC(o,e.getByType("node"),r)?.[0]?.feature.id;return i?[i]:[]}async function hi(o,e,t){let r=xp(t),i=(await e.Query.nearest(o,e.getByType("node"),r))?.[0]?.feature.id;return i?[i]:[]}function qg(o,e,t){let r=[];for(let n of o.navigationTarget){let i=yr(n,e,t);r.push(...i)}return r}async function Qg(o,e,t){let r=[];for(let n of o.navigationTarget){let i=await Mo(n,e,t);r.push(...i)}return r}function Cp(o,e){let r=e?.getMVFFeatureById("entrance",o.id)?.properties.node;return r?[r]:[]}function _p(o,e){return e?.getMVFFeatureById("area",o.id)?.properties.destinationNodes??[]}function Pp(o,e){let t=e?.getMVFFeatureById("space",o.id);if(t==null)return[];let r=e.entranceNodeIdsBySpaceId?.[o.id];return r&&r.length>0?r:t.properties.destinationNodes??[]}function Kg(o,e,t){let r=[];for(let n of o.coordinates){let i=fi(n,e,t);i.length>0&&r.push(i[0])}return r}async function em(o,e,t){let r=[];for(let n of o.coordinates){let i=await hi(n,e,t);i.length>0&&r.push(i[0])}return r}function Op(o,e){return e?.objectEntranceNodeIdsByObstructionId[o.id]??[]}function Dp(o,e){return o.spaces.flatMap(t=>e?.getMVFFeatureById("space",t.id)?.properties.destinationNodes??[]).filter(t=>typeof t=="string")}function wp(o){return o.nodes.map(e=>e.id)}function yr(o,e,t){if(he.has(o))return he.get(o);if(co.is(o)){let r=qg(o,e,t);return he.set(o,r),r}else if(Ut.is(o)){let r=fi(o,e,t);return he.set(o,r),r}else if(H.is(o)){let r=fi(o,e,t);return he.set(o,r),r}else{if(yt.is(o))return fi(o,e,t);if(et.is(o)){let r=Cp(o,e);return he.set(o,r),r}else if(Ct.is(o)){let r=_p(o,e);return he.set(o,r),r}else if(Ie.is(o)){let r=Pp(o,e);return he.set(o,r),r}else if(ze.is(o)){let r=Kg(o,e,t);return he.set(o,r),r}else if(dt.is(o)){let r=Op(o,e);return he.set(o,r),r}else if(Ve.is(o)){let r=Dp(o,e);return he.set(o,r),r}else if(ct.is(o)){let r=wp(o);return he.set(o,r),r}else if(xt.is(o)){let r=[o.id];return he.set(o,r),r}else return[]}}async function Mo(o,e,t){if(he.has(o))return he.get(o);if(co.is(o)){let r=await Qg(o,e,t);return he.set(o,r),r}else if(Ut.is(o)){let r=await hi(o,e,t);return he.set(o,r),r}else if(H.is(o)){let r=await hi(o,e,t);return he.set(o,r),r}else if(yt.is(o)){let r=await hi(o,e,t);return he.set(o,r),r}else if(et.is(o)){let r=Cp(o,e);return he.set(o,r),r}else if(Ct.is(o)){let r=_p(o,e);return he.set(o,r),r}else if(Ie.is(o)){let r=Pp(o,e);return he.set(o,r),r}else if(ze.is(o)){let r=await em(o,e,t);return he.set(o,r),r}else if(dt.is(o)){let r=Op(o,e);return he.set(o,r),r}else{if(Ve.is(o))return Dp(o,e);if(ct.is(o)){let r=wp(o);return he.set(o,r),r}else if(xt.is(o)){let r=[o.id];return he.set(o,r),r}else return[]}}function Ap(o,e){if(!o.instances||o.instances.length===0)return o;for(let t of o.instances)if(t.nodes.map(n=>n.id).includes(e))return t;return o}function Fp(o,e,t){let r=o.features[0]?.properties.id,n=e[0];if(e.length>1){for(let i of e)if((t.get(i)??[]).includes(r)){n=i;break}}return ct.is(n)&&(n=Ap(n,r)),n}function kp(o,e,t){let r=o.features[o.features.length-1]?.properties.id,n=e[0];if(e.length>1){for(let i of e)if((t.get(i)??[]).includes(r)){n=i;break}}return ct.is(n)&&(n=Ap(n,r)),n}function Is(o){if(H.is(o))return o;if(!(!Mp(o)||Array.isArray(o.navigationTarget)||!H.is(o.navigationTarget)))return o.navigationTarget}var br=class{navigator;connections;constructor({nodes:e,geojsonCollection:t,connections:r,groupBy:n,multiplicativeDistanceWeightScaling:i,flagDeclarations:a,getDoorByNodeId:s}){this.navigator=new Jl({nodes:e,geojsonCollection:this.createCollection(t),groupBy:n,multiplicativeDistanceWeightScaling:i,flagDeclarations:a,getDoorByNodeId:s}),this.connections=r}processTargets(e,t,r){let n=[],i=[],a=new Map,s=new Set,l=new Set;for(let[c,p]of e){let h=a.get(c);h||(h=[],a.set(c,h)),Ie.is(c)&&s.add(c.id);for(let g of p)h.push(g),n.push(g)}for(let[c,p]of t){let h=a.get(c);h||(h=[],a.set(c,h)),Ie.is(c)&&l.add(c.id);for(let g of p)h.push(g),i.push(g)}if(s.size===0&&l.size===0)return{originIds:n,destinationNodeIds:i,featureToNodeIdsMap:a};for(let c of n){let p=r.spaceIdsByNodeId[c]||[];for(let h of p)if(l.has(h)){i.push(c);break}}for(let c of i){let p=r.spaceIdsByNodeId[c]||[];for(let h of p)if(s.has(h)){n.push(c);break}}return{originIds:n,destinationNodeIds:i,featureToNodeIdsMap:a}}getDirections=async(e,t,r,n)=>{let i=new Map,a=new Map;for(let p of e)i.set(p,await Mo(p,n,n.enterpriseMode));for(let p of t)a.set(p,await Mo(p,n,n.enterpriseMode));let{originIds:s,destinationNodeIds:l,featureToNodeIdsMap:c}=this.processTargets(i,a,n);return this.#e(e,t,s,l,r,n,c)};getDirectionsSync=(e,t,r,n)=>{let i=new Map(e.map(p=>[p,yr(p,n,n.enterpriseMode)])),a=new Map(t.map(p=>[p,yr(p,n,n.enterpriseMode)])),{originIds:s,destinationNodeIds:l,featureToNodeIdsMap:c}=this.processTargets(i,a,n);return this.#e(e,t,s,l,r,n,c)};#e=(e,t,r,n,i,a,s)=>{let l=this.getDisabledConnectionNodeIds(i.accessible).filter(x=>!r.includes(x)&&!n.includes(x)),c=new Map,p={...i.connectionIdWeightMap};for(let x of i.excludedConnections)p[x.id]=1/0;for(let x in p){let A=a.getById("connection",x);A&&this.#t(A,p[x],c)}let g=(i.smoothing.__EXPERIMENTAL_METHOD??"greedy-los")!=="greedy-los",T=this.navigator.getDirections({zones:i.zones.map(x=>({geometry:x.geometry,cost:x.cost,map:x.floor?.id})),originIds:r,from:g?Lp(e):[],to:g?Lp(t):[],destinationNodeIds:n,disabledConnectionNodeIds:l,simplify:i.smoothing,overrideEdgeWeights:c,multiplicativeDistanceWeightScaling:!a.enterpriseMode,includeNonPublic:i.includeNonPublic});this.addCoordinateDirections(T,e,t);let I=Fp(T,e,s),E=kp(T,t,s),D=new Eo(T,a,I,E);if(!(D.distance===0&&new Set([...r,...n]).size===r.length+n.length))return D};getDisabledConnectionNodeIds=e=>e===!1?[]:this.connections.reduce((t,r)=>r.accessible?t:t.concat(r.nodes),[]);#t=(e,t,r)=>{if(e.nodes.length<2)return;let n=new Set(e.nodes.map(i=>i.id));for(let i of e.nodes){let a=this.navigator.graph.edges[i.id];if(a)for(let s of a)n.has(s.destination.properties.id)&&r.set(s,t)}};addCoordinateDirections=(e,[t],[r])=>{if(!e.features.length)return;let n=Is(t);if(n){let a=this.createDirectionFeature(n,this.navigator.getAngle([n.longitude,n.latitude],e.features[0].geometry.coordinates),this.navigator.getDistance([n.longitude,n.latitude],e.features[0].geometry.coordinates));e.features.splice(0,0,a)}let i=Is(r);if(i){let a=this.createDirectionFeature(i,0,0),s=e.features[e.features.length-1];s.properties.distance=this.navigator.getDistance(s.geometry.coordinates,[i.longitude,i.latitude]),s.properties.angle=this.navigator.getAngle(s.geometry.coordinates,[i.longitude,i.latitude]),e.features.push(a)}};createCollection(e){return{type:"FeatureCollection",features:Object.entries(e).reduce((t,[r,n])=>t.concat(n.features.map(i=>(i.properties.map=r,i))),[])}}createDirectionFeature=(e,t,r)=>({type:"Feature",geometry:{type:"Point",coordinates:[e.longitude,e.latitude]},properties:{groupBy:e.floorId,id:e.id,angle:t,distance:r,edges:[]}})};function tm(o){if(H.is(o))return o.floorId;if(Ie.is(o)||et.is(o)||yt.is(o)||Ut.is(o)||dt.is(o)||Ct.is(o)||xt.is(o))return o.floor.id;if((ze.is(o)||ct.is(o))&&o.coordinates.length>0)return o.coordinates[0].floorId;if(Ve.is(o)&&o.spaces.length>0)return o.spaces[0].floor.id}function Lp(o){return o.reduce((e,t)=>{let r=Io(t);if(!r)return e;let n=tm(t);return e.push({type:"Feature",geometry:{type:"Point",coordinates:[r.longitude,r.latitude]},properties:{id:t.id,neighbors:[],map:n}}),e},[])}f();f();f();import Bo from"zod";var Tr=50,Ss=1,Es=!1,Rp=Bo.object({limit:Bo.enum(["same-floor","same-elevation","all-floors"]).optional(),mode:Bo.enum(["travel-distance","absolute-distance"]).optional(),lineOfSight:Bo.boolean().optional().or(Bo.literal("auto")),maxDistance:Bo.number().optional(),maxResults:Bo.number().optional()}),Np={lineOfSight:Es,mode:"travel-distance",maxDistance:Tr,limit:"same-floor",maxResults:Ss},Qr=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}__LEGACY_NEAREST_SYNC=(e,t,r)=>{let n={...Np,...r};try{Rp.parse(n)}catch(p){C.error(p);return}let i=Io(e);if(!i)return;let a=this.#o(i,n),s=[],l={},c=[];for(let p of t){let h=yr(p,this.#e,this.#e.enterpriseMode);if(h)for(let g of h)l[g]||(l[g]=[]),l[g].push(p),c.push(g)}return r?.mode==="absolute-distance"?s=this.#r(i,a,t,n):s=this.#n(e,a,c,l,n),s.sort((p,h)=>p.distance-h.distance)};async nearest(e,t,r){let n={...Np,...r};try{Rp.parse(n)}catch(h){C.error(h);return}let i=Io(e);if(!i)return;let a=this.#o(i,n),s=[],l={},c=[],p=[];if(r?.mode==="absolute-distance")s=this.#r(i,a,t,n);else{for(let h of t)p.push(Mo(h,this.#e,this.#e.enterpriseMode).then(g=>{if(g)for(let T of g)l[T]||(l[T]=[]),l[T].push(h),c.push(T)}));await Promise.all(p),s=await this.#i(e,a,c,l,n)}return s.sort((h,g)=>h.distance-g.distance)}#o(e,t){let r=e.floorId?[e.floorId]:[];if(t?.limit==="all-floors")r=this.#e.getByType("floor").map(n=>n.id);else if(e.floorId==null)for(let n of this.#e.getByType("floor-stack")){let i=n.defaultFloor;i&&r.push(i.id)}else if(t?.limit==="same-elevation"){let n=this.#e.floorsById[e.floorId];if(n){let i=n?.elevation;i!=null&&(r=this.#e.getByType("floor-stack").map(a=>a.floors.find(s=>s.elevation===i)?.id).filter(Boolean))}}return r}#r=(e,t,r,n)=>{let i=[],a=new Set(r.map(s=>s.__type));for(let s of t)for(let l of a){let c=this.#t.searchWithIncludedIds([e.longitude,e.latitude],l,this.#e.mapName,s,r.filter(p=>p.__type===l).map(p=>p.id),n?.maxDistance??Tr,n?.lineOfSight==="auto"?Es:n?.lineOfSight,n?.maxResults??1);if(c)for(let p of c)i.push({distance:p.distance,feature:this.#e.getById(l,p.node.properties.parentId)||this.#e.getById(l,p.node.properties.id)})}return i};#i=async(e,t,r,n,i)=>{let a=[];for(let s of t){let l,c=0;if(!xt.is(e)){let p=this.#r(e.anchorTarget,[s],this.#e.getByType("node").filter(h=>h.floor.id===s),{limit:"same-floor",lineOfSight:i?.lineOfSight??!0,mode:"absolute-distance",maxDistance:i?.maxDistance??Tr,maxResults:1});p.length>0&&(l=p[0].feature,c=p[0].distance)}if(l){let p=new Set,h=this.#e.directions.navigator.findNearestNodesOnGraph(l.id,(i?.maxDistance??Tr)-c,s,r,!1,i?.maxResults??Ss);for(let g of h)for(let T of n[g.feature.properties.id])p.has(T.id)||(a.push({distance:g.distance+c,feature:T}),p.add(T.id))}}return a};#n=(e,t,r,n,i)=>{let a=[];for(let s of t){let l;if(xt.is(e)||(l=this.__LEGACY_NEAREST_SYNC(e,this.#e.getByType("node"),{lineOfSight:i?.lineOfSight??!0,mode:"absolute-distance",maxDistance:i?.maxDistance??Tr,maxResults:1})?.[0].feature),l){let c=this.#e.directions.navigator.findNearestNodesOnGraph(l.id,i?.maxDistance??Tr,s,r,i?.lineOfSight==="auto"?Es:i?.lineOfSight,i?.maxResults??Ss);for(let p of c)for(let h of n[p.feature.properties.id])a.push({distance:p.distance,feature:h})}}return a}};f();var gi=class{#e;constructor(e){this.#e=e}at(e){let t=[],r=[e.longitude,e.latitude],n=e.floorId?[e.floorId]:this.#e.getAllFloorIds();for(let i of n){let a=this.#e.searchAtCoordinate(e,i);for(let s of a)this.#t(r,s)&&t.push(s)}return t}#t(e,t){let r=t.geoJSON;if(!r||!r.geometry)return!1;let n=r.geometry.type;return n==="Point"?e[0]===r.geometry.coordinates[0]&&e[1]===r.geometry.coordinates[1]:n!=="Polygon"&&n!=="MultiPolygon"?!1:Zl(e,r)}};f();f();f();f();function Bp(o){let e=+this._x.call(null,o),t=+this._y.call(null,o);return Vp(this.cover(e,t),e,t,o)}function Vp(o,e,t,r){if(isNaN(e)||isNaN(t))return o;var n,i=o._root,a={data:r},s=o._x0,l=o._y0,c=o._x1,p=o._y1,h,g,T,I,E,D,x,A;if(!i)return o._root=a,o;for(;i.length;)if((E=e>=(h=(s+c)/2))?s=h:c=h,(D=t>=(g=(l+p)/2))?l=g:p=g,n=i,!(i=i[x=D<<1|E]))return n[x]=a,o;if(T=+o._x.call(null,i.data),I=+o._y.call(null,i.data),e===T&&t===I)return a.next=i,n?n[x]=a:o._root=a,o;do n=n?n[x]=new Array(4):o._root=new Array(4),(E=e>=(h=(s+c)/2))?s=h:c=h,(D=t>=(g=(l+p)/2))?l=g:p=g;while((x=D<<1|E)===(A=(I>=g)<<1|T>=h));return n[A]=i,n[x]=a,o}function jp(o){var e,t,r=o.length,n,i,a=new Array(r),s=new Array(r),l=1/0,c=1/0,p=-1/0,h=-1/0;for(t=0;t<r;++t)isNaN(n=+this._x.call(null,e=o[t]))||isNaN(i=+this._y.call(null,e))||(a[t]=n,s[t]=i,n<l&&(l=n),n>p&&(p=n),i<c&&(c=i),i>h&&(h=i));if(l>p||c>h)return this;for(this.cover(l,c).cover(p,h),t=0;t<r;++t)Vp(this,a[t],s[t],o[t]);return this}f();function Gp(o,e){if(isNaN(o=+o)||isNaN(e=+e))return this;var t=this._x0,r=this._y0,n=this._x1,i=this._y1;if(isNaN(t))n=(t=Math.floor(o))+1,i=(r=Math.floor(e))+1;else{for(var a=n-t||1,s=this._root,l,c;t>o||o>=n||r>e||e>=i;)switch(c=(e<r)<<1|o<t,l=new Array(4),l[c]=s,s=l,a*=2,c){case 0:n=t+a,i=r+a;break;case 1:t=n-a,i=r+a;break;case 2:n=t+a,r=i-a;break;case 3:t=n-a,r=i-a;break}this._root&&this._root.length&&(this._root=s)}return this._x0=t,this._y0=r,this._x1=n,this._y1=i,this}f();function Up(){var o=[];return this.visit(function(e){if(!e.length)do o.push(e.data);while(e=e.next)}),o}f();function Hp(o){return arguments.length?this.cover(+o[0][0],+o[0][1]).cover(+o[1][0],+o[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}f();f();function je(o,e,t,r,n){this.node=o,this.x0=e,this.y0=t,this.x1=r,this.y1=n}function Wp(o,e,t){var r,n=this._x0,i=this._y0,a,s,l,c,p=this._x1,h=this._y1,g=[],T=this._root,I,E;for(T&&g.push(new je(T,n,i,p,h)),t==null?t=1/0:(n=o-t,i=e-t,p=o+t,h=e+t,t*=t);I=g.pop();)if(!(!(T=I.node)||(a=I.x0)>p||(s=I.y0)>h||(l=I.x1)<n||(c=I.y1)<i))if(T.length){var D=(a+l)/2,x=(s+c)/2;g.push(new je(T[3],D,x,l,c),new je(T[2],a,x,D,c),new je(T[1],D,s,l,x),new je(T[0],a,s,D,x)),(E=(e>=x)<<1|o>=D)&&(I=g[g.length-1],g[g.length-1]=g[g.length-1-E],g[g.length-1-E]=I)}else{var A=o-+this._x.call(null,T.data),U=e-+this._y.call(null,T.data),R=A*A+U*U;if(R<t){var B=Math.sqrt(t=R);n=o-B,i=e-B,p=o+B,h=e+B,r=T.data}}return r}f();function zp(o){if(isNaN(p=+this._x.call(null,o))||isNaN(h=+this._y.call(null,o)))return this;var e,t=this._root,r,n,i,a=this._x0,s=this._y0,l=this._x1,c=this._y1,p,h,g,T,I,E,D,x;if(!t)return this;if(t.length)for(;;){if((I=p>=(g=(a+l)/2))?a=g:l=g,(E=h>=(T=(s+c)/2))?s=T:c=T,e=t,!(t=t[D=E<<1|I]))return this;if(!t.length)break;(e[D+1&3]||e[D+2&3]||e[D+3&3])&&(r=e,x=D)}for(;t.data!==o;)if(n=t,!(t=t.next))return this;return(i=t.next)&&delete t.next,n?(i?n.next=i:delete n.next,this):e?(i?e[D]=i:delete e[D],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(r?r[x]=t:this._root=t),this):(this._root=i,this)}function Xp(o){for(var e=0,t=o.length;e<t;++e)this.remove(o[e]);return this}f();function $p(){return this._root}f();function Yp(){var o=0;return this.visit(function(e){if(!e.length)do++o;while(e=e.next)}),o}f();function Zp(o){var e=[],t,r=this._root,n,i,a,s,l;for(r&&e.push(new je(r,this._x0,this._y0,this._x1,this._y1));t=e.pop();)if(!o(r=t.node,i=t.x0,a=t.y0,s=t.x1,l=t.y1)&&r.length){var c=(i+s)/2,p=(a+l)/2;(n=r[3])&&e.push(new je(n,c,p,s,l)),(n=r[2])&&e.push(new je(n,i,p,c,l)),(n=r[1])&&e.push(new je(n,c,a,s,p)),(n=r[0])&&e.push(new je(n,i,a,c,p))}return this}f();function Jp(o){var e=[],t=[],r;for(this._root&&e.push(new je(this._root,this._x0,this._y0,this._x1,this._y1));r=e.pop();){var n=r.node;if(n.length){var i,a=r.x0,s=r.y0,l=r.x1,c=r.y1,p=(a+l)/2,h=(s+c)/2;(i=n[0])&&e.push(new je(i,a,s,p,h)),(i=n[1])&&e.push(new je(i,p,s,l,h)),(i=n[2])&&e.push(new je(i,a,h,p,c)),(i=n[3])&&e.push(new je(i,p,h,l,c))}t.push(r)}for(;r=t.pop();)o(r.node,r.x0,r.y0,r.x1,r.y1);return this}f();function qp(o){return o[0]}function Qp(o){return arguments.length?(this._x=o,this):this._x}f();function Kp(o){return o[1]}function ed(o){return arguments.length?(this._y=o,this):this._y}function Kr(o,e,t){var r=new Ms(e??qp,t??Kp,NaN,NaN,NaN,NaN);return o==null?r:r.addAll(o)}function Ms(o,e,t,r,n,i){this._x=o,this._y=e,this._x0=t,this._y0=r,this._x1=n,this._y1=i,this._root=void 0}function td(o){for(var e={data:o.data},t=e;o=o.next;)t=t.next={data:o.data};return e}var tt=Kr.prototype=Ms.prototype;tt.copy=function(){var o=new Ms(this._x,this._y,this._x0,this._y0,this._x1,this._y1),e=this._root,t,r;if(!e)return o;if(!e.length)return o._root=td(e),o;for(t=[{source:e,target:o._root=new Array(4)}];e=t.pop();)for(var n=0;n<4;++n)(r=e.source[n])&&(r.length?t.push({source:r,target:e.target[n]=new Array(4)}):e.target[n]=td(r));return o};tt.add=Bp;tt.addAll=jp;tt.cover=Gp;tt.data=Up;tt.extent=Hp;tt.find=Wp;tt.remove=zp;tt.removeAll=Xp;tt.root=$p;tt.size=Yp;tt.visit=Zp;tt.visitAfter=Jp;tt.x=Qp;tt.y=ed;f();function xs(o,e,t,r=0,n=0,i=0,a=0){if(t===void 0){t=o.root();let l=o.extent();if(l&&([[r,n],[i,a]]=l,e(t,r,n,i,a)))return!0;if(!t)return!1}let s=[[r,n,(i+r)/2,(a+n)/2],[(i+r)/2,n,i,(a+n)/2],[r,(a+n)/2,(i+r)/2,a],[(i+r)/2,(a+n)/2,i,a]];for(let l=0;l<4;l++){let c=t[l];if(c){let[p,h,g,T]=s[l];e(c,p,h,g,T)||xs(o,e,c,p,h,g,T)}}return!1}var od=1e3,om=.1,rm=5,nm=1.5,mi=class{#e={};#t=new Map;getMaxSearchRadiusForFloorId=(e,t)=>{let r=this.#t.get(this.#r.mapName)?.get(t);if(r)return r;let n=this.getNodeTreeByTypeAndFloorId(e,this.#r.mapName,t);if(typeof n.extent=="function")if(n.extent()){let[[i,a],[s,l]]=n.extent(),c=s-i,p=l-a;r=Math.max(c,p)}else r=od;else r=od;return this.#t.set(this.#r.mapName,new Map([[t,r]])),r};searchWithIncludedIds(e,t,r,n,i,a,s=!1,l=1/0){let c=this.getNodeTreeByTypeAndFloorId(t,r,n),p=new Set,h=[],g=rm,T=Math.max(a,this.getMaxSearchRadiusForFloorId(t,n));for(;h.length<l&&g<=T;){let I=this.#o(e,c,i,g,a,p);I.sort((E,D)=>E.distance-D.distance);for(let E of I){if(h.length>=l)break;s?this.#r.directions.navigator.hasLineOfSight(e,E.node.geometry.coordinates,n,om)&&h.push(E):h.push(E)}g=g*nm}return h}#o(e,t,r,n,i,a){let{x:s,y:l}=this.#i(e[0],e[1]),c=s-n,p=s+n,h=l-n,g=l+n,T=[];return xs(t,(I,E,D,x,A)=>{let U=E>=p||D>=g||x<c||A<h;if("data"in I){let R=I.data,B=R.properties.parentId||R.properties.id;if(r.includes(B)&&!a.has(B)){a.add(B);let V=qt(e,R.geometry.coordinates);V<=i&&T.push({node:R,distance:V})}}return U}),T}#r;getNodeTreeByTypeAndFloorId(e,t,r){if(this.#e[e]||(this.#e[e]={}),this.#e[e][t]?.[r])return this.#e[e][t][r];this.#e[e][t]||(this.#e[e][t]={}),this.#e[e][t][r]=Kr();let n=this.#e[e][t][r];n.x(a=>{let s=a.geometry.coordinates;return this.#i(s[0],s[1]).x}),n.y(a=>{let s=a.geometry.coordinates;return this.#i(s[0],s[1]).y});let i=[];switch(e){case"space":i=this.#r.mvfSpacesByFloorId[r].flatMap(c=>c.properties.destinationNodes).map(c=>{let p=this.#r.mvfNodesById[c];return p?{...p,properties:{id:p.properties.id,parentId:p.properties.space[0]}}:null});break;case"node":i=this.#r.mvfNodesByFloorId[r]?.filter(c=>c.properties.neighbors.length>0)||[];break;case"point-of-interest":i=this.#r.mvfPoisByFloorId[r]||[];break;case"door":i=this.#r.mvfEntrancesByFloorId[r]||[];break;case"annotation":i=this.#r.mvfAnnotationsByFloorId[r]||[];break;case"enterprise-location":let s=this.#r.mvfNodesByFloorId[r]||[],l=this.#r.locationIdsByNodeId;i=[];for(let c=0;c<s.length;c++){let p=s[c],h=l[p.properties.id];h?.length>0&&i.push({...p,properties:{id:p.properties.id,parentId:h[0]}})}break}return i?.length>0&&n.addAll(i),n}#i;constructor(e,t){this.#r=e,this.#i=t}};f();f();f();f();function yi(o,e,t=0,r=o.length-1,n=im){for(;r>t;){if(r-t>600){let l=r-t+1,c=e-t+1,p=Math.log(l),h=.5*Math.exp(2*p/3),g=.5*Math.sqrt(p*h*(l-h)/l)*(c-l/2<0?-1:1),T=Math.max(t,Math.floor(e-c*h/l+g)),I=Math.min(r,Math.floor(e+(l-c)*h/l+g));yi(o,e,T,I,n)}let i=o[e],a=t,s=r;for(en(o,t,e),n(o[r],i)>0&&en(o,t,r);a<s;){for(en(o,a,s),a++,s--;n(o[a],i)<0;)a++;for(;n(o[s],i)>0;)s--}n(o[t],i)===0?en(o,t,s):(s++,en(o,s,r)),s<=e&&(t=s+1),e<=s&&(r=s-1)}}function en(o,e,t){let r=o[e];o[e]=o[t],o[t]=r}function im(o,e){return o<e?-1:o>e?1:0}var rn=class{constructor(e=9){this._maxEntries=Math.max(4,e),this._minEntries=Math.max(2,Math.ceil(this._maxEntries*.4)),this.clear()}all(){return this._all(this.data,[])}search(e){let t=this.data,r=[];if(!Ti(e,t))return r;let n=this.toBBox,i=[];for(;t;){for(let a=0;a<t.children.length;a++){let s=t.children[a],l=t.leaf?n(s):s;Ti(e,l)&&(t.leaf?r.push(s):_s(e,l)?this._all(s,r):i.push(s))}t=i.pop()}return r}collides(e){let t=this.data;if(!Ti(e,t))return!1;let r=[];for(;t;){for(let n=0;n<t.children.length;n++){let i=t.children[n],a=t.leaf?this.toBBox(i):i;if(Ti(e,a)){if(t.leaf||_s(e,a))return!0;r.push(i)}}t=r.pop()}return!1}load(e){if(!(e&&e.length))return this;if(e.length<this._minEntries){for(let r=0;r<e.length;r++)this.insert(e[r]);return this}let t=this._build(e.slice(),0,e.length-1,0);if(!this.data.children.length)this.data=t;else if(this.data.height===t.height)this._splitRoot(this.data,t);else{if(this.data.height<t.height){let r=this.data;this.data=t,t=r}this._insert(t,this.data.height-t.height-1,!0)}return this}insert(e){return e&&this._insert(e,this.data.height-1),this}clear(){return this.data=Ir([]),this}remove(e,t){if(!e)return this;let r=this.data,n=this.toBBox(e),i=[],a=[],s,l,c;for(;r||i.length;){if(r||(r=i.pop(),l=i[i.length-1],s=a.pop(),c=!0),r.leaf){let p=am(e,r.children,t);if(p!==-1)return r.children.splice(p,1),i.push(r),this._condense(i),this}!c&&!r.leaf&&_s(r,n)?(i.push(r),a.push(s),s=0,l=r,r=r.children[0]):l?(s++,r=l.children[s],c=!1):r=null}return this}toBBox(e){return e}compareMinX(e,t){return e.minX-t.minX}compareMinY(e,t){return e.minY-t.minY}toJSON(){return this.data}fromJSON(e){return this.data=e,this}_all(e,t){let r=[];for(;e;)e.leaf?t.push(...e.children):r.push(...e.children),e=r.pop();return t}_build(e,t,r,n){let i=r-t+1,a=this._maxEntries,s;if(i<=a)return s=Ir(e.slice(t,r+1)),vr(s,this.toBBox),s;n||(n=Math.ceil(Math.log(i)/Math.log(a)),a=Math.ceil(i/Math.pow(a,n-1))),s=Ir([]),s.leaf=!1,s.height=n;let l=Math.ceil(i/a),c=l*Math.ceil(Math.sqrt(a));rd(e,t,r,c,this.compareMinX);for(let p=t;p<=r;p+=c){let h=Math.min(p+c-1,r);rd(e,p,h,l,this.compareMinY);for(let g=p;g<=h;g+=l){let T=Math.min(g+l-1,h);s.children.push(this._build(e,g,T,n-1))}}return vr(s,this.toBBox),s}_chooseSubtree(e,t,r,n){for(;n.push(t),!(t.leaf||n.length-1===r);){let i=1/0,a=1/0,s;for(let l=0;l<t.children.length;l++){let c=t.children[l],p=Cs(c),h=cm(e,c)-p;h<a?(a=h,i=p<i?p:i,s=c):h===a&&p<i&&(i=p,s=c)}t=s||t.children[0]}return t}_insert(e,t,r){let n=r?e:this.toBBox(e),i=[],a=this._chooseSubtree(n,this.data,t,i);for(a.children.push(e),on(a,n);t>=0&&i[t].children.length>this._maxEntries;)this._split(i,t),t--;this._adjustParentBBoxes(n,i,t)}_split(e,t){let r=e[t],n=r.children.length,i=this._minEntries;this._chooseSplitAxis(r,i,n);let a=this._chooseSplitIndex(r,i,n),s=Ir(r.children.splice(a,r.children.length-a));s.height=r.height,s.leaf=r.leaf,vr(r,this.toBBox),vr(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(r,s)}_splitRoot(e,t){this.data=Ir([e,t]),this.data.height=e.height+1,this.data.leaf=!1,vr(this.data,this.toBBox)}_chooseSplitIndex(e,t,r){let n,i=1/0,a=1/0;for(let s=t;s<=r-t;s++){let l=tn(e,0,s,this.toBBox),c=tn(e,s,r,this.toBBox),p=pm(l,c),h=Cs(l)+Cs(c);p<i?(i=p,n=s,a=h<a?h:a):p===i&&h<a&&(a=h,n=s)}return n||r-t}_chooseSplitAxis(e,t,r){let n=e.leaf?this.compareMinX:sm,i=e.leaf?this.compareMinY:lm,a=this._allDistMargin(e,t,r,n),s=this._allDistMargin(e,t,r,i);a<s&&e.children.sort(n)}_allDistMargin(e,t,r,n){e.children.sort(n);let i=this.toBBox,a=tn(e,0,t,i),s=tn(e,r-t,r,i),l=bi(a)+bi(s);for(let c=t;c<r-t;c++){let p=e.children[c];on(a,e.leaf?i(p):p),l+=bi(a)}for(let c=r-t-1;c>=t;c--){let p=e.children[c];on(s,e.leaf?i(p):p),l+=bi(s)}return l}_adjustParentBBoxes(e,t,r){for(let n=r;n>=0;n--)on(t[n],e)}_condense(e){for(let t=e.length-1,r;t>=0;t--)e[t].children.length===0?t>0?(r=e[t-1].children,r.splice(r.indexOf(e[t]),1)):this.clear():vr(e[t],this.toBBox)}};function am(o,e,t){if(!t)return e.indexOf(o);for(let r=0;r<e.length;r++)if(t(o,e[r]))return r;return-1}function vr(o,e){tn(o,0,o.children.length,e,o)}function tn(o,e,t,r,n){n||(n=Ir(null)),n.minX=1/0,n.minY=1/0,n.maxX=-1/0,n.maxY=-1/0;for(let i=e;i<t;i++){let a=o.children[i];on(n,o.leaf?r(a):a)}return n}function on(o,e){return o.minX=Math.min(o.minX,e.minX),o.minY=Math.min(o.minY,e.minY),o.maxX=Math.max(o.maxX,e.maxX),o.maxY=Math.max(o.maxY,e.maxY),o}function sm(o,e){return o.minX-e.minX}function lm(o,e){return o.minY-e.minY}function Cs(o){return(o.maxX-o.minX)*(o.maxY-o.minY)}function bi(o){return o.maxX-o.minX+(o.maxY-o.minY)}function cm(o,e){return(Math.max(e.maxX,o.maxX)-Math.min(e.minX,o.minX))*(Math.max(e.maxY,o.maxY)-Math.min(e.minY,o.minY))}function pm(o,e){let t=Math.max(o.minX,e.minX),r=Math.max(o.minY,e.minY),n=Math.min(o.maxX,e.maxX),i=Math.min(o.maxY,e.maxY);return Math.max(0,n-t)*Math.max(0,i-r)}function _s(o,e){return o.minX<=e.minX&&o.minY<=e.minY&&e.maxX<=o.maxX&&e.maxY<=o.maxY}function Ti(o,e){return e.minX<=o.maxX&&e.minY<=o.maxY&&e.maxX>=o.minX&&e.maxY>=o.minY}function Ir(o){return{children:o,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function rd(o,e,t,r,n){let i=[e,t];for(;i.length;){if(t=i.pop(),e=i.pop(),t-e<=r)continue;let a=e+Math.ceil((t-e)/r/2)*r;yi(o,a,e,t,n),i.push(e,a,a,t)}}var vi=class extends rn{#e;constructor(e){super(),this.#e=e}toBBox=e=>{let t=e.geoJSONBoundingBox;t==null&&C.warn(`Item "${e.id}" has no geoJSONBoundingBox; falling back to zero-size bbox at origin.`);let r=t!=null&&t.length===6,n=t?.[0]??0,i=t?.[1]??0,a=(r?t?.[3]:t?.[2])??0,s=(r?t?.[4]:t?.[3])??0,l=this.#e(n,i),c=this.#e(a,s);return{minX:l.x,minY:l.y,maxX:c.x,maxY:c.y}};compareMinX=(e,t)=>{let r=this.toBBox(e),n=this.toBBox(t);return r.minX-n.minX};compareMinY=(e,t)=>{let r=this.toBBox(e),n=this.toBBox(t);return r.minY-n.minY};search(e,t,r,n){if(typeof e=="object")return super.search(e);let i=this.#e(e,t),a=this.#e(r,n);return super.search({minX:i.x,minY:i.y,maxX:a.x,maxY:a.y})}searchCoordinate(e){return this.search(e.longitude,e.latitude,e.longitude,e.latitude)}};var Ii=class{#e;#t;#o=new Map;constructor(e,t){this.#e=e,this.#t=t}getTreeByFloorId(e){let t=this.#o.get(e);if(t)return t;let r=new vi(this.#t),n=this.#e.floorsById[e];if(n){let i=[n,...n.spaces,...n.objects];for(let a of this.#e.areas)a.floor.id===e&&i.push(a);r.load(i)}return this.#o.set(e,r),r}searchAtCoordinate(e,t){return this.getTreeByFloorId(t).searchCoordinate(e)}getAllFloorIds(){return this.#e.floors.map(e=>e.id)}};f();function nd(o,e){let t=111319.9*Math.cos(e*Math.PI/180);return(r,n)=>({x:(r-o)*t,y:(n-e)*111319.9})}var nn=class{#e;#t;#o;#r;constructor(e){let t=nd(e.mapCenter.longitude,e.mapCenter.latitude);this.#o=new mi(e,t),this.#r=new Ii(e,t),this.#e=new Qr(e,this.#o),this.#t=new gi(this.#r)}__LEGACY_NEAREST_SYNC=(e,t,r)=>this.#e.__LEGACY_NEAREST_SYNC(e,t,r);async nearest(e,t,r){return this.#e.nearest(e,t,r)}async at(e){return this.#t.at(e)}};f();f();var Si=class{#e;constructor(e){this.#e=e||[]}get raw(){return this.#e}};var Ps=class o extends Fe{static is(e){return e.__type===o.__type}static __type="location-profile";__type=o.__type;id="loc_";name="";externalId;description;logo;logoImage;phone;social=[];images=[];links=[];website;icon;extra;searchTags;#e;#t={};#o;#r;constructor(e,t){super(t.mvf2Data.id),this.#e=e,this.#o=t.mvf2Data,this.#r=t.mvf3Data;for(let r in t.mvf2Data)r==="links"?this.links=t.mvf2Data.links.map(n=>new ko({mvfData:n})):r==="pictures"?this.images=t.mvf2Data.pictures.map(n=>n.url?new Kt({mvfData:{...n,url:n.url??""},mapData:this.#e}):void 0).filter(n=>n!=null):r==="website"?t.mvf2Data.website&&(this.website=new ko({mvfData:t.mvf2Data.website})):r==="icon"?t.mvf2Data.icon&&(this.icon=new Kt({mvfData:{url:t.mvf2Data.icon},mapData:this.#e})):r==="logo"?t.mvf2Data.logo&&(this.logoImage=new Kt({mvfData:{url:t.mvf2Data.logo},mapData:this.#e}),Object.defineProperty(this,"logo",{get(){return this.logoImage?.url}})):Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),r)||Object.defineProperty(this,r,{enumerable:!0,get(){return this.#o[r]}});this.#r&&(this.extra=this.#r.extra)}get spaces(){if(this.#t.spaces)return this.#t.spaces;if(this.#o.spaces==null)return this.#t.spaces=[],this.#t.spaces;this.#t.spaces=[];for(let e=0;e<this.#o.spaces.length;e++){let t=this.#e.getById("space",this.#o.spaces[e].id);t&&this.#t.spaces.push(t)}return this.#t.spaces}get points(){if(this.#t.points)return this.#t.points;if(this.#o.spaces==null)return this.#t.points=[],this.#t.points;this.#t.points=[];for(let e=0;e<this.#o.spaces.length;e++){let t=this.#e.getById("point-of-interest",this.#o.spaces[e].id);t&&this.#t.points.push(t)}return this.#t.points}get doors(){if(this.#t.doors)return this.#t.doors;if(this.#o.entrances==null)return this.#t.doors=[],this.#t.doors;this.#t.doors=[];for(let e=0;e<this.#o.entrances.length;e++){let t=this.#e.getById("door",this.#o.entrances[e].id);t&&this.#t.doors.push(t)}return this.#t.doors}get connections(){if(this.#t.connections)return this.#t.connections;if(this.#o.connections==null)return this.#t.connections=[],this.#t.connections;this.#t.connections=[];for(let e of this.#o.connections){let t=this.#e.getById("connection",e);t&&this.#t.connections.push(t)}return this.#t.connections}get annotations(){if(this.#t.annotations)return this.#t.annotations;if(this.#o.annotations==null)return this.#t.annotations=[],this.#t.annotations;this.#t.annotations=[];for(let e=0;e<this.#o.annotations.length;e++){let t=this.#e.getById("annotation",this.#o.annotations[e].id);t&&this.#t.annotations.push(t)}return this.#t.annotations}get categories(){return this.#t.categories?this.#t.categories:this.#o.categories==null?(this.#t.categories=[],this.#t.categories):(this.#t.categories=this.#o.categories.map(e=>this.#e.getById("location-category",e)).filter(e=>e!=null),this.#t.categories)}get mapObjects(){return this.#t.mapObjects?this.#t.mapObjects:this.#o.obstructions==null?(this.#t.mapObjects=[],this.#t.mapObjects):(this.#t.mapObjects=this.#o.obstructions.map(e=>this.#e.getById("object",e.id)).filter(e=>e!=null),this.#t.mapObjects)}get areas(){return this.#t.areas?this.#t.areas:this.#o.areas==null?(this.#t.areas=[],this.#t.areas):(this.#t.areas=this.#o.areas.map(e=>this.#e.getById("area",e.id)).filter(e=>e!=null),this.#t.areas)}get focusTarget(){if(this.#t.focusTarget)return this.#t.focusTarget;let e=[];for(let t of this.spaces)e.push(t);for(let t of this.connections)e.push(...t.coordinates);for(let t of this.doors)e.push(t.focusTarget);for(let t of this.mapObjects)e.push(t.focusTarget);for(let t of this.annotations)e.push(t.focusTarget);for(let t of this.points)e.push(t.focusTarget);for(let t of this.areas)e.push(t.focusTarget);return this.#t.focusTarget=e,e}get openingHours(){return this.#t.openingHours?this.#t.openingHours:(this.#t.openingHours=new Si(this.#o.openingHoursSpecification??[]),this.#t.openingHours)}get navigationTarget(){if(this.#t.navigationTarget)return this.#t.navigationTarget;let e=[];for(let t of this.spaces)e.push(t);for(let t of this.connections)e.push(...t.coordinates);for(let t of this.doors)e.push(t.focusTarget);for(let t of this.mapObjects)e.push(t.focusTarget);for(let t of this.annotations)e.push(t.focusTarget);for(let t of this.points)e.push(t.focusTarget);return this.#t.navigationTarget=e,e}toJSON(){return{__type:o.__type,id:this.id,name:this.name}}},co=Ps;f();var Os=class o extends Fe{static is(e){return e.__type===o.__type}static __type="location-category";__type=o.__type;id="cat_";name="";icon="";#e;#t={};#o;constructor(e,t){super(t.mvfData.id),this.#e=e,this.#o=t.mvfData;for(let r in t.mvfData)Object.getOwnPropertyDescriptor(Object.getPrototypeOf(this),r)||Object.defineProperty(this,r,{enumerable:!0,get(){return this.#o[r]}})}get parent(){return this.#t.parent?this.#t.parent:(this.#t.parent=this.#o.parent?this.#e.getById("location-category",this.#o.parent):void 0,this.#t.parent)}get children(){return this.#t.children?this.#t.children:(this.#t.children=this.#e.locationCategoriesByParentId[this.id]||[],this.#t.children)}get locationProfiles(){if(this.#t.locationProfiles)return this.#t.locationProfiles;let e=[];for(let t of this.#e.locationProfilesByCategoryId[this.id]||[]){let r=this.#e.getById("location-profile",t.id);r&&e.push(r)}return this.#t.locationProfiles=e,e}toJSON(){return{__type:o.__type,id:this.id,name:this.name}}},ci=Os;var Ds=.75;function dm(o){let e=[];if(o.geometry.type==="Polygon")for(let t=1;t<o.geometry.coordinates.length;t++)e.push({type:"Feature",geometry:{type:"Polygon",coordinates:[o.geometry.coordinates[t]]},properties:{...o.properties,id:ee()}});else if(o.geometry.type==="MultiPolygon")for(let t of o.geometry.coordinates)for(let r=1;r<t.length;r++)e.push({type:"Feature",geometry:{type:"Polygon",coordinates:[t[r]]},properties:{...o.properties,id:ee()}});return e}function um(o){let e={},t=o["floor.geojson"]?.features??[];for(let r of t){let n=r.properties.id;if(!n)continue;let i=[];if(r.geometry!=null&&r.geometry.coordinates.length>0){let a=dm(r);for(let s of a)i.push(s)}e[n]={voids:{type:"FeatureCollection",features:i}}}return e}var Vo=class extends Mt{Analytics;#e={};Query;mvf;outdoorViewToken;objectEntranceNodeIdsByObstructionId;obstructionIdByEntranceId;venue;tokenManager;directions;enterpriseMode=!1;nodesById;spacesById;floorsById;floorStacksById;facadesById;facadesBySpaceId;connectionsById;objectsById;doorsById;pointsOfInterestById;annotationsById;areasById;locationProfilesById;locationCategoriesById;locationProfilesByExternalId;locationProfilesByCategoryId;locationCategoriesByParentId;doorsByNodeId;mvfAnnotationsById;mvfConnectionsById;mvfConnectionsByNodeId;mvfEntrancesById;mvfNodesById;mvfObstructionById;mvfSpacesById;mvfFloorsById;mvfFloorStacksById;mvfAreasById;spacesByExternalId;nodesByExternalId;objectsByExternalId;poisByExternalId;floorsByExternalId;floorStacksByExternalId;doorsByExternalId;areasByExternalId;locationProfilesByAttachedFeatureId={};entranceNodeIdsBySpaceId={};locationsById={};locationInstancesById={};instanceLocationsByPolygonId={};categoriesById={};mvfLocationsByGeometryId={};locationIdsByNodeId={};spaceIdsByNodeId={};objectIdsByNodeId={};connectionsByExternalId={};locationsByExternalId={};categoriesByExternalId={};destinationNodesIdsBySpaceId={};mvfNodesByFloorId;mvfSpacesByFloorId;mvfPoisByFloorId;mvfEntrancesByFloorId;mvfAnnotationsByFloorId;voidsByFloorId={};floorImagesByAnchorId=new Map;localePacksUrls;currentLanguage;languagePacks={};tilesets={};navigationFlags;binaryBundle;envControl;getMapDataOptions;#t;constructor(e,t){super();let r=t?.env??To();if(this.envControl=r,this.binaryBundle=t?.binaryBundle,this.Analytics=new tr,this.localePacksUrls=t?.localePacksUrls??{},this.mvf=e,this.outdoorViewToken=t?.outdoorViewToken,this.getMapDataOptions=t?.getMapDataOptions,this.#t=t?.mvf3,e["tileset.json"]?.default!=null&&(this.tilesets[e["tileset.json"].default.key]=e["tileset.json"].default,r.updateTileServerBaseUrl(e["tileset.json"].default.url),e["tileset.json"].others!=null))for(let i of e["tileset.json"].others)this.tilesets[i.key]=i;this.navigationFlags=e["navigationFlags.json"]??{},this.enterpriseMode=t?.enterprise??!1,this.tokenManager=t?.tokenManager;let n=lp(this,e,t?.mvf3);if(this.nodesById=n.nodesById,this.spacesById=n.spacesById,this.floorsById=n.floorsById,this.floorStacksById=n.floorStacksById,this.facadesById=n.facadesById,this.facadesBySpaceId=n.facadesBySpaceId,this.connectionsById=n.connectionsById,this.objectsById=n.objectsById,this.doorsById=n.doorsById,this.pointsOfInterestById=n.poisById,this.annotationsById=n.annotationsById,this.areasById=n.areasById,this.locationProfilesById=n.locationProfilesById,this.locationCategoriesById=n.locationCategoriesById,this.locationProfilesByCategoryId=n.locationProfilesByCategoryId,this.locationCategoriesByParentId=n.locationCategoriesByParentId,this.spacesByExternalId=n.spacesByExternalId,this.nodesByExternalId=n.nodesByExternalId,this.objectsByExternalId=n.objectsByExternalId,this.floorsByExternalId=n.floorsByExternalId,this.locationProfilesByExternalId=n.locationProfilesByExternalId,this.floorStacksByExternalId=n.floorStacksByExternalId,this.poisByExternalId=n.poisByExternalId,this.doorsByExternalId=n.doorsByExternalId,this.areasByExternalId=n.areasByExternalId,this.mvfAnnotationsById=n.mvfAnnotationsById,this.mvfConnectionsById=n.mvfConnectionsById,this.mvfConnectionsByNodeId=n.mvfConnectionsByNodeId,this.mvfEntrancesById=n.mvfEntrancesById,this.mvfNodesById=n.mvfNodesById,this.mvfObstructionById=n.mvfObstructionById,this.mvfSpacesById=n.mvfSpacesById,this.mvfFloorsById=n.mvfFloorsById,this.mvfFloorStacksById=n.mvfFloorStacksById,this.mvfNodesByFloorId=n.mvfNodesByFloorId,this.mvfSpacesByFloorId=n.mvfSpacesByFloorId,this.mvfPoisByFloorId=n.mvfPoisByFloorId,this.mvfEntrancesByFloorId=n.mvfEntrancesByFloorId,this.mvfAnnotationsByFloorId=n.mvfAnnotationsByFloorId,this.mvfAreasById=n.mvfAreasById,this.doorsByNodeId=n.doorsByNodeId,this.objectEntranceNodeIdsByObstructionId=n.objectEntranceNodeIdsByObstructionId,this.obstructionIdByEntranceId=n.obstructionIdByEntranceId,this.locationProfilesByAttachedFeatureId=n.locationProfilesByAttachedFeatureId,this.entranceNodeIdsBySpaceId=n.entranceNodeIdsBySpaceId,this.spaceIdsByNodeId=n.spaceIdsByNodeId,this.objectIdsByNodeId=n.objectIdsByNodeId,this.destinationNodesIdsBySpaceId=n.destinationNodesIdsBySpaceId,this.voidsByFloorId=um(e),this.enterpriseMode||an()){let i=sp(e,this);if(this.locationsById=i.locationsById,this.locationInstancesById=i.locationInstancesById,this.instanceLocationsByPolygonId=i.instanceLocationsByPolygonId,this.categoriesById=i.categoriesById,this.mvfLocationsByGeometryId=i.mvfLocationsByGeometryId,this.locationIdsByNodeId=i.locationIdsByNodeId,this.connectionsByExternalId=i.connectionsByExternalId,this.locationsByExternalId=i.locationsByExternalId,this.categoriesByExternalId=i.categoriesByExternalId,i.venue.name!=null){this.venue=new fs(this,{mvfData:i.venue});let a={};for(let s in i.mvfLocationsById)a[s]=i.mvfLocationsById[s];for(let s in i.mvfLocationInstancesById)a[s]=i.mvfLocationInstancesById[s];this.languagePacks[this.venue.defaultLanguage.code]={type:"initial",optimized:{"enterprise-location":a,"enterprise-category":i.mvfCategoriesById,"floor-stack":n.mvfFloorStacksById,floor:n.mvfFloorsById}},t?.languagePacks?.forEach(({language:s,localePack:l})=>{this.languagePacks[s.code]=Ha(l)}),this.currentLanguage=this.venue.defaultLanguage}}this.directions=new br({nodes:e["node.geojson"],geojsonCollection:this.enterpriseMode&&e.enterprise?e.space:e.obstruction,connections:e["connection.json"],groupBy:"map",multiplicativeDistanceWeightScaling:!this.enterpriseMode,flagDeclarations:e["navigationFlags.json"],getDoorByNodeId:(i=>{let a=this.doorsByNodeId[i];if(a!=null)return{geoJSON:a.geoJSON}})}),this.Query=new nn(this)}getEnv(){let e=this;return{get baseUri(){return e.envControl.getBaseUri()},get baseAuthUri(){return e.envControl.getBaseAuthUri()},get analyticsBaseUri(){return e.envControl.getAnalyticsBaseUri()},get tileServerUri(){return e.envControl.getTileServerUri()}}}get mapName(){return this.mvf["manifest.geojson"].features[0].properties.name}get organizationId(){return this.mvf["manifest.geojson"].features[0].properties.org_id??""}#o=new H(0,0,"initializing");get mapCenter(){return this.#o.floorId==="initializing"&&(this.#o=new H(this.mvf["manifest.geojson"].features[0].geometry.coordinates[1],this.mvf["manifest.geojson"].features[0].geometry.coordinates[0])),this.#o}get naturalBearing(){return this.mvf["manifest.geojson"].features[0].properties.naturalBearing??0}get spaces(){return this.#e.spaces==null&&(this.#e.spaces=globalThis.Object.values(this.spacesById)),this.#e.spaces}get objects(){return this.#e.objects==null&&(this.#e.objects=globalThis.Object.values(this.objectsById)),this.#e.objects}get connections(){return this.#e.connections==null&&(this.#e.connections=globalThis.Object.values(this.connectionsById)),this.#e.connections}get floors(){return this.#e.floors==null&&(this.#e.floors=globalThis.Object.values(this.floorsById)),this.#e.floors}get floorStacks(){return this.#e.floorStacks==null&&(this.#e.floorStacks=globalThis.Object.values(this.floorStacksById)),this.#e.floorStacks}get facades(){return this.#e.facades==null&&(this.#e.facades=globalThis.Object.values(this.facadesById)),this.#e.facades}get doors(){return this.#e.doors==null&&(this.#e.doors=globalThis.Object.values(this.doorsById)),this.#e.doors}get pointsOfInterest(){return this.#e.pointsOfInterest==null&&(this.#e.pointsOfInterest=globalThis.Object.values(this.pointsOfInterestById)),this.#e.pointsOfInterest}get annotations(){return this.#e.annotations==null&&(this.#e.annotations=globalThis.Object.values(this.annotationsById)),this.#e.annotations}get areas(){return this.#e.areas==null&&(this.#e.areas=globalThis.Object.values(this.areasById)),this.#e.areas}get nodes(){return this.#e.nodes==null&&(this.#e.nodes=globalThis.Object.values(this.nodesById)),this.#e.nodes}get locations(){return this.#e.locations==null&&(this.#e.locations=globalThis.Object.values(this.locationsById)),globalThis.Object.values(this.locationsById)}get categories(){return this.#e.categories==null&&(this.#e.categories=globalThis.Object.values(this.categoriesById)),globalThis.Object.values(this.categoriesById)}get locationProfiles(){return this.#e.locationProfiles==null&&(this.#e.locationProfiles=globalThis.Object.values(this.locationProfilesById)),this.#e.locationProfiles}get locationCategories(){return this.#e.locationCategories==null&&(this.#e.locationCategories=globalThis.Object.values(this.locationCategoriesById)),this.#e.locationCategories}get mvfFloors(){return this.#e.mvfFloors==null&&(this.#e.mvfFloors=globalThis.Object.values(this.mvfFloorsById)),this.#e.mvfFloors}get mvfFloorStacks(){return this.#e.mvfFloorStacks==null&&(this.#e.mvfFloorStacks=globalThis.Object.values(this.mvfFloorStacksById)),this.#e.mvfFloorStacks}getByType(e){switch(e){case"location-profile":return this.locationProfiles;case"location-category":return this.locationCategories;case"area":return this.areas;case"node":return this.nodes;case"space":return this.spaces;case"door":return this.doors;case"floor":return this.floors;case"floor-stack":return this.floorStacks;case"connection":return this.connections;case"object":return this.objects;case"point-of-interest":return this.pointsOfInterest;case"annotation":return this.annotations;case"enterprise-location":return this.locations;case"enterprise-category":return this.categories;case"enterprise-venue":return this.venue;case"facade":return this.facades;default:return[]}}getAllOfTypes(e,t){let r=e instanceof Set?e:new Set(e);return t!=null&&Array.isArray(t)?t.filter(n=>r.has(n.__type)):Array.from(r).flatMap(n=>this.getByType(n))}getById(e,t){let r={"location-profile":this.locationProfilesById,"location-category":this.locationCategoriesById,space:this.spacesById,floor:this.floorsById,"floor-stack":this.floorStacksById,facade:this.facadesById,node:this.nodesById,door:this.doorsById,connection:this.connectionsById,"mvf-connection":this.mvfConnectionsById,object:this.objectsById,"point-of-interest":this.pointsOfInterestById,annotation:this.annotationsById,area:this.areasById,"enterprise-location":a=>this.locationsById[a]??this.locationInstancesById[a],"enterprise-category":this.categoriesById},n=a=>{let s=r[a];if(s!=null)return typeof s=="function"?s(t):s[t]},i=()=>{for(let a of Object.keys(r)){let s=n(a);if(s!=null)return s}};return e==="unknown"?i():n(e)}getByExternalId(e,t){switch(e){case"location-profile":return this.locationProfilesByExternalId[t]??[];case"location-category":return[];case"space":return this.spacesByExternalId[t]??[];case"floor":return this.floorsByExternalId[t]??[];case"floor-stack":return this.floorStacksByExternalId[t]??[];case"node":return this.nodesByExternalId[t]??[];case"door":return this.doorsByExternalId[t]??[];case"connection":return this.connectionsByExternalId[t]??[];case"object":return this.objectsByExternalId[t]??[];case"point-of-interest":return this.poisByExternalId[t]??[];case"area":return this.areasByExternalId[t]??[];case"enterprise-location":return this.locationsByExternalId[t]??[];case"enterprise-category":return this.categoriesByExternalId[t]??[];default:return[]}}getMapDataById(e){return this.spacesById[e]??this.floorsById[e]??this.floorStacksById[e]??this.facadesById[e]??this.nodesById[e]??this.doorsById[e]??this.connectionsById[e]??this.objectsById[e]??this.pointsOfInterestById[e]??this.annotationsById[e]??this.areasById[e]}getMVFFeatureById(e,t){switch(e){case"space":return this.mvfSpacesById[t];case"node":return this.mvfNodesById[t];case"obstruction":return this.mvfObstructionById[t];case"floor":return this.mvfFloorsById[t];case"floor-stack":return this.mvfFloorStacksById[t];case"connection":return this.mvfConnectionsById[t];case"entrance":return this.mvfEntrancesById[t];case"annotation":return this.mvfAnnotationsById[t];case"area":return this.mvfAreasById[t];default:throw new Error(`Unknown MVF feature type: ${e}`)}}getMVFFeatureByNodeId(e,t){switch(e){case"connection":return this.mvfConnectionsByNodeId[t];default:throw new Error(`Unsupported MVF feature type: ${e}`)}}getMVFFeatureByType(e){switch(e){case"floor-stack":return this.mvfFloorStacks;case"floor":return this.mvfFloors;default:throw new Error(`Unsupported MVF feature type: ${e}`)}}propTranslationCache=new Map;getPropTranslation(e,t,r,n){if(!this.currentLanguage)return n;let{code:i}=this.currentLanguage,a=this.languagePacks[i]?.optimized?.[e];if(a){let s=a[r];if(s!=null&&s[t]!==void 0){let l=s[t];if(l!=null&&typeof l=="object"){if(typeof n=="object"&&typeof l=="object"&&!Array.isArray(l)){let c=$n(i+e+r+t.toString());if(this.propTranslationCache.has(c))return this.propTranslationCache.get(c);let p=zl(n,l,["id"]);return this.propTranslationCache.set(c,p),p}return l}return l}}return n}findPreferredLanguage(e){if(!this.venue)return;let t=ws(this.venue,e);return e?.languageCode!=null&&e.languageCode.toLowerCase()!==t.code.toLowerCase()&&C.warn(`Language code "${e.languageCode}" could not be found in the venue. Using "${t.code}" instead.`),t}#r;async changeLanguage(e){let t=e.toLowerCase();if(!t){C.error("Language code must be defined.");return}if(!this.currentLanguage||!this.venue){C.error("Changing the language is not supported for this map.");return}let r=this.currentLanguage.code,n=this.venue?.languages.find(({code:a})=>a.toLowerCase()===t.toLowerCase());if(!n){C.warn(`Language code "${t}" could not be found in the venue.`);return}if(r===n.code)return;let i=this.languagePacks[n.code];if(!i){let a=this.localePacksUrls[n.code];if(!a){C.error(`Locale pack URL not found for language code "${n.code}".`);return}this.#r&&this.#r.abort();let s=new AbortController;this.#r=s;let l;try{l=await Yc(a,{signal:s.signal})}catch(c){C.error(`Failed to download language pack for language code "${n.code}".`,c);return}if(!l||s.signal.aborted)return;i=Ha(l),this.languagePacks[n.code]=i}this.Analytics.sendChangeLanguageEvent({fromLanguage:this.currentLanguage.code}),this.currentLanguage=n,this.publish("language-change",this.currentLanguage)}__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC=(e,t,r)=>this.__LEGACY_GET_DIRECTIONS_SYNC(e,t,{...r,multiDestination:!0});__LEGACY_GET_DIRECTIONS_SYNC=(e,t,r)=>{let{accessible:n=!1,multiDestination:i=!1}=r||{},a=id(this.enterpriseMode,r),s=r?.zones||[],l={accessible:n,zones:s,smoothing:a,excludedConnections:r?.excludedConnections||[],connectionIdWeightMap:r?.connectionIdWeightMap||{},includeNonPublic:r?.includeNonPublic??!1};if(i&&Array.isArray(t)){let c=Array.isArray(e)?e:[e],p=[];for(let h of t){let g=Array.isArray(h)?h:[h],T=this.directions.getDirectionsSync(c,g,l,this);if(!T){C.error("getDirections failed due to missing directions for one of the segments");return}c=g,p.push(T)}return p}else{let c=Array.isArray(e)?e:[e],p=Array.isArray(t)?t:[t];if(Array.isArray(p[0])){C.error("getDirections does not support multi-destination without multisegment option");return}c[0].id&&p[0].id&&this.Analytics.sendGetDirectionsEvent(c[0].id,p[0].id,n);try{return this.directions.getDirectionsSync(c,p,l,this)}catch(h){C.error("Unable to get directions",h);return}}};getDirections=async(e,t,r)=>{let{accessible:n=!1}=r||{},i=id(this.enterpriseMode,r),a=r?.zones||[],s={accessible:n,zones:a,smoothing:i,excludedConnections:r?.excludedConnections||[],connectionIdWeightMap:r?.connectionIdWeightMap||{},includeNonPublic:r?.includeNonPublic??!1},l=Array.isArray(e)?e:[e],c=Array.isArray(t)?t:[t];if(Array.isArray(c[0])){C.error("getDirections does not support multi-destination without multisegment option");return}l[0].id&&c[0].id&&this.Analytics.sendGetDirectionsEvent(l[0].id,c[0].id,n);try{return this.directions.getDirections(l,c,s,this)}catch(p){C.error("Unable to get directions",p);return}};getDirectionsMultiDestination=async(e,t,r)=>Promise.resolve(this.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(e,t,r));getDistance(e,t){let r=Io(e),n=Io(t);return qt([r.longitude,r.latitude],[n.longitude,n.latitude])}getDoorByNodeId=e=>this.doorsByNodeId[e];transformImageRequest=async e=>{if(this.enterpriseMode||!this.getMapDataOptions)return{url:e};if(!qc(e))return{url:e};if(Qc(e))return{url:e};let t=sr(e);if(!t)return{url:e};try{let n=(await this.tokenManager?.getSasTokensAsync())?.tokens?.[t.mapId];if(n==null)throw new Error("SAS token not found");let[i]=e.split("?");return{url:`${i}?${n.token}`}}catch(r){return C.error("Failed to append SAS token to image request. Requests for private images may fail.",r),{url:e}}};async toJSONBundle({downloadLanguagePacks:e=!0}={}){let t=[];if(e&&this.enterpriseMode){let r=new AbortController;for(let n of this.venue?.languages||[])try{if(this.localePacksUrls[n.code]){let i=await La(this.localePacksUrls[n.code],{signal:r.signal}),a=await ir(i);a&&t.push({language:{code:n.code,name:n.name},localePack:a})}}catch(i){C.warn("failed downloading language pack",i)}}return{type:"json",options:{enterprise:this.enterpriseMode,mvf3:this.#t},languagePacks:t,main:this.mvf}}async toBinaryBundle({downloadLanguagePacks:e=!0}={}){if(!this.binaryBundle){C.error("binary bundle not found");return}let t=[];if(e&&this.enterpriseMode){let r=new AbortController;for(let n of this.venue?.languages||[])try{if(this.localePacksUrls[n.code]){let i=await La(this.localePacksUrls[n.code],{signal:r.signal});i&&t.push({language:{code:n.code,name:n.name},localePack:i})}}catch(i){C.warn("failed downloading language pack",i)}}return{type:"binary",options:{enterprise:this.enterpriseMode},languagePacks:t,main:this.binaryBundle}}destroy(){for(let e of globalThis.Object.keys(this.#e))this.#e[e]=null;this.propTranslationCache.clear()}};var id=(o,e)=>{let t=!o,r=e?.smoothing,i=r!=null?typeof r=="object"?r.enabled??t:r:t,a=typeof r=="object"?r.radius:void 0,s=typeof r=="object"?r.__EXPERIMENTAL_METHOD??"greedy-los":"greedy-los";return s==="dp-optimal"?{enabled:i,radius:a??Ds,__EXPERIMENTAL_METHOD:"dp-optimal",includeDoorBufferNodes:typeof r=="object"&&r.__EXPERIMENTAL_METHOD==="dp-optimal"?r.__EXPERIMENTAL_INCLUDE_DOOR_BUFFER_NODES:void 0}:s==="rdp"?{enabled:i,radius:a??Ds,__EXPERIMENTAL_METHOD:"rdp",mustIncludeDoorBufferNodes:typeof r=="object"&&r.__EXPERIMENTAL_METHOD==="rdp"?r.__EXPERIMENTAL_MUST_INCLUDE_DOOR_BUFFER_NODES:void 0}:{enabled:i,radius:a??Ds,__EXPERIMENTAL_METHOD:s}};f();f();f();f();f();var po=class o{id;text;target;static __type="label";__type=o.__type;static is(e){return e.__type===o.__type}get focusTarget(){return this.target.anchorTarget}constructor(e,t,r){this.id=e,this.text=t,this.target=r}get navigationTarget(){return this.target.anchorTarget}};f();var ro=class o{id;static __type="marker";#e;get target(){return this.#e}get coordinate(){return this.#e.anchorTarget}get navigationTarget(){return this.target.anchorTarget}toJSON(){return{id:this.id,__type:o.__type,target:this.target,coordinate:this.coordinate}}__type=o.__type;contentEl;static is(e){return e.__type===o.__type}constructor(e,t,r){this.id=e,this.contentEl=t,this.#e=r}get focusTarget(){return this.target.anchorTarget}updateTarget(e){this.#e=e}};f();var jo=class o{id;groupId;static __type="model";__type=o.__type;#e;get target(){return this.#e}static is(e){return e.__type===o.__type}constructor(e,t,r){this.id=e,this.groupId=t,this.#e=r}updateTarget(e){this.#e=e}toJSON(){return{id:this.id,__type:o.__type,groupId:this.groupId,target:this.#e}}get navigationTarget(){return this.#e.anchorTarget}};f();var xo=class o{id;coordinates;#e;static __type="path-segment";__type=o.__type;static is(e){return e.__type===o.__type}constructor(e,t){this.id=e,this.coordinates=t}get isConnectionSegment(){return this.coordinates.length===2&&this.coordinates[0].floorId!==this.coordinates[1].floorId}get distance(){return this.#e?this.#e:(this.#e=Xa(this.coordinates),this.#e)}get focusTarget(){return this.coordinates}},_t=class o{id;animation;coordinates;segments;#e;static __type="path";__type=o.__type;static is(e){return e.__type===o.__type}get focusTarget(){return this.coordinates}constructor(e,t,r,n){this.id=e,this.animation=t,this.coordinates=r,this.segments=n.map(({id:i,coordinates:a})=>new xo(i.toString(),a))}get distance(){return this.#e?this.#e:(this.#e=Xa(this.coordinates),this.#e)}toJSON(){return{__type:o.__type,id:this.id,coordinates:this.coordinates,segments:this.segments}}};f();var fm=7,sn=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t?.precision??fm}toJSON(){return{center:this.center,bearing:this.bearing,pitch:this.pitch,zoomLevel:this.zoomLevel}}get center(){let e=this.#e.center;if(this.#t===-1)return e;let t=qn(e.latitude,this.#t),r=qn(e.longitude,this.#t);return new H({latitude:t,longitude:r,floorId:e.floorId,verticalOffset:e.verticalOffset})}get bearing(){return this.#e.bearing}get pitch(){return this.#e.pitch}get zoomLevel(){return qn(this.#e.zoomLevel,5)}};f();var uo=class o{id;static __type="shape";__type=o.__type;static is(e){return e.__type===o.__type}get focusTarget(){return this}constructor(e){this.id=e}};f();var fo=class o{id;constructor(e,t){this.id=e,this.target=t}target;static __type="text-3d";__type=o.__type;static is(e){return e.__type===o.__type}};f();f();f();var hm=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
|
|
7
7
|
<path
|
|
8
8
|
fillRule="evenodd"
|
|
9
9
|
clipRule="evenodd"
|
|
@@ -293,7 +293,7 @@ See https://handlebarsjs.com/api-reference/runtime-options.html#options-to-contr
|
|
|
293
293
|
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(94.117647%,94.117647%,94.117647%);fill-opacity:1;" d="M 2.25 7.5 L 2.25 7.125 L 9.75 7.125 L 9.75 7.5 Z M 2.25 7.5 "/>
|
|
294
294
|
<path style=" stroke:none;fill-rule:nonzero;fill:rgb(94.117647%,94.117647%,94.117647%);fill-opacity:1;" d="M 2.25 10.125 L 2.25 9.75 L 9.75 9.75 L 9.75 10.125 Z M 2.25 10.125 "/>
|
|
295
295
|
</g>
|
|
296
|
-
</svg>`},H1=/<svg([^>]*)>/g;function Xf(o,e,t){let r=U1[o];return r?r.replace(H1,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${e}; width:${t}px; height:${t}px">`):null}function W1(o){return zf.sanitize(o,{USE_PROFILES:{svg:!0}})}function z1(o,e){let n=new DOMParser().parseFromString(o,"image/svg+xml").documentElement;return n==null||n.tagName==="parsererror"||n.tagName.toLowerCase()!=="svg"?(C.error("Failed to parse SVG",{svg:o,tagName:n?.tagName}),o):(e!=null&&(n.setAttribute("color",e),n.querySelectorAll("*").forEach(s=>{(s.getAttribute("fill")!=null||s.tagName==="path")&&s.getAttribute("fill")!=="none"&&s.setAttribute("fill","currentColor"),s.getAttribute("stroke")!=null&&s.getAttribute("stroke")!=="none"&&s.setAttribute("stroke","currentColor")})),new XMLSerializer().serializeToString(n))}async function $f(o,e){let t="";try{if(o.trim()==="")throw new Error("URL is empty!");e?.style==="fill"&&(o=o.replace(".svg","-fill.svg"));let r=await ht()(o),n=r.headers.get("content-type");if(n?.includes("image/svg+xml")){let i=await r.text();return t=W1(i),e?.color!=null&&(t=z1(t,e.color)),{icon:t,type:"svg"}}else{if(n?.includes("image"))return{icon:o,type:"image"};throw new Error(`Expected SVG or Image content, but received: ${n}`)}}catch(r){return C.error(`Failed to fetch icon from ${o}.`,r),null}}f();function Yf(o){return o.locationProfiles.some(e=>e.categories.some(t=>t.name.includes("Restroom")))}function Zf(o){return o.locationProfiles.some(e=>e.categories.some(t=>t.name.includes("Parking")))}var qf=new Set(["connection","point-of-interest","space","object","door","facade"]),zo={default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F",parking:"#418425",door:"#A0552C"},Fr={elevator:"connection-elevator-12x12",escalator:"connection-stairs-12x12",stairs:"connection-stairs-12x12",point:"point-of-interest-12x12",door:"door-12x12",building:"building-12x12",ladder:"ladder-12x12"};function X1(o){let e=null;if(ze.is(o))switch(o.type){case"elevator":e=Fr.elevator;break;case"ladder":e=Fr.ladder;break;case"escalator":case"stairs":default:e=Fr.stairs}else yt.is(o)?e=Fr.point:et.is(o)?e=Fr.door:Ve.is(o)&&(e=Fr.building);return e!=null?Xf(e,"#FFFFFF",12):null}function Jf(o){return ze.is(o)?zo.connection:Ve.is(o)?zo.default:Yf(o)?zo.washroom:Zf(o)?zo.parking:yt.is(o)?zo.point:et.is(o)?zo.door:zo.default}async function $1(o,e){let t=null,r="locationProfiles"in o?o.locationProfiles.find(n=>n.icon!=null)?.icon:null;if(r?.url!=null&&(t=await $f(r.url,{color:e.color,style:"fill"})),t==null){let n=X1(o);n!=null&&(t={icon:n,type:"svg"})}return t}function Y1(o){return ze.is(o)||et.is(o)?"low":yt.is(o)||Ve.is(o)?"high":"medium"}async function Z1(o){let e={appearance:{color:Jf(o),pinOutlineColor:Jf(o),iconPadding:8,iconSize:24,textSize:12.5,iconScale:{on:"zoom-level",input:[18,20],output:[.7,1]}},rank:Y1(o),interactive:!0},t=await $1(o,{color:"#FFFFFF"});return t!=null&&(e.appearance.icon=t.icon,t.type==="svg"?Ve.is(o)&&(e.appearance.iconSize=30,e.appearance.iconPadding=10):t.type==="image"&&(e.appearance.iconSize=48,e.appearance.iconPadding=2,e.appearance.pinOutlineColor="#FFFFFF",e.rank="high")),e}async function Qf(o,e){return(await Promise.all(e.map(async r=>{let n=[];if(!lo(r))return n;let i=await Z1(r);return ze.is(r)?n=r.coordinates.map(a=>o.Labels.add(a,r.name,i)):Ve.is(r)?r.spaces.length>0&&r.floorStack.name!=null&&r.floorStack.name!==""&&n.push(o.Labels.add(r.spaces[0],r.floorStack.name,i)):Pf(r)&&$a(r)&&n.push(o.Labels.add(r,r.name,i)),n}))).flat()}async function Kf(o,e){let t=o.getMapDataInternal();if(!t)throw new Error("Map data not found");let r=t.getAllOfTypes(qf,e),n=t.getAllOfTypes(Mf,e),i=t.getAllOfTypes(Cf,e),[a,s]=await Promise.all([r.length>0?Qf(o,r):[],n.length>0?xf(o,n):[],i.length>0?_f(o,i):[]]);return{labels:a,markers:s}}var aa=.05,Nn=class extends Mt{core;mapObjects=[];id;mapDataExternal={};mapsByFloorId={};mapData;currentMap;hiddenOutdoorGeometries=[];lastFacadeIntersected;#e=!1;#t=!1;mapView;externalPubSub;get manualFloorVisibility(){return this.#e}set manualFloorVisibility(e){this.#e=e,this.externalPubSub.publish("state-change-internal",{manualFloorVisibility:e})}get hidePathsNotOnCurrentFloor(){return this.#t}set hidePathsNotOnCurrentFloor(e){this.#t=e,this.currentMap?.updateOutdoorPathLayerVisibility()}Camera;Labels;Text3D;Markers;Models;Paths;Exporter;Navigation;Outdoor;Shapes;Style;Image3D;constructor(e,t,r){super(),this.core=e,this.mapView=t,this.externalPubSub=r,this.Camera=new fn(this),this.id=this.core.addGroupContainer("root").id.toString();let n=new Tn("outdoors-container",void 0,void 0,this);this.mapObjects.push(n),this.currentMap=n,this.core.on("pre-render",()=>{r.publish("pre-render")},{signal:this.signal}),this.core.on("post-render",()=>{r.publish("post-render")},{signal:this.signal}),this.core.on("resize",()=>{r.publish("resize")},{signal:this.signal}),this.core.on("render-error",({error:c})=>{r.publish("render-error",{error:new Wl(c instanceof Error?c.message:"Unknown error")})},{signal:this.signal});let i=c=>{let p=c;c.startsWith(Jr)&&c.endsWith("-merged")&&(p=c.slice(Jr.length,-7));let h=this.getMapDataObject(p);switch(h?.__type){case"facade":return h;case"floor":return h.floorStack.facade;default:return null}};this.core.on("geometry-in-focus",c=>{let p=new Set;for(let h of c){let g=i(h);g&&p.add(g)}r.publish("facades-in-view-change",{facades:Array.from(p)})},{signal:this.signal}),this.core.getSystems().renderSystem.on("camera-state-change",()=>{r.publish("state-change-internal",{Camera:this.getCameraState()})},{signal:this.signal});let a=new sn(this.Camera,{precision:7});this.core.on("camera-change",()=>{r.publish("camera-change",a)},{signal:this.signal}),this.core.on("pan-bounds-change",c=>{r.publish("camera-bounds-change",ui(c,this.core.convert3DMapPositionToCoordinate))},{signal:this.signal}),this.core.camera.on("padding-change",({padding:c})=>{r.publish("camera-screen-offsets-change",c)},{signal:this.signal});let s=c=>p=>{let h=[],g=[],T=[],I=[],E=[];p.labels.forEach(L=>{let j=this.Labels.getById(L.toString());j&&h.push(j.label)}),p.markers.forEach(L=>{let j=this.Markers.getById(L.toString())||this.Navigation.getMarkerById(L.toString());j&&g.push(j.marker)}),p.models.forEach(L=>{let j=this.Models.getById(L.toString());j&&T.push(j.model)}),p.images.forEach(L=>{let j=this.Image3D.getById(L.toString());j&&I.push(j.image)}),p.paths.forEach(L=>{let j=this.Paths.getById(L.toString())||this.Navigation.getPathById(L.toString());j&&!E.includes(j)&&E.push(j)});let D=p.geometry,x;D.length>0&&(x=D.map(L=>this.getMapDataInternal()?.getById("space",L)).filter(Boolean)[0],x||(x=D.map(L=>this.getMapDataInternal()?.getById("object",L)).filter(Boolean)[0]),x||(x=D.map(L=>this.getMapDataInternal()?.getById("area",L)).filter(Boolean)[0]),x||(x=D.map(L=>this.Shapes.getById(L)).filter(Boolean)[0]));let A=p.containers.reduce((L,j)=>{let te=this.getMapDataInternal()?.getById("floor",j);return te&&pt.is(te)&&L.push(te),L},[]),U,R=0;if(A.length>0){U=A[0].id;let L=this.core.getState(U);R=p.coordinate[2]?p.coordinate[2]-L.altitude:R}let B;this.lastFacadeIntersected&&this.lastFacadeIntersected.spaces.forEach(L=>{this.core.setState(L.id,{hovered:!1})}),x&&Ie.is(x)&&(B=D.map(L=>this.getMapDataInternal()?.facadesBySpaceId[L]).filter(Boolean)[0],B&&B.spaces.forEach(L=>{this.core.setState(L.id,{hovered:!0})})),this.lastFacadeIntersected=B;let V={coordinate:new H({latitude:p.coordinate[1],longitude:p.coordinate[0],floorId:U,verticalOffset:R}),spaces:x&&Ie.is(x)?[x]:[],objects:x&&dt.is(x)?[x]:[],areas:x&&Ct.is(x)?[x]:[],shapes:x&&uo.is(x)?[x]:[],markers:g,labels:h,models:T,images:I,paths:E,floors:A,facades:B?[B]:[]};"pointerEvent"in p&&(V.pointerEvent=p.pointerEvent),r.publish(c,V)};this.core.on("hover",s("hover"),{signal:this.signal}),this.core.on("click",s("click"),{signal:this.signal}),this.core.on("user-interaction-start",()=>{r.publish("user-interaction-start")},{signal:this.signal}),this.core.on("user-interaction-end",()=>{r.publish("user-interaction-end")},{signal:this.signal});let l={currentMapGetter:()=>this.currentMap,mapDataInternalGetter:()=>this.mapData?.internal};this.Markers=new vn(l),this.Models=new Sn(l),this.Labels=new gn(l),this.Text3D=new Cn(l),this.Exporter=new hn(l),this.Paths=new En(l),this.Navigation=new un(this),this.on("navigation-state-change",c=>{this.externalPubSub.publish("state-change-internal",{Navigation:c})}),this.on("navigation-connection-click",c=>{this.externalPubSub.publish("navigation-connection-click",c)}),this.on("navigation-active-path-change",c=>{this.externalPubSub.publish("navigation-active-path-change",c)}),this.Outdoor=new Cr(this.core,this.hiddenOutdoorGeometries),this.Outdoor.enabled&&(this.core.on("outdoor-view-loaded",()=>{r.publish("outdoor-view-loaded")},{signal:this.signal}),this.core.on("outdoor-style-loaded",()=>{r.publish("outdoor-style-loaded")},{signal:this.signal})),this.Image3D=new In(l),this.Shapes=new Mn(l),this.Style=new xn(l)}preloadFloors(e){e.forEach(t=>{t instanceof pt&&this.core.setState(t.id,{preloadGeometry:!0})})}updateState(e,t){if(t==null||typeof t!="object")return;let r=this.currentMap.options?.disableUpdateStateValidation??!1;if(e==="interior-walls"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(Ee);if(a){let s=a.layers.get(So);s&&this.core.hasState(s)&&this.core.setState(s,qs(se(Js,t,{warn:!0,disableValidation:r}),this.core.getState(s)))}});return}if(e==="exterior-walls"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(Ee);if(a){let s=a.layers.get(eo);s&&this.core.hasState(s)&&this.core.setState(s,qs(se(Js,t,{warn:!0,disableValidation:r}),this.core.getState(s)))}});return}if(e==="interior-doors"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(Ee),s=i.layers.get(pr);if(!a)return;let l=a.layers.get(lr);if(!l||!this.core.hasState(l))return;let c=Gs(se(Pi,t,{warn:!0,disableValidation:r}),this.core.getState(l));Object.keys(c.featureCollection).length>0&&this.core.setState(l,c.featureCollection),s&&Object.keys(c.container).length>0&&this.core.setState(s.containerId,c.container)});return}if(e==="exterior-doors"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(Ee),s=i.layers.get(dr);if(!a)return;let l=a.layers.get(cr);if(!l||!this.core.hasState(l))return;let c=Gs(se(Pi,t,{warn:!0,disableValidation:r}),this.core.getState(l));Object.keys(c.featureCollection).length>0&&this.core.setState(l,c.featureCollection),s&&Object.keys(c.container).length>0&&this.core.setState(s.containerId,c.container)});return}let n=typeof e=="string"?this.getMapDataObject(e):e;if(n){if(n.__type!==_t.__type&&!this.core.hasState(n.id)){C.warn(`Failed to update state for "${n.id}". No ${n.__type} found with that ID.`);return}if(po.is(n))return this.core.setState(n.id,fu(se(du,t,{warn:!0,disableValidation:r}),this.core.getState(n.id)));if(ro.is(n))return this.core.setState(n.id,mu(se(hu,t,{warn:!0,disableValidation:r}),this.core.getState(n.id)));if(Ie.is(n)||dt.is(n)){let i=this.core.getState(n.id);i!=null&&this.core.setState(n.id,pu(se(Ws,t,{warn:!0,disableValidation:r}),i))}if(Ct.is(n)&&this.core.setState(n.id,se(Ws,t,{warn:!0,disableValidation:r})),mt.is(n)&&this.core.setState(n.id,se(_u,t,{warn:!0,disableValidation:r})),et.is(n)&&this.core.setState(n.id,Bd(se(Pi,t,{warn:!0,disableValidation:r}),this.core.getState(n.id))),uo.is(n)){let i=Tu(se(Ys,t,{warn:!0,disableValidation:r}));i.mergedShapeState&&this.core.setState(n.id,i.mergedShapeState)}if(jo.is(n)){let{position:i,scale:a,rotation:s,...l}=se(Du,t,{warn:!0,disableValidation:r}),c=l;i&&(c.position=[i.longitude,i.latitude,i.verticalOffset]),a!=null&&(Array.isArray(a)?c.scale=a:c.scale=[a,a,a]),s!=null&&(Array.isArray(s)?c.rotation=s:c.rotation=[s,s,s]),i&&n.updateTarget(i),this.core.setState(n.id,c)}if(pt.is(n)){let i=this.currentMap.floorsById.get(n.id);if(i==null)return;let a=se(au,t,{warn:!0,disableValidation:r});this.core.setState(n.id,a);let s=i.layers.get(Ee);if(s!=null&&"geometry"in t&&t.geometry){this.core.setState(s.containerId,se(qd,t.geometry,{warn:!0,disableValidation:r}));for(let E of s.layers.keys())this.core.setState(s.layers.get(E),{maskId:t.geometry.maskId??void 0,maskEffect:t.geometry.maskEffect??void 0,maskMode:t.geometry.maskMode??void 0,maskEnabled:t.geometry.maskEnabled??void 0,effectStart:t.geometry.effectStart??void 0,effectDistance:t.geometry.effectDistance??void 0,darkenAmount:t.geometry.darkenAmount??void 0,darkenUseDepth:t.geometry.darkenUseDepth??void 0,desaturateAmount:t.geometry.desaturateAmount??void 0,desaturateUseDepth:t.geometry.desaturateUseDepth??void 0,washOutAmount:t.geometry.washOutAmount??void 0,washOutUseDepth:t.geometry.washOutUseDepth??void 0})}let l=i.layers.get(to);if(l!=null&&"labels"in t&&t.labels){let E=se(Qd,t.labels,{warn:!0,disableValidation:r});"enabled"in E&&typeof E.enabled=="boolean"&&l.setVisible(E.enabled)}let c=i.layers.get(jt);if(c!=null&&"markers"in t&&t.markers){let E=se(Kd,t.markers,{warn:!0,disableValidation:r});"enabled"in E&&typeof E.enabled=="boolean"&&c.setVisible(E.enabled)}if(i.footprintObject&&"footprint"in t&&t.footprint){let E=se(Uo,t.footprint,{warn:!0,disableValidation:r});i.footprintObject.update({altitude:E.altitude,visible:E.visible,height:E.height,opacity:E.opacity,side:E.side,color:E.color,ceilingVisible:E.ceilingVisible,ceilingThickness:E.ceilingThickness,basementMaskEnabled:E.basementMaskEnabled,outline:E.outline})}if(i.gapFootprintObject&&"visible"in t){let E={visible:t.visible};if("footprint"in t&&t.footprint){let D=se(Uo,t.footprint,{warn:!0,disableValidation:r});D.color!==void 0&&(E.color=D.color),D.opacity!==void 0&&(E.opacity=D.opacity),D.outline!==void 0&&(E.outline=D.outline)}i.gapFootprintObject.update(E)}let p=i.layers.get(Lo);if(p!=null&&"occlusion"in t&&t.occlusion){let E=se(tu,t.occlusion,{warn:!0,disableValidation:r});"enabled"in E&&typeof E.enabled=="boolean"&&p.setVisible(E.enabled)}let h=i.layers.get(ur);if(h!=null&&"images"in t&&t.images){let E=se(eu,t.images,{warn:!0,disableValidation:r});if("visible"in E&&typeof E.visible=="boolean"&&h.setVisible(E.visible),"collisionsEnabled"in E&&typeof E.collisionsEnabled=="boolean"&&s!=null)for(let D of s.layers.values()){let x=this.core.getState(D);if(x?.children)for(let A of x.children)this.core.setState(A,{enableImageCollisions:E.collisionsEnabled})}}let g=i.layers.get(oo);if(g!=null&&"paths"in t&&t.paths!=null){let E=se(ou,t.paths,{warn:!0,disableValidation:r});E.visible!=null&&typeof E.visible=="boolean"&&g.setVisible(E.visible)}let T=i.layers.get(Ro);if(T!=null&&"areas"in t&&t.areas!=null){let E=se(ru,t.areas,{warn:!0,disableValidation:r});E.visible!=null&&typeof E.visible=="boolean"&&T.setVisible(E.visible)}let I=i.layers.get(Gt);if(I!=null&&"models"in t&&t.models!=null){let E=se(iu,t.models,{warn:!0,disableValidation:r});E.visible!=null&&typeof E.visible=="boolean"&&I.setVisible(E.visible)}if("text3d"in t&&t.text3d!=null){let E=se(nu,t.text3d,{warn:!0,disableValidation:r});E.visible!=null&&i.setBatchedTextVisible(E.visible)}}if(Ve.is(n)){let i=this.core.getState(n.id);for(let a of i.children)a.type==="group-container"&&this.core.setState(a.id,se(jd,t,{warn:!0,disableValidation:r}))}if(fo.is(n)&&this.core.setState(n.id,se(Eu,t,{warn:!0,disableValidation:r})),_t.is(n)){let i=se(Bs,t,{warn:!0,disableValidation:r}),a=xr(i);for(let s of n.segments)this.core.setState(s.id,a)}if(xo.is(n)){let i=se(Bs,t,{warn:!0,disableValidation:r}),a=xr(i);this.core.setState(n.id,a)}}}getMapDataObject(e){return this.getMapDataInternal()?.getMapDataById(e)}update=()=>{this.core.render()};getMapDataInternal(){if(this.mapData)return Hr(this.mapData)}getMapData(){return this.mapData}addMap(e,t){return new Promise(r=>{let n;try{n=Hr(e)}catch(p){C.error("Error adding map",p),r(e);return}this.mapDataExternal[e.mapName]=e,this.mapData=e;let{mvf:i}=n,a=i["manifest.geojson"].features[0].geometry.coordinates;this.core.mode!=="outdoors-overlay"&&this.Camera.set({center:new H(a[1],a[0])});let s=i["manifest.geojson"].features[0].properties.name,l=new Tn(`mapObject-${s}`,n,t,this);this.currentMap=l,this.currentMap.loadAllFloors(),this.currentMap.setFloor(this.currentMap.startingFloorId),this.core.renderSync();let c=t?.outdoorView?.layersHiddenByGeometry??[];if(c.length>0){let p=[];for(let h of l.floorStacksById.values())h.isOutdoors===!1&&h.defaultFloor.footprint&&h.defaultFloor.footprint.geometry!=null&&h.defaultFloor.footprint.geometry?.coordinates.length>0&&p.push(h.defaultFloor.footprint);p.length>0&&(this.core.hideOutdoorLayersIntersectingPolygons(p,c),this.hiddenOutdoorGeometries.push([p,c]))}if(this.mapObjects.push(l),n.getMVFFeatureByType("floor").forEach(p=>{this.mapsByFloorId[p.id]=l}),l.on("floor-change-start",p=>{this.externalPubSub.publish("floor-change-start",{reason:p.reason,floor:this.getMapDataInternal()?.getById("floor",p.floorId)??this.currentFloor,previousFloor:this.getMapDataInternal()?.getById("floor",p.previousFloorId)??this.currentFloor})},{signal:this.signal}),l.on("floor-change",p=>{this.externalPubSub.publish("floor-change",{reason:p.reason,floor:this.currentFloor,previousFloor:this.getMapDataInternal()?.getById("floor",p.previousFloorId)??this.currentFloor}),this.externalPubSub.publish("state-change-internal",{currentFloor:this.currentFloor,currentFloorStack:this.currentFloorStack})},{signal:this.signal}),t?.zoomLevel!=null)this.core.camera.setZoomLevel(t.zoomLevel),r(e);else if(this.core.mode!=="outdoors-overlay"&&this.currentFloor){let p=t?.screenOffsets??{top:aa*this.core.canvasHeight,left:aa*this.core.canvasWidth,right:aa*this.core.canvasWidth,bottom:aa*this.core.canvasHeight};this.Camera.focusOn(this.currentFloor,{duration:op,screenOffsets:p}).then(()=>{this.Camera.setElevation(this.currentFloor.elevation),r(e)})}else r(e)})}setFloor(e,t){return this.currentMap.setFloor(Yr(e),t)}setFloorStack(e,t){return this.currentMap.setFloorStack(Yr(e),t)}updateWatermark(e){this.core.updateWatermark(e)}get currentFloorStack(){let e=this.currentMap.currentFloorStack.id;if(!e)throw new Oe("Missing currentFloorStack.");let t=this.mapData?.getById("floor-stack",e);if(!t)throw new Oe("FloorStack was not found in map data.");return t}get currentFloor(){let e=this.currentMap.currentFloor.id;if(!e)throw new Oe("Missing currentFloor object from GeoJsonApi");let t=this.mapData?.getById("floor",e);if(!t)throw new Oe("Missing currentFloor");return t}getState(e){typeof e=="object"&&_t.is(e)&&C.warn("Cannot get state of a Path directly. Use getState() on individual segments within Path.segments[] instead.");let t=Ts(e,this),r=this.core.getState(t);if(r){if(["interior-walls","exterior-walls"].includes(e)&&r.type==="feature-collection")return Cu(r);if(["interior-doors","exterior-doors"].includes(e)&&r.type==="feature-collection"){let n=e==="interior-doors"?pr:dr,i;for(let a of this.currentMap.floors){let s=a.layers.get(n);if(!s)continue;let l=this.core.getState(s.containerId);if(l){i=l;break}}return Nd(r,i)}else{if(r.type==="geometry")return cu(r);if(r.type==="label"&&r.options.appearance&&r.options.rank!==void 0&&r.options.interactive!==void 0)return uu(r);if(r.type==="marker"&&r.options?.rank!==void 0&&r.options.interactive!==void 0)return gu(r,this.Markers.getById(r.id.toString())?.marker);if(r.type==="model")return wu(r);if(r.type==="image")return Pu(r);if(r.type==="text3d")return Mu(r);if(r.type==="feature-collection"&&e&&typeof e!="string"&&uo.is(e))return bu(r);if(r.type==="path")return kd(r);if(r.type==="group-container"&&typeof e!="string"&&pt.is(e))return su(r,this.currentMap.floorsById.get(e.id),this.core);if(r.type==="group-container"&&r.children.length>0&&typeof e!="string"&&Ve.is(e)){let n=this.core.getState(r.children[0].id);return Gd(n)}}}}__EXPERIMENTAL__getRenderedState(e){let t=Ts(e,this);if(t)return this.core.getRenderedState(t)}setHoverColor(e){this.core.setState({hoverColor:e})}getHoverColor(){let e=this.core.getState();return e?.type==="map-view"?e.hoverColor:void 0}getFloorStackAltitudeData(e){return this.currentMap.getFloorStackAltitudeData(e)}createCoordinateFromScreenCoordinate(e,t,r){if(r!=null){let l=this.core.projectScreenXYToCoordinate(e,t,!0);return l?new H(l.coordinate[1],l.coordinate[0],r.id):void 0}let n=this.core.projectScreenXYToCoordinate(e,t);if(n==null||n.coordinate==null)return;let{coordinate:i,groupContainers:a}=n,s=a?.find(l=>{let c=l.userData.entityId.toString();return c.includes("f_")||c.includes("m_")})?.userData.entityId.toString();return new H(i[1],i[0],s)}getScreenCoordinateFromCoordinate(e){let t=0;if(e.floorId!=null){let r=this.mapData?.getById("floor",e.floorId);r!=null&&(t=this.getState(r)?.altitude??0)}return t+=e.verticalOffset,this.core.projectCoordinateToScreenXY([e.longitude,e.latitude,t])}isInView(e){return this.core.isInView(typeof e=="string"?e:e.id)}getInView(e,t){let r=this.core.queryGeometry2DInView({screenOffsets:t?.screenOffsets,fullyContains:t?.fullyContains});if(r.length===0)return[];let n=[];switch(e){case po.__type:n=r.map(i=>this.Labels.getById(i)).filter(i=>i!=null).map(i=>i.label);break;case ro.__type:n=r.map(i=>this.Markers.getById(i)).filter(i=>i!=null).map(i=>i.marker)}return n}async __EXPERIMENTAL__auto(e){return await Kf(this,e)}tween(e){let t=new ao(e);return this.core.getExternalTweenGroup().add(t),this.core.render(),t}removeTween(e){this.core.getExternalTweenGroup().remove(e)}tweenGroup(){return this.core.getExternalTweenGroup()}get __core(){return this.core}getCameraState(){return this.core.camera.getState()}getNavigationState(){return{isMultiFloor:this.Navigation.isMultiFloor,floorStacks:this.Navigation.floorStacks,floors:this.Navigation.floors,activeDirections:this.Navigation.activeDirections,activePath:this.Navigation.activePath,paths:this.Navigation.paths}}getAllState(){return{currentFloor:this.currentFloor,currentFloorStack:this.currentFloorStack,Camera:this.getCameraState(),Navigation:this.getNavigationState(),manualFloorVisibility:this.manualFloorVisibility}}publishAllState(){this.externalPubSub.publish("state-change-internal",this.getAllState())}clear(){this.Navigation.clear(),this.Shapes.removeAll(),this.Paths.removeAll(),this.Models.removeAll(),this.Markers.removeAll(),this.Image3D.removeAll(),this.Labels.removeAll()}destroy(){this.clear(),super.destroy(),this.core.destroy()}getOptimalVisualDistanceBetweenFloors(e,t=!1){let r=this.currentMap;if(!r){C.error("Cannot compute optimal visual distance between floors. Missing current map.");return}if(e.length<2){C.warn("Cannot compute optimal visual distance between floors. Must provide at least 2 floors.");return}let n=r.renderer.getInternalState().geometry3DMap.get(e[0].id),i=r.renderer.getInternalState().geometry3DMap.get(e[1].id);if(!n||!i){C.warn("Cannot compute optimal visual distance between floors. Floors not found in current map.");return}va(n,"group-container"),va(i,"group-container"),t&&typeof r.renderer.debugVisualizeBoundingBoxes=="function"&&r.renderer.debugVisualizeBoundingBoxes(n,i);let a=r.renderer.computeMinZOffsetBetweenContainers(n,i);if(a!==-1)return a}};function J1(o){if(o===""){ya(""),Ta("");return}Ta(`${o}/${rc}`),ya(`${o}/${oc}`)}f();var sa=class{state;#e;constructor(e){this.#e=e,this.update=e.Debug.update.bind(e.Debug),this.state=e.Debug.state}update;getCameraState(){let e=this.#e.camera.center,t=this.#e.camera.bearing;return{center:new H({longitude:e[0],latitude:e[1]}),zoomLevel:this.#e.camera.zoomLevel,bearing:t,pitch:this.#e.camera.pitch}}};f();import Ue from"zod";var eh=Ue.strictObject({environment:Ue.union([Ue.literal("basic"),Ue.literal(!1)]).optional(),text3d:Ue.object({hoverColor:Ue.string().optional()}).optional(),geometry:Ue.object({hoverColor:Ue.string().optional()}).optional(),backgroundColor:Ue.string().optional(),backgroundAlpha:Ue.number().optional(),multiFloorView:Ue.object({spacesOpenToBelowVisualEffectEnabled:Ue.boolean().optional(),spacesOpenToBelowVisualEffectDarkenAmount:Ue.number().min(0).max(1).optional(),spacesOpenToBelowVisualEffectDarkenUseDepth:Ue.boolean().optional(),spacesOpenToBelowVisualEffectDesaturateAmount:Ue.number().min(0).max(1).optional(),spacesOpenToBelowVisualEffectDesaturateUseDepth:Ue.boolean().optional(),spacesOpenToBelowVisualEffectWashOutAmount:Ue.number().min(0).max(1).optional(),spacesOpenToBelowVisualEffectWashOutUseDepth:Ue.boolean().optional()}).optional()});f();var Ol=Xn(mh(),1);f();var Bn=null;function th(){if(Bn)return Bn;if(typeof OffscreenCanvas<"u")Bn=new OffscreenCanvas(1,1).getContext("2d");else if(typeof document<"u"){let o=document.createElement("canvas");o.width=1,o.height=1,Bn=o.getContext("2d")}return Bn}function xl(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function Cl(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}function _l(o){let e=th();if(!e)return[0,0,0];e.fillStyle=o,e.fillRect(0,0,1,1);let[t,r,n]=e.getImageData(0,0,1,1).data;return[xl(t/255),xl(r/255),xl(n/255)]}function oh(o){let e=Math.round(Math.min(1,Math.max(0,Cl(o[0])))*255),t=Math.round(Math.min(1,Math.max(0,Cl(o[1])))*255),r=Math.round(Math.min(1,Math.max(0,Cl(o[2])))*255);return"#"+(1<<24|e<<16|t<<8|r).toString(16).slice(1)}var q1=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,Q1=/^rgba?\(\s*\d+/,K1=/^hsla?\(\s*[\d.]+/;function Pl(o){if(o==null||typeof o!="string")return!1;if(q1.test(o)||Q1.test(o)||K1.test(o))return!0;let e=th();return e?(e.fillStyle="#000",e.fillStyle=o,e.fillStyle!=="#000000"||o.toLowerCase()==="black"||o==="#000"||o==="#000000"):!1}var eb=(o,e)=>{let t={},r=(n,i,a)=>{for(let s in i){let l=n[s],c=i[s];typeof c=="object"&&!Array.isArray(c)&&c!==null&&typeof l=="object"&&!Array.isArray(l)&&l!==null?(a[s]={},r(l,c,a[s])):a[s]=l}};return r(o,e,t),t},rh=(o,e)=>{let t=eb(o,e),r=(0,Ol.default)({},t,e),n=(0,Ol.default)({},t),i=(a,s,l,c=n)=>{for(let p in s){let h=a[p],g=s[p];if(typeof g=="number"&&typeof h=="number")c[p]=h+(g-h)*l;else if(typeof g=="string"&&typeof h=="string"){if(Pl(h)&&Pl(g)){let T=_l(h),I=_l(g);T&&I?c[p]=oh([T[0]+(I[0]-T[0])*l,T[1]+(I[1]-T[1])*l,T[2]+(I[2]-T[2])*l]):C.warn(`Color "${p}" could not be animated!`)}}else typeof g=="object"&&g!==null&&typeof h=="object"&&h!==null?i(h,g,l,c[p]):C.warn(`Value "${p}" could not be animated!`)}};return a=>(a=Math.min(Math.max(a,0),1),a===0?o:a===1?r:(i(t,e,a),n))};f();function tb(o){return o.getContext("webgl2")||o.getContext("webgl")}function Dl(o){let e=tb(o);if(!e||o.width===0||o.height===0)return null;let t=e;t.PIXEL_PACK_BUFFER!==void 0&&t.bindBuffer(t.PIXEL_PACK_BUFFER,null);let r=new Uint8Array(o.width*o.height*4);e.readPixels(0,0,o.width,o.height,e.RGBA,e.UNSIGNED_BYTE,r);let n=document.createElement("canvas");n.width=o.width,n.height=o.height;let i=n.getContext("2d");if(!i)return null;let a=new ImageData(o.width,o.height);for(let s=0;s<o.height;s++)for(let l=0;l<o.width;l++){let c=((o.height-s-1)*o.width+l)*4,p=(s*o.width+l)*4;a.data[p]=r[c],a.data[p+1]=r[c+1],a.data[p+2]=r[c+2],a.data[p+3]=r[c+3]}return i.putImageData(a,0,0),n}async function nh(o,e=1e3){let t=null,r=new Promise(a=>{t=()=>{let s=o.getCanvas();a(s?Dl(s):null)},o.once("render",t),o.triggerRepaint()}),n=new Promise(a=>setTimeout(()=>a(null),e)),i=await Promise.race([r,n]);return i===null&&t&&o.off("render",t),i}function wl(o,e="labels"){let t=o.getContext("2d");if(!t)return null;try{let r=t.getImageData(0,0,o.width,o.height),n=document.createElement("canvas");n.width=o.width,n.height=o.height;let i=n.getContext("2d");return i?(i.putImageData(r,0,0),n):null}catch{let n=e==="overlay"?"HTML overlay canvas is tainted and cannot be included in screenshot. This may occur if overlay content contains cross-origin images without proper CORS headers.":"Labels canvas is tainted and cannot be included in screenshot. This may occur if labels contain cross-origin images without proper CORS headers.";return C.warn(n),null}}var Vn=class{#e;#t;#o;Camera;Labels;Text3D;Markers;Image3D;Models;Paths;Exporter;Navigation;Style;Shapes;Outdoor;constructor(e){this.#e=new Mt,this.#o=e;let t=new Nn(e,this,this.#e);this.#t=t,this.Camera=this.#t.Camera,this.Markers=this.#t.Markers,this.Models=this.#t.Models,this.Labels=this.#t.Labels,this.Text3D=this.#t.Text3D,this.Exporter=this.#t.Exporter,this.Paths=this.#t.Paths,this.Navigation=this.#t.Navigation,this.Shapes=this.#t.Shapes,this.Style=this.#t.Style,this.Outdoor=this.#t.Outdoor,this.Image3D=this.#t.Image3D,this.#o.container.dataset.version=S.env.npm_package_version,this.Debug=new sa(this.#t.core)}updateState(e,t){return this.#t.updateState(e,t)}animateState(e,t,r){let n=this.#t.getState(e);if(n==null)return C.warn(`Cannot animate state of ${e}.`),new Promise(c=>c({result:"completed"}));let i=rh(n,t),a=this.#t.tween({percent:0}).to({percent:1},r?.duration??1e3).onUpdate(({percent:l})=>{this.#t.updateState(e,i(l))});r?.easing&&r.easing in Ko&&a.easing(Ko[r.easing]);let s=new Promise(l=>{a.onComplete(()=>{this.#t.removeTween(a),l({result:"completed"})}).onStop(()=>{this.#t.removeTween(a),l({result:"cancelled"})}),a.start()});return s.cancel=()=>{a.stop(),this.#t.updateState(e,i(0))},s}updateGlobalState(e){try{eh.parse(e)}catch(t){C.error("updateGlobalState",t);return}if(typeof e=="object"){let t={};if(e.text3d?.hoverColor&&(t.text3dHoverColor=e.text3d.hoverColor),e.geometry?.hoverColor&&(t.hoverColor=e.geometry.hoverColor),e.backgroundColor||e.backgroundAlpha!==void 0){let r=e.backgroundColor??this.#t.core.backgroundColor,n=e.backgroundAlpha??this.#t.core.backgroundAlpha;this.#t.core.setBackgroundColor(r,n)}e.environment!=null&&this.#t.core.setEnvironment(e.environment),e.multiFloorView!=null&&this.#t.currentMap.updateMultiFloorViewEffects(e.multiFloorView),this.#t.core.setState(t),this.#e.publish("global-state-change")}}get options(){return ip(this.#t.currentMap.options)}getGlobalState(){let e=this.#t.core.getState();return{backgroundColor:this.#t.core.backgroundColor,backgroundAlpha:this.#t.core.backgroundAlpha,environment:this.#t.core.getEnvironment(),geometry:{hoverColor:e.hoverColor},text3d:{hoverColor:e.text3dHoverColor},multiFloorView:this.#t.currentMap.getMultiFloorViewEffects()}}update=()=>{this.#t.core.render()};getMapData(){if(this.#t.mapData==null)throw new Oe("MapData not found.");return this.#t.mapData}getDimensions(){return{width:this.#o.canvasWidth,height:this.#o.canvasHeight}}addMap(e,t){return this.#t.addMap(e,t)}setFloor(e,t){return this.#t.setFloor(e,t?.context)}setFloorStack(e,t){return this.#t.setFloorStack(e,t?.context)}preloadFloors(e){this.#t.preloadFloors(e)}tween(e){return this.#t.tween(e)}removeTween(e){this.#t.removeTween(e)}get tweenGroup(){return this.#t.tweenGroup()}get currentFloorStack(){return this.#t.currentFloorStack}get currentFloor(){return this.#t.currentFloor}updateWatermark(e){this.#t.updateWatermark(e)}getState(e){return this.#t.getState(e)}getFloorStackAltitudeData(e){let t=typeof e=="string"?e:e.id;return this.#t.getFloorStackAltitudeData(t)}__EXPERIMENTAL__getRenderedState(e){return this.#t.__EXPERIMENTAL__getRenderedState(e)}setHoverColor(e){this.#t.setHoverColor(e)}getHoverColor(){return this.#t.getHoverColor()}convertAltitudeToMercatorZoomLevel(e){return this.#t.core.getSystems().cameraSystem.convertAltitudeToZoomLevel(e)}convertMercatorZoomLevelToAltitude(e){return this.#t.core.getSystems().cameraSystem.convertZoomLevelToAltitude(e)}isInView(e){return this.#t.isInView(e)}getInView(e,t){return this.#t.getInView(e,t)}getMetersPerPixel(){return this.#t.core.getMetersPerPixel()}__LEGACY_GET_DIRECTIONS_SYNC=(e,t,r)=>this.#t.getMapData()?.__LEGACY_GET_DIRECTIONS_SYNC(e,t,r)??void 0;getDirections=(e,t,r)=>this.#t.getMapData()?.getDirections(e,t,r)??Promise.resolve(void 0);__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC=(e,t,r)=>this.#t.getMapData()?.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(e,t,r)??void 0;getDirectionsMultiDestination=(e,t,r)=>this.#t.getMapData()?.getDirectionsMultiDestination(e,t,r)??Promise.resolve(void 0);getDistance(e,t){return this.#t.getMapData()?.getDistance(e,t)}createCoordinate(e,t,r){return typeof e=="object"?new H(e):new H(e,t,r?.id)}createCoordinateFromScreenCoordinate(e,t,r){return this.#t.createCoordinateFromScreenCoordinate(e,t,r)}getScreenCoordinateFromCoordinate(e){return this.#t.getScreenCoordinateFromCoordinate(e)}__EXPERIMENTAL__auto(e){return this.#t.__EXPERIMENTAL__auto(e)}on=(e,t)=>{this.#e.on(e,t)};off=(e,t)=>{this.#e.off(e,t)};get __core(){if(S.env.INTERNAL==="true")return this.#t.core;throw new Error("__core is not available.")}get container(){return this.#o.container}publishAllState(){this.#t.publishAllState()}clear(){this.#t.clear()}destroy(){this.#e.publish("destroy"),this.#e.destroy(),this.#t.destroy()}async enableDebug(e={}){let{Inspector:t}=await import("./inspector-2HI72MBL.js");await new t(this,this.#t).enable(e)}Debug;async takeScreenshot(e){let t={withOutdoorContext:e?.withOutdoorContext??!1,withLabels:e?.withLabels??!1,captureMarkers:e?.captureMarkers},r=this.#o.rendererDomElement,n=this.#o.map,i=!1,a=!1,s=[];if(this.Outdoor.enabled&&this.Outdoor.visible&&!t.withOutdoorContext&&(this.Outdoor.hide(),i=!0,n)){let l=null;n.triggerRepaint(),await Promise.race([new Promise(p=>{l=()=>p(),n.once("render",l)}),new Promise(p=>setTimeout(p,1e3))])===void 0&&l&&n.off("render",l)}if(this.Outdoor.enabled&&t.withOutdoorContext&&!this.Outdoor.visible){if(n){let l=n.getStyle()?.layers;l&&(s=l.filter(c=>n.getLayoutProperty(c.id,"visibility")!=="none").map(c=>c.id))}if(this.Outdoor.show(),a=!0,n){let l=null;n.triggerRepaint(),await Promise.race([new Promise(p=>{l=()=>p(),n.once("render",l)}),new Promise(p=>setTimeout(p,1e3))])===void 0&&l&&n.off("render",l)}}try{let l=document.createElement("canvas"),c=l.getContext("2d",{willReadFrequently:!0});if(l.width=r.width,l.height=r.height,!c)throw new Error("Failed to get 2D context");if(t.withOutdoorContext&&n){if(!n.loaded()){let g=null;await Promise.race([new Promise(I=>{g=()=>I(),n.once("idle",g)}),new Promise(I=>setTimeout(I,5e3))])===void 0&&g&&n.off("idle",g)}let h=await nh(n);h&&c.drawImage(h,0,0,l.width,l.height)}await this.#o.renderSync();let p=Dl(r);if(p&&c.drawImage(p,0,0,l.width,l.height),t.withLabels){let h=this.#o.labelsCanvas;if(h){let g=wl(h);g&&c.drawImage(g,0,0,l.width,l.height)}}if(t.withLabels&&t.captureMarkers){let h=this.#o.container;if(h)for(let g=0;g<h.children.length;g++){let T=h.children[g],I=T.classList.contains("mappedin-2d-entities");if(!(T.tagName==="CANVAS"||T.offsetWidth===0||T.offsetHeight===0||!I))try{let E=await t.captureMarkers(T),D=wl(E,"overlay");D&&D.width>0&&D.height>0&&c.drawImage(D,0,0,l.width,l.height)}catch(E){C.warn(`Overlay layer capture failed: ${E instanceof Error?E.message:String(E)}. Continuing with other layers.`)}}}try{return l.toDataURL("image/png")}catch(h){if((h instanceof Error?h.name:h?.name)==="SecurityError"||h?.message?.includes("tainted")||h?.message?.includes("security")){let E=h instanceof Error?`Screenshot failed due to security restrictions: ${h.message}`:"Screenshot failed due to security restrictions. Ensure all images have proper CORS headers.";throw new Oe(E)}let I=h instanceof Error?`Screenshot failed: ${h.message}`:"Screenshot failed due to an unknown error.";throw new Oe(I)}}finally{i&&this.Outdoor.show(),a&&this.Outdoor.hide(s)}}get manualFloorVisibility(){return this.#t.manualFloorVisibility}set manualFloorVisibility(e){this.#t.manualFloorVisibility=e}getOptimalVisualDistanceBetweenFloors(e){return this.#t.getOptimalVisualDistanceBetweenFloors(e)}get __INTERNAL__hidePathsNotOnCurrentFloor(){return this.#t.hidePathsNotOnCurrentFloor}set __INTERNAL__hidePathsNotOnCurrentFloor(e){this.#t.hidePathsNotOnCurrentFloor=!!e}registerPlugin(e){C.warn("registerPlugin is super experimental and may change or be removed without notice."),this.#o.registerPlugin(e)}unregisterPlugin(e){this.#o.unregisterPlugin(e)}};f();var ih=(o,{id:e}={})=>{let t=Array.isArray(o)?o:[o];if(!t.every(i=>typeof i=="string"))return;let r=t.join(""),n=null;if(e){let i=document.getElementById(e);i instanceof HTMLStyleElement&&(n=i)}n==null&&(n=document.createElement("style")),e&&e!==""&&(n.id=e),n.textContent=r,document.head.appendChild(n)};f();var ob=1e3*60*60*2,kr=class{#e=new Mt;#t;#o;#r;#i;#n;#s;#c;#a;constructor(e,t){this.#t=e,this.#o=t}#l=()=>{"key"in this.#o&&"secret"in this.#o&&this.#u(),this.#f()};#d(e){let t=e.token!==this.#n?.token;this.#n=e,t&&this.#e.publish("access-token-refreshed",{accessToken:e})}#h(e){let t=JSON.stringify(e.tokens)!==JSON.stringify(this.#s?.tokens);this.#s=e,t&&this.#e.publish("sas-tokens-refreshed",{sasTokens:e.tokens})}async#u(e=!1){if("accessToken"in this.#o&&typeof this.#o.accessToken=="string"){let t={token:this.#o.accessToken,expires:Date.now()+72e5};return this.#n=t,t}if(!("key"in this.#o)||!("secret"in this.#o)||typeof this.#o.key!="string"||typeof this.#o.secret!="string")throw new Error("No API keys or access token provided!");return this.#r!=null?this.#r:this.#n!=null&&this.#n.expires!=null&&this.#n.expires>Date.now()&&!e?this.#n:(this.#r=Wr({...this.#o,key:this.#o.key,secret:this.#o.secret},this.#o.enterprise??!1).then(t=>{let r={token:t.accessToken,expires:t.expiresTimestamp*1e3};return this.#d(r),r}).catch(t=>{throw t}).finally(()=>{this.#r=void 0}),this.#r)}async#f(e=!1){return this.isEnterpriseMode()?{tokens:{},expires:1/0}:this.#i!=null?this.#i:this.#s!=null&&this.#s.expires>Date.now()&&!e?this.#s:(this.#i=new Promise((t,r)=>{this.#u().then(n=>{let i={},a=this.#t.map(s=>Ca({...this.#o,mapId:s},n.token).then(l=>{i[s]={token:l.token,expires:l.expires}}).catch(l=>{C.error(`Error getting SAS token for map ${s}:`,l)}));Promise.all(a).then(()=>{let s={tokens:i,expires:Math.min(...Object.values(i).map(l=>l.expires??1/0))};this.#h(s),t(s)})}).catch(n=>{r(n)})}),this.#i.catch(t=>{throw t}).finally(()=>{this.#i=void 0}),this.#i)}#p(e){if(!("key"in this.#o)||!("secret"in this.#o))return;let t=e.expires!=null?e.expires-Date.now():ob;isFinite(t)&&(this.#c=setTimeout(()=>{this.#u(!0).then(r=>{this.#p(r)})},t-Ac))}#m(e){let t=e.expires-Date.now();isFinite(t)&&(this.#a=setTimeout(()=>{this.#f(!0).then(r=>{this.#m(r)})},t-Rc))}#y(){this.#c!=null&&clearTimeout(this.#c),this.#a!=null&&clearTimeout(this.#a)}setMapIds(e){this.#t=e}setEnterprise(e){this.#o.enterprise=e}async readySync(){if((!("key"in this.#o)||!("secret"in this.#o))&&!("accessToken"in this.#o)){C.error("No API keys or access token provided! Cannot preload tokens.");return}let e=[this.#u(),null];this.#o.enterprise||(e[1]=this.getSasTokensAsync());let[t,r]=await Promise.all(e);this.#y(),this.#p(t),r!=null&&this.#m(r),Vr()&&globalThis.addEventListener?.("focus",this.#l)}async refreshing(){let e=[];return this.#r!=null&&e.push(this.#r),this.#i!=null&&e.push(this.#i),Promise.all(e)}getAccessTokenAsync(){return this.#u()}getSasTokensAsync(){return this.#f()}getAccessToken(){return this.#n==null?(C.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):this.#n}getSasToken(e){return this.isEnterpriseMode()?(C.error("SAS tokens are not available in the enterprise mode!"),{token:""}):this.#s==null?(C.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):e in this.#s.tokens?this.#s.tokens[e]:(C.error(`SAS token for map ${e} not found!`),{token:""})}isEnterpriseMode(){return this.#o.enterprise??!1}on=(e,t)=>this.#e.on(e,t);off=(e,t)=>this.#e.off(e,t);destroy(){this.#y(),this.#e.destroy(),Vr()&&globalThis.removeEventListener("focus",this.#l)}};f();var rb=async(o,e)=>{let t=("mvfVersion"in(e??{})?e?.mvfVersion:void 0)??("options"in o&&"version"in(o.options??{})?o.options?.version:void 0),r={prefetchTokens:!0,...e||{},mvfVersion:t},n,i,a=To();a.updateByUserOption(r);let s={};if("type"in o&&typeof o.type=="string"){if(o.type==="binary"&&o.main instanceof Uint8Array){let A=await ri(o.main,r.mvfVersion);n=A.mvf2,i=A.mvf3,s.languagePacks=[];for(let U of o.languagePacks??[])U.localePack instanceof Uint8Array&&s.languagePacks.push({language:U.language,localePack:await ir(U.localePack)})}else if(o.type==="json")n=o.main,i=o.options?.mvf3,s.languagePacks=o.languagePacks??[];else throw new Error("Invalid backup type");o.type==="binary"&&o.main instanceof Uint8Array&&(s.binaryBundle=o.main);let x=n.enterprise!=null;o.options?.enterprise!==void 0&&(x?C.warn('The "enterprise" option in hydrateMapData is deprecated and ignored. Enterprise mode is now automatically detected from the MVF data.'):C.warn('The "enterprise" option in hydrateMapData is deprecated and will be removed in a future release. Please ensure your MVF bundle includes enterprise data for automatic detection.')),s.enterprise=x||(o.options?.enterprise??!1)}else n=o,s.enterprise=n.enterprise!=null;s.mvf3=i;let l="key"in r&&"secret"in r,c="accessToken"in r&&r.accessToken;l&&Fc(r.key)&&(s.enterprise=!1),a.setEnterprise(s.enterprise??!1);let p=oi(n),h=p.length>0?p:[r.mapId];r.baseAuthUri=a.getBaseAuthUri();let g=new kr(h,{...r,enterprise:s.enterprise}),T;if(c)T=r.accessToken;else if(l){let x;try{x=await g.getAccessTokenAsync()}catch(A){C.error("Failed getting token during hydrateMapData",A)}T=x?.token||""}if(s.outdoorViewToken=T,s.env=a,s.getMapDataOptions=r,s.tokenManager=g,r.prefetchTokens&&(l||c))try{await g.readySync()}catch(x){C.error("Failed to ready token manager!",x)}an()&&(s.enterprise&&C.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),r.mvfVersion!=="3.0.0"&&C.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let I=new Vo(n,s);T&&I.Analytics.init({accessToken:T,mapId:r.mapId,key:"key"in r?r.key:void 0,secret:"secret"in r?r.secret:void 0,enterprise:s.enterprise??!1,...r.analytics,baseUri:a.getAnalyticsBaseUri(),context:r.analytics?.context});let E=new Ur(I),D=I.findPreferredLanguage({languageCode:r.language,fallbackToNavigatorLanguage:!1});if(D)try{await E.changeLanguage(D.code)}catch{}return typeof e?.onMVFParsed=="function"&&e.onMVFParsed(n),E};var ah=`:root {
|
|
296
|
+
</svg>`},H1=/<svg([^>]*)>/g;function Xf(o,e,t){let r=U1[o];return r?r.replace(H1,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${e}; width:${t}px; height:${t}px">`):null}function W1(o){return zf.sanitize(o,{USE_PROFILES:{svg:!0}})}function z1(o,e){let n=new DOMParser().parseFromString(o,"image/svg+xml").documentElement;return n==null||n.tagName==="parsererror"||n.tagName.toLowerCase()!=="svg"?(C.error("Failed to parse SVG",{svg:o,tagName:n?.tagName}),o):(e!=null&&(n.setAttribute("color",e),n.querySelectorAll("*").forEach(s=>{(s.getAttribute("fill")!=null||s.tagName==="path")&&s.getAttribute("fill")!=="none"&&s.setAttribute("fill","currentColor"),s.getAttribute("stroke")!=null&&s.getAttribute("stroke")!=="none"&&s.setAttribute("stroke","currentColor")})),new XMLSerializer().serializeToString(n))}async function $f(o,e){let t="";try{if(o.trim()==="")throw new Error("URL is empty!");e?.style==="fill"&&(o=o.replace(".svg","-fill.svg"));let r=await ht()(o),n=r.headers.get("content-type");if(n?.includes("image/svg+xml")){let i=await r.text();return t=W1(i),e?.color!=null&&(t=z1(t,e.color)),{icon:t,type:"svg"}}else{if(n?.includes("image"))return{icon:o,type:"image"};throw new Error(`Expected SVG or Image content, but received: ${n}`)}}catch(r){return C.error(`Failed to fetch icon from ${o}.`,r),null}}f();function Yf(o){return o.locationProfiles.some(e=>e.categories.some(t=>t.name.includes("Restroom")))}function Zf(o){return o.locationProfiles.some(e=>e.categories.some(t=>t.name.includes("Parking")))}var qf=new Set(["connection","point-of-interest","space","object","door","facade"]),zo={default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F",parking:"#418425",door:"#A0552C"},Fr={elevator:"connection-elevator-12x12",escalator:"connection-stairs-12x12",stairs:"connection-stairs-12x12",point:"point-of-interest-12x12",door:"door-12x12",building:"building-12x12",ladder:"ladder-12x12"};function X1(o){let e=null;if(ze.is(o))switch(o.type){case"elevator":e=Fr.elevator;break;case"ladder":e=Fr.ladder;break;case"escalator":case"stairs":default:e=Fr.stairs}else yt.is(o)?e=Fr.point:et.is(o)?e=Fr.door:Ve.is(o)&&(e=Fr.building);return e!=null?Xf(e,"#FFFFFF",12):null}function Jf(o){return ze.is(o)?zo.connection:Ve.is(o)?zo.default:Yf(o)?zo.washroom:Zf(o)?zo.parking:yt.is(o)?zo.point:et.is(o)?zo.door:zo.default}async function $1(o,e){let t=null,r="locationProfiles"in o?o.locationProfiles.find(n=>n.icon!=null)?.icon:null;if(r?.url!=null&&(t=await $f(r.url,{color:e.color,style:"fill"})),t==null){let n=X1(o);n!=null&&(t={icon:n,type:"svg"})}return t}function Y1(o){return ze.is(o)||et.is(o)?"low":yt.is(o)||Ve.is(o)?"high":"medium"}async function Z1(o){let e={appearance:{color:Jf(o),pinOutlineColor:Jf(o),iconPadding:8,iconSize:24,textSize:12.5,iconScale:{on:"zoom-level",input:[18,20],output:[.7,1]}},rank:Y1(o),interactive:!0},t=await $1(o,{color:"#FFFFFF"});return t!=null&&(e.appearance.icon=t.icon,t.type==="svg"?Ve.is(o)&&(e.appearance.iconSize=30,e.appearance.iconPadding=10):t.type==="image"&&(e.appearance.iconSize=48,e.appearance.iconPadding=2,e.appearance.pinOutlineColor="#FFFFFF",e.rank="high")),e}async function Qf(o,e){return(await Promise.all(e.map(async r=>{let n=[];if(!lo(r))return n;let i=await Z1(r);return ze.is(r)?n=r.coordinates.map(a=>o.Labels.add(a,r.name,i)):Ve.is(r)?r.spaces.length>0&&r.floorStack.name!=null&&r.floorStack.name!==""&&n.push(o.Labels.add(r.spaces[0],r.floorStack.name,i)):Pf(r)&&$a(r)&&n.push(o.Labels.add(r,r.name,i)),n}))).flat()}async function Kf(o,e){let t=o.getMapDataInternal();if(!t)throw new Error("Map data not found");let r=t.getAllOfTypes(qf,e),n=t.getAllOfTypes(Mf,e),i=t.getAllOfTypes(Cf,e),[a,s]=await Promise.all([r.length>0?Qf(o,r):[],n.length>0?xf(o,n):[],i.length>0?_f(o,i):[]]);return{labels:a,markers:s}}var aa=.05,Nn=class extends Mt{core;mapObjects=[];id;mapDataExternal={};mapsByFloorId={};mapData;currentMap;hiddenOutdoorGeometries=[];lastFacadeIntersected;#e=!1;#t=!1;mapView;externalPubSub;get manualFloorVisibility(){return this.#e}set manualFloorVisibility(e){this.#e=e,this.externalPubSub.publish("state-change-internal",{manualFloorVisibility:e})}get hidePathsNotOnCurrentFloor(){return this.#t}set hidePathsNotOnCurrentFloor(e){this.#t=e,this.currentMap?.updateOutdoorPathLayerVisibility()}Camera;Labels;Text3D;Markers;Models;Paths;Exporter;Navigation;Outdoor;Shapes;Style;Image3D;constructor(e,t,r){super(),this.core=e,this.mapView=t,this.externalPubSub=r,this.Camera=new fn(this),this.id=this.core.addGroupContainer("root").id.toString();let n=new Tn("outdoors-container",void 0,void 0,this);this.mapObjects.push(n),this.currentMap=n,this.core.on("pre-render",()=>{r.publish("pre-render")},{signal:this.signal}),this.core.on("post-render",()=>{r.publish("post-render")},{signal:this.signal}),this.core.on("resize",()=>{r.publish("resize")},{signal:this.signal}),this.core.on("render-error",({error:c})=>{r.publish("render-error",{error:new Wl(c instanceof Error?c.message:"Unknown error")})},{signal:this.signal});let i=c=>{let p=c;c.startsWith(Jr)&&c.endsWith("-merged")&&(p=c.slice(Jr.length,-7));let h=this.getMapDataObject(p);switch(h?.__type){case"facade":return h;case"floor":return h.floorStack.facade;default:return null}};this.core.on("geometry-in-focus",c=>{let p=new Set;for(let h of c){let g=i(h);g&&p.add(g)}r.publish("facades-in-view-change",{facades:Array.from(p)})},{signal:this.signal}),this.core.getSystems().renderSystem.on("camera-state-change",()=>{r.publish("state-change-internal",{Camera:this.getCameraState()})},{signal:this.signal});let a=new sn(this.Camera,{precision:7});this.core.on("camera-change",()=>{r.publish("camera-change",a)},{signal:this.signal}),this.core.on("pan-bounds-change",c=>{r.publish("camera-bounds-change",ui(c,this.core.convert3DMapPositionToCoordinate))},{signal:this.signal}),this.core.camera.on("padding-change",({padding:c})=>{r.publish("camera-screen-offsets-change",c)},{signal:this.signal});let s=c=>p=>{let h=[],g=[],T=[],I=[],E=[];p.labels.forEach(L=>{let j=this.Labels.getById(L.toString());j&&h.push(j.label)}),p.markers.forEach(L=>{let j=this.Markers.getById(L.toString())||this.Navigation.getMarkerById(L.toString());j&&g.push(j.marker)}),p.models.forEach(L=>{let j=this.Models.getById(L.toString());j&&T.push(j.model)}),p.images.forEach(L=>{let j=this.Image3D.getById(L.toString());j&&I.push(j.image)}),p.paths.forEach(L=>{let j=this.Paths.getById(L.toString())||this.Navigation.getPathById(L.toString());j&&!E.includes(j)&&E.push(j)});let D=p.geometry,x;D.length>0&&(x=D.map(L=>this.getMapDataInternal()?.getById("space",L)).filter(Boolean)[0],x||(x=D.map(L=>this.getMapDataInternal()?.getById("object",L)).filter(Boolean)[0]),x||(x=D.map(L=>this.getMapDataInternal()?.getById("area",L)).filter(Boolean)[0]),x||(x=D.map(L=>this.Shapes.getById(L)).filter(Boolean)[0]));let A=p.containers.reduce((L,j)=>{let te=this.getMapDataInternal()?.getById("floor",j);return te&&pt.is(te)&&L.push(te),L},[]),U,R=0;if(A.length>0){U=A[0].id;let L=this.core.getState(U);R=p.coordinate[2]?p.coordinate[2]-L.altitude:R}let B;this.lastFacadeIntersected&&this.lastFacadeIntersected.spaces.forEach(L=>{this.core.setState(L.id,{hovered:!1})}),x&&Ie.is(x)&&(B=D.map(L=>this.getMapDataInternal()?.facadesBySpaceId[L]).filter(Boolean)[0],B&&B.spaces.forEach(L=>{this.core.setState(L.id,{hovered:!0})})),this.lastFacadeIntersected=B;let V={coordinate:new H({latitude:p.coordinate[1],longitude:p.coordinate[0],floorId:U,verticalOffset:R}),spaces:x&&Ie.is(x)?[x]:[],objects:x&&dt.is(x)?[x]:[],areas:x&&Ct.is(x)?[x]:[],shapes:x&&uo.is(x)?[x]:[],markers:g,labels:h,models:T,images:I,paths:E,floors:A,facades:B?[B]:[]};"pointerEvent"in p&&(V.pointerEvent=p.pointerEvent),r.publish(c,V)};this.core.on("hover",s("hover"),{signal:this.signal}),this.core.on("click",s("click"),{signal:this.signal}),this.core.on("user-interaction-start",()=>{r.publish("user-interaction-start")},{signal:this.signal}),this.core.on("user-interaction-end",()=>{r.publish("user-interaction-end")},{signal:this.signal});let l={currentMapGetter:()=>this.currentMap,mapDataInternalGetter:()=>this.mapData?.internal};this.Markers=new vn(l),this.Models=new Sn(l),this.Labels=new gn(l),this.Text3D=new Cn(l),this.Exporter=new hn(l),this.Paths=new En(l),this.Navigation=new un(this),this.on("navigation-state-change",c=>{this.externalPubSub.publish("state-change-internal",{Navigation:c})}),this.on("navigation-connection-click",c=>{this.externalPubSub.publish("navigation-connection-click",c)}),this.on("navigation-active-path-change",c=>{this.externalPubSub.publish("navigation-active-path-change",c)}),this.Outdoor=new Cr(this.core,this.hiddenOutdoorGeometries),this.Outdoor.enabled&&(this.core.on("outdoor-view-loaded",()=>{r.publish("outdoor-view-loaded")},{signal:this.signal}),this.core.on("outdoor-style-loaded",()=>{r.publish("outdoor-style-loaded")},{signal:this.signal})),this.Image3D=new In(l),this.Shapes=new Mn(l),this.Style=new xn(l)}preloadFloors(e){e.forEach(t=>{t instanceof pt&&this.core.setState(t.id,{preloadGeometry:!0})})}updateState(e,t){if(t==null||typeof t!="object")return;let r=this.currentMap.options?.disableUpdateStateValidation??!1;if(e==="interior-walls"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(Ee);if(a){let s=a.layers.get(So);s&&this.core.hasState(s)&&this.core.setState(s,qs(se(Js,t,{warn:!0,disableValidation:r}),this.core.getState(s)))}});return}if(e==="exterior-walls"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(Ee);if(a){let s=a.layers.get(eo);s&&this.core.hasState(s)&&this.core.setState(s,qs(se(Js,t,{warn:!0,disableValidation:r}),this.core.getState(s)))}});return}if(e==="interior-doors"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(Ee),s=i.layers.get(pr);if(!a)return;let l=a.layers.get(lr);if(!l||!this.core.hasState(l))return;let c=Gs(se(Pi,t,{warn:!0,disableValidation:r}),this.core.getState(l));Object.keys(c.featureCollection).length>0&&this.core.setState(l,c.featureCollection),s&&Object.keys(c.container).length>0&&this.core.setState(s.containerId,c.container)});return}if(e==="exterior-doors"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(Ee),s=i.layers.get(dr);if(!a)return;let l=a.layers.get(cr);if(!l||!this.core.hasState(l))return;let c=Gs(se(Pi,t,{warn:!0,disableValidation:r}),this.core.getState(l));Object.keys(c.featureCollection).length>0&&this.core.setState(l,c.featureCollection),s&&Object.keys(c.container).length>0&&this.core.setState(s.containerId,c.container)});return}let n=typeof e=="string"?this.getMapDataObject(e):e;if(n){if(n.__type!==_t.__type&&!this.core.hasState(n.id)){C.warn(`Failed to update state for "${n.id}". No ${n.__type} found with that ID.`);return}if(po.is(n))return this.core.setState(n.id,fu(se(du,t,{warn:!0,disableValidation:r}),this.core.getState(n.id)));if(ro.is(n))return this.core.setState(n.id,mu(se(hu,t,{warn:!0,disableValidation:r}),this.core.getState(n.id)));if(Ie.is(n)||dt.is(n)){let i=this.core.getState(n.id);i!=null&&this.core.setState(n.id,pu(se(Ws,t,{warn:!0,disableValidation:r}),i))}if(Ct.is(n)&&this.core.setState(n.id,se(Ws,t,{warn:!0,disableValidation:r})),mt.is(n)&&this.core.setState(n.id,se(_u,t,{warn:!0,disableValidation:r})),et.is(n)&&this.core.setState(n.id,Bd(se(Pi,t,{warn:!0,disableValidation:r}),this.core.getState(n.id))),uo.is(n)){let i=Tu(se(Ys,t,{warn:!0,disableValidation:r}));i.mergedShapeState&&this.core.setState(n.id,i.mergedShapeState)}if(jo.is(n)){let{position:i,scale:a,rotation:s,...l}=se(Du,t,{warn:!0,disableValidation:r}),c=l;i&&(c.position=[i.longitude,i.latitude,i.verticalOffset]),a!=null&&(Array.isArray(a)?c.scale=a:c.scale=[a,a,a]),s!=null&&(Array.isArray(s)?c.rotation=s:c.rotation=[s,s,s]),i&&n.updateTarget(i),this.core.setState(n.id,c)}if(pt.is(n)){let i=this.currentMap.floorsById.get(n.id);if(i==null)return;let a=se(au,t,{warn:!0,disableValidation:r});this.core.setState(n.id,a);let s=i.layers.get(Ee);if(s!=null&&"geometry"in t&&t.geometry){this.core.setState(s.containerId,se(qd,t.geometry,{warn:!0,disableValidation:r}));for(let E of s.layers.keys())this.core.setState(s.layers.get(E),{maskId:t.geometry.maskId??void 0,maskEffect:t.geometry.maskEffect??void 0,maskMode:t.geometry.maskMode??void 0,maskEnabled:t.geometry.maskEnabled??void 0,effectStart:t.geometry.effectStart??void 0,effectDistance:t.geometry.effectDistance??void 0,darkenAmount:t.geometry.darkenAmount??void 0,darkenUseDepth:t.geometry.darkenUseDepth??void 0,desaturateAmount:t.geometry.desaturateAmount??void 0,desaturateUseDepth:t.geometry.desaturateUseDepth??void 0,washOutAmount:t.geometry.washOutAmount??void 0,washOutUseDepth:t.geometry.washOutUseDepth??void 0})}let l=i.layers.get(to);if(l!=null&&"labels"in t&&t.labels){let E=se(Qd,t.labels,{warn:!0,disableValidation:r});"enabled"in E&&typeof E.enabled=="boolean"&&l.setVisible(E.enabled)}let c=i.layers.get(jt);if(c!=null&&"markers"in t&&t.markers){let E=se(Kd,t.markers,{warn:!0,disableValidation:r});"enabled"in E&&typeof E.enabled=="boolean"&&c.setVisible(E.enabled)}if(i.footprintObject&&"footprint"in t&&t.footprint){let E=se(Uo,t.footprint,{warn:!0,disableValidation:r});i.footprintObject.update({altitude:E.altitude,visible:E.visible,height:E.height,opacity:E.opacity,side:E.side,color:E.color,ceilingVisible:E.ceilingVisible,ceilingThickness:E.ceilingThickness,basementMaskEnabled:E.basementMaskEnabled,outline:E.outline})}if(i.gapFootprintObject&&"visible"in t){let E={visible:t.visible};if("footprint"in t&&t.footprint){let D=se(Uo,t.footprint,{warn:!0,disableValidation:r});D.color!==void 0&&(E.color=D.color),D.opacity!==void 0&&(E.opacity=D.opacity),D.outline!==void 0&&(E.outline=D.outline)}i.gapFootprintObject.update(E)}let p=i.layers.get(Lo);if(p!=null&&"occlusion"in t&&t.occlusion){let E=se(tu,t.occlusion,{warn:!0,disableValidation:r});"enabled"in E&&typeof E.enabled=="boolean"&&p.setVisible(E.enabled)}let h=i.layers.get(ur);if(h!=null&&"images"in t&&t.images){let E=se(eu,t.images,{warn:!0,disableValidation:r});if("visible"in E&&typeof E.visible=="boolean"&&h.setVisible(E.visible),"collisionsEnabled"in E&&typeof E.collisionsEnabled=="boolean"&&s!=null)for(let D of s.layers.values()){let x=this.core.getState(D);if(x?.children)for(let A of x.children)this.core.setState(A,{enableImageCollisions:E.collisionsEnabled})}}let g=i.layers.get(oo);if(g!=null&&"paths"in t&&t.paths!=null){let E=se(ou,t.paths,{warn:!0,disableValidation:r});E.visible!=null&&typeof E.visible=="boolean"&&g.setVisible(E.visible)}let T=i.layers.get(Ro);if(T!=null&&"areas"in t&&t.areas!=null){let E=se(ru,t.areas,{warn:!0,disableValidation:r});E.visible!=null&&typeof E.visible=="boolean"&&T.setVisible(E.visible)}let I=i.layers.get(Gt);if(I!=null&&"models"in t&&t.models!=null){let E=se(iu,t.models,{warn:!0,disableValidation:r});E.visible!=null&&typeof E.visible=="boolean"&&I.setVisible(E.visible)}if("text3d"in t&&t.text3d!=null){let E=se(nu,t.text3d,{warn:!0,disableValidation:r});E.visible!=null&&i.setBatchedTextVisible(E.visible)}}if(Ve.is(n)){let i=this.core.getState(n.id);for(let a of i.children)a.type==="group-container"&&this.core.setState(a.id,se(jd,t,{warn:!0,disableValidation:r}))}if(fo.is(n)&&this.core.setState(n.id,se(Eu,t,{warn:!0,disableValidation:r})),_t.is(n)){let i=se(Bs,t,{warn:!0,disableValidation:r}),a=xr(i);for(let s of n.segments)this.core.setState(s.id,a)}if(xo.is(n)){let i=se(Bs,t,{warn:!0,disableValidation:r}),a=xr(i);this.core.setState(n.id,a)}}}getMapDataObject(e){return this.getMapDataInternal()?.getMapDataById(e)}update=()=>{this.core.render()};getMapDataInternal(){if(this.mapData)return Hr(this.mapData)}getMapData(){return this.mapData}addMap(e,t){return new Promise(r=>{let n;try{n=Hr(e)}catch(p){C.error("Error adding map",p),r(e);return}this.mapDataExternal[e.mapName]=e,this.mapData=e;let{mvf:i}=n,a=i["manifest.geojson"].features[0].geometry.coordinates;this.core.mode!=="outdoors-overlay"&&this.Camera.set({center:new H(a[1],a[0])});let s=i["manifest.geojson"].features[0].properties.name,l=new Tn(`mapObject-${s}`,n,t,this);this.currentMap=l,this.currentMap.loadAllFloors(),this.currentMap.setFloor(this.currentMap.startingFloorId),this.core.renderSync();let c=t?.outdoorView?.layersHiddenByGeometry??[];if(c.length>0){let p=[];for(let h of l.floorStacksById.values())h.isOutdoors===!1&&h.defaultFloor.footprint&&h.defaultFloor.footprint.geometry!=null&&h.defaultFloor.footprint.geometry?.coordinates.length>0&&p.push(h.defaultFloor.footprint);p.length>0&&(this.core.hideOutdoorLayersIntersectingPolygons(p,c),this.hiddenOutdoorGeometries.push([p,c]))}if(this.mapObjects.push(l),n.getMVFFeatureByType("floor").forEach(p=>{this.mapsByFloorId[p.id]=l}),l.on("floor-change-start",p=>{this.externalPubSub.publish("floor-change-start",{reason:p.reason,floor:this.getMapDataInternal()?.getById("floor",p.floorId)??this.currentFloor,previousFloor:this.getMapDataInternal()?.getById("floor",p.previousFloorId)??this.currentFloor})},{signal:this.signal}),l.on("floor-change",p=>{this.externalPubSub.publish("floor-change",{reason:p.reason,floor:this.currentFloor,previousFloor:this.getMapDataInternal()?.getById("floor",p.previousFloorId)??this.currentFloor}),this.externalPubSub.publish("state-change-internal",{currentFloor:this.currentFloor,currentFloorStack:this.currentFloorStack})},{signal:this.signal}),t?.zoomLevel!=null)this.core.camera.setZoomLevel(t.zoomLevel),r(e);else if(this.core.mode!=="outdoors-overlay"&&this.currentFloor){let p=t?.screenOffsets??{top:aa*this.core.canvasHeight,left:aa*this.core.canvasWidth,right:aa*this.core.canvasWidth,bottom:aa*this.core.canvasHeight};this.Camera.focusOn(this.currentFloor,{duration:op,screenOffsets:p}).then(()=>{this.Camera.setElevation(this.currentFloor.elevation),r(e)})}else r(e)})}setFloor(e,t){return this.currentMap.setFloor(Yr(e),t)}setFloorStack(e,t){return this.currentMap.setFloorStack(Yr(e),t)}updateWatermark(e){this.core.updateWatermark(e)}get currentFloorStack(){let e=this.currentMap.currentFloorStack.id;if(!e)throw new Oe("Missing currentFloorStack.");let t=this.mapData?.getById("floor-stack",e);if(!t)throw new Oe("FloorStack was not found in map data.");return t}get currentFloor(){let e=this.currentMap.currentFloor.id;if(!e)throw new Oe("Missing currentFloor object from GeoJsonApi");let t=this.mapData?.getById("floor",e);if(!t)throw new Oe("Missing currentFloor");return t}getState(e){typeof e=="object"&&_t.is(e)&&C.warn("Cannot get state of a Path directly. Use getState() on individual segments within Path.segments[] instead.");let t=Ts(e,this),r=this.core.getState(t);if(r){if(["interior-walls","exterior-walls"].includes(e)&&r.type==="feature-collection")return Cu(r);if(["interior-doors","exterior-doors"].includes(e)&&r.type==="feature-collection"){let n=e==="interior-doors"?pr:dr,i;for(let a of this.currentMap.floors){let s=a.layers.get(n);if(!s)continue;let l=this.core.getState(s.containerId);if(l){i=l;break}}return Nd(r,i)}else{if(r.type==="geometry")return cu(r);if(r.type==="label"&&r.options.appearance&&r.options.rank!==void 0&&r.options.interactive!==void 0)return uu(r);if(r.type==="marker"&&r.options?.rank!==void 0&&r.options.interactive!==void 0)return gu(r,this.Markers.getById(r.id.toString())?.marker);if(r.type==="model")return wu(r);if(r.type==="image")return Pu(r);if(r.type==="text3d")return Mu(r);if(r.type==="feature-collection"&&e&&typeof e!="string"&&uo.is(e))return bu(r);if(r.type==="path")return kd(r);if(r.type==="group-container"&&typeof e!="string"&&pt.is(e))return su(r,this.currentMap.floorsById.get(e.id),this.core);if(r.type==="group-container"&&r.children.length>0&&typeof e!="string"&&Ve.is(e)){let n=this.core.getState(r.children[0].id);return Gd(n)}}}}__EXPERIMENTAL__getRenderedState(e){let t=Ts(e,this);if(t)return this.core.getRenderedState(t)}setHoverColor(e){this.core.setState({hoverColor:e})}getHoverColor(){let e=this.core.getState();return e?.type==="map-view"?e.hoverColor:void 0}getFloorStackAltitudeData(e){return this.currentMap.getFloorStackAltitudeData(e)}createCoordinateFromScreenCoordinate(e,t,r){if(r!=null){let l=this.core.projectScreenXYToCoordinate(e,t,!0);return l?new H(l.coordinate[1],l.coordinate[0],r.id):void 0}let n=this.core.projectScreenXYToCoordinate(e,t);if(n==null||n.coordinate==null)return;let{coordinate:i,groupContainers:a}=n,s=a?.find(l=>{let c=l.userData.entityId.toString();return c.includes("f_")||c.includes("m_")})?.userData.entityId.toString();return new H(i[1],i[0],s)}getScreenCoordinateFromCoordinate(e){let t=0;if(e.floorId!=null){let r=this.mapData?.getById("floor",e.floorId);r!=null&&(t=this.getState(r)?.altitude??0)}return t+=e.verticalOffset,this.core.projectCoordinateToScreenXY([e.longitude,e.latitude,t])}isInView(e){return this.core.isInView(typeof e=="string"?e:e.id)}getInView(e,t){let r=this.core.queryGeometry2DInView({screenOffsets:t?.screenOffsets,fullyContains:t?.fullyContains});if(r.length===0)return[];let n=[];switch(e){case po.__type:n=r.map(i=>this.Labels.getById(i)).filter(i=>i!=null).map(i=>i.label);break;case ro.__type:n=r.map(i=>this.Markers.getById(i)).filter(i=>i!=null).map(i=>i.marker)}return n}async __EXPERIMENTAL__auto(e){return await Kf(this,e)}tween(e){let t=new ao(e);return this.core.getExternalTweenGroup().add(t),this.core.render(),t}removeTween(e){this.core.getExternalTweenGroup().remove(e)}tweenGroup(){return this.core.getExternalTweenGroup()}get __core(){return this.core}getCameraState(){return this.core.camera.getState()}getNavigationState(){return{isMultiFloor:this.Navigation.isMultiFloor,floorStacks:this.Navigation.floorStacks,floors:this.Navigation.floors,activeDirections:this.Navigation.activeDirections,activePath:this.Navigation.activePath,paths:this.Navigation.paths}}getAllState(){return{currentFloor:this.currentFloor,currentFloorStack:this.currentFloorStack,Camera:this.getCameraState(),Navigation:this.getNavigationState(),manualFloorVisibility:this.manualFloorVisibility}}publishAllState(){this.externalPubSub.publish("state-change-internal",this.getAllState())}clear(){this.Navigation.clear(),this.Shapes.removeAll(),this.Paths.removeAll(),this.Models.removeAll(),this.Markers.removeAll(),this.Image3D.removeAll(),this.Labels.removeAll()}destroy(){this.clear(),super.destroy(),this.core.destroy()}getOptimalVisualDistanceBetweenFloors(e,t=!1){let r=this.currentMap;if(!r){C.error("Cannot compute optimal visual distance between floors. Missing current map.");return}if(e.length<2){C.warn("Cannot compute optimal visual distance between floors. Must provide at least 2 floors.");return}let n=r.renderer.getInternalState().geometry3DMap.get(e[0].id),i=r.renderer.getInternalState().geometry3DMap.get(e[1].id);if(!n||!i){C.warn("Cannot compute optimal visual distance between floors. Floors not found in current map.");return}va(n,"group-container"),va(i,"group-container"),t&&typeof r.renderer.debugVisualizeBoundingBoxes=="function"&&r.renderer.debugVisualizeBoundingBoxes(n,i);let a=r.renderer.computeMinZOffsetBetweenContainers(n,i);if(a!==-1)return a}};function J1(o){if(o===""){ya(""),Ta("");return}Ta(`${o}/${rc}`),ya(`${o}/${oc}`)}f();var sa=class{state;#e;constructor(e){this.#e=e,this.update=e.Debug.update.bind(e.Debug),this.state=e.Debug.state}update;getCameraState(){let e=this.#e.camera.center,t=this.#e.camera.bearing;return{center:new H({longitude:e[0],latitude:e[1]}),zoomLevel:this.#e.camera.zoomLevel,bearing:t,pitch:this.#e.camera.pitch}}};f();import Ue from"zod";var eh=Ue.strictObject({environment:Ue.union([Ue.literal("basic"),Ue.literal(!1)]).optional(),text3d:Ue.object({hoverColor:Ue.string().optional()}).optional(),geometry:Ue.object({hoverColor:Ue.string().optional()}).optional(),backgroundColor:Ue.string().optional(),backgroundAlpha:Ue.number().optional(),multiFloorView:Ue.object({spacesOpenToBelowVisualEffectEnabled:Ue.boolean().optional(),spacesOpenToBelowVisualEffectDarkenAmount:Ue.number().min(0).max(1).optional(),spacesOpenToBelowVisualEffectDarkenUseDepth:Ue.boolean().optional(),spacesOpenToBelowVisualEffectDesaturateAmount:Ue.number().min(0).max(1).optional(),spacesOpenToBelowVisualEffectDesaturateUseDepth:Ue.boolean().optional(),spacesOpenToBelowVisualEffectWashOutAmount:Ue.number().min(0).max(1).optional(),spacesOpenToBelowVisualEffectWashOutUseDepth:Ue.boolean().optional()}).optional()});f();var Ol=Xn(mh(),1);f();var Bn=null;function th(){if(Bn)return Bn;if(typeof OffscreenCanvas<"u")Bn=new OffscreenCanvas(1,1).getContext("2d");else if(typeof document<"u"){let o=document.createElement("canvas");o.width=1,o.height=1,Bn=o.getContext("2d")}return Bn}function xl(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function Cl(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}function _l(o){let e=th();if(!e)return[0,0,0];e.fillStyle=o,e.fillRect(0,0,1,1);let[t,r,n]=e.getImageData(0,0,1,1).data;return[xl(t/255),xl(r/255),xl(n/255)]}function oh(o){let e=Math.round(Math.min(1,Math.max(0,Cl(o[0])))*255),t=Math.round(Math.min(1,Math.max(0,Cl(o[1])))*255),r=Math.round(Math.min(1,Math.max(0,Cl(o[2])))*255);return"#"+(1<<24|e<<16|t<<8|r).toString(16).slice(1)}var q1=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,Q1=/^rgba?\(\s*\d+/,K1=/^hsla?\(\s*[\d.]+/;function Pl(o){if(o==null||typeof o!="string")return!1;if(q1.test(o)||Q1.test(o)||K1.test(o))return!0;let e=th();return e?(e.fillStyle="#000",e.fillStyle=o,e.fillStyle!=="#000000"||o.toLowerCase()==="black"||o==="#000"||o==="#000000"):!1}var eb=(o,e)=>{let t={},r=(n,i,a)=>{for(let s in i){let l=n[s],c=i[s];typeof c=="object"&&!Array.isArray(c)&&c!==null&&typeof l=="object"&&!Array.isArray(l)&&l!==null?(a[s]={},r(l,c,a[s])):a[s]=l}};return r(o,e,t),t},rh=(o,e)=>{let t=eb(o,e),r=(0,Ol.default)({},t,e),n=(0,Ol.default)({},t),i=(a,s,l,c=n)=>{for(let p in s){let h=a[p],g=s[p];if(typeof g=="number"&&typeof h=="number")c[p]=h+(g-h)*l;else if(typeof g=="string"&&typeof h=="string"){if(Pl(h)&&Pl(g)){let T=_l(h),I=_l(g);T&&I?c[p]=oh([T[0]+(I[0]-T[0])*l,T[1]+(I[1]-T[1])*l,T[2]+(I[2]-T[2])*l]):C.warn(`Color "${p}" could not be animated!`)}}else typeof g=="object"&&g!==null&&typeof h=="object"&&h!==null?i(h,g,l,c[p]):C.warn(`Value "${p}" could not be animated!`)}};return a=>(a=Math.min(Math.max(a,0),1),a===0?o:a===1?r:(i(t,e,a),n))};f();function tb(o){return o.getContext("webgl2")||o.getContext("webgl")}function Dl(o){let e=tb(o);if(!e||o.width===0||o.height===0)return null;let t=e;t.PIXEL_PACK_BUFFER!==void 0&&t.bindBuffer(t.PIXEL_PACK_BUFFER,null);let r=new Uint8Array(o.width*o.height*4);e.readPixels(0,0,o.width,o.height,e.RGBA,e.UNSIGNED_BYTE,r);let n=document.createElement("canvas");n.width=o.width,n.height=o.height;let i=n.getContext("2d");if(!i)return null;let a=new ImageData(o.width,o.height);for(let s=0;s<o.height;s++)for(let l=0;l<o.width;l++){let c=((o.height-s-1)*o.width+l)*4,p=(s*o.width+l)*4;a.data[p]=r[c],a.data[p+1]=r[c+1],a.data[p+2]=r[c+2],a.data[p+3]=r[c+3]}return i.putImageData(a,0,0),n}async function nh(o,e=1e3){let t=null,r=new Promise(a=>{t=()=>{let s=o.getCanvas();a(s?Dl(s):null)},o.once("render",t),o.triggerRepaint()}),n=new Promise(a=>setTimeout(()=>a(null),e)),i=await Promise.race([r,n]);return i===null&&t&&o.off("render",t),i}function wl(o,e="labels"){let t=o.getContext("2d");if(!t)return null;try{let r=t.getImageData(0,0,o.width,o.height),n=document.createElement("canvas");n.width=o.width,n.height=o.height;let i=n.getContext("2d");return i?(i.putImageData(r,0,0),n):null}catch{let n=e==="overlay"?"HTML overlay canvas is tainted and cannot be included in screenshot. This may occur if overlay content contains cross-origin images without proper CORS headers.":"Labels canvas is tainted and cannot be included in screenshot. This may occur if labels contain cross-origin images without proper CORS headers.";return C.warn(n),null}}var Vn=class{#e;#t;#o;Camera;Labels;Text3D;Markers;Image3D;Models;Paths;Exporter;Navigation;Style;Shapes;Outdoor;constructor(e){this.#e=new Mt,this.#o=e;let t=new Nn(e,this,this.#e);this.#t=t,this.Camera=this.#t.Camera,this.Markers=this.#t.Markers,this.Models=this.#t.Models,this.Labels=this.#t.Labels,this.Text3D=this.#t.Text3D,this.Exporter=this.#t.Exporter,this.Paths=this.#t.Paths,this.Navigation=this.#t.Navigation,this.Shapes=this.#t.Shapes,this.Style=this.#t.Style,this.Outdoor=this.#t.Outdoor,this.Image3D=this.#t.Image3D,this.#o.container.dataset.version=S.env.npm_package_version,this.Debug=new sa(this.#t.core)}updateState(e,t){return this.#t.updateState(e,t)}animateState(e,t,r){let n=this.#t.getState(e);if(n==null)return C.warn(`Cannot animate state of ${e}.`),new Promise(c=>c({result:"completed"}));let i=rh(n,t),a=this.#t.tween({percent:0}).to({percent:1},r?.duration??1e3).onUpdate(({percent:l})=>{this.#t.updateState(e,i(l))});r?.easing&&r.easing in Ko&&a.easing(Ko[r.easing]);let s=new Promise(l=>{a.onComplete(()=>{this.#t.removeTween(a),l({result:"completed"})}).onStop(()=>{this.#t.removeTween(a),l({result:"cancelled"})}),a.start()});return s.cancel=()=>{a.stop(),this.#t.updateState(e,i(0))},s}updateGlobalState(e){try{eh.parse(e)}catch(t){C.error("updateGlobalState",t);return}if(typeof e=="object"){let t={};if(e.text3d?.hoverColor&&(t.text3dHoverColor=e.text3d.hoverColor),e.geometry?.hoverColor&&(t.hoverColor=e.geometry.hoverColor),e.backgroundColor||e.backgroundAlpha!==void 0){let r=e.backgroundColor??this.#t.core.backgroundColor,n=e.backgroundAlpha??this.#t.core.backgroundAlpha;this.#t.core.setBackgroundColor(r,n)}e.environment!=null&&this.#t.core.setEnvironment(e.environment),e.multiFloorView!=null&&this.#t.currentMap.updateMultiFloorViewEffects(e.multiFloorView),this.#t.core.setState(t),this.#e.publish("global-state-change")}}get options(){return ip(this.#t.currentMap.options)}getGlobalState(){let e=this.#t.core.getState();return{backgroundColor:this.#t.core.backgroundColor,backgroundAlpha:this.#t.core.backgroundAlpha,environment:this.#t.core.getEnvironment(),geometry:{hoverColor:e.hoverColor},text3d:{hoverColor:e.text3dHoverColor},multiFloorView:this.#t.currentMap.getMultiFloorViewEffects()}}update=()=>{this.#t.core.render()};getMapData(){if(this.#t.mapData==null)throw new Oe("MapData not found.");return this.#t.mapData}getDimensions(){return{width:this.#o.canvasWidth,height:this.#o.canvasHeight}}addMap(e,t){return this.#t.addMap(e,t)}setFloor(e,t){return this.#t.setFloor(e,t?.context)}setFloorStack(e,t){return this.#t.setFloorStack(e,t?.context)}preloadFloors(e){this.#t.preloadFloors(e)}tween(e){return this.#t.tween(e)}removeTween(e){this.#t.removeTween(e)}get tweenGroup(){return this.#t.tweenGroup()}get currentFloorStack(){return this.#t.currentFloorStack}get currentFloor(){return this.#t.currentFloor}updateWatermark(e){this.#t.updateWatermark(e)}getState(e){return this.#t.getState(e)}getFloorStackAltitudeData(e){let t=typeof e=="string"?e:e.id;return this.#t.getFloorStackAltitudeData(t)}__EXPERIMENTAL__getRenderedState(e){return this.#t.__EXPERIMENTAL__getRenderedState(e)}setHoverColor(e){this.#t.setHoverColor(e)}getHoverColor(){return this.#t.getHoverColor()}convertAltitudeToMercatorZoomLevel(e){return this.#t.core.getSystems().cameraSystem.convertAltitudeToZoomLevel(e)}convertMercatorZoomLevelToAltitude(e){return this.#t.core.getSystems().cameraSystem.convertZoomLevelToAltitude(e)}isInView(e){return this.#t.isInView(e)}getInView(e,t){return this.#t.getInView(e,t)}getMetersPerPixel(){return this.#t.core.getMetersPerPixel()}__LEGACY_GET_DIRECTIONS_SYNC=(e,t,r)=>this.#t.getMapData()?.__LEGACY_GET_DIRECTIONS_SYNC(e,t,r)??void 0;getDirections=(e,t,r)=>this.#t.getMapData()?.getDirections(e,t,r)??Promise.resolve(void 0);__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC=(e,t,r)=>this.#t.getMapData()?.__LEGACY_GET_DIRECTIONS_MULTI_DESTINATION_SYNC(e,t,r)??void 0;getDirectionsMultiDestination=(e,t,r)=>this.#t.getMapData()?.getDirectionsMultiDestination(e,t,r)??Promise.resolve(void 0);getDistance(e,t){return this.#t.getMapData()?.getDistance(e,t)}createCoordinate(e,t,r){return typeof e=="object"?new H(e):new H(e,t,r?.id)}createCoordinateFromScreenCoordinate(e,t,r){return this.#t.createCoordinateFromScreenCoordinate(e,t,r)}getScreenCoordinateFromCoordinate(e){return this.#t.getScreenCoordinateFromCoordinate(e)}__EXPERIMENTAL__auto(e){return this.#t.__EXPERIMENTAL__auto(e)}on=(e,t)=>{this.#e.on(e,t)};off=(e,t)=>{this.#e.off(e,t)};get __core(){if(S.env.INTERNAL==="true")return this.#t.core;throw new Error("__core is not available.")}get container(){return this.#o.container}publishAllState(){this.#t.publishAllState()}clear(){this.#t.clear()}destroy(){this.#e.publish("destroy"),this.#e.destroy(),this.#t.destroy()}async enableDebug(e={}){let{Inspector:t}=await import("./inspector-FCMDYYIP.js");await new t(this,this.#t).enable(e)}Debug;async takeScreenshot(e){let t={withOutdoorContext:e?.withOutdoorContext??!1,withLabels:e?.withLabels??!1,captureMarkers:e?.captureMarkers},r=this.#o.rendererDomElement,n=this.#o.map,i=!1,a=!1,s=[];if(this.Outdoor.enabled&&this.Outdoor.visible&&!t.withOutdoorContext&&(this.Outdoor.hide(),i=!0,n)){let l=null;n.triggerRepaint(),await Promise.race([new Promise(p=>{l=()=>p(),n.once("render",l)}),new Promise(p=>setTimeout(p,1e3))])===void 0&&l&&n.off("render",l)}if(this.Outdoor.enabled&&t.withOutdoorContext&&!this.Outdoor.visible){if(n){let l=n.getStyle()?.layers;l&&(s=l.filter(c=>n.getLayoutProperty(c.id,"visibility")!=="none").map(c=>c.id))}if(this.Outdoor.show(),a=!0,n){let l=null;n.triggerRepaint(),await Promise.race([new Promise(p=>{l=()=>p(),n.once("render",l)}),new Promise(p=>setTimeout(p,1e3))])===void 0&&l&&n.off("render",l)}}try{let l=document.createElement("canvas"),c=l.getContext("2d",{willReadFrequently:!0});if(l.width=r.width,l.height=r.height,!c)throw new Error("Failed to get 2D context");if(t.withOutdoorContext&&n){if(!n.loaded()){let g=null;await Promise.race([new Promise(I=>{g=()=>I(),n.once("idle",g)}),new Promise(I=>setTimeout(I,5e3))])===void 0&&g&&n.off("idle",g)}let h=await nh(n);h&&c.drawImage(h,0,0,l.width,l.height)}await this.#o.renderSync();let p=Dl(r);if(p&&c.drawImage(p,0,0,l.width,l.height),t.withLabels){let h=this.#o.labelsCanvas;if(h){let g=wl(h);g&&c.drawImage(g,0,0,l.width,l.height)}}if(t.withLabels&&t.captureMarkers){let h=this.#o.container;if(h)for(let g=0;g<h.children.length;g++){let T=h.children[g],I=T.classList.contains("mappedin-2d-entities");if(!(T.tagName==="CANVAS"||T.offsetWidth===0||T.offsetHeight===0||!I))try{let E=await t.captureMarkers(T),D=wl(E,"overlay");D&&D.width>0&&D.height>0&&c.drawImage(D,0,0,l.width,l.height)}catch(E){C.warn(`Overlay layer capture failed: ${E instanceof Error?E.message:String(E)}. Continuing with other layers.`)}}}try{return l.toDataURL("image/png")}catch(h){if((h instanceof Error?h.name:h?.name)==="SecurityError"||h?.message?.includes("tainted")||h?.message?.includes("security")){let E=h instanceof Error?`Screenshot failed due to security restrictions: ${h.message}`:"Screenshot failed due to security restrictions. Ensure all images have proper CORS headers.";throw new Oe(E)}let I=h instanceof Error?`Screenshot failed: ${h.message}`:"Screenshot failed due to an unknown error.";throw new Oe(I)}}finally{i&&this.Outdoor.show(),a&&this.Outdoor.hide(s)}}get manualFloorVisibility(){return this.#t.manualFloorVisibility}set manualFloorVisibility(e){this.#t.manualFloorVisibility=e}getOptimalVisualDistanceBetweenFloors(e){return this.#t.getOptimalVisualDistanceBetweenFloors(e)}get __INTERNAL__hidePathsNotOnCurrentFloor(){return this.#t.hidePathsNotOnCurrentFloor}set __INTERNAL__hidePathsNotOnCurrentFloor(e){this.#t.hidePathsNotOnCurrentFloor=!!e}registerPlugin(e){C.warn("registerPlugin is super experimental and may change or be removed without notice."),this.#o.registerPlugin(e)}unregisterPlugin(e){this.#o.unregisterPlugin(e)}};f();var ih=(o,{id:e}={})=>{let t=Array.isArray(o)?o:[o];if(!t.every(i=>typeof i=="string"))return;let r=t.join(""),n=null;if(e){let i=document.getElementById(e);i instanceof HTMLStyleElement&&(n=i)}n==null&&(n=document.createElement("style")),e&&e!==""&&(n.id=e),n.textContent=r,document.head.appendChild(n)};f();var ob=1e3*60*60*2,kr=class{#e=new Mt;#t;#o;#r;#i;#n;#s;#c;#a;constructor(e,t){this.#t=e,this.#o=t}#l=()=>{"key"in this.#o&&"secret"in this.#o&&this.#u(),this.#f()};#d(e){let t=e.token!==this.#n?.token;this.#n=e,t&&this.#e.publish("access-token-refreshed",{accessToken:e})}#h(e){let t=JSON.stringify(e.tokens)!==JSON.stringify(this.#s?.tokens);this.#s=e,t&&this.#e.publish("sas-tokens-refreshed",{sasTokens:e.tokens})}async#u(e=!1){if("accessToken"in this.#o&&typeof this.#o.accessToken=="string"){let t={token:this.#o.accessToken,expires:Date.now()+72e5};return this.#n=t,t}if(!("key"in this.#o)||!("secret"in this.#o)||typeof this.#o.key!="string"||typeof this.#o.secret!="string")throw new Error("No API keys or access token provided!");return this.#r!=null?this.#r:this.#n!=null&&this.#n.expires!=null&&this.#n.expires>Date.now()&&!e?this.#n:(this.#r=Wr({...this.#o,key:this.#o.key,secret:this.#o.secret},this.#o.enterprise??!1).then(t=>{let r={token:t.accessToken,expires:t.expiresTimestamp*1e3};return this.#d(r),r}).catch(t=>{throw t}).finally(()=>{this.#r=void 0}),this.#r)}async#f(e=!1){return this.isEnterpriseMode()?{tokens:{},expires:1/0}:this.#i!=null?this.#i:this.#s!=null&&this.#s.expires>Date.now()&&!e?this.#s:(this.#i=new Promise((t,r)=>{this.#u().then(n=>{let i={},a=this.#t.map(s=>Ca({...this.#o,mapId:s},n.token).then(l=>{i[s]={token:l.token,expires:l.expires}}).catch(l=>{C.error(`Error getting SAS token for map ${s}:`,l)}));Promise.all(a).then(()=>{let s={tokens:i,expires:Math.min(...Object.values(i).map(l=>l.expires??1/0))};this.#h(s),t(s)})}).catch(n=>{r(n)})}),this.#i.catch(t=>{throw t}).finally(()=>{this.#i=void 0}),this.#i)}#p(e){if(!("key"in this.#o)||!("secret"in this.#o))return;let t=e.expires!=null?e.expires-Date.now():ob;isFinite(t)&&(this.#c=setTimeout(()=>{this.#u(!0).then(r=>{this.#p(r)})},t-Ac))}#m(e){let t=e.expires-Date.now();isFinite(t)&&(this.#a=setTimeout(()=>{this.#f(!0).then(r=>{this.#m(r)})},t-Rc))}#y(){this.#c!=null&&clearTimeout(this.#c),this.#a!=null&&clearTimeout(this.#a)}setMapIds(e){this.#t=e}setEnterprise(e){this.#o.enterprise=e}async readySync(){if((!("key"in this.#o)||!("secret"in this.#o))&&!("accessToken"in this.#o)){C.error("No API keys or access token provided! Cannot preload tokens.");return}let e=[this.#u(),null];this.#o.enterprise||(e[1]=this.getSasTokensAsync());let[t,r]=await Promise.all(e);this.#y(),this.#p(t),r!=null&&this.#m(r),Vr()&&globalThis.addEventListener?.("focus",this.#l)}async refreshing(){let e=[];return this.#r!=null&&e.push(this.#r),this.#i!=null&&e.push(this.#i),Promise.all(e)}getAccessTokenAsync(){return this.#u()}getSasTokensAsync(){return this.#f()}getAccessToken(){return this.#n==null?(C.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):this.#n}getSasToken(e){return this.isEnterpriseMode()?(C.error("SAS tokens are not available in the enterprise mode!"),{token:""}):this.#s==null?(C.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):e in this.#s.tokens?this.#s.tokens[e]:(C.error(`SAS token for map ${e} not found!`),{token:""})}isEnterpriseMode(){return this.#o.enterprise??!1}on=(e,t)=>this.#e.on(e,t);off=(e,t)=>this.#e.off(e,t);destroy(){this.#y(),this.#e.destroy(),Vr()&&globalThis.removeEventListener("focus",this.#l)}};f();var rb=async(o,e)=>{let t=("mvfVersion"in(e??{})?e?.mvfVersion:void 0)??("options"in o&&"version"in(o.options??{})?o.options?.version:void 0),r={prefetchTokens:!0,...e||{},mvfVersion:t},n,i,a=To();a.updateByUserOption(r);let s={};if("type"in o&&typeof o.type=="string"){if(o.type==="binary"&&o.main instanceof Uint8Array){let A=await ri(o.main,r.mvfVersion);n=A.mvf2,i=A.mvf3,s.languagePacks=[];for(let U of o.languagePacks??[])U.localePack instanceof Uint8Array&&s.languagePacks.push({language:U.language,localePack:await ir(U.localePack)})}else if(o.type==="json")n=o.main,i=o.options?.mvf3,s.languagePacks=o.languagePacks??[];else throw new Error("Invalid backup type");o.type==="binary"&&o.main instanceof Uint8Array&&(s.binaryBundle=o.main);let x=n.enterprise!=null;o.options?.enterprise!==void 0&&(x?C.warn('The "enterprise" option in hydrateMapData is deprecated and ignored. Enterprise mode is now automatically detected from the MVF data.'):C.warn('The "enterprise" option in hydrateMapData is deprecated and will be removed in a future release. Please ensure your MVF bundle includes enterprise data for automatic detection.')),s.enterprise=x||(o.options?.enterprise??!1)}else n=o,s.enterprise=n.enterprise!=null;s.mvf3=i;let l="key"in r&&"secret"in r,c="accessToken"in r&&r.accessToken;l&&Fc(r.key)&&(s.enterprise=!1),a.setEnterprise(s.enterprise??!1);let p=oi(n),h=p.length>0?p:[r.mapId];r.baseAuthUri=a.getBaseAuthUri();let g=new kr(h,{...r,enterprise:s.enterprise}),T;if(c)T=r.accessToken;else if(l){let x;try{x=await g.getAccessTokenAsync()}catch(A){C.error("Failed getting token during hydrateMapData",A)}T=x?.token||""}if(s.outdoorViewToken=T,s.env=a,s.getMapDataOptions=r,s.tokenManager=g,r.prefetchTokens&&(l||c))try{await g.readySync()}catch(x){C.error("Failed to ready token manager!",x)}an()&&(s.enterprise&&C.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),r.mvfVersion!=="3.0.0"&&C.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let I=new Vo(n,s);T&&I.Analytics.init({accessToken:T,mapId:r.mapId,key:"key"in r?r.key:void 0,secret:"secret"in r?r.secret:void 0,enterprise:s.enterprise??!1,...r.analytics,baseUri:a.getAnalyticsBaseUri(),context:r.analytics?.context});let E=new Ur(I),D=I.findPreferredLanguage({languageCode:r.language,fallbackToNavigatorLanguage:!1});if(D)try{await E.changeLanguage(D.code)}catch{}return typeof e?.onMVFParsed=="function"&&e.onMVFParsed(n),E};var ah=`:root {
|
|
297
297
|
--pin-shadow-hover-scale: 0.9;
|
|
298
298
|
--pin-shadow-width: 12px;
|
|
299
299
|
--pin-shadow-height: 5px;
|