@mappedin/mappedin-js 6.24.0 → 6.24.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.
@@ -1,9 +1,9 @@
1
- import{A as Rc,a as gi,b as mi,c as on,d as qt,e as Ho,f as gc,g as yi,h as Mo,i as pr,j as dr,k as mc,l as bc,m as Fa,n as Tc,o as vc,p as Aa,q as Ic,r as Sc,s as Ec,t as ja,w as Nc}from"./chunk-B3VG275M.js";import{$ as Dc,B as De,C as yc,Cc as Lc,F as ka,Ha as kc,J as Mc,K as xc,L as _c,M as Cc,P as ao,Q as ur,R as La,S as Pc,T as Oc,U as wc,V as Na,W as Ra,X as Ba,Y as Va,ca as bi,e as x,f as oe,fa as Ga,g as ui,ga as Ua,h as pc,ha as Fc,ia as Ac,j as gt,ka as ig,l as lr,la as Ha,m as fi,n as tn,q as hi,r as dc,t as uc,u as Jt,v as Da,x as fc,y as hc,z as cr}from"./chunk-VJRVK75J.js";import{a as f,b as S}from"./chunk-EIF63KEB.js";import{b as _e,d as di}from"./chunk-PWEV3AFA.js";var Cs=_e((xs,_s)=>{f();(function(o,e){typeof xs=="object"&&typeof _s<"u"?_s.exports=e():typeof define=="function"&&define.amd?define(e):(o=typeof globalThis<"u"?globalThis:o||self,o.polygonClipping=e())})(xs,(function(){"use strict";function o(M,d){var u={label:0,sent:function(){if(b[0]&1)throw b[1];return b[1]},trys:[],ops:[]},m,T,b,D;return D={next:C(0),throw:C(1),return:C(2)},typeof Symbol=="function"&&(D[Symbol.iterator]=function(){return this}),D;function C(k){return function(X){return L([k,X])}}function L(k){if(m)throw new TypeError("Generator is already executing.");for(;u;)try{if(m=1,T&&(b=k[0]&2?T.return:k[0]?T.throw||((b=T.return)&&b.call(T),0):T.next)&&!(b=b.call(T,k[1])).done)return b;switch(T=0,b&&(k=[k[0]&2,b.value]),k[0]){case 0:case 1:b=k;break;case 4:return u.label++,{value:k[1],done:!1};case 5:u.label++,T=k[1],k=[0];continue;case 7:k=u.ops.pop(),u.trys.pop();continue;default:if(b=u.trys,!(b=b.length>0&&b[b.length-1])&&(k[0]===6||k[0]===2)){u=0;continue}if(k[0]===3&&(!b||k[1]>b[0]&&k[1]<b[3])){u.label=k[1];break}if(k[0]===6&&u.label<b[1]){u.label=b[1],b=k;break}if(b&&u.label<b[2]){u.label=b[2],u.ops.push(k);break}b[2]&&u.ops.pop(),u.trys.pop();continue}k=d.call(M,u)}catch(X){k=[6,X],T=0}finally{m=b=0}if(k[0]&5)throw k[1];return{value:k[0]?k[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),T=m,b=m;;){var D=u(M,d.key);if(D<0){if(d.left===null)break;if(u(M,d.left.key)<0){var C=d.left;if(d.left=C.right,C.right=d,d=C,d.left===null)break}b.left=d,b=d,d=d.left}else if(D>0){if(d.right===null)break;if(u(M,d.right.key)>0){var C=d.right;if(d.right=C.left,C.left=d,d=C,d.right===null)break}T.right=d,T=d,d=d.right}else break}return T.right=d.left,b.left=d.right,d.left=m.right,d.right=m.left,d}function n(M,d,u,m){var T=new e(M,d);if(u===null)return T.left=T.right=null,T;u=r(M,u,m);var b=m(M,u.key);return b<0?(T.left=u.left,T.right=u,u.left=null):b>=0&&(T.right=u.right,T.left=u,u.right=null),T}function i(M,d,u){var m=null,T=null;if(d){d=r(M,d,u);var b=u(d.key,M);b===0?(m=d.left,T=d.right):b<0?(T=d.right,d.right=null,m=d):(m=d.left,d.left=null,T=d)}return{left:m,right:T}}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,T){if(M){m(""+d+(u?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+T(M)+`
1
+ import{A as Rc,a as gi,b as mi,c as on,d as qt,e as Ho,f as gc,g as yi,h as Mo,i as pr,j as dr,k as mc,l as bc,m as Fa,n as Tc,o as vc,p as Aa,q as Ic,r as Sc,s as Ec,t as ja,w as Nc}from"./chunk-66VPLG5U.js";import{$ as Dc,B as De,C as yc,Cc as Lc,F as ka,Ha as kc,J as Mc,K as xc,L as _c,M as Cc,P as ao,Q as ur,R as La,S as Pc,T as Oc,U as wc,V as Na,W as Ra,X as Ba,Y as Va,ca as bi,e as x,f as oe,fa as Ga,g as ui,ga as Ua,h as pc,ha as Fc,ia as Ac,j as gt,ka as ig,l as lr,la as Ha,m as fi,n as tn,q as hi,r as dc,t as uc,u as Jt,v as Da,x as fc,y as hc,z as cr}from"./chunk-BZRV2IXY.js";import{a as f,b as S}from"./chunk-KVOE73GU.js";import{b as _e,d as di}from"./chunk-PWEV3AFA.js";var Cs=_e((xs,_s)=>{f();(function(o,e){typeof xs=="object"&&typeof _s<"u"?_s.exports=e():typeof define=="function"&&define.amd?define(e):(o=typeof globalThis<"u"?globalThis:o||self,o.polygonClipping=e())})(xs,(function(){"use strict";function o(M,d){var u={label:0,sent:function(){if(b[0]&1)throw b[1];return b[1]},trys:[],ops:[]},m,T,b,D;return D={next:C(0),throw:C(1),return:C(2)},typeof Symbol=="function"&&(D[Symbol.iterator]=function(){return this}),D;function C(k){return function(X){return L([k,X])}}function L(k){if(m)throw new TypeError("Generator is already executing.");for(;u;)try{if(m=1,T&&(b=k[0]&2?T.return:k[0]?T.throw||((b=T.return)&&b.call(T),0):T.next)&&!(b=b.call(T,k[1])).done)return b;switch(T=0,b&&(k=[k[0]&2,b.value]),k[0]){case 0:case 1:b=k;break;case 4:return u.label++,{value:k[1],done:!1};case 5:u.label++,T=k[1],k=[0];continue;case 7:k=u.ops.pop(),u.trys.pop();continue;default:if(b=u.trys,!(b=b.length>0&&b[b.length-1])&&(k[0]===6||k[0]===2)){u=0;continue}if(k[0]===3&&(!b||k[1]>b[0]&&k[1]<b[3])){u.label=k[1];break}if(k[0]===6&&u.label<b[1]){u.label=b[1],b=k;break}if(b&&u.label<b[2]){u.label=b[2],u.ops.push(k);break}b[2]&&u.ops.pop(),u.trys.pop();continue}k=d.call(M,u)}catch(X){k=[6,X],T=0}finally{m=b=0}if(k[0]&5)throw k[1];return{value:k[0]?k[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),T=m,b=m;;){var D=u(M,d.key);if(D<0){if(d.left===null)break;if(u(M,d.left.key)<0){var C=d.left;if(d.left=C.right,C.right=d,d=C,d.left===null)break}b.left=d,b=d,d=d.left}else if(D>0){if(d.right===null)break;if(u(M,d.right.key)>0){var C=d.right;if(d.right=C.left,C.left=d,d=C,d.right===null)break}T.right=d,T=d,d=d.right}else break}return T.right=d.left,b.left=d.right,d.left=m.right,d.right=m.left,d}function n(M,d,u,m){var T=new e(M,d);if(u===null)return T.left=T.right=null,T;u=r(M,u,m);var b=m(M,u.key);return b<0?(T.left=u.left,T.right=u,u.left=null):b>=0&&(T.right=u.right,T.left=u,u.right=null),T}function i(M,d,u){var m=null,T=null;if(d){d=r(M,d,u);var b=u(d.key,M);b===0?(m=d.left,T=d.right):b<0?(T=d.right,d.right=null,m=d):(m=d.left,d.left=null,T=d)}return{left:m,right:T}}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,T){if(M){m(""+d+(u?"\u2514\u2500\u2500 ":"\u251C\u2500\u2500 ")+T(M)+`
2
2
  `);var b=d+(u?" ":"\u2502 ");M.left&&s(M.left,b,!1,m,T),M.right&&s(M.right,b,!0,m,T)}}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 T=this._comparator,b=r(d,this._root,T),D=T(d,b.key);return D===0?this._root=b:(D<0?(m.left=b.left,m.right=b,b.left=null):D>0&&(m.right=b.right,m.left=b,b.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 T;if(u===null)return null;u=r(d,u,m);var b=m(d,u.key);return b===0?(u.left===null?T=u.right:(T=r(d,u.left,m),T.right=u.right),this._size--,T):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 T=m(d,u.key);if(T===0)return u;T<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 T=m(d,u.key);if(T===0)return!0;T<0?u=u.left:u=u.right}return!1},M.prototype.forEach=function(d,u){for(var m=this._root,T=[],b=!1;!b;)m!==null?(T.push(m),m=m.left):T.length!==0?(m=T.pop(),d.call(u,m),m=m.right):b=!0;return this},M.prototype.range=function(d,u,m,T){for(var b=[],D=this._comparator,C=this._root,L;b.length!==0||C;)if(C)b.push(C),C=C.left;else{if(C=b.pop(),L=D(C.key,u),L>0)break;if(D(C.key,d)>=0&&m.call(T,C))return this;C=C.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,T=0,b=[];!m;)if(u)b.push(u),u=u.left;else if(b.length>0){if(u=b.pop(),T===d)return u;T++,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 T=this._comparator;u;){var b=T(d.key,u.key);if(b===0)break;b<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 T=this._comparator;u;){var b=T(d.key,u.key);if(b===0)break;b<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 T=d.length,b=this._comparator;if(m&&I(d,u,0,T-1,b),this._root===null)this._root=c(d,u,0,T),this._size=T;else{var D=v(this.toList(),p(d,u),b);T=this._size+T,this._root=g({head:D},0,T)}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 T=this._comparator,b=i(d,this._root,T),D=b.left,C=b.right;T(d,u)<0?C=n(u,m,C,T):D=n(u,m,D,T),this._root=a(D,C,T)},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(T){switch(T.label){case 0:d=this._root,u=[],m=!1,T.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 T.sent(),d=d.right,[3,5];case 4:m=!0,T.label=5;case 5:return[3,1];case 6:return[2]}})},M})();function c(M,d,u,m){var T=m-u;if(T>0){var b=u+Math.floor(T/2),D=M[b],C=d[b],L=new e(D,C);return L.left=c(M,d,u,b),L.right=c(M,d,b+1,m),L}return null}function p(M,d){for(var u=new e(null,null),m=u,T=0;T<M.length;T++)m=m.next=new e(M[T],d[T]);return m.next=null,u.next}function h(M){for(var d=M,u=[],m=!1,T=new e(null,null),b=T;!m;)d?(u.push(d),d=d.left):u.length>0?(d=b=b.next=u.pop(),d=d.right):m=!0;return b.next=null,T.next}function g(M,d,u){var m=u-d;if(m>0){var T=d+Math.floor(m/2),b=g(M,d,T),D=M.head;return D.left=b,M.head=M.head.next,D.right=g(M,T+1,u),D}return null}function v(M,d,u){for(var m=new e(null,null),T=m,b=M,D=d;b!==null&&D!==null;)u(b.key,D.key)<0?(T.next=b,b=b.next):(T.next=D,D=D.next),T=T.next;return b!==null?T.next=b:D!==null&&(T.next=D),m.next}function I(M,d,u,m,T){if(!(u>=m)){for(var b=M[u+m>>1],D=u-1,C=m+1;;){do D++;while(T(M[D],b)<0);do C--;while(T(M[C],b)>0);if(D>=C)break;var L=M[D];M[D]=M[C],M[C]=L,L=d[D],d[D]=d[C],d[C]=L}I(M,d,u,C,T),I(M,d,C+1,m,T)}}let E=(M,d)=>M.ll.x<=d.x&&d.x<=M.ur.x&&M.ll.y<=d.y&&d.y<=M.ur.y,O=(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,T=M.ll.y<d.ll.y?d.ll.y:M.ll.y,b=M.ur.y<d.ur.y?M.ur.y:d.ur.y;return{ll:{x:u,y:T},ur:{x:m,y:b}}},w=Number.EPSILON;w===void 0&&(w=Math.pow(2,-52));let F=w*w,W=(M,d)=>{if(-w<M&&M<w&&-w<d&&d<w)return 0;let u=M-d;return u*u<F*M*d?0:M<d?-1:1};class N{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&&W(u.key,m.key)===0)return this.tree.remove(d),m.key;let T=this.tree.next(u);return T!==null&&W(u.key,T.key)===0?(this.tree.remove(d),T.key):d}}let G=new N,A=11102230246251565e-32,j=134217729,te=(3+8*A)*A;function he(M,d,u,m,T){let b,D,C,L,k=d[0],X=m[0],P=0,R=0;X>k==X>-k?(b=k,k=d[++P]):(b=X,X=m[++R]);let U=0;if(P<M&&R<u)for(X>k==X>-k?(D=k+b,C=b-(D-k),k=d[++P]):(D=X+b,C=b-(D-X),X=m[++R]),b=D,C!==0&&(T[U++]=C);P<M&&R<u;)X>k==X>-k?(D=b+k,L=D-b,C=b-(D-L)+(k-L),k=d[++P]):(D=b+X,L=D-b,C=b-(D-L)+(X-L),X=m[++R]),b=D,C!==0&&(T[U++]=C);for(;P<M;)D=b+k,L=D-b,C=b-(D-L)+(k-L),k=d[++P],b=D,C!==0&&(T[U++]=C);for(;R<u;)D=b+X,L=D-b,C=b-(D-L)+(X-L),X=m[++R],b=D,C!==0&&(T[U++]=C);return(b!==0||U===0)&&(T[U++]=b),U}function ge(M,d){let u=d[0];for(let m=1;m<M;m++)u+=d[m];return u}function ie(M){return new Float64Array(M)}let Te=(3+16*A)*A,Be=(2+12*A)*A,Ve=(9+64*A)*A*A,pe=ie(4),$e=ie(8),wt=ie(12),ot=ie(16),ve=ie(4);function mo(M,d,u,m,T,b,D){let C,L,k,X,P,R,U,K,J,ne,Q,de,we,Ee,je,Ae,Qe,ke,rt=M-T,ft=u-T,Ye=d-b,ht=m-b;Ee=rt*ht,R=j*rt,U=R-(R-rt),K=rt-U,R=j*ht,J=R-(R-ht),ne=ht-J,je=K*ne-(Ee-U*J-K*J-U*ne),Ae=Ye*ft,R=j*Ye,U=R-(R-Ye),K=Ye-U,R=j*ft,J=R-(R-ft),ne=ft-J,Qe=K*ne-(Ae-U*J-K*J-U*ne),Q=je-Qe,P=je-Q,pe[0]=je-(Q+P)+(P-Qe),de=Ee+Q,P=de-Ee,we=Ee-(de-P)+(Q-P),Q=we-Ae,P=we-Q,pe[1]=we-(Q+P)+(P-Ae),ke=de+Q,P=ke-de,pe[2]=de-(ke-P)+(Q-P),pe[3]=ke;let kt=ge(4,pe),me=Be*D;if(kt>=me||-kt>=me||(P=M-rt,C=M-(rt+P)+(P-T),P=u-ft,k=u-(ft+P)+(P-T),P=d-Ye,L=d-(Ye+P)+(P-b),P=m-ht,X=m-(ht+P)+(P-b),C===0&&L===0&&k===0&&X===0)||(me=Ve*D+te*Math.abs(kt),kt+=rt*X+ht*C-(Ye*k+ft*L),kt>=me||-kt>=me))return kt;Ee=C*ht,R=j*C,U=R-(R-C),K=C-U,R=j*ht,J=R-(R-ht),ne=ht-J,je=K*ne-(Ee-U*J-K*J-U*ne),Ae=L*ft,R=j*L,U=R-(R-L),K=L-U,R=j*ft,J=R-(R-ft),ne=ft-J,Qe=K*ne-(Ae-U*J-K*J-U*ne),Q=je-Qe,P=je-Q,ve[0]=je-(Q+P)+(P-Qe),de=Ee+Q,P=de-Ee,we=Ee-(de-P)+(Q-P),Q=we-Ae,P=we-Q,ve[1]=we-(Q+P)+(P-Ae),ke=de+Q,P=ke-de,ve[2]=de-(ke-P)+(Q-P),ve[3]=ke;let So=he(4,pe,4,ve,$e);Ee=rt*X,R=j*rt,U=R-(R-rt),K=rt-U,R=j*X,J=R-(R-X),ne=X-J,je=K*ne-(Ee-U*J-K*J-U*ne),Ae=Ye*k,R=j*Ye,U=R-(R-Ye),K=Ye-U,R=j*k,J=R-(R-k),ne=k-J,Qe=K*ne-(Ae-U*J-K*J-U*ne),Q=je-Qe,P=je-Q,ve[0]=je-(Q+P)+(P-Qe),de=Ee+Q,P=de-Ee,we=Ee-(de-P)+(Q-P),Q=we-Ae,P=we-Q,ve[1]=we-(Q+P)+(P-Ae),ke=de+Q,P=ke-de,ve[2]=de-(ke-P)+(Q-P),ve[3]=ke;let _a=he(So,$e,4,ve,wt);Ee=C*X,R=j*C,U=R-(R-C),K=C-U,R=j*X,J=R-(R-X),ne=X-J,je=K*ne-(Ee-U*J-K*J-U*ne),Ae=L*k,R=j*L,U=R-(R-L),K=L-U,R=j*k,J=R-(R-k),ne=k-J,Qe=K*ne-(Ae-U*J-K*J-U*ne),Q=je-Qe,P=je-Q,ve[0]=je-(Q+P)+(P-Qe),de=Ee+Q,P=de-Ee,we=Ee-(de-P)+(Q-P),Q=we-Ae,P=we-Q,ve[1]=we-(Q+P)+(P-Ae),ke=de+Q,P=ke-de,ve[2]=de-(ke-P)+(Q-P),ve[3]=ke;let ai=he(_a,wt,4,ve,ot);return ot[ai-1]}function se(M,d,u,m,T,b){let D=(d-b)*(u-T),C=(M-T)*(m-b),L=D-C,k=Math.abs(D+C);return Math.abs(L)>=Te*k?L:-mo(M,d,u,m,T,b,k)}let Et=(M,d)=>M.x*d.y-M.y*d.x,Dt=(M,d)=>M.x*d.x+M.y*d.y,$t=(M,d,u)=>{let m=se(M.x,M.y,d.x,d.y,u.x,u.y);return m>0?-1:m<0?1:0},Ft=M=>Math.sqrt(Dt(M,M)),yo=(M,d,u)=>{let m={x:d.x-M.x,y:d.y-M.y},T={x:u.x-M.x,y:u.y-M.y};return Et(T,m)/Ft(T)/Ft(m)},bo=(M,d,u)=>{let m={x:d.x-M.x,y:d.y-M.y},T={x:u.x-M.x,y:u.y-M.y};return Dt(T,m)/Ft(T)/Ft(m)},Vo=(M,d,u)=>d.y===0?null:{x:M.x+d.x/d.y*(u-M.y),y:u},ir=(M,d,u)=>d.x===0?null:{x:u,y:M.y+d.y/d.x*(u-M.x)},ar=(M,d,u,m)=>{if(d.x===0)return ir(u,m,M.x);if(m.x===0)return ir(M,d,u.x);if(d.y===0)return Vo(u,m,M.y);if(m.y===0)return Vo(M,d,u.y);let T=Et(d,m);if(T==0)return null;let b={x:u.x-M.x,y:u.y-M.y},D=Et(b,d)/T,C=Et(b,m)/T,L=M.x+C*d.x,k=u.x+D*m.x,X=M.y+C*d.y,P=u.y+D*m.y,R=(L+k)/2,U=(X+P)/2;return{x:R,y:U}};class re{static compare(d,u){let m=re.comparePoints(d.point,u.point);return m!==0?m:(d.point!==u.point&&d.link(u),d.isLeft!==u.isLeft?d.isLeft?1:-1:ae.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,T=u.length;m<T;m++){let b=u[m];this.point.events.push(b),b.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 T=u+1;T<d;T++){let b=this.point.events[T];b.consumedBy===void 0&&m.otherSE.point.events===b.otherSE.point.events&&m.segment.consume(b.segment)}}}getAvailableLinkedEvents(){let d=[];for(let u=0,m=this.point.events.length;u<m;u++){let T=this.point.events[u];T!==this&&!T.segment.ringOut&&T.segment.isInResult()&&d.push(T)}return d}getLeftmostComparator(d){let u=new Map,m=T=>{let b=T.otherSE;u.set(T,{sine:yo(this.point,d.point,b.point),cosine:bo(this.point,d.point,b.point)})};return(T,b)=>{u.has(T)||m(T),u.has(b)||m(b);let{sine:D,cosine:C}=u.get(T),{sine:L,cosine:k}=u.get(b);return D>=0&&L>=0?C<k?1:C>k?-1:0:D<0&&L<0?C<k?-1:C>k?1:0:L<D?-1:L>D?1:0}}}let jo=0;class ae{static compare(d,u){let m=d.leftSE.point.x,T=u.leftSE.point.x,b=d.rightSE.point.x,D=u.rightSE.point.x;if(D<m)return 1;if(b<T)return-1;let C=d.leftSE.point.y,L=u.leftSE.point.y,k=d.rightSE.point.y,X=u.rightSE.point.y;if(m<T){if(L<C&&L<k)return 1;if(L>C&&L>k)return-1;let P=d.comparePoint(u.leftSE.point);if(P<0)return 1;if(P>0)return-1;let R=u.comparePoint(d.rightSE.point);return R!==0?R:-1}if(m>T){if(C<L&&C<X)return-1;if(C>L&&C>X)return 1;let P=u.comparePoint(d.leftSE.point);if(P!==0)return P;let R=d.comparePoint(u.rightSE.point);return R<0?1:R>0?-1:1}if(C<L)return-1;if(C>L)return 1;if(b<D){let P=u.comparePoint(d.rightSE.point);if(P!==0)return P}if(b>D){let P=d.comparePoint(u.rightSE.point);if(P<0)return 1;if(P>0)return-1}if(b!==D){let P=k-C,R=b-m,U=X-L,K=D-T;if(P>R&&U<K)return 1;if(P<R&&U>K)return-1}return b>D?1:b<D||k<X?-1:k>X?1:d.id<u.id?-1:d.id>u.id?1:0}constructor(d,u,m,T){this.id=++jo,this.leftSE=d,d.segment=this,d.otherSE=u,this.rightSE=u,u.segment=this,u.otherSE=d,this.rings=m,this.windings=T}static fromRing(d,u,m){let T,b,D,C=re.comparePoints(d,u);if(C<0)T=d,b=u,D=1;else if(C>0)T=u,b=d,D=-1;else throw new Error(`Tried to create degenerate segment at [${d.x}, ${d.y}]`);let L=new re(T,!0),k=new re(b,!1);return new ae(L,k,[m],[D])}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,T=this.vector();if(u.x===m.x)return d.x===u.x?0:d.x<u.x?1:-1;let b=(d.y-u.y)/T.y,D=u.x+b*T.x;if(d.x===D)return 0;let C=(d.x-u.x)/T.x,L=u.y+C*T.y;return d.y===L?0:d.y<L?-1:1}getIntersection(d){let u=this.bbox(),m=d.bbox(),T=O(u,m);if(T===null)return null;let b=this.leftSE.point,D=this.rightSE.point,C=d.leftSE.point,L=d.rightSE.point,k=E(u,C)&&this.comparePoint(C)===0,X=E(m,b)&&d.comparePoint(b)===0,P=E(u,L)&&this.comparePoint(L)===0,R=E(m,D)&&d.comparePoint(D)===0;if(X&&k)return R&&!P?D:!R&&P?L:null;if(X)return P&&b.x===L.x&&b.y===L.y?null:b;if(k)return R&&D.x===C.x&&D.y===C.y?null:C;if(R&&P)return null;if(R)return D;if(P)return L;let U=ar(b,this.vector(),C,d.vector());return U===null||!E(T,U)?null:G.round(U.x,U.y)}split(d){let u=[],m=d.events!==void 0,T=new re(d,!0),b=new re(d,!1),D=this.rightSE;this.replaceRightSE(b),u.push(b),u.push(T);let C=new ae(T,D,this.rings.slice(),this.windings.slice());return re.comparePoints(C.leftSE.point,C.rightSE.point)>0&&C.swapEvents(),re.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),m&&(T.checkForConsuming(),b.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 T=ae.compare(u,m);if(T!==0){if(T>0){let b=u;u=m,m=b}if(u.prev===m){let b=u;u=m,m=b}for(let b=0,D=m.rings.length;b<D;b++){let C=m.rings[b],L=m.windings[b],k=u.rings.indexOf(C);k===-1?(u.rings.push(C),u.windings.push(L)):u.windings[k]+=L}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,T=this._afterState.multiPolys;for(let C=0,L=this.rings.length;C<L;C++){let k=this.rings[C],X=this.windings[C],P=u.indexOf(k);P===-1?(u.push(k),m.push(X)):m[P]+=X}let b=[],D=[];for(let C=0,L=u.length;C<L;C++){if(m[C]===0)continue;let k=u[C],X=k.poly;if(D.indexOf(X)===-1)if(k.isExterior)b.push(X);else{D.indexOf(X)===-1&&D.push(X);let P=b.indexOf(k.poly);P!==-1&&b.splice(P,1)}}for(let C=0,L=b.length;C<L;C++){let k=b[C].multiPoly;T.indexOf(k)===-1&&T.push(k)}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(Oe.type){case"union":{let m=d.length===0,T=u.length===0;this._isInResult=m!==T;break}case"intersection":{let m,T;d.length<u.length?(m=d.length,T=u.length):(m=u.length,T=d.length),this._isInResult=T===Oe.numMultiPolys&&m<T;break}case"xor":{let m=Math.abs(d.length-u.length);this._isInResult=m%2===1;break}case"difference":{let m=T=>T.length===1&&T[0].isSubject;this._isInResult=m(d)!==m(u);break}default:throw new Error(`Unrecognized operation type found ${Oe.type}`)}return this._isInResult}}class To{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 T=G.round(d[0][0],d[0][1]);this.bbox={ll:{x:T.x,y:T.y},ur:{x:T.x,y:T.y}};let b=T;for(let D=1,C=d.length;D<C;D++){if(typeof d[D][0]!="number"||typeof d[D][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");let L=G.round(d[D][0],d[D][1]);L.x===b.x&&L.y===b.y||(this.segments.push(ae.fromRing(b,L,this)),L.x<this.bbox.ll.x&&(this.bbox.ll.x=L.x),L.y<this.bbox.ll.y&&(this.bbox.ll.y=L.y),L.x>this.bbox.ur.x&&(this.bbox.ur.x=L.x),L.y>this.bbox.ur.y&&(this.bbox.ur.y=L.y),b=L)}(T.x!==b.x||T.y!==b.y)&&this.segments.push(ae.fromRing(b,T,this))}getSweepEvents(){let d=[];for(let u=0,m=this.segments.length;u<m;u++){let T=this.segments[u];d.push(T.leftSE),d.push(T.rightSE)}return d}}class Se{constructor(d,u){if(!Array.isArray(d))throw new Error("Input geometry is not a valid Polygon or MultiPolygon");this.exteriorRing=new To(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,T=d.length;m<T;m++){let b=new To(d[m],this,!1);b.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=b.bbox.ll.x),b.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=b.bbox.ll.y),b.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=b.bbox.ur.x),b.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=b.bbox.ur.y),this.interiorRings.push(b)}this.multiPoly=u}getSweepEvents(){let d=this.exteriorRing.getSweepEvents();for(let u=0,m=this.interiorRings.length;u<m;u++){let T=this.interiorRings[u].getSweepEvents();for(let b=0,D=T.length;b<D;b++)d.push(T[b])}return d}}class vo{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,T=d.length;m<T;m++){let b=new Se(d[m],this);b.bbox.ll.x<this.bbox.ll.x&&(this.bbox.ll.x=b.bbox.ll.x),b.bbox.ll.y<this.bbox.ll.y&&(this.bbox.ll.y=b.bbox.ll.y),b.bbox.ur.x>this.bbox.ur.x&&(this.bbox.ur.x=b.bbox.ur.x),b.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=b.bbox.ur.y),this.polys.push(b)}this.isSubject=u}getSweepEvents(){let d=[];for(let u=0,m=this.polys.length;u<m;u++){let T=this.polys[u].getSweepEvents();for(let b=0,D=T.length;b<D;b++)d.push(T[b])}return d}}class Go{static factory(d){let u=[];for(let m=0,T=d.length;m<T;m++){let b=d[m];if(!b.isInResult()||b.ringOut)continue;let D=null,C=b.leftSE,L=b.rightSE,k=[C],X=C.point,P=[];for(;D=C,C=L,k.push(C),C.point!==X;)for(;;){let R=C.getAvailableLinkedEvents();if(R.length===0){let J=k[0].point,ne=k[k.length-1].point;throw new Error(`Unable to complete output ring starting at [${J.x}, ${J.y}]. Last matching segment found ends at [${ne.x}, ${ne.y}].`)}if(R.length===1){L=R[0].otherSE;break}let U=null;for(let J=0,ne=P.length;J<ne;J++)if(P[J].point===C.point){U=J;break}if(U!==null){let J=P.splice(U)[0],ne=k.splice(J.index);ne.unshift(ne[0].otherSE),u.push(new Go(ne.reverse()));continue}P.push({index:k.length,point:C.point});let K=C.getLeftmostComparator(D);L=R.sort(K)[0].otherSE;break}u.push(new Go(k))}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 k=1,X=this.events.length-1;k<X;k++){let P=this.events[k].point,R=this.events[k+1].point;$t(P,d,R)!==0&&(u.push(P),d=P)}if(u.length===1)return null;let m=u[0],T=u[1];$t(m,d,T)===0&&u.shift(),u.push(u[0]);let b=this.isExteriorRing()?1:-1,D=this.isExteriorRing()?0:u.length-1,C=this.isExteriorRing()?u.length:-1,L=[];for(let k=D;k!=C;k+=b)L.push([u[k].x,u[k].y]);return L}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 T=1,b=this.events.length;T<b;T++){let D=this.events[T];re.compare(d,D)>0&&(d=D)}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 At{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 T=this.interiorRings[u].getGeom();T!==null&&d.push(T)}return d}}class ri{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 T=this.polys[u].getGeom();T!==null&&d.push(T)}return d}_composePolys(d){let u=[];for(let m=0,T=d.length;m<T;m++){let b=d[m];if(!b.poly)if(b.isExteriorRing())u.push(new At(b));else{let D=b.enclosingRing();D.poly||u.push(new At(D)),D.poly.addInterior(b)}}return u}}class Yr{constructor(d){let u=arguments.length>1&&arguments[1]!==void 0?arguments[1]:ae.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 T=d.isLeft?this.tree.add(u):this.tree.find(u);if(!T)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 b=T,D=T,C,L;for(;C===void 0;)b=this.tree.prev(b),b===null?C=null:b.key.consumedBy===void 0&&(C=b.key);for(;L===void 0;)D=this.tree.next(D),D===null?L=null:D.key.consumedBy===void 0&&(L=D.key);if(d.isLeft){let k=null;if(C){let P=C.getIntersection(u);if(P!==null&&(u.isAnEndpoint(P)||(k=P),!C.isAnEndpoint(P))){let R=this._splitSafely(C,P);for(let U=0,K=R.length;U<K;U++)m.push(R[U])}}let X=null;if(L){let P=L.getIntersection(u);if(P!==null&&(u.isAnEndpoint(P)||(X=P),!L.isAnEndpoint(P))){let R=this._splitSafely(L,P);for(let U=0,K=R.length;U<K;U++)m.push(R[U])}}if(k!==null||X!==null){let P=null;k===null?P=X:X===null?P=k:P=re.comparePoints(k,X)<=0?k:X,this.queue.remove(u.rightSE),m.push(u.rightSE);let R=u.split(P);for(let U=0,K=R.length;U<K;U++)m.push(R[U])}m.length>0?(this.tree.remove(u),m.push(d)):(this.segments.push(u),u.prev=C)}else{if(C&&L){let k=C.getIntersection(L);if(k!==null){if(!C.isAnEndpoint(k)){let X=this._splitSafely(C,k);for(let P=0,R=X.length;P<R;P++)m.push(X[P])}if(!L.isAnEndpoint(k)){let X=this._splitSafely(L,k);for(let P=0,R=X.length;P<R;P++)m.push(X[P])}}}this.tree.remove(u)}return m}_splitSafely(d,u){this.tree.remove(d);let m=d.rightSE;this.queue.remove(m);let T=d.split(u);return T.push(m),d.consumedBy===void 0&&this.tree.add(d),T}}let Zr=typeof S<"u"&&S.env.POLYGON_CLIPPING_MAX_QUEUE_SIZE||1e6,ni=typeof S<"u"&&S.env.POLYGON_CLIPPING_MAX_SWEEPLINE_SEGMENTS||1e6;class Yt{run(d,u,m){Oe.type=d,G.reset();let T=[new vo(u,!0)];for(let P=0,R=m.length;P<R;P++)T.push(new vo(m[P],!1));if(Oe.numMultiPolys=T.length,Oe.type==="difference"){let P=T[0],R=1;for(;R<T.length;)O(T[R].bbox,P.bbox)!==null?R++:T.splice(R,1)}if(Oe.type==="intersection")for(let P=0,R=T.length;P<R;P++){let U=T[P];for(let K=P+1,J=T.length;K<J;K++)if(O(U.bbox,T[K].bbox)===null)return[]}let b=new l(re.compare);for(let P=0,R=T.length;P<R;P++){let U=T[P].getSweepEvents();for(let K=0,J=U.length;K<J;K++)if(b.insert(U[K]),b.size>Zr)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big).")}let D=new Yr(b),C=b.size,L=b.pop();for(;L;){let P=L.key;if(b.size===C){let U=P.segment;throw new Error(`Unable to pop() ${P.isLeft?"left":"right"} SweepEvent [${P.point.x}, ${P.point.y}] from segment #${U.id} [${U.leftSE.point.x}, ${U.leftSE.point.y}] -> [${U.rightSE.point.x}, ${U.rightSE.point.y}] from queue.`)}if(b.size>Zr)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big).");if(D.segments.length>ni)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments).");let R=D.process(P);for(let U=0,K=R.length;U<K;U++){let J=R[U];J.consumedBy===void 0&&b.insert(J)}C=b.size,L=b.pop()}G.reset();let k=Go.factory(D.segments);return new ri(k).getGeom()}}let Oe=new Yt;var Qr={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 Oe.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 Oe.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 Oe.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 Oe.run("difference",M,u)}};return Qr}))});var zt=_e(It=>{"use strict";f();It.__esModule=!0;It.extend=cf;It.indexOf=Vy;It.escapeExpression=jy;It.isEmpty=Gy;It.createFrame=Uy;It.blockParams=Hy;It.appendContextPath=Wy;var Ly={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","=":"&#x3D;"},Ny=/[&<>"'`=]/g,Ry=/[&<>"'`=]/;function By(o){return Ly[o]}function cf(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 Sl=Object.prototype.toString;It.toString=Sl;var Il=function(e){return typeof e=="function"};Il(/x/)&&(It.isFunction=Il=function(o){return typeof o=="function"&&Sl.call(o)==="[object Function]"});It.isFunction=Il;var pf=Array.isArray||function(o){return o&&typeof o=="object"?Sl.call(o)==="[object Array]":!1};It.isArray=pf;function Vy(o,e){for(var t=0,r=o.length;t<r;t++)if(o[t]===e)return t;return-1}function jy(o){if(typeof o!="string"){if(o&&o.toHTML)return o.toHTML();if(o==null)return"";if(!o)return o+"";o=""+o}return Ry.test(o)?o.replace(Ny,By):o}function Gy(o){return!o&&o!==0?!0:!!(pf(o)&&o.length===0)}function Uy(o){var e=cf({},o);return e._parent=o,e}function Hy(o,e){return o.path=e,o}function Wy(o,e){return(o?o+".":"")+e}});var Lo=_e((ia,df)=>{"use strict";f();ia.__esModule=!0;var El=["description","fileName","lineNumber","endLineNumber","message","name","number","stack"];function Ml(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<El.length;l++)this[El[l]]=s[El[l]];Error.captureStackTrace&&Error.captureStackTrace(this,Ml);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{}}Ml.prototype=new Error;ia.default=Ml;df.exports=ia.default});var ff=_e((aa,uf)=>{"use strict";f();aa.__esModule=!0;var xl=zt();aa.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(xl.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=xl.createFrame(t.data);i.contextPath=xl.appendContextPath(t.data.contextPath,t.name),t={data:i}}return n(e,t)})};uf.exports=aa.default});var gf=_e((sa,hf)=>{"use strict";f();sa.__esModule=!0;function zy(o){return o&&o.__esModule?o:{default:o}}var $n=zt(),Xy=Lo(),$y=zy(Xy);sa.default=function(o){o.registerHelper("each",function(e,t){if(!t)throw new $y.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=$n.appendContextPath(t.data.contextPath,t.ids[0])+"."),$n.isFunction(e)&&(e=e.call(this)),t.data&&(s=$n.createFrame(t.data));function c(I,E,O){s&&(s.key=I,s.index=E,s.first=E===0,s.last=!!O,l&&(s.contextPath=l+I)),a=a+r(e[I],{data:s,blockParams:$n.blockParams([e[I],I],[l+I,null])})}if(e&&typeof e=="object")if($n.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](),v=g.next();!v.done;v=g.next())h.push(v.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})};hf.exports=sa.default});var yf=_e((la,mf)=>{"use strict";f();la.__esModule=!0;function Yy(o){return o&&o.__esModule?o:{default:o}}var Zy=Lo(),Jy=Yy(Zy);la.default=function(o){o.registerHelper("helperMissing",function(){if(arguments.length!==1)throw new Jy.default('Missing helper: "'+arguments[arguments.length-1].name+'"')})};mf.exports=la.default});var If=_e((ca,vf)=>{"use strict";f();ca.__esModule=!0;function qy(o){return o&&o.__esModule?o:{default:o}}var bf=zt(),Qy=Lo(),Tf=qy(Qy);ca.default=function(o){o.registerHelper("if",function(e,t){if(arguments.length!=2)throw new Tf.default("#if requires exactly one argument");return bf.isFunction(e)&&(e=e.call(this)),!t.hash.includeZero&&!e||bf.isEmpty(e)?t.inverse(this):t.fn(this)}),o.registerHelper("unless",function(e,t){if(arguments.length!=2)throw new Tf.default("#unless requires exactly one argument");return o.helpers.if.call(this,e,{fn:t.inverse,inverse:t.fn,hash:t.hash})})};vf.exports=ca.default});var Ef=_e((pa,Sf)=>{"use strict";f();pa.__esModule=!0;pa.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)})};Sf.exports=pa.default});var xf=_e((da,Mf)=>{"use strict";f();da.__esModule=!0;da.default=function(o){o.registerHelper("lookup",function(e,t,r){return e&&r.lookupProperty(e,t)})};Mf.exports=da.default});var Cf=_e((ua,_f)=>{"use strict";f();ua.__esModule=!0;function Ky(o){return o&&o.__esModule?o:{default:o}}var Yn=zt(),e1=Lo(),t1=Ky(e1);ua.default=function(o){o.registerHelper("with",function(e,t){if(arguments.length!=2)throw new t1.default("#with requires exactly one argument");Yn.isFunction(e)&&(e=e.call(this));var r=t.fn;if(Yn.isEmpty(e))return t.inverse(this);var n=t.data;return t.data&&t.ids&&(n=Yn.createFrame(t.data),n.contextPath=Yn.appendContextPath(t.data.contextPath,t.ids[0])),r(e,{data:n,blockParams:Yn.blockParams([e],[n&&n.contextPath])})})};_f.exports=ua.default});var _l=_e(fa=>{"use strict";f();fa.__esModule=!0;fa.registerDefaultHelpers=m1;fa.moveHelperToHooks=y1;function tr(o){return o&&o.__esModule?o:{default:o}}var o1=ff(),r1=tr(o1),n1=gf(),i1=tr(n1),a1=yf(),s1=tr(a1),l1=If(),c1=tr(l1),p1=Ef(),d1=tr(p1),u1=xf(),f1=tr(u1),h1=Cf(),g1=tr(h1);function m1(o){r1.default(o),i1.default(o),s1.default(o),c1.default(o),d1.default(o),f1.default(o),g1.default(o)}function y1(o,e,t){o.helpers[e]&&(o.hooks[e]=o.helpers[e],t||(o.helpers[e]=void 0))}});var Of=_e((ha,Pf)=>{"use strict";f();ha.__esModule=!0;var b1=zt();ha.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=b1.extend({},l,t.partials);var c=e(a,s);return r.partials=l,c}),t.partials[n.args[0]]=n.fn,i})};Pf.exports=ha.default});var wf=_e(Cl=>{"use strict";f();Cl.__esModule=!0;Cl.registerDefaultDecorators=S1;function T1(o){return o&&o.__esModule?o:{default:o}}var v1=Of(),I1=T1(v1);function S1(o){I1.default(o)}});var Pl=_e((ga,Df)=>{"use strict";f();ga.__esModule=!0;var E1=zt(),jr={methodMap:["debug","info","warn","error"],level:"info",lookupLevel:function(e){if(typeof e=="string"){var t=E1.indexOf(jr.methodMap,e.toLowerCase());t>=0?e=t:e=parseInt(e,10)}return e},log:function(e){if(e=jr.lookupLevel(e),typeof console<"u"&&jr.lookupLevel(jr.level)<=e){var t=jr.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)}}};ga.default=jr;Df.exports=ga.default});var Ol=_e(Zn=>{"use strict";f();Zn.__esModule=!0;Zn.createProtoAccessControl=C1;Zn.resultIsAllowed=P1;Zn.resetLoggedProperties=w1;function M1(o){return o&&o.__esModule?o:{default:o}}var Ff=zt(),x1=Pl(),_1=M1(x1),ma=Object.create(null);function C1(o){var e=Object.create(null);e.__proto__=!1,Ff.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,Ff.extend(t,o.allowedProtoMethods),{properties:{whitelist:e,defaultValue:o.allowProtoPropertiesByDefault},methods:{whitelist:t,defaultValue:o.allowProtoMethodsByDefault}}}function P1(o,e,t){return Af(typeof o=="function"?e.methods:e.properties,t)}function Af(o,e){return o.whitelist[e]!==void 0?o.whitelist[e]===!0:o.defaultValue!==void 0?o.defaultValue:(O1(e),!1)}function O1(o){ma[o]!==!0&&(ma[o]=!0,_1.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 w1(){Object.keys(ma).forEach(function(o){delete ma[o]})}});var Al=_e(io=>{"use strict";f();io.__esModule=!0;io.HandlebarsEnvironment=Fl;function kf(o){return o&&o.__esModule?o:{default:o}}var or=zt(),D1=Lo(),wl=kf(D1),F1=_l(),A1=wf(),k1=Pl(),ya=kf(k1),L1=Ol(),N1="4.7.9";io.VERSION=N1;var R1=8;io.COMPILER_REVISION=R1;var B1=7;io.LAST_COMPATIBLE_COMPILER_REVISION=B1;var V1={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=V1;var Dl="[object Object]";function Fl(o,e,t){this.helpers=o||{},this.partials=e||{},this.decorators=t||{},F1.registerDefaultHelpers(this),A1.registerDefaultDecorators(this)}Fl.prototype={constructor:Fl,logger:ya.default,log:ya.default.log,registerHelper:function(e,t){if(or.toString.call(e)===Dl){if(t)throw new wl.default("Arg not supported with multiple helpers");or.extend(this.helpers,e)}else this.helpers[e]=t},unregisterHelper:function(e){delete this.helpers[e]},registerPartial:function(e,t){if(or.toString.call(e)===Dl)or.extend(this.partials,e);else{if(typeof t>"u")throw new wl.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(or.toString.call(e)===Dl){if(t)throw new wl.default("Arg not supported with multiple decorators");or.extend(this.decorators,e)}else this.decorators[e]=t},unregisterDecorator:function(e){delete this.decorators[e]},resetLoggedPropertyAccesses:function(){L1.resetLoggedProperties()}};var j1=ya.default.log;io.log=j1;io.createFrame=or.createFrame;io.logger=ya.default});var Nf=_e((ba,Lf)=>{"use strict";f();ba.__esModule=!0;function kl(o){this.string=o}kl.prototype.toString=kl.prototype.toHTML=function(){return""+this.string};ba.default=kl;Lf.exports=ba.default});var Rf=_e(Ll=>{"use strict";f();Ll.__esModule=!0;Ll.wrapHelper=G1;function G1(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 Hf=_e(No=>{"use strict";f();No.__esModule=!0;No.checkRevision=$1;No.template=Y1;No.wrapProgram=Ta;No.resolvePartial=Z1;No.invokePartial=J1;No.noop=Gf;function U1(o){return o&&o.__esModule?o:{default:o}}function H1(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 W1=zt(),Gr=H1(W1),z1=Lo(),ho=U1(z1),go=Al(),Bf=_l(),X1=Rf(),Vf=Ol();function $1(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 Y1(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=Gr.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)||Vf.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:Gr.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],v=this.fn(s);return l||h||p||c?g=Ta(this,s,v,l,c,p,h):g||(g=this.programs[s]=Ta(this,s,v)),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=Gr.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=q1(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={};jf(s,e.helpers,n),jf(s,a.helpers,n),n.helpers=s,o.usePartial&&(n.partials=n.mergeIfNeeded(a.partials,e.partials)),(o.usePartial||o.useDecorators)&&(n.decorators=Gr.extend({},e.decorators,a.decorators)),n.hooks={},n.protoAccessControl=Vf.createProtoAccessControl(a);var l=a.allowCallsToHelperMissing||t;Bf.moveHelperToHooks(n,"helperMissing",l),Bf.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 Ta(n,a,o[a],s,0,l,c)},i}function Ta(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 Z1(o,e,t){return o?!o.call&&!t.name&&(t.name=o,o=va(t.partials,o)):t.name==="@partial-block"?o=va(t.data,"partial-block"):o=va(t.partials,t.name),o}function J1(o,e,t){var r=va(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!==Gf&&(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=Gr.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 Gf(){return""}function va(o,e){if(o&&Object.prototype.hasOwnProperty.call(o,e))return o[e]}function q1(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),Gr.extend(e,a)}return e}function jf(o,e,t){e&&Object.keys(e).forEach(function(r){var n=e[r];o[r]=Q1(n,t)})}function Q1(o,e){var t=e.lookupProperty;return X1.wrapHelper(o,function(r){return r.lookupProperty=t,r})}});var zf=_e((Ia,Wf)=>{"use strict";f();Ia.__esModule=!0;Ia.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}};Wf.exports=Ia.default});var Jf=_e((Sa,Zf)=>{"use strict";f();Sa.__esModule=!0;function Rl(o){return o&&o.__esModule?o:{default:o}}function Bl(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 K1=Al(),Xf=Bl(K1),eb=Nf(),tb=Rl(eb),ob=Lo(),rb=Rl(ob),nb=zt(),Nl=Bl(nb),ib=Hf(),$f=Bl(ib),ab=zf(),sb=Rl(ab);function Yf(){var o=new Xf.HandlebarsEnvironment;return Nl.extend(o,Xf),o.SafeString=tb.default,o.Exception=rb.default,o.Utils=Nl,o.escapeExpression=Nl.escapeExpression,o.VM=$f,o.template=function(e){return $f.template(e,o)},o}var Jn=Yf();Jn.create=Yf;sb.default(Jn);Jn.default=Jn;Sa.default=Jn;Zf.exports=Sa.default});var Qf=_e((g4,qf)=>{f();qf.exports=Jf().default});f();f();f();f();f();var Bc="mi-session-data",Vc="mi-local-data",rn="id",nn="deviceId",Mt=class o{static#e;#t;#o;constructor(){try{let e=sessionStorage.getItem(Bc);e?this.#t=JSON.parse(e):this.#t={[rn]:oe()}}catch{this.#t={[rn]:oe()}}try{let e=localStorage.getItem(Vc);e?this.#o=JSON.parse(e):this.#o={[nn]:oe()}}catch{this.#o={[nn]:oe()}}this.#t[rn]||(this.#t[rn]=oe()),this.#o[nn]||(this.#o[nn]=oe())}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(Bc,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(Vc,JSON.stringify(this.#o)),!0}catch{return!1}}loadLocalData(e){let t=this.#o[e];if(t!=null)return t}};f();f();var fr=o=>o!=null;var ag=(function(){let e=globalThis.fetch;return{fetch(...t){if(!fr(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}}})(),jc=ag.fetch;var zc=["websdk","web","webv2","kiosk","kiosk-v2","mobile","iossdk","androidsdk","reactnativesdk","gen7","bespoke","reactsdk","minimap"],Gc=zc[0],Xc="https://api-gateway.mappedin.com/track-analytics/a/",$c="deny-watchposition",Yc="load-mapview",Zc="load-mapdata",Jc="change-language",qc="query-directions";var hr=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&&Mt.getInstance().saveSessionData("id",e.sessionId),e.deviceId&&Mt.getInstance().saveLocalData("deviceId",e.deviceId)}#r(e){let t=e.baseUri??Xc;return{baseUri:t,analyticsBaseUrl:Wa({...e,baseUri:t}),version:e.version||S?.env?.npm_package_version||"v6",deviceId:e.deviceId||Uc(),accessToken:e.accessToken,mapId:e.mapId,sessionId:e.sessionId||Hc(),platformString:e.platformString||"",context:Wc(e.context)||Gc,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=Wa({...this.#t,mapId:t.mapId})),t.context&&(t.context=Wc(t.context)),t.baseUri&&(t.analyticsBaseUrl=Wa({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||Gc}getSessionId(){return this.getState().sessionId||this.#e.sessionId||Hc()}getDeviceId(){return this.getState().deviceId||this.#e.deviceId||Uc()}sendAnalyticEvent(e,t={}){let r=this.getState(),n=sg(r.analyticsBaseUrl,e),i={"mi-context":this.getContext(),"mi-session":this.getSessionId(),"mi-device":this.getDeviceId()};if(r.logEvents&&x.log("Analytics.track",n,i),!r.sendEvents)return Promise.resolve();if(!this.authReady)return!r.key&&!r.secret&&!r.accessToken?void 0:x.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}`),jc(n,{method:"POST",mode:"cors",headers:i,body:JSON.stringify(a)})}capture(e,t){if(cg.includes(e))return x.warn(`${e} event is sent internally.`),Promise.resolve();let r=lg.includes(e)?e.slice(1):e;return this.sendAnalyticEvent(r,t)}sendGetMapDataEvent(e){return this.sendAnalyticEvent(Zc,e)}sendChangeLanguageEvent(e){return this.sendAnalyticEvent(Jc,e)}sendWatchPositionDenied(){return this.sendAnalyticEvent($c)}sendMapViewLoadedEvent({firstRenderDuration:e,dimension:t,collisionWorkerDisabled:r,outdoorsWorkerDisabled:n}){return this.sendAnalyticEvent(Yc,{type:"3d",firstRenderDuration:e,width:t.width,height:t.height,devicePixelRatio:globalThis.devicePixelRatio||1,collisionWorkerDisabled:r,outdoorsWorkerDisabled:n})}sendGetDirectionsEvent=pc((e,t,r)=>{let n={start:e,end:t,type:"location_to_location"};return r!==void 0&&(n.accessible=r),this.sendAnalyticEvent(qc,n)},2500);sendBlueDotEvents(e){if(!((e==="found-floor"||e==="found-position")&&this.oneTimeEventsSent.has(e)))return this.oneTimeEventsSent.add(e),this.sendAnalyticEvent(e)}};function Wa({mapId:o,baseUri:e=Xc}){return`${e}${o}/`}function Uc(){return Mt.getInstance().loadLocalData("deviceId")}function Hc(){return Mt.getInstance().loadSessionData("id")}function sg(o,e){return o+e}function Wc(o){return zc.find(e=>e===o)}var lg=["$select-location","$select-category","$query-suggest","$query-search"],cg=[Yc,Zc,qc,$c,Jc],DT=new hr,an=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 sn=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 x.error("Search should be enabled by now"),{places:[],enterpriseLocations:[],enterpriseCategories:[]};try{return await(await this.searchInstance).search(e,t)}catch(r){return x.error("Search.query failed due to",r),{places:[],enterpriseLocations:[],enterpriseCategories:[]}}}async suggest(e,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return x.error("Search should be enabled by now"),[];try{return await(await this.searchInstance).suggest(e,t)}catch(r){return x.error("Search.suggest failed due to",r),[]}}async enable(){this.enabled||(this.enabled=!0,this.searchInstance||(this.searchInstance=import("./internal-4G5ODHLV.js").then(({InternalSearch:e})=>new e(this.#e))),this.#t.on("language-change",this.#o),await this.searchInstance)}};var Qc={"enterprise-location":"location-profile","enterprise-category":"location-category"},Kc={"location-profile":"enterprise-location","location-category":"enterprise-category"},ep=new WeakMap,za=class{#e;#t;Analytics;Search;Query;internal;constructor(e,{search:t}={}){this.#e=new gt,this.#t=e,ep.set(this,e),this.Analytics=new an(e.Analytics),this.Query=e.Query,this.internal=e,this.Search=new sn(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 Qc?x.warn(`MappedinSDK: getByType('${e}') returned 0 results. This is a Maker map (API key starts with 'mik_'). Use '${Qc[e]}' instead. See https://developer.mappedin.com/web-sdk/getting-started`):r&&e in Kc&&x.warn(`MappedinSDK: getByType('${e}') returned 0 results. This is an Enterprise map. Use '${Kc[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})}},ln=za;function cn(o){let e=ep.get(o);if(!e)throw new Error("MapDataInternal not found");return e}f();f();f();f();f();function gr(o){return o.endsWith("/")?o:`${o}/`}f();var mr="https://app.mappedin.com/",tp="https://auth.mappedin.com/",op=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"}),pg=Object.freeze({...op,baseUri:"https://api-gateway.mappedin.com/",baseAuthUri:"https://auth.mappedin.com/"}),dg=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"}),ug=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"}),fg=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"}),hg={eu:dg,us:op,"us-enterprise":pg,"us-staging-enterprise":ug,"us-staging-self-serve":fg};function rp(o){return hg[o]}f();f();var gg=o=>{let e=Date.now();return o-e},Ti=(o,e)=>gg(o)<=e*60*1e3;var ip=10,ap=ip*60*1e3,np="accessTokens",mg="mik_";function sp(o){return typeof o=="string"&&o.startsWith(mg)}async function pn(o,e=!1,t=!1){let r=`${o.key}`,n=Mt.getInstance(),i=n?.loadSessionData(np)||{},a=Math.floor(Date.now()/1e3);if(!t&&i[r]&&!Ti(i[r].expiresTimestamp*1e3,ip))return i[r];let s=e?await yg(o,a):await bg(o,a),l={...i,[r]:s};return n?.saveSessionData(np,l),s}async function yg(o,e){let t;o.customAuthUri?t=o.customAuthUri:t=`${o.baseAuthUri??tp}oauth2/token`;let r;try{r=await mt()(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 bg(o,e){let t;o.customAuthUri?t=o.customAuthUri:t=`${o.baseAuthUri?gr(o.baseAuthUri):mr}api/v1/api-key/token`;let r;try{r=await mt()(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 cp=10,pp=cp*60*1e3,lp="miSasTokens";async function Xa(o,e){let t=`${e}__${o.mapId}`,r=Mt.getInstance(),n=r?.loadSessionData(lp)||{};if(n[t]&&!Ti(n[t].expires,cp))return n[t];let i=await Tg(o,e),a={...n,[t]:{token:i.token,expires:new Date(i.expires).getTime()}};return r?.saveSessionData(lp,a),i}async function Tg(o,e){let t=`${o.baseUri?gr(o.baseUri):mr}api/v1/venue/${o.mapId}/sas-token`,r=await mt()(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 yt=Uint8Array,Wo=Uint16Array,dp=Uint32Array,up=new yt([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]),fp=new yt([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]),vg=new yt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hp=function(o,e){for(var t=new Wo(31),r=0;r<31;++r)t[r]=e+=1<<o[r-1];for(var n=new dp(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]},gp=hp(up,2),mp=gp[0],Ig=gp[1];mp[28]=258,Ig[258]=28;var yp=hp(fp,0),Sg=yp[0],y0=yp[1],Ja=new Wo(32768);for(ue=0;ue<32768;++ue)so=(ue&43690)>>>1|(ue&21845)<<1,so=(so&52428)>>>2|(so&13107)<<2,so=(so&61680)>>>4|(so&3855)<<4,Ja[ue]=((so&65280)>>>8|(so&255)<<8)>>>1;var so,ue,dn=(function(o,e,t){for(var r=o.length,n=0,i=new Wo(e);n<r;++n)o[n]&&++i[o[n]-1];var a=new Wo(e);for(n=0;n<e;++n)a[n]=a[n-1]+i[n-1]<<1;var s;if(t){s=new Wo(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[Ja[h]>>>l]=c}else for(s=new Wo(r),n=0;n<r;++n)o[n]&&(s[n]=Ja[a[o[n]-1]++]>>>15-o[n]);return s}),un=new yt(288);for(ue=0;ue<144;++ue)un[ue]=8;var ue;for(ue=144;ue<256;++ue)un[ue]=9;var ue;for(ue=256;ue<280;++ue)un[ue]=7;var ue;for(ue=280;ue<288;++ue)un[ue]=8;var ue,bp=new yt(32);for(ue=0;ue<32;++ue)bp[ue]=5;var ue;var Eg=dn(un,9,1);var Mg=dn(bp,5,1),$a=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},Lt=function(o,e,t){var r=e/8|0;return(o[r]|o[r+1]<<8)>>(e&7)&t},Ya=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},xg=function(o){return(o+7)/8|0},Qa=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?Wo:o.BYTES_PER_ELEMENT==4?dp:yt)(t-e);return r.set(o.subarray(e,t)),r};var _g=["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||_g[o]);if(r.code=o,Error.captureStackTrace&&Error.captureStackTrace(r,Nt),!t)throw r;return r},Cg=function(o,e,t){var r=o.length;if(!r||t&&t.f&&!t.l)return e||new yt(0);var n=!e||t,i=!t||t.i;t||(t={}),e||(e=new yt(r*3));var a=function(Ft){var yo=e.length;if(Ft>yo){var bo=new yt(Math.max(yo*2,Ft));bo.set(e),e=bo}},s=t.f||0,l=t.p||0,c=t.b||0,p=t.l,h=t.d,g=t.m,v=t.n,I=r*8;do{if(!p){s=Lt(o,l,1);var E=Lt(o,l+1,3);if(l+=3,E)if(E==1)p=Eg,h=Mg,g=9,v=5;else if(E==2){var W=Lt(o,l,31)+257,N=Lt(o,l+10,15)+4,B=W+Lt(o,l+5,31)+1;l+=14;for(var G=new yt(B),A=new yt(19),j=0;j<N;++j)A[vg[j]]=Lt(o,l+j*3,7);l+=N*3;for(var te=$a(A),he=(1<<te)-1,ge=dn(A,te,1),j=0;j<B;){var ie=ge[Lt(o,l,he)];l+=ie&15;var O=ie>>>4;if(O<16)G[j++]=O;else{var Te=0,Be=0;for(O==16?(Be=3+Lt(o,l,3),l+=2,Te=G[j-1]):O==17?(Be=3+Lt(o,l,7),l+=3):O==18&&(Be=11+Lt(o,l,127),l+=7);Be--;)G[j++]=Te}}var Ve=G.subarray(0,W),pe=G.subarray(W);g=$a(Ve),v=$a(pe),p=dn(Ve,g,1),h=dn(pe,v,1)}else Nt(1);else{var O=xg(l)+4,w=o[O-4]|o[O-3]<<8,F=O+w;if(F>r){i&&Nt(0);break}n&&a(c+w),e.set(o.subarray(O,F),c),t.b=c+=w,t.p=l=F*8,t.f=s;continue}if(l>I){i&&Nt(0);break}}n&&a(c+131072);for(var $e=(1<<g)-1,wt=(1<<v)-1,ot=l;;ot=l){var Te=p[Ya(o,l)&$e],ve=Te>>>4;if(l+=Te&15,l>I){i&&Nt(0);break}if(Te||Nt(2),ve<256)e[c++]=ve;else if(ve==256){ot=l,p=null;break}else{var mo=ve-254;if(ve>264){var j=ve-257,se=up[j];mo=Lt(o,l,(1<<se)-1)+mp[j],l+=se}var Et=h[Ya(o,l)&wt],Dt=Et>>>4;Et||Nt(3),l+=Et&15;var pe=Sg[Dt];if(Dt>3){var se=fp[Dt];pe+=Ya(o,l)&(1<<se)-1,l+=se}if(l>I){i&&Nt(0);break}n&&a(c+131072);for(var $t=c+mo;c<$t;c+=4)e[c]=e[c-pe],e[c+1]=e[c+1-pe],e[c+2]=e[c+2-pe],e[c+3]=e[c+3-pe];c=$t}}t.l=p,t.p=ot,t.b=c,t.f=s,p&&(s=1,t.m=g,t.d=h,t.n=v)}while(!s);return c==e.length?e:Qa(e,0,c)};var Pg=new yt(0);var Qt=function(o,e){return o[e]|o[e+1]<<8},Rt=function(o,e){return(o[e]|o[e+1]<<8|o[e+2]<<16|o[e+3]<<24)>>>0},Za=function(o,e){return Rt(o,e)+Rt(o,e+4)*4294967296};function Og(o,e){return Cg(o,e)}var qa=typeof TextDecoder<"u"&&new TextDecoder,wg=0;try{qa.decode(Pg,{stream:!0}),wg=1}catch{}var Dg=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,Qa(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 Fg(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(qa)return qa.decode(o);var n=Dg(o),i=n[0],a=n[1];return a.length&&Nt(8),i}}var Ag=function(o,e){return e+30+Qt(o,e+26)+Qt(o,e+28)},kg=function(o,e,t){var r=Qt(o,e+28),n=Fg(o.subarray(e+46,e+46+r),!(Qt(o,e+8)&2048)),i=e+46+r,a=Rt(o,e+20),s=t&&a==4294967295?Lg(o,i):[a,Rt(o,e+24),Rt(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]},Lg=function(o,e){for(;Qt(o,e)!=1;e+=4+Qt(o,e+2));return[Za(o,e+12),Za(o,e+4),Za(o,e+20)]};function Ka(o,e){for(var t={},r=o.length-22;Rt(o,r)!=101010256;--r)(!r||o.length-r>65558)&&Nt(13);var n=Qt(o,r+8);if(!n)return{};var i=Rt(o,r+16),a=i==4294967295||n==65535;if(a){var s=Rt(o,r-12);a=Rt(o,s)==101075792,a&&(n=Rt(o,s+32),i=Rt(o,s+48))}for(var l=e&&e.filter,c=0;c<n;++c){var p=kg(o,i,a),h=p[0],g=p[1],v=p[2],I=p[3],E=p[4],O=p[5],w=Ag(o,O);i=E,(!l||l({name:I,size:g,originalSize:v,compression:h}))&&(h?h==8?t[I]=Og(o.subarray(w,w+g),new yt(v)):Nt(14,"unknown compression type "+h):t[I]=Qa(o,w,w+g))}return t}var Tp=globalThis.fetch,Rg=S?.env?.npm_package_version;function mt(){if(Tp==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return Tp}async function Bg(o){return typeof o=="function"?o():o}var es={supplementaryUrl:"https://api-gateway.mappedin.com/analytics/",headers:{},accessToken:"",clientId:"",noAuth:!1,includeHidden:!0,clientSecret:"",apiGateway:"",authorization:"",perspective:"Website",language:"",venue:""};function Ip(o){let e={...es,...o};return e.headers={...e.headers,"mappedin-sdk-version":Rg},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 Vg(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 jg(o,e,t=!1){let r=Vg(o,e,t),n=await mt()(r.url,r.req);if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);return n.json()}var Gg=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 x.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){x.warn(`Perspective ${r} is missing url or locale_packs!`);continue}t[r]={url:i,locale_packs:a}}return t};async function Ug(o,e="exports/mvf/1/bundle"){let t=Ip({baseUri:"https://api-gateway.mappedin.com/",...es,...o}),r=`${t.baseUri+e}?venue=${t.venue}&version=${t.version??"2.0.0"}`;t.headers["Content-Type"]="application/zip";let n=await jg(t,r),i=n.url,a=n.locale_packs,s=t.perspective??es.perspective,l=Gg(n);if(s!=null&&s!==""&&l!=null){let c=l[s];c==null?x.warn(`Perspective ${s} not found in response! Loading default perspective instead.`):(x.log(`Loading perspective "${s}"`),i=c.url,a=c.locale_packs)}return{url:i,localePacks:a,updated_at:n.updated_at}}var yr=(function(){let o;return()=>(o||(o=new TextDecoder),o)})();async function ts(o,{signal:e}){let t=await(await mt()(o,{signal:e})).arrayBuffer();return new Uint8Array(t)}async function br(o){let e=Ka(o),t={};if(e["enterprise/"]!=null){t.enterprise={};let r=e["enterprise/locations.json"];r&&(t.enterprise.locations=JSON.parse(yr().decode(r)));let n=e["enterprise/locationInstances.json"];n&&(t.enterprise.locationInstances=JSON.parse(yr().decode(n)));let i=e["enterprise/categories.json"];i&&(t.enterprise.categories=JSON.parse(yr().decode(i)))}return e["floorstack.json"]&&(t["floorstack.json"]=JSON.parse(yr().decode(e["floorstack.json"]))),e["floor.geojson"]&&(t["floor.geojson"]=JSON.parse(yr().decode(e["floor.geojson"]))),e["manifest.json"]&&(t["manifest.geojson"]=JSON.parse(yr().decode(e["manifest.json"]))),t}async function Sp(o,{signal:e}){try{let t=await(await mt()(o,{signal:e})).arrayBuffer();if(e.aborted)return;let r=new Uint8Array(t);return await br(r)}catch(t){let r=new Error("downloadLanguagePack failed");throw r.cause=t,r}}function Hg(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 os(o){return new Promise(async(e,t)=>{try{let r=Hg(o),{url:n,localePacks:i}=await Ug(o,r),a=await mt()(n).then(l=>l.arrayBuffer()),s=new Uint8Array(a);e({compressed:s,localePacks:i})}catch(r){t(r)}})}async function rs(o,e){return new Promise(async(t,r)=>{try{let{url:n}=await Wg(o,e),i=await mt()(n).then(s=>s.arrayBuffer()),a=new Uint8Array(i);t(a)}catch(n){r(n)}})}async function Wg(o,e){if(o.bundleUri!=null)return{url:await Bg(o.bundleUri),updated_at:""};if(e==null||e==="")throw new Error("Missing access token.");let t=new URL(`${o.baseUri?gr(o.baseUri):mr}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 mt()(t.toString(),{headers:{Authorization:`Bearer ${e}`}});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);return r.json()}function Ep(o){return Fa(o)}function zg(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 ns(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=Ka(o);if(!zg(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"){x.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 xo(){let o="us",e={};function t(){return Xg(rp(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 Xg(o,e){return{...o,...e}}var vi=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_",""))},Ii=o=>o?.cms!=null,vp=async o=>{let e=performance.now(),t,r=vc.decompressUnsafeSync(o);r.isOk()?t=r.unwrap():x.error("MVFv3 decompression failed!");let n;if(t)try{n=Tc(t)}catch(i){x.error("MVFv3 to MVFv2 conversion failed!",i)}if(x.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 Si(o,e="2.0.0"){switch(e){case"2.0.0":case"2.0.0-c":try{let t=performance.now(),r=await ns(o),n=Fa(r);return x.log(`Parsed MVFv2 in ${performance.now()-t}ms`),{mvf2:n}}catch{return x.error("MVFv2 parsing failed! Trying MVFv3."),vp(o)}case"3.0.0":return vp(o);default:throw new Error(`Unsupported MVF version: ${e}`)}}f();f();function $g(o,e,t){t===void 0&&(t={});for(var r=Mo(o),n=pr(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")),Yg(n[i],n[i+1],r,a,typeof t.epsilon>"u"?null:t.epsilon))return!0}return!1}function Yg(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,v=c-s,I=p-l,E=h*I-g*v;if(n!==null){if(Math.abs(E)>n)return!1}else if(E!==0)return!1;if(r){if(r==="start")return Math.abs(v)>=Math.abs(I)?v>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(v)>=Math.abs(I)?v>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(v)>=Math.abs(I)?v>0?s<i&&i<c:c<i&&i<s:I>0?l<a&&a<p:p<a&&a<l}else return Math.abs(v)>=Math.abs(I)?v>0?s<=i&&i<=c:c<=i&&i<=s:I>0?l<=a&&a<=p:p<=a&&a<=l;return!1}var Mp=$g;f();function Zg(o,e){e===void 0&&(e={});var t=cr(o),r=(t[0]+t[2])/2,n=(t[1]+t[3])/2;return lr([r,n],e.properties,e)}var Tr=Zg;f();f();function Jg(o,e,t){t===void 0&&(t={});var r=Mo(o),n=Mo(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 dc(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),t.units)}var _o=Jg;function Ei(o,e){return e===void 0&&(e={}),hc(o,function(t,r){var n=r.geometry.coordinates;return t+_o(n[0],n[1],e)},0)}f();f();f();function Mi(o,e,t){if(t===void 0&&(t={}),t.final===!0)return qg(o,e);var r=Mo(o),n=Mo(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 uc(Math.atan2(c,p))}function qg(o,e){var t=Mi(e,o);return t=(t+180)%360,t}function Qg(o,e,t){t===void 0&&(t={});var r=lr([1/0,1/0],{dist:1/0}),n=0;return fc(o,function(i){for(var a=pr(i),s=0;s<a.length-1;s++){var l=lr(a[s]);l.properties.dist=_o(e,l,t);var c=lr(a[s+1]);c.properties.dist=_o(e,c,t);var p=_o(l,c,t),h=Math.max(l.properties.dist,c.properties.dist),g=Mi(l,c),v=Aa(e,h,g+90,t),I=Aa(e,h,g-90,t),E=Ic(tn([v.geometry.coordinates,I.geometry.coordinates]),tn([l.geometry.coordinates,c.geometry.coordinates])),O=null;E.features.length>0&&(O=E.features[0],O.properties.dist=_o(e,O,t),O.properties.location=n+_o(l,O,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),O&&O.properties.dist<r.properties.dist&&(r=O,r.properties.index=s),n+=p}}),r}var fn=Qg;function Kg(o,e,t){var r=pr(t);if(mc(t)!=="LineString")throw new Error("line must be a LineString");var n=fn(t,o),i=fn(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),tn(s,t.properties)}var is=Kg;var em=1e-7;function as(o){return{type:"Point",coordinates:o}}function tm(o,e){let{coordinates:t}=e.geometry,{coordinates:r}=o.geometry,n=t.map(i=>fn(o,as(i)));return r.reduce((i,a)=>{let s=is(as(a),n[0],o),l=is(as(a),n[1],o),c=Ei(s)<Ei(l)?s:l;return c.properties={...o.properties,entrances:[]},i.concat([c])},[])}function ss(o,e){return e.reduce((t,r)=>{let n={epsilon:em},i=t.obstructions.findIndex(s=>Mp(Tr(r),s,n)),a=t.obstructions[i];if(a){let[s,l]=tm(a,r);t.entrances.push(r),t.obstructions.splice(i,1,s,l)}return t},{obstructions:[o],entrances:[]})}f();f();f();var Le=class{id;constructor(e){this.id=e}};f();f();var ls=class o{static __type="coordinate";__type=o.__type;id=oe();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]}},z=ls;function cs(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 om=/^https?:\/\/cdn(-staging)?\.mappedin\.com(\/|$)/;function xp(o){return om.test(o)}function _p(o){return!!o.split("?")[1]?.includes("sv=")}function Ke(o,e){let t=o?.properties?.id||"unknown";if(o.geometry==null)return x.error(`Cannot get the center coordinate for "${t}" because it has no geometry.`),new z({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 z({latitude:l,longitude:s,floorId:e})}else if(o.geometry.type==="Point"){let[r,n]=o.geometry.coordinates;return new z({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 z({latitude:i,longitude:n,floorId:e})}}}catch{}try{let[r,n]=Tr(o).geometry.coordinates;return new z({latitude:n,longitude:r,floorId:e})}catch(r){return x.error(`Failed to get center coordinate for "${t}" ${r instanceof Error?r.stack:""}`),new z({latitude:0,longitude:0,floorId:e})}}function Cp(o,e){return e&&(o.flags[e.index]&1<<e.bit)!==0}function xi(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 ps=class o extends Le{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=Ke(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&&Cp({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=ps;f();f();f();f();var ds=class o extends Le{static __type="hyperlink";__type=o.__type;#e={};#t;static is(e){return e.__type===o.__type}constructor(e){super(String(oe())),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]}},zo=ds;f();f();function hn(o){return typeof o=="string"?o:o?.id??""}function Pp(o){return Array.isArray(o)&&Number.isFinite(o[0])&&Number.isFinite(o[1])}var rm=/^https:\/\/cdn\.mappedin\.com\/category-symbols\/.+$/,nm=/^https:\/\/cdn-staging\.mappedin\.net\/category-symbols\/.+$/,im=o=>rm.test(o)||nm.test(o),am=/^https:\/\/cdn\.mappedin\.com\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,sm=/^https:\/\/cdn-staging\.mappedin\.com\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,lm=o=>im(o)?!1:am.test(o)||sm.test(o),vr=o=>{if(!lm(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 us(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 fs(o){return o!=null&&typeof o=="object"&&"name"in o&&o.name!=null&&typeof o.name=="string"&&o.name!==""}function Op(o){return lo(o)&&fs(o)}var hs=class o extends Le{static __type="image";__type=o.__type;#e={};#t;#o;static is(e){return e.__type===o.__type}constructor(e){super(String(oe())),this.#t=e.mvfData,this.#o=e.mapData}get url(){let e=this.#t.url;if(this.#o.tokenManager==null)return e;let t=vr(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"&&x.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=hs;f();var Bt=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=cr(this.geoJSON),this.#e)}get geoJSON(){return{properties:null,type:"Feature",geometry:{type:"Polygon",coordinates:[[]]}}}};var Ne=class extends Bt{#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 zo({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 bt=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=vr(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"&&x.error("Error getting SAS token for image",{error:r,url:this.#t}),this.#t}}};f();f();function Co(o){let e;if(z.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&&z.is(o.center))e=o.center;else if("coordinate"in o&&z.is(o.coordinate))e=o.coordinate;else return;return e}f();f();var gn={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",Po="Walls",wp=0,Ir="InteriorDoors",Sr="ExteriorDoors",Er="InteriorDoorsLayer",Mr="ExteriorDoorsLayer",Ce="GeometryLayer",mn="Focusable-",to="LabelsLayer",Vt="MarkersLayer",yn="FootprintLayer",Xo="OcclusionLayer",$o="AreasLayer",xr="ImagesLayer",Yo="FacadesLayer",oo="PathsLayer",jt="ModelsLayer",Zo="Text3DLayer",cm="geometryText",pm="floortext";function Dp(o){return`${Zo}-${o}`}function Oo(o){return`${cm}-${o}`}function _r(o){return`${pm}-${o}`}var Fp=["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"],dm={orange:"#F26336",teal:"#057685",lightTeal:"#5DC7D0"};var um=new Set(["outdoorView","bearing","pitch","zoomLevel","screenOffsets","debug","initialFloor","shadingAndOutlines","wallTopColor","style","multiFloorView","occlusion","imagePlacementOptions","flipImagesToFaceCamera","injectStyles","useStandaloneCamera","preloadFloors"]),fm=new Set(["style","enabled","layersHiddenByGeometry","lowDpi"]);function gs(o){o.outdoorView?.enabled&&!o.outdoorView?.token&&x.error("Enable outdoor view requires a token. Provide token in `options.outdoorView.token`")}function ms(o,e){let t=o?.outdoorView?.token||e.outdoorViewToken,r={...gn,...o,outdoorView:{enabled:o?.outdoorView?.enabled===void 0?!!t:o?.outdoorView?.enabled,layersHiddenByGeometry:gn.outdoorView?.layersHiddenByGeometry,...o?.outdoorView},bearing:o?.bearing??e.naturalBearing??0,imagePlacementOptions:{...gn.imagePlacementOptions,...o?.imagePlacementOptions},multiFloorView:{...gn.multiFloorView,...o?.multiFloorView},disableUpdateStateValidation:o?.disableUpdateStateValidation??!1};return t&&r.outdoorView&&(r.outdoorView.token=t),r}function Ap(o){let e={remove_watermark:!1};if(o)try{let t=gi(o);Object.assign(e,t.capabilities)}catch(t){x.error("Error decoding capabilities from token",t)}return e}function kp(o){let e=Object.fromEntries(Object.entries(o).filter(([t])=>um.has(t)));return e.outdoorView&&(e.outdoorView=Object.fromEntries(Object.entries(e.outdoorView).filter(([t])=>fm.has(t)))),e}var ys=class o extends Ne{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=Ke(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.#n();return t?[...e,t]:e}#n(){let e=this.#r.properties;if(e.image!=null)return this.#o.polygonImage==null&&(this.#o.polygonImage=new bt(`${this.id}-polygon-image-${oe()}`,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(){}},_t=ys;f();var bs=class o extends Ne{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=Ke(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]}},it=bs;f();var Ts=class o extends Ne{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 gm(this.#r.properties.kind)}get enterpriseLocations(){return this.#o.enterpriseLocations!=null?this.#o.enterpriseLocations:(this.#o.enterpriseLocations=xi(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.#n();return t?[...e,t]:e}#n(){let e=this.#r.properties;if(e.image!=null)return this.#o.polygonImage==null&&(this.#o.polygonImage=new bt(`${this.id}-polygon-image-${oe()}`,e.image.path,this,this.#e.tokenManager)),this.#o.polygonImage}get center(){return this.#o.center==null&&(this.#o.center=Ke(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]}},hm=["room","hallway","exterior","void","gate","otb"];function gm(o){if(o==null||o==="default")return"room";let e=o.toLowerCase();return hm.includes(e)?e:"room"}var xe=Ts;f();var vs=class o extends Bt{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=Ke(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=vs;f();var Is=class o extends Ne{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(fr)}get floors(){return this.coordinates.map(e=>e.floorId?this.#e.getById("floor",e.floorId):void 0).filter(fr)}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=Is;f();var Ss=class o extends Ne{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=xi(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=Ke(this.#r,this.#t)),this.#o.center}get images3D(){let e=this.#e.floorImagesByAnchorId.get(this.id)??[],t=this.#n();return t?[...e,t]:e}#n(){let e=this.#r.properties;if(e.image!=null)return this.#o.polygonImage==null&&(this.#o.polygonImage=new bt(`${this.id}-polygon-image-${oe()}`,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=Ss;f();var Es=class o extends Ne{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=Ke(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}},Tt=Es;f();var Ms=class o extends Ne{static __type="annotation";__type=o.__type;#e;#t;#o={};#r;#n;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.#n=t.symbol??{url:"",name:""}}#i(){let[e,t]=this.#r.properties.symbolId.split("--");return{group:e,type:t}}get group(){return this.#i().group}get type(){return this.#i().type}get coordinate(){return this.#o.coordinate==null&&(this.#o.coordinate=Ke(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.#n.name||""}get icon(){return this.#o.icon==null&&(this.#o.icon=super.icon||new Kt({mvfData:{url:this.#n.url,altText:this.#n.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]}},Gt=Ms;f();f();var Lp=di(Cs(),1);function mm(o,e,t){t===void 0&&(t={});var r=dr(o),n=dr(e),i=Lp.default.union(r.coordinates,n.coordinates);return i.length===0?null:i.length===1?fi(i[0],t.properties):hi(i,t.properties)}var _i=mm;var Ps=class o extends Bt{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}#n(e){return this.#e.getPropTranslation(this.__type,e,this.id,this.#o[e])}get type(){return this.#o.type}get name(){let e=this.#n("name");return typeof e=="string"?e:""}get shortName(){let e=this.#n("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&&x.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=_i(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]}},Cr=Ps;f();var Os=class o extends Bt{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 De("No geometry found for facade!");let t=Tr(e);this.#r.center=new z({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}}},Ge=Os;f();var ym=new Set(["wall","area"]),bm=new Set(["desk-entrance"]),Tm=o=>{let e={};for(let t of o?.locations??[])e[t.id]=t;return{mvf3LocationsById:e}},vm=(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 Pi(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}},Im=(o,e)=>{let t={},r={},n={},i={},a={},s={},l={},c={},p={},h=globalThis.Object.keys(o.space);for(let g of h){let v=o.space[g];if(v!=null){for(let I of v.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)),!Lm(I))if(I.properties.kind==="poi"||I.geometry.type==="Point"&&I.properties.kind==null){let E=new Tt(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")x.warn("Encountered a point space with an unknown kind!",I.properties.kind);else{let E=new xe(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}},Sm=(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}},Em=(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(ym.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}},Mm=(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}},xm=(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 Cr(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 Ge(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}},_m=(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}},Cm=(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 it(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}},Pm=(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)}}}}},Om=(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)}}}}},wm=(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}}})}},Dm=(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)}}},Fm=(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 Gt(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}},Am=(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 _t(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}},km=(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}},Np=(o,e)=>{let t={},r={},n={},i={},a=(o.enterprise?.locations??[]).reduce((F,W)=>(F[W.id]=W,F),{}),s={},l={},c={},p={},h={},g={},v=o.enterprise?.venue||{},I={},E={},O={};for(let F of o.enterprise?.categories??[]){let W=new Ci(e,{mvfData:F});s[F.id]=W,F.externalId&&(l[F.externalId]==null&&(l[F.externalId]=[]),l[F.externalId].push(W)),c[F.id]=F,F.locations.forEach(N=>{h[N]==null&&(h[N]=[]),h[N].push(F.id)})}let w={};for(let F of o.enterprise?.locationInstances??[]){let W=a[F.parent],N=Object.keys(W),B={};for(let j of N)B[j]=void 0;let G={...B,polygons:[],nodes:[],...F};w[G.parent]==null&&(w[G.parent]=[]);let A=new ct(e,{mvfData:G,categoryIds:o.enterprise?.categoryPriorities?.[G.id]||h[G.id],parentId:F.parent});w[G.parent].push(A);for(let j of F.polygons??[])O[j.id]=A;I[G.id]=F,E[G.id]=A,F.externalId&&(i[F.externalId]==null&&(i[F.externalId]=[]),i[F.externalId].push(A))}for(let F of o.enterprise?.locations??[]){let W=new ct(e,{mvfData:F,categoryIds:o.enterprise?.categoryPriorities?.[F.id]||h[F.id],locationInstances:w[F.id]});n[F.id]=W,F.externalId&&(i[F.externalId]==null&&(i[F.externalId]=[]),i[F.externalId].push(W)),F.nodes.forEach(N=>{g[N.id]==null&&(g[N.id]=[]),g[N.id].push(F.id)});for(let N of F.polygons)p[N.id]==null&&(p[N.id]=[]),p[N.id].push(F)}if(e.enterpriseMode===!0){for(let F in e.mvfConnectionsById){let W={},N=e.mvfConnectionsById[F],B={id:F,externalId:N.externalId,kind:"enterprise."+N.type,destinationNodes:[],flags:N.flags,type:N.type,nodes:N.nodes,accessible:N.accessible,extra:N.extra,details:N.details};for(let G of e.mvfConnectionsById[F].nodes){let A=e.nodesById[G];A!=null&&(W[A.floor.id]={type:"Feature",geometry:{type:"Point",coordinates:[A.coordinate.longitude,A.coordinate.latitude]},properties:B})}Object.keys(W).length>0&&(t[F]=new Ze(e,{mvfData:B}),N.externalId&&(r[N.externalId]==null&&(r[N.externalId]=[]),r[N.externalId].push(t[F])))}e.connectionsById=t}return{connectionsByExternalId:r,locationIdsByNodeId:g,mvfLocationsByGeometryId:p,mvfLocationsById:a,mvfCategoriesById:c,locationsById:n,locationInstancesById:E,instanceLocationsByPolygonId:O,locationsByExternalId:i,mvfLocationInstancesById:I,categoriesById:s,categoriesByExternalId:l,venue:v}},Rp=(o,e,t)=>{let{nodesById:r,nodesByExternalId:n,mvfNodesById:i,mvfNodesByFloorId:a}=Sm(e,o),{connectionsById:s,mvfConnectionsById:l,mvfConnectionsByNodeId:c}=_m(e,o),{spacesById:p,spacesByExternalId:h,poisById:g,poisByExternalId:v,mvfSpacesById:I,objectEntranceNodeIdsByObstructionId:E,mvfSpacesByFloorId:O,mvfPoisByFloorId:w}=Im(e,o),{objectsById:F,objectsByExternalId:W,mvfObstructionById:N,obstructionIdByEntranceId:B}=Em(e,o),{floorsById:G,floorsByExternalId:A,mvfFloorsById:j}=Mm(e,o),{floorStacksById:te,floorStacksByExternalId:he,mvfFloorStacksById:ge,facadesById:ie,facadesBySpaceId:Te}=xm(e,o),{doorsById:Be,doorsByExternalId:Ve,doorsByNodeId:pe,mvfEntrancesById:$e,mvfEntrancesByFloorId:wt}=Cm(e,o),{annotationsById:ot,mvfAnnotationsById:ve,mvfAnnotationsByFloorId:mo}=Fm(e,o),{areasById:se,areasByExternalId:Et,mvfAreasById:Dt}=Am(e,o);Om(e,I,N,Dt),Pm(e,I,N),wm(e,I),Dm(e,I,N);let{mvf3LocationsById:$t}=Tm(t),{locationCategoriesByParentId:Ft,locationProfilesById:yo,locationCategoriesById:bo,locationProfilesByExternalId:Vo,locationProfilesByCategoryId:ir,locationProfilesByAttachedFeatureId:ar}=vm(o,e,$t),{entranceNodeIdsBySpaceId:re,spaceIdsByNodeId:jo,objectIdsByNodeId:ae,destinationNodesIdsBySpaceId:To}=km(I,pe);return{spacesById:p,spacesByExternalId:h,nodesById:r,nodesByExternalId:n,objectsById:F,objectsByExternalId:W,floorsById:G,floorsByExternalId:A,floorStacksById:te,floorStacksByExternalId:he,facadesById:ie,facadesBySpaceId:Te,connectionsById:s,doorsById:Be,doorsByExternalId:Ve,doorsByNodeId:pe,poisById:g,poisByExternalId:v,annotationsById:ot,areasById:se,areasByExternalId:Et,objectEntranceNodeIdsByObstructionId:E,obstructionIdByEntranceId:B,locationProfilesById:yo,locationCategoriesById:bo,locationProfilesByExternalId:Vo,locationProfilesByCategoryId:ir,locationCategoriesByParentId:Ft,mvfSpacesById:I,mvfNodesById:i,mvfObstructionById:N,mvfFloorsById:j,mvfFloorStacksById:ge,mvfConnectionsById:l,mvfConnectionsByNodeId:c,mvfEntrancesById:$e,mvfAnnotationsById:ve,mvfNodesByFloorId:a,mvfSpacesByFloorId:O,mvfPoisByFloorId:w,mvfAreasById:Dt,mvfEntrancesByFloorId:wt,mvfAnnotationsByFloorId:mo,locationProfilesByAttachedFeatureId:ar,entranceNodeIdsBySpaceId:re,spaceIdsByNodeId:jo,objectIdsByNodeId:ae,destinationNodesIdsBySpaceId:To,mvf3LocationsById:$t}};function Lm(o){return!["Polygon","MultiPolygon"].includes(o.geometry.type)&&"kind"in o.properties&&o.properties.kind==null||o.properties.kind?.includes("connection")||bm.has(o.properties.kind??"")}f();var Nm=new Set(["polygons"]),ws=class o extends Le{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)!Nm.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=ws;f();var Rm=new Set,Ds=class o extends Le{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)!Rm.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]}},Ci=Ds;f();var Bm=new Set,Fs=class o extends Le{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)!Bm.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]}},As=Fs;f();f();f();f();f();var Bp=(i=>(i.Departure="Departure",i.TakeConnection="TakeConnection",i.ExitConnection="ExitConnection",i.Turn="Turn",i.Arrival="Arrival",i))(Bp||{}),ks=(a=>(a.Straight="Straight",a.Right="Right",a.SlightRight="SlightRight",a.Left="Left",a.SlightLeft="SlightLeft",a.Back="Back",a))(ks||{}),Vp=(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))(Vp||{}),Oi=(t=>(t.Exterior="exterior-walls",t.Interior="interior-walls",t))(Oi||{}),wi=(t=>(t.Interior="interior-doors",t.Exterior="exterior-doors",t))(wi||{});f();function jp(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}=gc(a),c=s(e),p=s(t),h=p.x-c.x,g=p.y-c.y,v=i-n,I=Math.sqrt(h*h+g*g+v*v);if(I<=r*2)return null;let E=r/I,O={x:c.x+h*E,y:c.y+g*E},w=l(O.x,O.y),F=e[2]!==void 0?e[2]+v*E:void 0,W={x:p.x-h*E,y:p.y-g*E},N=l(W.x,W.y),B=t[2]!==void 0?t[2]-v*E:void 0;return{fromPosition:F!==void 0?[w.lon,w.lat,F]:[w.lon,w.lat],toPosition:B!==void 0?[N.lon,N.lat,B]:[N.lon,N.lat]}}function Ls(o,e,t,r,n){let i=jp({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 vt(o){return o.verticalOffset===0?[o.longitude,o.latitude]:[o.longitude,o.latitude,o.verticalOffset]}function Gm(o){return new Map(o.map(e=>{let{properties:t}=e,{id:r}=t;return[r,e]}))}var Bs=(o,e)=>{let t=Gm(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}=ss(n,a);i=l.map(c=>c.geometry.coordinates),r.entrances.features.push(...s)}r.walls.geometry.coordinates.push(...i)}return r};function Up(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 Wp(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 zp(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 Pr(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 Vs=(o,e)=>{let r=(e.currentMap?.currentFloor).layers.get(Ce);switch(o){case"interior-walls":return r?.layers.get(Po);case"exterior-walls":return r?.layers.get(eo);case"interior-doors":return r?.layers.get(Ir);case"exterior-doors":return r?.layers.get(Sr);default:return typeof o=="string"?o:o?.id}};function js(o){return new Promise(e=>{o.onComplete(e),o.onStop(e)})}function Xp(o){return o.bbox?o.bbox:cr(o)}function Or(o,e,t){return o.floorId&&e.has(o.floorId)?e.get(o.floorId):t}function wr(o){if(xe.is(o)||dt.is(o))return o.id}function $p(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 Yp(o,e){let t=o.properties.path.split("/"),r=t[t.length-1].split(".")[0],n=atob(r);return"img_"+ui(n).toString()+"-"+e}function Ns(o="auto",e,t=1,r){return o!=="auto"?o*t:e!=null?e*t:r!=null?r*t:3*t}function Gp(o,e,t,r){if(o.maxHeight!=null&&o.maxHeight>0)return Ns(e,o.maxHeight,t,r);let n=Ns(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 Zp(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=Gp(h,e,t,r);if(!n){let v=h.elevation-c-1;v>0&&(s+=v*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=Gp(h,e,t,r),v=-(s+g);l.set(h.elevation,{altitude:v,visualHeight:g}),s+=g}return l}function Jp(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),v=g?.visualHeight??Ns(t,void 0,r,n),I=h*v,E=g?.altitude??0;s.push({altitude:E-I,height:I,floorAboveElevation:p.elevation,missingCount:h})}l=p.elevation}return s}function Di(o,e){let t=e(o.center);return{center:new z({latitude:t[1],longitude:t[0]}),radius:o.radius}}function qp(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 Qp=Math.PI*.1,wo=class{id;#e={};#t;#o;constructor(e,t,r,n,i){this.id=i?.id??oe(),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 z(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 z(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;#n;#i;#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.#n=p,this.#i=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.#n=p,this.#i=c}else this.#r==="take"?(l.push(this.#c("ExitConnection",a,i,this.#n,this.#i)),this.#r="exit",this.#n=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?-Up(e.properties.angle,t.properties.angle):0;return Math.abs(i)>=Qp?{type:"Turn",bearing:Hp(i,Qp),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 Kp(o){return lo(o)?"navigationTarget"in o&&o.navigationTarget!=null:!1}var Um={lineOfSight:!0,mode:"absolute-distance",maxResults:1};function ed(o){return{...Um,lineOfSight:!o}}var Ie=new WeakMap;function Fi(o,e,t){let r=ed(t),i=e.Query.__LEGACY_NEAREST_SYNC(o,e.getByType("node"),r)?.[0]?.feature.id;return i?[i]:[]}async function Ai(o,e,t){let r=ed(t),i=(await e.Query.nearest(o,e.getByType("node"),r))?.[0]?.feature.id;return i?[i]:[]}function Hm(o,e,t){let r=[];for(let n of o.navigationTarget){let i=Do(n,e,t);r.push(...i)}return r}async function Wm(o,e,t){let r=[];for(let n of o.navigationTarget){let i=await Fo(n,e,t);r.push(...i)}return r}function td(o,e){let r=e?.getMVFFeatureById("entrance",o.id)?.properties.node;return r?[r]:[]}function od(o,e){return e?.getMVFFeatureById("area",o.id)?.properties.destinationNodes??[]}function rd(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 zm(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 Xm(o,e,t){let r=[];for(let n of o.coordinates){let i=await Ai(n,e,t);i.length>0&&r.push(i[0])}return r}function nd(o,e){return e?.objectEntranceNodeIdsByObstructionId[o.id]??[]}function id(o,e){return o.spaces.flatMap(t=>e?.getMVFFeatureById("space",t.id)?.properties.destinationNodes??[]).filter(t=>typeof t=="string")}function ad(o){return o.nodes.map(e=>e.id)}function Do(o,e,t){if(Ie.has(o))return Ie.get(o);if(co.is(o)){let r=Hm(o,e,t);return Ie.set(o,r),r}else if(Gt.is(o)){let r=Fi(o,e,t);return Ie.set(o,r),r}else if(z.is(o)){let r=Fi(o,e,t);return Ie.set(o,r),r}else{if(Tt.is(o))return Fi(o,e,t);if(it.is(o)){let r=td(o,e);return Ie.set(o,r),r}else if(_t.is(o)){let r=od(o,e);return Ie.set(o,r),r}else if(xe.is(o)){let r=rd(o,e);return Ie.set(o,r),r}else if(Ze.is(o)){let r=zm(o,e,t);return Ie.set(o,r),r}else if(dt.is(o)){let r=nd(o,e);return Ie.set(o,r),r}else if(Ge.is(o)){let r=id(o,e);return Ie.set(o,r),r}else if(ct.is(o)){let r=ad(o);return Ie.set(o,r),r}else if(xt.is(o)){let r=[o.id];return Ie.set(o,r),r}else return[]}}async function Fo(o,e,t){if(Ie.has(o))return Ie.get(o);if(co.is(o)){let r=await Wm(o,e,t);return Ie.set(o,r),r}else if(Gt.is(o)){let r=await Ai(o,e,t);return Ie.set(o,r),r}else if(z.is(o)){let r=await Ai(o,e,t);return Ie.set(o,r),r}else if(Tt.is(o)){let r=await Ai(o,e,t);return Ie.set(o,r),r}else if(it.is(o)){let r=td(o,e);return Ie.set(o,r),r}else if(_t.is(o)){let r=od(o,e);return Ie.set(o,r),r}else if(xe.is(o)){let r=rd(o,e);return Ie.set(o,r),r}else if(Ze.is(o)){let r=await Xm(o,e,t);return Ie.set(o,r),r}else if(dt.is(o)){let r=nd(o,e);return Ie.set(o,r),r}else{if(Ge.is(o))return id(o,e);if(ct.is(o)){let r=ad(o);return Ie.set(o,r),r}else if(xt.is(o)){let r=[o.id];return Ie.set(o,r),r}else return[]}}function sd(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 ld(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=sd(n,r)),n}function cd(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=sd(n,r)),n}function Gs(o){if(z.is(o))return o;if(!(!Kp(o)||Array.isArray(o.navigationTarget)||!z.is(o.navigationTarget)))return o.navigationTarget}var Dr=class{navigator;connections;constructor({nodes:e,geojsonCollection:t,connections:r,groupBy:n,multiplicativeDistanceWeightScaling:i,flagDeclarations:a,getDoorByNodeId:s}){this.navigator=new Ec({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)),xe.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)),xe.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 Fo(p,n,n.enterpriseMode));for(let p of t)a.set(p,await Fo(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,Do(p,n,n.enterpriseMode)])),a=new Map(t.map(p=>[p,Do(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(w=>!r.includes(w)&&!n.includes(w)),c=new Map,p={...i.connectionIdWeightMap};for(let w of i.excludedConnections)p[w.id]=1/0;for(let w in p){let F=a.getById("connection",w);F&&this.#t(F,p[w],c)}let g=(i.smoothing.__EXPERIMENTAL_METHOD??"greedy-los")!=="greedy-los",v=this.navigator.getDirections({zones:i.zones.map(w=>({geometry:w.geometry,cost:w.cost,map:w.floor?.id})),originIds:r,from:g?pd(e):[],to:g?pd(t):[],destinationNodeIds:n,disabledConnectionNodeIds:l,simplify:i.smoothing,overrideEdgeWeights:c,multiplicativeDistanceWeightScaling:!a.enterpriseMode,includeNonPublic:i.includeNonPublic});this.addCoordinateDirections(v,e,t);let I=ld(v,e,s),E=cd(v,t,s),O=new wo(v,a,I,E);if(!(O.distance===0&&new Set([...r,...n]).size===r.length+n.length))return O};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=Gs(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=Gs(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 $m(o){if(z.is(o))return o.floorId;if(xe.is(o)||it.is(o)||Tt.is(o)||Gt.is(o)||dt.is(o)||_t.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(Ge.is(o)&&o.spaces.length>0)return o.spaces[0].floor.id}function pd(o){return o.reduce((e,t)=>{let r=Co(t);if(!r)return e;let n=$m(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 Jo from"zod";var Fr=50,Us=1,Hs=!1,dd=Jo.object({limit:Jo.enum(["same-floor","same-elevation","all-floors"]).optional(),mode:Jo.enum(["travel-distance","absolute-distance"]).optional(),lineOfSight:Jo.boolean().optional().or(Jo.literal("auto")),maxDistance:Jo.number().optional(),maxResults:Jo.number().optional()}),ud={lineOfSight:Hs,mode:"travel-distance",maxDistance:Fr,limit:"same-floor",maxResults:Us},bn=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}__LEGACY_NEAREST_SYNC=(e,t,r)=>{let n={...ud,...r};try{dd.parse(n)}catch(p){x.error(p);return}let i=Co(e);if(!i)return;let a=this.#o(i,n),s=[],l={},c=[];for(let p of t){let h=Do(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.#i(e,a,c,l,n),s.sort((p,h)=>p.distance-h.distance)};async nearest(e,t,r){let n={...ud,...r};try{dd.parse(n)}catch(h){x.error(h);return}let i=Co(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(Fo(h,this.#e,this.#e.enterpriseMode).then(g=>{if(g)for(let v of g)l[v]||(l[v]=[]),l[v].push(h),c.push(v)}));await Promise.all(p),s=await this.#n(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??Fr,n?.lineOfSight==="auto"?Hs: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};#n=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??Fr,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??Fr)-c,s,r,!1,i?.maxResults??Us);for(let g of h)for(let v of n[g.feature.properties.id])p.has(v.id)||(a.push({distance:g.distance+c,feature:v}),p.add(v.id))}}return a};#i=(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??Fr,maxResults:1})?.[0].feature),l){let c=this.#e.directions.navigator.findNearestNodesOnGraph(l.id,i?.maxDistance??Fr,s,r,i?.lineOfSight==="auto"?Hs:i?.lineOfSight,i?.maxResults??Us);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 ki=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:Sc(e,r)}};f();f();f();f();function fd(o){let e=+this._x.call(null,o),t=+this._y.call(null,o);return hd(this.cover(e,t),e,t,o)}function hd(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,v,I,E,O,w,F;if(!i)return o._root=a,o;for(;i.length;)if((E=e>=(h=(s+c)/2))?s=h:c=h,(O=t>=(g=(l+p)/2))?l=g:p=g,n=i,!(i=i[w=O<<1|E]))return n[w]=a,o;if(v=+o._x.call(null,i.data),I=+o._y.call(null,i.data),e===v&&t===I)return a.next=i,n?n[w]=a:o._root=a,o;do n=n?n[w]=new Array(4):o._root=new Array(4),(E=e>=(h=(s+c)/2))?s=h:c=h,(O=t>=(g=(l+p)/2))?l=g:p=g;while((w=O<<1|E)===(F=(I>=g)<<1|v>=h));return n[F]=i,n[w]=a,o}function gd(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)hd(this,a[t],s[t],o[t]);return this}f();function md(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 yd(){var o=[];return this.visit(function(e){if(!e.length)do o.push(e.data);while(e=e.next)}),o}f();function bd(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 Ue(o,e,t,r,n){this.node=o,this.x0=e,this.y0=t,this.x1=r,this.y1=n}function Td(o,e,t){var r,n=this._x0,i=this._y0,a,s,l,c,p=this._x1,h=this._y1,g=[],v=this._root,I,E;for(v&&g.push(new Ue(v,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(!(!(v=I.node)||(a=I.x0)>p||(s=I.y0)>h||(l=I.x1)<n||(c=I.y1)<i))if(v.length){var O=(a+l)/2,w=(s+c)/2;g.push(new Ue(v[3],O,w,l,c),new Ue(v[2],a,w,O,c),new Ue(v[1],O,s,l,w),new Ue(v[0],a,s,O,w)),(E=(e>=w)<<1|o>=O)&&(I=g[g.length-1],g[g.length-1]=g[g.length-1-E],g[g.length-1-E]=I)}else{var F=o-+this._x.call(null,v.data),W=e-+this._y.call(null,v.data),N=F*F+W*W;if(N<t){var B=Math.sqrt(t=N);n=o-B,i=e-B,p=o+B,h=e+B,r=v.data}}return r}f();function vd(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,v,I,E,O,w;if(!t)return this;if(t.length)for(;;){if((I=p>=(g=(a+l)/2))?a=g:l=g,(E=h>=(v=(s+c)/2))?s=v:c=v,e=t,!(t=t[O=E<<1|I]))return this;if(!t.length)break;(e[O+1&3]||e[O+2&3]||e[O+3&3])&&(r=e,w=O)}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[O]=i:delete e[O],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(r?r[w]=t:this._root=t),this):(this._root=i,this)}function Id(o){for(var e=0,t=o.length;e<t;++e)this.remove(o[e]);return this}f();function Sd(){return this._root}f();function Ed(){var o=0;return this.visit(function(e){if(!e.length)do++o;while(e=e.next)}),o}f();function Md(o){var e=[],t,r=this._root,n,i,a,s,l;for(r&&e.push(new Ue(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 Ue(n,c,p,s,l)),(n=r[2])&&e.push(new Ue(n,i,p,c,l)),(n=r[1])&&e.push(new Ue(n,c,a,s,p)),(n=r[0])&&e.push(new Ue(n,i,a,c,p))}return this}f();function xd(o){var e=[],t=[],r;for(this._root&&e.push(new Ue(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 Ue(i,a,s,p,h)),(i=n[1])&&e.push(new Ue(i,p,s,l,h)),(i=n[2])&&e.push(new Ue(i,a,h,p,c)),(i=n[3])&&e.push(new Ue(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 _d(o){return o[0]}function Cd(o){return arguments.length?(this._x=o,this):this._x}f();function Pd(o){return o[1]}function Od(o){return arguments.length?(this._y=o,this):this._y}function Tn(o,e,t){var r=new Ws(e??_d,t??Pd,NaN,NaN,NaN,NaN);return o==null?r:r.addAll(o)}function Ws(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 wd(o){for(var e={data:o.data},t=e;o=o.next;)t=t.next={data:o.data};return e}var at=Tn.prototype=Ws.prototype;at.copy=function(){var o=new Ws(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=wd(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]=wd(r));return o};at.add=fd;at.addAll=gd;at.cover=md;at.data=yd;at.extent=bd;at.find=Td;at.remove=vd;at.removeAll=Id;at.root=Sd;at.size=Ed;at.visit=Md;at.visitAfter=xd;at.x=Cd;at.y=Od;f();function zs(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,v]=s[l];e(c,p,h,g,v)||zs(o,e,c,p,h,g,v)}}return!1}var Dd=1e3,Ym=.1,Zm=5,Jm=1.5,Li=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=Dd;else r=Dd;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=Zm,v=Math.max(a,this.getMaxSearchRadiusForFloorId(t,n));for(;h.length<l&&g<=v;){let I=this.#o(e,c,i,g,a,p);I.sort((E,O)=>E.distance-O.distance);for(let E of I){if(h.length>=l)break;s?this.#r.directions.navigator.hasLineOfSight(e,E.node.geometry.coordinates,n,Ym)&&h.push(E):h.push(E)}g=g*Jm}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,v=[];return zs(t,(I,E,O,w,F)=>{let W=E>=p||O>=g||w<c||F<h;if("data"in I){let N=I;for(;N;){let B=N.data,G=B.properties.parentId||B.properties.id;if(r.includes(G)&&!a.has(G)){a.add(G);let A=qt(e,B.geometry.coordinates);A<=i&&v.push({node:B,distance:A})}N=N.next}}return W}),v}#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]=Tn();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;case"object":case"location-profile":case"connection":case"area":case"facade":i=this.#n(this.#r.getByType(e),r);break}return i?.length>0&&n.addAll(i),n}#n(e,t){let r=[];for(let n of e){let i=Do(n,this.#r,this.#r.enterpriseMode);for(let a=0;a<i.length;a++){let s=this.#r.mvfNodesById[i[a]];s&&(s.properties.floor??s.properties.map)===t&&r.push({...s,properties:{...s.properties,id:s.properties.id,parentId:n.id}})}}return r}#i;constructor(e,t){this.#r=e,this.#i=t}};f();f();f();f();function Ni(o,e,t=0,r=o.length-1,n=qm){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),v=Math.max(t,Math.floor(e-c*h/l+g)),I=Math.min(r,Math.floor(e+(l-c)*h/l+g));Ni(o,e,v,I,n)}let i=o[e],a=t,s=r;for(vn(o,t,e),n(o[r],i)>0&&vn(o,t,r);a<s;){for(vn(o,a,s),a++,s--;n(o[a],i)<0;)a++;for(;n(o[s],i)>0;)s--}n(o[t],i)===0?vn(o,t,s):(s++,vn(o,s,r)),s<=e&&(t=s+1),e<=s&&(r=s-1)}}function vn(o,e,t){let r=o[e];o[e]=o[t],o[t]=r}function qm(o,e){return o<e?-1:o>e?1:0}var En=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(!Bi(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;Bi(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(!Bi(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(Bi(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=kr([]),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=Qm(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=kr(e.slice(t,r+1)),Ar(s,this.toBBox),s;n||(n=Math.ceil(Math.log(i)/Math.log(a)),a=Math.ceil(i/Math.pow(a,n-1))),s=kr([]),s.leaf=!1,s.height=n;let l=Math.ceil(i/a),c=l*Math.ceil(Math.sqrt(a));Fd(e,t,r,c,this.compareMinX);for(let p=t;p<=r;p+=c){let h=Math.min(p+c-1,r);Fd(e,p,h,l,this.compareMinY);for(let g=p;g<=h;g+=l){let v=Math.min(g+l-1,h);s.children.push(this._build(e,g,v,n-1))}}return Ar(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=Xs(c),h=ty(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),Sn(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=kr(r.children.splice(a,r.children.length-a));s.height=r.height,s.leaf=r.leaf,Ar(r,this.toBBox),Ar(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(r,s)}_splitRoot(e,t){this.data=kr([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Ar(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=In(e,0,s,this.toBBox),c=In(e,s,r,this.toBBox),p=oy(l,c),h=Xs(l)+Xs(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:Km,i=e.leaf?this.compareMinY:ey,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=In(e,0,t,i),s=In(e,r-t,r,i),l=Ri(a)+Ri(s);for(let c=t;c<r-t;c++){let p=e.children[c];Sn(a,e.leaf?i(p):p),l+=Ri(a)}for(let c=r-t-1;c>=t;c--){let p=e.children[c];Sn(s,e.leaf?i(p):p),l+=Ri(s)}return l}_adjustParentBBoxes(e,t,r){for(let n=r;n>=0;n--)Sn(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():Ar(e[t],this.toBBox)}};function Qm(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 Ar(o,e){In(o,0,o.children.length,e,o)}function In(o,e,t,r,n){n||(n=kr(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];Sn(n,o.leaf?r(a):a)}return n}function Sn(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 Km(o,e){return o.minX-e.minX}function ey(o,e){return o.minY-e.minY}function Xs(o){return(o.maxX-o.minX)*(o.maxY-o.minY)}function Ri(o){return o.maxX-o.minX+(o.maxY-o.minY)}function ty(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 oy(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 Bi(o,e){return e.minX<=o.maxX&&e.minY<=o.maxY&&e.maxX>=o.minX&&e.maxY>=o.minY}function kr(o){return{children:o,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Fd(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;Ni(o,a,e,t,n),i.push(e,a,a,t)}}var Vi=class extends En{#e;constructor(e){super(),this.#e=e}toBBox=e=>{let t=e.geoJSONBoundingBox;t==null&&x.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 ji=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 Ad(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 Mn=class{#e;#t;#o;#r;constructor(e){let t=Ad(e.mapCenter.longitude,e.mapCenter.latitude);this.#o=new Li(e,t),this.#r=new ji(e,t),this.#e=new bn(e,this.#o),this.#t=new ki(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 Gi=class{#e;constructor(e){this.#e=e||[]}get raw(){return this.#e}};var Ys=class o extends Le{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 zo({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 zo({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 Gi(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=Ys;f();var Zs=class o extends Le{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}}},Pi=Zs;var Js=.75;function ry(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:oe()}});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:oe()}});return e}function ny(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=ry(r);for(let s of a)i.push(s)}e[n]={voids:{type:"FeatureCollection",features:i}}}return e}var qo=class extends gt{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??xo();if(this.envControl=r,this.binaryBundle=t?.binaryBundle,this.Analytics=new hr,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=Rp(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=ny(e),this.enterpriseMode||xn()){let i=Np(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 As(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]=cs(l)}),this.currentLanguage=this.venue.defaultLanguage}}this.directions=new Dr({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 Mn(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 z(0,0,"initializing");get mapCenter(){return this.#o.floorId==="initializing"&&(this.#o=new z(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=ui(i+e+r+t.toString());if(this.propTranslationCache.has(c))return this.propTranslationCache.get(c);let p=bc(n,l,["id"]);return this.propTranslationCache.set(c,p),p}return l}return l}}return n}findPreferredLanguage(e){if(!this.venue)return;let t=qs(this.venue,e);return e?.languageCode!=null&&e.languageCode.toLowerCase()!==t.code.toLowerCase()&&x.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){x.error("Language code must be defined.");return}if(!this.currentLanguage||!this.venue){x.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){x.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){x.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 Sp(a,{signal:s.signal})}catch(c){x.error(`Failed to download language pack for language code "${n.code}".`,c);return}if(!l||s.signal.aborted)return;i=cs(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=kd(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],v=this.directions.getDirectionsSync(c,g,l,this);if(!v){x.error("getDirections failed due to missing directions for one of the segments");return}c=g,p.push(v)}return p}else{let c=Array.isArray(e)?e:[e],p=Array.isArray(t)?t:[t];if(Array.isArray(p[0])){x.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){x.error("Unable to get directions",h);return}}};getDirections=async(e,t,r)=>{let{accessible:n=!1}=r||{},i=kd(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])){x.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){x.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=Co(e),n=Co(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(!xp(e))return{url:e};if(_p(e))return{url:e};let t=vr(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 x.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 ts(this.localePacksUrls[n.code],{signal:r.signal}),a=await br(i);a&&t.push({language:{code:n.code,name:n.name},localePack:a})}}catch(i){x.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){x.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 ts(this.localePacksUrls[n.code],{signal:r.signal});i&&t.push({language:{code:n.code,name:n.name},localePack:i})}}catch(i){x.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 kd=(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??Js,__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??Js,__EXPERIMENTAL_METHOD:"rdp",mustIncludeDoorBufferNodes:typeof r=="object"&&r.__EXPERIMENTAL_METHOD==="rdp"?r.__EXPERIMENTAL_MUST_INCLUDE_DOOR_BUFFER_NODES:void 0}:{enabled:i,radius:a??Js,__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 Qo=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 Ao=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=us(this.coordinates),this.#e)}get focusTarget(){return this.coordinates}toJSON(){return{__type:o.__type,id:this.id,coordinates:this.coordinates,isConnectionSegment:this.isConnectionSegment,distance:this.distance}}},Ct=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 Ao(i.toString(),a))}get distance(){return this.#e?this.#e:(this.#e=us(this.coordinates),this.#e)}toJSON(){return{__type:o.__type,id:this.id,coordinates:this.coordinates,segments:this.segments}}};f();var iy=7,_n=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t?.precision??iy}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=mi(e.latitude,this.#t),r=mi(e.longitude,this.#t);return new z({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 mi(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 ay=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)||Vf.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:Gr.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],v=this.fn(s);return l||h||p||c?g=Ta(this,s,v,l,c,p,h):g||(g=this.programs[s]=Ta(this,s,v)),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=Gr.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=q1(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={};jf(s,e.helpers,n),jf(s,a.helpers,n),n.helpers=s,o.usePartial&&(n.partials=n.mergeIfNeeded(a.partials,e.partials)),(o.usePartial||o.useDecorators)&&(n.decorators=Gr.extend({},e.decorators,a.decorators)),n.hooks={},n.protoAccessControl=Vf.createProtoAccessControl(a);var l=a.allowCallsToHelperMissing||t;Bf.moveHelperToHooks(n,"helperMissing",l),Bf.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 Ta(n,a,o[a],s,0,l,c)},i}function Ta(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 Z1(o,e,t){return o?!o.call&&!t.name&&(t.name=o,o=va(t.partials,o)):t.name==="@partial-block"?o=va(t.data,"partial-block"):o=va(t.partials,t.name),o}function J1(o,e,t){var r=va(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!==Gf&&(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=Gr.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 Gf(){return""}function va(o,e){if(o&&Object.prototype.hasOwnProperty.call(o,e))return o[e]}function q1(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),Gr.extend(e,a)}return e}function jf(o,e,t){e&&Object.keys(e).forEach(function(r){var n=e[r];o[r]=Q1(n,t)})}function Q1(o,e){var t=e.lookupProperty;return X1.wrapHelper(o,function(r){return r.lookupProperty=t,r})}});var zf=_e((Ia,Wf)=>{"use strict";f();Ia.__esModule=!0;Ia.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}};Wf.exports=Ia.default});var Jf=_e((Sa,Zf)=>{"use strict";f();Sa.__esModule=!0;function Rl(o){return o&&o.__esModule?o:{default:o}}function Bl(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 K1=Al(),Xf=Bl(K1),eb=Nf(),tb=Rl(eb),ob=Lo(),rb=Rl(ob),nb=zt(),Nl=Bl(nb),ib=Hf(),$f=Bl(ib),ab=zf(),sb=Rl(ab);function Yf(){var o=new Xf.HandlebarsEnvironment;return Nl.extend(o,Xf),o.SafeString=tb.default,o.Exception=rb.default,o.Utils=Nl,o.escapeExpression=Nl.escapeExpression,o.VM=$f,o.template=function(e){return $f.template(e,o)},o}var Jn=Yf();Jn.create=Yf;sb.default(Jn);Jn.default=Jn;Sa.default=Jn;Zf.exports=Sa.default});var Qf=_e((g4,qf)=>{f();qf.exports=Jf().default});f();f();f();f();f();var Bc="mi-session-data",Vc="mi-local-data",rn="id",nn="deviceId",Mt=class o{static#e;#t;#o;constructor(){try{let e=sessionStorage.getItem(Bc);e?this.#t=JSON.parse(e):this.#t={[rn]:oe()}}catch{this.#t={[rn]:oe()}}try{let e=localStorage.getItem(Vc);e?this.#o=JSON.parse(e):this.#o={[nn]:oe()}}catch{this.#o={[nn]:oe()}}this.#t[rn]||(this.#t[rn]=oe()),this.#o[nn]||(this.#o[nn]=oe())}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(Bc,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(Vc,JSON.stringify(this.#o)),!0}catch{return!1}}loadLocalData(e){let t=this.#o[e];if(t!=null)return t}};f();f();var fr=o=>o!=null;var ag=(function(){let e=globalThis.fetch;return{fetch(...t){if(!fr(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}}})(),jc=ag.fetch;var zc=["websdk","web","webv2","kiosk","kiosk-v2","mobile","iossdk","androidsdk","reactnativesdk","gen7","bespoke","reactsdk","minimap"],Gc=zc[0],Xc="https://api-gateway.mappedin.com/track-analytics/a/",$c="deny-watchposition",Yc="load-mapview",Zc="load-mapdata",Jc="change-language",qc="query-directions";var hr=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&&Mt.getInstance().saveSessionData("id",e.sessionId),e.deviceId&&Mt.getInstance().saveLocalData("deviceId",e.deviceId)}#r(e){let t=e.baseUri??Xc;return{baseUri:t,analyticsBaseUrl:Wa({...e,baseUri:t}),version:e.version||S?.env?.npm_package_version||"v6",deviceId:e.deviceId||Uc(),accessToken:e.accessToken,mapId:e.mapId,sessionId:e.sessionId||Hc(),platformString:e.platformString||"",context:Wc(e.context)||Gc,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=Wa({...this.#t,mapId:t.mapId})),t.context&&(t.context=Wc(t.context)),t.baseUri&&(t.analyticsBaseUrl=Wa({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||Gc}getSessionId(){return this.getState().sessionId||this.#e.sessionId||Hc()}getDeviceId(){return this.getState().deviceId||this.#e.deviceId||Uc()}sendAnalyticEvent(e,t={}){let r=this.getState(),n=sg(r.analyticsBaseUrl,e),i={"mi-context":this.getContext(),"mi-session":this.getSessionId(),"mi-device":this.getDeviceId()};if(r.logEvents&&x.log("Analytics.track",n,i),!r.sendEvents)return Promise.resolve();if(!this.authReady)return!r.key&&!r.secret&&!r.accessToken?void 0:x.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}`),jc(n,{method:"POST",mode:"cors",headers:i,body:JSON.stringify(a)})}capture(e,t){if(cg.includes(e))return x.warn(`${e} event is sent internally.`),Promise.resolve();let r=lg.includes(e)?e.slice(1):e;return this.sendAnalyticEvent(r,t)}sendGetMapDataEvent(e){return this.sendAnalyticEvent(Zc,e)}sendChangeLanguageEvent(e){return this.sendAnalyticEvent(Jc,e)}sendWatchPositionDenied(){return this.sendAnalyticEvent($c)}sendMapViewLoadedEvent({firstRenderDuration:e,dimension:t,collisionWorkerDisabled:r,outdoorsWorkerDisabled:n}){return this.sendAnalyticEvent(Yc,{type:"3d",firstRenderDuration:e,width:t.width,height:t.height,devicePixelRatio:globalThis.devicePixelRatio||1,collisionWorkerDisabled:r,outdoorsWorkerDisabled:n})}sendGetDirectionsEvent=pc((e,t,r)=>{let n={start:e,end:t,type:"location_to_location"};return r!==void 0&&(n.accessible=r),this.sendAnalyticEvent(qc,n)},2500);sendBlueDotEvents(e){if(!((e==="found-floor"||e==="found-position")&&this.oneTimeEventsSent.has(e)))return this.oneTimeEventsSent.add(e),this.sendAnalyticEvent(e)}};function Wa({mapId:o,baseUri:e=Xc}){return`${e}${o}/`}function Uc(){return Mt.getInstance().loadLocalData("deviceId")}function Hc(){return Mt.getInstance().loadSessionData("id")}function sg(o,e){return o+e}function Wc(o){return zc.find(e=>e===o)}var lg=["$select-location","$select-category","$query-suggest","$query-search"],cg=[Yc,Zc,qc,$c,Jc],DT=new hr,an=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 sn=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 x.error("Search should be enabled by now"),{places:[],enterpriseLocations:[],enterpriseCategories:[]};try{return await(await this.searchInstance).search(e,t)}catch(r){return x.error("Search.query failed due to",r),{places:[],enterpriseLocations:[],enterpriseCategories:[]}}}async suggest(e,t={}){if(this.enabled||await this.enable(),!this.searchInstance)return x.error("Search should be enabled by now"),[];try{return await(await this.searchInstance).suggest(e,t)}catch(r){return x.error("Search.suggest failed due to",r),[]}}async enable(){this.enabled||(this.enabled=!0,this.searchInstance||(this.searchInstance=import("./internal-Y76T47KY.js").then(({InternalSearch:e})=>new e(this.#e))),this.#t.on("language-change",this.#o),await this.searchInstance)}};var Qc={"enterprise-location":"location-profile","enterprise-category":"location-category"},Kc={"location-profile":"enterprise-location","location-category":"enterprise-category"},ep=new WeakMap,za=class{#e;#t;Analytics;Search;Query;internal;constructor(e,{search:t}={}){this.#e=new gt,this.#t=e,ep.set(this,e),this.Analytics=new an(e.Analytics),this.Query=e.Query,this.internal=e,this.Search=new sn(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 Qc?x.warn(`MappedinSDK: getByType('${e}') returned 0 results. This is a Maker map (API key starts with 'mik_'). Use '${Qc[e]}' instead. See https://developer.mappedin.com/web-sdk/getting-started`):r&&e in Kc&&x.warn(`MappedinSDK: getByType('${e}') returned 0 results. This is an Enterprise map. Use '${Kc[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})}},ln=za;function cn(o){let e=ep.get(o);if(!e)throw new Error("MapDataInternal not found");return e}f();f();f();f();f();function gr(o){return o.endsWith("/")?o:`${o}/`}f();var mr="https://app.mappedin.com/",tp="https://auth.mappedin.com/",op=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"}),pg=Object.freeze({...op,baseUri:"https://api-gateway.mappedin.com/",baseAuthUri:"https://auth.mappedin.com/"}),dg=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"}),ug=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"}),fg=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"}),hg={eu:dg,us:op,"us-enterprise":pg,"us-staging-enterprise":ug,"us-staging-self-serve":fg};function rp(o){return hg[o]}f();f();var gg=o=>{let e=Date.now();return o-e},Ti=(o,e)=>gg(o)<=e*60*1e3;var ip=10,ap=ip*60*1e3,np="accessTokens",mg="mik_";function sp(o){return typeof o=="string"&&o.startsWith(mg)}async function pn(o,e=!1,t=!1){let r=`${o.key}`,n=Mt.getInstance(),i=n?.loadSessionData(np)||{},a=Math.floor(Date.now()/1e3);if(!t&&i[r]&&!Ti(i[r].expiresTimestamp*1e3,ip))return i[r];let s=e?await yg(o,a):await bg(o,a),l={...i,[r]:s};return n?.saveSessionData(np,l),s}async function yg(o,e){let t;o.customAuthUri?t=o.customAuthUri:t=`${o.baseAuthUri??tp}oauth2/token`;let r;try{r=await mt()(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 bg(o,e){let t;o.customAuthUri?t=o.customAuthUri:t=`${o.baseAuthUri?gr(o.baseAuthUri):mr}api/v1/api-key/token`;let r;try{r=await mt()(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 cp=10,pp=cp*60*1e3,lp="miSasTokens";async function Xa(o,e){let t=`${e}__${o.mapId}`,r=Mt.getInstance(),n=r?.loadSessionData(lp)||{};if(n[t]&&!Ti(n[t].expires,cp))return n[t];let i=await Tg(o,e),a={...n,[t]:{token:i.token,expires:new Date(i.expires).getTime()}};return r?.saveSessionData(lp,a),i}async function Tg(o,e){let t=`${o.baseUri?gr(o.baseUri):mr}api/v1/venue/${o.mapId}/sas-token`,r=await mt()(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 yt=Uint8Array,Wo=Uint16Array,dp=Uint32Array,up=new yt([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]),fp=new yt([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]),vg=new yt([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hp=function(o,e){for(var t=new Wo(31),r=0;r<31;++r)t[r]=e+=1<<o[r-1];for(var n=new dp(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]},gp=hp(up,2),mp=gp[0],Ig=gp[1];mp[28]=258,Ig[258]=28;var yp=hp(fp,0),Sg=yp[0],y0=yp[1],Ja=new Wo(32768);for(ue=0;ue<32768;++ue)so=(ue&43690)>>>1|(ue&21845)<<1,so=(so&52428)>>>2|(so&13107)<<2,so=(so&61680)>>>4|(so&3855)<<4,Ja[ue]=((so&65280)>>>8|(so&255)<<8)>>>1;var so,ue,dn=(function(o,e,t){for(var r=o.length,n=0,i=new Wo(e);n<r;++n)o[n]&&++i[o[n]-1];var a=new Wo(e);for(n=0;n<e;++n)a[n]=a[n-1]+i[n-1]<<1;var s;if(t){s=new Wo(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[Ja[h]>>>l]=c}else for(s=new Wo(r),n=0;n<r;++n)o[n]&&(s[n]=Ja[a[o[n]-1]++]>>>15-o[n]);return s}),un=new yt(288);for(ue=0;ue<144;++ue)un[ue]=8;var ue;for(ue=144;ue<256;++ue)un[ue]=9;var ue;for(ue=256;ue<280;++ue)un[ue]=7;var ue;for(ue=280;ue<288;++ue)un[ue]=8;var ue,bp=new yt(32);for(ue=0;ue<32;++ue)bp[ue]=5;var ue;var Eg=dn(un,9,1);var Mg=dn(bp,5,1),$a=function(o){for(var e=o[0],t=1;t<o.length;++t)o[t]>e&&(e=o[t]);return e},Lt=function(o,e,t){var r=e/8|0;return(o[r]|o[r+1]<<8)>>(e&7)&t},Ya=function(o,e){var t=e/8|0;return(o[t]|o[t+1]<<8|o[t+2]<<16)>>(e&7)},xg=function(o){return(o+7)/8|0},Qa=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?Wo:o.BYTES_PER_ELEMENT==4?dp:yt)(t-e);return r.set(o.subarray(e,t)),r};var _g=["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||_g[o]);if(r.code=o,Error.captureStackTrace&&Error.captureStackTrace(r,Nt),!t)throw r;return r},Cg=function(o,e,t){var r=o.length;if(!r||t&&t.f&&!t.l)return e||new yt(0);var n=!e||t,i=!t||t.i;t||(t={}),e||(e=new yt(r*3));var a=function(Ft){var yo=e.length;if(Ft>yo){var bo=new yt(Math.max(yo*2,Ft));bo.set(e),e=bo}},s=t.f||0,l=t.p||0,c=t.b||0,p=t.l,h=t.d,g=t.m,v=t.n,I=r*8;do{if(!p){s=Lt(o,l,1);var E=Lt(o,l+1,3);if(l+=3,E)if(E==1)p=Eg,h=Mg,g=9,v=5;else if(E==2){var W=Lt(o,l,31)+257,N=Lt(o,l+10,15)+4,B=W+Lt(o,l+5,31)+1;l+=14;for(var G=new yt(B),A=new yt(19),j=0;j<N;++j)A[vg[j]]=Lt(o,l+j*3,7);l+=N*3;for(var te=$a(A),he=(1<<te)-1,ge=dn(A,te,1),j=0;j<B;){var ie=ge[Lt(o,l,he)];l+=ie&15;var O=ie>>>4;if(O<16)G[j++]=O;else{var Te=0,Be=0;for(O==16?(Be=3+Lt(o,l,3),l+=2,Te=G[j-1]):O==17?(Be=3+Lt(o,l,7),l+=3):O==18&&(Be=11+Lt(o,l,127),l+=7);Be--;)G[j++]=Te}}var Ve=G.subarray(0,W),pe=G.subarray(W);g=$a(Ve),v=$a(pe),p=dn(Ve,g,1),h=dn(pe,v,1)}else Nt(1);else{var O=xg(l)+4,w=o[O-4]|o[O-3]<<8,F=O+w;if(F>r){i&&Nt(0);break}n&&a(c+w),e.set(o.subarray(O,F),c),t.b=c+=w,t.p=l=F*8,t.f=s;continue}if(l>I){i&&Nt(0);break}}n&&a(c+131072);for(var $e=(1<<g)-1,wt=(1<<v)-1,ot=l;;ot=l){var Te=p[Ya(o,l)&$e],ve=Te>>>4;if(l+=Te&15,l>I){i&&Nt(0);break}if(Te||Nt(2),ve<256)e[c++]=ve;else if(ve==256){ot=l,p=null;break}else{var mo=ve-254;if(ve>264){var j=ve-257,se=up[j];mo=Lt(o,l,(1<<se)-1)+mp[j],l+=se}var Et=h[Ya(o,l)&wt],Dt=Et>>>4;Et||Nt(3),l+=Et&15;var pe=Sg[Dt];if(Dt>3){var se=fp[Dt];pe+=Ya(o,l)&(1<<se)-1,l+=se}if(l>I){i&&Nt(0);break}n&&a(c+131072);for(var $t=c+mo;c<$t;c+=4)e[c]=e[c-pe],e[c+1]=e[c+1-pe],e[c+2]=e[c+2-pe],e[c+3]=e[c+3-pe];c=$t}}t.l=p,t.p=ot,t.b=c,t.f=s,p&&(s=1,t.m=g,t.d=h,t.n=v)}while(!s);return c==e.length?e:Qa(e,0,c)};var Pg=new yt(0);var Qt=function(o,e){return o[e]|o[e+1]<<8},Rt=function(o,e){return(o[e]|o[e+1]<<8|o[e+2]<<16|o[e+3]<<24)>>>0},Za=function(o,e){return Rt(o,e)+Rt(o,e+4)*4294967296};function Og(o,e){return Cg(o,e)}var qa=typeof TextDecoder<"u"&&new TextDecoder,wg=0;try{qa.decode(Pg,{stream:!0}),wg=1}catch{}var Dg=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,Qa(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 Fg(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(qa)return qa.decode(o);var n=Dg(o),i=n[0],a=n[1];return a.length&&Nt(8),i}}var Ag=function(o,e){return e+30+Qt(o,e+26)+Qt(o,e+28)},kg=function(o,e,t){var r=Qt(o,e+28),n=Fg(o.subarray(e+46,e+46+r),!(Qt(o,e+8)&2048)),i=e+46+r,a=Rt(o,e+20),s=t&&a==4294967295?Lg(o,i):[a,Rt(o,e+24),Rt(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]},Lg=function(o,e){for(;Qt(o,e)!=1;e+=4+Qt(o,e+2));return[Za(o,e+12),Za(o,e+4),Za(o,e+20)]};function Ka(o,e){for(var t={},r=o.length-22;Rt(o,r)!=101010256;--r)(!r||o.length-r>65558)&&Nt(13);var n=Qt(o,r+8);if(!n)return{};var i=Rt(o,r+16),a=i==4294967295||n==65535;if(a){var s=Rt(o,r-12);a=Rt(o,s)==101075792,a&&(n=Rt(o,s+32),i=Rt(o,s+48))}for(var l=e&&e.filter,c=0;c<n;++c){var p=kg(o,i,a),h=p[0],g=p[1],v=p[2],I=p[3],E=p[4],O=p[5],w=Ag(o,O);i=E,(!l||l({name:I,size:g,originalSize:v,compression:h}))&&(h?h==8?t[I]=Og(o.subarray(w,w+g),new yt(v)):Nt(14,"unknown compression type "+h):t[I]=Qa(o,w,w+g))}return t}var Tp=globalThis.fetch,Rg=S?.env?.npm_package_version;function mt(){if(Tp==null)throw new Error("fetch is not available in your environment. Pass your own function into `setFetchFn` (node-fetch, etc)");return Tp}async function Bg(o){return typeof o=="function"?o():o}var es={supplementaryUrl:"https://api-gateway.mappedin.com/analytics/",headers:{},accessToken:"",clientId:"",noAuth:!1,includeHidden:!0,clientSecret:"",apiGateway:"",authorization:"",perspective:"Website",language:"",venue:""};function Ip(o){let e={...es,...o};return e.headers={...e.headers,"mappedin-sdk-version":Rg},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 Vg(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 jg(o,e,t=!1){let r=Vg(o,e,t),n=await mt()(r.url,r.req);if(!n.ok)throw new Error(`${n.status} ${n.statusText}`);return n.json()}var Gg=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 x.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){x.warn(`Perspective ${r} is missing url or locale_packs!`);continue}t[r]={url:i,locale_packs:a}}return t};async function Ug(o,e="exports/mvf/1/bundle"){let t=Ip({baseUri:"https://api-gateway.mappedin.com/",...es,...o}),r=`${t.baseUri+e}?venue=${t.venue}&version=${t.version??"2.0.0"}`;t.headers["Content-Type"]="application/zip";let n=await jg(t,r),i=n.url,a=n.locale_packs,s=t.perspective??es.perspective,l=Gg(n);if(s!=null&&s!==""&&l!=null){let c=l[s];c==null?x.warn(`Perspective ${s} not found in response! Loading default perspective instead.`):(x.log(`Loading perspective "${s}"`),i=c.url,a=c.locale_packs)}return{url:i,localePacks:a,updated_at:n.updated_at}}var yr=(function(){let o;return()=>(o||(o=new TextDecoder),o)})();async function ts(o,{signal:e}){let t=await(await mt()(o,{signal:e})).arrayBuffer();return new Uint8Array(t)}async function br(o){let e=Ka(o),t={};if(e["enterprise/"]!=null){t.enterprise={};let r=e["enterprise/locations.json"];r&&(t.enterprise.locations=JSON.parse(yr().decode(r)));let n=e["enterprise/locationInstances.json"];n&&(t.enterprise.locationInstances=JSON.parse(yr().decode(n)));let i=e["enterprise/categories.json"];i&&(t.enterprise.categories=JSON.parse(yr().decode(i)))}return e["floorstack.json"]&&(t["floorstack.json"]=JSON.parse(yr().decode(e["floorstack.json"]))),e["floor.geojson"]&&(t["floor.geojson"]=JSON.parse(yr().decode(e["floor.geojson"]))),e["manifest.json"]&&(t["manifest.geojson"]=JSON.parse(yr().decode(e["manifest.json"]))),t}async function Sp(o,{signal:e}){try{let t=await(await mt()(o,{signal:e})).arrayBuffer();if(e.aborted)return;let r=new Uint8Array(t);return await br(r)}catch(t){let r=new Error("downloadLanguagePack failed");throw r.cause=t,r}}function Hg(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 os(o){return new Promise(async(e,t)=>{try{let r=Hg(o),{url:n,localePacks:i}=await Ug(o,r),a=await mt()(n).then(l=>l.arrayBuffer()),s=new Uint8Array(a);e({compressed:s,localePacks:i})}catch(r){t(r)}})}async function rs(o,e){return new Promise(async(t,r)=>{try{let{url:n}=await Wg(o,e),i=await mt()(n).then(s=>s.arrayBuffer()),a=new Uint8Array(i);t(a)}catch(n){r(n)}})}async function Wg(o,e){if(o.bundleUri!=null)return{url:await Bg(o.bundleUri),updated_at:""};if(e==null||e==="")throw new Error("Missing access token.");let t=new URL(`${o.baseUri?gr(o.baseUri):mr}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 mt()(t.toString(),{headers:{Authorization:`Bearer ${e}`}});if(!r.ok)throw new Error(`${r.status} ${r.statusText}`);return r.json()}function Ep(o){return Fa(o)}function zg(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 ns(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=Ka(o);if(!zg(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"){x.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 xo(){let o="us",e={};function t(){return Xg(rp(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 Xg(o,e){return{...o,...e}}var vi=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_",""))},Ii=o=>o?.cms!=null,vp=async o=>{let e=performance.now(),t,r=vc.decompressUnsafeSync(o);r.isOk()?t=r.unwrap():x.error("MVFv3 decompression failed!");let n;if(t)try{n=Tc(t)}catch(i){x.error("MVFv3 to MVFv2 conversion failed!",i)}if(x.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 Si(o,e="2.0.0"){switch(e){case"2.0.0":case"2.0.0-c":try{let t=performance.now(),r=await ns(o),n=Fa(r);return x.log(`Parsed MVFv2 in ${performance.now()-t}ms`),{mvf2:n}}catch{return x.error("MVFv2 parsing failed! Trying MVFv3."),vp(o)}case"3.0.0":return vp(o);default:throw new Error(`Unsupported MVF version: ${e}`)}}f();f();function $g(o,e,t){t===void 0&&(t={});for(var r=Mo(o),n=pr(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")),Yg(n[i],n[i+1],r,a,typeof t.epsilon>"u"?null:t.epsilon))return!0}return!1}function Yg(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,v=c-s,I=p-l,E=h*I-g*v;if(n!==null){if(Math.abs(E)>n)return!1}else if(E!==0)return!1;if(r){if(r==="start")return Math.abs(v)>=Math.abs(I)?v>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(v)>=Math.abs(I)?v>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(v)>=Math.abs(I)?v>0?s<i&&i<c:c<i&&i<s:I>0?l<a&&a<p:p<a&&a<l}else return Math.abs(v)>=Math.abs(I)?v>0?s<=i&&i<=c:c<=i&&i<=s:I>0?l<=a&&a<=p:p<=a&&a<=l;return!1}var Mp=$g;f();function Zg(o,e){e===void 0&&(e={});var t=cr(o),r=(t[0]+t[2])/2,n=(t[1]+t[3])/2;return lr([r,n],e.properties,e)}var Tr=Zg;f();f();function Jg(o,e,t){t===void 0&&(t={});var r=Mo(o),n=Mo(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 dc(2*Math.atan2(Math.sqrt(c),Math.sqrt(1-c)),t.units)}var _o=Jg;function Ei(o,e){return e===void 0&&(e={}),hc(o,function(t,r){var n=r.geometry.coordinates;return t+_o(n[0],n[1],e)},0)}f();f();f();function Mi(o,e,t){if(t===void 0&&(t={}),t.final===!0)return qg(o,e);var r=Mo(o),n=Mo(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 uc(Math.atan2(c,p))}function qg(o,e){var t=Mi(e,o);return t=(t+180)%360,t}function Qg(o,e,t){t===void 0&&(t={});var r=lr([1/0,1/0],{dist:1/0}),n=0;return fc(o,function(i){for(var a=pr(i),s=0;s<a.length-1;s++){var l=lr(a[s]);l.properties.dist=_o(e,l,t);var c=lr(a[s+1]);c.properties.dist=_o(e,c,t);var p=_o(l,c,t),h=Math.max(l.properties.dist,c.properties.dist),g=Mi(l,c),v=Aa(e,h,g+90,t),I=Aa(e,h,g-90,t),E=Ic(tn([v.geometry.coordinates,I.geometry.coordinates]),tn([l.geometry.coordinates,c.geometry.coordinates])),O=null;E.features.length>0&&(O=E.features[0],O.properties.dist=_o(e,O,t),O.properties.location=n+_o(l,O,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),O&&O.properties.dist<r.properties.dist&&(r=O,r.properties.index=s),n+=p}}),r}var fn=Qg;function Kg(o,e,t){var r=pr(t);if(mc(t)!=="LineString")throw new Error("line must be a LineString");var n=fn(t,o),i=fn(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),tn(s,t.properties)}var is=Kg;var em=1e-7;function as(o){return{type:"Point",coordinates:o}}function tm(o,e){let{coordinates:t}=e.geometry,{coordinates:r}=o.geometry,n=t.map(i=>fn(o,as(i)));return r.reduce((i,a)=>{let s=is(as(a),n[0],o),l=is(as(a),n[1],o),c=Ei(s)<Ei(l)?s:l;return c.properties={...o.properties,entrances:[]},i.concat([c])},[])}function ss(o,e){return e.reduce((t,r)=>{let n={epsilon:em},i=t.obstructions.findIndex(s=>Mp(Tr(r),s,n)),a=t.obstructions[i];if(a){let[s,l]=tm(a,r);t.entrances.push(r),t.obstructions.splice(i,1,s,l)}return t},{obstructions:[o],entrances:[]})}f();f();f();var Le=class{id;constructor(e){this.id=e}};f();f();var ls=class o{static __type="coordinate";__type=o.__type;id=oe();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]}},z=ls;function cs(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 om=/^https?:\/\/cdn(-staging)?\.mappedin\.com(\/|$)/;function xp(o){return om.test(o)}function _p(o){return!!o.split("?")[1]?.includes("sv=")}function Ke(o,e){let t=o?.properties?.id||"unknown";if(o.geometry==null)return x.error(`Cannot get the center coordinate for "${t}" because it has no geometry.`),new z({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 z({latitude:l,longitude:s,floorId:e})}else if(o.geometry.type==="Point"){let[r,n]=o.geometry.coordinates;return new z({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 z({latitude:i,longitude:n,floorId:e})}}}catch{}try{let[r,n]=Tr(o).geometry.coordinates;return new z({latitude:n,longitude:r,floorId:e})}catch(r){return x.error(`Failed to get center coordinate for "${t}" ${r instanceof Error?r.stack:""}`),new z({latitude:0,longitude:0,floorId:e})}}function Cp(o,e){return e&&(o.flags[e.index]&1<<e.bit)!==0}function xi(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 ps=class o extends Le{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=Ke(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&&Cp({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=ps;f();f();f();f();var ds=class o extends Le{static __type="hyperlink";__type=o.__type;#e={};#t;static is(e){return e.__type===o.__type}constructor(e){super(String(oe())),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]}},zo=ds;f();f();function hn(o){return typeof o=="string"?o:o?.id??""}function Pp(o){return Array.isArray(o)&&Number.isFinite(o[0])&&Number.isFinite(o[1])}var rm=/^https:\/\/cdn\.mappedin\.com\/category-symbols\/.+$/,nm=/^https:\/\/cdn-staging\.mappedin\.net\/category-symbols\/.+$/,im=o=>rm.test(o)||nm.test(o),am=/^https:\/\/cdn\.mappedin\.com\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,sm=/^https:\/\/cdn-staging\.mappedin\.com\/[^/]+\/[^/]+\.[a-zA-Z0-9]+$/,lm=o=>im(o)?!1:am.test(o)||sm.test(o),vr=o=>{if(!lm(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 us(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 fs(o){return o!=null&&typeof o=="object"&&"name"in o&&o.name!=null&&typeof o.name=="string"&&o.name!==""}function Op(o){return lo(o)&&fs(o)}var hs=class o extends Le{static __type="image";__type=o.__type;#e={};#t;#o;static is(e){return e.__type===o.__type}constructor(e){super(String(oe())),this.#t=e.mvfData,this.#o=e.mapData}get url(){let e=this.#t.url;if(this.#o.tokenManager==null)return e;let t=vr(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"&&x.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=hs;f();var Bt=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=cr(this.geoJSON),this.#e)}get geoJSON(){return{properties:null,type:"Feature",geometry:{type:"Polygon",coordinates:[[]]}}}};var Ne=class extends Bt{#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 zo({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 bt=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=vr(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"&&x.error("Error getting SAS token for image",{error:r,url:this.#t}),this.#t}}};f();f();function Co(o){let e;if(z.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&&z.is(o.center))e=o.center;else if("coordinate"in o&&z.is(o.coordinate))e=o.coordinate;else return;return e}f();f();var gn={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",Po="Walls",wp=0,Ir="InteriorDoors",Sr="ExteriorDoors",Er="InteriorDoorsLayer",Mr="ExteriorDoorsLayer",Ce="GeometryLayer",mn="Focusable-",to="LabelsLayer",Vt="MarkersLayer",yn="FootprintLayer",Xo="OcclusionLayer",$o="AreasLayer",xr="ImagesLayer",Yo="FacadesLayer",oo="PathsLayer",jt="ModelsLayer",Zo="Text3DLayer",cm="geometryText",pm="floortext";function Dp(o){return`${Zo}-${o}`}function Oo(o){return`${cm}-${o}`}function _r(o){return`${pm}-${o}`}var Fp=["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"],dm={orange:"#F26336",teal:"#057685",lightTeal:"#5DC7D0"};var um=new Set(["outdoorView","bearing","pitch","zoomLevel","screenOffsets","debug","initialFloor","shadingAndOutlines","wallTopColor","style","multiFloorView","occlusion","imagePlacementOptions","flipImagesToFaceCamera","injectStyles","useStandaloneCamera","preloadFloors"]),fm=new Set(["style","enabled","layersHiddenByGeometry","lowDpi"]);function gs(o){o.outdoorView?.enabled&&!o.outdoorView?.token&&x.error("Enable outdoor view requires a token. Provide token in `options.outdoorView.token`")}function ms(o,e){let t=o?.outdoorView?.token||e.outdoorViewToken,r={...gn,...o,outdoorView:{enabled:o?.outdoorView?.enabled===void 0?!!t:o?.outdoorView?.enabled,layersHiddenByGeometry:gn.outdoorView?.layersHiddenByGeometry,...o?.outdoorView},bearing:o?.bearing??e.naturalBearing??0,imagePlacementOptions:{...gn.imagePlacementOptions,...o?.imagePlacementOptions},multiFloorView:{...gn.multiFloorView,...o?.multiFloorView},disableUpdateStateValidation:o?.disableUpdateStateValidation??!1};return t&&r.outdoorView&&(r.outdoorView.token=t),r}function Ap(o){let e={remove_watermark:!1};if(o)try{let t=gi(o);Object.assign(e,t.capabilities)}catch(t){x.error("Error decoding capabilities from token",t)}return e}function kp(o){let e=Object.fromEntries(Object.entries(o).filter(([t])=>um.has(t)));return e.outdoorView&&(e.outdoorView=Object.fromEntries(Object.entries(e.outdoorView).filter(([t])=>fm.has(t)))),e}var ys=class o extends Ne{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=Ke(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.#n();return t?[...e,t]:e}#n(){let e=this.#r.properties;if(e.image!=null)return this.#o.polygonImage==null&&(this.#o.polygonImage=new bt(`${this.id}-polygon-image-${oe()}`,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(){}},_t=ys;f();var bs=class o extends Ne{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=Ke(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]}},it=bs;f();var Ts=class o extends Ne{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 gm(this.#r.properties.kind)}get enterpriseLocations(){return this.#o.enterpriseLocations!=null?this.#o.enterpriseLocations:(this.#o.enterpriseLocations=xi(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.#n();return t?[...e,t]:e}#n(){let e=this.#r.properties;if(e.image!=null)return this.#o.polygonImage==null&&(this.#o.polygonImage=new bt(`${this.id}-polygon-image-${oe()}`,e.image.path,this,this.#e.tokenManager)),this.#o.polygonImage}get center(){return this.#o.center==null&&(this.#o.center=Ke(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]}},hm=["room","hallway","exterior","void","gate","otb"];function gm(o){if(o==null||o==="default")return"room";let e=o.toLowerCase();return hm.includes(e)?e:"room"}var xe=Ts;f();var vs=class o extends Bt{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=Ke(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=vs;f();var Is=class o extends Ne{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(fr)}get floors(){return this.coordinates.map(e=>e.floorId?this.#e.getById("floor",e.floorId):void 0).filter(fr)}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=Is;f();var Ss=class o extends Ne{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=xi(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=Ke(this.#r,this.#t)),this.#o.center}get images3D(){let e=this.#e.floorImagesByAnchorId.get(this.id)??[],t=this.#n();return t?[...e,t]:e}#n(){let e=this.#r.properties;if(e.image!=null)return this.#o.polygonImage==null&&(this.#o.polygonImage=new bt(`${this.id}-polygon-image-${oe()}`,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=Ss;f();var Es=class o extends Ne{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=Ke(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}},Tt=Es;f();var Ms=class o extends Ne{static __type="annotation";__type=o.__type;#e;#t;#o={};#r;#n;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.#n=t.symbol??{url:"",name:""}}#i(){let[e,t]=this.#r.properties.symbolId.split("--");return{group:e,type:t}}get group(){return this.#i().group}get type(){return this.#i().type}get coordinate(){return this.#o.coordinate==null&&(this.#o.coordinate=Ke(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.#n.name||""}get icon(){return this.#o.icon==null&&(this.#o.icon=super.icon||new Kt({mvfData:{url:this.#n.url,altText:this.#n.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]}},Gt=Ms;f();f();var Lp=di(Cs(),1);function mm(o,e,t){t===void 0&&(t={});var r=dr(o),n=dr(e),i=Lp.default.union(r.coordinates,n.coordinates);return i.length===0?null:i.length===1?fi(i[0],t.properties):hi(i,t.properties)}var _i=mm;var Ps=class o extends Bt{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}#n(e){return this.#e.getPropTranslation(this.__type,e,this.id,this.#o[e])}get type(){return this.#o.type}get name(){let e=this.#n("name");return typeof e=="string"?e:""}get shortName(){let e=this.#n("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&&x.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=_i(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]}},Cr=Ps;f();var Os=class o extends Bt{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 De("No geometry found for facade!");let t=Tr(e);this.#r.center=new z({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}}},Ge=Os;f();var ym=new Set(["wall","area"]),bm=new Set(["desk-entrance"]),Tm=o=>{let e={};for(let t of o?.locations??[])e[t.id]=t;return{mvf3LocationsById:e}},vm=(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 Pi(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}},Im=(o,e)=>{let t={},r={},n={},i={},a={},s={},l={},c={},p={},h=globalThis.Object.keys(o.space);for(let g of h){let v=o.space[g];if(v!=null){for(let I of v.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)),!Lm(I))if(I.properties.kind==="poi"||I.geometry.type==="Point"&&I.properties.kind==null){let E=new Tt(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")x.warn("Encountered a point space with an unknown kind!",I.properties.kind);else{let E=new xe(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}},Sm=(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}},Em=(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(ym.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}},Mm=(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}},xm=(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 Cr(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 Ge(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}},_m=(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}},Cm=(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 it(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}},Pm=(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)}}}}},Om=(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)}}}}},wm=(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}}})}},Dm=(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)}}},Fm=(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 Gt(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}},Am=(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 _t(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}},km=(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}},Np=(o,e)=>{let t={},r={},n={},i={},a=(o.enterprise?.locations??[]).reduce((F,W)=>(F[W.id]=W,F),{}),s={},l={},c={},p={},h={},g={},v=o.enterprise?.venue||{},I={},E={},O={};for(let F of o.enterprise?.categories??[]){let W=new Ci(e,{mvfData:F});s[F.id]=W,F.externalId&&(l[F.externalId]==null&&(l[F.externalId]=[]),l[F.externalId].push(W)),c[F.id]=F,F.locations.forEach(N=>{h[N]==null&&(h[N]=[]),h[N].push(F.id)})}let w={};for(let F of o.enterprise?.locationInstances??[]){let W=a[F.parent],N=Object.keys(W),B={};for(let j of N)B[j]=void 0;let G={...B,polygons:[],nodes:[],...F};w[G.parent]==null&&(w[G.parent]=[]);let A=new ct(e,{mvfData:G,categoryIds:o.enterprise?.categoryPriorities?.[G.id]||h[G.id],parentId:F.parent});w[G.parent].push(A);for(let j of F.polygons??[])O[j.id]=A;I[G.id]=F,E[G.id]=A,F.externalId&&(i[F.externalId]==null&&(i[F.externalId]=[]),i[F.externalId].push(A))}for(let F of o.enterprise?.locations??[]){let W=new ct(e,{mvfData:F,categoryIds:o.enterprise?.categoryPriorities?.[F.id]||h[F.id],locationInstances:w[F.id]});n[F.id]=W,F.externalId&&(i[F.externalId]==null&&(i[F.externalId]=[]),i[F.externalId].push(W)),F.nodes.forEach(N=>{g[N.id]==null&&(g[N.id]=[]),g[N.id].push(F.id)});for(let N of F.polygons)p[N.id]==null&&(p[N.id]=[]),p[N.id].push(F)}if(e.enterpriseMode===!0){for(let F in e.mvfConnectionsById){let W={},N=e.mvfConnectionsById[F],B={id:F,externalId:N.externalId,kind:"enterprise."+N.type,destinationNodes:[],flags:N.flags,type:N.type,nodes:N.nodes,accessible:N.accessible,extra:N.extra,details:N.details};for(let G of e.mvfConnectionsById[F].nodes){let A=e.nodesById[G];A!=null&&(W[A.floor.id]={type:"Feature",geometry:{type:"Point",coordinates:[A.coordinate.longitude,A.coordinate.latitude]},properties:B})}Object.keys(W).length>0&&(t[F]=new Ze(e,{mvfData:B}),N.externalId&&(r[N.externalId]==null&&(r[N.externalId]=[]),r[N.externalId].push(t[F])))}e.connectionsById=t}return{connectionsByExternalId:r,locationIdsByNodeId:g,mvfLocationsByGeometryId:p,mvfLocationsById:a,mvfCategoriesById:c,locationsById:n,locationInstancesById:E,instanceLocationsByPolygonId:O,locationsByExternalId:i,mvfLocationInstancesById:I,categoriesById:s,categoriesByExternalId:l,venue:v}},Rp=(o,e,t)=>{let{nodesById:r,nodesByExternalId:n,mvfNodesById:i,mvfNodesByFloorId:a}=Sm(e,o),{connectionsById:s,mvfConnectionsById:l,mvfConnectionsByNodeId:c}=_m(e,o),{spacesById:p,spacesByExternalId:h,poisById:g,poisByExternalId:v,mvfSpacesById:I,objectEntranceNodeIdsByObstructionId:E,mvfSpacesByFloorId:O,mvfPoisByFloorId:w}=Im(e,o),{objectsById:F,objectsByExternalId:W,mvfObstructionById:N,obstructionIdByEntranceId:B}=Em(e,o),{floorsById:G,floorsByExternalId:A,mvfFloorsById:j}=Mm(e,o),{floorStacksById:te,floorStacksByExternalId:he,mvfFloorStacksById:ge,facadesById:ie,facadesBySpaceId:Te}=xm(e,o),{doorsById:Be,doorsByExternalId:Ve,doorsByNodeId:pe,mvfEntrancesById:$e,mvfEntrancesByFloorId:wt}=Cm(e,o),{annotationsById:ot,mvfAnnotationsById:ve,mvfAnnotationsByFloorId:mo}=Fm(e,o),{areasById:se,areasByExternalId:Et,mvfAreasById:Dt}=Am(e,o);Om(e,I,N,Dt),Pm(e,I,N),wm(e,I),Dm(e,I,N);let{mvf3LocationsById:$t}=Tm(t),{locationCategoriesByParentId:Ft,locationProfilesById:yo,locationCategoriesById:bo,locationProfilesByExternalId:Vo,locationProfilesByCategoryId:ir,locationProfilesByAttachedFeatureId:ar}=vm(o,e,$t),{entranceNodeIdsBySpaceId:re,spaceIdsByNodeId:jo,objectIdsByNodeId:ae,destinationNodesIdsBySpaceId:To}=km(I,pe);return{spacesById:p,spacesByExternalId:h,nodesById:r,nodesByExternalId:n,objectsById:F,objectsByExternalId:W,floorsById:G,floorsByExternalId:A,floorStacksById:te,floorStacksByExternalId:he,facadesById:ie,facadesBySpaceId:Te,connectionsById:s,doorsById:Be,doorsByExternalId:Ve,doorsByNodeId:pe,poisById:g,poisByExternalId:v,annotationsById:ot,areasById:se,areasByExternalId:Et,objectEntranceNodeIdsByObstructionId:E,obstructionIdByEntranceId:B,locationProfilesById:yo,locationCategoriesById:bo,locationProfilesByExternalId:Vo,locationProfilesByCategoryId:ir,locationCategoriesByParentId:Ft,mvfSpacesById:I,mvfNodesById:i,mvfObstructionById:N,mvfFloorsById:j,mvfFloorStacksById:ge,mvfConnectionsById:l,mvfConnectionsByNodeId:c,mvfEntrancesById:$e,mvfAnnotationsById:ve,mvfNodesByFloorId:a,mvfSpacesByFloorId:O,mvfPoisByFloorId:w,mvfAreasById:Dt,mvfEntrancesByFloorId:wt,mvfAnnotationsByFloorId:mo,locationProfilesByAttachedFeatureId:ar,entranceNodeIdsBySpaceId:re,spaceIdsByNodeId:jo,objectIdsByNodeId:ae,destinationNodesIdsBySpaceId:To,mvf3LocationsById:$t}};function Lm(o){return!["Polygon","MultiPolygon"].includes(o.geometry.type)&&"kind"in o.properties&&o.properties.kind==null||o.properties.kind?.includes("connection")||bm.has(o.properties.kind??"")}f();var Nm=new Set(["polygons"]),ws=class o extends Le{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)!Nm.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=ws;f();var Rm=new Set,Ds=class o extends Le{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)!Rm.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]}},Ci=Ds;f();var Bm=new Set,Fs=class o extends Le{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)!Bm.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]}},As=Fs;f();f();f();f();f();var Bp=(i=>(i.Departure="Departure",i.TakeConnection="TakeConnection",i.ExitConnection="ExitConnection",i.Turn="Turn",i.Arrival="Arrival",i))(Bp||{}),ks=(a=>(a.Straight="Straight",a.Right="Right",a.SlightRight="SlightRight",a.Left="Left",a.SlightLeft="SlightLeft",a.Back="Back",a))(ks||{}),Vp=(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))(Vp||{}),Oi=(t=>(t.Exterior="exterior-walls",t.Interior="interior-walls",t))(Oi||{}),wi=(t=>(t.Interior="interior-doors",t.Exterior="exterior-doors",t))(wi||{});f();function jp(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}=gc(a),c=s(e),p=s(t),h=p.x-c.x,g=p.y-c.y,v=i-n,I=Math.sqrt(h*h+g*g+v*v);if(I<=r*2)return null;let E=r/I,O={x:c.x+h*E,y:c.y+g*E},w=l(O.x,O.y),F=e[2]!==void 0?e[2]+v*E:void 0,W={x:p.x-h*E,y:p.y-g*E},N=l(W.x,W.y),B=t[2]!==void 0?t[2]-v*E:void 0;return{fromPosition:F!==void 0?[w.lon,w.lat,F]:[w.lon,w.lat],toPosition:B!==void 0?[N.lon,N.lat,B]:[N.lon,N.lat]}}function Ls(o,e,t,r,n){let i=jp({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 vt(o){return o.verticalOffset===0?[o.longitude,o.latitude]:[o.longitude,o.latitude,o.verticalOffset]}function Gm(o){return new Map(o.map(e=>{let{properties:t}=e,{id:r}=t;return[r,e]}))}var Bs=(o,e)=>{let t=Gm(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}=ss(n,a);i=l.map(c=>c.geometry.coordinates),r.entrances.features.push(...s)}r.walls.geometry.coordinates.push(...i)}return r};function Up(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 Wp(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 zp(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 Pr(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 Vs=(o,e)=>{let r=(e.currentMap?.currentFloor).layers.get(Ce);switch(o){case"interior-walls":return r?.layers.get(Po);case"exterior-walls":return r?.layers.get(eo);case"interior-doors":return r?.layers.get(Ir);case"exterior-doors":return r?.layers.get(Sr);default:return typeof o=="string"?o:o?.id}};function js(o){return new Promise(e=>{o.onComplete(e),o.onStop(e)})}function Xp(o){return o.bbox?o.bbox:cr(o)}function Or(o,e,t){return o.floorId&&e.has(o.floorId)?e.get(o.floorId):t}function wr(o){if(xe.is(o)||dt.is(o))return o.id}function $p(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 Yp(o,e){let t=o.properties.path.split("/"),r=t[t.length-1].split(".")[0],n=atob(r);return"img_"+ui(n).toString()+"-"+e}function Ns(o="auto",e,t=1,r){return o!=="auto"?o*t:e!=null?e*t:r!=null?r*t:3*t}function Gp(o,e,t,r){if(o.maxHeight!=null&&o.maxHeight>0)return Ns(e,o.maxHeight,t,r);let n=Ns(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 Zp(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=Gp(h,e,t,r);if(!n){let v=h.elevation-c-1;v>0&&(s+=v*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=Gp(h,e,t,r),v=-(s+g);l.set(h.elevation,{altitude:v,visualHeight:g}),s+=g}return l}function Jp(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),v=g?.visualHeight??Ns(t,void 0,r,n),I=h*v,E=g?.altitude??0;s.push({altitude:E-I,height:I,floorAboveElevation:p.elevation,missingCount:h})}l=p.elevation}return s}function Di(o,e){let t=e(o.center);return{center:new z({latitude:t[1],longitude:t[0]}),radius:o.radius}}function qp(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 Qp=Math.PI*.1,wo=class{id;#e={};#t;#o;constructor(e,t,r,n,i){this.id=i?.id??oe(),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 z(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 z(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;#n;#i;#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.#n=p,this.#i=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.#n=p,this.#i=c}else this.#r==="take"?(l.push(this.#c("ExitConnection",a,i,this.#n,this.#i)),this.#r="exit",this.#n=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?-Up(e.properties.angle,t.properties.angle):0;return Math.abs(i)>=Qp?{type:"Turn",bearing:Hp(i,Qp),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 Kp(o){return lo(o)?"navigationTarget"in o&&o.navigationTarget!=null:!1}var Um={lineOfSight:!0,mode:"absolute-distance",maxResults:1};function ed(o){return{...Um,lineOfSight:!o}}var Ie=new WeakMap;function Fi(o,e,t){let r=ed(t),i=e.Query.__LEGACY_NEAREST_SYNC(o,e.getByType("node"),r)?.[0]?.feature.id;return i?[i]:[]}async function Ai(o,e,t){let r=ed(t),i=(await e.Query.nearest(o,e.getByType("node"),r))?.[0]?.feature.id;return i?[i]:[]}function Hm(o,e,t){let r=[];for(let n of o.navigationTarget){let i=Do(n,e,t);r.push(...i)}return r}async function Wm(o,e,t){let r=[];for(let n of o.navigationTarget){let i=await Fo(n,e,t);r.push(...i)}return r}function td(o,e){let r=e?.getMVFFeatureById("entrance",o.id)?.properties.node;return r?[r]:[]}function od(o,e){return e?.getMVFFeatureById("area",o.id)?.properties.destinationNodes??[]}function rd(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 zm(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 Xm(o,e,t){let r=[];for(let n of o.coordinates){let i=await Ai(n,e,t);i.length>0&&r.push(i[0])}return r}function nd(o,e){return e?.objectEntranceNodeIdsByObstructionId[o.id]??[]}function id(o,e){return o.spaces.flatMap(t=>e?.getMVFFeatureById("space",t.id)?.properties.destinationNodes??[]).filter(t=>typeof t=="string")}function ad(o){return o.nodes.map(e=>e.id)}function Do(o,e,t){if(Ie.has(o))return Ie.get(o);if(co.is(o)){let r=Hm(o,e,t);return Ie.set(o,r),r}else if(Gt.is(o)){let r=Fi(o,e,t);return Ie.set(o,r),r}else if(z.is(o)){let r=Fi(o,e,t);return Ie.set(o,r),r}else{if(Tt.is(o))return Fi(o,e,t);if(it.is(o)){let r=td(o,e);return Ie.set(o,r),r}else if(_t.is(o)){let r=od(o,e);return Ie.set(o,r),r}else if(xe.is(o)){let r=rd(o,e);return Ie.set(o,r),r}else if(Ze.is(o)){let r=zm(o,e,t);return Ie.set(o,r),r}else if(dt.is(o)){let r=nd(o,e);return Ie.set(o,r),r}else if(Ge.is(o)){let r=id(o,e);return Ie.set(o,r),r}else if(ct.is(o)){let r=ad(o);return Ie.set(o,r),r}else if(xt.is(o)){let r=[o.id];return Ie.set(o,r),r}else return[]}}async function Fo(o,e,t){if(Ie.has(o))return Ie.get(o);if(co.is(o)){let r=await Wm(o,e,t);return Ie.set(o,r),r}else if(Gt.is(o)){let r=await Ai(o,e,t);return Ie.set(o,r),r}else if(z.is(o)){let r=await Ai(o,e,t);return Ie.set(o,r),r}else if(Tt.is(o)){let r=await Ai(o,e,t);return Ie.set(o,r),r}else if(it.is(o)){let r=td(o,e);return Ie.set(o,r),r}else if(_t.is(o)){let r=od(o,e);return Ie.set(o,r),r}else if(xe.is(o)){let r=rd(o,e);return Ie.set(o,r),r}else if(Ze.is(o)){let r=await Xm(o,e,t);return Ie.set(o,r),r}else if(dt.is(o)){let r=nd(o,e);return Ie.set(o,r),r}else{if(Ge.is(o))return id(o,e);if(ct.is(o)){let r=ad(o);return Ie.set(o,r),r}else if(xt.is(o)){let r=[o.id];return Ie.set(o,r),r}else return[]}}function sd(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 ld(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=sd(n,r)),n}function cd(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=sd(n,r)),n}function Gs(o){if(z.is(o))return o;if(!(!Kp(o)||Array.isArray(o.navigationTarget)||!z.is(o.navigationTarget)))return o.navigationTarget}var Dr=class{navigator;connections;constructor({nodes:e,geojsonCollection:t,connections:r,groupBy:n,multiplicativeDistanceWeightScaling:i,flagDeclarations:a,getDoorByNodeId:s}){this.navigator=new Ec({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)),xe.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)),xe.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 Fo(p,n,n.enterpriseMode));for(let p of t)a.set(p,await Fo(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,Do(p,n,n.enterpriseMode)])),a=new Map(t.map(p=>[p,Do(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(w=>!r.includes(w)&&!n.includes(w)),c=new Map,p={...i.connectionIdWeightMap};for(let w of i.excludedConnections)p[w.id]=1/0;for(let w in p){let F=a.getById("connection",w);F&&this.#t(F,p[w],c)}let g=(i.smoothing.__EXPERIMENTAL_METHOD??"greedy-los")!=="greedy-los",v=this.navigator.getDirections({zones:i.zones.map(w=>({geometry:w.geometry,cost:w.cost,map:w.floor?.id})),originIds:r,from:g?pd(e):[],to:g?pd(t):[],destinationNodeIds:n,disabledConnectionNodeIds:l,simplify:i.smoothing,overrideEdgeWeights:c,multiplicativeDistanceWeightScaling:!a.enterpriseMode,includeNonPublic:i.includeNonPublic});this.addCoordinateDirections(v,e,t);let I=ld(v,e,s),E=cd(v,t,s),O=new wo(v,a,I,E);if(!(O.distance===0&&new Set([...r,...n]).size===r.length+n.length))return O};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=Gs(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=Gs(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 $m(o){if(z.is(o))return o.floorId;if(xe.is(o)||it.is(o)||Tt.is(o)||Gt.is(o)||dt.is(o)||_t.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(Ge.is(o)&&o.spaces.length>0)return o.spaces[0].floor.id}function pd(o){return o.reduce((e,t)=>{let r=Co(t);if(!r)return e;let n=$m(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 Jo from"zod";var Fr=50,Us=1,Hs=!1,dd=Jo.object({limit:Jo.enum(["same-floor","same-elevation","all-floors"]).optional(),mode:Jo.enum(["travel-distance","absolute-distance"]).optional(),lineOfSight:Jo.boolean().optional().or(Jo.literal("auto")),maxDistance:Jo.number().optional(),maxResults:Jo.number().optional()}),ud={lineOfSight:Hs,mode:"travel-distance",maxDistance:Fr,limit:"same-floor",maxResults:Us},bn=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t}__LEGACY_NEAREST_SYNC=(e,t,r)=>{let n={...ud,...r};try{dd.parse(n)}catch(p){x.error(p);return}let i=Co(e);if(!i)return;let a=this.#o(i,n),s=[],l={},c=[];for(let p of t){let h=Do(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.#i(e,a,c,l,n),s.sort((p,h)=>p.distance-h.distance)};async nearest(e,t,r){let n={...ud,...r};try{dd.parse(n)}catch(h){x.error(h);return}let i=Co(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(Fo(h,this.#e,this.#e.enterpriseMode).then(g=>{if(g)for(let v of g)l[v]||(l[v]=[]),l[v].push(h),c.push(v)}));await Promise.all(p),s=await this.#n(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??Fr,n?.lineOfSight==="auto"?Hs: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};#n=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??Fr,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??Fr)-c,s,r,!1,i?.maxResults??Us);for(let g of h)for(let v of n[g.feature.properties.id])p.has(v.id)||(a.push({distance:g.distance+c,feature:v}),p.add(v.id))}}return a};#i=(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??Fr,maxResults:1})?.[0].feature),l){let c=this.#e.directions.navigator.findNearestNodesOnGraph(l.id,i?.maxDistance??Fr,s,r,i?.lineOfSight==="auto"?Hs:i?.lineOfSight,i?.maxResults??Us);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 ki=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:Sc(e,r)}};f();f();f();f();function fd(o){let e=+this._x.call(null,o),t=+this._y.call(null,o);return hd(this.cover(e,t),e,t,o)}function hd(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,v,I,E,O,w,F;if(!i)return o._root=a,o;for(;i.length;)if((E=e>=(h=(s+c)/2))?s=h:c=h,(O=t>=(g=(l+p)/2))?l=g:p=g,n=i,!(i=i[w=O<<1|E]))return n[w]=a,o;if(v=+o._x.call(null,i.data),I=+o._y.call(null,i.data),e===v&&t===I)return a.next=i,n?n[w]=a:o._root=a,o;do n=n?n[w]=new Array(4):o._root=new Array(4),(E=e>=(h=(s+c)/2))?s=h:c=h,(O=t>=(g=(l+p)/2))?l=g:p=g;while((w=O<<1|E)===(F=(I>=g)<<1|v>=h));return n[F]=i,n[w]=a,o}function gd(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)hd(this,a[t],s[t],o[t]);return this}f();function md(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 yd(){var o=[];return this.visit(function(e){if(!e.length)do o.push(e.data);while(e=e.next)}),o}f();function bd(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 Ue(o,e,t,r,n){this.node=o,this.x0=e,this.y0=t,this.x1=r,this.y1=n}function Td(o,e,t){var r,n=this._x0,i=this._y0,a,s,l,c,p=this._x1,h=this._y1,g=[],v=this._root,I,E;for(v&&g.push(new Ue(v,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(!(!(v=I.node)||(a=I.x0)>p||(s=I.y0)>h||(l=I.x1)<n||(c=I.y1)<i))if(v.length){var O=(a+l)/2,w=(s+c)/2;g.push(new Ue(v[3],O,w,l,c),new Ue(v[2],a,w,O,c),new Ue(v[1],O,s,l,w),new Ue(v[0],a,s,O,w)),(E=(e>=w)<<1|o>=O)&&(I=g[g.length-1],g[g.length-1]=g[g.length-1-E],g[g.length-1-E]=I)}else{var F=o-+this._x.call(null,v.data),W=e-+this._y.call(null,v.data),N=F*F+W*W;if(N<t){var B=Math.sqrt(t=N);n=o-B,i=e-B,p=o+B,h=e+B,r=v.data}}return r}f();function vd(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,v,I,E,O,w;if(!t)return this;if(t.length)for(;;){if((I=p>=(g=(a+l)/2))?a=g:l=g,(E=h>=(v=(s+c)/2))?s=v:c=v,e=t,!(t=t[O=E<<1|I]))return this;if(!t.length)break;(e[O+1&3]||e[O+2&3]||e[O+3&3])&&(r=e,w=O)}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[O]=i:delete e[O],(t=e[0]||e[1]||e[2]||e[3])&&t===(e[3]||e[2]||e[1]||e[0])&&!t.length&&(r?r[w]=t:this._root=t),this):(this._root=i,this)}function Id(o){for(var e=0,t=o.length;e<t;++e)this.remove(o[e]);return this}f();function Sd(){return this._root}f();function Ed(){var o=0;return this.visit(function(e){if(!e.length)do++o;while(e=e.next)}),o}f();function Md(o){var e=[],t,r=this._root,n,i,a,s,l;for(r&&e.push(new Ue(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 Ue(n,c,p,s,l)),(n=r[2])&&e.push(new Ue(n,i,p,c,l)),(n=r[1])&&e.push(new Ue(n,c,a,s,p)),(n=r[0])&&e.push(new Ue(n,i,a,c,p))}return this}f();function xd(o){var e=[],t=[],r;for(this._root&&e.push(new Ue(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 Ue(i,a,s,p,h)),(i=n[1])&&e.push(new Ue(i,p,s,l,h)),(i=n[2])&&e.push(new Ue(i,a,h,p,c)),(i=n[3])&&e.push(new Ue(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 _d(o){return o[0]}function Cd(o){return arguments.length?(this._x=o,this):this._x}f();function Pd(o){return o[1]}function Od(o){return arguments.length?(this._y=o,this):this._y}function Tn(o,e,t){var r=new Ws(e??_d,t??Pd,NaN,NaN,NaN,NaN);return o==null?r:r.addAll(o)}function Ws(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 wd(o){for(var e={data:o.data},t=e;o=o.next;)t=t.next={data:o.data};return e}var at=Tn.prototype=Ws.prototype;at.copy=function(){var o=new Ws(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=wd(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]=wd(r));return o};at.add=fd;at.addAll=gd;at.cover=md;at.data=yd;at.extent=bd;at.find=Td;at.remove=vd;at.removeAll=Id;at.root=Sd;at.size=Ed;at.visit=Md;at.visitAfter=xd;at.x=Cd;at.y=Od;f();function zs(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,v]=s[l];e(c,p,h,g,v)||zs(o,e,c,p,h,g,v)}}return!1}var Dd=1e3,Ym=.1,Zm=5,Jm=1.5,Li=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=Dd;else r=Dd;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=Zm,v=Math.max(a,this.getMaxSearchRadiusForFloorId(t,n));for(;h.length<l&&g<=v;){let I=this.#o(e,c,i,g,a,p);I.sort((E,O)=>E.distance-O.distance);for(let E of I){if(h.length>=l)break;s?this.#r.directions.navigator.hasLineOfSight(e,E.node.geometry.coordinates,n,Ym)&&h.push(E):h.push(E)}g=g*Jm}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,v=[];return zs(t,(I,E,O,w,F)=>{let W=E>=p||O>=g||w<c||F<h;if("data"in I){let N=I;for(;N;){let B=N.data,G=B.properties.parentId||B.properties.id;if(r.includes(G)&&!a.has(G)){a.add(G);let A=qt(e,B.geometry.coordinates);A<=i&&v.push({node:B,distance:A})}N=N.next}}return W}),v}#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]=Tn();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;case"object":case"location-profile":case"connection":case"area":case"facade":i=this.#n(this.#r.getByType(e),r);break}return i?.length>0&&n.addAll(i),n}#n(e,t){let r=[];for(let n of e){let i=Do(n,this.#r,this.#r.enterpriseMode);for(let a=0;a<i.length;a++){let s=this.#r.mvfNodesById[i[a]];s&&(s.properties.floor??s.properties.map)===t&&r.push({...s,properties:{...s.properties,id:s.properties.id,parentId:n.id}})}}return r}#i;constructor(e,t){this.#r=e,this.#i=t}};f();f();f();f();function Ni(o,e,t=0,r=o.length-1,n=qm){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),v=Math.max(t,Math.floor(e-c*h/l+g)),I=Math.min(r,Math.floor(e+(l-c)*h/l+g));Ni(o,e,v,I,n)}let i=o[e],a=t,s=r;for(vn(o,t,e),n(o[r],i)>0&&vn(o,t,r);a<s;){for(vn(o,a,s),a++,s--;n(o[a],i)<0;)a++;for(;n(o[s],i)>0;)s--}n(o[t],i)===0?vn(o,t,s):(s++,vn(o,s,r)),s<=e&&(t=s+1),e<=s&&(r=s-1)}}function vn(o,e,t){let r=o[e];o[e]=o[t],o[t]=r}function qm(o,e){return o<e?-1:o>e?1:0}var En=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(!Bi(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;Bi(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(!Bi(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(Bi(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=kr([]),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=Qm(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=kr(e.slice(t,r+1)),Ar(s,this.toBBox),s;n||(n=Math.ceil(Math.log(i)/Math.log(a)),a=Math.ceil(i/Math.pow(a,n-1))),s=kr([]),s.leaf=!1,s.height=n;let l=Math.ceil(i/a),c=l*Math.ceil(Math.sqrt(a));Fd(e,t,r,c,this.compareMinX);for(let p=t;p<=r;p+=c){let h=Math.min(p+c-1,r);Fd(e,p,h,l,this.compareMinY);for(let g=p;g<=h;g+=l){let v=Math.min(g+l-1,h);s.children.push(this._build(e,g,v,n-1))}}return Ar(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=Xs(c),h=ty(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),Sn(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=kr(r.children.splice(a,r.children.length-a));s.height=r.height,s.leaf=r.leaf,Ar(r,this.toBBox),Ar(s,this.toBBox),t?e[t-1].children.push(s):this._splitRoot(r,s)}_splitRoot(e,t){this.data=kr([e,t]),this.data.height=e.height+1,this.data.leaf=!1,Ar(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=In(e,0,s,this.toBBox),c=In(e,s,r,this.toBBox),p=oy(l,c),h=Xs(l)+Xs(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:Km,i=e.leaf?this.compareMinY:ey,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=In(e,0,t,i),s=In(e,r-t,r,i),l=Ri(a)+Ri(s);for(let c=t;c<r-t;c++){let p=e.children[c];Sn(a,e.leaf?i(p):p),l+=Ri(a)}for(let c=r-t-1;c>=t;c--){let p=e.children[c];Sn(s,e.leaf?i(p):p),l+=Ri(s)}return l}_adjustParentBBoxes(e,t,r){for(let n=r;n>=0;n--)Sn(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():Ar(e[t],this.toBBox)}};function Qm(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 Ar(o,e){In(o,0,o.children.length,e,o)}function In(o,e,t,r,n){n||(n=kr(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];Sn(n,o.leaf?r(a):a)}return n}function Sn(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 Km(o,e){return o.minX-e.minX}function ey(o,e){return o.minY-e.minY}function Xs(o){return(o.maxX-o.minX)*(o.maxY-o.minY)}function Ri(o){return o.maxX-o.minX+(o.maxY-o.minY)}function ty(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 oy(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 Bi(o,e){return e.minX<=o.maxX&&e.minY<=o.maxY&&e.maxX>=o.minX&&e.maxY>=o.minY}function kr(o){return{children:o,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function Fd(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;Ni(o,a,e,t,n),i.push(e,a,a,t)}}var Vi=class extends En{#e;constructor(e){super(),this.#e=e}toBBox=e=>{let t=e.geoJSONBoundingBox;t==null&&x.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 ji=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 Ad(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 Mn=class{#e;#t;#o;#r;constructor(e){let t=Ad(e.mapCenter.longitude,e.mapCenter.latitude);this.#o=new Li(e,t),this.#r=new ji(e,t),this.#e=new bn(e,this.#o),this.#t=new ki(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 Gi=class{#e;constructor(e){this.#e=e||[]}get raw(){return this.#e}};var Ys=class o extends Le{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 zo({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 zo({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 Gi(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=Ys;f();var Zs=class o extends Le{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}}},Pi=Zs;var Js=.75;function ry(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:oe()}});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:oe()}});return e}function ny(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=ry(r);for(let s of a)i.push(s)}e[n]={voids:{type:"FeatureCollection",features:i}}}return e}var qo=class extends gt{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??xo();if(this.envControl=r,this.binaryBundle=t?.binaryBundle,this.Analytics=new hr,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=Rp(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=ny(e),this.enterpriseMode||xn()){let i=Np(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 As(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]=cs(l)}),this.currentLanguage=this.venue.defaultLanguage}}this.directions=new Dr({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 Mn(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 z(0,0,"initializing");get mapCenter(){return this.#o.floorId==="initializing"&&(this.#o=new z(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=ui(i+e+r+t.toString());if(this.propTranslationCache.has(c))return this.propTranslationCache.get(c);let p=bc(n,l,["id"]);return this.propTranslationCache.set(c,p),p}return l}return l}}return n}findPreferredLanguage(e){if(!this.venue)return;let t=qs(this.venue,e);return e?.languageCode!=null&&e.languageCode.toLowerCase()!==t.code.toLowerCase()&&x.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){x.error("Language code must be defined.");return}if(!this.currentLanguage||!this.venue){x.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){x.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){x.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 Sp(a,{signal:s.signal})}catch(c){x.error(`Failed to download language pack for language code "${n.code}".`,c);return}if(!l||s.signal.aborted)return;i=cs(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=kd(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],v=this.directions.getDirectionsSync(c,g,l,this);if(!v){x.error("getDirections failed due to missing directions for one of the segments");return}c=g,p.push(v)}return p}else{let c=Array.isArray(e)?e:[e],p=Array.isArray(t)?t:[t];if(Array.isArray(p[0])){x.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){x.error("Unable to get directions",h);return}}};getDirections=async(e,t,r)=>{let{accessible:n=!1}=r||{},i=kd(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])){x.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){x.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=Co(e),n=Co(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(!xp(e))return{url:e};if(_p(e))return{url:e};let t=vr(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 x.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 ts(this.localePacksUrls[n.code],{signal:r.signal}),a=await br(i);a&&t.push({language:{code:n.code,name:n.name},localePack:a})}}catch(i){x.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){x.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 ts(this.localePacksUrls[n.code],{signal:r.signal});i&&t.push({language:{code:n.code,name:n.name},localePack:i})}}catch(i){x.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 kd=(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??Js,__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??Js,__EXPERIMENTAL_METHOD:"rdp",mustIncludeDoorBufferNodes:typeof r=="object"&&r.__EXPERIMENTAL_METHOD==="rdp"?r.__EXPERIMENTAL_MUST_INCLUDE_DOOR_BUFFER_NODES:void 0}:{enabled:i,radius:a??Js,__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 Qo=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 Ao=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=us(this.coordinates),this.#e)}get focusTarget(){return this.coordinates}toJSON(){return{__type:o.__type,id:this.id,coordinates:this.coordinates,isConnectionSegment:this.isConnectionSegment,distance:this.distance}}},Ct=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 Ao(i.toString(),a))}get distance(){return this.#e?this.#e:(this.#e=us(this.coordinates),this.#e)}toJSON(){return{__type:o.__type,id:this.id,coordinates:this.coordinates,segments:this.segments}}};f();var iy=7,_n=class{#e;#t;constructor(e,t){this.#e=e,this.#t=t?.precision??iy}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=mi(e.latitude,this.#t),r=mi(e.longitude,this.#t);return new z({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 mi(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 ay=new Map([["search-16x16",`<svg viewBox="0 0 16 16">
7
7
  <path
8
8
  fillRule="evenodd"
9
9
  clipRule="evenodd"
@@ -294,7 +294,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
294
294
  <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 "/>
295
295
  <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 "/>
296
296
  </g>
297
- </svg>`},zb=/<svg([^>]*)>/g;function Mh(o,e,t){let r=Wb[o];return r?r.replace(zb,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${e}; width:${t}px; height:${t}px">`):null}function Xb(o){return Eh.sanitize(o,{USE_PROFILES:{svg:!0}})}function $b(o,e){let n=new DOMParser().parseFromString(o,"image/svg+xml").documentElement;return n==null||n.tagName==="parsererror"||n.tagName.toLowerCase()!=="svg"?(x.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 xh(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 mt()(o),n=r.headers.get("content-type");if(n?.includes("image/svg+xml")){let i=await r.text();return t=Xb(i),e?.color!=null&&(t=$b(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 x.error(`Failed to fetch icon from ${o}.`,r),null}}f();function _h(o){return o.locationProfiles.some(e=>e.categories.some(t=>t.name.includes("Restroom")))}function Ch(o){return o.locationProfiles.some(e=>e.categories.some(t=>t.name.includes("Parking")))}var Oh=new Set(["connection","point-of-interest","space","object","door","facade"]),nr={default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F",parking:"#418425",door:"#A0552C"},Xr={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 Yb(o){let e=null;if(Ze.is(o))switch(o.type){case"elevator":e=Xr.elevator;break;case"ladder":e=Xr.ladder;break;case"escalator":case"stairs":default:e=Xr.stairs}else Tt.is(o)?e=Xr.point:it.is(o)?e=Xr.door:Ge.is(o)&&(e=Xr.building);return e!=null?Mh(e,"#FFFFFF",12):null}function Ph(o){return Ze.is(o)?nr.connection:Ge.is(o)?nr.default:_h(o)?nr.washroom:Ch(o)?nr.parking:Tt.is(o)?nr.point:it.is(o)?nr.door:nr.default}async function Zb(o,e){let t=null,r="locationProfiles"in o?o.locationProfiles.find(n=>n.icon!=null)?.icon:null;if(r?.url!=null&&(t=await xh(r.url,{color:e.color,style:"fill"})),t==null){let n=Yb(o);n!=null&&(t={icon:n,type:"svg"})}return t}function Jb(o){return Ze.is(o)||it.is(o)?"low":Tt.is(o)||Ge.is(o)?"high":"medium"}async function qb(o){let e={appearance:{color:Ph(o),pinOutlineColor:Ph(o),iconPadding:8,iconSize:24,textSize:12.5,iconScale:{on:"zoom-level",input:[18,20],output:[.7,1]}},rank:Jb(o),interactive:!0},t=await Zb(o,{color:"#FFFFFF"});return t!=null&&(e.appearance.icon=t.icon,t.type==="svg"?Ge.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 wh(o,e){return(await Promise.all(e.map(async r=>{let n=[];if(!lo(r))return n;let i=await qb(r);return Ze.is(r)?n=r.coordinates.map(a=>o.Labels.add(a,r.name,i)):Ge.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)):nh(r)&&fs(r)&&n.push(o.Labels.add(r,r.name,i)),n}))).flat()}async function Dh(o,e){let t=o.getMapDataInternal();if(!t)throw new Error("Map data not found");let r=t.getAllOfTypes(Oh,e),n=t.getAllOfTypes(eh,e),i=t.getAllOfTypes(oh,e),[a,s]=await Promise.all([r.length>0?wh(o,r):[],n.length>0?th(o,n):[],i.length>0?rh(o,i):[]]);return{labels:a,markers:s}}f();f();var Xl=(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)};var Ma=.05,ei=class extends gt{core;mapObjects=[];id;mapDataExternal={};mapsByFloorId={};mapData;currentMap;hiddenOutdoorGeometries=[];lastFacadeIntersected;#e;#t=!1;mapView;externalPubSub;get __EXPERIMENTAL__floorHandler(){return this.#e}__EXPERIMENTAL__overrideSetFloorHandler(e){e&&this.#e&&this.#e!==yi&&x.warn("overwriting an existing setFloor override handler"),this.#o(e)}get manualFloorVisibility(){return this.#e!==void 0}set manualFloorVisibility(e){let t=this.#e;t&&t!==yi&&e&&x.warn("manualFloorVisibility true overwriting an existing setFloor handler to noop"),this.#o(e?yi:void 0)}#o(e){let t=this.manualFloorVisibility;this.#e=e,this.manualFloorVisibility!==t&&this.externalPubSub.publish("state-change-internal",{manualFloorVisibility:this.manualFloorVisibility})}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 Bn("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 yc(c instanceof Error?c.message:"Unknown error")})},{signal:this.signal});let i=c=>{let p=c;c.startsWith(mn)&&c.endsWith("-merged")&&(p=c.slice(mn.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 _n(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",Di(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=[],v=[],I=[],E=[];p.labels.forEach(A=>{let j=this.Labels.getById(A.toString());j&&h.push(j.label)}),p.markers.forEach(A=>{let j=this.Markers.getById(A.toString())||this.Navigation.getMarkerById(A.toString());j&&g.push(j.marker)}),p.models.forEach(A=>{let j=this.Models.getById(A.toString());j&&v.push(j.model)}),p.images.forEach(A=>{let j=this.Image3D.getById(A.toString());j&&I.push(j.image)}),p.paths.forEach(A=>{let j=this.Paths.getById(A.toString())||this.Navigation.getPathById(A.toString());j&&!E.includes(j)&&E.push(j)});let O=p.geometry,w;O.length>0&&(w=O.map(A=>this.getMapDataInternal()?.getById("space",A)).filter(Boolean)[0],w||(w=O.map(A=>this.getMapDataInternal()?.getById("object",A)).filter(Boolean)[0]),w||(w=O.map(A=>this.getMapDataInternal()?.getById("area",A)).filter(Boolean)[0]),w||(w=O.map(A=>this.Shapes.getById(A)).filter(Boolean)[0]));let F=p.containers.reduce((A,j)=>{let te=this.getMapDataInternal()?.getById("floor",j);return te&&pt.is(te)&&A.push(te),A},[]),W,N=0;if(F.length>0){W=F[0].id;let A=this.core.getState(W);N=p.coordinate[2]?p.coordinate[2]-A.altitude:N}let B;this.lastFacadeIntersected&&this.lastFacadeIntersected.spaces.forEach(A=>{this.core.setState(A.id,{hovered:!1})}),w&&xe.is(w)&&(B=O.map(A=>this.getMapDataInternal()?.facadesBySpaceId[A]).filter(Boolean)[0],B&&B.spaces.forEach(A=>{this.core.setState(A.id,{hovered:!0})})),this.lastFacadeIntersected=B;let G={coordinate:new z({latitude:p.coordinate[1],longitude:p.coordinate[0],floorId:W,verticalOffset:N}),spaces:w&&xe.is(w)?[w]:[],objects:w&&dt.is(w)?[w]:[],areas:w&&_t.is(w)?[w]:[],shapes:w&&uo.is(w)?[w]:[],markers:g,labels:h,models:v,images:I,paths:E,floors:F,facades:B?[B]:[]};"pointerEvent"in p&&(G.pointerEvent=p.pointerEvent),r.publish(c,G)};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 Gn(l),this.Labels=new kn(l),this.Text3D=new zn(l),this.Exporter=new An(l),this.Paths=new Un(l),this.Navigation=new Dn(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 Vr(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 jn(l),this.Shapes=new Hn(l),this.Style=new Wn(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(Ce);if(a){let s=a.layers.get(Po);s&&this.core.hasState(s)&&this.core.setState(s,bl(fe(yl,t,{warn:!0,disableValidation:r}),this.core.getState(s)))}});return}if(e==="exterior-walls"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(Ce);if(a){let s=a.layers.get(eo);s&&this.core.hasState(s)&&this.core.setState(s,bl(fe(yl,t,{warn:!0,disableValidation:r}),this.core.getState(s)))}});return}if(e==="interior-doors"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(Ce),s=i.layers.get(Er);if(!a)return;let l=a.layers.get(Ir);if(!l||!this.core.hasState(l))return;let c=ll(fe($i,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(Ce),s=i.layers.get(Mr);if(!a)return;let l=a.layers.get(Sr);if(!l||!this.core.hasState(l))return;let c=ll(fe($i,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!==Ct.__type&&!this.core.hasState(n.id)){x.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,Hu(fe(Gu,t,{warn:!0,disableValidation:r}),this.core.getState(n.id)));if(ro.is(n))return this.core.setState(n.id,Xu(fe(Wu,t,{warn:!0,disableValidation:r}),this.core.getState(n.id)));if(xe.is(n)||dt.is(n)){let i=this.core.getState(n.id);i!=null&&this.core.setState(n.id,ju(fe(dl,t,{warn:!0,disableValidation:r}),i))}if(_t.is(n)&&this.core.setState(n.id,fe(dl,t,{warn:!0,disableValidation:r})),bt.is(n)&&this.core.setState(n.id,fe(rf,t,{warn:!0,disableValidation:r})),it.is(n)&&this.core.setState(n.id,fu(fe($i,t,{warn:!0,disableValidation:r}),this.core.getState(n.id))),uo.is(n)){let i=Zu(fe(gl,t,{warn:!0,disableValidation:r}));i.mergedShapeState&&this.core.setState(n.id,i.mergedShapeState)}if(Qo.is(n)){let{position:i,scale:a,rotation:s,...l}=fe(sf,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=fe(Nu,t,{warn:!0,disableValidation:r});this.core.setState(n.id,a);let s=i.layers.get(Ce);if(s!=null&&"geometry"in t&&t.geometry){this.core.setState(s.containerId,fe(Cu,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=fe(Pu,t.labels,{warn:!0,disableValidation:r});"enabled"in E&&typeof E.enabled=="boolean"&&l.setVisible(E.enabled)}let c=i.layers.get(Vt);if(c!=null&&"markers"in t&&t.markers){let E=fe(Ou,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=fe(er,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 O=fe(er,t.footprint,{warn:!0,disableValidation:r});O.color!==void 0&&(E.color=O.color),O.opacity!==void 0&&(E.opacity=O.opacity),O.outline!==void 0&&(E.outline=O.outline)}i.gapFootprintObject.update(E)}let p=i.layers.get(Xo);if(p!=null&&"occlusion"in t&&t.occlusion){let E=fe(Du,t.occlusion,{warn:!0,disableValidation:r});"enabled"in E&&typeof E.enabled=="boolean"&&p.setVisible(E.enabled)}let h=i.layers.get(xr);if(h!=null&&"images"in t&&t.images){let E=fe(wu,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 O of s.layers.values()){let w=this.core.getState(O);if(w?.children)for(let F of w.children)this.core.setState(F,{enableImageCollisions:E.collisionsEnabled})}}let g=i.layers.get(oo);if(g!=null&&"paths"in t&&t.paths!=null){let E=fe(Fu,t.paths,{warn:!0,disableValidation:r});E.visible!=null&&typeof E.visible=="boolean"&&g.setVisible(E.visible)}let v=i.layers.get($o);if(v!=null&&"areas"in t&&t.areas!=null){let E=fe(Au,t.areas,{warn:!0,disableValidation:r});E.visible!=null&&typeof E.visible=="boolean"&&v.setVisible(E.visible)}let I=i.layers.get(jt);if(I!=null&&"models"in t&&t.models!=null){let E=fe(Lu,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=fe(ku,t.text3d,{warn:!0,disableValidation:r}),O=i.layers.get(Zo);O!=null&&E.visible!=null&&O.setVisible(E.visible),E.geometryText?.visible!=null&&i.setGeometryTextBatchVisible(E.geometryText.visible),E.floorText?.visible!=null&&i.setFloorTextBatchVisible(E.floorText.visible)}}if(Ge.is(n)){let i=this.core.getState(n.id);for(let a of i.children)a.type==="group-container"&&this.core.setState(a.id,fe(gu,t,{warn:!0,disableValidation:r}))}if(fo.is(n)&&this.core.setState(n.id,fe(Ku,t,{warn:!0,disableValidation:r})),Ct.is(n)){let i=fe(il,t,{warn:!0,disableValidation:r}),a=Br(i);for(let s of n.segments)this.core.setState(s.id,a)}if(Ao.is(n)){let i=fe(il,t,{warn:!0,disableValidation:r}),a=Br(i);this.core.setState(n.id,a)}}}getMapDataObject(e){return this.getMapDataInternal()?.getMapDataById(e)}update=()=>{this.core.render()};getMapDataInternal(){if(this.mapData)return cn(this.mapData)}getMapData(){return this.mapData}addMap(e,t){return new Promise(r=>{let n;try{n=cn(e)}catch(p){x.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 z(a[1],a[0])});let s=i["manifest.geojson"].features[0].properties.name,l=new Bn(`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=>{let h=Fh(this.getMapDataInternal(),p.floorId,p.previousFloorId);h&&this.externalPubSub.publish("floor-change-start",{reason:p.reason,...h})},{signal:this.signal}),l.on("floor-change",p=>{let h=Fh(this.getMapDataInternal(),p.floorId,p.previousFloorId);h&&this.externalPubSub.publish("floor-change",{reason:p.reason,...h}),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:Ma*this.core.canvasHeight,left:Ma*this.core.canvasWidth,right:Ma*this.core.canvasWidth,bottom:Ma*this.core.canvasHeight};this.Camera.focusOn(this.currentFloor,{duration:wp,screenOffsets:p}).then(()=>{this.Camera.setElevation(this.currentFloor.elevation),r(e)})}else r(e)})}setFloor(e,t){return this.currentMap.setFloor(hn(e),t)}setFloorStack(e,t){return this.currentMap.setFloorStack(hn(e),t)}updateWatermark(e){this.core.updateWatermark(e)}get currentFloorStack(){let e=this.currentMap.currentFloorStack.id;if(!e)throw new De("Missing currentFloorStack.");let t=this.mapData?.getById("floor-stack",e);if(!t)throw new De("FloorStack was not found in map data.");return t}get currentFloor(){let e=this.currentMap.currentFloor.id;if(!e)throw new De("Missing currentFloor object from GeoJsonApi");let t=this.mapData?.getById("floor",e);if(!t)throw new De("Missing currentFloor");return t}getState(e){typeof e=="object"&&Ct.is(e)&&x.warn("Cannot get state of a Path directly. Use getState() on individual segments within Path.segments[] instead.");let t=Vs(e,this),r=this.core.getState(t);if(r){if(["interior-walls","exterior-walls"].includes(e)&&r.type==="feature-collection")return of(r);if(["interior-doors","exterior-doors"].includes(e)&&r.type==="feature-collection"){let n=e==="interior-doors"?Er:Mr,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 uu(r,i)}else{if(r.type==="geometry")return Vu(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 zu(r,this.Markers.getById(r.id.toString())?.marker);if(r.type==="model")return lf(r);if(r.type==="image")return nf(r);if(r.type==="text3d")return ef(r);if(r.type==="feature-collection"&&e&&typeof e!="string"&&uo.is(e))return Yu(r);if(r.type==="path")return cu(r);if(r.type==="group-container"&&typeof e!="string"&&pt.is(e))return Ru(r,this.currentMap.floorsById.get(e.id),this.core);if(r.type==="group-container"&&r.children.length>0&&typeof e!="string"&&Ge.is(e)){let n=this.core.getState(r.children[0].id);return mu(n)}}}}__EXPERIMENTAL__getRenderedState(e){let t=Vs(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 z(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 z(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 Dh(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,markers:this.Navigation.markers}}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){x.error("Cannot compute optimal visual distance between floors. Missing current map.");return}if(e.length<2){x.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){x.warn("Cannot compute optimal visual distance between floors. Floors not found in current map.");return}ja(n,"group-container"),ja(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 Qb(o){if(o===""){Ra(""),Va("");return}Va(`${o}/${wc}`),Ra(`${o}/${Oc}`)}function Fh(o,e,t){let r=o?.getById("floor",t),n=o?.getById("floor",e);return!r||!n?null:{floor:n,previousFloor:r}}f();var xa=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 z({longitude:e[0],latitude:e[1]}),zoomLevel:this.#e.camera.zoomLevel,bearing:t,pitch:this.#e.camera.pitch}}};f();import Xe from"zod";var Ah=Xe.strictObject({environment:Xe.union([Xe.literal("basic"),Xe.literal(!1)]).optional(),text3d:Xe.object({hoverColor:Xe.string().optional()}).optional(),geometry:Xe.object({hoverColor:Xe.string().optional()}).optional(),backgroundColor:Xe.string().optional(),backgroundAlpha:Xe.number().optional(),multiFloorView:Xe.object({spacesOpenToBelowVisualEffectEnabled:Xe.boolean().optional(),spacesOpenToBelowVisualEffectDarkenAmount:Xe.number().min(0).max(1).optional(),spacesOpenToBelowVisualEffectDarkenUseDepth:Xe.boolean().optional(),spacesOpenToBelowVisualEffectDesaturateAmount:Xe.number().min(0).max(1).optional(),spacesOpenToBelowVisualEffectDesaturateUseDepth:Xe.boolean().optional(),spacesOpenToBelowVisualEffectWashOutAmount:Xe.number().min(0).max(1).optional(),spacesOpenToBelowVisualEffectWashOutUseDepth:Xe.boolean().optional()}).optional()});f();var ql=di(ig(),1);f();var ti=null;function kh(){if(ti)return ti;if(typeof OffscreenCanvas<"u")ti=new OffscreenCanvas(1,1).getContext("2d");else if(typeof document<"u"){let o=document.createElement("canvas");o.width=1,o.height=1,ti=o.getContext("2d")}return ti}function $l(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function Yl(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}function Zl(o){let e=kh();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[$l(t/255),$l(r/255),$l(n/255)]}function Lh(o){let e=Math.round(Math.min(1,Math.max(0,Yl(o[0])))*255),t=Math.round(Math.min(1,Math.max(0,Yl(o[1])))*255),r=Math.round(Math.min(1,Math.max(0,Yl(o[2])))*255);return"#"+(1<<24|e<<16|t<<8|r).toString(16).slice(1)}var Kb=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,eT=/^rgba?\(\s*\d+/,tT=/^hsla?\(\s*[\d.]+/;function Jl(o){if(o==null||typeof o!="string")return!1;if(Kb.test(o)||eT.test(o)||tT.test(o))return!0;let e=kh();return e?(e.fillStyle="#000",e.fillStyle=o,e.fillStyle!=="#000000"||o.toLowerCase()==="black"||o==="#000"||o==="#000000"):!1}var oT=(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},Nh=(o,e)=>{let t=oT(o,e),r=(0,ql.default)({},t,e),n=(0,ql.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(Jl(h)&&Jl(g)){let v=Zl(h),I=Zl(g);v&&I?c[p]=Lh([v[0]+(I[0]-v[0])*l,v[1]+(I[1]-v[1])*l,v[2]+(I[2]-v[2])*l]):x.warn(`Color "${p}" could not be animated!`)}}else typeof g=="object"&&g!==null&&typeof h=="object"&&h!==null?i(h,g,l,c[p]):x.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 rT(o){return o.getContext("webgl2")||o.getContext("webgl")}function Ql(o){let e=rT(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 Rh(o,e=1e3){let t=null,r=new Promise(a=>{t=()=>{let s=o.getCanvas();a(s?Ql(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 Kl(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 x.warn(n),null}}var oi=class{#e;#t;#o;Camera;Labels;Text3D;Markers;Image3D;Models;Paths;Exporter;Navigation;Style;Shapes;Outdoor;constructor(e){this.#e=new gt,this.#o=e;let t=new ei(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 xa(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 x.warn(`Cannot animate state of ${e}.`),new Promise(c=>c({result:"completed"}));let i=Nh(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 ur&&a.easing(ur[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{Ah.parse(e)}catch(t){x.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 kp(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 De("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 z(e):new z(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-LHEBDO45.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 Rh(n);h&&c.drawImage(h,0,0,l.width,l.height)}await this.#o.renderSync();let p=Ql(r);if(p&&c.drawImage(p,0,0,l.width,l.height),t.withLabels){let h=this.#o.labelsCanvas;if(h){let g=Kl(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 v=h.children[g],I=v.classList.contains("mappedin-2d-entities");if(!(v.tagName==="CANVAS"||v.offsetWidth===0||v.offsetHeight===0||!I))try{let E=await t.captureMarkers(v),O=Kl(E,"overlay");O&&O.width>0&&O.height>0&&c.drawImage(O,0,0,l.width,l.height)}catch(E){x.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 De(E)}let I=h instanceof Error?`Screenshot failed: ${h.message}`:"Screenshot failed due to an unknown error.";throw new De(I)}}finally{i&&this.Outdoor.show(),a&&this.Outdoor.hide(s)}}get manualFloorVisibility(){return this.#t.manualFloorVisibility}set manualFloorVisibility(e){this.#t.manualFloorVisibility=e}__EXPERIMENTAL__overrideSetFloorHandler(e){this.#t.__EXPERIMENTAL__overrideSetFloorHandler(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){x.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 nT=1e3*60*60*2,$r=class{#e=new gt;#t;#o;#r;#n;#i;#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.#i?.token;this.#i=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.#i=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.#i!=null&&this.#i.expires!=null&&this.#i.expires>Date.now()&&!e?this.#i:(this.#r=pn({...this.#o,key:this.#o.key,secret:this.#o.secret},this.#o.enterprise??!1,e).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.#n!=null?this.#n:this.#s!=null&&this.#s.expires>Date.now()&&!e?this.#s:(this.#n=new Promise((t,r)=>{this.#u().then(n=>{let i={},a=this.#t.map(s=>Xa({...this.#o,mapId:s},n.token).then(l=>{i[s]={token:l.token,expires:l.expires}}).catch(l=>{x.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.#n.catch(t=>{throw t}).finally(()=>{this.#n=void 0}),this.#n)}#p(e){if(!("key"in this.#o)||!("secret"in this.#o))return;let t=e.expires!=null?e.expires-Date.now():nT;isFinite(t)&&(this.#c=setTimeout(()=>{this.#u(!0).then(r=>{this.#p(r)})},t-ap))}#m(e){let t=e.expires-Date.now();isFinite(t)&&(this.#a=setTimeout(()=>{this.#f(!0).then(r=>{this.#m(r)})},t-pp))}#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)){x.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),on()&&globalThis.addEventListener?.("focus",this.#l)}async refreshing(){let e=[];return this.#r!=null&&e.push(this.#r),this.#n!=null&&e.push(this.#n),Promise.all(e)}getAccessTokenAsync(e=!1){return this.#u(e)}getSasTokensAsync(){return this.#f()}getAccessToken(){return this.#i==null?(x.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):this.#i}getSasToken(e){return this.isEnterpriseMode()?(x.error("SAS tokens are not available in the enterprise mode!"),{token:""}):this.#s==null?(x.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):e in this.#s.tokens?this.#s.tokens[e]:(x.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(),on()&&globalThis.removeEventListener("focus",this.#l)}};f();var iT=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=xo();a.updateByUserOption(r);let s={};if("type"in o&&typeof o.type=="string"){if(o.type==="binary"&&o.main instanceof Uint8Array){let F=await Si(o.main,r.mvfVersion);n=F.mvf2,i=F.mvf3,s.languagePacks=[];for(let W of o.languagePacks??[])W.localePack instanceof Uint8Array&&s.languagePacks.push({language:W.language,localePack:await br(W.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 w=i!=null?Ii(i):n.enterprise!=null;o.options?.enterprise!==void 0&&(w?x.warn('The "enterprise" option in hydrateMapData is deprecated and ignored. Enterprise mode is now automatically detected from the MVF data.'):x.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=w||(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&&sp(r.key)&&(s.enterprise=!1),a.setEnterprise(s.enterprise??!1);let p=vi(n),h=p.length>0?p:[r.mapId];r.baseAuthUri=a.getBaseAuthUri();let g=new $r(h,{...r,enterprise:s.enterprise}),v;if(c)v=r.accessToken;else if(l){let w;try{w=await g.getAccessTokenAsync()}catch(F){x.error("Failed getting token during hydrateMapData",F)}v=w?.token||""}if(s.outdoorViewToken=v,s.env=a,s.getMapDataOptions=r,s.tokenManager=g,r.prefetchTokens&&(l||c))try{await g.readySync()}catch(w){x.error("Failed to ready token manager!",w)}xn()&&(s.enterprise&&x.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),r.mvfVersion!=="3.0.0"&&x.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let I=new qo(n,s);v&&I.Analytics.init({accessToken:v,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 ln(I),O=I.findPreferredLanguage({languageCode:r.language,fallbackToNavigatorLanguage:!1});if(O)try{await E.changeLanguage(O.code)}catch{}return typeof e?.onMVFParsed=="function"&&e.onMVFParsed(n),E};var Bh=`:root {
297
+ </svg>`},zb=/<svg([^>]*)>/g;function Mh(o,e,t){let r=Wb[o];return r?r.replace(zb,`<svg$1 xmlns="http://www.w3.org/2000/svg" style="fill:${e}; width:${t}px; height:${t}px">`):null}function Xb(o){return Eh.sanitize(o,{USE_PROFILES:{svg:!0}})}function $b(o,e){let n=new DOMParser().parseFromString(o,"image/svg+xml").documentElement;return n==null||n.tagName==="parsererror"||n.tagName.toLowerCase()!=="svg"?(x.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 xh(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 mt()(o),n=r.headers.get("content-type");if(n?.includes("image/svg+xml")){let i=await r.text();return t=Xb(i),e?.color!=null&&(t=$b(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 x.error(`Failed to fetch icon from ${o}.`,r),null}}f();function _h(o){return o.locationProfiles.some(e=>e.categories.some(t=>t.name.includes("Restroom")))}function Ch(o){return o.locationProfiles.some(e=>e.categories.some(t=>t.name.includes("Parking")))}var Oh=new Set(["connection","point-of-interest","space","object","door","facade"]),nr={default:"#3D5676",connection:"#128387",washroom:"#3161B4",point:"#AD468F",parking:"#418425",door:"#A0552C"},Xr={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 Yb(o){let e=null;if(Ze.is(o))switch(o.type){case"elevator":e=Xr.elevator;break;case"ladder":e=Xr.ladder;break;case"escalator":case"stairs":default:e=Xr.stairs}else Tt.is(o)?e=Xr.point:it.is(o)?e=Xr.door:Ge.is(o)&&(e=Xr.building);return e!=null?Mh(e,"#FFFFFF",12):null}function Ph(o){return Ze.is(o)?nr.connection:Ge.is(o)?nr.default:_h(o)?nr.washroom:Ch(o)?nr.parking:Tt.is(o)?nr.point:it.is(o)?nr.door:nr.default}async function Zb(o,e){let t=null,r="locationProfiles"in o?o.locationProfiles.find(n=>n.icon!=null)?.icon:null;if(r?.url!=null&&(t=await xh(r.url,{color:e.color,style:"fill"})),t==null){let n=Yb(o);n!=null&&(t={icon:n,type:"svg"})}return t}function Jb(o){return Ze.is(o)||it.is(o)?"low":Tt.is(o)||Ge.is(o)?"high":"medium"}async function qb(o){let e={appearance:{color:Ph(o),pinOutlineColor:Ph(o),iconPadding:8,iconSize:24,textSize:12.5,iconScale:{on:"zoom-level",input:[18,20],output:[.7,1]}},rank:Jb(o),interactive:!0},t=await Zb(o,{color:"#FFFFFF"});return t!=null&&(e.appearance.icon=t.icon,t.type==="svg"?Ge.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 wh(o,e){return(await Promise.all(e.map(async r=>{let n=[];if(!lo(r))return n;let i=await qb(r);return Ze.is(r)?n=r.coordinates.map(a=>o.Labels.add(a,r.name,i)):Ge.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)):nh(r)&&fs(r)&&n.push(o.Labels.add(r,r.name,i)),n}))).flat()}async function Dh(o,e){let t=o.getMapDataInternal();if(!t)throw new Error("Map data not found");let r=t.getAllOfTypes(Oh,e),n=t.getAllOfTypes(eh,e),i=t.getAllOfTypes(oh,e),[a,s]=await Promise.all([r.length>0?wh(o,r):[],n.length>0?th(o,n):[],i.length>0?rh(o,i):[]]);return{labels:a,markers:s}}f();f();var Xl=(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)};var Ma=.05,ei=class extends gt{core;mapObjects=[];id;mapDataExternal={};mapsByFloorId={};mapData;currentMap;hiddenOutdoorGeometries=[];lastFacadeIntersected;#e;#t=!1;mapView;externalPubSub;get __EXPERIMENTAL__floorHandler(){return this.#e}__EXPERIMENTAL__overrideSetFloorHandler(e){e&&this.#e&&this.#e!==yi&&x.warn("overwriting an existing setFloor override handler"),this.#o(e)}get manualFloorVisibility(){return this.#e!==void 0}set manualFloorVisibility(e){let t=this.#e;t&&t!==yi&&e&&x.warn("manualFloorVisibility true overwriting an existing setFloor handler to noop"),this.#o(e?yi:void 0)}#o(e){let t=this.manualFloorVisibility;this.#e=e,this.manualFloorVisibility!==t&&this.externalPubSub.publish("state-change-internal",{manualFloorVisibility:this.manualFloorVisibility})}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 Bn("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 yc(c instanceof Error?c.message:"Unknown error")})},{signal:this.signal});let i=c=>{let p=c;c.startsWith(mn)&&c.endsWith("-merged")&&(p=c.slice(mn.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 _n(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",Di(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=[],v=[],I=[],E=[];p.labels.forEach(A=>{let j=this.Labels.getById(A.toString());j&&h.push(j.label)}),p.markers.forEach(A=>{let j=this.Markers.getById(A.toString())||this.Navigation.getMarkerById(A.toString());j&&g.push(j.marker)}),p.models.forEach(A=>{let j=this.Models.getById(A.toString());j&&v.push(j.model)}),p.images.forEach(A=>{let j=this.Image3D.getById(A.toString());j&&I.push(j.image)}),p.paths.forEach(A=>{let j=this.Paths.getById(A.toString())||this.Navigation.getPathById(A.toString());j&&!E.includes(j)&&E.push(j)});let O=p.geometry,w;O.length>0&&(w=O.map(A=>this.getMapDataInternal()?.getById("space",A)).filter(Boolean)[0],w||(w=O.map(A=>this.getMapDataInternal()?.getById("object",A)).filter(Boolean)[0]),w||(w=O.map(A=>this.getMapDataInternal()?.getById("area",A)).filter(Boolean)[0]),w||(w=O.map(A=>this.Shapes.getById(A)).filter(Boolean)[0]));let F=p.containers.reduce((A,j)=>{let te=this.getMapDataInternal()?.getById("floor",j);return te&&pt.is(te)&&A.push(te),A},[]),W,N=0;if(F.length>0){W=F[0].id;let A=this.core.getState(W);N=p.coordinate[2]?p.coordinate[2]-A.altitude:N}let B;this.lastFacadeIntersected&&this.lastFacadeIntersected.spaces.forEach(A=>{this.core.setState(A.id,{hovered:!1})}),w&&xe.is(w)&&(B=O.map(A=>this.getMapDataInternal()?.facadesBySpaceId[A]).filter(Boolean)[0],B&&B.spaces.forEach(A=>{this.core.setState(A.id,{hovered:!0})})),this.lastFacadeIntersected=B;let G={coordinate:new z({latitude:p.coordinate[1],longitude:p.coordinate[0],floorId:W,verticalOffset:N}),spaces:w&&xe.is(w)?[w]:[],objects:w&&dt.is(w)?[w]:[],areas:w&&_t.is(w)?[w]:[],shapes:w&&uo.is(w)?[w]:[],markers:g,labels:h,models:v,images:I,paths:E,floors:F,facades:B?[B]:[]};"pointerEvent"in p&&(G.pointerEvent=p.pointerEvent),r.publish(c,G)};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 Gn(l),this.Labels=new kn(l),this.Text3D=new zn(l),this.Exporter=new An(l),this.Paths=new Un(l),this.Navigation=new Dn(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 Vr(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 jn(l),this.Shapes=new Hn(l),this.Style=new Wn(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(Ce);if(a){let s=a.layers.get(Po);s&&this.core.hasState(s)&&this.core.setState(s,bl(fe(yl,t,{warn:!0,disableValidation:r}),this.core.getState(s)))}});return}if(e==="exterior-walls"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(Ce);if(a){let s=a.layers.get(eo);s&&this.core.hasState(s)&&this.core.setState(s,bl(fe(yl,t,{warn:!0,disableValidation:r}),this.core.getState(s)))}});return}if(e==="interior-doors"){this.currentMap.floors.forEach(i=>{let a=i.layers.get(Ce),s=i.layers.get(Er);if(!a)return;let l=a.layers.get(Ir);if(!l||!this.core.hasState(l))return;let c=ll(fe($i,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(Ce),s=i.layers.get(Mr);if(!a)return;let l=a.layers.get(Sr);if(!l||!this.core.hasState(l))return;let c=ll(fe($i,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!==Ct.__type&&!this.core.hasState(n.id)){x.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,Hu(fe(Gu,t,{warn:!0,disableValidation:r}),this.core.getState(n.id)));if(ro.is(n))return this.core.setState(n.id,Xu(fe(Wu,t,{warn:!0,disableValidation:r}),this.core.getState(n.id)));if(xe.is(n)||dt.is(n)){let i=this.core.getState(n.id);i!=null&&this.core.setState(n.id,ju(fe(dl,t,{warn:!0,disableValidation:r}),i))}if(_t.is(n)&&this.core.setState(n.id,fe(dl,t,{warn:!0,disableValidation:r})),bt.is(n)&&this.core.setState(n.id,fe(rf,t,{warn:!0,disableValidation:r})),it.is(n)&&this.core.setState(n.id,fu(fe($i,t,{warn:!0,disableValidation:r}),this.core.getState(n.id))),uo.is(n)){let i=Zu(fe(gl,t,{warn:!0,disableValidation:r}));i.mergedShapeState&&this.core.setState(n.id,i.mergedShapeState)}if(Qo.is(n)){let{position:i,scale:a,rotation:s,...l}=fe(sf,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=fe(Nu,t,{warn:!0,disableValidation:r});this.core.setState(n.id,a);let s=i.layers.get(Ce);if(s!=null&&"geometry"in t&&t.geometry){this.core.setState(s.containerId,fe(Cu,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=fe(Pu,t.labels,{warn:!0,disableValidation:r});"enabled"in E&&typeof E.enabled=="boolean"&&l.setVisible(E.enabled)}let c=i.layers.get(Vt);if(c!=null&&"markers"in t&&t.markers){let E=fe(Ou,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=fe(er,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 O=fe(er,t.footprint,{warn:!0,disableValidation:r});O.color!==void 0&&(E.color=O.color),O.opacity!==void 0&&(E.opacity=O.opacity),O.outline!==void 0&&(E.outline=O.outline)}i.gapFootprintObject.update(E)}let p=i.layers.get(Xo);if(p!=null&&"occlusion"in t&&t.occlusion){let E=fe(Du,t.occlusion,{warn:!0,disableValidation:r});"enabled"in E&&typeof E.enabled=="boolean"&&p.setVisible(E.enabled)}let h=i.layers.get(xr);if(h!=null&&"images"in t&&t.images){let E=fe(wu,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 O of s.layers.values()){let w=this.core.getState(O);if(w?.children)for(let F of w.children)this.core.setState(F,{enableImageCollisions:E.collisionsEnabled})}}let g=i.layers.get(oo);if(g!=null&&"paths"in t&&t.paths!=null){let E=fe(Fu,t.paths,{warn:!0,disableValidation:r});E.visible!=null&&typeof E.visible=="boolean"&&g.setVisible(E.visible)}let v=i.layers.get($o);if(v!=null&&"areas"in t&&t.areas!=null){let E=fe(Au,t.areas,{warn:!0,disableValidation:r});E.visible!=null&&typeof E.visible=="boolean"&&v.setVisible(E.visible)}let I=i.layers.get(jt);if(I!=null&&"models"in t&&t.models!=null){let E=fe(Lu,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=fe(ku,t.text3d,{warn:!0,disableValidation:r}),O=i.layers.get(Zo);O!=null&&E.visible!=null&&O.setVisible(E.visible),E.geometryText?.visible!=null&&i.setGeometryTextBatchVisible(E.geometryText.visible),E.floorText?.visible!=null&&i.setFloorTextBatchVisible(E.floorText.visible)}}if(Ge.is(n)){let i=this.core.getState(n.id);for(let a of i.children)a.type==="group-container"&&this.core.setState(a.id,fe(gu,t,{warn:!0,disableValidation:r}))}if(fo.is(n)&&this.core.setState(n.id,fe(Ku,t,{warn:!0,disableValidation:r})),Ct.is(n)){let i=fe(il,t,{warn:!0,disableValidation:r}),a=Br(i);for(let s of n.segments)this.core.setState(s.id,a)}if(Ao.is(n)){let i=fe(il,t,{warn:!0,disableValidation:r}),a=Br(i);this.core.setState(n.id,a)}}}getMapDataObject(e){return this.getMapDataInternal()?.getMapDataById(e)}update=()=>{this.core.render()};getMapDataInternal(){if(this.mapData)return cn(this.mapData)}getMapData(){return this.mapData}addMap(e,t){return new Promise(r=>{let n;try{n=cn(e)}catch(p){x.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 z(a[1],a[0])});let s=i["manifest.geojson"].features[0].properties.name,l=new Bn(`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=>{let h=Fh(this.getMapDataInternal(),p.floorId,p.previousFloorId);h&&this.externalPubSub.publish("floor-change-start",{reason:p.reason,...h})},{signal:this.signal}),l.on("floor-change",p=>{let h=Fh(this.getMapDataInternal(),p.floorId,p.previousFloorId);h&&this.externalPubSub.publish("floor-change",{reason:p.reason,...h}),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:Ma*this.core.canvasHeight,left:Ma*this.core.canvasWidth,right:Ma*this.core.canvasWidth,bottom:Ma*this.core.canvasHeight};this.Camera.focusOn(this.currentFloor,{duration:wp,screenOffsets:p}).then(()=>{this.Camera.setElevation(this.currentFloor.elevation),r(e)})}else r(e)})}setFloor(e,t){return this.currentMap.setFloor(hn(e),t)}setFloorStack(e,t){return this.currentMap.setFloorStack(hn(e),t)}updateWatermark(e){this.core.updateWatermark(e)}get currentFloorStack(){let e=this.currentMap.currentFloorStack.id;if(!e)throw new De("Missing currentFloorStack.");let t=this.mapData?.getById("floor-stack",e);if(!t)throw new De("FloorStack was not found in map data.");return t}get currentFloor(){let e=this.currentMap.currentFloor.id;if(!e)throw new De("Missing currentFloor object from GeoJsonApi");let t=this.mapData?.getById("floor",e);if(!t)throw new De("Missing currentFloor");return t}getState(e){typeof e=="object"&&Ct.is(e)&&x.warn("Cannot get state of a Path directly. Use getState() on individual segments within Path.segments[] instead.");let t=Vs(e,this),r=this.core.getState(t);if(r){if(["interior-walls","exterior-walls"].includes(e)&&r.type==="feature-collection")return of(r);if(["interior-doors","exterior-doors"].includes(e)&&r.type==="feature-collection"){let n=e==="interior-doors"?Er:Mr,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 uu(r,i)}else{if(r.type==="geometry")return Vu(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 zu(r,this.Markers.getById(r.id.toString())?.marker);if(r.type==="model")return lf(r);if(r.type==="image")return nf(r);if(r.type==="text3d")return ef(r);if(r.type==="feature-collection"&&e&&typeof e!="string"&&uo.is(e))return Yu(r);if(r.type==="path")return cu(r);if(r.type==="group-container"&&typeof e!="string"&&pt.is(e))return Ru(r,this.currentMap.floorsById.get(e.id),this.core);if(r.type==="group-container"&&r.children.length>0&&typeof e!="string"&&Ge.is(e)){let n=this.core.getState(r.children[0].id);return mu(n)}}}}__EXPERIMENTAL__getRenderedState(e){let t=Vs(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 z(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 z(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 Dh(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,markers:this.Navigation.markers}}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){x.error("Cannot compute optimal visual distance between floors. Missing current map.");return}if(e.length<2){x.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){x.warn("Cannot compute optimal visual distance between floors. Floors not found in current map.");return}ja(n,"group-container"),ja(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 Qb(o){if(o===""){Ra(""),Va("");return}Va(`${o}/${wc}`),Ra(`${o}/${Oc}`)}function Fh(o,e,t){let r=o?.getById("floor",t),n=o?.getById("floor",e);return!r||!n?null:{floor:n,previousFloor:r}}f();var xa=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 z({longitude:e[0],latitude:e[1]}),zoomLevel:this.#e.camera.zoomLevel,bearing:t,pitch:this.#e.camera.pitch}}};f();import Xe from"zod";var Ah=Xe.strictObject({environment:Xe.union([Xe.literal("basic"),Xe.literal(!1)]).optional(),text3d:Xe.object({hoverColor:Xe.string().optional()}).optional(),geometry:Xe.object({hoverColor:Xe.string().optional()}).optional(),backgroundColor:Xe.string().optional(),backgroundAlpha:Xe.number().optional(),multiFloorView:Xe.object({spacesOpenToBelowVisualEffectEnabled:Xe.boolean().optional(),spacesOpenToBelowVisualEffectDarkenAmount:Xe.number().min(0).max(1).optional(),spacesOpenToBelowVisualEffectDarkenUseDepth:Xe.boolean().optional(),spacesOpenToBelowVisualEffectDesaturateAmount:Xe.number().min(0).max(1).optional(),spacesOpenToBelowVisualEffectDesaturateUseDepth:Xe.boolean().optional(),spacesOpenToBelowVisualEffectWashOutAmount:Xe.number().min(0).max(1).optional(),spacesOpenToBelowVisualEffectWashOutUseDepth:Xe.boolean().optional()}).optional()});f();var ql=di(ig(),1);f();var ti=null;function kh(){if(ti)return ti;if(typeof OffscreenCanvas<"u")ti=new OffscreenCanvas(1,1).getContext("2d");else if(typeof document<"u"){let o=document.createElement("canvas");o.width=1,o.height=1,ti=o.getContext("2d")}return ti}function $l(o){return o<.04045?o*.0773993808:Math.pow(o*.9478672986+.0521327014,2.4)}function Yl(o){return o<.0031308?o*12.92:1.055*Math.pow(o,.41666)-.055}function Zl(o){let e=kh();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[$l(t/255),$l(r/255),$l(n/255)]}function Lh(o){let e=Math.round(Math.min(1,Math.max(0,Yl(o[0])))*255),t=Math.round(Math.min(1,Math.max(0,Yl(o[1])))*255),r=Math.round(Math.min(1,Math.max(0,Yl(o[2])))*255);return"#"+(1<<24|e<<16|t<<8|r).toString(16).slice(1)}var Kb=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,eT=/^rgba?\(\s*\d+/,tT=/^hsla?\(\s*[\d.]+/;function Jl(o){if(o==null||typeof o!="string")return!1;if(Kb.test(o)||eT.test(o)||tT.test(o))return!0;let e=kh();return e?(e.fillStyle="#000",e.fillStyle=o,e.fillStyle!=="#000000"||o.toLowerCase()==="black"||o==="#000"||o==="#000000"):!1}var oT=(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},Nh=(o,e)=>{let t=oT(o,e),r=(0,ql.default)({},t,e),n=(0,ql.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(Jl(h)&&Jl(g)){let v=Zl(h),I=Zl(g);v&&I?c[p]=Lh([v[0]+(I[0]-v[0])*l,v[1]+(I[1]-v[1])*l,v[2]+(I[2]-v[2])*l]):x.warn(`Color "${p}" could not be animated!`)}}else typeof g=="object"&&g!==null&&typeof h=="object"&&h!==null?i(h,g,l,c[p]):x.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 rT(o){return o.getContext("webgl2")||o.getContext("webgl")}function Ql(o){let e=rT(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 Rh(o,e=1e3){let t=null,r=new Promise(a=>{t=()=>{let s=o.getCanvas();a(s?Ql(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 Kl(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 x.warn(n),null}}var oi=class{#e;#t;#o;Camera;Labels;Text3D;Markers;Image3D;Models;Paths;Exporter;Navigation;Style;Shapes;Outdoor;constructor(e){this.#e=new gt,this.#o=e;let t=new ei(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 xa(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 x.warn(`Cannot animate state of ${e}.`),new Promise(c=>c({result:"completed"}));let i=Nh(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 ur&&a.easing(ur[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{Ah.parse(e)}catch(t){x.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 kp(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 De("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 z(e):new z(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-XIQ7ZRNS.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 Rh(n);h&&c.drawImage(h,0,0,l.width,l.height)}await this.#o.renderSync();let p=Ql(r);if(p&&c.drawImage(p,0,0,l.width,l.height),t.withLabels){let h=this.#o.labelsCanvas;if(h){let g=Kl(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 v=h.children[g],I=v.classList.contains("mappedin-2d-entities");if(!(v.tagName==="CANVAS"||v.offsetWidth===0||v.offsetHeight===0||!I))try{let E=await t.captureMarkers(v),O=Kl(E,"overlay");O&&O.width>0&&O.height>0&&c.drawImage(O,0,0,l.width,l.height)}catch(E){x.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 De(E)}let I=h instanceof Error?`Screenshot failed: ${h.message}`:"Screenshot failed due to an unknown error.";throw new De(I)}}finally{i&&this.Outdoor.show(),a&&this.Outdoor.hide(s)}}get manualFloorVisibility(){return this.#t.manualFloorVisibility}set manualFloorVisibility(e){this.#t.manualFloorVisibility=e}__EXPERIMENTAL__overrideSetFloorHandler(e){this.#t.__EXPERIMENTAL__overrideSetFloorHandler(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){x.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 nT=1e3*60*60*2,$r=class{#e=new gt;#t;#o;#r;#n;#i;#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.#i?.token;this.#i=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.#i=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.#i!=null&&this.#i.expires!=null&&this.#i.expires>Date.now()&&!e?this.#i:(this.#r=pn({...this.#o,key:this.#o.key,secret:this.#o.secret},this.#o.enterprise??!1,e).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.#n!=null?this.#n:this.#s!=null&&this.#s.expires>Date.now()&&!e?this.#s:(this.#n=new Promise((t,r)=>{this.#u().then(n=>{let i={},a=this.#t.map(s=>Xa({...this.#o,mapId:s},n.token).then(l=>{i[s]={token:l.token,expires:l.expires}}).catch(l=>{x.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.#n.catch(t=>{throw t}).finally(()=>{this.#n=void 0}),this.#n)}#p(e){if(!("key"in this.#o)||!("secret"in this.#o))return;let t=e.expires!=null?e.expires-Date.now():nT;isFinite(t)&&(this.#c=setTimeout(()=>{this.#u(!0).then(r=>{this.#p(r)})},t-ap))}#m(e){let t=e.expires-Date.now();isFinite(t)&&(this.#a=setTimeout(()=>{this.#f(!0).then(r=>{this.#m(r)})},t-pp))}#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)){x.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),on()&&globalThis.addEventListener?.("focus",this.#l)}async refreshing(){let e=[];return this.#r!=null&&e.push(this.#r),this.#n!=null&&e.push(this.#n),Promise.all(e)}getAccessTokenAsync(e=!1){return this.#u(e)}getSasTokensAsync(){return this.#f()}getAccessToken(){return this.#i==null?(x.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):this.#i}getSasToken(e){return this.isEnterpriseMode()?(x.error("SAS tokens are not available in the enterprise mode!"),{token:""}):this.#s==null?(x.error("Tokens must be loaded before reading synchronously! Try awaiting readySync() first."),{token:""}):e in this.#s.tokens?this.#s.tokens[e]:(x.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(),on()&&globalThis.removeEventListener("focus",this.#l)}};f();var iT=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=xo();a.updateByUserOption(r);let s={};if("type"in o&&typeof o.type=="string"){if(o.type==="binary"&&o.main instanceof Uint8Array){let F=await Si(o.main,r.mvfVersion);n=F.mvf2,i=F.mvf3,s.languagePacks=[];for(let W of o.languagePacks??[])W.localePack instanceof Uint8Array&&s.languagePacks.push({language:W.language,localePack:await br(W.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 w=i!=null?Ii(i):n.enterprise!=null;o.options?.enterprise!==void 0&&(w?x.warn('The "enterprise" option in hydrateMapData is deprecated and ignored. Enterprise mode is now automatically detected from the MVF data.'):x.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=w||(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&&sp(r.key)&&(s.enterprise=!1),a.setEnterprise(s.enterprise??!1);let p=vi(n),h=p.length>0?p:[r.mapId];r.baseAuthUri=a.getBaseAuthUri();let g=new $r(h,{...r,enterprise:s.enterprise}),v;if(c)v=r.accessToken;else if(l){let w;try{w=await g.getAccessTokenAsync()}catch(F){x.error("Failed getting token during hydrateMapData",F)}v=w?.token||""}if(s.outdoorViewToken=v,s.env=a,s.getMapDataOptions=r,s.tokenManager=g,r.prefetchTokens&&(l||c))try{await g.readySync()}catch(w){x.error("Failed to ready token manager!",w)}xn()&&(s.enterprise&&x.warn("forceEnterpriseLocations is enabled, but the map is already an enterprise map!"),r.mvfVersion!=="3.0.0"&&x.warn("mvfVersion must be '3.0.0' when forceEnterpriseLocations is enabled!"));let I=new qo(n,s);v&&I.Analytics.init({accessToken:v,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 ln(I),O=I.findPreferredLanguage({languageCode:r.language,fallbackToNavigatorLanguage:!1});if(O)try{await E.changeLanguage(O.code)}catch{}return typeof e?.onMVFParsed=="function"&&e.onMVFParsed(n),E};var Bh=`:root {
298
298
  --pin-shadow-hover-scale: 0.9;
299
299
  --pin-shadow-width: 12px;
300
300
  --pin-shadow-height: 5px;