@mappedin/mappedin-js 6.21.0 → 6.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/esm/{GLTFExporter-TPBX6R3U.js → GLTFExporter-V762TD2A.js} +1 -1
- package/lib/esm/{GLTFLoader-MAX3PCDM.js → GLTFLoader-HBT4C4QX.js} +1 -1
- package/lib/esm/{chunk-S3S2TZVB.js → chunk-23SDKQLF.js} +55 -55
- package/lib/esm/{chunk-3IQDSCDT.js → chunk-73NFNZ3A.js} +1 -1
- package/lib/esm/{chunk-LJC6K2N5.js → chunk-B5PVUD5J.js} +12 -12
- package/lib/esm/{chunk-F4OI5ZPF.js → chunk-DEPTGCUS.js} +1 -1
- package/lib/esm/{chunk-VJT5KQYB.js → chunk-HQ5BIBGU.js} +3 -3
- package/lib/esm/index.d.ts +12 -3
- package/lib/esm/index.js +1 -1
- package/lib/esm/{inspector-2HI72MBL.js → inspector-FCMDYYIP.js} +2 -2
- package/lib/esm/{internal-I5R5O5YO.js → internal-GPY5MCOX.js} +1 -1
- package/lib/esm/{src-5XG5YVCF.js → src-QYUMVA7Q.js} +1 -1
- package/lib/esm/{text3d-ZRFQLWHM.js → text3d-TJVE4VTW.js} +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{$ as pc,$a as _c,$b as Ys,Aa as Nr,Ab as Xc,Ac as Ce,Ba as Do,Bb as Yc,Bc as ie,C as Os,Ca as hn,Cb as $c,D as kl,Db as pr,E as fo,Ea as ue,Eb as No,F as sr,Fa as Oe,Fb as Le,G as At,Ga as qe,Gb as qc,H as Ls,Ha as ks,Hb as Jc,Ia as Mt,Ib as Kc,Ja as Po,Jb as Hs,Ka as Io,Kb as Qc,La as Oo,Lb as Ws,M as ar,Ma as Ec,Mb as Vs,N as As,Na as wc,Nb as Bo,O as zl,Oa as hr,Ob as eu,Pa as Tc,Pb as tu,Qa as Br,Qb as js,Ra as Dc,Rb as ru,Sb as nu,Ta as Pc,Tb as ou,U as Rs,Ua as Lo,Ub as Zs,Va as Ic,Vb as iu,W as _s,Wa as Oc,Wb as mr,Xa as Lc,Xb as Go,Ya as Ac,Yb as Xs,Z as Ul,Za as zs,Zb as su,_a as Rc,_b as au,aa as mc,ab as Gr,ac as lu,b as Fl,bb as Fc,bc as gn,ca as dn,cb as Ao,cc as $s,d as _,da as fc,db as Us,dc as ko,e as Dr,eb as Nc,ec as cu,f as on,fb as Ro,fc as qs,g as Pr,gb as pn,gc as uu,h as co,hb as Ct,hc as du,i as Z,ia as Eo,ib as _o,ic as hu,j as Ts,jb as Ut,jc as pu,k as uo,kb as Ht,l as ho,la as wo,lb as Bc,lc as mu,m as po,ma as zt,mc as fu,n as ir,na as gc,nc as gu,o as Nl,oa as yc,ob as Gc,oc as yu,p as Bl,pa as bc,pb as Fo,pc as bu,qa as vc,qb as kc,qc as lt,r as Gl,ra as xc,rb as mn,rc as vu,s as Ds,sa as Sc,sb as zc,sc as ve,t as mo,ta as To,tb as Uc,tc as xu,ua as Mc,ub as fn,uc as zo,v as Ps,va as Cc,vb as Hc,vc as ct,w as Lt,wa as Bs,wb as Wc,wc as Su,xa as Gs,xb as Vc,xc as Wt,y as Is,ya as He,yb as jc,yc as kr,z as vt,za as $,zb as Zc,zc as oe}from"./chunk-S3S2TZVB.js";import{a as ze}from"./chunk-F4OI5ZPF.js";import{$ as xt,A as Yl,Aa as Lr,C as lr,Ca as Bt,E as $l,F as le,G as ln,H as cr,Ha as rc,I as bo,Ia as nc,J as ur,Ja as So,K as Ir,Ka as oc,La as ic,M as ql,Ma as Ar,N as U,Na as Rr,O as W,Oa as _r,P as _t,Pa as Ie,Q as O,Qa as Fr,Ra as sc,Sa as un,Ua as Gt,Va as ac,W as Jl,X as cn,Y as ce,Z as Kl,_ as Y,a as f,aa as Ge,b as E,ba as k,c as go,ca as Ql,cb as Mo,d as yo,da as Me,e as Hl,ea as ke,f as Rt,fa as dr,fb as Ns,g as Wl,ga as Ft,gb as Co,h as Vl,ha as V,hb as lc,i as sn,ia as Nt,ka as $e,la as ec,lb as cc,ma as Fs,na as vo,nb as kt,o as an,oa as St,pb as uc,qb as dc,r as jl,s as Zl,sb as hc,u as Xl,wa as K,xa as tc,ya as Or,za as xo}from"./chunk-3IQDSCDT.js";import{b as at,c as Bp,d as lo}from"./chunk-PWEV3AFA.js";var Od=at((La,Aa)=>{f();(function(n,e){typeof La=="object"&&typeof Aa<"u"?Aa.exports=e():typeof define=="function"&&define.amd?define(e):(n=n||self).RBush=e()})(La,function(){"use strict";function n(m,p,y,v,x){(function S(w,D,C,T,P){for(;T>C;){if(T-C>600){var I=T-C+1,L=D-C+1,N=Math.log(I),z=.5*Math.exp(2*N/3),j=.5*Math.sqrt(N*z*(I-z)/I)*(L-I/2<0?-1:1),H=Math.max(C,Math.floor(D-L*z/I+j)),Q=Math.min(T,Math.floor(D+(I-L)*z/I+j));S(w,D,H,Q,P)}var G=w[D],J=C,ne=T;for(e(w,C,D),P(w[T],G)>0&&e(w,C,T);J<ne;){for(e(w,J,ne),J++,ne--;P(w[J],G)<0;)J++;for(;P(w[ne],G)>0;)ne--}P(w[C],G)===0?e(w,C,ne):e(w,++ne,T),ne<=D&&(C=ne+1),D<=ne&&(T=ne-1)}})(m,p,y||0,v||m.length-1,x||t)}function e(m,p,y){var v=m[p];m[p]=m[y],m[y]=v}function t(m,p){return m<p?-1:m>p?1:0}var r=function(m){m===void 0&&(m=9),this._maxEntries=Math.max(4,m),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(m,p,y){if(!y)return p.indexOf(m);for(var v=0;v<p.length;v++)if(y(m,p[v]))return v;return-1}function i(m,p){s(m,0,m.children.length,p,m)}function s(m,p,y,v,x){x||(x=b(null)),x.minX=1/0,x.minY=1/0,x.maxX=-1/0,x.maxY=-1/0;for(var S=p;S<y;S++){var w=m.children[S];a(x,m.leaf?v(w):w)}return x}function a(m,p){return m.minX=Math.min(m.minX,p.minX),m.minY=Math.min(m.minY,p.minY),m.maxX=Math.max(m.maxX,p.maxX),m.maxY=Math.max(m.maxY,p.maxY),m}function l(m,p){return m.minX-p.minX}function c(m,p){return m.minY-p.minY}function u(m){return(m.maxX-m.minX)*(m.maxY-m.minY)}function d(m){return m.maxX-m.minX+(m.maxY-m.minY)}function h(m,p){return m.minX<=p.minX&&m.minY<=p.minY&&p.maxX<=m.maxX&&p.maxY<=m.maxY}function g(m,p){return p.minX<=m.maxX&&p.minY<=m.maxY&&p.maxX>=m.minX&&p.maxY>=m.minY}function b(m){return{children:m,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function M(m,p,y,v,x){for(var S=[p,y];S.length;)if(!((y=S.pop())-(p=S.pop())<=v)){var w=p+Math.ceil((y-p)/v/2)*v;n(m,w,p,y,x),S.push(p,w,w,y)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(m){var p=this.data,y=[];if(!g(m,p))return y;for(var v=this.toBBox,x=[];p;){for(var S=0;S<p.children.length;S++){var w=p.children[S],D=p.leaf?v(w):w;g(m,D)&&(p.leaf?y.push(w):h(m,D)?this._all(w,y):x.push(w))}p=x.pop()}return y},r.prototype.collides=function(m){var p=this.data;if(!g(m,p))return!1;for(var y=[];p;){for(var v=0;v<p.children.length;v++){var x=p.children[v],S=p.leaf?this.toBBox(x):x;if(g(m,S)){if(p.leaf||h(m,S))return!0;y.push(x)}}p=y.pop()}return!1},r.prototype.load=function(m){if(!m||!m.length)return this;if(m.length<this._minEntries){for(var p=0;p<m.length;p++)this.insert(m[p]);return this}var y=this._build(m.slice(),0,m.length-1,0);if(this.data.children.length)if(this.data.height===y.height)this._splitRoot(this.data,y);else{if(this.data.height<y.height){var v=this.data;this.data=y,y=v}this._insert(y,this.data.height-y.height-1,!0)}else this.data=y;return this},r.prototype.insert=function(m){return m&&this._insert(m,this.data.height-1),this},r.prototype.clear=function(){return this.data=b([]),this},r.prototype.remove=function(m,p){if(!m)return this;for(var y,v,x,S=this.data,w=this.toBBox(m),D=[],C=[];S||D.length;){if(S||(S=D.pop(),v=D[D.length-1],y=C.pop(),x=!0),S.leaf){var T=o(m,S.children,p);if(T!==-1)return S.children.splice(T,1),D.push(S),this._condense(D),this}x||S.leaf||!h(S,w)?v?(y++,S=v.children[y],x=!1):S=null:(D.push(S),C.push(y),y=0,v=S,S=S.children[0])}return this},r.prototype.toBBox=function(m){return m},r.prototype.compareMinX=function(m,p){return m.minX-p.minX},r.prototype.compareMinY=function(m,p){return m.minY-p.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(m){return this.data=m,this},r.prototype._all=function(m,p){for(var y=[];m;)m.leaf?p.push.apply(p,m.children):y.push.apply(y,m.children),m=y.pop();return p},r.prototype._build=function(m,p,y,v){var x,S=y-p+1,w=this._maxEntries;if(S<=w)return i(x=b(m.slice(p,y+1)),this.toBBox),x;v||(v=Math.ceil(Math.log(S)/Math.log(w)),w=Math.ceil(S/Math.pow(w,v-1))),(x=b([])).leaf=!1,x.height=v;var D=Math.ceil(S/w),C=D*Math.ceil(Math.sqrt(w));M(m,p,y,C,this.compareMinX);for(var T=p;T<=y;T+=C){var P=Math.min(T+C-1,y);M(m,T,P,D,this.compareMinY);for(var I=T;I<=P;I+=D){var L=Math.min(I+D-1,P);x.children.push(this._build(m,I,L,v-1))}}return i(x,this.toBBox),x},r.prototype._chooseSubtree=function(m,p,y,v){for(;v.push(p),!p.leaf&&v.length-1!==y;){for(var x=1/0,S=1/0,w=void 0,D=0;D<p.children.length;D++){var C=p.children[D],T=u(C),P=(I=m,L=C,(Math.max(L.maxX,I.maxX)-Math.min(L.minX,I.minX))*(Math.max(L.maxY,I.maxY)-Math.min(L.minY,I.minY))-T);P<S?(S=P,x=T<x?T:x,w=C):P===S&&T<x&&(x=T,w=C)}p=w||p.children[0]}var I,L;return p},r.prototype._insert=function(m,p,y){var v=y?m:this.toBBox(m),x=[],S=this._chooseSubtree(v,this.data,p,x);for(S.children.push(m),a(S,v);p>=0&&x[p].children.length>this._maxEntries;)this._split(x,p),p--;this._adjustParentBBoxes(v,x,p)},r.prototype._split=function(m,p){var y=m[p],v=y.children.length,x=this._minEntries;this._chooseSplitAxis(y,x,v);var S=this._chooseSplitIndex(y,x,v),w=b(y.children.splice(S,y.children.length-S));w.height=y.height,w.leaf=y.leaf,i(y,this.toBBox),i(w,this.toBBox),p?m[p-1].children.push(w):this._splitRoot(y,w)},r.prototype._splitRoot=function(m,p){this.data=b([m,p]),this.data.height=m.height+1,this.data.leaf=!1,i(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(m,p,y){for(var v,x,S,w,D,C,T,P=1/0,I=1/0,L=p;L<=y-p;L++){var N=s(m,0,L,this.toBBox),z=s(m,L,y,this.toBBox),j=(x=N,S=z,w=void 0,D=void 0,C=void 0,T=void 0,w=Math.max(x.minX,S.minX),D=Math.max(x.minY,S.minY),C=Math.min(x.maxX,S.maxX),T=Math.min(x.maxY,S.maxY),Math.max(0,C-w)*Math.max(0,T-D)),H=u(N)+u(z);j<P?(P=j,v=L,I=H<I?H:I):j===P&&H<I&&(I=H,v=L)}return v||y-p},r.prototype._chooseSplitAxis=function(m,p,y){var v=m.leaf?this.compareMinX:l,x=m.leaf?this.compareMinY:c;this._allDistMargin(m,p,y,v)<this._allDistMargin(m,p,y,x)&&m.children.sort(v)},r.prototype._allDistMargin=function(m,p,y,v){m.children.sort(v);for(var x=this.toBBox,S=s(m,0,p,x),w=s(m,y-p,y,x),D=d(S)+d(w),C=p;C<y-p;C++){var T=m.children[C];a(S,m.leaf?x(T):T),D+=d(S)}for(var P=y-p-1;P>=p;P--){var I=m.children[P];a(w,m.leaf?x(I):I),D+=d(w)}return D},r.prototype._adjustParentBBoxes=function(m,p,y){for(var v=y;v>=0;v--)a(p[v],m)},r.prototype._condense=function(m){for(var p=m.length-1,y=void 0;p>=0;p--)m[p].children.length===0?p>0?(y=m[p-1].children).splice(y.indexOf(m[p]),1):this.clear():i(m[p],this.toBBox)},r})});var Ba=at(B=>{"use strict";f();Object.defineProperty(B,"__esModule",{value:!0});B.earthRadius=63710088e-1;B.factors={centimeters:B.earthRadius*100,centimetres:B.earthRadius*100,degrees:B.earthRadius/111325,feet:B.earthRadius*3.28084,inches:B.earthRadius*39.37,kilometers:B.earthRadius/1e3,kilometres:B.earthRadius/1e3,meters:B.earthRadius,metres:B.earthRadius,miles:B.earthRadius/1609.344,millimeters:B.earthRadius*1e3,millimetres:B.earthRadius*1e3,nauticalmiles:B.earthRadius/1852,radians:1,yards:B.earthRadius*1.0936};B.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/B.earthRadius,yards:1.0936133};B.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function jt(n,e,t){t===void 0&&(t={});var r={type:"Feature"};return(t.id===0||t.id)&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.properties=e||{},r.geometry=n,r}B.feature=jt;function xf(n,e,t){switch(t===void 0&&(t={}),n){case"Point":return Ra(e).geometry;case"LineString":return Fa(e).geometry;case"Polygon":return _a(e).geometry;case"MultiPoint":return Ad(e).geometry;case"MultiLineString":return Ld(e).geometry;case"MultiPolygon":return Rd(e).geometry;default:throw new Error(n+" is invalid")}}B.geometry=xf;function Ra(n,e,t){if(t===void 0&&(t={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ci(n[0])||!Ci(n[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:n};return jt(r,e,t)}B.point=Ra;function Sf(n,e,t){return t===void 0&&(t={}),Ei(n.map(function(r){return Ra(r,e)}),t)}B.points=Sf;function _a(n,e,t){t===void 0&&(t={});for(var r=0,o=n;r<o.length;r++){var i=o[r];if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<i[i.length-1].length;s++)if(i[i.length-1][s]!==i[0][s])throw new Error("First and last Position are not equivalent.")}var a={type:"Polygon",coordinates:n};return jt(a,e,t)}B.polygon=_a;function Mf(n,e,t){return t===void 0&&(t={}),Ei(n.map(function(r){return _a(r,e)}),t)}B.polygons=Mf;function Fa(n,e,t){if(t===void 0&&(t={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var r={type:"LineString",coordinates:n};return jt(r,e,t)}B.lineString=Fa;function Cf(n,e,t){return t===void 0&&(t={}),Ei(n.map(function(r){return Fa(r,e)}),t)}B.lineStrings=Cf;function Ei(n,e){e===void 0&&(e={});var t={type:"FeatureCollection"};return e.id&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.features=n,t}B.featureCollection=Ei;function Ld(n,e,t){t===void 0&&(t={});var r={type:"MultiLineString",coordinates:n};return jt(r,e,t)}B.multiLineString=Ld;function Ad(n,e,t){t===void 0&&(t={});var r={type:"MultiPoint",coordinates:n};return jt(r,e,t)}B.multiPoint=Ad;function Rd(n,e,t){t===void 0&&(t={});var r={type:"MultiPolygon",coordinates:n};return jt(r,e,t)}B.multiPolygon=Rd;function Ef(n,e,t){t===void 0&&(t={});var r={type:"GeometryCollection",geometries:n};return jt(r,e,t)}B.geometryCollection=Ef;function wf(n,e){if(e===void 0&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var t=Math.pow(10,e||0);return Math.round(n*t)/t}B.round=wf;function _d(n,e){e===void 0&&(e="kilometers");var t=B.factors[e];if(!t)throw new Error(e+" units is invalid");return n*t}B.radiansToLength=_d;function Na(n,e){e===void 0&&(e="kilometers");var t=B.factors[e];if(!t)throw new Error(e+" units is invalid");return n/t}B.lengthToRadians=Na;function Tf(n,e){return Fd(Na(n,e))}B.lengthToDegrees=Tf;function Df(n){var e=n%360;return e<0&&(e+=360),e}B.bearingToAzimuth=Df;function Fd(n){var e=n%(2*Math.PI);return e*180/Math.PI}B.radiansToDegrees=Fd;function Pf(n){var e=n%360;return e*Math.PI/180}B.degreesToRadians=Pf;function If(n,e,t){if(e===void 0&&(e="kilometers"),t===void 0&&(t="kilometers"),!(n>=0))throw new Error("length must be a positive number");return _d(Na(n,e),t)}B.convertLength=If;function Of(n,e,t){if(e===void 0&&(e="meters"),t===void 0&&(t="kilometers"),!(n>=0))throw new Error("area must be a positive number");var r=B.areaFactors[e];if(!r)throw new Error("invalid original units");var o=B.areaFactors[t];if(!o)throw new Error("invalid final units");return n/r*o}B.convertArea=Of;function Ci(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}B.isNumber=Ci;function Lf(n){return!!n&&n.constructor===Object}B.isObject=Lf;function Af(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(function(e){if(!Ci(e))throw new Error("bbox must only contain numbers")})}B.validateBBox=Af;function Rf(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}B.validateId=Rf});var zd=at(pe=>{"use strict";f();Object.defineProperty(pe,"__esModule",{value:!0});var we=Ba();function Rn(n,e,t){if(n!==null)for(var r,o,i,s,a,l,c,u=0,d=0,h,g=n.type,b=g==="FeatureCollection",M=g==="Feature",m=b?n.features.length:1,p=0;p<m;p++){c=b?n.features[p].geometry:M?n.geometry:n,h=c?c.type==="GeometryCollection":!1,a=h?c.geometries.length:1;for(var y=0;y<a;y++){var v=0,x=0;if(s=h?c.geometries[y]:c,s!==null){l=s.coordinates;var S=s.type;switch(u=t&&(S==="Polygon"||S==="MultiPolygon")?1:0,S){case null:break;case"Point":if(e(l,d,p,v,x)===!1)return!1;d++,v++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(e(l[r],d,p,v,x)===!1)return!1;d++,S==="MultiPoint"&&v++}S==="LineString"&&v++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(o=0;o<l[r].length-u;o++){if(e(l[r][o],d,p,v,x)===!1)return!1;d++}S==="MultiLineString"&&v++,S==="Polygon"&&x++}S==="Polygon"&&v++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(x=0,o=0;o<l[r].length;o++){for(i=0;i<l[r][o].length-u;i++){if(e(l[r][o][i],d,p,v,x)===!1)return!1;d++}x++}v++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(Rn(s.geometries[r],e,t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function _f(n,e,t,r){var o=t;return Rn(n,function(i,s,a,l,c){s===0&&t===void 0?o=i:o=e(o,i,s,a,l,c)},r),o}function Nd(n,e){var t;switch(n.type){case"FeatureCollection":for(t=0;t<n.features.length&&e(n.features[t].properties,t)!==!1;t++);break;case"Feature":e(n.properties,0);break}}function Ff(n,e,t){var r=t;return Nd(n,function(o,i){i===0&&t===void 0?r=o:r=e(r,o,i)}),r}function Bd(n,e){if(n.type==="Feature")e(n,0);else if(n.type==="FeatureCollection")for(var t=0;t<n.features.length&&e(n.features[t],t)!==!1;t++);}function Nf(n,e,t){var r=t;return Bd(n,function(o,i){i===0&&t===void 0?r=o:r=e(r,o,i)}),r}function Bf(n){var e=[];return Rn(n,function(t){e.push(t)}),e}function Ga(n,e){var t,r,o,i,s,a,l,c,u,d,h=0,g=n.type==="FeatureCollection",b=n.type==="Feature",M=g?n.features.length:1;for(t=0;t<M;t++){for(a=g?n.features[t].geometry:b?n.geometry:n,c=g?n.features[t].properties:b?n.properties:{},u=g?n.features[t].bbox:b?n.bbox:void 0,d=g?n.features[t].id:b?n.id:void 0,l=a?a.type==="GeometryCollection":!1,s=l?a.geometries.length:1,o=0;o<s;o++){if(i=l?a.geometries[o]:a,i===null){if(e(null,h,c,u,d)===!1)return!1;continue}switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(i,h,c,u,d)===!1)return!1;break}case"GeometryCollection":{for(r=0;r<i.geometries.length;r++)if(e(i.geometries[r],h,c,u,d)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function Gf(n,e,t){var r=t;return Ga(n,function(o,i,s,a,l){i===0&&t===void 0?r=o:r=e(r,o,i,s,a,l)}),r}function wi(n,e){Ga(n,function(t,r,o,i,s){var a=t===null?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return e(we.feature(t,o,{bbox:i,id:s}),r,0)===!1?!1:void 0}var l;switch(a){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var c=0;c<t.coordinates.length;c++){var u=t.coordinates[c],d={type:l,coordinates:u};if(e(we.feature(d,o),r,c)===!1)return!1}})}function kf(n,e,t){var r=t;return wi(n,function(o,i,s){i===0&&s===0&&t===void 0?r=o:r=e(r,o,i,s)}),r}function Gd(n,e){wi(n,function(t,r,o){var i=0;if(t.geometry){var s=t.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var a,l=0,c=0,u=0;if(Rn(t,function(d,h,g,b,M){if(a===void 0||r>l||b>c||M>u){a=d,l=r,c=b,u=M,i=0;return}var m=we.lineString([a,d],t.properties);if(e(m,r,o,M,i)===!1)return!1;i++,a=d})===!1)return!1}}})}function zf(n,e,t){var r=t,o=!1;return Gd(n,function(i,s,a,l,c){o===!1&&t===void 0?r=i:r=e(r,i,s,a,l,c),o=!0}),r}function kd(n,e){if(!n)throw new Error("geojson is required");wi(n,function(t,r,o){if(t.geometry!==null){var i=t.geometry.type,s=t.geometry.coordinates;switch(i){case"LineString":if(e(t,r,o,0,0)===!1)return!1;break;case"Polygon":for(var a=0;a<s.length;a++)if(e(we.lineString(s[a],t.properties),r,o,a)===!1)return!1;break}}})}function Uf(n,e,t){var r=t;return kd(n,function(o,i,s,a){i===0&&t===void 0?r=o:r=e(r,o,i,s,a)}),r}function Hf(n,e){if(e=e||{},!we.isObject(e))throw new Error("options is invalid");var t=e.featureIndex||0,r=e.multiFeatureIndex||0,o=e.geometryIndex||0,i=e.segmentIndex||0,s=e.properties,a;switch(n.type){case"FeatureCollection":t<0&&(t=n.features.length+t),s=s||n.features[t].properties,a=n.features[t].geometry;break;case"Feature":s=s||n.properties,a=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=n;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var l=a.coordinates;switch(a.type){case"Point":case"MultiPoint":return null;case"LineString":return i<0&&(i=l.length+i-1),we.lineString([l[i],l[i+1]],s,e);case"Polygon":return o<0&&(o=l.length+o),i<0&&(i=l[o].length+i-1),we.lineString([l[o][i],l[o][i+1]],s,e);case"MultiLineString":return r<0&&(r=l.length+r),i<0&&(i=l[r].length+i-1),we.lineString([l[r][i],l[r][i+1]],s,e);case"MultiPolygon":return r<0&&(r=l.length+r),o<0&&(o=l[r].length+o),i<0&&(i=l[r][o].length-i-1),we.lineString([l[r][o][i],l[r][o][i+1]],s,e)}throw new Error("geojson is invalid")}function Wf(n,e){if(e=e||{},!we.isObject(e))throw new Error("options is invalid");var t=e.featureIndex||0,r=e.multiFeatureIndex||0,o=e.geometryIndex||0,i=e.coordIndex||0,s=e.properties,a;switch(n.type){case"FeatureCollection":t<0&&(t=n.features.length+t),s=s||n.features[t].properties,a=n.features[t].geometry;break;case"Feature":s=s||n.properties,a=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=n;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var l=a.coordinates;switch(a.type){case"Point":return we.point(l,s,e);case"MultiPoint":return r<0&&(r=l.length+r),we.point(l[r],s,e);case"LineString":return i<0&&(i=l.length+i),we.point(l[i],s,e);case"Polygon":return o<0&&(o=l.length+o),i<0&&(i=l[o].length+i),we.point(l[o][i],s,e);case"MultiLineString":return r<0&&(r=l.length+r),i<0&&(i=l[r].length+i),we.point(l[r][i],s,e);case"MultiPolygon":return r<0&&(r=l.length+r),o<0&&(o=l[r].length+o),i<0&&(i=l[r][o].length-i),we.point(l[r][o][i],s,e)}throw new Error("geojson is invalid")}pe.coordAll=Bf;pe.coordEach=Rn;pe.coordReduce=_f;pe.featureEach=Bd;pe.featureReduce=Nf;pe.findPoint=Wf;pe.findSegment=Hf;pe.flattenEach=wi;pe.flattenReduce=kf;pe.geomEach=Ga;pe.geomReduce=Gf;pe.lineEach=kd;pe.lineReduce=Uf;pe.propEach=Nd;pe.propReduce=Ff;pe.segmentEach=Gd;pe.segmentReduce=zf});var Zd=at(X=>{"use strict";f();Object.defineProperty(X,"__esModule",{value:!0});var Ue=63710088e-1,za={centimeters:Ue*100,centimetres:Ue*100,degrees:360/(2*Math.PI),feet:Ue*3.28084,inches:Ue*39.37,kilometers:Ue/1e3,kilometres:Ue/1e3,meters:Ue,metres:Ue,miles:Ue/1609.344,millimeters:Ue*1e3,millimetres:Ue*1e3,nauticalmiles:Ue/1852,radians:1,yards:Ue*1.0936},ka={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Zt(n,e,t={}){let r={type:"Feature"};return(t.id===0||t.id)&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.properties=e||{},r.geometry=n,r}function Vf(n,e,t={}){switch(n){case"Point":return Ua(e).geometry;case"LineString":return Wa(e).geometry;case"Polygon":return Ha(e).geometry;case"MultiPoint":return Hd(e).geometry;case"MultiLineString":return Ud(e).geometry;case"MultiPolygon":return Wd(e).geometry;default:throw new Error(n+" is invalid")}}function Ua(n,e,t={}){if(!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ti(n[0])||!Ti(n[1]))throw new Error("coordinates must contain numbers");return Zt({type:"Point",coordinates:n},e,t)}function jf(n,e,t={}){return Di(n.map(r=>Ua(r,e)),t)}function Ha(n,e,t={}){for(let o of n){if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(o[o.length-1].length!==o[0].length)throw new Error("First and last Position are not equivalent.");for(let i=0;i<o[o.length-1].length;i++)if(o[o.length-1][i]!==o[0][i])throw new Error("First and last Position are not equivalent.")}return Zt({type:"Polygon",coordinates:n},e,t)}function Zf(n,e,t={}){return Di(n.map(r=>Ha(r,e)),t)}function Wa(n,e,t={}){if(n.length<2)throw new Error("coordinates must be an array of two or more positions");return Zt({type:"LineString",coordinates:n},e,t)}function Xf(n,e,t={}){return Di(n.map(r=>Wa(r,e)),t)}function Di(n,e={}){let t={type:"FeatureCollection"};return e.id&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.features=n,t}function Ud(n,e,t={}){return Zt({type:"MultiLineString",coordinates:n},e,t)}function Hd(n,e,t={}){return Zt({type:"MultiPoint",coordinates:n},e,t)}function Wd(n,e,t={}){return Zt({type:"MultiPolygon",coordinates:n},e,t)}function Yf(n,e,t={}){return Zt({type:"GeometryCollection",geometries:n},e,t)}function $f(n,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");let t=Math.pow(10,e||0);return Math.round(n*t)/t}function Vd(n,e="kilometers"){let t=za[e];if(!t)throw new Error(e+" units is invalid");return n*t}function Va(n,e="kilometers"){let t=za[e];if(!t)throw new Error(e+" units is invalid");return n/t}function qf(n,e){return jd(Va(n,e))}function Jf(n){let e=n%360;return e<0&&(e+=360),e}function Kf(n){return n=n%360,n>180?n-360:n<-180?n+360:n}function jd(n){return n%(2*Math.PI)*180/Math.PI}function Qf(n){return n%360*Math.PI/180}function eg(n,e="kilometers",t="kilometers"){if(!(n>=0))throw new Error("length must be a positive number");return Vd(Va(n,e),t)}function tg(n,e="meters",t="kilometers"){if(!(n>=0))throw new Error("area must be a positive number");let r=ka[e];if(!r)throw new Error("invalid original units");let o=ka[t];if(!o)throw new Error("invalid final units");return n/r*o}function Ti(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function rg(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function ng(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(e=>{if(!Ti(e))throw new Error("bbox must only contain numbers")})}function og(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}X.areaFactors=ka;X.azimuthToBearing=Kf;X.bearingToAzimuth=Jf;X.convertArea=tg;X.convertLength=eg;X.degreesToRadians=Qf;X.earthRadius=Ue;X.factors=za;X.feature=Zt;X.featureCollection=Di;X.geometry=Vf;X.geometryCollection=Yf;X.isNumber=Ti;X.isObject=rg;X.lengthToDegrees=qf;X.lengthToRadians=Va;X.lineString=Wa;X.lineStrings=Xf;X.multiLineString=Ud;X.multiPoint=Hd;X.multiPolygon=Wd;X.point=Ua;X.points=jf;X.polygon=Ha;X.polygons=Zf;X.radiansToDegrees=jd;X.radiansToLength=Vd;X.round=$f;X.validateBBox=ng;X.validateId=og});var Jd=at(me=>{"use strict";f();Object.defineProperty(me,"__esModule",{value:!0});var Te=Zd();function _n(n,e,t){if(n!==null)for(var r,o,i,s,a,l,c,u=0,d=0,h,g=n.type,b=g==="FeatureCollection",M=g==="Feature",m=b?n.features.length:1,p=0;p<m;p++){c=b?n.features[p].geometry:M?n.geometry:n,h=c?c.type==="GeometryCollection":!1,a=h?c.geometries.length:1;for(var y=0;y<a;y++){var v=0,x=0;if(s=h?c.geometries[y]:c,s!==null){l=s.coordinates;var S=s.type;switch(u=t&&(S==="Polygon"||S==="MultiPolygon")?1:0,S){case null:break;case"Point":if(e(l,d,p,v,x)===!1)return!1;d++,v++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(e(l[r],d,p,v,x)===!1)return!1;d++,S==="MultiPoint"&&v++}S==="LineString"&&v++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(o=0;o<l[r].length-u;o++){if(e(l[r][o],d,p,v,x)===!1)return!1;d++}S==="MultiLineString"&&v++,S==="Polygon"&&x++}S==="Polygon"&&v++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(x=0,o=0;o<l[r].length;o++){for(i=0;i<l[r][o].length-u;i++){if(e(l[r][o][i],d,p,v,x)===!1)return!1;d++}x++}v++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(_n(s.geometries[r],e,t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ig(n,e,t,r){var o=t;return _n(n,function(i,s,a,l,c){s===0&&t===void 0?o=i:o=e(o,i,s,a,l,c)},r),o}function Xd(n,e){var t;switch(n.type){case"FeatureCollection":for(t=0;t<n.features.length&&e(n.features[t].properties,t)!==!1;t++);break;case"Feature":e(n.properties,0);break}}function sg(n,e,t){var r=t;return Xd(n,function(o,i){i===0&&t===void 0?r=o:r=e(r,o,i)}),r}function Yd(n,e){if(n.type==="Feature")e(n,0);else if(n.type==="FeatureCollection")for(var t=0;t<n.features.length&&e(n.features[t],t)!==!1;t++);}function ag(n,e,t){var r=t;return Yd(n,function(o,i){i===0&&t===void 0?r=o:r=e(r,o,i)}),r}function lg(n){var e=[];return _n(n,function(t){e.push(t)}),e}function ja(n,e){var t,r,o,i,s,a,l,c,u,d,h=0,g=n.type==="FeatureCollection",b=n.type==="Feature",M=g?n.features.length:1;for(t=0;t<M;t++){for(a=g?n.features[t].geometry:b?n.geometry:n,c=g?n.features[t].properties:b?n.properties:{},u=g?n.features[t].bbox:b?n.bbox:void 0,d=g?n.features[t].id:b?n.id:void 0,l=a?a.type==="GeometryCollection":!1,s=l?a.geometries.length:1,o=0;o<s;o++){if(i=l?a.geometries[o]:a,i===null){if(e(null,h,c,u,d)===!1)return!1;continue}switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(i,h,c,u,d)===!1)return!1;break}case"GeometryCollection":{for(r=0;r<i.geometries.length;r++)if(e(i.geometries[r],h,c,u,d)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function cg(n,e,t){var r=t;return ja(n,function(o,i,s,a,l){i===0&&t===void 0?r=o:r=e(r,o,i,s,a,l)}),r}function Pi(n,e){ja(n,function(t,r,o,i,s){var a=t===null?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return e(Te.feature.call(void 0,t,o,{bbox:i,id:s}),r,0)===!1?!1:void 0}var l;switch(a){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var c=0;c<t.coordinates.length;c++){var u=t.coordinates[c],d={type:l,coordinates:u};if(e(Te.feature.call(void 0,d,o),r,c)===!1)return!1}})}function ug(n,e,t){var r=t;return Pi(n,function(o,i,s){i===0&&s===0&&t===void 0?r=o:r=e(r,o,i,s)}),r}function $d(n,e){Pi(n,function(t,r,o){var i=0;if(t.geometry){var s=t.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var a,l=0,c=0,u=0;if(_n(t,function(d,h,g,b,M){if(a===void 0||r>l||b>c||M>u){a=d,l=r,c=b,u=M,i=0;return}var m=Te.lineString.call(void 0,[a,d],t.properties);if(e(m,r,o,M,i)===!1)return!1;i++,a=d})===!1)return!1}}})}function dg(n,e,t){var r=t,o=!1;return $d(n,function(i,s,a,l,c){o===!1&&t===void 0?r=i:r=e(r,i,s,a,l,c),o=!0}),r}function qd(n,e){if(!n)throw new Error("geojson is required");Pi(n,function(t,r,o){if(t.geometry!==null){var i=t.geometry.type,s=t.geometry.coordinates;switch(i){case"LineString":if(e(t,r,o,0,0)===!1)return!1;break;case"Polygon":for(var a=0;a<s.length;a++)if(e(Te.lineString.call(void 0,s[a],t.properties),r,o,a)===!1)return!1;break}}})}function hg(n,e,t){var r=t;return qd(n,function(o,i,s,a){i===0&&t===void 0?r=o:r=e(r,o,i,s,a)}),r}function pg(n,e){if(e=e||{},!Te.isObject.call(void 0,e))throw new Error("options is invalid");var t=e.featureIndex||0,r=e.multiFeatureIndex||0,o=e.geometryIndex||0,i=e.segmentIndex||0,s=e.properties,a;switch(n.type){case"FeatureCollection":t<0&&(t=n.features.length+t),s=s||n.features[t].properties,a=n.features[t].geometry;break;case"Feature":s=s||n.properties,a=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=n;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var l=a.coordinates;switch(a.type){case"Point":case"MultiPoint":return null;case"LineString":return i<0&&(i=l.length+i-1),Te.lineString.call(void 0,[l[i],l[i+1]],s,e);case"Polygon":return o<0&&(o=l.length+o),i<0&&(i=l[o].length+i-1),Te.lineString.call(void 0,[l[o][i],l[o][i+1]],s,e);case"MultiLineString":return r<0&&(r=l.length+r),i<0&&(i=l[r].length+i-1),Te.lineString.call(void 0,[l[r][i],l[r][i+1]],s,e);case"MultiPolygon":return r<0&&(r=l.length+r),o<0&&(o=l[r].length+o),i<0&&(i=l[r][o].length-i-1),Te.lineString.call(void 0,[l[r][o][i],l[r][o][i+1]],s,e)}throw new Error("geojson is invalid")}function mg(n,e){if(e=e||{},!Te.isObject.call(void 0,e))throw new Error("options is invalid");var t=e.featureIndex||0,r=e.multiFeatureIndex||0,o=e.geometryIndex||0,i=e.coordIndex||0,s=e.properties,a;switch(n.type){case"FeatureCollection":t<0&&(t=n.features.length+t),s=s||n.features[t].properties,a=n.features[t].geometry;break;case"Feature":s=s||n.properties,a=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=n;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var l=a.coordinates;switch(a.type){case"Point":return Te.point.call(void 0,l,s,e);case"MultiPoint":return r<0&&(r=l.length+r),Te.point.call(void 0,l[r],s,e);case"LineString":return i<0&&(i=l.length+i),Te.point.call(void 0,l[i],s,e);case"Polygon":return o<0&&(o=l.length+o),i<0&&(i=l[o].length+i),Te.point.call(void 0,l[o][i],s,e);case"MultiLineString":return r<0&&(r=l.length+r),i<0&&(i=l[r].length+i),Te.point.call(void 0,l[r][i],s,e);case"MultiPolygon":return r<0&&(r=l.length+r),o<0&&(o=l[r].length+o),i<0&&(i=l[r][o].length-i),Te.point.call(void 0,l[r][o][i],s,e)}throw new Error("geojson is invalid")}me.coordAll=lg;me.coordEach=_n;me.coordReduce=ig;me.featureEach=Yd;me.featureReduce=ag;me.findPoint=mg;me.findSegment=pg;me.flattenEach=Pi;me.flattenReduce=ug;me.geomEach=ja;me.geomReduce=cg;me.lineEach=qd;me.lineReduce=hg;me.propEach=Xd;me.propReduce=sg;me.segmentEach=$d;me.segmentReduce=dg});var Qd=at(Ii=>{"use strict";f();Object.defineProperty(Ii,"__esModule",{value:!0});var fg=Jd();function Kd(n,e={}){if(n.bbox!=null&&e.recompute!==!0)return n.bbox;let t=[1/0,1/0,-1/0,-1/0];return fg.coordEach.call(void 0,n,r=>{t[0]>r[0]&&(t[0]=r[0]),t[1]>r[1]&&(t[1]=r[1]),t[2]<r[0]&&(t[2]=r[0]),t[3]<r[1]&&(t[3]=r[1])}),t}var gg=Kd;Ii.bbox=Kd;Ii.default=gg});var oh=at((WE,Za)=>{f();var ut=Od(),th=Ba(),rh=zd(),Xr=Qd().default,yg=rh.featureEach,UE=rh.coordEach,HE=th.polygon,eh=th.featureCollection;function nh(n){var e=new ut(n);return e.insert=function(t){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Xr(t),ut.prototype.insert.call(this,t)},e.load=function(t){var r=[];return Array.isArray(t)?t.forEach(function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Xr(o),r.push(o)}):yg(t,function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Xr(o),r.push(o)}),ut.prototype.load.call(this,r)},e.remove=function(t,r){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Xr(t),ut.prototype.remove.call(this,t,r)},e.clear=function(){return ut.prototype.clear.call(this)},e.search=function(t){var r=ut.prototype.search.call(this,this.toBBox(t));return eh(r)},e.collides=function(t){return ut.prototype.collides.call(this,this.toBBox(t))},e.all=function(){var t=ut.prototype.all.call(this);return eh(t)},e.toJSON=function(){return ut.prototype.toJSON.call(this)},e.fromJSON=function(t){return ut.prototype.fromJSON.call(this,t)},e.toBBox=function(t){var r;if(t.bbox)r=t.bbox;else if(Array.isArray(t)&&t.length===4)r=t;else if(Array.isArray(t)&&t.length===6)r=[t[0],t[1],t[3],t[4]];else if(t.type==="Feature")r=Xr(t);else if(t.type==="FeatureCollection")r=Xr(t);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},e}Za.exports=nh;Za.exports.default=nh});var ml=at((WI,cs)=>{f();(function(){"use strict";function n(s,a){var l=s.x-a.x,c=s.y-a.y;return l*l+c*c}function e(s,a,l){var c=a.x,u=a.y,d=l.x-c,h=l.y-u;if(d!==0||h!==0){var g=((s.x-c)*d+(s.y-u)*h)/(d*d+h*h);g>1?(c=l.x,u=l.y):g>0&&(c+=d*g,u+=h*g)}return d=s.x-c,h=s.y-u,d*d+h*h}function t(s,a){for(var l=s[0],c=[l],u,d=1,h=s.length;d<h;d++)u=s[d],n(u,l)>a&&(c.push(u),l=u);return l!==u&&c.push(u),c}function r(s,a,l,c,u){for(var d=c,h,g=a+1;g<l;g++){var b=e(s[g],s[a],s[l]);b>d&&(h=g,d=b)}d>c&&(h-a>1&&r(s,a,h,c,u),u.push(s[h]),l-h>1&&r(s,h,l,c,u))}function o(s,a){var l=s.length-1,c=[s[0]];return r(s,0,l,a,c),c.push(s[l]),c}function i(s,a,l){if(s.length<=2)return s;var c=a!==void 0?a*a:1;return s=l?s:t(s,c),s=o(s,c),s}typeof define=="function"&&define.amd?define(function(){return i}):typeof cs<"u"?(cs.exports=i,cs.exports.default=i):typeof self<"u"?self.simplify=i:window.simplify=i})()});var xp=at((Pl,Il)=>{f();(function(n,e){typeof Pl=="object"&&typeof Il<"u"?Il.exports=e():typeof define=="function"&&define.amd?define(e):(n=n||self,n.TinyQueue=e())})(Pl,function(){"use strict";var n=function(r,o){if(r===void 0&&(r=[]),o===void 0&&(o=e),this.data=r,this.length=this.data.length,this.compare=o,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)};n.prototype.push=function(r){this.data.push(r),this.length++,this._up(this.length-1)},n.prototype.pop=function(){if(this.length!==0){var r=this.data[0],o=this.data.pop();return this.length--,this.length>0&&(this.data[0]=o,this._down(0)),r}},n.prototype.peek=function(){return this.data[0]},n.prototype._up=function(r){for(var o=this,i=o.data,s=o.compare,a=i[r];r>0;){var l=r-1>>1,c=i[l];if(s(a,c)>=0)break;i[r]=c,r=l}i[r]=a},n.prototype._down=function(r){for(var o=this,i=o.data,s=o.compare,a=this.length>>1,l=i[r];r<a;){var c=(r<<1)+1,u=i[c],d=c+1;if(d<this.length&&s(i[d],u)<0&&(c=d,u=i[d]),s(u,l)>=0)break;i[r]=u,r=c}i[r]=l};function e(t,r){return t<r?-1:t>r?1:0}return n})});var Mp=at((J3,Ol)=>{"use strict";f();var Ss=xp();Ss.default&&(Ss=Ss.default);Ol.exports=Sp;Ol.exports.default=Sp;function Sp(n,e,t){e=e||1;for(var r,o,i,s,a=0;a<n[0].length;a++){var l=n[0][a];(!a||l[0]<r)&&(r=l[0]),(!a||l[1]<o)&&(o=l[1]),(!a||l[0]>i)&&(i=l[0]),(!a||l[1]>s)&&(s=l[1])}var c=i-r,u=s-o,d=Math.min(c,u),h=d/2;if(d===0){var g=[r,o];return g.distance=0,g}for(var b=new Ss(void 0,bb),M=r;M<i;M+=d)for(var m=o;m<s;m+=d)b.push(new Kt(M+h,m+h,h,n));var p=xb(n),y=new Kt(r+c/2,o+u/2,0,n);y.d>p.d&&(p=y);for(var v=b.length;b.length;){var x=b.pop();x.d>p.d&&(p=x,t&&console.log("found best %d after %d probes",Math.round(1e4*x.d)/1e4,v)),!(x.max-p.d<=e)&&(h=x.h/2,b.push(new Kt(x.x-h,x.y-h,h,n)),b.push(new Kt(x.x+h,x.y-h,h,n)),b.push(new Kt(x.x-h,x.y+h,h,n)),b.push(new Kt(x.x+h,x.y+h,h,n)),v+=4)}t&&(console.log("num probes: "+v),console.log("best distance: "+p.d));var S=[p.x,p.y];return S.distance=p.d,S}function bb(n,e){return e.max-n.max}function Kt(n,e,t,r){this.x=n,this.y=e,this.h=t,this.d=vb(n,e,r),this.max=this.d+this.h*Math.SQRT2}function vb(n,e,t){for(var r=!1,o=1/0,i=0;i<t.length;i++)for(var s=t[i],a=0,l=s.length,c=l-1;a<l;c=a++){var u=s[a],d=s[c];u[1]>e!=d[1]>e&&n<(d[0]-u[0])*(e-u[1])/(d[1]-u[1])+u[0]&&(r=!r),o=Math.min(o,Sb(n,e,u,d))}return o===0?0:(r?1:-1)*Math.sqrt(o)}function xb(n){for(var e=0,t=0,r=0,o=n[0],i=0,s=o.length,a=s-1;i<s;a=i++){var l=o[i],c=o[a],u=l[0]*c[1]-c[0]*l[1];t+=(l[0]+c[0])*u,r+=(l[1]+c[1])*u,e+=u*3}return e===0?new Kt(o[0][0],o[0][1],0,n):new Kt(t/e,r/e,0,n)}function Sb(n,e,t,r){var o=t[0],i=t[1],s=r[0]-o,a=r[1]-i;if(s!==0||a!==0){var l=((n-o)*s+(e-i)*a)/(s*s+a*a);l>1?(o=r[0],i=r[1]):l>0&&(o+=s*l,i+=a*l)}return s=n-o,a=e-i,s*s+a*a}});f();f();globalThis.MappedinDebug||(globalThis.MappedinDebug={});globalThis.MappedinDebug.__idleCallbackInteractionState={isInteracting:!1,interactionCheckers:[],pendingCallbacks:[],registerInteractionChecker:function(n){this.interactionCheckers.push(n)},unregisterInteractionChecker:function(n){let e;for(let t=this.interactionCheckers.length-1;t>=0;t--)if(e=this.interactionCheckers[t],e===n){this.interactionCheckers.splice(t,1);break}},checkInteraction:function(){let n=!1;for(let e=0;e<this.interactionCheckers.length;e++)if(n=this.interactionCheckers[e](),n)return!0;return!1},addPendingCallback:function(n,e){this.pendingCallbacks.push({callback:n,timeoutId:e}),this.scheduleDeferredCheck()},scheduleDeferredCheck:function(){var n=this;this.checkTimeoutId||(this.checkTimeoutId=setTimeout(function e(){if(n.checkInteraction())n.checkTimeoutId=setTimeout(e,16);else{n.checkTimeoutId=null;var t=n.pendingCallbacks.slice();n.pendingCallbacks=[];let r;for(let o=0;o<t.length;o++)if(r=t[o],r&&r.callback)try{r.callback()}catch{}}},16))},removePendingCallback:function(n){let e;for(let t=this.pendingCallbacks.length-1;t>=0;t--)if(e=this.pendingCallbacks[t],e.timeoutId===n){this.pendingCallbacks.splice(t,1);break}}};globalThis.requestIdleCallback=globalThis.requestIdleCallback||function(n){var e=performance.now(),t,r=!1,o=function(){if(!r){r=!0;try{n({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(performance.now()-e))}})}catch{}}};return globalThis.MappedinDebug?.__idleCallbackInteractionState?.checkInteraction()?(t=Date.now()+Math.random(),globalThis.MappedinDebug.__idleCallbackInteractionState.addPendingCallback(o,t),t):(t=setTimeout(o,0),t)};globalThis.cancelIdleCallback=globalThis.cancelIdleCallback||function(n){clearTimeout(n),globalThis.MappedinDebug?.__idleCallbackInteractionState?.removePendingCallback(n)};f();f();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var Mu="data:image/jpeg;base64,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gAAEAAgEAggEEEEEEEFSCCCCCCAQASCSQWJJJJLEkkkkkgkkEgEgEgAAEAAgEAggEEEEEH5AQQQQVBBAIAAJBIJJJLEkkkkliSSSSSQSSCQSAAAQAQQCCCCCCCCCpBBBBBUEEEAgAAkEgkkksSSSSSWJJJJJJBJIJBIAABABBAIIIIIIIIKg/LCAQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQAQQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQfPgAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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bpu3bpum6bpum6bpum6bpu3TdN03bpum6bpum6bt03TdN03TdN03TdN03TdN03TduysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysmzKzKzKybMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrJT+2lKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpSn9tKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpT/wDrA//EAB0RAAMBAAMBAQEAAAAAAAAAAAABERIwQFAgkMD/2gAIAQIBAT8A/COlKioqKioqKi+zSoqKioqL59Ro0aKyvpVlZWaNFXiVGkaNFZWV9CsrNGjRpFXepo0V8c69Zo0u1pGilfVnJWaNF+NFXNUaNFfmU0aReamkaNPzNM19VlZWaKysrK/XrKzTNGjRWaKyv+u0/8QAHREBAQACAQUAAAAAAAAAAAAAEQBAUCAQITCQwP/aAAgBAwEBPwD1NkRER07eYiIiNMRERGARERGgIiNAREZRERoCIjiYBERqiIwiI1REcCIiIiIjbkREREREfXZ//9k=";f();var Js=class n extends Error{name="AssertionError";constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,n)}};function Cu(n,e){if(n==null){let t;e?.customMessage?t=e.customMessage:t=`Expected ${e?.valueName?`'${e.valueName}'`:"value"} to be defined, but received ${n}`;let r=e?.errorClass||Js,o=new r(t);throw e?.captureStackTrace!==!1&&Error.captureStackTrace&&Error.captureStackTrace(o,Cu),o}}function Ks(n,e,t){if(Cu(n),n?.type!==e){let r=`Expected type ${e} but got ${n?.type}`;throw new Error(t??r)}}f();var Uo=class{backgroundAlpha=1;backgroundColor=new k;width=0;height=0;options={};renderer;constructor(e){try{this.options=e,Ul()?(this.renderer={setSize:()=>{},state:{reset:()=>{}},properties:{get:()=>{}},getSize:()=>({width:window.innerWidth,height:innerHeight}),getDrawingBufferSize:()=>({width:window.innerWidth,height:innerHeight}),getClearAlpha:()=>1,getClearColor:()=>new k,autoUpdate:!0,shadowMap:{autoUpdate:!0},getContext:()=>({getContextAttributes(){return{alpha:!0,antialias:!1,depth:!0,stencil:!1}}}),readRenderTargetPixelsAsync:()=>Promise.resolve([]),setRenderTarget:()=>{},setClearColor:()=>{},clear:()=>{},render:()=>{},clearStencil:()=>{},clearDepth:()=>{},domElement:document.createElement("canvas"),capabilities:{isWebGL2:!0}},this.renderer.domElement.style.width="1920px",Object.defineProperty(this.renderer.domElement,"clientWidth",{configurable:!0,value:1920}),this.renderer.domElement.style.height="1080px",Object.defineProperty(this.renderer.domElement,"clientHeight",{configurable:!0,value:1080})):(this.renderer=new hc({canvas:e.canvas,alpha:e.alpha||!1,stencil:!0,antialias:typeof e.antialias=="boolean"?e.antialias:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.renderer.localClippingEnabled=!0),this.backgroundColor=new k(e.backgroundColor??"#ffffff"),this.backgroundAlpha=e.backgroundAlpha??1}catch(t){_.error(t),e.onWebGLRendererError&&e.onWebGLRendererError(t)}this.domElement()?.addEventListener("webglcontextlost",this.handleWebGLContextLost),this.domElement()?.addEventListener("webglcontextrestored",this.handleWebGLContextRestored),this.domElement()?.addEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError),this.domElement()&&(this.domElement().style.zIndex="1")}destroy(){this.renderer&&this.renderer.dispose?.(),this.domElement()?.removeEventListener("webglcontextlost",this.handleWebGLContextLost),this.domElement()?.removeEventListener("webglcontextrestored",this.handleWebGLContextRestored),this.domElement()?.removeEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}enabledLayers=new Set([0,1]);matricesUpdatedThisFrame=!1;startFrame(){this.matricesUpdatedThisFrame=!1}updateMatricesIfNeeded(e){this.matricesUpdatedThisFrame||(e.updateMatrixWorld(),this.matricesUpdatedThisFrame=!0)}renderScene(e,t){this.renderer&&(this.updateMatricesIfNeeded(e),this.renderer.render(e,t))}renderFullScene(e,t){if(this.renderer){this.renderer.state.reset(),this.updateMatricesIfNeeded(e),this.renderer.clearStencil(),this.renderer.setRenderTarget(null),this.renderer.autoClear=!1,t.layers.disableAll();for(let r of this.enabledLayers.values())t.layers.enable(r);this.renderer.render(e,t),this.renderer.clearDepth(),t.layers.disableAll(),t.layers.enable(ue.ALWAYS_ON_TOP_PATHS),this.renderer.render(e,t),this.renderer.clearStencil(),this.renderer.state.reset()}}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(e,t){E.env.NODE_ENV==="test"||!this.renderer||(this.width=e,this.height=t,this.renderer.setSize(e,t,!1))}setBackgroundColor(e,t){this.backgroundColor=e,this.backgroundAlpha=t}domElement(){return this.renderer?.domElement}handleWebGLContextCreationError=e=>{this.options.onWebGLContextCreationError?.(e)};handleWebGLContextLost=e=>{e.preventDefault(),this.options.onWebGLContextLost?.(e)};handleWebGLContextRestored=e=>{this.options.onWebGLContextRestored?.(e)}};f();f();f();f();var Ho=class{type;event;constructor(e){this.type=0,this.event=e}get timestamp(){return this.event.timeStamp}},Wo=class{taps=[];add(e){this.lastPointerDown&&e.timestamp-this.lastPointerDown.timestamp<50?this.lastPointerDown.type=1:this.taps.push(e)}get lastPointerDown(){return this.taps.length>=1?this.taps[this.taps.length-1]:void 0}get isSingleTapWithTwoFingers(){return this.isSingleTap&&this.lastPointerDown?.type===1}get isSingleTapWithOneFinger(){return this.isSingleTap&&this.lastPointerDown?.type===0}get isDoubleTapWithOneFinger(){return this.isDoubleTap&&this.taps[0]?.type===0&&this.taps[1]?.type===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(e){this.taps=this.taps.filter(t=>e-t.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};f();function ea(n){let e=new Set;for(let t of n){let r=t.object;for(;r.visible&&r.parent&&r.parent.visible===!0&&!e.has(r.parent);)r=r.parent,r instanceof ie&&r.type==="group-container"&&r.visible&&r.components[0]&&e.add(r)}return Array.from(e)}f();function ta(n,e){if(n==null||e==null)return n===e;if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}var yn=class extends Z{raycaster=new kt;state={hovered3DEntity:void 0,hovered2DEntities:new Set,hovered3DContainers:void 0,lastHover:void 0,interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}};coreState;camera;worldPlane;_quadtree=new gc(new zt(0,0,0,0));_container;lastPointerEvent;cursor="grab";touchesCount=0;isUserMovingCamera;constructor(e,t,r,o,i){super(),this.isUserMovingCamera=i,this.raycaster.layers.enableAll(),this.raycaster.layers.disable(1),this.camera=r,this._container=e,this.coreState=t,this.worldPlane=o,this._container.addEventListener("pointerdown",this.onPointerDown,{capture:!1,signal:this.signal}),this._container.addEventListener("pointermove",this.onPointerMove,{capture:!1,signal:this.signal}),this._container.classList.add("mappedin-interactive")}updateQuadtree(e){this._quadtree=e}setHovered3DEntityInteractionComponentDirty(){if(this.state.hovered3DEntity){let e=this.state.hovered3DEntity.components[2];e&&(e.dirty=!0)}}hasTouched=!1;onPointerMove=co(e=>{e&&(e.preventDefault(),this.updateInteractionStateIfPanning(e),(e.pointerType!=="touch"||e.pointerType===void 0&&this.hasTouched)&&this.handleHover(e),this.handleCursor())},E.env.NODE_ENV==="test"?0:16,{leading:!0});tapsControl=new Wo;getThreeDIntersectsFromXY(e){this.raycaster.setFromCamera(e,this.camera),this.raycaster.layers.enable(ue.GEOMETRY);let t=this.raycaster.intersectObjects(this._hitBoxes.entities,!0).filter(o=>o.object?.name==="worldPlane"||o.object?.visible),r=t.findIndex(o=>o.object?.name==="worldPlane");return r!==-1&&t.push(t.splice(r,1)[0]),t}getGroupContainerIntersectsFromXY(e){let t=this.getThreeDIntersectsFromXY(e),r;return t!=null&&t.length>0&&(r=ea(t)),r}onPointerDown=e=>{e.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,{capture:!1,signal:this.signal}),this._container.addEventListener("pointercancel",this.onPointerUp,{capture:!1,signal:this.signal}),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:e.timeStamp,offsetX:e.offsetX,offsetY:e.offsetY},this.lastPointerEvent=e,this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),e.pointerType==="touch"&&(this.tapsControl.add(new Ho(e)),this.touchesCount=Math.max(0,this.touchesCount+1)))};clickTimeout=void 0;onPointerUp=e=>{this.tapsControl.discardOutsideOfWaitWindow(e.timeStamp),this.lastPointerEvent=e,this.touchesCount=Math.max(0,this.touchesCount-1),this.touchesCount===0&&(this._container.removeEventListener("pointerup",this.onPointerUp,{capture:!1}),this._container.removeEventListener("pointercancel",this.onPointerUp,{capture:!1})),this.updateInteractionStateIfPanning(e);let{mouseDownStart:t}=this.state.interaction;!t||this.state.interaction.distanceFromMouseDown==null||(Date.now()<t.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(e.pointerType==="touch"&&!this.isUserMovingCamera()?this.tapsControl.isSingleTapWithTwoFingers?(this.publish("singletap-with-twofinger",e),this.flush()):this.tapsControl.isSingleTapWithOneFinger&&this.touchesCount===0?(this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickTimeout=window.setTimeout(()=>{this.handleClick(e),this.flush()},300)):this.tapsControl.isDoubleTapWithOneFinger&&(this.publish("doubletap-with-onefinger",e),this.flush()):this.handleClick(e)),this.state.interaction.mouseDownStart=void 0,this.state.interaction.distanceFromMouseDown=void 0,this.state.interaction.isPanning=!1,this.handleCursor())};flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(e){let t=e||this.lastPointerEvent;if(t?.pointerType==="touch"||this.state.interaction.mouseDownStart||!t||this.isUserMovingCamera())return;let{entity3D:r,entity2D:o,position:i,groupContainers:s}=this.intersect(t);(this.detect3DEntityHover(r)||this.detect2DEntityHover(o)||this.detect3DContainerHover(s))&&(this.state.hovered3DEntity=r,this.state.lastHover=r,this.state.hovered2DEntities=new Set(o.map(a=>a.id)),this.state.hovered3DContainers=s,this.publish("hover",{entity2D:o,entity3D:this.state.hovered3DEntity,position:i,groupContainers:s})),this.handleCursor()}handleCursor(){let e=!!(this.state.hovered3DEntity&&this.state.hovered3DEntity?.components[2]||this.state.hovered2DEntities.size>0),t=!!this.state.interaction.mouseDownStart,r=this.state.interaction.isPanning,o=Up(e,r,t);this.cursor!==o&&(this.cursor=o,o==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}detect2DEntityHover(e){if(e.length!==this.state.hovered2DEntities.size)return!0;for(let t=0;t<e.length;t++)if(!this.state.hovered2DEntities.has(e[t].id))return!0;return!1}handleClick(e){let t=this.intersect(e);this.publish("click",{entity2D:t.entity2D,entity3D:t.entity3D,position:t.position,groupContainers:t.groupContainers,pointerEvent:{button:e.button}})}dirty3D=!0;cachedHitBoxes={entities:[]};get _hitBoxes(){if(this.dirty3D){this.cachedHitBoxes.entities=[];let e;for(let t of this.coreState.geometry3DIdsInScene)if(e=this.coreState.geometry3DMap.get(t),e?.type==="geometry"||e?.type==="model"||e?.type==="path"||e?.type==="custom-geometry"||e?.type==="image"){let r=e.components[0];if(r instanceof oe&&r.pointerEventsPassThrough)continue;r.mesh&&!this.cachedHitBoxes.entities.includes(r.mesh)&&this.cachedHitBoxes.entities.push(r.mesh)}return this.dirty3D=!1,this.cachedHitBoxes.entities.push(this.worldPlane),this.cachedHitBoxes}return this.cachedHitBoxes}ndcPoint=new W;intersect(e){let{offsetX:t,offsetY:r}=e,o=[t,r],s=this._quadtree.queryPoint(o).filter(y=>y.intersectsPoint(o));this.ndcPoint.x=t/this._container.clientWidth*2-1,this.ndcPoint.y=-(r/this._container.clientHeight)*2+1;let a=this.getThreeDIntersectsFromXY(this.ndcPoint),l=[],c=[],u=[],d;for(let y of a){if(y.object.name==="worldPlane"){d??=y;continue}if(y.object.name==="hole-fill-mesh"||!(y.object instanceof V)||y.object.material?.colorWrite===!1)continue;let v=y?.instanceId??y?.batchId,x=v!=null&&y?.object.userData.entities?y.object.userData.entities[v]:y.object.userData?.entityId,S=x?this.coreState.geometry3DMap.get(x):void 0;if(S instanceof $){let D=S.components[0];if(D instanceof oe&&D.pointerEventsPassThrough)continue}let w=y.object.userData?.entityId;if(w){let C=this.coreState.geometry3DMap.get(w)?.components[7];if(C?.verticalOffset!=null&&y.point.z>C.verticalOffset)continue}u.push(y),y.object.material.depthTest===!1?l.push(y):c.push(y)}let h=l[0]??c[0]??void 0,g=h?.point??d?.point,b,M;if(h!=null){let y=h?.instanceId??h?.batchId;b=y!=null&&h?.object.userData.entities?this.coreState.geometry3DMap.get(h?.object.userData.entities[y]):this.coreState.geometry3DMap.get(h?.object.userData.entityId),b?.components[2]&&(M=b)}let m=ea(u),p=[];for(let y of s)if(y?.userData?.entityId==="watermark")p.push({id:"watermark"});else{let v=this.coreState.geometry2DMap.get(y?.userData.entityId);v&&p.push(v)}return Hp(p),{entity2D:p,entity3D:M,position:g,groupContainers:m.length>0?m:void 0}}detect3DEntityHover(e){return this.state.lastHover!==e&&(this.state.lastHover&&Tu(this.state.lastHover,!1,this.coreState),e&&Tu(e,!0,this.coreState)),this.state.hovered3DEntity!==e}detect3DContainerHover(e){return!ta(this.state.hovered3DContainers,e)}updateInteractionStateIfPanning(e){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(e.offsetX-this.state.interaction.mouseDownStart.offsetX,2)+Math.pow(e.offsetY-this.state.interaction.mouseDownStart.offsetY,2)),!this.state.interaction.isPanning&&this.state.interaction.distanceFromMouseDown>15&&(this.state.interaction.isPanning=!0))}getMouseRayIntersects(){return this.raycaster.intersectObjects([this.worldPlane],!1)}destroy(){this._container.removeEventListener("pointerdown",this.onPointerDown,{capture:!1}),this._container.removeEventListener("pointermove",this.onPointerMove,{capture:!1}),this._container.removeEventListener("pointerup",this.onPointerUp,{capture:!1}),this._container.removeEventListener("pointercancel",this.onPointerUp,{capture:!1}),super.destroy()}debugPanel;enableDebug(){let e=document.createElement("div");e.style.position="absolute",e.style.top="0",e.style.right="0",e.style.backgroundColor="white",e.style.padding="10px",document.body.append(e),e.id="interaction-debug-panel",this.debugPanel=e,this.on("doubletap-with-onefinger",()=>{this.queueDebugMessage("doubletap-with-onefinger","#ffadad")}),this.on("singletap-with-twofinger",()=>{this.queueDebugMessage("singletap-with-twofinger","#ffd6a5")}),this.on("click",t=>{this.queueDebugMessage(`CLICK
|
|
1
|
+
import{$ as pc,$a as _c,$b as Ys,Aa as Nr,Ab as Xc,Ac as Ce,Ba as Do,Bb as Yc,Bc as ie,C as Os,Ca as hn,Cb as $c,D as kl,Db as pr,E as fo,Ea as ue,Eb as No,F as sr,Fa as Oe,Fb as Le,G as At,Ga as qe,Gb as qc,H as Ls,Ha as ks,Hb as Jc,Ia as Mt,Ib as Kc,Ja as Po,Jb as Hs,Ka as Io,Kb as Qc,La as Oo,Lb as Vs,M as ar,Ma as Ec,Mb as Ws,N as As,Na as wc,Nb as Bo,O as zl,Oa as hr,Ob as eu,Pa as Tc,Pb as tu,Qa as Br,Qb as js,Ra as Dc,Rb as ru,Sb as nu,Ta as Pc,Tb as ou,U as Rs,Ua as Lo,Ub as Zs,Va as Ic,Vb as iu,W as _s,Wa as Oc,Wb as mr,Xa as Lc,Xb as Go,Ya as Ac,Yb as Xs,Z as Ul,Za as zs,Zb as su,_a as Rc,_b as au,aa as mc,ab as Gr,ac as lu,b as Fl,bb as Fc,bc as gn,ca as dn,cb as Ao,cc as $s,d as _,da as fc,db as Us,dc as ko,e as Dr,eb as Nc,ec as cu,f as on,fb as Ro,fc as qs,g as Pr,gb as pn,gc as uu,h as co,hb as Ct,hc as du,i as Z,ia as Eo,ib as _o,ic as hu,j as Ts,jb as Ut,jc as pu,k as uo,kb as Ht,l as ho,la as wo,lb as Bc,lc as mu,m as po,ma as zt,mc as fu,n as ir,na as gc,nc as gu,o as Nl,oa as yc,ob as Gc,oc as yu,p as Bl,pa as bc,pb as Fo,pc as bu,qa as vc,qb as kc,qc as lt,r as Gl,ra as xc,rb as mn,rc as vu,s as Ds,sa as Sc,sb as zc,sc as ve,t as mo,ta as To,tb as Uc,tc as xu,ua as Mc,ub as fn,uc as zo,v as Ps,va as Cc,vb as Hc,vc as ct,w as Lt,wa as Bs,wb as Vc,wc as Su,xa as Gs,xb as Wc,xc as Vt,y as Is,ya as He,yb as jc,yc as kr,z as vt,za as $,zb as Zc,zc as oe}from"./chunk-23SDKQLF.js";import{a as ze}from"./chunk-DEPTGCUS.js";import{$ as xt,A as Yl,Aa as Lr,C as lr,Ca as Bt,E as $l,F as le,G as ln,H as cr,Ha as rc,I as bo,Ia as nc,J as ur,Ja as So,K as Ir,Ka as oc,La as ic,M as ql,Ma as Ar,N as U,Na as Rr,O as V,Oa as _r,P as _t,Pa as Ie,Q as O,Qa as Fr,Ra as sc,Sa as un,Ua as Gt,Va as ac,W as Jl,X as cn,Y as ce,Z as Kl,_ as Y,a as f,aa as Ge,b as E,ba as k,c as go,ca as Ql,cb as Mo,d as yo,da as Me,e as Hl,ea as ke,f as Rt,fa as dr,fb as Ns,g as Vl,ga as Ft,gb as Co,h as Wl,ha as W,hb as lc,i as sn,ia as Nt,ka as $e,la as ec,lb as cc,ma as Fs,na as vo,nb as kt,o as an,oa as St,pb as uc,qb as dc,r as jl,s as Zl,sb as hc,u as Xl,wa as K,xa as tc,ya as Or,za as xo}from"./chunk-73NFNZ3A.js";import{b as at,c as Bp,d as lo}from"./chunk-PWEV3AFA.js";var Od=at((La,Aa)=>{f();(function(n,e){typeof La=="object"&&typeof Aa<"u"?Aa.exports=e():typeof define=="function"&&define.amd?define(e):(n=n||self).RBush=e()})(La,function(){"use strict";function n(m,p,y,v,x){(function S(w,D,C,T,P){for(;T>C;){if(T-C>600){var I=T-C+1,L=D-C+1,N=Math.log(I),z=.5*Math.exp(2*N/3),j=.5*Math.sqrt(N*z*(I-z)/I)*(L-I/2<0?-1:1),H=Math.max(C,Math.floor(D-L*z/I+j)),Q=Math.min(T,Math.floor(D+(I-L)*z/I+j));S(w,D,H,Q,P)}var G=w[D],J=C,ne=T;for(e(w,C,D),P(w[T],G)>0&&e(w,C,T);J<ne;){for(e(w,J,ne),J++,ne--;P(w[J],G)<0;)J++;for(;P(w[ne],G)>0;)ne--}P(w[C],G)===0?e(w,C,ne):e(w,++ne,T),ne<=D&&(C=ne+1),D<=ne&&(T=ne-1)}})(m,p,y||0,v||m.length-1,x||t)}function e(m,p,y){var v=m[p];m[p]=m[y],m[y]=v}function t(m,p){return m<p?-1:m>p?1:0}var r=function(m){m===void 0&&(m=9),this._maxEntries=Math.max(4,m),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function o(m,p,y){if(!y)return p.indexOf(m);for(var v=0;v<p.length;v++)if(y(m,p[v]))return v;return-1}function i(m,p){s(m,0,m.children.length,p,m)}function s(m,p,y,v,x){x||(x=b(null)),x.minX=1/0,x.minY=1/0,x.maxX=-1/0,x.maxY=-1/0;for(var S=p;S<y;S++){var w=m.children[S];a(x,m.leaf?v(w):w)}return x}function a(m,p){return m.minX=Math.min(m.minX,p.minX),m.minY=Math.min(m.minY,p.minY),m.maxX=Math.max(m.maxX,p.maxX),m.maxY=Math.max(m.maxY,p.maxY),m}function l(m,p){return m.minX-p.minX}function c(m,p){return m.minY-p.minY}function u(m){return(m.maxX-m.minX)*(m.maxY-m.minY)}function d(m){return m.maxX-m.minX+(m.maxY-m.minY)}function h(m,p){return m.minX<=p.minX&&m.minY<=p.minY&&p.maxX<=m.maxX&&p.maxY<=m.maxY}function g(m,p){return p.minX<=m.maxX&&p.minY<=m.maxY&&p.maxX>=m.minX&&p.maxY>=m.minY}function b(m){return{children:m,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function M(m,p,y,v,x){for(var S=[p,y];S.length;)if(!((y=S.pop())-(p=S.pop())<=v)){var w=p+Math.ceil((y-p)/v/2)*v;n(m,w,p,y,x),S.push(p,w,w,y)}}return r.prototype.all=function(){return this._all(this.data,[])},r.prototype.search=function(m){var p=this.data,y=[];if(!g(m,p))return y;for(var v=this.toBBox,x=[];p;){for(var S=0;S<p.children.length;S++){var w=p.children[S],D=p.leaf?v(w):w;g(m,D)&&(p.leaf?y.push(w):h(m,D)?this._all(w,y):x.push(w))}p=x.pop()}return y},r.prototype.collides=function(m){var p=this.data;if(!g(m,p))return!1;for(var y=[];p;){for(var v=0;v<p.children.length;v++){var x=p.children[v],S=p.leaf?this.toBBox(x):x;if(g(m,S)){if(p.leaf||h(m,S))return!0;y.push(x)}}p=y.pop()}return!1},r.prototype.load=function(m){if(!m||!m.length)return this;if(m.length<this._minEntries){for(var p=0;p<m.length;p++)this.insert(m[p]);return this}var y=this._build(m.slice(),0,m.length-1,0);if(this.data.children.length)if(this.data.height===y.height)this._splitRoot(this.data,y);else{if(this.data.height<y.height){var v=this.data;this.data=y,y=v}this._insert(y,this.data.height-y.height-1,!0)}else this.data=y;return this},r.prototype.insert=function(m){return m&&this._insert(m,this.data.height-1),this},r.prototype.clear=function(){return this.data=b([]),this},r.prototype.remove=function(m,p){if(!m)return this;for(var y,v,x,S=this.data,w=this.toBBox(m),D=[],C=[];S||D.length;){if(S||(S=D.pop(),v=D[D.length-1],y=C.pop(),x=!0),S.leaf){var T=o(m,S.children,p);if(T!==-1)return S.children.splice(T,1),D.push(S),this._condense(D),this}x||S.leaf||!h(S,w)?v?(y++,S=v.children[y],x=!1):S=null:(D.push(S),C.push(y),y=0,v=S,S=S.children[0])}return this},r.prototype.toBBox=function(m){return m},r.prototype.compareMinX=function(m,p){return m.minX-p.minX},r.prototype.compareMinY=function(m,p){return m.minY-p.minY},r.prototype.toJSON=function(){return this.data},r.prototype.fromJSON=function(m){return this.data=m,this},r.prototype._all=function(m,p){for(var y=[];m;)m.leaf?p.push.apply(p,m.children):y.push.apply(y,m.children),m=y.pop();return p},r.prototype._build=function(m,p,y,v){var x,S=y-p+1,w=this._maxEntries;if(S<=w)return i(x=b(m.slice(p,y+1)),this.toBBox),x;v||(v=Math.ceil(Math.log(S)/Math.log(w)),w=Math.ceil(S/Math.pow(w,v-1))),(x=b([])).leaf=!1,x.height=v;var D=Math.ceil(S/w),C=D*Math.ceil(Math.sqrt(w));M(m,p,y,C,this.compareMinX);for(var T=p;T<=y;T+=C){var P=Math.min(T+C-1,y);M(m,T,P,D,this.compareMinY);for(var I=T;I<=P;I+=D){var L=Math.min(I+D-1,P);x.children.push(this._build(m,I,L,v-1))}}return i(x,this.toBBox),x},r.prototype._chooseSubtree=function(m,p,y,v){for(;v.push(p),!p.leaf&&v.length-1!==y;){for(var x=1/0,S=1/0,w=void 0,D=0;D<p.children.length;D++){var C=p.children[D],T=u(C),P=(I=m,L=C,(Math.max(L.maxX,I.maxX)-Math.min(L.minX,I.minX))*(Math.max(L.maxY,I.maxY)-Math.min(L.minY,I.minY))-T);P<S?(S=P,x=T<x?T:x,w=C):P===S&&T<x&&(x=T,w=C)}p=w||p.children[0]}var I,L;return p},r.prototype._insert=function(m,p,y){var v=y?m:this.toBBox(m),x=[],S=this._chooseSubtree(v,this.data,p,x);for(S.children.push(m),a(S,v);p>=0&&x[p].children.length>this._maxEntries;)this._split(x,p),p--;this._adjustParentBBoxes(v,x,p)},r.prototype._split=function(m,p){var y=m[p],v=y.children.length,x=this._minEntries;this._chooseSplitAxis(y,x,v);var S=this._chooseSplitIndex(y,x,v),w=b(y.children.splice(S,y.children.length-S));w.height=y.height,w.leaf=y.leaf,i(y,this.toBBox),i(w,this.toBBox),p?m[p-1].children.push(w):this._splitRoot(y,w)},r.prototype._splitRoot=function(m,p){this.data=b([m,p]),this.data.height=m.height+1,this.data.leaf=!1,i(this.data,this.toBBox)},r.prototype._chooseSplitIndex=function(m,p,y){for(var v,x,S,w,D,C,T,P=1/0,I=1/0,L=p;L<=y-p;L++){var N=s(m,0,L,this.toBBox),z=s(m,L,y,this.toBBox),j=(x=N,S=z,w=void 0,D=void 0,C=void 0,T=void 0,w=Math.max(x.minX,S.minX),D=Math.max(x.minY,S.minY),C=Math.min(x.maxX,S.maxX),T=Math.min(x.maxY,S.maxY),Math.max(0,C-w)*Math.max(0,T-D)),H=u(N)+u(z);j<P?(P=j,v=L,I=H<I?H:I):j===P&&H<I&&(I=H,v=L)}return v||y-p},r.prototype._chooseSplitAxis=function(m,p,y){var v=m.leaf?this.compareMinX:l,x=m.leaf?this.compareMinY:c;this._allDistMargin(m,p,y,v)<this._allDistMargin(m,p,y,x)&&m.children.sort(v)},r.prototype._allDistMargin=function(m,p,y,v){m.children.sort(v);for(var x=this.toBBox,S=s(m,0,p,x),w=s(m,y-p,y,x),D=d(S)+d(w),C=p;C<y-p;C++){var T=m.children[C];a(S,m.leaf?x(T):T),D+=d(S)}for(var P=y-p-1;P>=p;P--){var I=m.children[P];a(w,m.leaf?x(I):I),D+=d(w)}return D},r.prototype._adjustParentBBoxes=function(m,p,y){for(var v=y;v>=0;v--)a(p[v],m)},r.prototype._condense=function(m){for(var p=m.length-1,y=void 0;p>=0;p--)m[p].children.length===0?p>0?(y=m[p-1].children).splice(y.indexOf(m[p]),1):this.clear():i(m[p],this.toBBox)},r})});var Ba=at(B=>{"use strict";f();Object.defineProperty(B,"__esModule",{value:!0});B.earthRadius=63710088e-1;B.factors={centimeters:B.earthRadius*100,centimetres:B.earthRadius*100,degrees:B.earthRadius/111325,feet:B.earthRadius*3.28084,inches:B.earthRadius*39.37,kilometers:B.earthRadius/1e3,kilometres:B.earthRadius/1e3,meters:B.earthRadius,metres:B.earthRadius,miles:B.earthRadius/1609.344,millimeters:B.earthRadius*1e3,millimetres:B.earthRadius*1e3,nauticalmiles:B.earthRadius/1852,radians:1,yards:B.earthRadius*1.0936};B.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/B.earthRadius,yards:1.0936133};B.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function jt(n,e,t){t===void 0&&(t={});var r={type:"Feature"};return(t.id===0||t.id)&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.properties=e||{},r.geometry=n,r}B.feature=jt;function xf(n,e,t){switch(t===void 0&&(t={}),n){case"Point":return Ra(e).geometry;case"LineString":return Fa(e).geometry;case"Polygon":return _a(e).geometry;case"MultiPoint":return Ad(e).geometry;case"MultiLineString":return Ld(e).geometry;case"MultiPolygon":return Rd(e).geometry;default:throw new Error(n+" is invalid")}}B.geometry=xf;function Ra(n,e,t){if(t===void 0&&(t={}),!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ci(n[0])||!Ci(n[1]))throw new Error("coordinates must contain numbers");var r={type:"Point",coordinates:n};return jt(r,e,t)}B.point=Ra;function Sf(n,e,t){return t===void 0&&(t={}),Ei(n.map(function(r){return Ra(r,e)}),t)}B.points=Sf;function _a(n,e,t){t===void 0&&(t={});for(var r=0,o=n;r<o.length;r++){var i=o[r];if(i.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<i[i.length-1].length;s++)if(i[i.length-1][s]!==i[0][s])throw new Error("First and last Position are not equivalent.")}var a={type:"Polygon",coordinates:n};return jt(a,e,t)}B.polygon=_a;function Mf(n,e,t){return t===void 0&&(t={}),Ei(n.map(function(r){return _a(r,e)}),t)}B.polygons=Mf;function Fa(n,e,t){if(t===void 0&&(t={}),n.length<2)throw new Error("coordinates must be an array of two or more positions");var r={type:"LineString",coordinates:n};return jt(r,e,t)}B.lineString=Fa;function Cf(n,e,t){return t===void 0&&(t={}),Ei(n.map(function(r){return Fa(r,e)}),t)}B.lineStrings=Cf;function Ei(n,e){e===void 0&&(e={});var t={type:"FeatureCollection"};return e.id&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.features=n,t}B.featureCollection=Ei;function Ld(n,e,t){t===void 0&&(t={});var r={type:"MultiLineString",coordinates:n};return jt(r,e,t)}B.multiLineString=Ld;function Ad(n,e,t){t===void 0&&(t={});var r={type:"MultiPoint",coordinates:n};return jt(r,e,t)}B.multiPoint=Ad;function Rd(n,e,t){t===void 0&&(t={});var r={type:"MultiPolygon",coordinates:n};return jt(r,e,t)}B.multiPolygon=Rd;function Ef(n,e,t){t===void 0&&(t={});var r={type:"GeometryCollection",geometries:n};return jt(r,e,t)}B.geometryCollection=Ef;function wf(n,e){if(e===void 0&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var t=Math.pow(10,e||0);return Math.round(n*t)/t}B.round=wf;function _d(n,e){e===void 0&&(e="kilometers");var t=B.factors[e];if(!t)throw new Error(e+" units is invalid");return n*t}B.radiansToLength=_d;function Na(n,e){e===void 0&&(e="kilometers");var t=B.factors[e];if(!t)throw new Error(e+" units is invalid");return n/t}B.lengthToRadians=Na;function Tf(n,e){return Fd(Na(n,e))}B.lengthToDegrees=Tf;function Df(n){var e=n%360;return e<0&&(e+=360),e}B.bearingToAzimuth=Df;function Fd(n){var e=n%(2*Math.PI);return e*180/Math.PI}B.radiansToDegrees=Fd;function Pf(n){var e=n%360;return e*Math.PI/180}B.degreesToRadians=Pf;function If(n,e,t){if(e===void 0&&(e="kilometers"),t===void 0&&(t="kilometers"),!(n>=0))throw new Error("length must be a positive number");return _d(Na(n,e),t)}B.convertLength=If;function Of(n,e,t){if(e===void 0&&(e="meters"),t===void 0&&(t="kilometers"),!(n>=0))throw new Error("area must be a positive number");var r=B.areaFactors[e];if(!r)throw new Error("invalid original units");var o=B.areaFactors[t];if(!o)throw new Error("invalid final units");return n/r*o}B.convertArea=Of;function Ci(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}B.isNumber=Ci;function Lf(n){return!!n&&n.constructor===Object}B.isObject=Lf;function Af(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(function(e){if(!Ci(e))throw new Error("bbox must only contain numbers")})}B.validateBBox=Af;function Rf(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}B.validateId=Rf});var zd=at(pe=>{"use strict";f();Object.defineProperty(pe,"__esModule",{value:!0});var we=Ba();function Rn(n,e,t){if(n!==null)for(var r,o,i,s,a,l,c,u=0,d=0,h,g=n.type,b=g==="FeatureCollection",M=g==="Feature",m=b?n.features.length:1,p=0;p<m;p++){c=b?n.features[p].geometry:M?n.geometry:n,h=c?c.type==="GeometryCollection":!1,a=h?c.geometries.length:1;for(var y=0;y<a;y++){var v=0,x=0;if(s=h?c.geometries[y]:c,s!==null){l=s.coordinates;var S=s.type;switch(u=t&&(S==="Polygon"||S==="MultiPolygon")?1:0,S){case null:break;case"Point":if(e(l,d,p,v,x)===!1)return!1;d++,v++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(e(l[r],d,p,v,x)===!1)return!1;d++,S==="MultiPoint"&&v++}S==="LineString"&&v++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(o=0;o<l[r].length-u;o++){if(e(l[r][o],d,p,v,x)===!1)return!1;d++}S==="MultiLineString"&&v++,S==="Polygon"&&x++}S==="Polygon"&&v++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(x=0,o=0;o<l[r].length;o++){for(i=0;i<l[r][o].length-u;i++){if(e(l[r][o][i],d,p,v,x)===!1)return!1;d++}x++}v++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(Rn(s.geometries[r],e,t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function _f(n,e,t,r){var o=t;return Rn(n,function(i,s,a,l,c){s===0&&t===void 0?o=i:o=e(o,i,s,a,l,c)},r),o}function Nd(n,e){var t;switch(n.type){case"FeatureCollection":for(t=0;t<n.features.length&&e(n.features[t].properties,t)!==!1;t++);break;case"Feature":e(n.properties,0);break}}function Ff(n,e,t){var r=t;return Nd(n,function(o,i){i===0&&t===void 0?r=o:r=e(r,o,i)}),r}function Bd(n,e){if(n.type==="Feature")e(n,0);else if(n.type==="FeatureCollection")for(var t=0;t<n.features.length&&e(n.features[t],t)!==!1;t++);}function Nf(n,e,t){var r=t;return Bd(n,function(o,i){i===0&&t===void 0?r=o:r=e(r,o,i)}),r}function Bf(n){var e=[];return Rn(n,function(t){e.push(t)}),e}function Ga(n,e){var t,r,o,i,s,a,l,c,u,d,h=0,g=n.type==="FeatureCollection",b=n.type==="Feature",M=g?n.features.length:1;for(t=0;t<M;t++){for(a=g?n.features[t].geometry:b?n.geometry:n,c=g?n.features[t].properties:b?n.properties:{},u=g?n.features[t].bbox:b?n.bbox:void 0,d=g?n.features[t].id:b?n.id:void 0,l=a?a.type==="GeometryCollection":!1,s=l?a.geometries.length:1,o=0;o<s;o++){if(i=l?a.geometries[o]:a,i===null){if(e(null,h,c,u,d)===!1)return!1;continue}switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(i,h,c,u,d)===!1)return!1;break}case"GeometryCollection":{for(r=0;r<i.geometries.length;r++)if(e(i.geometries[r],h,c,u,d)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function Gf(n,e,t){var r=t;return Ga(n,function(o,i,s,a,l){i===0&&t===void 0?r=o:r=e(r,o,i,s,a,l)}),r}function wi(n,e){Ga(n,function(t,r,o,i,s){var a=t===null?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return e(we.feature(t,o,{bbox:i,id:s}),r,0)===!1?!1:void 0}var l;switch(a){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var c=0;c<t.coordinates.length;c++){var u=t.coordinates[c],d={type:l,coordinates:u};if(e(we.feature(d,o),r,c)===!1)return!1}})}function kf(n,e,t){var r=t;return wi(n,function(o,i,s){i===0&&s===0&&t===void 0?r=o:r=e(r,o,i,s)}),r}function Gd(n,e){wi(n,function(t,r,o){var i=0;if(t.geometry){var s=t.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var a,l=0,c=0,u=0;if(Rn(t,function(d,h,g,b,M){if(a===void 0||r>l||b>c||M>u){a=d,l=r,c=b,u=M,i=0;return}var m=we.lineString([a,d],t.properties);if(e(m,r,o,M,i)===!1)return!1;i++,a=d})===!1)return!1}}})}function zf(n,e,t){var r=t,o=!1;return Gd(n,function(i,s,a,l,c){o===!1&&t===void 0?r=i:r=e(r,i,s,a,l,c),o=!0}),r}function kd(n,e){if(!n)throw new Error("geojson is required");wi(n,function(t,r,o){if(t.geometry!==null){var i=t.geometry.type,s=t.geometry.coordinates;switch(i){case"LineString":if(e(t,r,o,0,0)===!1)return!1;break;case"Polygon":for(var a=0;a<s.length;a++)if(e(we.lineString(s[a],t.properties),r,o,a)===!1)return!1;break}}})}function Uf(n,e,t){var r=t;return kd(n,function(o,i,s,a){i===0&&t===void 0?r=o:r=e(r,o,i,s,a)}),r}function Hf(n,e){if(e=e||{},!we.isObject(e))throw new Error("options is invalid");var t=e.featureIndex||0,r=e.multiFeatureIndex||0,o=e.geometryIndex||0,i=e.segmentIndex||0,s=e.properties,a;switch(n.type){case"FeatureCollection":t<0&&(t=n.features.length+t),s=s||n.features[t].properties,a=n.features[t].geometry;break;case"Feature":s=s||n.properties,a=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=n;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var l=a.coordinates;switch(a.type){case"Point":case"MultiPoint":return null;case"LineString":return i<0&&(i=l.length+i-1),we.lineString([l[i],l[i+1]],s,e);case"Polygon":return o<0&&(o=l.length+o),i<0&&(i=l[o].length+i-1),we.lineString([l[o][i],l[o][i+1]],s,e);case"MultiLineString":return r<0&&(r=l.length+r),i<0&&(i=l[r].length+i-1),we.lineString([l[r][i],l[r][i+1]],s,e);case"MultiPolygon":return r<0&&(r=l.length+r),o<0&&(o=l[r].length+o),i<0&&(i=l[r][o].length-i-1),we.lineString([l[r][o][i],l[r][o][i+1]],s,e)}throw new Error("geojson is invalid")}function Vf(n,e){if(e=e||{},!we.isObject(e))throw new Error("options is invalid");var t=e.featureIndex||0,r=e.multiFeatureIndex||0,o=e.geometryIndex||0,i=e.coordIndex||0,s=e.properties,a;switch(n.type){case"FeatureCollection":t<0&&(t=n.features.length+t),s=s||n.features[t].properties,a=n.features[t].geometry;break;case"Feature":s=s||n.properties,a=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=n;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var l=a.coordinates;switch(a.type){case"Point":return we.point(l,s,e);case"MultiPoint":return r<0&&(r=l.length+r),we.point(l[r],s,e);case"LineString":return i<0&&(i=l.length+i),we.point(l[i],s,e);case"Polygon":return o<0&&(o=l.length+o),i<0&&(i=l[o].length+i),we.point(l[o][i],s,e);case"MultiLineString":return r<0&&(r=l.length+r),i<0&&(i=l[r].length+i),we.point(l[r][i],s,e);case"MultiPolygon":return r<0&&(r=l.length+r),o<0&&(o=l[r].length+o),i<0&&(i=l[r][o].length-i),we.point(l[r][o][i],s,e)}throw new Error("geojson is invalid")}pe.coordAll=Bf;pe.coordEach=Rn;pe.coordReduce=_f;pe.featureEach=Bd;pe.featureReduce=Nf;pe.findPoint=Vf;pe.findSegment=Hf;pe.flattenEach=wi;pe.flattenReduce=kf;pe.geomEach=Ga;pe.geomReduce=Gf;pe.lineEach=kd;pe.lineReduce=Uf;pe.propEach=Nd;pe.propReduce=Ff;pe.segmentEach=Gd;pe.segmentReduce=zf});var Zd=at(X=>{"use strict";f();Object.defineProperty(X,"__esModule",{value:!0});var Ue=63710088e-1,za={centimeters:Ue*100,centimetres:Ue*100,degrees:360/(2*Math.PI),feet:Ue*3.28084,inches:Ue*39.37,kilometers:Ue/1e3,kilometres:Ue/1e3,meters:Ue,metres:Ue,miles:Ue/1609.344,millimeters:Ue*1e3,millimetres:Ue*1e3,nauticalmiles:Ue/1852,radians:1,yards:Ue*1.0936},ka={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,nauticalmiles:29155334959812285e-23,millimeters:1e6,millimetres:1e6,yards:1.195990046};function Zt(n,e,t={}){let r={type:"Feature"};return(t.id===0||t.id)&&(r.id=t.id),t.bbox&&(r.bbox=t.bbox),r.properties=e||{},r.geometry=n,r}function Wf(n,e,t={}){switch(n){case"Point":return Ua(e).geometry;case"LineString":return Va(e).geometry;case"Polygon":return Ha(e).geometry;case"MultiPoint":return Hd(e).geometry;case"MultiLineString":return Ud(e).geometry;case"MultiPolygon":return Vd(e).geometry;default:throw new Error(n+" is invalid")}}function Ua(n,e,t={}){if(!n)throw new Error("coordinates is required");if(!Array.isArray(n))throw new Error("coordinates must be an Array");if(n.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Ti(n[0])||!Ti(n[1]))throw new Error("coordinates must contain numbers");return Zt({type:"Point",coordinates:n},e,t)}function jf(n,e,t={}){return Di(n.map(r=>Ua(r,e)),t)}function Ha(n,e,t={}){for(let o of n){if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");if(o[o.length-1].length!==o[0].length)throw new Error("First and last Position are not equivalent.");for(let i=0;i<o[o.length-1].length;i++)if(o[o.length-1][i]!==o[0][i])throw new Error("First and last Position are not equivalent.")}return Zt({type:"Polygon",coordinates:n},e,t)}function Zf(n,e,t={}){return Di(n.map(r=>Ha(r,e)),t)}function Va(n,e,t={}){if(n.length<2)throw new Error("coordinates must be an array of two or more positions");return Zt({type:"LineString",coordinates:n},e,t)}function Xf(n,e,t={}){return Di(n.map(r=>Va(r,e)),t)}function Di(n,e={}){let t={type:"FeatureCollection"};return e.id&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.features=n,t}function Ud(n,e,t={}){return Zt({type:"MultiLineString",coordinates:n},e,t)}function Hd(n,e,t={}){return Zt({type:"MultiPoint",coordinates:n},e,t)}function Vd(n,e,t={}){return Zt({type:"MultiPolygon",coordinates:n},e,t)}function Yf(n,e,t={}){return Zt({type:"GeometryCollection",geometries:n},e,t)}function $f(n,e=0){if(e&&!(e>=0))throw new Error("precision must be a positive number");let t=Math.pow(10,e||0);return Math.round(n*t)/t}function Wd(n,e="kilometers"){let t=za[e];if(!t)throw new Error(e+" units is invalid");return n*t}function Wa(n,e="kilometers"){let t=za[e];if(!t)throw new Error(e+" units is invalid");return n/t}function qf(n,e){return jd(Wa(n,e))}function Jf(n){let e=n%360;return e<0&&(e+=360),e}function Kf(n){return n=n%360,n>180?n-360:n<-180?n+360:n}function jd(n){return n%(2*Math.PI)*180/Math.PI}function Qf(n){return n%360*Math.PI/180}function eg(n,e="kilometers",t="kilometers"){if(!(n>=0))throw new Error("length must be a positive number");return Wd(Wa(n,e),t)}function tg(n,e="meters",t="kilometers"){if(!(n>=0))throw new Error("area must be a positive number");let r=ka[e];if(!r)throw new Error("invalid original units");let o=ka[t];if(!o)throw new Error("invalid final units");return n/r*o}function Ti(n){return!isNaN(n)&&n!==null&&!Array.isArray(n)}function rg(n){return n!==null&&typeof n=="object"&&!Array.isArray(n)}function ng(n){if(!n)throw new Error("bbox is required");if(!Array.isArray(n))throw new Error("bbox must be an Array");if(n.length!==4&&n.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");n.forEach(e=>{if(!Ti(e))throw new Error("bbox must only contain numbers")})}function og(n){if(!n)throw new Error("id is required");if(["string","number"].indexOf(typeof n)===-1)throw new Error("id must be a number or a string")}X.areaFactors=ka;X.azimuthToBearing=Kf;X.bearingToAzimuth=Jf;X.convertArea=tg;X.convertLength=eg;X.degreesToRadians=Qf;X.earthRadius=Ue;X.factors=za;X.feature=Zt;X.featureCollection=Di;X.geometry=Wf;X.geometryCollection=Yf;X.isNumber=Ti;X.isObject=rg;X.lengthToDegrees=qf;X.lengthToRadians=Wa;X.lineString=Va;X.lineStrings=Xf;X.multiLineString=Ud;X.multiPoint=Hd;X.multiPolygon=Vd;X.point=Ua;X.points=jf;X.polygon=Ha;X.polygons=Zf;X.radiansToDegrees=jd;X.radiansToLength=Wd;X.round=$f;X.validateBBox=ng;X.validateId=og});var Jd=at(me=>{"use strict";f();Object.defineProperty(me,"__esModule",{value:!0});var Te=Zd();function _n(n,e,t){if(n!==null)for(var r,o,i,s,a,l,c,u=0,d=0,h,g=n.type,b=g==="FeatureCollection",M=g==="Feature",m=b?n.features.length:1,p=0;p<m;p++){c=b?n.features[p].geometry:M?n.geometry:n,h=c?c.type==="GeometryCollection":!1,a=h?c.geometries.length:1;for(var y=0;y<a;y++){var v=0,x=0;if(s=h?c.geometries[y]:c,s!==null){l=s.coordinates;var S=s.type;switch(u=t&&(S==="Polygon"||S==="MultiPolygon")?1:0,S){case null:break;case"Point":if(e(l,d,p,v,x)===!1)return!1;d++,v++;break;case"LineString":case"MultiPoint":for(r=0;r<l.length;r++){if(e(l[r],d,p,v,x)===!1)return!1;d++,S==="MultiPoint"&&v++}S==="LineString"&&v++;break;case"Polygon":case"MultiLineString":for(r=0;r<l.length;r++){for(o=0;o<l[r].length-u;o++){if(e(l[r][o],d,p,v,x)===!1)return!1;d++}S==="MultiLineString"&&v++,S==="Polygon"&&x++}S==="Polygon"&&v++;break;case"MultiPolygon":for(r=0;r<l.length;r++){for(x=0,o=0;o<l[r].length;o++){for(i=0;i<l[r][o].length-u;i++){if(e(l[r][o][i],d,p,v,x)===!1)return!1;d++}x++}v++}break;case"GeometryCollection":for(r=0;r<s.geometries.length;r++)if(_n(s.geometries[r],e,t)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}function ig(n,e,t,r){var o=t;return _n(n,function(i,s,a,l,c){s===0&&t===void 0?o=i:o=e(o,i,s,a,l,c)},r),o}function Xd(n,e){var t;switch(n.type){case"FeatureCollection":for(t=0;t<n.features.length&&e(n.features[t].properties,t)!==!1;t++);break;case"Feature":e(n.properties,0);break}}function sg(n,e,t){var r=t;return Xd(n,function(o,i){i===0&&t===void 0?r=o:r=e(r,o,i)}),r}function Yd(n,e){if(n.type==="Feature")e(n,0);else if(n.type==="FeatureCollection")for(var t=0;t<n.features.length&&e(n.features[t],t)!==!1;t++);}function ag(n,e,t){var r=t;return Yd(n,function(o,i){i===0&&t===void 0?r=o:r=e(r,o,i)}),r}function lg(n){var e=[];return _n(n,function(t){e.push(t)}),e}function ja(n,e){var t,r,o,i,s,a,l,c,u,d,h=0,g=n.type==="FeatureCollection",b=n.type==="Feature",M=g?n.features.length:1;for(t=0;t<M;t++){for(a=g?n.features[t].geometry:b?n.geometry:n,c=g?n.features[t].properties:b?n.properties:{},u=g?n.features[t].bbox:b?n.bbox:void 0,d=g?n.features[t].id:b?n.id:void 0,l=a?a.type==="GeometryCollection":!1,s=l?a.geometries.length:1,o=0;o<s;o++){if(i=l?a.geometries[o]:a,i===null){if(e(null,h,c,u,d)===!1)return!1;continue}switch(i.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(i,h,c,u,d)===!1)return!1;break}case"GeometryCollection":{for(r=0;r<i.geometries.length;r++)if(e(i.geometries[r],h,c,u,d)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}h++}}function cg(n,e,t){var r=t;return ja(n,function(o,i,s,a,l){i===0&&t===void 0?r=o:r=e(r,o,i,s,a,l)}),r}function Pi(n,e){ja(n,function(t,r,o,i,s){var a=t===null?null:t.type;switch(a){case null:case"Point":case"LineString":case"Polygon":return e(Te.feature.call(void 0,t,o,{bbox:i,id:s}),r,0)===!1?!1:void 0}var l;switch(a){case"MultiPoint":l="Point";break;case"MultiLineString":l="LineString";break;case"MultiPolygon":l="Polygon";break}for(var c=0;c<t.coordinates.length;c++){var u=t.coordinates[c],d={type:l,coordinates:u};if(e(Te.feature.call(void 0,d,o),r,c)===!1)return!1}})}function ug(n,e,t){var r=t;return Pi(n,function(o,i,s){i===0&&s===0&&t===void 0?r=o:r=e(r,o,i,s)}),r}function $d(n,e){Pi(n,function(t,r,o){var i=0;if(t.geometry){var s=t.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var a,l=0,c=0,u=0;if(_n(t,function(d,h,g,b,M){if(a===void 0||r>l||b>c||M>u){a=d,l=r,c=b,u=M,i=0;return}var m=Te.lineString.call(void 0,[a,d],t.properties);if(e(m,r,o,M,i)===!1)return!1;i++,a=d})===!1)return!1}}})}function dg(n,e,t){var r=t,o=!1;return $d(n,function(i,s,a,l,c){o===!1&&t===void 0?r=i:r=e(r,i,s,a,l,c),o=!0}),r}function qd(n,e){if(!n)throw new Error("geojson is required");Pi(n,function(t,r,o){if(t.geometry!==null){var i=t.geometry.type,s=t.geometry.coordinates;switch(i){case"LineString":if(e(t,r,o,0,0)===!1)return!1;break;case"Polygon":for(var a=0;a<s.length;a++)if(e(Te.lineString.call(void 0,s[a],t.properties),r,o,a)===!1)return!1;break}}})}function hg(n,e,t){var r=t;return qd(n,function(o,i,s,a){i===0&&t===void 0?r=o:r=e(r,o,i,s,a)}),r}function pg(n,e){if(e=e||{},!Te.isObject.call(void 0,e))throw new Error("options is invalid");var t=e.featureIndex||0,r=e.multiFeatureIndex||0,o=e.geometryIndex||0,i=e.segmentIndex||0,s=e.properties,a;switch(n.type){case"FeatureCollection":t<0&&(t=n.features.length+t),s=s||n.features[t].properties,a=n.features[t].geometry;break;case"Feature":s=s||n.properties,a=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=n;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var l=a.coordinates;switch(a.type){case"Point":case"MultiPoint":return null;case"LineString":return i<0&&(i=l.length+i-1),Te.lineString.call(void 0,[l[i],l[i+1]],s,e);case"Polygon":return o<0&&(o=l.length+o),i<0&&(i=l[o].length+i-1),Te.lineString.call(void 0,[l[o][i],l[o][i+1]],s,e);case"MultiLineString":return r<0&&(r=l.length+r),i<0&&(i=l[r].length+i-1),Te.lineString.call(void 0,[l[r][i],l[r][i+1]],s,e);case"MultiPolygon":return r<0&&(r=l.length+r),o<0&&(o=l[r].length+o),i<0&&(i=l[r][o].length-i-1),Te.lineString.call(void 0,[l[r][o][i],l[r][o][i+1]],s,e)}throw new Error("geojson is invalid")}function mg(n,e){if(e=e||{},!Te.isObject.call(void 0,e))throw new Error("options is invalid");var t=e.featureIndex||0,r=e.multiFeatureIndex||0,o=e.geometryIndex||0,i=e.coordIndex||0,s=e.properties,a;switch(n.type){case"FeatureCollection":t<0&&(t=n.features.length+t),s=s||n.features[t].properties,a=n.features[t].geometry;break;case"Feature":s=s||n.properties,a=n.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":a=n;break;default:throw new Error("geojson is invalid")}if(a===null)return null;var l=a.coordinates;switch(a.type){case"Point":return Te.point.call(void 0,l,s,e);case"MultiPoint":return r<0&&(r=l.length+r),Te.point.call(void 0,l[r],s,e);case"LineString":return i<0&&(i=l.length+i),Te.point.call(void 0,l[i],s,e);case"Polygon":return o<0&&(o=l.length+o),i<0&&(i=l[o].length+i),Te.point.call(void 0,l[o][i],s,e);case"MultiLineString":return r<0&&(r=l.length+r),i<0&&(i=l[r].length+i),Te.point.call(void 0,l[r][i],s,e);case"MultiPolygon":return r<0&&(r=l.length+r),o<0&&(o=l[r].length+o),i<0&&(i=l[r][o].length-i),Te.point.call(void 0,l[r][o][i],s,e)}throw new Error("geojson is invalid")}me.coordAll=lg;me.coordEach=_n;me.coordReduce=ig;me.featureEach=Yd;me.featureReduce=ag;me.findPoint=mg;me.findSegment=pg;me.flattenEach=Pi;me.flattenReduce=ug;me.geomEach=ja;me.geomReduce=cg;me.lineEach=qd;me.lineReduce=hg;me.propEach=Xd;me.propReduce=sg;me.segmentEach=$d;me.segmentReduce=dg});var Qd=at(Ii=>{"use strict";f();Object.defineProperty(Ii,"__esModule",{value:!0});var fg=Jd();function Kd(n,e={}){if(n.bbox!=null&&e.recompute!==!0)return n.bbox;let t=[1/0,1/0,-1/0,-1/0];return fg.coordEach.call(void 0,n,r=>{t[0]>r[0]&&(t[0]=r[0]),t[1]>r[1]&&(t[1]=r[1]),t[2]<r[0]&&(t[2]=r[0]),t[3]<r[1]&&(t[3]=r[1])}),t}var gg=Kd;Ii.bbox=Kd;Ii.default=gg});var oh=at((VE,Za)=>{f();var ut=Od(),th=Ba(),rh=zd(),Xr=Qd().default,yg=rh.featureEach,UE=rh.coordEach,HE=th.polygon,eh=th.featureCollection;function nh(n){var e=new ut(n);return e.insert=function(t){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Xr(t),ut.prototype.insert.call(this,t)},e.load=function(t){var r=[];return Array.isArray(t)?t.forEach(function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Xr(o),r.push(o)}):yg(t,function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Xr(o),r.push(o)}),ut.prototype.load.call(this,r)},e.remove=function(t,r){if(t.type!=="Feature")throw new Error("invalid feature");return t.bbox=t.bbox?t.bbox:Xr(t),ut.prototype.remove.call(this,t,r)},e.clear=function(){return ut.prototype.clear.call(this)},e.search=function(t){var r=ut.prototype.search.call(this,this.toBBox(t));return eh(r)},e.collides=function(t){return ut.prototype.collides.call(this,this.toBBox(t))},e.all=function(){var t=ut.prototype.all.call(this);return eh(t)},e.toJSON=function(){return ut.prototype.toJSON.call(this)},e.fromJSON=function(t){return ut.prototype.fromJSON.call(this,t)},e.toBBox=function(t){var r;if(t.bbox)r=t.bbox;else if(Array.isArray(t)&&t.length===4)r=t;else if(Array.isArray(t)&&t.length===6)r=[t[0],t[1],t[3],t[4]];else if(t.type==="Feature")r=Xr(t);else if(t.type==="FeatureCollection")r=Xr(t);else throw new Error("invalid geojson");return{minX:r[0],minY:r[1],maxX:r[2],maxY:r[3]}},e}Za.exports=nh;Za.exports.default=nh});var ml=at((VI,cs)=>{f();(function(){"use strict";function n(s,a){var l=s.x-a.x,c=s.y-a.y;return l*l+c*c}function e(s,a,l){var c=a.x,u=a.y,d=l.x-c,h=l.y-u;if(d!==0||h!==0){var g=((s.x-c)*d+(s.y-u)*h)/(d*d+h*h);g>1?(c=l.x,u=l.y):g>0&&(c+=d*g,u+=h*g)}return d=s.x-c,h=s.y-u,d*d+h*h}function t(s,a){for(var l=s[0],c=[l],u,d=1,h=s.length;d<h;d++)u=s[d],n(u,l)>a&&(c.push(u),l=u);return l!==u&&c.push(u),c}function r(s,a,l,c,u){for(var d=c,h,g=a+1;g<l;g++){var b=e(s[g],s[a],s[l]);b>d&&(h=g,d=b)}d>c&&(h-a>1&&r(s,a,h,c,u),u.push(s[h]),l-h>1&&r(s,h,l,c,u))}function o(s,a){var l=s.length-1,c=[s[0]];return r(s,0,l,a,c),c.push(s[l]),c}function i(s,a,l){if(s.length<=2)return s;var c=a!==void 0?a*a:1;return s=l?s:t(s,c),s=o(s,c),s}typeof define=="function"&&define.amd?define(function(){return i}):typeof cs<"u"?(cs.exports=i,cs.exports.default=i):typeof self<"u"?self.simplify=i:window.simplify=i})()});var xp=at((Pl,Il)=>{f();(function(n,e){typeof Pl=="object"&&typeof Il<"u"?Il.exports=e():typeof define=="function"&&define.amd?define(e):(n=n||self,n.TinyQueue=e())})(Pl,function(){"use strict";var n=function(r,o){if(r===void 0&&(r=[]),o===void 0&&(o=e),this.data=r,this.length=this.data.length,this.compare=o,this.length>0)for(var i=(this.length>>1)-1;i>=0;i--)this._down(i)};n.prototype.push=function(r){this.data.push(r),this.length++,this._up(this.length-1)},n.prototype.pop=function(){if(this.length!==0){var r=this.data[0],o=this.data.pop();return this.length--,this.length>0&&(this.data[0]=o,this._down(0)),r}},n.prototype.peek=function(){return this.data[0]},n.prototype._up=function(r){for(var o=this,i=o.data,s=o.compare,a=i[r];r>0;){var l=r-1>>1,c=i[l];if(s(a,c)>=0)break;i[r]=c,r=l}i[r]=a},n.prototype._down=function(r){for(var o=this,i=o.data,s=o.compare,a=this.length>>1,l=i[r];r<a;){var c=(r<<1)+1,u=i[c],d=c+1;if(d<this.length&&s(i[d],u)<0&&(c=d,u=i[d]),s(u,l)>=0)break;i[r]=u,r=c}i[r]=l};function e(t,r){return t<r?-1:t>r?1:0}return n})});var Mp=at((J3,Ol)=>{"use strict";f();var Ss=xp();Ss.default&&(Ss=Ss.default);Ol.exports=Sp;Ol.exports.default=Sp;function Sp(n,e,t){e=e||1;for(var r,o,i,s,a=0;a<n[0].length;a++){var l=n[0][a];(!a||l[0]<r)&&(r=l[0]),(!a||l[1]<o)&&(o=l[1]),(!a||l[0]>i)&&(i=l[0]),(!a||l[1]>s)&&(s=l[1])}var c=i-r,u=s-o,d=Math.min(c,u),h=d/2;if(d===0){var g=[r,o];return g.distance=0,g}for(var b=new Ss(void 0,bb),M=r;M<i;M+=d)for(var m=o;m<s;m+=d)b.push(new Kt(M+h,m+h,h,n));var p=xb(n),y=new Kt(r+c/2,o+u/2,0,n);y.d>p.d&&(p=y);for(var v=b.length;b.length;){var x=b.pop();x.d>p.d&&(p=x,t&&console.log("found best %d after %d probes",Math.round(1e4*x.d)/1e4,v)),!(x.max-p.d<=e)&&(h=x.h/2,b.push(new Kt(x.x-h,x.y-h,h,n)),b.push(new Kt(x.x+h,x.y-h,h,n)),b.push(new Kt(x.x-h,x.y+h,h,n)),b.push(new Kt(x.x+h,x.y+h,h,n)),v+=4)}t&&(console.log("num probes: "+v),console.log("best distance: "+p.d));var S=[p.x,p.y];return S.distance=p.d,S}function bb(n,e){return e.max-n.max}function Kt(n,e,t,r){this.x=n,this.y=e,this.h=t,this.d=vb(n,e,r),this.max=this.d+this.h*Math.SQRT2}function vb(n,e,t){for(var r=!1,o=1/0,i=0;i<t.length;i++)for(var s=t[i],a=0,l=s.length,c=l-1;a<l;c=a++){var u=s[a],d=s[c];u[1]>e!=d[1]>e&&n<(d[0]-u[0])*(e-u[1])/(d[1]-u[1])+u[0]&&(r=!r),o=Math.min(o,Sb(n,e,u,d))}return o===0?0:(r?1:-1)*Math.sqrt(o)}function xb(n){for(var e=0,t=0,r=0,o=n[0],i=0,s=o.length,a=s-1;i<s;a=i++){var l=o[i],c=o[a],u=l[0]*c[1]-c[0]*l[1];t+=(l[0]+c[0])*u,r+=(l[1]+c[1])*u,e+=u*3}return e===0?new Kt(o[0][0],o[0][1],0,n):new Kt(t/e,r/e,0,n)}function Sb(n,e,t,r){var o=t[0],i=t[1],s=r[0]-o,a=r[1]-i;if(s!==0||a!==0){var l=((n-o)*s+(e-i)*a)/(s*s+a*a);l>1?(o=r[0],i=r[1]):l>0&&(o+=s*l,i+=a*l)}return s=n-o,a=e-i,s*s+a*a}});f();f();globalThis.MappedinDebug||(globalThis.MappedinDebug={});globalThis.MappedinDebug.__idleCallbackInteractionState={isInteracting:!1,interactionCheckers:[],pendingCallbacks:[],registerInteractionChecker:function(n){this.interactionCheckers.push(n)},unregisterInteractionChecker:function(n){let e;for(let t=this.interactionCheckers.length-1;t>=0;t--)if(e=this.interactionCheckers[t],e===n){this.interactionCheckers.splice(t,1);break}},checkInteraction:function(){let n=!1;for(let e=0;e<this.interactionCheckers.length;e++)if(n=this.interactionCheckers[e](),n)return!0;return!1},addPendingCallback:function(n,e){this.pendingCallbacks.push({callback:n,timeoutId:e}),this.scheduleDeferredCheck()},scheduleDeferredCheck:function(){var n=this;this.checkTimeoutId||(this.checkTimeoutId=setTimeout(function e(){if(n.checkInteraction())n.checkTimeoutId=setTimeout(e,16);else{n.checkTimeoutId=null;var t=n.pendingCallbacks.slice();n.pendingCallbacks=[];let r;for(let o=0;o<t.length;o++)if(r=t[o],r&&r.callback)try{r.callback()}catch{}}},16))},removePendingCallback:function(n){let e;for(let t=this.pendingCallbacks.length-1;t>=0;t--)if(e=this.pendingCallbacks[t],e.timeoutId===n){this.pendingCallbacks.splice(t,1);break}}};globalThis.requestIdleCallback=globalThis.requestIdleCallback||function(n){var e=performance.now(),t,r=!1,o=function(){if(!r){r=!0;try{n({didTimeout:!1,timeRemaining:function(){return Math.max(0,50-(performance.now()-e))}})}catch{}}};return globalThis.MappedinDebug?.__idleCallbackInteractionState?.checkInteraction()?(t=Date.now()+Math.random(),globalThis.MappedinDebug.__idleCallbackInteractionState.addPendingCallback(o,t),t):(t=setTimeout(o,0),t)};globalThis.cancelIdleCallback=globalThis.cancelIdleCallback||function(n){clearTimeout(n),globalThis.MappedinDebug?.__idleCallbackInteractionState?.removePendingCallback(n)};f();f();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:function(){return this},configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var Mu="data:image/jpeg;base64,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gAAEAAgEAggEEEEEEEFSCCCCCCAQASCSQWJJJJLEkkkkkgkkEgEgEgAAEAAgEAggEEEEEH5AQQQQVBBAIAAJBIJJJLEkkkkliSSSSSQSSCQSAAAQAQQCCCCCCCCCpBBBBBUEEEAgAAkEgkkksSSSSSWJJJJJJBJIJBIAABABBAIIIIIIIIKg/LCAQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQAQQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQfPgAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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bpu3bpum6bpum6bpum6bpu3TdN03bpum6bpum6bt03TdN03TdN03TdN03TdN03TduysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysmzKzKzKybMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrJT+2lKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpSn9tKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpT/wDrA//EAB0RAAMBAAMBAQEAAAAAAAAAAAABERIwQFAgkMD/2gAIAQIBAT8A/COlKioqKioqKi+zSoqKioqL59Ro0aKyvpVlZWaNFXiVGkaNFZWV9CsrNGjRpFXepo0V8c69Zo0u1pGilfVnJWaNF+NFXNUaNFfmU0aReamkaNPzNM19VlZWaKysrK/XrKzTNGjRWaKyv+u0/8QAHREBAQACAQUAAAAAAAAAAAAAEQBAUCAQITCQwP/aAAgBAwEBPwD1NkRER07eYiIiNMRERGARERGgIiNAREZRERoCIjiYBERqiIwiI1REcCIiIiIjbkREREREfXZ//9k=";f();var Js=class n extends Error{name="AssertionError";constructor(e){super(e),Error.captureStackTrace&&Error.captureStackTrace(this,n)}};function Cu(n,e){if(n==null){let t;e?.customMessage?t=e.customMessage:t=`Expected ${e?.valueName?`'${e.valueName}'`:"value"} to be defined, but received ${n}`;let r=e?.errorClass||Js,o=new r(t);throw e?.captureStackTrace!==!1&&Error.captureStackTrace&&Error.captureStackTrace(o,Cu),o}}function Ks(n,e,t){if(Cu(n),n?.type!==e){let r=`Expected type ${e} but got ${n?.type}`;throw new Error(t??r)}}f();var Uo=class{backgroundAlpha=1;backgroundColor=new k;width=0;height=0;options={};renderer;constructor(e){try{this.options=e,Ul()?(this.renderer={setSize:()=>{},state:{reset:()=>{}},properties:{get:()=>{}},getSize:()=>({width:window.innerWidth,height:innerHeight}),getDrawingBufferSize:()=>({width:window.innerWidth,height:innerHeight}),getClearAlpha:()=>1,getClearColor:()=>new k,autoUpdate:!0,shadowMap:{autoUpdate:!0},getContext:()=>({getContextAttributes(){return{alpha:!0,antialias:!1,depth:!0,stencil:!1}}}),readRenderTargetPixelsAsync:()=>Promise.resolve([]),setRenderTarget:()=>{},setClearColor:()=>{},clear:()=>{},render:()=>{},clearStencil:()=>{},clearDepth:()=>{},domElement:document.createElement("canvas"),capabilities:{isWebGL2:!0}},this.renderer.domElement.style.width="1920px",Object.defineProperty(this.renderer.domElement,"clientWidth",{configurable:!0,value:1920}),this.renderer.domElement.style.height="1080px",Object.defineProperty(this.renderer.domElement,"clientHeight",{configurable:!0,value:1080})):(this.renderer=new hc({canvas:e.canvas,alpha:e.alpha||!1,stencil:!0,antialias:typeof e.antialias=="boolean"?e.antialias:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.renderer.localClippingEnabled=!0),this.backgroundColor=new k(e.backgroundColor??"#ffffff"),this.backgroundAlpha=e.backgroundAlpha??1}catch(t){_.error(t),e.onWebGLRendererError&&e.onWebGLRendererError(t)}this.domElement()?.addEventListener("webglcontextlost",this.handleWebGLContextLost),this.domElement()?.addEventListener("webglcontextrestored",this.handleWebGLContextRestored),this.domElement()?.addEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError),this.domElement()&&(this.domElement().style.zIndex="1")}destroy(){this.renderer&&this.renderer.dispose?.(),this.domElement()?.removeEventListener("webglcontextlost",this.handleWebGLContextLost),this.domElement()?.removeEventListener("webglcontextrestored",this.handleWebGLContextRestored),this.domElement()?.removeEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}enabledLayers=new Set([0,1]);matricesUpdatedThisFrame=!1;startFrame(){this.matricesUpdatedThisFrame=!1}updateMatricesIfNeeded(e){this.matricesUpdatedThisFrame||(e.updateMatrixWorld(),this.matricesUpdatedThisFrame=!0)}renderScene(e,t){this.renderer&&(this.updateMatricesIfNeeded(e),this.renderer.render(e,t))}renderFullScene(e,t){if(this.renderer){this.renderer.state.reset(),this.updateMatricesIfNeeded(e),this.renderer.clearStencil(),this.renderer.setRenderTarget(null),this.renderer.autoClear=!1,t.layers.disableAll();for(let r of this.enabledLayers.values())t.layers.enable(r);this.renderer.render(e,t),this.renderer.clearDepth(),t.layers.disableAll(),t.layers.enable(ue.ALWAYS_ON_TOP_PATHS),this.renderer.render(e,t),this.renderer.clearStencil(),this.renderer.state.reset()}}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(e,t){E.env.NODE_ENV==="test"||!this.renderer||(this.width=e,this.height=t,this.renderer.setSize(e,t,!1))}setBackgroundColor(e,t){this.backgroundColor=e,this.backgroundAlpha=t}domElement(){return this.renderer?.domElement}handleWebGLContextCreationError=e=>{this.options.onWebGLContextCreationError?.(e)};handleWebGLContextLost=e=>{e.preventDefault(),this.options.onWebGLContextLost?.(e)};handleWebGLContextRestored=e=>{this.options.onWebGLContextRestored?.(e)}};f();f();f();f();var Ho=class{type;event;constructor(e){this.type=0,this.event=e}get timestamp(){return this.event.timeStamp}},Vo=class{taps=[];add(e){this.lastPointerDown&&e.timestamp-this.lastPointerDown.timestamp<50?this.lastPointerDown.type=1:this.taps.push(e)}get lastPointerDown(){return this.taps.length>=1?this.taps[this.taps.length-1]:void 0}get isSingleTapWithTwoFingers(){return this.isSingleTap&&this.lastPointerDown?.type===1}get isSingleTapWithOneFinger(){return this.isSingleTap&&this.lastPointerDown?.type===0}get isDoubleTapWithOneFinger(){return this.isDoubleTap&&this.taps[0]?.type===0&&this.taps[1]?.type===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(e){this.taps=this.taps.filter(t=>e-t.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};f();function ea(n){let e=new Set;for(let t of n){let r=t.object;for(;r.visible&&r.parent&&r.parent.visible===!0&&!e.has(r.parent);)r=r.parent,r instanceof ie&&r.type==="group-container"&&r.visible&&r.components[0]&&e.add(r)}return Array.from(e)}f();function ta(n,e){if(n==null||e==null)return n===e;if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;return!0}var yn=class extends Z{raycaster=new kt;state={hovered3DEntity:void 0,hovered2DEntities:new Set,hovered3DContainers:void 0,lastHover:void 0,interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}};coreState;camera;worldPlane;_quadtree=new gc(new zt(0,0,0,0));_container;lastPointerEvent;cursor="grab";touchesCount=0;isUserMovingCamera;constructor(e,t,r,o,i){super(),this.isUserMovingCamera=i,this.raycaster.layers.enableAll(),this.raycaster.layers.disable(1),this.camera=r,this._container=e,this.coreState=t,this.worldPlane=o,this._container.addEventListener("pointerdown",this.onPointerDown,{capture:!1,signal:this.signal}),this._container.addEventListener("pointermove",this.onPointerMove,{capture:!1,signal:this.signal}),this._container.classList.add("mappedin-interactive")}updateQuadtree(e){this._quadtree=e}setHovered3DEntityInteractionComponentDirty(){if(this.state.hovered3DEntity){let e=this.state.hovered3DEntity.components[2];e&&(e.dirty=!0)}}hasTouched=!1;onPointerMove=co(e=>{e&&(e.preventDefault(),this.updateInteractionStateIfPanning(e),(e.pointerType!=="touch"||e.pointerType===void 0&&this.hasTouched)&&this.handleHover(e),this.handleCursor())},E.env.NODE_ENV==="test"?0:16,{leading:!0});tapsControl=new Vo;getThreeDIntersectsFromXY(e){this.raycaster.setFromCamera(e,this.camera),this.raycaster.layers.enable(ue.GEOMETRY);let t=this.raycaster.intersectObjects(this._hitBoxes.entities,!0).filter(o=>o.object?.name==="worldPlane"||o.object?.visible),r=t.findIndex(o=>o.object?.name==="worldPlane");return r!==-1&&t.push(t.splice(r,1)[0]),t}getGroupContainerIntersectsFromXY(e){let t=this.getThreeDIntersectsFromXY(e),r;return t!=null&&t.length>0&&(r=ea(t)),r}onPointerDown=e=>{e.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,{capture:!1,signal:this.signal}),this._container.addEventListener("pointercancel",this.onPointerUp,{capture:!1,signal:this.signal}),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:e.timeStamp,offsetX:e.offsetX,offsetY:e.offsetY},this.lastPointerEvent=e,this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),e.pointerType==="touch"&&(this.tapsControl.add(new Ho(e)),this.touchesCount=Math.max(0,this.touchesCount+1)))};clickTimeout=void 0;onPointerUp=e=>{this.tapsControl.discardOutsideOfWaitWindow(e.timeStamp),this.lastPointerEvent=e,this.touchesCount=Math.max(0,this.touchesCount-1),this.touchesCount===0&&(this._container.removeEventListener("pointerup",this.onPointerUp,{capture:!1}),this._container.removeEventListener("pointercancel",this.onPointerUp,{capture:!1})),this.updateInteractionStateIfPanning(e);let{mouseDownStart:t}=this.state.interaction;!t||this.state.interaction.distanceFromMouseDown==null||(Date.now()<t.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(e.pointerType==="touch"&&!this.isUserMovingCamera()?this.tapsControl.isSingleTapWithTwoFingers?(this.publish("singletap-with-twofinger",e),this.flush()):this.tapsControl.isSingleTapWithOneFinger&&this.touchesCount===0?(this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickTimeout=window.setTimeout(()=>{this.handleClick(e),this.flush()},300)):this.tapsControl.isDoubleTapWithOneFinger&&(this.publish("doubletap-with-onefinger",e),this.flush()):this.handleClick(e)),this.state.interaction.mouseDownStart=void 0,this.state.interaction.distanceFromMouseDown=void 0,this.state.interaction.isPanning=!1,this.handleCursor())};flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(e){let t=e||this.lastPointerEvent;if(t?.pointerType==="touch"||this.state.interaction.mouseDownStart||!t||this.isUserMovingCamera())return;let{entity3D:r,entity2D:o,position:i,groupContainers:s}=this.intersect(t);(this.detect3DEntityHover(r)||this.detect2DEntityHover(o)||this.detect3DContainerHover(s))&&(this.state.hovered3DEntity=r,this.state.lastHover=r,this.state.hovered2DEntities=new Set(o.map(a=>a.id)),this.state.hovered3DContainers=s,this.publish("hover",{entity2D:o,entity3D:this.state.hovered3DEntity,position:i,groupContainers:s})),this.handleCursor()}handleCursor(){let e=!!(this.state.hovered3DEntity&&this.state.hovered3DEntity?.components[2]||this.state.hovered2DEntities.size>0),t=!!this.state.interaction.mouseDownStart,r=this.state.interaction.isPanning,o=Up(e,r,t);this.cursor!==o&&(this.cursor=o,o==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}detect2DEntityHover(e){if(e.length!==this.state.hovered2DEntities.size)return!0;for(let t=0;t<e.length;t++)if(!this.state.hovered2DEntities.has(e[t].id))return!0;return!1}handleClick(e){let t=this.intersect(e);this.publish("click",{entity2D:t.entity2D,entity3D:t.entity3D,position:t.position,groupContainers:t.groupContainers,pointerEvent:{button:e.button}})}dirty3D=!0;cachedHitBoxes={entities:[]};get _hitBoxes(){if(this.dirty3D){this.cachedHitBoxes.entities=[];let e;for(let t of this.coreState.geometry3DIdsInScene)if(e=this.coreState.geometry3DMap.get(t),e?.type==="geometry"||e?.type==="model"||e?.type==="path"||e?.type==="custom-geometry"||e?.type==="image"){let r=e.components[0];if(r instanceof oe&&r.pointerEventsPassThrough)continue;r.mesh&&!this.cachedHitBoxes.entities.includes(r.mesh)&&this.cachedHitBoxes.entities.push(r.mesh)}return this.dirty3D=!1,this.cachedHitBoxes.entities.push(this.worldPlane),this.cachedHitBoxes}return this.cachedHitBoxes}ndcPoint=new V;intersect(e){let{offsetX:t,offsetY:r}=e,o=[t,r],s=this._quadtree.queryPoint(o).filter(y=>y.intersectsPoint(o));this.ndcPoint.x=t/this._container.clientWidth*2-1,this.ndcPoint.y=-(r/this._container.clientHeight)*2+1;let a=this.getThreeDIntersectsFromXY(this.ndcPoint),l=[],c=[],u=[],d;for(let y of a){if(y.object.name==="worldPlane"){d??=y;continue}if(y.object.name==="hole-fill-mesh"||!(y.object instanceof W)||y.object.material?.colorWrite===!1)continue;let v=y?.instanceId??y?.batchId,x=v!=null&&y?.object.userData.entities?y.object.userData.entities[v]:y.object.userData?.entityId,S=x?this.coreState.geometry3DMap.get(x):void 0;if(S instanceof $){let D=S.components[0];if(D instanceof oe&&D.pointerEventsPassThrough)continue}let w=y.object.userData?.entityId;if(w){let C=this.coreState.geometry3DMap.get(w)?.components[7];if(C?.verticalOffset!=null&&y.point.z>C.verticalOffset)continue}u.push(y),y.object.material.depthTest===!1?l.push(y):c.push(y)}let h=l[0]??c[0]??void 0,g=h?.point??d?.point,b,M;if(h!=null){let y=h?.instanceId??h?.batchId;b=y!=null&&h?.object.userData.entities?this.coreState.geometry3DMap.get(h?.object.userData.entities[y]):this.coreState.geometry3DMap.get(h?.object.userData.entityId),b?.components[2]&&(M=b)}let m=ea(u),p=[];for(let y of s)if(y?.userData?.entityId==="watermark")p.push({id:"watermark"});else{let v=this.coreState.geometry2DMap.get(y?.userData.entityId);v&&p.push(v)}return Hp(p),{entity2D:p,entity3D:M,position:g,groupContainers:m.length>0?m:void 0}}detect3DEntityHover(e){return this.state.lastHover!==e&&(this.state.lastHover&&Tu(this.state.lastHover,!1,this.coreState),e&&Tu(e,!0,this.coreState)),this.state.hovered3DEntity!==e}detect3DContainerHover(e){return!ta(this.state.hovered3DContainers,e)}updateInteractionStateIfPanning(e){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(e.offsetX-this.state.interaction.mouseDownStart.offsetX,2)+Math.pow(e.offsetY-this.state.interaction.mouseDownStart.offsetY,2)),!this.state.interaction.isPanning&&this.state.interaction.distanceFromMouseDown>15&&(this.state.interaction.isPanning=!0))}getMouseRayIntersects(){return this.raycaster.intersectObjects([this.worldPlane],!1)}destroy(){this._container.removeEventListener("pointerdown",this.onPointerDown,{capture:!1}),this._container.removeEventListener("pointermove",this.onPointerMove,{capture:!1}),this._container.removeEventListener("pointerup",this.onPointerUp,{capture:!1}),this._container.removeEventListener("pointercancel",this.onPointerUp,{capture:!1}),super.destroy()}debugPanel;enableDebug(){let e=document.createElement("div");e.style.position="absolute",e.style.top="0",e.style.right="0",e.style.backgroundColor="white",e.style.padding="10px",document.body.append(e),e.id="interaction-debug-panel",this.debugPanel=e,this.on("doubletap-with-onefinger",()=>{this.queueDebugMessage("doubletap-with-onefinger","#ffadad")}),this.on("singletap-with-twofinger",()=>{this.queueDebugMessage("singletap-with-twofinger","#ffd6a5")}),this.on("click",t=>{this.queueDebugMessage(`CLICK
|
|
2
2
|
3D: ${t.entity3D?.id}
|
|
3
3
|
2D: ${t.entity2D?.map(r=>r.id).join(", ")}
|
|
4
4
|
Pos: ${t.position?.toArray().join(", ")}`,"#fdffb6")}),this.on("hover",t=>{this.queueDebugMessage(`HOVER
|
|
5
5
|
3D: ${t.entity3D?.id}
|
|
6
6
|
2D: ${t.entity2D?.map(r=>r.id).join(", ")}
|
|
7
|
-
Pos: ${t.position?.toArray().join(", ")}`,"#caffbf")})}get _state(){return this.state}queueDebugMessage(e,t){let r=document.createElement("pre");r.style.maxWidth="300px",r.style.transition="opacity 500ms cubic-bezier(0.4, 0, 0.2, 1)",r.style.backgroundColor=t,r.textContent=e,this.debugPanel?.prepend(r),setTimeout(()=>{r.style.opacity="0",setTimeout(()=>{r.remove()},500)},2500)}getCursor(){return this.cursor}};function Tu(n,e,t){let r=n.components[2];r&&r.hover!==!0&&(r.hover=e?"user-interaction":!1,r.dirty=!0);let o=n.components[0].textMesh?.userData.entityId;if(!o)return;let i=t.geometry3DMap.get(o);i?.type==="text3d"&&(i.components[1].hoverByPolygon=e,i.components[1].dirty=!0)}function Up(n,e,t){return e?"grabbing":n?"pointer":t?"grabbing":"grab"}function Hp(n){if(n.length<=1)return;let e=[],t=[],r=[];for(let i=0;i<n.length;i++){let s=n[i];s.components?s.type==="marker"?e.push(s):t.push(s):r.push(s)}if(e.length>1){let i,s;e.sort((a,l)=>{i=a.components[0],s=l.components[0];let c=i.projection.y,u=s.projection.y;return c!==u?u-c:i.markerContainer.compareDocumentPosition(s.markerContainer)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1})}if(t.length>1){let i=[];for(let s=0;s<t.length;s++){let a=t[s],l=a.components[0];i.push({entity:a,y:l.projection.y,idx:s})}i.sort((s,a)=>s.y!==a.y?a.y-s.y:a.idx-s.idx);for(let s=0;s<i.length;s++)t[s]=i[s].entity}let o=0;for(let i=0;i<e.length;i++)n[o++]=e[i];for(let i=0;i<t.length;i++)n[o++]=t[i];for(let i=0;i<r.length;i++)n[o++]=r[i]}f();f();f();var Du=new Y;function bn(n,e=!0){let t=new Ft,r=n.mesh?.geometry;if(!r||!n.batchedProps?.range)return;let o=n.batchedProps.range,i=o.start,s=o.count,a=r.getAttribute("position");if(a){let u=new Float32Array(s*3);for(let d=0;d<s;d++){let h=i+d;u[d*3]=a.array[h*3],u[d*3+1]=a.array[h*3+1],u[d*3+2]=a.array[h*3+2]}t.setAttribute("position",new ke(u,3))}let l=r.getAttribute("normal");if(l){let u=new Float32Array(s*3);for(let d=0;d<s;d++){let h=i+d;u[d*3]=l.array[h*3],u[d*3+1]=l.array[h*3+1],u[d*3+2]=l.array[h*3+2]}t.setAttribute("normal",new ke(u,3))}let c=r.getAttribute("uv");if(c){let u=new Float32Array(s*2);for(let d=0;d<s;d++){let h=i+d;u[d*2]=c.array[h*2],u[d*2+1]=c.array[h*2+1]}t.setAttribute("uv",new ke(u,2))}if(r.index){let u=r.index,d=new Uint32Array(s);for(let h=0;h<s;h++)d[h]=u.array[i+h];t.setIndex(new ke(d,1))}if(e&&n.instanceIndex!==-1&&kr(n.mesh))try{n.mesh.getMatrixAt(n.instanceIndex,Du),t.applyMatrix4(Du)}catch(u){_.error(u)}return t}function Pu(n,e,t){let r=bn(n,!1);if(!r||!kr(n.mesh))return;n.mesh.getMatrixAt(n.instanceIndex,t),n.mesh.deleteInstance(n.instanceIndex),n.mesh.optimize();let o=e.addGeometry(r);e.addInstance(o),e.setMatrixAt(o,t);let i=e.getGeometryIdAt(o),s=e.getGeometryRangeAt(i);return s&&n.batchedProps&&(n.batchedProps.range=s),r.dispose(),o}function Iu(n,e){if(e===0)return;let t=n.getAttribute("position");for(let r=0;r<t.count;r++)t.setZ(r,t.getZ(r)+e);t.needsUpdate=!0}var vn=class{#e=null;#n;constructor(e){this.#n=e}getCurrentSceneGLTF=async e=>{let t={onlyVisible:!0,binary:!0,light:!0,scale:1,...e},r=await this.#o(),o=this.#i(t),i=await r.parseAsync(o,{trs:!1,maxTextureSize:1/0,onlyVisible:t.onlyVisible,binary:t.binary,scale:t.scale}),s;if(i instanceof ArrayBuffer)s=new Blob([i],{type:"application/octet-stream"});else{let a=JSON.stringify(i,null,2);s=new Blob([a],{type:"text/plain"})}return s};#i=e=>{let{scale:t,light:r,onlyVisible:o}=e,i=new St,s=new ce().setFromObject(this.#n.geometryScene);if(this.#s(this.#n.geometryScene,i,o),r){let a=new Co(16777215,.3*Math.PI);a.position.set(0,Math.max(s.max.x,s.max.y)*t*.5,s.max.y*t*4),a.lookAt(0,0,-1),a.target.position.set(0,0,-1),a.add(a.target),i.add(a)}return i};async#o(){if(!this.#e){let{GLTFExporter:e}=await import("./GLTFExporter-TPBX6R3U.js");this.#e=new e}return this.#e}#s=(e,t,r)=>{e.material&&e instanceof xo&&this.#a(e).forEach(o=>t.add(o)),e.children.forEach(o=>{(!r||o.visible)&&this.#s(o,t,r)})};#l=(e,t,r)=>{let o=new un({color:new k(e),metalness:0});return o.opacity=t,o.transparent=r,o};#a(e){let t=[],o=(e.userData?.entities?Object.values(e.userData?.entities):[]).map(a=>this.#n.geometry3DMap.get(a)),i=new Map;e.updateWorldMatrix(!0,!1);let s=new O;return e.getWorldPosition(s),o.forEach(a=>{if(!a||!(a instanceof $))return;let l=a.components[1],c=a.components[2];if(!l.visible||l instanceof ct&&l.opacity===0||l instanceof pn||l instanceof _o)return;let d=`${c?.hover?l.hoverColor||this.#n.hoverColor:l.color}-${l.opacity}-${Number(l.visible)}`;i.has(d)||i.set(d,[]),i.get(d)?.push(a)}),i.forEach((a,l)=>{let[c,u,d]=l.split("-"),h=a.reduce((m,p)=>{if(p.type==="custom-geometry")return m;let y=p.components[0];if("geometry"in y&&y.geometry instanceof Ft){let v=y.geometry.clone();Iu(v,s.z),m.push(v)}else if(y instanceof oe&&y.batchedProps){let v=bn(y);v&&(Iu(v,s.z),m.push(v))}return m},[]);if(h.length===0){_.error("No geometries found for batched mesh");return}let g=this.#l(c,Number(u),e.material.transparent),b=ze(h,!0);if(!b){_.error("No merged geometry found for batched mesh");return}let M=new V(b,g);M.position.copy(e.position),M.rotation.copy(e.rotation),M.scale.copy(e.scale),M.visible=!!d,this.#d(M.position,M.scale,M.rotation,M.quaternion),t.push(this.#h(M))}),t}#h=e=>{let{geometry:t,material:r,position:o,rotation:i,quaternion:s,scale:a}=e;if(!t?.isBufferGeometry)return e;let l=t.attributes.position,c=t.attributes.normal,u=t.attributes.uv;return this.#y(l,c),this.#d(o,a,i,s),u&&this.#r(u),r?.map&&t.type==="PlaneGeometry"&&(e.side=Rt),e};#y=(e,t)=>{let r=new O,o=new O;for(let i=0;i<e.count;i++)r.fromBufferAttribute(e,i),this.#t(r),e.setXYZ(i,r.x,r.y,r.z),t&&(o.fromBufferAttribute(t,i),this.#t(o),t.setXYZ(i,o.x,o.y,o.z))};#t=e=>{let t=e.y;e.y=e.z,e.z=-t};#d=(e,t,r,o)=>{let i=e.y;e.y=e.z,e.z=-i;let s=t.y;if(t.y=t.z,t.z=s,r instanceof xt)r.order="YXZ",r.set(r.x,r.y,r.z,r.order);else{let a=o.y;o.set(o.x,o.z,-a,o.w)}};#r=e=>{for(let t=0;t<e.count;t++){let r=e.getX(t),o=e.getY(t);e.setXY(t,r,o)}};destroy(){this.#e=null}};f();f();var Wp="gray",Vp=.1,xn=100,na=new lt.ClipperOffset;function Sn(n){let e=n.length;if(e<2)return e;let t=n[0],r=n[e-1];return t.x===r.x&&t.y===r.y?e-1:e}function oa(n,e){if(e<3)return 0;let t=0,r=0,o=0,i=0;for(let a=1;a<e;a++)n[a].x<n[t].x&&(t=a),n[a].y<n[r].y&&(r=a),n[a].x>n[o].x&&(o=a),n[a].y>n[i].y&&(i=a);let s=a=>a===t||a===r||a===o||a===i;for(let a=0;a<e;a++){let l=(a+e-1)%e;if(!s(a)&&!s(l))return a}for(let a=0;a<e;a++)if(!s(a))return a;return(t-(e>>1)+e)%e}function jp(n,e){na.Clear(),e/=2;let t=n.map(o=>({X:o.x*xn,Y:o.y*xn}));na.AddPath(t,lt.JoinType.jtMiter,lt.EndType.etClosedPolygon);let r=new lt.Paths;return na.Execute(r,e*xn),r.length?r.map(i=>i.map(s=>({x:s.X/xn,y:s.Y/xn}))):[n]}function jo(n,e,t){let{color:r=Wp,opacity:o=1,altitude:i=0,height:s=Vp}=t||{};Array.isArray(o)&&(o=1);let a={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:s+i},center:{x:0,y:0,z:(s+i)/2}},c=n.geometry.coordinates[0].map(g=>{let b=e(g[1],g[0]);return a.min.x=Math.min(a.min.x,b.x),a.min.y=Math.min(a.min.y,b.y),a.max.x=Math.max(a.max.x,b.x),a.max.y=Math.max(a.max.y,b.y),b});n.properties?.style?.edgeOffset!=null&&n.properties.style.edgeOffset!==0||n.properties?.image!=null?c=jp(c,n.properties?.style?.edgeOffset||0):c=[c];let u=[];for(let g of c){let b=new Rr,M=Sn(g),m=oa(g,M);b.moveTo(g[m].x,g[m].y);for(let x=1;x<M;x++){let S=(m+x)%M;b.lineTo(g[S].x,g[S].y)}let p=n.geometry.coordinates.slice(1);b.holes=p.map(x=>{let S=x.map(C=>e(C[1],C[0])),w=new Ar,D=Sn(S);w.moveTo(S[0].x,S[0].y);for(let C=1;C<D;C++)w.lineTo(S[C].x,S[C].y);return w});let y=hn(t?.bevel,s),v=new _r(b,y);v.userData={style:{color:r,opacity:o},usedBevelSettings:y},u.push(v)}if(u.length===1)return u[0];let d=ze(u);u.forEach(g=>g.dispose());let h=hn(t?.bevel,s);return d.userData={style:{color:r,opacity:o},usedBevelSettings:h,_split:!0},d}f();var Zp="gray",Xp=.1;function Zo(n,e,t){let{color:r=Zp,opacity:o=1,altitude:i=0,height:s=Xp}=t||{};Array.isArray(o)&&(o=1);let a={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:s+i}},l=hn(t?.bevel,s),c=[];n.geometry.coordinates.forEach(d=>{let h=new Rr,g=d[0].map(y=>{let v=e(y[1],y[0]);return a.min.x=Math.min(a.min.x,v.x),a.min.y=Math.min(a.min.y,v.y),a.max.x=Math.max(a.max.x,v.x),a.max.y=Math.max(a.max.y,v.y),v}),b=Sn(g),M=oa(g,b);h.moveTo(g[M].x,g[M].y);for(let y=1;y<b;y++){let v=(M+y)%b;h.lineTo(g[v].x,g[v].y)}let m=d.slice(1);h.holes=m.map(y=>{let v=y.map(w=>e(w[1],w[0])),x=new Ar,S=Sn(v);x.moveTo(v[0].x,v[0].y);for(let w=1;w<S;w++)x.lineTo(v[w].x,v[w].y);return x});let p=new _r(h,l);c.push(p)});let u=ze(c);return c.forEach(d=>d.dispose()),u.userData={style:{color:r,opacity:o},usedBevelSettings:l},u}f();var Ae=100,Yp=.22,$p=.01;function Ou(n,e,t={}){let{width:r=Yp,height:o=$p,color:i="gray",opacity:s=1,altitude:a=0}=t,l={min:{x:1/0,y:1/0,z:a},max:{x:-1/0,y:-1/0,z:a+o}},c={bevelEnabled:!1,depth:o},u=new lt.ClipperOffset,d=n.geometry.coordinates.map(M=>M.map(m=>e(m[1],m[0])));u.AddPaths(d.map(M=>M.map(m=>({X:m.x*Ae,Y:m.y*Ae}))),lt.JoinType.jsMiter,lt.EndType.etOpenRound);let h=new lt.PolyTree;u.Execute(h,r/2*Ae);let g=[];for(let M of h.m_AllPolys){let m=new Rr;if(M.IsHole())continue;l.min.x=Math.min(l.min.x,M.m_polygon[0].X),l.min.y=Math.min(l.min.y,M.m_polygon[0].Y),l.max.x=Math.max(l.max.x,M.m_polygon[0].X),l.max.y=Math.max(l.max.y,M.m_polygon[0].Y);let p=M.m_polygon;m.moveTo(p[0].X/Ae,p[0].Y/Ae),p.slice(1).forEach(y=>m.lineTo(y.X/Ae,y.Y/Ae)),m.lineTo(p[0].X/Ae,p[0].Y/Ae),m.holes=M.m_Childs.map(y=>{let v=new Ar,x=y.m_polygon;return v.moveTo(x[0].X/Ae,x[0].Y/Ae),x.slice(1).forEach(S=>v.lineTo(S.X/Ae,S.Y/Ae)),v.lineTo(x[0].X/Ae,x[0].Y/Ae),v}),g.push(new _r(m,c))}let b=ze(g);return b.translate(0,0,a||0),b.userData={style:{color:i,opacity:s}},u.Clear(),b}function qp(n){let e=n[1],t=n[6],{opacity:r}=e??{},{texture:o,topTexture:i}=t??{};return`${r}${o?.path||""}${i?.path||""}`}var Xo=class extends Z{state;convertTo3DMapPosition;constructor(e,t){super(),this.state=e,this.convertTo3DMapPosition=t}createEntityFromFeature(e,t,r){let o=new oe(t),i=Array.isArray(t)?t[0]?.properties:t.properties,s=i?.bevel,a=r&&"bevel"in r?r.bevel:void 0,l;a?l={...s,...a}:s&&(l=s);let c=new $(o,new ct({...r,url:i?.image?.path,bevel:l}));if(r?.outline){let u=this.state.outlinesOptions?.darkenFactor;c.components[3]=new kc(Wc(r.color,u))}return r?.focusable&&(c.components[4]=new $c),i?.textures!=null&&Array.isArray(i.textures)&&i.textures.length>0?c.components[6]=new pr(i.textures.find(u=>u.face==="side"),i.textures.find(u=>u.face==="top")):(r!=null&&"texture"in r&&r.texture!=null||r!=null&&"topTexture"in r&&r.topTexture!=null)&&(c.components[6]=new pr(r.texture,r.topTexture)),c.id=Array.isArray(t)?e+"-merged":e,c}populateEntityMesh(e,t,r=!1){let o=e.components[0];o.geometry=t,r||(o.batchedProps={range:{start:0,count:1/0,indexCount:1/0,indexStart:0,vertexCount:1/0,vertexStart:0,reservedVertexCount:1/0,reservedIndexCount:1/0},geometryId:-1,positionCount:t.attributes.position.count}),o.currentHeight=e.components[1].height,e.components[1].initialHeight=e.components[1].height,o.dirty=!1}populateEntityGroup(e){let t,r,o;for(let i of e.values())if(o=this.state.geometry3DMap.get(i),o.components[0]instanceof oe){t=o.components[0].feature,r=o.components[1];try{if(Array.isArray(t)){let s=[];for(let l of t){let c=this.#e(l,r);c!=null&&s.push(c)}let a=ze(s);this.populateEntityMesh(o,a,!0),s.forEach(l=>l.dispose())}else{let s=this.#e(t,r);s!=null&&this.populateEntityMesh(o,s)}}catch(s){_.warn(`Failed to create mesh for entity ${i}:`,s)}}return e}#e(e,t){let r;return e.geometry.type==="Polygon"?(r=jo(e,this.convertTo3DMapPosition,t),e.properties?.textures&&e.properties.textures.length>0&&Vc(r,e.properties.textures,this.state.naturalBearing,this.convertTo3DMapPosition)):e.geometry.type==="MultiPolygon"?r=Zo(e,this.convertTo3DMapPosition,t):e.geometry.type==="LineString"?r=vu(e,this.convertTo3DMapPosition,t):e.geometry.type==="MultiLineString"&&(r=Ou(e,this.convertTo3DMapPosition,t)),r}update(){for(let e of this.state.geometryGroupIdsToLoad.values()){let t=this.state.geometry3DMap.get(e);if(t instanceof Ce&&t.userData.dirty&&!t.userData.modelURL){try{this.populateEntityGroup(t.userData.entities3D)}catch(i){_.warn(i)}let r,o={};if(t.userData.isMerged){let i=t.userData.entities3D.values().next().value;if(i&&(r=this.state.geometry3DMap.get(i),r?.type==="geometry")){let s=r.getComponent("geometry"),a=r.getComponent("style");if(s&&a){let l=new pc({color:a.color}),c=new Wt(s?.geometry,l);l.setColor(new k(a.color),new k(a.topColor??a.color)),c.renderOrder=ue.GEOMETRY,c.frustumCulled=!0,c.userData.entityId=r.id,c.layers.enable(Oe.SHOULD_CAST_SHADOWS),s.mesh=c,s.material=l,t.add(c)}}}else{for(let i of t.userData.entities3D.values()){r=this.state.geometry3DMap.get(i);let s=r?.components[0];if(r?.type==="geometry"){let a=qp(r.components);o[a]===void 0&&(o[a]={style:r.components[1],entities:[]}),o[a].entities.push(r)}else s&&"mesh"in s&&s.mesh&&s.mesh?.parent!==t&&t.add(s.mesh)}for(let i in o){let s=Hc(o[i].entities,o[i].style);s.layers.enable(Oe.SHOULD_CAST_SHADOWS),t.add(s)}}for(let i of t.userData.entities3D.values())if(r=this.state.geometry3DMap.get(i),r!=null&&r.entities2D.size>0)for(let s of r.entities2D.values())s&&(r.attach(s),this.publish("geometry-2d-added"));this.publish("geometry-group-added"),t.userData.dirty=!1,t.userData.localCenter=void 0}}return Promise.resolve()}};f();var Yo=new ce,Lu=new O;function Jp(n,e){let t=n.components[2],r=n.components[1];return t?.hover?[r.hoverColor||e,r.hoverColor||e]:[r.color,r.topColor||r.color]}var $o=class{state;transparencyChanged=!1;convertTo3DMapPosition;convert3DMapPositionToCoordinate;constructor(e,t,r){this.convertTo3DMapPosition=t,this.convert3DMapPositionToCoordinate=r,this.state=e}determineTextureVisiblity(e,t,r){let o=mn(e);(o?.texture!=null||o?.topTexture!=null)&&(r?.hover&&o.texturesVisible?o.hideTextures(e.instanceIndex):o.texturesVisible||o.showTextures(e.instanceIndex),t.texture==null&&o.removeSideTexture(e.instanceIndex),t.topTexture==null&&o.removeTopTexture(e.instanceIndex))}update(){let e,t;for(let r of this.state.geometry3DsInScene)if((r.type==="geometry"||r.type==="custom-geometry")&&(r.components[1]?.dirty||r.components[2]?.dirty)){let o=r.components[0],i=r.components[1];t=r.components[2];let s=Jp(r,this.state.hoverColor);o.setColor(s[0],s[1]);let a=mn(o);if(i.visible!==o.visible&&(o.visible=i.visible,o instanceof oe&&o.textMesh)){let c=this.state.geometry3DMap.get(o.textMesh.userData.entityId);c?.type==="text3d"&&c.components[0].polygonEntityId!=null&&(c.components[0].visible=i.visible)}i.altitude!==o.altitude&&(o.altitude=i.altitude);let l=i.opacity*Gr(r);if(a&&o.mesh&&o.type==="geometry"&&l!==o.opacity){if(a.opacity=l,a.transparent=l<1,o.imageMesh){let c=Array.isArray(o.imageMesh.material)?o.imageMesh.material:[o.imageMesh.material];for(let u of c)u.opacity=l}l===0?(o.mesh.layers.disable(Oe.SHOULD_CAST_SHADOWS),this.transparencyChanged=!0):o.opacity===0&&l!==0&&(o.mesh.layers.enable(Oe.SHOULD_CAST_SHADOWS),this.transparencyChanged=!0),o.opacity=l}if(i.renderOrder!==o.renderOrder&&(o.renderOrder=i.renderOrder),a&&Uc(a,i.side,l),a&&(a.setEffectRange(i.effectStart,i.effectDistance),a.setVisualEffect(i.darkenAmount,i.darkenUseDepth,i.desaturateAmount,i.desaturateUseDepth,i.washOutAmount,i.washOutUseDepth)),o instanceof oe&&i.shading!=null&&(i.shading?.start!==a?.getGradientShading().start||i.shading?.end!==a?.getGradientShading().end||i.shading?.intensity!==a?.getGradientShading().intensity)&&a?.setGradientShading(i.shading?.start??0,i.shading?.end??0,i.shading?.intensity??0),i.dirty=!1,o instanceof oe){let c=r.components[6];c instanceof pr&&this.determineTextureVisiblity(o,c,t)}r.components[2]&&(r.components[2].dirty=!1)}else if(r?.type==="image"&&r.components[1]?.dirty){e=r.components[0];let o=r.components[1];o.visible!==e.visible&&(e.visible=o.visible),o.dirty=!1}else if(r?.type==="text3d"&&r.components[1]?.dirty){e=r.components[0];let o=r.components[1],i=e.polygonEntityId!=null;o.visible!=null&&o.visible!==e.visible&&(e.visible=o.visible);let{textMesh:s}=e;if(s)if(Object.assign(s,o.getState()),i){let a=o.hoverColor??this.state.text3dHoverColor;s.color=o.hoverByPolygon?a:o.color??Ct.color,s.outlineColor=o.hoverByPolygon?a:o.outlineColor??Ct.outlineColor,s.strokeColor=o.hoverByPolygon?a:o.strokeColor??Ct.strokeColor}else s.color=o.color??Ct.color,s.outlineColor=o.outlineColor??Ct.outlineColor,s.strokeColor=o.strokeColor??Ct.strokeColor;o.dirty=!1}else if(r?.type==="feature-collection"&&r?.userData.dirty===!1&&r?.userData.positionDirty){let o=r;if(o.userData.localCenter||(Yo.makeEmpty(),Yo.setFromObject(o),Nr(Yo)&&(Yo.getCenter(Lu),o.userData.localCenter=Lu.clone())),!o.userData.centroid&&o.userData.localCenter){let i=this.convert3DMapPositionToCoordinate(o.userData.localCenter);o.userData.centroid=[i[0],i[1]]}if(o.userData.centroid&&o.userData.localCenter){let i=this.convertTo3DMapPosition(o.userData.centroid);o.position.x+=i.x-o.userData.localCenter.x,o.position.y+=i.y-o.userData.localCenter.y,o.userData.localCenter.set(i.x,i.y,o.userData.localCenter.z),o.userData.positionDirty=!1}}}endFrame=()=>{this.transparencyChanged=!1}};f();var qo=class extends Z{state;renderer;mode;scene;cameraObject;viewCamera;systems;constructor(e,t,r,o,i,s,a){super(),this.renderer=e,this.state=t,this.mode=r,this.scene=o,this.cameraObject=i,this.viewCamera=s,this.systems=a,this.systems.cameraSystem.on("pan-start",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!1,{signal:this.signal}),this.systems.cameraSystem.on("zoom-start",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!1,{signal:this.signal}),this.systems.cameraSystem.on("zoom-end",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!0,{signal:this.signal}),this.systems.cameraSystem.on("rotate-start",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!1,{signal:this.signal}),this.systems.cameraSystem.on("rotate-end",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!0,{signal:this.signal})}twoDdirty=!0;threeDdirty=!0;frameId=null;update=(e=!1)=>{if(this.renderer?.renderer==null)return Promise.resolve();if(e){this.renderer.startFrame();let t=this.commitRenderState();return this.paint(),t}else return this.frameId?Promise.resolve():new Promise((t,r)=>{this.frameId=requestAnimationFrame(()=>this.renderer?.renderer==null?t():this.mode==="standalone"?(this.renderer.startFrame(),this.commitRenderState()?.then(()=>{this.paint(),t()}).catch(o=>{r(o)})):t())})};paint(){if(!this.renderer?.renderer)return;this.mode==="standalone"&&this.renderer.clear();let e=!this.state.useStandaloneCamera&&this.mode!=="standalone";e&&(this.viewCamera.matrixWorld.copy(this.cameraObject.matrixWorld),this.viewCamera.matrixWorldInverse.copy(this.cameraObject.matrixWorldInverse),this.viewCamera.projectionMatrix.multiply(this.cameraObject.matrixWorld)),this.renderer.renderFullScene(this.scene,e?this.viewCamera:this.cameraObject),e&&(this.viewCamera.projectionMatrix.multiply(this.cameraObject.matrixWorldInverse),this.viewCamera.matrixWorldInverse.identity())}commitRenderState=()=>{try{let e=[];this.frameId=null,this.publish("pre-render"),this.state.internalTweenGroup.update(),this.state.externalTweenGroup.update(),(this.mode==="outdoors-interleaved"||this.mode==="standalone")&&this.systems.cameraSystem.update(),this.state.shouldMeasureCanvas&&(this.state.shouldMeasureCanvas=!1,this.publish("measure-canvas")),this.twoDdirty&&(this.state.geometry2DIdsInScene.clear(),this.state.geometry2DsInScene.clear(),Lc(this.state.geometryScene,this.state.geometry2DMap,this.state.geometry2DIdsInScene,this.state.geometry2DsInScene),this.systems.twoDEntitySystem.syncTwoDEntities(),this.systems.twoDEntitySystem.markDirty(),this.twoDdirty=!1),this.threeDdirty&&(this.state.geometry3DIdsInScene.clear(),this.state.geometry3DsInScene.clear(),this.state.geometryGroupIdsToLoad.clear(),Oc(this.state.geometryScene,this.state.geometry3DMap,this.state.geometry3DIdsInScene,this.state.geometry3DsInScene,this.state.geometryGroupIdsToLoad),this.systems.interactionSystem.dirty3D=!0,this.systems.outlineInterpolationSystem.geometries3DDirty=!0,this.systems.geometryInFocusSystem.focusablesDirty=!0,this.systems.shadowsSystem&&(this.systems.shadowsSystem.needsRender=!0),this.threeDdirty=!1);let t=this.systems.batchedMeshSystem.update();t&&e.push(t);let r=this.systems.modelSystem.update();return r&&e.push(r),this.systems.borderSystem.update(),this.systems.meshDetachmentSystem.update(),this.systems.meshModificationSystem.update(),this.systems.renderOrderSystem.update(),this.systems.clippingPlaneSystem.update(),this.systems.imageSystem.update(this.systems.cameraSystem.getRotation(),this.systems.cameraSystem.isCameraMoving(),this.systems.cameraSystem.lastCameraStoppedMovingTime()),e.push(this.systems.text3DSystem.update(this.systems.cameraSystem.getRotation())),this.systems.customGeometrySystem.update(),this.systems.panBoundsSystem.update(),this.systems.geometryInFocusSystem.update(this.systems.cameraSystem.isCameraMoving(),this.systems.cameraSystem.lastCameraStoppedMovingTime()),this.systems.outlineInterpolationSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.zoomDirty),this.systems.pathSystem.update(this.systems.cameraSystem.minZoomAltitude,this.systems.cameraSystem.maxZoomAltitude,this.systems.cameraSystem.getZoomAltitude(),this.systems.cameraSystem.getCurrentMetersPerPixel()),this.systems.cameraSystem.postRender(),this.systems.occlusion2DSystem.update(),this.systems.watermarkSystem.insertIntoQuadTree(this.systems.twoDEntitySystem.interactiveCollidersQTree),this.systems.interactionSystem.updateQuadtree(this.systems.twoDEntitySystem.interactiveCollidersQTree),this.systems.twoDEntitySystem.updateWatermark({width:this.systems.watermarkSystem.width,height:this.systems.watermarkSystem.height,position:this.systems.watermarkSystem.options.position}),this.systems.twoDEntitySystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.isUserInteracting(),this.systems.cameraSystem.isCameraMoving(),this.systems.imageSystem.currentImageScreenBBoxes),this.systems.watermarkSystem.update(),this.systems.textureSystem.update(),this.systems.pluginSystem.update(this.state),this.systems.drawSystem.update(),this.systems.geometryDisposalSystem.update(),this.systems.maskingSystem.update(),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1,this.systems.cameraSystem.rotationDirty=!1,this.systems.shadowsSystem&&((this.systems.modelSystem.transparencyChanged||this.systems.drawSystem.transparencyChanged)&&(this.systems.shadowsSystem.needsRender=!0),this.systems.shadowsSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.getPedestal())),this.systems.modelSystem.endFrame(),this.systems.drawSystem.endFrame(),this.systems.cameraSystem.stateDirty&&(this.publish("camera-state-change"),this.systems.cameraSystem.stateDirty=!1),this.publish("post-render"),Promise.all(e)}catch(e){return Promise.reject(e)}};destroy(){this.frameId&&cancelAnimationFrame(this.frameId),this.systems.twoDEntitySystem.cancelPendingFrames(),this.state.geometry2DIdsInScene.clear(),this.state.geometry3DIdsInScene.clear(),this.systems.twoDEntitySystem.markDirty(),this.update(),super.destroy()}};f();f();f();f();f();import{z as F}from"zod";f();import{z as Jo}from"zod";var zr=Jo.object({type:Jo.enum(["Point"]),coordinates:Jo.array(Jo.number()).min(2).max(3)});var Kp=F.object({interactive:F.boolean().optional(),id:F.string().optional(),width:F.union([F.number(),F.string().regex(fo),F.object({on:F.literal("zoom-level").optional(),input:F.array(F.number()).nonempty(),output:F.union([F.array(F.number()).nonempty(),F.array(F.string().regex(fo)).nonempty()]),easing:F.string().optional()})]).optional(),accentColor:F.string().optional(),displayArrowsOnPath:F.boolean().optional(),animateArrowsOnPath:F.boolean().optional(),visibleThroughGeometry:F.boolean().optional(),dashed:F.boolean().optional(),travelledEndFraction:F.number().optional(),travelledColor:F.string().optional(),smoothingTension:F.number().optional(),smoothingCornerRadius:F.number().optional(),dashLength:F.number().optional(),dashGap:F.number().optional(),dashRelativeToWidth:F.boolean().optional(),dashSize:F.number().optional(),gapSize:F.number().optional(),dashAbsolute:F.boolean().optional(),dashMeters:F.number().optional(),gapMeters:F.number().optional(),__EXPERIMENTAL_GEOMETRY:F.enum(["tube","ribbon"]).optional(),__EXPERIMENTAL_ENDCAP_EXTENSION:F.tuple([F.number(),F.number()]).optional(),__EXPERIMENTAL_BILLBOARDING:F.union([F.boolean(),F.number().min(0).max(90)]).optional(),__EXPERIMENTAL_BORDER:F.object({enabled:F.boolean(),color:F.string(),width:F.number().optional()}).optional(),__EXPERIMENTAL_PREVENT_SELF_OVERLAP:F.boolean().optional(),xrayStyle:F.object({color:F.string().optional(),tint:F.number().min(0).max(1).optional(),dithering:F.number().min(0).optional()}).optional()}),Qp=F.object({type:F.enum(["Feature"]),geometry:zr,properties:F.object({parentId:F.any().optional()})});function Au(n,e){F.object({features:F.array(Qp)}).parse(n),Kp.parse(e)}function em(n,e){let t=Ls(n);t&&e==="tube"&&(_.warn("Screen-space pixel width is only supported with ribbon geometry. Falling back to world-space interpretation."),t=!1);let r;return typeof n=="object"&&"output"in n?r=n.output.map(o=>typeof o=="string"?At(o):Number(o)):sr(n)?r=[At(n)]:r=[n],{screenSpace:t,parsedOutputValues:r}}var fr=class{type="path";mesh=new He;material;geometry;outline;feature;options;width={on:"zoom-level",input:[17,22],output:[.8,.4]};breakpoint=0;screenSpace=!1;parsedOutputValues=[];altitudeBreakpoints;accentColor="blue";completeFraction=1;altitudeAdjustment=1;displayArrowsOnPath=!1;animateArrowsOnPath=!1;visibleThroughGeometry=!1;highlightStartFraction=0;highlightEndFraction=0;highlightCompleteFraction=1;highlightWidthMultiplier=1.1;highlightColor="red";highlightDisplayArrowsOnPath=!1;xrayOpacity=.25;xrayStyle;travelledEndFraction=0;travelledColor="#999";dashed=!1;smoothingTension=Mt.tension;smoothingCornerRadius=Mt.cornerRadius;dashLength=.1;dashGap=.1;dashRelativeToWidth=!1;dashSize=3;gapSize=2;dashAbsolute=!1;dashMeters=1;gapMeters=.5;__EXPERIMENTAL_GEOMETRY="tube";__EXPERIMENTAL_ENDCAP_EXTENSION=[.5,.5];__EXPERIMENTAL_BILLBOARDING=80;__EXPERIMENTAL_BORDER;__EXPERIMENTAL_PREVENT_SELF_OVERLAP=!1;isVertical=!1;dirty=!0;materialDirty=!0;constructor(e,t){this.feature=e,this.options=t||{},this.width=t?.width??this.width,this.accentColor=t?.accentColor??this.accentColor,this.displayArrowsOnPath=t?.displayArrowsOnPath??this.displayArrowsOnPath,this.animateArrowsOnPath=t?.animateArrowsOnPath??this.animateArrowsOnPath,this.highlightDisplayArrowsOnPath=t?.highlightDisplayArrowsOnPath??this.displayArrowsOnPath,this.visibleThroughGeometry=t?.visibleThroughGeometry??this.visibleThroughGeometry,this.dashed=t?.dashed??this.dashed,this.xrayOpacity=t?.xrayOpacity??this.xrayOpacity,this.xrayStyle=t?.xrayStyle,this.travelledEndFraction=t?.travelledEndFraction??this.travelledEndFraction,this.travelledColor=t?.travelledColor??this.travelledColor,this.smoothingTension=t?.smoothingTension??Mt.tension,this.smoothingCornerRadius=t?.smoothingCornerRadius??Mt.cornerRadius,this.dashLength=t?.dashLength??this.dashLength,this.dashGap=t?.dashGap??this.dashGap,this.dashRelativeToWidth=t?.dashRelativeToWidth??this.dashRelativeToWidth,this.dashSize=t?.dashSize??this.dashSize,this.gapSize=t?.gapSize??this.gapSize,this.dashAbsolute=t?.dashAbsolute??this.dashAbsolute,this.dashMeters=t?.dashMeters??this.dashMeters,this.gapMeters=t?.gapMeters??this.gapMeters,this.__EXPERIMENTAL_GEOMETRY=t?.__EXPERIMENTAL_GEOMETRY??"tube",this.__EXPERIMENTAL_ENDCAP_EXTENSION=t?.__EXPERIMENTAL_ENDCAP_EXTENSION??[.5,.5],this.__EXPERIMENTAL_BILLBOARDING=t?.__EXPERIMENTAL_BILLBOARDING??80,this.__EXPERIMENTAL_BORDER=t?.__EXPERIMENTAL_BORDER,this.__EXPERIMENTAL_PREVENT_SELF_OVERLAP=t?.__EXPERIMENTAL_PREVENT_SELF_OVERLAP??!1,this.updateScreenSpaceState()}updateScreenSpaceState(){let e=em(this.width,this.__EXPERIMENTAL_GEOMETRY);this.screenSpace=e.screenSpace,this.parsedOutputValues=e.parsedOutputValues}setColor(){}setOpacity(){}set visible(e){this.mesh&&(this.mesh.visible=e)}get visible(){return this.mesh?this.mesh.visible:!1}position=new O;#e=0;get altitude(){return this.#e}set altitude(e){this.mesh&&(this.mesh.position.z=e,this.#e=e)}set complete(e){this.material&&(this.material.uniforms.complete.value=e,this.material.needsUpdate=!0)}};f();f();f();function Ur(n,e,t){return n.type==="portion"?{top:n.top*t,left:n.left*e,bottom:n.bottom*t,right:n.right*e,type:"pixel"}:n}f();f();f();var Ru=(n,e)=>(e-n+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,_u=(n,e)=>new W(n.clientX-e.offsetLeft,n.clientY-e.offsetTop),ia=(n,e)=>Math.atan2(e.y-n.y,e.x-n.x),Mn=(n,e)=>Math.sqrt((e.y-n.y)**2+(e.x-n.x)**2),sa=(n,e)=>new W((n.x+e.x)/2,(n.y+e.y)/2),aa=n=>{let e=0,{wheelDelta:t,detail:r}=n;return t!==void 0?e=t:r!==void 0&&(e=-r),e};var Ko=class{input1;input2;lastAngle;lastDistance;totalDistance;first;second;constructor(e,t){this.input1=e,this.input2=t,this.lastAngle=ia(e,t),this.lastDistance=Mn(e,t),this.totalDistance=0,this.first=e,this.second=t}update(e,t){let r=Mn(e,t);this.input1=e,this.input2=t;let o=ia(e,t);this.lastAngle=o,this.lastDistance=r,this.totalDistance+=(Mn(this.first,e)+Mn(this.second,t))/2,this.first=sa(this.first,e),this.second=sa(this.second,t)}};f();var Cn=class{touch;camera;cameraPlane;viewCoordinate;snapHolderMatrix;snapCamera;cameraPosition;raycaster;worldCoordinate;snapshotted=!1;constructor(e,t,r){this.touch=e,this.camera=t,this.cameraPlane=r,this.viewCoordinate={x:e.x,y:e.y},this.camera.updateMatrixWorld(),this.camera.updateMatrix(),this.snapHolderMatrix=this.camera.matrixWorld.clone(),this.snapCamera=this.camera.clone(),this.snapshotCameraState()}snapshotCameraState(){this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraPosition=this.camera.position.clone();let e=new W(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new kt,this.raycaster.setFromCamera(e,this.snapCamera);let t=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=t&&t.length>0?t[0].point:null,this.snapshotted=!0}updateAnchorState(e,t){this.camera=e,this.snapCamera=e.clone(),this.snapHolderMatrix=e.matrixWorld.clone(),this.updateViewCoordinate(t),this.snapshotCameraState()}updateViewCoordinate(e){this.viewCoordinate={x:e.x,y:e.y}}reUnproject(){let e=new W(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster?.setFromCamera(e,this.snapCamera);let t=this.raycaster?.intersectObject(this.cameraPlane,!0)[0];return t?t.point:void 0}};var rt={};Bp(rt,{BLOCK_MERCATOR_ZOOM_LEVEL:()=>rm,CLIPPING_RADIUS:()=>En,CONTROL_OPTIONS:()=>tm,DEFAULT_ANIMATION_DURATION:()=>ha,DEFAULT_BEARING:()=>am,DEFAULT_MAX_ZOOM_LEVEL:()=>im,DEFAULT_MIN_ZOOM_LEVEL:()=>ma,DEFAULT_PITCH:()=>sm,DEFAULT_ZOOM_LEVEL:()=>om,EVENTS:()=>pa,MAPLIBRE_TILE_SIZE:()=>Qo,MAX_LAT:()=>ca,MAX_MERCATOR_ZOOM_LEVEL:()=>ti,MIN_LAT:()=>la,MIN_MERCATOR_ZOOM_LEVEL:()=>ei,ROOM_MERCATOR_ZOOM_LEVEL:()=>nm,TWO_PI:()=>ua,WHEEL_ZOOM_MULTIPLIER:()=>da,ZRANGE:()=>Hr});f();var Qo=512,la=-85.051129,ca=85.051129,En=1e4,tm={chain:"chain",cancel:"cancel"},ua=Math.PI*2,Hr=100,da=1e4,ei=0,ti=24,rm=17,nm=20,ha=200,pa=["change","pan-start","pan-end","rotate-start","rotate-end","zoom-start","zoom-end","multi-start","multi-end","multi-cancel","pedestal-start","pedestal-change","pedestal-end","user-pan-start","user-pedestal-start","user-rotate-start","user-dolly-start","user-zoom-start","user-tilt-start","user-pan-end","user-pedestal-end","user-rotate-end","user-dolly-end","user-zoom-end","user-tilt-end","position-updated","zoom-updated","tilt-updated","rotation-updated"],om=18,ma=12,im=22,sm=0,am=0;f();f();var gr=class extends Error{};gr.prototype.name="InvalidTokenError";function lm(n){return decodeURIComponent(atob(n).replace(/(.)/g,(e,t)=>{let r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function cm(n){let e=n.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return lm(e)}catch{return atob(e)}}function Fu(n,e){if(typeof n!="string")throw new gr("Invalid token specified: must be a string");e||(e={});let t=e.header===!0?0:1,r=n.split(".")[t];if(typeof r!="string")throw new gr(`Invalid token specified: missing part #${t+1}`);let o;try{o=cm(r)}catch(i){throw new gr(`Invalid token specified: invalid base64 for part #${t+1} (${i.message})`)}try{return JSON.parse(o)}catch(i){throw new gr(`Invalid token specified: invalid json for part #${t+1} (${i.message})`)}}f();function We(n,e,t,r){return(n<e||n>t)&&_.warn(r),Math.min(t,Math.max(e,n))}function Qx(n){let e=Fu(n);if(e.sub==null)throw new Error("Access token is missing sub claim.");return{sub:e.sub,aud:typeof e.aud=="string"?[e.aud]:e.aud??[],capabilities:e.capabilities??{}}}function Et(n){return n*(Math.PI/180)}function Nu(n){return n*(180/Math.PI)}function ri(n,e){let t=Math.pow(10,e);return Math.sign(n)*Math.round(Math.abs(n)*t)/t}function Bu(n,e){return(n%e+e)%e}function Gu(n,e){let t=Bu(n,Math.PI*2),r=Bu(e,Math.PI*2),o=r-t,i=r+(o>Math.PI?-Math.PI*2:o<-Math.PI?Math.PI*2:0);return{start:t,end:i}}function eS(){return typeof window<"u"&&window!==null}function ku(n,e){let[t,r]=n,[o,i]=e,s=Et(o-t),a=Et(i-r);return Math.sqrt(s*s+a*a)*vt}function Ee(n,e){let[t,r]=n.map(u=>Et(u)),[o,i]=e.map(u=>Et(u)),s=i-r,l=(o-t)*Math.cos((r+i)/2),c=s;return Math.sqrt(l*l+c*c)*vt}function fa(n,e){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))}function ni(n){let e=Et(n),r=Math.cos(e)*vt;function o(s,a){let l=Et(s[0]),c=Et(s[1]),u=l*r,d=c*vt;return a?(a.x=u,a.y=d,a):{x:u,y:d}}return{toCartesian:o,toGeographic:(s,a)=>{let l=Nu(s/r),c=Nu(a/vt);return{lon:l,lat:c}}}}var oi=!1,um=!1;var Wr=class extends Z{dirty=!1;zoomDirty=!1;rotationDirty=!1;panDirty=!1;stateDirty=!1;#e=ma;zoomSpeed=5;rotateSpeed=100;enabled=!0;enableZoom=!0;enablePan=!0;enablePedestal=!1;maxPedestal=1/0;minPedestal=0;enableRotate=!0;minZoomAltitude=0;maxZoomAltitude=1/0;get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(e){this.minZoomAltitude=this.convertZoomLevelToAltitude(e),this.stateDirty=!0}get defaultMinZoomLevel(){return this.#e}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(e){this.maxZoomAltitude=this.convertZoomLevelToAltitude(e),this.stateDirty=!0}ignoreZoomLimits=!1;zoomFactor=1;panBounds={min:new O(1/0,1/0),max:new O(-1/0,-1/0),center:new O(0,0,0),radius:1/0};minTilt=0;maxTilt=1.2;MOUSE_BUTTONS={ORBIT:go.RIGHT,ZOOM:go.MIDDLE,PAN:go.LEFT};camera;scene;renderer;elevation;orbit;cameraPlane;raycaster=new kt;rendererState;options;state=-1;intersection;viewState=null;tweens=new Map;clock=new cc(!0);coords={mouse:new W,rotateStart:new W,rotateEnd:new W,rotateDelta:new W,panStart:new O,panCameraStart:new O,panEnd:new O,panDelta:new O,initialShiftPos:new W,initialPedestal:0,floorAnchor:new O};touch={origin:{offsetLeft:0,offsetTop:0},touches:[],anchor1:null,anchor2:null,inputs:null};scrollTimer=null;lastWheelTime=0;resetZoom=!1;zoomStart;pedestalScaleFactor=1;isUserZooming=!1;stayInsideBounds=!0;userInteracting=!1;cameraMoving=!1;lastCameraMoveTime=Date.now();constructor(e,t,r,o,i){super(),this.camera=e,this.renderer=r,this.rendererState=o,this.scene=t,this.options=i,this.elevation=e.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=e.position.z,i.mode==="outdoors-overlay"?this.addMovingStateListeners():this.addEventListeners()}addMovingStateListeners=()=>{for(let e of pa)e.endsWith("start")?(this.on(e,this.setCameraMoving),e.startsWith("user")&&this.on(e,this.setUserInteracting)):(e.endsWith("end")||e.endsWith("cancel"))&&(this.on(e,this.unsetCameraMoving),e.startsWith("user")&&this.on(e,this.unsetUserInteracting))};get scrollPercent(){let e=this.minPedestal,t=this.maxPedestal,r=this.getPedestal();return r=Math.min(r,t),r=Math.max(r,e),(r-e)/(t-e)*100}get fov(){return this.camera.fov}get scrolledToBottom(){return this.minPedestal===0||Math.floor(this.getPedestal())<=this.minPedestal}get scrolledToTop(){return this.maxPedestal===0||Math.ceil(this.getPedestal())>=this.maxPedestal}get center(){let e=this.getPosition(),{lat:t,lon:r}=Io(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,e.x,e.y);return[r,t]}setCenter(e,t){let{x:r,y:o}=Oo(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,t,e);this.setPosition(r,o)}raycastToFloor=e=>{this.raycaster.setFromCamera(e,this.camera);let t=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return t?t.point:new O};isUserInteracting=()=>this.userInteracting;getPosition=()=>new O(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z);getPedestal=()=>this.orbit.position.z;pan=(e,t)=>{isNaN(e)||isNaN(t)||(this.setPosition(this.orbit.position.x+e,this.orbit.position.y+t),this.publish("position-updated"))};postRender=()=>{(this.state===2||this.state===6)&&(this.raycaster.setFromCamera(this.coords.mouse,this.camera),this.intersection=this.raycaster.intersectObject(this.cameraPlane,!1)[0],this.intersection&&(this.coords.panStart.set(this.intersection.point.x,this.intersection.point.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0))),this.state===3&&this.resetZoom&&(this.resetZoom=!1,this.zoomStart=this.getZoomAltitude(),this.coords.floorAnchor=this.raycastToFloor(this.coords.mouse),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0)),this.state===7&&this.isAnimating===!1&&(this.state=-1,this.publish("multi-end"))};get isAnimating(){return this.rendererState.internalTweenGroup.getAll().some(e=>e.cameraAnimation)}isCameraMoving=()=>this.cameraMoving;lastCameraStoppedMovingTime=()=>this.lastCameraMoveTime;beginGesture=()=>{this.state=2,this.publish("pan-start")};endGesture=()=>{this.state===2&&(this.state=-1,this.publish("pan-end"))};setPosition=(e,t)=>{e===void 0||t===void 0||isNaN(e)||isNaN(t)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(e,t),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0,this.stateDirty=!0)};updateCameraPosition=(e,t)=>{let r=e-this.panBounds.center.x,o=t-this.panBounds.center.y,i=Math.sqrt(r*r+o*o);if(this.stayInsideBounds&&i>this.panBounds.radius){let s=Math.atan2(o,r),a={x:Math.cos(s)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(s)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=a.x,this.orbit.position.y=a.y}else this.orbit.position.x=e,this.orbit.position.y=t};tilt=e=>{if(isNaN(e))return;this.state===-1&&this.publish("rotate-start");let t=this.stayInsideBounds?Math.max(Math.min(e+this.getTilt(),this.maxTilt),this.minTilt):e+this.getTilt();t!==this.elevation.rotation.x&&(this.elevation.rotation.x=t,this.publish("tilt-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end"),this.stateDirty=!0};zoomIn=(e,t,r)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o/1.5},e,t,r)};zoomOut=(e,t,r)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o*1.5},e,t,r)};getRotation=()=>(-this.orbit.rotation.z+Math.PI*2)%(Math.PI*2);cancelAnimation=()=>{let e=Array.from(this.tweens.keys());if(e.length<1)return;let t=e[e.length-1];t.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(t),this.state===7&&(this.state=-1)};animateCamera=(e,t,r,o,i,s)=>{let a={interruptible:!0,...s},l={},c={},u=this.getPosition();if(e.position!=null&&(e.position.x!==void 0&&(l.x=u.x,c.x=e.position.x),e.position.y!==void 0&&(l.y=u.y,c.y=e.position.y),e.position.z!==void 0&&(l.z=u.z,c.z=e.position.z)),e.zoom!==void 0&&(l.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?c.zoom=e.zoom:c.zoom=Math.min(Math.max(e.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),e.rotation!==void 0){let{start:y,end:v}=Gu(this.getRotation(),e.rotation);l.rotation=y,c.rotation=v}e.tilt!==void 0&&(l.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?c.tilt=e.tilt:c.tilt=Math.max(Math.min(e.tilt,this.maxTilt),this.minTilt));let d=l.zoom!==c.zoom,h=l.rotation!==c.rotation,g=l.tilt!==c.tilt,b=new zl(l).to(c,E.env.TESTING?0:t).onUpdate(y=>{this.setMulti({x:y.x,y:y.y,z:y.z},y.zoom,y.rotation,y.tilt)}).onComplete(()=>{this.completeTween(b),this.publish("multi-end",{zooming:d,rotating:h,tilting:g}),o&&o()}).onStart(()=>{this.state!==7&&(this.state=7,b.state=7,this.publish("multi-start",{zooming:d,rotating:h,tilting:g})),this.publish("change")});this.rendererState.internalTweenGroup.add(b);let M=Array.from(this.tweens.entries()),m=M[M.length-1],p=!1;return m!=null&&(m[1].interruptible?(typeof m[1].cancelledCallback=="function"&&m[1].cancelledCallback(),this.completeTween(m[0])):(p=!0,m[0].chain(b))),this.tweens.set(b,{cancelledCallback:i,interruptible:a.interruptible}),r?b.easing(r):b.easing(ar.Quadratic.In),!e.doNotAutoStart&&!p&&(b.start(),this.publish("change")),b.cameraAnimation=!0,b};setMulti=(e,t,r,o,i=!0)=>{this.state===-1&&this.publish("multi-start");let s=!1;e!=null&&(e.x!==void 0&&!isNaN(e.x)&&e.y!==void 0&&!isNaN(e.y)&&(this.updateCameraPosition(e.x,e.y),s=!0),e.z!==void 0&&!isNaN(e.z)&&(this.setPedestal(e.z,!0,!1),s=!0)),s&&this.publish("position-updated");let a={zooming:!1,tilting:!!t,rotating:!1};if(t!==void 0&&!isNaN(t)){let l=this.stayInsideBounds?Math.min(Math.max(t,this.getZoomScaledMin()),this.getZoomScaledMax()):t;l!==this.camera.position.z&&(a.zooming=!0,this.camera.position.z=l,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?t>En&&(this.camera.near=t-En,this.camera.far=t+En):(this.camera.near=t/Hr,this.camera.far=t*Hr),this.camera.updateProjectionMatrix())}if(r!==void 0&&!isNaN(r)&&r!==this.getRotation()&&(a.rotating=!0,this.orbit.rotation.z=-r,this.publish("rotation-updated")),o!==void 0&&!isNaN(o)){let l=this.stayInsideBounds?Math.max(Math.min(o,this.maxTilt),this.minTilt):o;l!==this.elevation.rotation.x&&(a.tilting=!0,this.elevation.rotation.x=l,this.publish("tilt-updated"))}i&&this.publish("change"),this.state===-1&&this.publish("multi-end",a),this.stateDirty=!0};getZoomScaledMin=()=>this.minZoomAltitude*this.zoomFactor;getZoomScaledMax=()=>{let e=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,e)};setRotation=(e,t)=>{if(isNaN(e))return;this.state===-1&&!t&&this.publish("rotate-start");let r=-(e%ua);r!==this.orbit.rotation.z&&(this.orbit.rotation.z=r,t||this.publish("rotation-updated")),t||this.publish("change"),this.state===-1&&!t&&this.publish("rotate-end"),this.dirty=!0,this.rotationDirty=!0,t||(this.stateDirty=!0)};setZoomAltitude=e=>{if(isNaN(e))return;this.state===-1&&this.publish("zoom-start");let t=this.stayInsideBounds?Math.min(Math.max(e,this.getZoomScaledMin()),this.getZoomScaledMax()):e;t!==this.camera.position.z&&(this.camera.position.z=t,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=t/Hr,this.camera.far=t*Hr,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0,this.stateDirty=!0};setZoomLevel=e=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(e))};getZoomAltitude=()=>this.camera.position.z;getZoomLevel=()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude());setTilt=(e,t)=>{if(isNaN(e))return;this.state===-1&&!t&&this.publish("rotate-start");let r=this.stayInsideBounds?Math.max(Math.min(e,this.maxTilt),this.minTilt):e;r!==this.elevation.rotation.x&&(this.elevation.rotation.x=r,t||this.publish("tilt-updated")),t||this.publish("change"),this.state===-1&&!t&&this.publish("rotate-end"),this.dirty=!0,t||(this.stateDirty=!0)};getTilt=()=>this.elevation.rotation.x;setCameraPlaneElevation=e=>{this.cameraPlane.position.z=e};zoom=e=>{if(isNaN(e))return;this.state===-1&&this.publish("zoom-start");let t=this.getZoomAltitude()-e;this.camera.position.z=this.stayInsideBounds?Math.min(Math.max(t,this.minZoomAltitude*this.zoomFactor),this.maxZoomAltitude*this.zoomFactor):t,this.publish("zoom-updated"),this.zoomDirty=!0,this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.stateDirty=!0};getProjectionScaleFactor=(e,t,r)=>zs(e,t,r);update=()=>{this.orbit.updateMatrixWorld(),this.lastWheelTime>0&&this.state===3&&this.clock.getElapsedTime()-this.lastWheelTime>.2&&(this.lastWheelTime=0,this.state=-1,this.publish("zoom-end"),this.removeMouseMoveEventListeners())};setPedestal=(e,t=!1,r=!0)=>{typeof e=="number"&&!isNaN(e)&&(this.orbit.position.z=e,t&&(this.publishPedestalChangeEvent(e),this.publish("pedestal-change",{pedestal:e})),this.publish("change"),this.dirty=!0,r&&(this.stateDirty=!0))};dispose=()=>{this.scene.remove(this.cameraPlane),this.destroy()};createCameraPlane=()=>{let e=oi?2e3:1e10,t=oi?100:1,r=new Ie(e,e,t,t),o=new Me({color:0,wireframe:oi,visible:oi}),i=new V(r,o);return this.scene.add(i),i};addEventListeners=()=>{let{domElement:e}=this.renderer;this.addMovingStateListeners(),e.addEventListener("contextmenu",this.onContextMenu,{capture:!1,signal:this.signal}),e.addEventListener("mousedown",this.onMouseDown,{capture:!1,signal:this.signal}),e.addEventListener("wheel",this.onMouseWheel,{capture:!1,passive:!1,signal:this.signal}),e.addEventListener("touchstart",this.onTouchStart,{capture:!1,signal:this.signal}),e.addEventListener("touchend",this.onTouchEnd,{capture:!1,signal:this.signal}),e.addEventListener("touchmove",this.onTouchMove,{capture:!1,signal:this.signal})};addMouseEventListeners=()=>{this.addMouseMoveEventListeners(),window.addEventListener("mouseup",this.onMouseUp,{capture:!1,signal:this.signal}),window.addEventListener("mouseout",this.onWindowMouseOut,{capture:!1,signal:this.signal})};onWindowMouseOut=e=>{e.relatedTarget==null&&this.onMouseUp()};addMouseMoveEventListeners=()=>{window.addEventListener("mousemove",this.onMouseMove,{capture:!0,signal:this.signal})};removeMouseMoveEventListeners=()=>{window.removeEventListener("mousemove",this.onMouseMove,{capture:!0})};removeMouseUpEventListeners=()=>{this.removeMouseMoveEventListeners(),window.removeEventListener("mouseup",this.onMouseUp,{capture:!1}),window.removeEventListener("mouseout",this.onWindowMouseOut,{capture:!1})};onContextMenu=e=>{e.preventDefault()};onMouseUp=()=>{if(this.enabled!==!1){switch(this.removeMouseUpEventListeners(),this.state){case 2:this.publish("pan-end"),this.publish("user-pan-end");break;case 1:this.publish("zoom-end"),this.publish("user-dolly-end");break;case 0:this.publish("rotate-end"),this.publish("user-rotate-end");break;case 8:this.publish("pedestal-end"),this.publish("user-pedestal-end");break}this.state=-1,this.panDirty=!1}};onMouseMove=e=>{if(this.enabled!==!1)if(e.preventDefault(),this.mouseToScene(e),this.state===0){if(this.enableRotate===!1)return;this.handleMouseMoveRotate(e)}else if(this.state===2){if(this.enablePan===!1)return;this.handleMouseMovePan()}else this.state===3?(this.resetZoom=!0,this.state=-1):this.state===8&&this.handleMouseMovePedestal(e)};onTouchStart=e=>{if(this.enabled!==!1){switch(this.updateTouchOrigin(),this.touchToScene(e),e.touches.length){case 1:this.enablePedestal?(this.handleTouchStartPedestal(e),this.state=9):this.enablePan&&(this.handleTouchStartPan(e),this.state=6);break;case 2:this.touch.inputs=new Ko(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}};onTouchMove=e=>{if(this.enabled!==!1)switch(this.touchToScene(e),e.touches.length){case 2:e.preventDefault(),e.stopPropagation();let t={...this.touch.inputs.first},r={...this.touch.inputs.second},o=new W(this.touch.touches[0].x,this.touch.touches[0].y),i=new W(this.touch.touches[1].x,this.touch.touches[1].y);if(this.touch.inputs.update(this.touch.touches[0],this.touch.touches[1]),this.enableRotate&&this.state===4)this.handleTouchMoveTilt(e);else if(this.state===5)this.handleTouchMoveDolly();else if(this.state!==5&&this.touch.inputs.totalDistance>.05){let s=t.y<o.y&&r.y<i.y,a=t.y>o.y&&r.y>i.y;this.enableRotate&&this.state!==4&&(a||s)?(this.handleTouchStartTilt(e),this.state=4):(this.handleTouchStartDolly(),this.state=5)}break;case 1:(this.enablePedestal||this.enablePan)&&(e.preventDefault(),e.stopPropagation()),this.enablePedestal&&this.state===9?this.handleTouchMovePedestal(e):this.enablePan&&this.state===6&&this.handleTouchMovePan(e);break;default:this.state=-1}};onTouchEnd=e=>{if(this.enabled!==!1){switch(this.handleTouchEnd(),this.state){case 2:case 6:this.publish("user-pan-end");break;case 4:this.publish("pan-end"),this.publish("user-tilt-end");break;case 1:case 5:this.publish("zoom-end"),this.publish("user-dolly-end");break;case 0:this.publish("rotate-end"),this.publish("user-rotate-end");break;case 8:case 9:this.publish("pedestal-end"),this.publish("user-pedestal-end");break}e.touches.length?this.onTouchStart(e):this.state=-1}};handleTouchMovePan=e=>{let t=Object.hasOwn(e,"x")?new W(e.x,e.y):this.touch.touches[0],r=this.raycastToFloor(t);this.coords.panEnd.set(r.x,r.y,0),this.coords.panDelta.subVectors(this.coords.panEnd,this.coords.panStart),this.setPosition(this.coords.panCameraStart.x-this.coords.panDelta.x,this.coords.panCameraStart.y-this.coords.panDelta.y),this.publish("change"),this.panDirty=!0};handleTouchStartDolly=()=>{let e=this.touch.touches[0].x-this.touch.touches[1].x,t=this.touch.touches[0].y-this.touch.touches[1].y;this.zoomStart=this.getZoomAltitude();let r=new W(this.touch.touches[0].x-e/2,this.touch.touches[0].y-t/2);this.coords.floorAnchor=this.raycastToFloor(r),this.orbit.updateMatrixWorld(),this.touch.anchor1=new Cn(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new Cn(this.touch.touches[1],this.camera,this.cameraPlane),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("user-dolly-start"),this.publish("zoom-start"),this.publish("multi-start")};handleMouseMovePan=()=>{let e=this.raycastToFloor(this.coords.mouse);this.coords.panEnd.set(e.x,e.y,0),this.coords.panDelta.subVectors(this.coords.panEnd,this.coords.panStart),this.setPosition(this.coords.panCameraStart.x-this.coords.panDelta.x,this.coords.panCameraStart.y-this.coords.panDelta.y),this.publish("change"),this.panDirty=!0};handleTouchStartTilt=e=>{this.coords.rotateStart.set(e.touches[1].clientX,e.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")};handleTouchMovePedestal=e=>{this.handleMouseMovePedestal(e.touches[0])};handleTouchMoveTilt=e=>{this.coords.rotateEnd.set(e.touches[1].clientX,e.touches[1].clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd)};handleTouchMoveDolly=()=>{let e=this.touch.inputs.first,t=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:e.x,y:e.y},this.touch.anchor2.viewCoordinate={x:t.x,y:t.y};let r=this.makeTransformFromTouchAnchors(this.touch.anchor1,this.touch.anchor2);r&&this.setCameraFromTransformMatrix(r),this.orbit.updateMatrixWorld(),this.touch.anchor1.updateAnchorState(this.camera,e),this.touch.anchor2.updateAnchorState(this.camera,t)};handleTouchEnd=()=>{this.state===4||this.state===5?this.publish("multi-end"):this.state===6&&this.publish("pan-end"),this.panDirty=!1};handleTouchStartPan=e=>{let t=Object.hasOwn(e,"x")?new W(e.x,e.y):this.touch.touches[0],r=this.raycastToFloor(t);this.coords.panStart.set(r.x,r.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("user-pan-start"),this.publish("pan-start")};handleTouchStartPedestal=e=>{this.handleMouseDownPedestal(e.touches[0])};onMouseDown=e=>{if(this.enabled!==!1){if(this.mouseToScene(e),e.preventDefault(),this.state===3&&this.publish("zoom-end"),e.button===this.MOUSE_BUTTONS.ORBIT){if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),this.state=0}else(e.button===this.MOUSE_BUTTONS.PAN||e.button===this.MOUSE_BUTTONS.ZOOM)&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(e),this.state=8));this.state!==-1&&this.addMouseEventListeners()}};onMouseWheel=e=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3&&this.state!==7||(this.state===7&&this.cancelAnimation(),e.preventDefault(),e.stopPropagation(),this.mouseToScene(e),this.canScrollZoom(e)&&(this.lastWheelTime=this.clock.getElapsedTime(),this.publishUserZoomEvent()),this.state!==3&&this.canScrollZoom(e)&&(this.addMouseMoveEventListeners(),this.state=3,this.zoomStart=this.getZoomAltitude(),this.coords.floorAnchor=this.raycastToFloor(this.coords.mouse),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("zoom-start")),this.scrollTimer!=null&&clearTimeout(this.scrollTimer),this.scrollTimer=setTimeout(()=>{this.publish("zoom-end")},50),this.handleMouseWheel(e))};handleMouseWheel=e=>{if(this.publish("zoom-start"),!this.canScrollZoom(e)){this.lastWheelTime>0&&this.publish("zoom-end"),this.lastWheelTime=0,this.state=-1;return}let t=this.getZoomAltitude(),r=t-aa(e)*t/da*this.zoomSpeed;if(this.setZoomAltitude(r),this.enablePan){let o=this.getZoomAltitude()/this.zoomStart;this.coords.panDelta.subVectors(this.coords.floorAnchor,this.coords.panCameraStart).multiplyScalar(1-o),this.setPosition(this.coords.panCameraStart.x+this.coords.panDelta.x,this.coords.panCameraStart.y+this.coords.panDelta.y)}this.publish("change")};setCameraFromTransformMatrix=e=>{this.orbit.updateMatrixWorld();let t=new xt;t.setFromRotationMatrix(e,"ZYX");let r=(e.elements[14]-this.cameraPlane.position.z)/Math.cos(t.x),o=t.z,i=new O(0,0,1);i.applyEuler(t),i.setLength(r);let s=new O;s.setFromMatrixPosition(e),s.sub(i),this.enablePan&&this.setPosition(s.x,s.y),this.enableZoom&&this.setZoomAltitude(r),this.enableRotate&&this.setRotation(-o)};makeTransformFromTouchAnchors=(e,t)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let r=this.camera.projectionMatrix.clone(),o=e.worldCoordinate,i=t.worldCoordinate,s=e.reUnproject(),a=t.reUnproject();if(!s||!a||!o||!i)return null;let l=e.viewCoordinate,c=t.viewCoordinate,u=i.x-o.x,d=i.y-o.y,h=Math.atan2(d,u),g=a.x-s.x,b=a.y-s.y,M=Math.atan2(b,g),m=Ru(h,M),p=new Y;p.makeRotationZ(-m);let y=p.clone();y.multiply(e.snapHolderMatrix);let v=(rr,nr,or)=>rr.elements[(nr-1)*4+or-1],x=v(r,1,1)*v(y,1,1)-l.x*v(r,3,4)*v(y,3,1),S=v(r,1,1)*v(y,1,2)-l.x*v(r,3,4)*v(y,3,2),w=v(r,1,1)*v(y,1,3)-l.x*v(r,3,4)*v(y,3,3),D=o.x*x+o.y*S+o.z*w,C=v(r,2,2)*v(y,2,1)-l.y*v(r,3,4)*v(y,3,1),T=v(r,2,2)*v(y,2,2)-l.y*v(r,3,4)*v(y,3,2),P=v(r,2,2)*v(y,2,3)-l.y*v(r,3,4)*v(y,3,3),I=o.x*C+o.y*T+o.z*P,L=v(r,1,1)*v(y,1,1)-c.x*v(r,3,4)*v(y,3,1),N=v(r,1,1)*v(y,1,2)-c.x*v(r,3,4)*v(y,3,2),z=v(r,1,1)*v(y,1,3)-c.x*v(r,3,4)*v(y,3,3),j=i.x*L+i.y*N+i.z*z,H=v(r,2,2)*v(y,2,1)-c.y*v(r,3,4)*v(y,3,1),Q=v(r,2,2)*v(y,2,2)-c.y*v(r,3,4)*v(y,3,2),G=v(r,2,2)*v(y,2,3)-c.y*v(r,3,4)*v(y,3,3),J=i.x*H+i.y*Q+i.z*G,ne=Math.abs(L-x),je=Math.abs(N-S),ye=Math.abs(z-w),be=Math.abs(L-C),pt=Math.abs(N-T),Ze=Math.abs(z-P),Qe=Math.abs(H-x),mt=Math.abs(Q-S),et=Math.abs(G-w),It=Math.abs(H-C),Fe=Math.abs(Q-T),Xe=Math.abs(G-P),ft=Math.min(ne+je+ye,be+pt+Ze),Se=Math.min(Qe+mt+et,It+Fe+Xe);ft<Se&&(L=H,N=Q,z=G,j=J);let Ye=C*w-x*P,Ne=T*w-S*P,er=I*w-D*P,Be=L*P-C*z,de=N*P-T*z,ro=j*P-I*z,wr=(ro*Ne-er*de)/(Be*Ne-Ye*de),ws=(ro*Ye-er*Be)/(de*Ye-Ne*Be),tr=T*x-S*C,Ot=P*x-w*C,st=I*x-D*C,Tr=N*C-T*L,rn=z*C-P*L,oo=((j*C-I*L)*tr-st*Tr)/(rn*tr-Ot*Tr),gt=y.clone();return gt.elements[12]=wr,gt.elements[13]=ws,gt.elements[14]=oo,oo>0?gt:null};updateTouchOrigin=()=>{let e=this.renderer.domElement;this.touch.origin.offsetLeft=e.getBoundingClientRect().left,this.touch.origin.offsetTop=e.getBoundingClientRect().top};touchToScene=e=>{this.touch.touches=[];for(let t=0,r=e.touches.length;t<r;t++){let o=e.touches[t],i=_u(o,this.touch.origin);this.touch.touches.push(new W(i.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,-(i.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1))}this.coords.mouse=this.touch.touches[0]};canScrollZoom=e=>{let t=aa(e),r=this.getZoomAltitude();return!(t<0&&r===this.getZoomScaledMax()||t>0&&r===this.getZoomScaledMin())};mouseToScene=e=>{let t=this.getMousePos(e);return this.coords.mouse.x=t.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,this.coords.mouse.y=-(t.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1,this.coords.mouse};getMousePos=e=>{let t=this.renderer.domElement.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}};handleMouseDownRotate=e=>{this.coords.rotateStart.set(e.clientX,e.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")};handleMouseDownPan=()=>{let e=this.raycastToFloor(this.coords.mouse);this.coords.panStart.set(e.x,e.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("pan-start"),this.publish("user-pan-start")};handleMouseDownPedestal=e=>{let t=new W(e.clientX,e.clientY);this.coords.initialShiftPos=t,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=zs(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")};handleMouseMovePedestal=e=>{let t={x:e.clientX,y:e.clientY},r=this.coords.initialPedestal+this.pedestalScaleFactor*(t.y-this.coords.initialShiftPos.y);this.stayInsideBounds&&(r<this.minPedestal?r=Math.max(r,this.minPedestal):r>this.maxPedestal&&(r=Math.min(r,this.maxPedestal))),r!==this.getPedestal()&&this.setPedestal(r,!0)};handleMouseMoveRotate=e=>{this.coords.rotateEnd.set(e.clientX,e.clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.setRotation(this.getRotation()+this.coords.rotateDelta.x/this.rotateSpeed),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd),this.publish("change")};publishUserZoomDebounced=Pr(()=>{this.isUserZooming=!1,this.publish("user-zoom-end")},250);publishUserZoomEvent=()=>{this.isUserZooming?this.publishUserZoomDebounced():(this.publish("user-zoom-start"),this.isUserZooming=!0,this.publishUserZoomDebounced())};setCameraMoving=()=>{this.cameraMoving=!0};unsetCameraMoving=()=>{this.cameraMoving=!1,this.lastCameraMoveTime=Date.now()};setUserInteracting=()=>{this.userInteracting=!0};unsetUserInteracting=()=>{this.userInteracting=!1};publishPedestalChangeEvent=e=>{this.publish("pedestal-change",{pedestal:e,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})};convertAltitudeToZoomLevel=e=>{let[,t]=this.center,r=this.computeMetersPerPixelFromAltitude(e),o=Math.cos(U.degToRad(t))*2*Math.PI*vt/r;return U.clamp(Math.log2(o/512),ei,ti)};convertZoomLevelToAltitude=e=>this.computeMetersPerPixelFromZoomLevel(e)*this.options.canvasHeight/2/Math.tan(U.degToRad(this.camera.fov)/2);completeTween=e=>{e.isPlaying()&&e.stop(),this.rendererState.internalTweenGroup.remove(e),this.tweens.delete(e)};static CAMERA_FRAME_PADDING_SIDES=["top","bottom","left","right"];debugContainer=new Ge;getCameraFrameForCoordinates(e,t){let r=t.minZoom!==void 0?t.minZoom:this.minZoomAltitude,o=t.maxZoom!==void 0?t.maxZoom:this.maxZoomAltitude,i=this.options.canvasWidth,s=this.options.canvasHeight,a=this.getRotation(),l=this.getTilt(),c=this.getPosition();this.setRotation(t.rotation??a,!0),this.setTilt(t.tilt??l,!0);let u=ga(e,{canvasWidth:i,canvasHeight:s,paddingOption:t.padding,verticalPadding:t.verticalPadding,minZoom:r,maxZoom:o,position:c,camera:this.camera,orbit:this.orbit});return this.setRotation(a,!0),this.setTilt(l,!0),{center:u.position,zoomLevel:this.convertAltitudeToZoomLevel(u.zoom)}}focusOn(e,t){if(um){this.debugContainer&&ve(this.debugContainer);let M=new Nt(4,4,4),m=new Me({color:65280,depthTest:!1}),p=new K(M,m,e.length),y=new Y;e.forEach((v,x)=>{y.setPosition(v),p.setMatrixAt(x,y)}),p.instanceMatrix.needsUpdate=!0,this.debugContainer.add(p),this.scene.add(this.debugContainer)}let r=t.curve,o=t.callback,i=t.cancelledCallback,s=t.minZoom!==void 0?t.minZoom:this.minZoomAltitude,a=t.maxZoom!==void 0?t.maxZoom:this.maxZoomAltitude,l=this.options.canvasWidth,c=this.options.canvasHeight,u;t.duration!==void 0?u=t.duration:E.env.TESTING==="true"?u=0:u=ha;let d=t.padding,h=this.getRotation(),g=this.getTilt();t.rotation!=null&&this.setRotation(t.rotation),t.tilt!=null&&this.setTilt(t.tilt);let b=ga(e,{canvasHeight:c,paddingOption:d,canvasWidth:l,minZoom:s,maxZoom:a,camera:this.camera,orbit:this.orbit,position:this.getPosition(),verticalPadding:t.verticalPadding});this.setRotation(h),this.setTilt(g),this.animateCamera({position:b.position,tilt:t.tilt,rotation:t.rotation,zoom:b.zoom},u,r,o,i,t)}resize(e,t){this.options.canvasWidth=e,this.options.canvasHeight=t}computeMetersPerPixelFromZoomLevel(e){let[,t]=this.center,r=U.clamp(e,ei,ti),o=Math.pow(2,r),i=U.clamp(t,la,ca),s=o*512;return Math.cos(U.degToRad(i))*Math.PI*2*vt/s}computeMetersPerPixelFromAltitude(e){return e*2*Math.tan(U.degToRad(this.camera.fov)/2)/this.options.canvasHeight}getCurrentMetersPerPixel(){let e=Math.max(0,this.getPedestal()-this.minPedestal);return this.computeMetersPerPixelFromAltitude(this.getZoomAltitude()+e)}};function ga(n,{canvasWidth:e,orbit:t,paddingOption:r,verticalPadding:o=0,canvasHeight:i,minZoom:s,maxZoom:a,camera:l,position:c}){let u={zoom:s,position:c};if(n.length===0)return u;for(let Ne of Wr.CAMERA_FRAME_PADDING_SIDES)typeof r[Ne]!="number"&&(r[Ne]=0);let d=Ur(r,e,i);if(d.left+d.right>=e||d.top+d.bottom>=i)return u;t.updateMatrixWorld();let h=l.matrixWorldInverse,g=l.fov*(Math.PI/180)/2,b=g,m=Math.atan(Math.tan(g)*(e/i)),p=new O(1/0,1/0,1/0),y=new O(-1/0,-1/0,-1/0),v=new ce,x=new O;for(let Ne=0,er=n.length;Ne<er;Ne++)x.copy(n[Ne]),v.expandByPoint(x),x.applyMatrix4(h),p.min(x),y.max(x),x.copy(n[Ne]),x.z-=o,x.applyMatrix4(h),p.min(x),y.max(x),x.copy(n[Ne]),x.z+=o,x.applyMatrix4(h),p.min(x),y.max(x);let S=y.x-p.x,w=y.y-p.y,D=e-d.left-d.right,C=i-d.top-d.bottom,T=(y.x+p.x)/2,P=(y.y+p.y)/2,I=S/D,L=w/C,N=s,z=a,j=N*Math.tan(m)*2,H=z*Math.tan(m)*2,Q=j/e,G=H/e,J=Math.max(I,L);J=U.clamp(J,Q,G);let ne=D*J,je=C*J,ye={min:{x:T-ne/2-d.left*J,y:P-je/2-d.bottom*J},max:{x:T+ne/2+d.right*J,y:P+je/2+d.top*J}},be=(ye.min.x+ye.max.x)/2,pt=(ye.min.y+ye.max.y)/2,Ze=v.getCenter(new O),Qe=Math.abs(be-ye.min.x),mt=Math.abs(pt-ye.min.y),et=Qe/Math.tan(m),It=mt/Math.tan(b),Fe=new O;Fe.set(be,pt,y.z+Math.max(et,It)),Fe.applyMatrix4(l.matrixWorld);let Xe=new O;Xe.set(be,pt,y.z),Xe.applyMatrix4(l.matrixWorld);let ft=new O().subVectors(Xe,Fe),Se=(Ze.z-Fe.z)/ft.z,Ye=new O().copy(Fe).add(ft.clone().multiplyScalar(Se));return Xe.set(Ye.x,Ye.y,Ye.z),Fe.sub(Xe),{position:Ye,zoom:Fe.length()}}f();import{z as te}from"zod";var dm=te.object({rotation:te.array(te.number()).length(3).optional(),altitude:te.number().optional(),scale:te.array(te.number()).length(3).optional(),interactive:te.boolean().optional(),verticalOffset:te.number().optional(),id:te.union([te.number(),te.string()]).optional()}),hm=te.object({type:te.enum(["Feature"]),geometry:zr,properties:dm}),pm=te.object({type:te.enum(["FeatureCollection"]),features:te.array(hm)}),mm=te.object({color:te.string()}),fm=te.object({url:te.string(),color:te.string().optional(),opacity:te.number().optional(),material:te.record(te.string(),mm).optional()});function zu(n,e,t){te.union([te.number(),te.string()]).parse(n),pm.parse(e),fm.parse(t)}var yr=class{mesh;type="model";positionDirty=!0;outline;geometry;material;feature;instanceIndex=-1;instancingDisabled=!1;constructor(e){this.feature=e}#e=!0;get visible(){return this.#e}set visible(e){this.#e=e}color=new k;clippingPlane;get modelScene(){return this.clippingPlane?this.mesh?.children.find(e=>e.name!=="hole-fill-mesh"):this.mesh}position=new O;#n=0;get altitude(){return this.#n}set altitude(e){this.#n=e}#i=1;get opacity(){return this.#i}set opacity(e){this.#i=e}#o=ue.GEOMETRY;get renderOrder(){return this.#o}set renderOrder(e){this.#o=e}#s=!1;get visibleThroughGeometry(){return this.#s}set visibleThroughGeometry(e){this.#s=e}};f();f();var br={container:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"9998"},focusOnBox:{position:"absolute",border:"2px solid orange",backgroundColor:"transparent",pointerEvents:"none"},getFocusOnTransformBox:{position:"absolute",border:"2px dashed cyan",backgroundColor:"rgba(0, 255, 255, 0.1)",pointerEvents:"none"},animateToBox:{position:"absolute",width:"12px",height:"12px",border:"2px solid lime",backgroundColor:"rgba(0, 255, 0, 0.3)",borderRadius:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"},label:{position:"absolute",fontSize:"10px",fontFamily:"monospace",color:"white",backgroundColor:"rgba(0, 0, 0, 0.7)",padding:"2px 4px",borderRadius:"2px",whiteSpace:"nowrap"}},ya={container:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"9999"},top:{position:"absolute",top:"0",left:"0",right:"0",backgroundColor:"rgba(255, 0, 0, 0.2)",borderBottom:"2px dashed rgba(255, 0, 0, 0.6)"},bottom:{position:"absolute",bottom:"0",left:"0",right:"0",backgroundColor:"rgba(0, 255, 0, 0.2)",borderTop:"2px dashed rgba(0, 255, 0, 0.6)"},left:{position:"absolute",top:"0",bottom:"0",left:"0",backgroundColor:"rgba(0, 0, 255, 0.2)",borderRight:"2px dashed rgba(0, 0, 255, 0.6)"},right:{position:"absolute",top:"0",bottom:"0",right:"0",backgroundColor:"rgba(255, 255, 0, 0.2)",borderLeft:"2px dashed rgba(255, 255, 0, 0.6)"},label:{position:"absolute",fontSize:"10px",fontFamily:"monospace",color:"white",backgroundColor:"rgba(0, 0, 0, 0.7)",padding:"2px 4px",borderRadius:"2px"}},ii=class n{#e;#n;#i=!1;#o=null;#s=null;#l=null;#a=null;#h=null;#y=null;#t=null;#d=null;#r=!1;#b=new Map;#m=!1;#c=new Map;#g=!1;static#x={};#C=!1;#p=null;#f=null;#S=null;#E=null;constructor(e,t){this.#e=e,this.#n=t}showCameraTargets(){this.#i||(this.#i=!0,this.#A(),this.#G())}hideCameraTargets(){this.#i&&(this.#i=!1,this.#O(),this.#B())}setFocusOnPointCloud(e,t,r){!this.#i&&!this.#r||(this.#i&&(this.#h=e.map(o=>o.clone()),this.#w()),this.#L(e,t,r))}setGetFocusOnTransformPointCloud(e,t,r){!this.#i&&!this.#r||(this.#i&&(this.#y=e.map(o=>o.clone()),this.#w()),this.#L(e,t,r))}setAnimateToPosition(e){this.#i&&(this.#t=e.clone(),this.#w())}#A(){let e=this.#e.container;if(!e)return;this.#o=document.createElement("div"),this.#o.dataset.debugCameraTargets="true",Object.assign(this.#o.style,br.container),this.#s=document.createElement("div"),this.#s.dataset.debugType="focusOn",Object.assign(this.#s.style,br.focusOnBox),this.#s.style.display="none";let t=document.createElement("span");Object.assign(t.style,br.label),t.style.top="-20px",t.style.left="0",t.style.color="orange",t.textContent="focusOn",this.#s.appendChild(t),this.#l=document.createElement("div"),this.#l.dataset.debugType="getFocusOnTransform",Object.assign(this.#l.style,br.getFocusOnTransformBox),this.#l.style.display="none";let r=document.createElement("span");Object.assign(r.style,br.label),r.style.top="-20px",r.style.left="0",r.style.color="cyan",r.textContent="getFocusOnTransform",this.#l.appendChild(r),this.#a=document.createElement("div"),this.#a.dataset.debugType="animateTo",Object.assign(this.#a.style,br.animateToBox),this.#a.style.display="none";let o=document.createElement("span");Object.assign(o.style,br.label),o.style.top="-20px",o.style.left="50%",o.style.transform="translateX(-50%)",o.style.color="lime",o.textContent="animateTo",this.#a.appendChild(o),this.#o.appendChild(this.#s),this.#o.appendChild(this.#l),this.#o.appendChild(this.#a),e.appendChild(this.#o)}#B(){this.#o&&(this.#o.remove(),this.#o=null),this.#s=null,this.#l=null,this.#a=null}#G(){this.#d=this.#e.on("post-render",()=>{this.#w()})}#O(){this.#d!==null&&(this.#d(),this.#d=null)}#P(e){let t=1/0,r=1/0,o=-1/0,i=-1/0,s=new W;for(let a of e)this.#e.project(s,a),s.x!==-1e3&&(t=Math.min(t,s.x),r=Math.min(r,s.y),o=Math.max(o,s.x),i=Math.max(i,s.y));return t!==1/0?{minX:t,minY:r,maxX:o,maxY:i}:null}#R(e,t){if(!t||t.length===0){e.style.display="none";return}let r=this.#P(t);r?(e.style.display="block",e.style.left=`${r.minX}px`,e.style.top=`${r.minY}px`,e.style.width=`${r.maxX-r.minX}px`,e.style.height=`${r.maxY-r.minY}px`):e.style.display="none"}#w(){if(!(!this.#i||!this.#o))if(this.#s&&this.#R(this.#s,this.#h),this.#l&&this.#R(this.#l,this.#y),this.#a&&this.#t){let e=new W;this.#e.project(e,this.#t),e.x!==-1e3?(this.#a.style.display="block",this.#a.style.left=`${e.x}px`,this.#a.style.top=`${e.y}px`):this.#a.style.display="none"}else this.#a&&(this.#a.style.display="none")}showFocusOnDebug(e){if(e===!1){this.hideFocusOnDebug();return}this.#D(this.#b),this.#D(this.#c),this.#r=!0,this.#m=e.pointCloud===!1?!1:{size:e.pointCloud?.size??2,color:e.pointCloud?.color??"lime"},this.#g=e.boundingBox===!1?!1:{color:e.boundingBox?.color??"lime"}}hideFocusOnDebug(){this.#r&&(this.#r=!1,this.#m=!1,this.#g=!1,this.#D(this.#b),this.#D(this.#c))}#L(e,t,r){if(!this.#r)return;let o=t??n.#x;this.#m!==!1&&this.#_(e,o,r),this.#g!==!1&&this.#I(e,o,r)}#_(e,t,r){let o=this.#e.getThreeScene();if(!o||e.length===0){this.#T(this.#b,t);return}if(this.#m===!1)return;let{size:i,color:s}=this.#m,a=r??s,l=this.#b.get(t);if(!l||l.count!==e.length){this.#T(this.#b,t);let u=new Fr(i,8,6),d=new Me({color:a,depthTest:!1,transparent:!0,opacity:.3});l=new K(u,d,e.length),l.renderOrder=9999,o.add(l),this.#b.set(t,l)}let c=new Ge;for(let u=0;u<e.length;u++)c.position.copy(e[u]),c.updateMatrix(),l.setMatrixAt(u,c.matrix);l.instanceMatrix.needsUpdate=!0,this.#e.render()}#T(e,t){let r=e.get(t);r&&(this.#e.getThreeScene()?.remove(r),r.geometry.dispose(),r.material.dispose(),e.delete(t))}#D(e){let t=this.#e.getThreeScene();for(let r of e.values())t?.remove(r),r.geometry.dispose(),r.material.dispose();e.clear()}#I(e,t,r){let o=this.#e.getThreeScene();if(!o||e.length===0){this.#T(this.#c,t);return}if(this.#g===!1)return;let i=r??this.#g.color,s=this.#e.getThreeCamera(),a=s.matrixWorldInverse,l=e.map(v=>v.clone().applyMatrix4(a)),c=new ce().setFromPoints(l),u=c.getSize(new O),d=c.getCenter(new O),h=new Y().copy(a).invert(),g=d.applyMatrix4(h),b=new _t().setFromRotationMatrix(s.matrixWorld);this.#T(this.#c,t);let M=new Nt(u.x,u.y,u.z),m=new So(M);M.dispose();let p=new Lr({color:i,depthTest:!1,transparent:!0,opacity:.5}),y=new Bt(m,p);y.position.copy(g),y.quaternion.copy(b),y.renderOrder=9999,o.add(y),this.#c.set(t,y),this.#e.render()}showScreenOffsets(){this.#C||(this.#C=!0,this.#F())}hideScreenOffsets(){this.#C&&(this.#C=!1,this.#N())}#F(){let e=this.#e.container;if(!e)return;this.#p=document.createElement("div"),this.#p.dataset.debugScreenOffsets="true",Object.assign(this.#p.style,ya.container);let t=r=>{let o=document.createElement("div");o.dataset.debugOffset=r,Object.assign(o.style,ya[r]);let i=document.createElement("span");switch(Object.assign(i.style,ya.label),i.dataset.debugLabel=r,r){case"top":i.style.bottom="4px",i.style.left="50%",i.style.transform="translateX(-50%)";break;case"bottom":i.style.top="4px",i.style.left="50%",i.style.transform="translateX(-50%)";break;case"left":i.style.right="4px",i.style.top="50%",i.style.transform="translateY(-50%)";break;case"right":i.style.left="4px",i.style.top="50%",i.style.transform="translateY(-50%)";break}return o.appendChild(i),o};this.#f={top:t("top"),bottom:t("bottom"),left:t("left"),right:t("right")},this.#p.appendChild(this.#f.top),this.#p.appendChild(this.#f.bottom),this.#p.appendChild(this.#f.left),this.#p.appendChild(this.#f.right),e.appendChild(this.#p),this.#M(),this.#E=this.#n.on("padding-change",()=>{this.#M()}),this.#S=new ResizeObserver(()=>{this.#M()}),this.#S.observe(e)}#N(){this.#E&&(this.#E(),this.#E=null),this.#S&&(this.#S.disconnect(),this.#S=null),this.#p&&(this.#p.remove(),this.#p=null),this.#f=null}#M(){if(!this.#f||!this.#p)return;let e=this.#n.insetsPadding,t=this.#e.container,r=t.clientWidth,o=t.clientHeight,i=Ur(e,r,o),s=this.#f.top,a=s.querySelector("[data-debug-label]");i.top>0?(s.style.height=`${i.top}px`,s.style.display="block",a&&(a.textContent=`top: ${this.#v(e.top,e.type)}`)):s.style.display="none";let l=this.#f.bottom,c=l.querySelector("[data-debug-label]");i.bottom>0?(l.style.height=`${i.bottom}px`,l.style.display="block",c&&(c.textContent=`bottom: ${this.#v(e.bottom,e.type)}`)):l.style.display="none";let u=this.#f.left,d=u.querySelector("[data-debug-label]");i.left>0?(u.style.height="",u.style.top=`${i.top}px`,u.style.bottom=`${i.bottom}px`,u.style.width=`${i.left}px`,u.style.display="block",d&&(d.textContent=`left: ${this.#v(e.left,e.type)}`)):u.style.display="none";let h=this.#f.right,g=h.querySelector("[data-debug-label]");i.right>0?(h.style.height="",h.style.top=`${i.top}px`,h.style.bottom=`${i.bottom}px`,h.style.width=`${i.right}px`,h.style.display="block",g&&(g.textContent=`right: ${this.#v(e.right,e.type)}`)):h.style.display="none"}#v(e,t){return t==="portion"?`${(e*100).toFixed(1)}%`:`${e}px`}destroy(){this.hideCameraTargets(),this.hideScreenOffsets(),this.hideFocusOnDebug()}};var gm=0,ym=90,bm=(E.env.NODE_ENV==="test",!1),si={linear:ar.Linear.None,"ease-in":ar.Quadratic.In,"ease-out":ar.Quadratic.Out,"ease-in-out":ar.Quadratic.InOut},vm=-50,ai=class extends Z{#e;#n;#i;#o;constructor(e,t,r){super(),this.#e=e,this.#n=t,this.#i=r,this.#o=new ii(e,this),this.#e.map&&this.#e.map.transform.setMinElevationForCurrentTile(vm),this.#n.cameraSystem.on("pedestal-change",({pedestal:o})=>{this.#n.cameraSystem.setCameraPlaneElevation(o),this.#e.mode==="outdoors-overlay"&&typeof this.#e.map?.setCenterElevation=="function"&&this.#e.map.setCenterElevation(this.#n.cameraSystem.getPedestal())})}get center(){return this.#e.mode==="outdoors-overlay"&&this.#e.map?this.#e.map.getCenter?.().toArray():this.#n.cameraSystem.center}setCenter(e){if(this.#e.mode==="outdoors-overlay"&&this.#e.map){this.#e.map?.setCenter(e),this.#n.interactionSystem.handleHover();return}this.#n.cameraSystem.setCenter(e[0],e[1]),this.#n.interactionSystem.handleHover()}get zoomLevel(){return this.#e.mode==="outdoors-overlay"&&this.#e.map?this.#e.map?.getZoom():this.#n.cameraSystem.getZoomLevel()}setZoomLevel(e){this.#e.mode==="outdoors-overlay"&&this.#e.map&&this.#e.map?.setZoom(e),this.#n.cameraSystem.setZoomLevel(We(e,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits."))}getState(){return{zoomLevel:this.zoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,minPitch:this.minPitch,maxPitch:this.maxPitch,autoMinZoomLevel:this.autoMinZoomLevel,panMode:this.panMode,screenOffsets:this.insetsPadding,center:this.center,bearing:this.bearing,pitch:this.pitch,elevation:this.elevation}}get isAnimating(){return this.#n.cameraSystem.isAnimating}cancelAnimation(){this.#n.cameraSystem.cancelAnimation()}get maxZoomLevel(){return this.#n.cameraSystem.maxZoomLevel}get minZoomLevel(){return this.#n.cameraSystem.minZoomLevel}setAutoMinZoomLevel(e){this.#n.panBoundsSystem.autoMinZoomLevel=e,e&&(this.#n.panBoundsSystem.dirty=!0,this.#n.panBoundsSystem.update())}get autoMinZoomLevel(){return this.#n.panBoundsSystem.autoMinZoomLevel}setMinZoomLevel(e,t=!1){t&&this.setAutoMinZoomLevel(!1);let r=We(e,rt.MIN_MERCATOR_ZOOM_LEVEL,this.maxZoomLevel,`setMinZoomLevel was clamped. minZoomLevel must be between ${rt.MIN_MERCATOR_ZOOM_LEVEL} and maxZoomLevel.`);this.#n.cameraSystem.setMinZoomLevel(r),this.zoomLevel<r&&this.setZoomLevel(r),this.#e.map?.setMinZoom(r)}setMaxZoomLevel(e){let t=We(e,this.minZoomLevel,rt.MAX_MERCATOR_ZOOM_LEVEL,`setMaxZoomLevel was clamped. maxZoomLevel must be between minZoomLevel and ${rt.MAX_MERCATOR_ZOOM_LEVEL}.`);this.#n.cameraSystem.setMaxZoomLevel(t),this.zoomLevel>t&&this.setZoomLevel(t),this.#e.map?.setMaxZoom(t)}get maxPitch(){return this.#e.mode==="outdoors-overlay"&&this.#e.map?this.#e.map?.getMaxPitch?.():U.radToDeg(this.#n.cameraSystem.maxTilt)}get minPitch(){return this.#e.mode==="outdoors-overlay"&&this.#e.map?this.#e.map?.getMinPitch?.():U.radToDeg(this.#n.cameraSystem.minTilt)}setMinPitch(e){let t=Math.max(gm,e);this.#e.map?.setMinPitch(t),this.#n.cameraSystem.minTilt=U.degToRad(t)}setMaxPitch(e){let t=Math.min(ym,e);this.#e.map?.setMaxPitch(t),this.#n.cameraSystem.maxTilt=U.degToRad(t)}get bearing(){return this.#e.mode==="outdoors-overlay"&&this.#e.map?this.#e.map?.getBearing():U.radToDeg(this.#n.cameraSystem.getRotation())}setBearing(e){if(this.#e.mode==="outdoors-overlay"&&this.#e.map){this.#e.map?.setBearing(e);return}this.#n.cameraSystem.setRotation(U.degToRad(e))}get pitch(){return this.#e.mode==="outdoors-overlay"&&this.#e.map?this.#e.map?.getPitch():U.radToDeg(this.#n.cameraSystem.getTilt())}setPitch(e){if(this.#e.mode==="outdoors-overlay"&&this.#e.map){this.#e.map?.setPitch(e);return}this.#n.cameraSystem.setTilt(U.degToRad(We(e,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")))}get elevation(){return this.#n.cameraSystem.getPedestal()}get maxElevation(){return this.#n.cameraSystem.maxPedestal}setMaxElevation(e){this.#n.cameraSystem.maxPedestal=e,this.elevation>e&&this.setElevation(e)}setElevation(e){let t=We(e,-1/0,this.maxElevation,"elevation was clamped to maxElevation. Use mapView.Camera.setMaxElevation() to adjust the limit.");this.#n.cameraSystem.setPedestal(t,!0)}#s;animateElevation(e,t){this.#s&&this.#s.stop();let r=We(e,-1/0,this.maxElevation,"animateElevation was clamped to maxElevation. Use mapView.Camera.setMaxElevation() to adjust the limit.");return new Promise(o=>{this.#n.cameraSystem.animateCamera({position:{z:r}},t?.duration||300,si[t?.easing||"ease-in-out"],o,o,{interruptible:t?.interruptible??!0})})}get insetsPadding(){return this.#i.insetsPadding}get panMode(){return this.#n.cameraSystem.enablePan===!1&&this.#n.cameraSystem.enablePedestal===!0?"elevation":"default"}setPanMode(e){if(e!=="default"&&e!=="elevation")throw new Error("Invalid pan mode");e!==this.panMode&&(e==="default"?(this.#n.cameraSystem.enablePan=!0,this.#n.cameraSystem.enablePedestal=!1):(this.#n.cameraSystem.enablePan=!1,this.#n.cameraSystem.enablePedestal=!0))}setInsetPadding(e){let t=this.#i.insetsPadding;Object.keys(e).every(r=>e[r]===t[r])||(this.#i.insetsPadding=Object.assign({},t,e),this.publish("padding-change",{padding:this.#i.insetsPadding}))}animateTo(e){let t=e.center?this.#e.convertTo3DMapPosition(e.center[1],e.center[0],e.center[2]||this.elevation):void 0;if(t&&this.#o.setAnimateToPosition(t),this.#e.mode==="outdoors-overlay"&&this.#e.map)return this.#e.map?.flyTo({center:e.center??this.center,zoom:e.zoomLevel??this.zoomLevel,bearing:e.bearing??this.bearing,pitch:e.pitch??this.pitch,duration:e.duration??600}),Promise.resolve();let r=e.zoomLevel!==void 0?this.#n.cameraSystem.convertZoomLevelToAltitude(We(e.zoomLevel,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits.")):void 0,o=e.bearing!==void 0?U.degToRad(e.bearing):void 0,i=e.pitch!==void 0?U.degToRad(We(e.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0;return new Promise(s=>{this.#n.cameraSystem.animateCamera({position:t,zoom:r,rotation:o,tilt:i},e.duration||0,si[e.easing||"ease-in-out"],()=>{this.#n.interactionSystem.handleHover(),s()},s,{interruptible:e?.interruptible??!0})})}getCameraFrameForCoordinates(e,t){let r=this.#l(t||{},()=>Promise.resolve()),{pointCloud:o}=Uu(e,this.#e,this.#i.geometry3DMap);if(o.length===0)return _.error("No valid coordinates found in targets:",e),{center:this.center,zoomLevel:this.zoomLevel};this.#o.setGetFocusOnTransformPointCloud(o,t?.debugKey,t?.debugColor);let{center:i,zoomLevel:s}=this.#n.cameraSystem.getCameraFrameForCoordinates(o,r);return{center:this.#e.convert3DMapPositionToCoordinate(i),zoomLevel:s}}#l(e,t){return{minZoom:e?.maxZoomLevel===void 0?void 0:this.#n.cameraSystem.convertZoomLevelToAltitude(We(e.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMaxZoomLevel() to adjust limits.")),maxZoom:e?.minZoomLevel===void 0?void 0:this.#n.cameraSystem.convertZoomLevelToAltitude(We(e.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() to adjust limits.")),padding:e?.padding?Object.assign({},Do,e?.padding):this.insetsPadding,curve:si[e?.easing||"ease-in-out"],rotation:e?.bearing===void 0?void 0:U.degToRad(e.bearing),tilt:e?.pitch!==void 0?U.degToRad(We(e.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0,duration:e?.duration,callback:()=>{this.#n.interactionSystem.handleHover(),t()},cancelledCallback:t,interruptible:e?.interruptible??!0,verticalPadding:e?.verticalPadding}}focusOn(e,t){let{pointCloud:r,geoBounds:o,firstPosition:i}=Uu(e,this.#e,this.#i.geometry3DMap);return r.length===0?(_.error("No valid coordinates found in targets:",e),Promise.resolve()):(this.#o.setFocusOnPointCloud(r,t?.debugKey,t?.debugColor),this.#e.mode==="outdoors-overlay"&&this.#e.map?(r.length===1&&i?this.#e.map?.flyTo({center:[i[0],i[1]],duration:t?.duration||this.#e.map.getBearing(),animate:!0,bearing:t?.bearing===void 0?this.#e.map.getBearing():t?.bearing,pitch:t?.pitch===void 0?this.#e.map.getPitch():t?.pitch,zoom:t?.maxZoomLevel||this.#e.map.getMaxZoom()}):(bm&&xm(this.#e,o),this.#e.map?.fitBounds(o,{duration:t?.duration??rt.DEFAULT_ANIMATION_DURATION,bearing:t?.bearing===void 0?this.#e.map.getBearing():t?.bearing,pitch:t?.pitch===void 0?this.#e.map.getPitch():t?.pitch,maxZoom:t?.maxZoomLevel??this.#e.map.getMaxZoom()})),this.#n.interactionSystem.handleHover(),Promise.resolve()):new Promise(s=>{this.#n.cameraSystem.focusOn(r,this.#l(t||{},s))}))}showCameraTargetsDebug(){this.#o.showCameraTargets()}hideCameraTargetsDebug(){this.#o.hideCameraTargets()}showFocusOnDebug(e){this.#o.showFocusOnDebug(e)}hideFocusOnDebug(){this.#o.hideFocusOnDebug()}showScreenOffsetsDebug(){this.#o.showScreenOffsets()}hideScreenOffsetsDebug(){this.#o.hideScreenOffsets()}destroy(){this.#o.destroy(),super.destroy()}};function ba(n,e){n[0]=Math.min(n[0],e[0]),n[1]=Math.min(n[1],e[1]),n[2]=Math.max(n[2],e[0]),n[3]=Math.max(n[3],e[1])}function Uu(n,e,t){let r=[],o=[1/0,1/0,-1/0,-1/0],i=null;if(!n||!Array.isArray(n)||n.length===0)return{pointCloud:r,geoBounds:o,firstPosition:i};let s=e.getSystems().renderSystem;for(let a of n)if(typeof a=="string"){(s.threeDdirty||s.twoDdirty)&&e.renderSync();let l=t.get(a);if(!l){_.error("Entity not found with id:",a);continue}let c=new ce;Tc(e,"userData"in l?l.userData.entityId??l.id:l.id,r,c,l instanceof ie?l.position.z:void 0);let u=e.convert3DMapPositionToCoordinate(c.min),d=e.convert3DMapPositionToCoordinate(c.max);ba(o,u),ba(o,d),i||(i=e.convert3DMapPositionToCoordinate(c.getCenter(new O)))}else r.push(e.convertTo3DMapPosition(a[1],a[0],a[2]||0)),ba(o,a),i||(i=a);return{pointCloud:r,geoBounds:o,firstPosition:i}}function xm(n,e){let t=[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]],[e[0],e[1]]];n.map?.getLayer("bounds-outline")&&n.map.removeLayer("bounds-outline"),n.map?.getSource("bounds-source")&&n.map.removeSource("bounds-source"),n.map?.addSource("bounds-source",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:t}}}),n.map?.addLayer({id:"bounds-outline",type:"line",source:"bounds-source",layout:{},paint:{"line-color":"#FF0000","line-width":2,"line-opacity":.8}})}f();f();var Hu=`uniform vec4 uSize;
|
|
7
|
+
Pos: ${t.position?.toArray().join(", ")}`,"#caffbf")})}get _state(){return this.state}queueDebugMessage(e,t){let r=document.createElement("pre");r.style.maxWidth="300px",r.style.transition="opacity 500ms cubic-bezier(0.4, 0, 0.2, 1)",r.style.backgroundColor=t,r.textContent=e,this.debugPanel?.prepend(r),setTimeout(()=>{r.style.opacity="0",setTimeout(()=>{r.remove()},500)},2500)}getCursor(){return this.cursor}};function Tu(n,e,t){let r=n.components[2];r&&r.hover!==!0&&(r.hover=e?"user-interaction":!1,r.dirty=!0);let o=n.components[0].textMesh?.userData.entityId;if(!o)return;let i=t.geometry3DMap.get(o);i?.type==="text3d"&&(i.components[1].hoverByPolygon=e,i.components[1].dirty=!0)}function Up(n,e,t){return e?"grabbing":n?"pointer":t?"grabbing":"grab"}function Hp(n){if(n.length<=1)return;let e=[],t=[],r=[];for(let i=0;i<n.length;i++){let s=n[i];s.components?s.type==="marker"?e.push(s):t.push(s):r.push(s)}if(e.length>1){let i,s;e.sort((a,l)=>{i=a.components[0],s=l.components[0];let c=i.projection.y,u=s.projection.y;return c!==u?u-c:i.markerContainer.compareDocumentPosition(s.markerContainer)&Node.DOCUMENT_POSITION_FOLLOWING?1:-1})}if(t.length>1){let i=[];for(let s=0;s<t.length;s++){let a=t[s],l=a.components[0];i.push({entity:a,y:l.projection.y,idx:s})}i.sort((s,a)=>s.y!==a.y?a.y-s.y:a.idx-s.idx);for(let s=0;s<i.length;s++)t[s]=i[s].entity}let o=0;for(let i=0;i<e.length;i++)n[o++]=e[i];for(let i=0;i<t.length;i++)n[o++]=t[i];for(let i=0;i<r.length;i++)n[o++]=r[i]}f();f();f();var Du=new Y;function bn(n,e=!0){let t=new Ft,r=n.mesh?.geometry;if(!r||!n.batchedProps?.range)return;let o=n.batchedProps.range,i=o.start,s=o.count,a=r.getAttribute("position");if(a){let u=new Float32Array(s*3);for(let d=0;d<s;d++){let h=i+d;u[d*3]=a.array[h*3],u[d*3+1]=a.array[h*3+1],u[d*3+2]=a.array[h*3+2]}t.setAttribute("position",new ke(u,3))}let l=r.getAttribute("normal");if(l){let u=new Float32Array(s*3);for(let d=0;d<s;d++){let h=i+d;u[d*3]=l.array[h*3],u[d*3+1]=l.array[h*3+1],u[d*3+2]=l.array[h*3+2]}t.setAttribute("normal",new ke(u,3))}let c=r.getAttribute("uv");if(c){let u=new Float32Array(s*2);for(let d=0;d<s;d++){let h=i+d;u[d*2]=c.array[h*2],u[d*2+1]=c.array[h*2+1]}t.setAttribute("uv",new ke(u,2))}if(r.index){let u=r.index,d=new Uint32Array(s);for(let h=0;h<s;h++)d[h]=u.array[i+h];t.setIndex(new ke(d,1))}if(e&&n.instanceIndex!==-1&&kr(n.mesh))try{n.mesh.getMatrixAt(n.instanceIndex,Du),t.applyMatrix4(Du)}catch(u){_.error(u)}return t}function Pu(n,e,t){let r=bn(n,!1);if(!r||!kr(n.mesh))return;n.mesh.getMatrixAt(n.instanceIndex,t),n.mesh.deleteInstance(n.instanceIndex),n.mesh.optimize();let o=e.addGeometry(r);e.addInstance(o),e.setMatrixAt(o,t);let i=e.getGeometryIdAt(o),s=e.getGeometryRangeAt(i);return s&&n.batchedProps&&(n.batchedProps.range=s),r.dispose(),o}function Iu(n,e){if(e===0)return;let t=n.getAttribute("position");for(let r=0;r<t.count;r++)t.setZ(r,t.getZ(r)+e);t.needsUpdate=!0}var vn=class{#e=null;#n;constructor(e){this.#n=e}getCurrentSceneGLTF=async e=>{let t={onlyVisible:!0,binary:!0,light:!0,scale:1,...e},r=await this.#o(),o=this.#i(t),i=await r.parseAsync(o,{trs:!1,maxTextureSize:1/0,onlyVisible:t.onlyVisible,binary:t.binary,scale:t.scale}),s;if(i instanceof ArrayBuffer)s=new Blob([i],{type:"application/octet-stream"});else{let a=JSON.stringify(i,null,2);s=new Blob([a],{type:"text/plain"})}return s};#i=e=>{let{scale:t,light:r,onlyVisible:o}=e,i=new St,s=new ce().setFromObject(this.#n.geometryScene);if(this.#s(this.#n.geometryScene,i,o),r){let a=new Co(16777215,.3*Math.PI);a.position.set(0,Math.max(s.max.x,s.max.y)*t*.5,s.max.y*t*4),a.lookAt(0,0,-1),a.target.position.set(0,0,-1),a.add(a.target),i.add(a)}return i};async#o(){if(!this.#e){let{GLTFExporter:e}=await import("./GLTFExporter-V762TD2A.js");this.#e=new e}return this.#e}#s=(e,t,r)=>{e.material&&e instanceof xo&&this.#a(e).forEach(o=>t.add(o)),e.children.forEach(o=>{(!r||o.visible)&&this.#s(o,t,r)})};#l=(e,t,r)=>{let o=new un({color:new k(e),metalness:0});return o.opacity=t,o.transparent=r,o};#a(e){let t=[],o=(e.userData?.entities?Object.values(e.userData?.entities):[]).map(a=>this.#n.geometry3DMap.get(a)),i=new Map;e.updateWorldMatrix(!0,!1);let s=new O;return e.getWorldPosition(s),o.forEach(a=>{if(!a||!(a instanceof $))return;let l=a.components[1],c=a.components[2];if(!l.visible||l instanceof ct&&l.opacity===0||l instanceof pn||l instanceof _o)return;let d=`${c?.hover?l.hoverColor||this.#n.hoverColor:l.color}-${l.opacity}-${Number(l.visible)}`;i.has(d)||i.set(d,[]),i.get(d)?.push(a)}),i.forEach((a,l)=>{let[c,u,d]=l.split("-"),h=a.reduce((m,p)=>{if(p.type==="custom-geometry")return m;let y=p.components[0];if("geometry"in y&&y.geometry instanceof Ft){let v=y.geometry.clone();Iu(v,s.z),m.push(v)}else if(y instanceof oe&&y.batchedProps){let v=bn(y);v&&(Iu(v,s.z),m.push(v))}return m},[]);if(h.length===0){_.error("No geometries found for batched mesh");return}let g=this.#l(c,Number(u),e.material.transparent),b=ze(h,!0);if(!b){_.error("No merged geometry found for batched mesh");return}let M=new W(b,g);M.position.copy(e.position),M.rotation.copy(e.rotation),M.scale.copy(e.scale),M.visible=!!d,this.#d(M.position,M.scale,M.rotation,M.quaternion),t.push(this.#h(M))}),t}#h=e=>{let{geometry:t,material:r,position:o,rotation:i,quaternion:s,scale:a}=e;if(!t?.isBufferGeometry)return e;let l=t.attributes.position,c=t.attributes.normal,u=t.attributes.uv;return this.#y(l,c),this.#d(o,a,i,s),u&&this.#r(u),r?.map&&t.type==="PlaneGeometry"&&(e.side=Rt),e};#y=(e,t)=>{let r=new O,o=new O;for(let i=0;i<e.count;i++)r.fromBufferAttribute(e,i),this.#t(r),e.setXYZ(i,r.x,r.y,r.z),t&&(o.fromBufferAttribute(t,i),this.#t(o),t.setXYZ(i,o.x,o.y,o.z))};#t=e=>{let t=e.y;e.y=e.z,e.z=-t};#d=(e,t,r,o)=>{let i=e.y;e.y=e.z,e.z=-i;let s=t.y;if(t.y=t.z,t.z=s,r instanceof xt)r.order="YXZ",r.set(r.x,r.y,r.z,r.order);else{let a=o.y;o.set(o.x,o.z,-a,o.w)}};#r=e=>{for(let t=0;t<e.count;t++){let r=e.getX(t),o=e.getY(t);e.setXY(t,r,o)}};destroy(){this.#e=null}};f();f();var Vp="gray",Wp=.1,xn=100,na=new lt.ClipperOffset;function Sn(n){let e=n.length;if(e<2)return e;let t=n[0],r=n[e-1];return t.x===r.x&&t.y===r.y?e-1:e}function oa(n,e){if(e<3)return 0;let t=0,r=0,o=0,i=0;for(let a=1;a<e;a++)n[a].x<n[t].x&&(t=a),n[a].y<n[r].y&&(r=a),n[a].x>n[o].x&&(o=a),n[a].y>n[i].y&&(i=a);let s=a=>a===t||a===r||a===o||a===i;for(let a=0;a<e;a++){let l=(a+e-1)%e;if(!s(a)&&!s(l))return a}for(let a=0;a<e;a++)if(!s(a))return a;return(t-(e>>1)+e)%e}function jp(n,e){na.Clear(),e/=2;let t=n.map(o=>({X:o.x*xn,Y:o.y*xn}));na.AddPath(t,lt.JoinType.jtMiter,lt.EndType.etClosedPolygon);let r=new lt.Paths;return na.Execute(r,e*xn),r.length?r.map(i=>i.map(s=>({x:s.X/xn,y:s.Y/xn}))):[n]}function jo(n,e,t){let{color:r=Vp,opacity:o=1,altitude:i=0,height:s=Wp}=t||{};Array.isArray(o)&&(o=1);let a={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:s+i},center:{x:0,y:0,z:(s+i)/2}},c=n.geometry.coordinates[0].map(g=>{let b=e(g[1],g[0]);return a.min.x=Math.min(a.min.x,b.x),a.min.y=Math.min(a.min.y,b.y),a.max.x=Math.max(a.max.x,b.x),a.max.y=Math.max(a.max.y,b.y),b});n.properties?.style?.edgeOffset!=null&&n.properties.style.edgeOffset!==0||n.properties?.image!=null?c=jp(c,n.properties?.style?.edgeOffset||0):c=[c];let u=[];for(let g of c){let b=new Rr,M=Sn(g),m=oa(g,M);b.moveTo(g[m].x,g[m].y);for(let x=1;x<M;x++){let S=(m+x)%M;b.lineTo(g[S].x,g[S].y)}let p=n.geometry.coordinates.slice(1);b.holes=p.map(x=>{let S=x.map(C=>e(C[1],C[0])),w=new Ar,D=Sn(S);w.moveTo(S[0].x,S[0].y);for(let C=1;C<D;C++)w.lineTo(S[C].x,S[C].y);return w});let y=hn(t?.bevel,s),v=new _r(b,y);v.userData={style:{color:r,opacity:o},usedBevelSettings:y},u.push(v)}if(u.length===1)return u[0];let d=ze(u);u.forEach(g=>g.dispose());let h=hn(t?.bevel,s);return d.userData={style:{color:r,opacity:o},usedBevelSettings:h,_split:!0},d}f();var Zp="gray",Xp=.1;function Zo(n,e,t){let{color:r=Zp,opacity:o=1,altitude:i=0,height:s=Xp}=t||{};Array.isArray(o)&&(o=1);let a={min:{x:1/0,y:1/0,z:i},max:{x:-1/0,y:-1/0,z:s+i}},l=hn(t?.bevel,s),c=[];n.geometry.coordinates.forEach(d=>{let h=new Rr,g=d[0].map(y=>{let v=e(y[1],y[0]);return a.min.x=Math.min(a.min.x,v.x),a.min.y=Math.min(a.min.y,v.y),a.max.x=Math.max(a.max.x,v.x),a.max.y=Math.max(a.max.y,v.y),v}),b=Sn(g),M=oa(g,b);h.moveTo(g[M].x,g[M].y);for(let y=1;y<b;y++){let v=(M+y)%b;h.lineTo(g[v].x,g[v].y)}let m=d.slice(1);h.holes=m.map(y=>{let v=y.map(w=>e(w[1],w[0])),x=new Ar,S=Sn(v);x.moveTo(v[0].x,v[0].y);for(let w=1;w<S;w++)x.lineTo(v[w].x,v[w].y);return x});let p=new _r(h,l);c.push(p)});let u=ze(c);return c.forEach(d=>d.dispose()),u.userData={style:{color:r,opacity:o},usedBevelSettings:l},u}f();var Ae=100,Yp=.22,$p=.01;function Ou(n,e,t={}){let{width:r=Yp,height:o=$p,color:i="gray",opacity:s=1,altitude:a=0}=t,l={min:{x:1/0,y:1/0,z:a},max:{x:-1/0,y:-1/0,z:a+o}},c={bevelEnabled:!1,depth:o},u=new lt.ClipperOffset,d=n.geometry.coordinates.map(M=>M.map(m=>e(m[1],m[0])));u.AddPaths(d.map(M=>M.map(m=>({X:m.x*Ae,Y:m.y*Ae}))),lt.JoinType.jsMiter,lt.EndType.etOpenRound);let h=new lt.PolyTree;u.Execute(h,r/2*Ae);let g=[];for(let M of h.m_AllPolys){let m=new Rr;if(M.IsHole())continue;l.min.x=Math.min(l.min.x,M.m_polygon[0].X),l.min.y=Math.min(l.min.y,M.m_polygon[0].Y),l.max.x=Math.max(l.max.x,M.m_polygon[0].X),l.max.y=Math.max(l.max.y,M.m_polygon[0].Y);let p=M.m_polygon;m.moveTo(p[0].X/Ae,p[0].Y/Ae),p.slice(1).forEach(y=>m.lineTo(y.X/Ae,y.Y/Ae)),m.lineTo(p[0].X/Ae,p[0].Y/Ae),m.holes=M.m_Childs.map(y=>{let v=new Ar,x=y.m_polygon;return v.moveTo(x[0].X/Ae,x[0].Y/Ae),x.slice(1).forEach(S=>v.lineTo(S.X/Ae,S.Y/Ae)),v.lineTo(x[0].X/Ae,x[0].Y/Ae),v}),g.push(new _r(m,c))}let b=ze(g);return b.translate(0,0,a||0),b.userData={style:{color:i,opacity:s}},u.Clear(),b}function qp(n){let e=n[1],t=n[6],{opacity:r}=e??{},{texture:o,topTexture:i}=t??{};return`${r}${o?.path||""}${i?.path||""}`}var Xo=class extends Z{state;convertTo3DMapPosition;constructor(e,t){super(),this.state=e,this.convertTo3DMapPosition=t}createEntityFromFeature(e,t,r){let o=new oe(t),i=Array.isArray(t)?t[0]?.properties:t.properties,s=i?.bevel,a=r&&"bevel"in r?r.bevel:void 0,l;a?l={...s,...a}:s&&(l=s);let c=new $(o,new ct({...r,url:i?.image?.path,bevel:l}));if(r?.outline){let u=this.state.outlinesOptions?.darkenFactor;c.components[3]=new kc(Vc(r.color,u))}return r?.focusable&&(c.components[4]=new $c),i?.textures!=null&&Array.isArray(i.textures)&&i.textures.length>0?c.components[6]=new pr(i.textures.find(u=>u.face==="side"),i.textures.find(u=>u.face==="top")):(r!=null&&"texture"in r&&r.texture!=null||r!=null&&"topTexture"in r&&r.topTexture!=null)&&(c.components[6]=new pr(r.texture,r.topTexture)),c.id=Array.isArray(t)?e+"-merged":e,c}populateEntityMesh(e,t,r=!1){let o=e.components[0];o.geometry=t,r||(o.batchedProps={range:{start:0,count:1/0,indexCount:1/0,indexStart:0,vertexCount:1/0,vertexStart:0,reservedVertexCount:1/0,reservedIndexCount:1/0},geometryId:-1,positionCount:t.attributes.position.count}),o.currentHeight=e.components[1].height,e.components[1].initialHeight=e.components[1].height,o.dirty=!1}populateEntityGroup(e){let t,r,o;for(let i of e.values())if(o=this.state.geometry3DMap.get(i),o.components[0]instanceof oe){t=o.components[0].feature,r=o.components[1];try{if(Array.isArray(t)){let s=[];for(let l of t){let c=this.#e(l,r);c!=null&&s.push(c)}let a=ze(s);this.populateEntityMesh(o,a,!0),s.forEach(l=>l.dispose())}else{let s=this.#e(t,r);s!=null&&this.populateEntityMesh(o,s)}}catch(s){_.warn(`Failed to create mesh for entity ${i}:`,s)}}return e}#e(e,t){let r;return e.geometry.type==="Polygon"?(r=jo(e,this.convertTo3DMapPosition,t),e.properties?.textures&&e.properties.textures.length>0&&Wc(r,e.properties.textures,this.state.naturalBearing,this.convertTo3DMapPosition)):e.geometry.type==="MultiPolygon"?r=Zo(e,this.convertTo3DMapPosition,t):e.geometry.type==="LineString"?r=vu(e,this.convertTo3DMapPosition,t):e.geometry.type==="MultiLineString"&&(r=Ou(e,this.convertTo3DMapPosition,t)),r}update(){for(let e of this.state.geometryGroupIdsToLoad.values()){let t=this.state.geometry3DMap.get(e);if(t instanceof Ce&&t.userData.dirty&&!t.userData.modelURL){try{this.populateEntityGroup(t.userData.entities3D)}catch(i){_.warn(i)}let r,o={};if(t.userData.isMerged){let i=t.userData.entities3D.values().next().value;if(i&&(r=this.state.geometry3DMap.get(i),r?.type==="geometry")){let s=r.getComponent("geometry"),a=r.getComponent("style");if(s&&a){let l=new pc({color:a.color}),c=new Vt(s?.geometry,l);l.setColor(new k(a.color),new k(a.topColor??a.color)),c.renderOrder=ue.GEOMETRY,c.frustumCulled=!0,c.userData.entityId=r.id,c.layers.enable(Oe.SHOULD_CAST_SHADOWS),s.mesh=c,s.material=l,t.add(c)}}}else{for(let i of t.userData.entities3D.values()){r=this.state.geometry3DMap.get(i);let s=r?.components[0];if(r?.type==="geometry"){let a=qp(r.components);o[a]===void 0&&(o[a]={style:r.components[1],entities:[]}),o[a].entities.push(r)}else s&&"mesh"in s&&s.mesh&&s.mesh?.parent!==t&&t.add(s.mesh)}for(let i in o){let s=Hc(o[i].entities,o[i].style);s.layers.enable(Oe.SHOULD_CAST_SHADOWS),t.add(s)}}for(let i of t.userData.entities3D.values())if(r=this.state.geometry3DMap.get(i),r!=null&&r.entities2D.size>0)for(let s of r.entities2D.values())s&&(r.attach(s),this.publish("geometry-2d-added"));this.publish("geometry-group-added"),t.userData.dirty=!1,t.userData.localCenter=void 0}}return Promise.resolve()}};f();var Yo=new ce,Lu=new O;function Jp(n,e){let t=n.components[2],r=n.components[1];return t?.hover?[r.hoverColor||e,r.hoverColor||e]:[r.color,r.topColor||r.color]}var $o=class{state;transparencyChanged=!1;convertTo3DMapPosition;convert3DMapPositionToCoordinate;constructor(e,t,r){this.convertTo3DMapPosition=t,this.convert3DMapPositionToCoordinate=r,this.state=e}determineTextureVisiblity(e,t,r){let o=mn(e);(o?.texture!=null||o?.topTexture!=null)&&(r?.hover&&o.texturesVisible?o.hideTextures(e.instanceIndex):o.texturesVisible||o.showTextures(e.instanceIndex),t.texture==null&&o.removeSideTexture(e.instanceIndex),t.topTexture==null&&o.removeTopTexture(e.instanceIndex))}update(){let e,t;for(let r of this.state.geometry3DsInScene)if((r.type==="geometry"||r.type==="custom-geometry")&&(r.components[1]?.dirty||r.components[2]?.dirty)){let o=r.components[0],i=r.components[1];t=r.components[2];let s=Jp(r,this.state.hoverColor);o.setColor(s[0],s[1]);let a=mn(o);if(i.visible!==o.visible&&(o.visible=i.visible,o instanceof oe&&o.textMesh)){let c=this.state.geometry3DMap.get(o.textMesh.userData.entityId);c?.type==="text3d"&&c.components[0].polygonEntityId!=null&&(c.components[0].visible=i.visible)}i.altitude!==o.altitude&&(o.altitude=i.altitude);let l=i.opacity*Gr(r);if(a&&o.mesh&&o.type==="geometry"&&l!==o.opacity){if(a.opacity=l,a.transparent=l<1,o.imageMesh){let c=Array.isArray(o.imageMesh.material)?o.imageMesh.material:[o.imageMesh.material];for(let u of c)u.opacity=l}l===0?(o.mesh.layers.disable(Oe.SHOULD_CAST_SHADOWS),this.transparencyChanged=!0):o.opacity===0&&l!==0&&(o.mesh.layers.enable(Oe.SHOULD_CAST_SHADOWS),this.transparencyChanged=!0),o.opacity=l}if(i.renderOrder!==o.renderOrder&&(o.renderOrder=i.renderOrder),a&&Uc(a,i.side,l),a&&(a.setEffectRange(i.effectStart,i.effectDistance),a.setVisualEffect(i.darkenAmount,i.darkenUseDepth,i.desaturateAmount,i.desaturateUseDepth,i.washOutAmount,i.washOutUseDepth)),o instanceof oe&&i.shading!=null&&(i.shading?.start!==a?.getGradientShading().start||i.shading?.end!==a?.getGradientShading().end||i.shading?.intensity!==a?.getGradientShading().intensity)&&a?.setGradientShading(i.shading?.start??0,i.shading?.end??0,i.shading?.intensity??0),i.dirty=!1,o instanceof oe){let c=r.components[6];c instanceof pr&&this.determineTextureVisiblity(o,c,t)}r.components[2]&&(r.components[2].dirty=!1)}else if(r?.type==="image"&&r.components[1]?.dirty){e=r.components[0];let o=r.components[1];o.visible!==e.visible&&(e.visible=o.visible),o.dirty=!1}else if(r?.type==="text3d"&&r.components[1]?.dirty){e=r.components[0];let o=r.components[1],i=e.polygonEntityId!=null;o.visible!=null&&o.visible!==e.visible&&(e.visible=o.visible);let{textMesh:s}=e;if(s)if(Object.assign(s,o.getState()),i){let a=o.hoverColor??this.state.text3dHoverColor;s.color=o.hoverByPolygon?a:o.color??Ct.color,s.outlineColor=o.hoverByPolygon?a:o.outlineColor??Ct.outlineColor,s.strokeColor=o.hoverByPolygon?a:o.strokeColor??Ct.strokeColor}else s.color=o.color??Ct.color,s.outlineColor=o.outlineColor??Ct.outlineColor,s.strokeColor=o.strokeColor??Ct.strokeColor;o.dirty=!1}else if(r?.type==="feature-collection"&&r?.userData.dirty===!1&&r?.userData.positionDirty){let o=r;if(o.userData.localCenter||(Yo.makeEmpty(),Yo.setFromObject(o),Nr(Yo)&&(Yo.getCenter(Lu),o.userData.localCenter=Lu.clone())),!o.userData.centroid&&o.userData.localCenter){let i=this.convert3DMapPositionToCoordinate(o.userData.localCenter);o.userData.centroid=[i[0],i[1]]}if(o.userData.centroid&&o.userData.localCenter){let i=this.convertTo3DMapPosition(o.userData.centroid);o.position.x+=i.x-o.userData.localCenter.x,o.position.y+=i.y-o.userData.localCenter.y,o.userData.localCenter.set(i.x,i.y,o.userData.localCenter.z),o.userData.positionDirty=!1}}}endFrame=()=>{this.transparencyChanged=!1}};f();var qo=class extends Z{state;renderer;mode;scene;cameraObject;viewCamera;systems;constructor(e,t,r,o,i,s,a){super(),this.renderer=e,this.state=t,this.mode=r,this.scene=o,this.cameraObject=i,this.viewCamera=s,this.systems=a,this.systems.cameraSystem.on("pan-start",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!1,{signal:this.signal}),this.systems.cameraSystem.on("zoom-start",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!1,{signal:this.signal}),this.systems.cameraSystem.on("zoom-end",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!0,{signal:this.signal}),this.systems.cameraSystem.on("rotate-start",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!1,{signal:this.signal}),this.systems.cameraSystem.on("rotate-end",()=>this.systems.twoDEntitySystem.collidersNeedRecomputing=!0,{signal:this.signal})}twoDdirty=!0;threeDdirty=!0;frameId=null;update=(e=!1)=>{if(this.renderer?.renderer==null)return Promise.resolve();if(e){this.renderer.startFrame();let t=this.commitRenderState();return this.paint(),t}else return this.frameId?Promise.resolve():new Promise((t,r)=>{this.frameId=requestAnimationFrame(()=>this.renderer?.renderer==null?t():this.mode==="standalone"?(this.renderer.startFrame(),this.commitRenderState()?.then(()=>{this.paint(),t()}).catch(o=>{r(o)})):t())})};paint(){if(!this.renderer?.renderer)return;this.mode==="standalone"&&this.renderer.clear();let e=!this.state.useStandaloneCamera&&this.mode!=="standalone";e&&(this.viewCamera.matrixWorld.copy(this.cameraObject.matrixWorld),this.viewCamera.matrixWorldInverse.copy(this.cameraObject.matrixWorldInverse),this.viewCamera.projectionMatrix.multiply(this.cameraObject.matrixWorld)),this.renderer.renderFullScene(this.scene,e?this.viewCamera:this.cameraObject),e&&(this.viewCamera.projectionMatrix.multiply(this.cameraObject.matrixWorldInverse),this.viewCamera.matrixWorldInverse.identity())}commitRenderState=()=>{try{let e=[];this.frameId=null,this.publish("pre-render"),this.state.internalTweenGroup.update(),this.state.externalTweenGroup.update(),(this.mode==="outdoors-interleaved"||this.mode==="standalone")&&this.systems.cameraSystem.update(),this.state.shouldMeasureCanvas&&(this.state.shouldMeasureCanvas=!1,this.publish("measure-canvas")),this.twoDdirty&&(this.state.geometry2DIdsInScene.clear(),this.state.geometry2DsInScene.clear(),Lc(this.state.geometryScene,this.state.geometry2DMap,this.state.geometry2DIdsInScene,this.state.geometry2DsInScene),this.systems.twoDEntitySystem.syncTwoDEntities(),this.systems.twoDEntitySystem.markDirty(),this.twoDdirty=!1),this.threeDdirty&&(this.state.geometry3DIdsInScene.clear(),this.state.geometry3DsInScene.clear(),this.state.geometryGroupIdsToLoad.clear(),Oc(this.state.geometryScene,this.state.geometry3DMap,this.state.geometry3DIdsInScene,this.state.geometry3DsInScene,this.state.geometryGroupIdsToLoad),this.systems.interactionSystem.dirty3D=!0,this.systems.outlineInterpolationSystem.geometries3DDirty=!0,this.systems.geometryInFocusSystem.focusablesDirty=!0,this.systems.shadowsSystem&&(this.systems.shadowsSystem.needsRender=!0),this.threeDdirty=!1);let t=this.systems.batchedMeshSystem.update();t&&e.push(t);let r=this.systems.modelSystem.update();return r&&e.push(r),this.systems.borderSystem.update(),this.systems.meshDetachmentSystem.update(),this.systems.meshModificationSystem.update(),this.systems.renderOrderSystem.update(),this.systems.clippingPlaneSystem.update(),this.systems.imageSystem.update(this.systems.cameraSystem.getRotation(),this.systems.cameraSystem.isCameraMoving(),this.systems.cameraSystem.lastCameraStoppedMovingTime()),e.push(this.systems.text3DSystem.update(this.systems.cameraSystem.getRotation())),this.systems.customGeometrySystem.update(),this.systems.panBoundsSystem.update(),this.systems.geometryInFocusSystem.update(this.systems.cameraSystem.isCameraMoving(),this.systems.cameraSystem.lastCameraStoppedMovingTime()),this.systems.outlineInterpolationSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.zoomDirty),this.systems.pathSystem.update(this.systems.cameraSystem.minZoomAltitude,this.systems.cameraSystem.maxZoomAltitude,this.systems.cameraSystem.getZoomAltitude(),this.systems.cameraSystem.getCurrentMetersPerPixel()),this.systems.cameraSystem.postRender(),this.systems.occlusion2DSystem.update(),this.systems.watermarkSystem.insertIntoQuadTree(this.systems.twoDEntitySystem.interactiveCollidersQTree),this.systems.interactionSystem.updateQuadtree(this.systems.twoDEntitySystem.interactiveCollidersQTree),this.systems.twoDEntitySystem.updateWatermark({width:this.systems.watermarkSystem.width,height:this.systems.watermarkSystem.height,position:this.systems.watermarkSystem.options.position}),this.systems.twoDEntitySystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.isUserInteracting(),this.systems.cameraSystem.isCameraMoving(),this.systems.imageSystem.currentImageScreenBBoxes),this.systems.watermarkSystem.update(),this.systems.textureSystem.update(),this.systems.pluginSystem.update(this.state),this.systems.drawSystem.update(),this.systems.geometryDisposalSystem.update(),this.systems.maskingSystem.update(),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1,this.systems.cameraSystem.rotationDirty=!1,this.systems.shadowsSystem&&((this.systems.modelSystem.transparencyChanged||this.systems.drawSystem.transparencyChanged)&&(this.systems.shadowsSystem.needsRender=!0),this.systems.shadowsSystem.update(this.systems.cameraSystem.getZoomLevel(),this.systems.cameraSystem.getPedestal())),this.systems.modelSystem.endFrame(),this.systems.drawSystem.endFrame(),this.systems.cameraSystem.stateDirty&&(this.publish("camera-state-change"),this.systems.cameraSystem.stateDirty=!1),this.publish("post-render"),Promise.all(e)}catch(e){return Promise.reject(e)}};destroy(){this.frameId&&cancelAnimationFrame(this.frameId),this.systems.twoDEntitySystem.cancelPendingFrames(),this.state.geometry2DIdsInScene.clear(),this.state.geometry3DIdsInScene.clear(),this.systems.twoDEntitySystem.markDirty(),this.update(),super.destroy()}};f();f();f();f();f();import{z as F}from"zod";f();import{z as Jo}from"zod";var zr=Jo.object({type:Jo.enum(["Point"]),coordinates:Jo.array(Jo.number()).min(2).max(3)});var Kp=F.object({interactive:F.boolean().optional(),id:F.string().optional(),width:F.union([F.number(),F.string().regex(fo),F.object({on:F.literal("zoom-level").optional(),input:F.array(F.number()).nonempty(),output:F.union([F.array(F.number()).nonempty(),F.array(F.string().regex(fo)).nonempty()]),easing:F.string().optional()})]).optional(),accentColor:F.string().optional(),displayArrowsOnPath:F.boolean().optional(),animateArrowsOnPath:F.boolean().optional(),visibleThroughGeometry:F.boolean().optional(),dashed:F.boolean().optional(),travelledEndFraction:F.number().optional(),travelledColor:F.string().optional(),smoothingTension:F.number().optional(),smoothingCornerRadius:F.number().optional(),dashLength:F.number().optional(),dashGap:F.number().optional(),dashRelativeToWidth:F.boolean().optional(),dashSize:F.number().optional(),gapSize:F.number().optional(),dashAbsolute:F.boolean().optional(),dashMeters:F.number().optional(),gapMeters:F.number().optional(),__EXPERIMENTAL_GEOMETRY:F.enum(["tube","ribbon"]).optional(),__EXPERIMENTAL_ENDCAP_EXTENSION:F.tuple([F.number(),F.number()]).optional(),__EXPERIMENTAL_BILLBOARDING:F.union([F.boolean(),F.number().min(0).max(90)]).optional(),__EXPERIMENTAL_BORDER:F.object({enabled:F.boolean(),color:F.string(),width:F.number().optional()}).optional(),__EXPERIMENTAL_PREVENT_SELF_OVERLAP:F.boolean().optional(),xrayStyle:F.object({color:F.string().optional(),tint:F.number().min(0).max(1).optional(),dithering:F.number().min(0).optional()}).optional()}),Qp=F.object({type:F.enum(["Feature"]),geometry:zr,properties:F.object({parentId:F.any().optional()})});function Au(n,e){F.object({features:F.array(Qp)}).parse(n),Kp.parse(e)}function em(n,e){let t=Ls(n);t&&e==="tube"&&(_.warn("Screen-space pixel width is only supported with ribbon geometry. Falling back to world-space interpretation."),t=!1);let r;return typeof n=="object"&&"output"in n?r=n.output.map(o=>typeof o=="string"?At(o):Number(o)):sr(n)?r=[At(n)]:r=[n],{screenSpace:t,parsedOutputValues:r}}var fr=class{type="path";mesh=new He;material;geometry;outline;feature;options;width={on:"zoom-level",input:[17,22],output:[.8,.4]};breakpoint=0;screenSpace=!1;parsedOutputValues=[];altitudeBreakpoints;accentColor="blue";completeFraction=1;altitudeAdjustment=1;displayArrowsOnPath=!1;animateArrowsOnPath=!1;visibleThroughGeometry=!1;highlightStartFraction=0;highlightEndFraction=0;highlightCompleteFraction=1;highlightWidthMultiplier=1.1;highlightColor="red";highlightDisplayArrowsOnPath=!1;xrayOpacity=.25;xrayStyle;travelledEndFraction=0;travelledColor="#999";dashed=!1;smoothingTension=Mt.tension;smoothingCornerRadius=Mt.cornerRadius;dashLength=.1;dashGap=.1;dashRelativeToWidth=!1;dashSize=3;gapSize=2;dashAbsolute=!1;dashMeters=1;gapMeters=.5;__EXPERIMENTAL_GEOMETRY="tube";__EXPERIMENTAL_ENDCAP_EXTENSION=[.5,.5];__EXPERIMENTAL_BILLBOARDING=80;__EXPERIMENTAL_BORDER;__EXPERIMENTAL_PREVENT_SELF_OVERLAP=!1;isVertical=!1;dirty=!0;materialDirty=!0;constructor(e,t){this.feature=e,this.options=t||{},this.width=t?.width??this.width,this.accentColor=t?.accentColor??this.accentColor,this.displayArrowsOnPath=t?.displayArrowsOnPath??this.displayArrowsOnPath,this.animateArrowsOnPath=t?.animateArrowsOnPath??this.animateArrowsOnPath,this.highlightDisplayArrowsOnPath=t?.highlightDisplayArrowsOnPath??this.displayArrowsOnPath,this.visibleThroughGeometry=t?.visibleThroughGeometry??this.visibleThroughGeometry,this.dashed=t?.dashed??this.dashed,this.xrayOpacity=t?.xrayOpacity??this.xrayOpacity,this.xrayStyle=t?.xrayStyle,this.travelledEndFraction=t?.travelledEndFraction??this.travelledEndFraction,this.travelledColor=t?.travelledColor??this.travelledColor,this.smoothingTension=t?.smoothingTension??Mt.tension,this.smoothingCornerRadius=t?.smoothingCornerRadius??Mt.cornerRadius,this.dashLength=t?.dashLength??this.dashLength,this.dashGap=t?.dashGap??this.dashGap,this.dashRelativeToWidth=t?.dashRelativeToWidth??this.dashRelativeToWidth,this.dashSize=t?.dashSize??this.dashSize,this.gapSize=t?.gapSize??this.gapSize,this.dashAbsolute=t?.dashAbsolute??this.dashAbsolute,this.dashMeters=t?.dashMeters??this.dashMeters,this.gapMeters=t?.gapMeters??this.gapMeters,this.__EXPERIMENTAL_GEOMETRY=t?.__EXPERIMENTAL_GEOMETRY??"tube",this.__EXPERIMENTAL_ENDCAP_EXTENSION=t?.__EXPERIMENTAL_ENDCAP_EXTENSION??[.5,.5],this.__EXPERIMENTAL_BILLBOARDING=t?.__EXPERIMENTAL_BILLBOARDING??80,this.__EXPERIMENTAL_BORDER=t?.__EXPERIMENTAL_BORDER,this.__EXPERIMENTAL_PREVENT_SELF_OVERLAP=t?.__EXPERIMENTAL_PREVENT_SELF_OVERLAP??!1,this.updateScreenSpaceState()}updateScreenSpaceState(){let e=em(this.width,this.__EXPERIMENTAL_GEOMETRY);this.screenSpace=e.screenSpace,this.parsedOutputValues=e.parsedOutputValues}setColor(){}setOpacity(){}set visible(e){this.mesh&&(this.mesh.visible=e)}get visible(){return this.mesh?this.mesh.visible:!1}position=new O;#e=0;get altitude(){return this.#e}set altitude(e){this.mesh&&(this.mesh.position.z=e,this.#e=e)}set complete(e){this.material&&(this.material.uniforms.complete.value=e,this.material.needsUpdate=!0)}};f();f();f();function Ur(n,e,t){return n.type==="portion"?{top:n.top*t,left:n.left*e,bottom:n.bottom*t,right:n.right*e,type:"pixel"}:n}f();f();f();var Ru=(n,e)=>(e-n+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,_u=(n,e)=>new V(n.clientX-e.offsetLeft,n.clientY-e.offsetTop),ia=(n,e)=>Math.atan2(e.y-n.y,e.x-n.x),Mn=(n,e)=>Math.sqrt((e.y-n.y)**2+(e.x-n.x)**2),sa=(n,e)=>new V((n.x+e.x)/2,(n.y+e.y)/2),aa=n=>{let e=0,{wheelDelta:t,detail:r}=n;return t!==void 0?e=t:r!==void 0&&(e=-r),e};var Ko=class{input1;input2;lastAngle;lastDistance;totalDistance;first;second;constructor(e,t){this.input1=e,this.input2=t,this.lastAngle=ia(e,t),this.lastDistance=Mn(e,t),this.totalDistance=0,this.first=e,this.second=t}update(e,t){let r=Mn(e,t);this.input1=e,this.input2=t;let o=ia(e,t);this.lastAngle=o,this.lastDistance=r,this.totalDistance+=(Mn(this.first,e)+Mn(this.second,t))/2,this.first=sa(this.first,e),this.second=sa(this.second,t)}};f();var Cn=class{touch;camera;cameraPlane;viewCoordinate;snapHolderMatrix;snapCamera;cameraPosition;raycaster;worldCoordinate;snapshotted=!1;constructor(e,t,r){this.touch=e,this.camera=t,this.cameraPlane=r,this.viewCoordinate={x:e.x,y:e.y},this.camera.updateMatrixWorld(),this.camera.updateMatrix(),this.snapHolderMatrix=this.camera.matrixWorld.clone(),this.snapCamera=this.camera.clone(),this.snapshotCameraState()}snapshotCameraState(){this.camera.updateMatrix(),this.camera.updateMatrixWorld(),this.cameraPosition=this.camera.position.clone();let e=new V(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new kt,this.raycaster.setFromCamera(e,this.snapCamera);let t=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=t&&t.length>0?t[0].point:null,this.snapshotted=!0}updateAnchorState(e,t){this.camera=e,this.snapCamera=e.clone(),this.snapHolderMatrix=e.matrixWorld.clone(),this.updateViewCoordinate(t),this.snapshotCameraState()}updateViewCoordinate(e){this.viewCoordinate={x:e.x,y:e.y}}reUnproject(){let e=new V(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster?.setFromCamera(e,this.snapCamera);let t=this.raycaster?.intersectObject(this.cameraPlane,!0)[0];return t?t.point:void 0}};var rt={};Bp(rt,{BLOCK_MERCATOR_ZOOM_LEVEL:()=>rm,CLIPPING_RADIUS:()=>En,CONTROL_OPTIONS:()=>tm,DEFAULT_ANIMATION_DURATION:()=>ha,DEFAULT_BEARING:()=>am,DEFAULT_MAX_ZOOM_LEVEL:()=>im,DEFAULT_MIN_ZOOM_LEVEL:()=>ma,DEFAULT_PITCH:()=>sm,DEFAULT_ZOOM_LEVEL:()=>om,EVENTS:()=>pa,MAPLIBRE_TILE_SIZE:()=>Qo,MAX_LAT:()=>ca,MAX_MERCATOR_ZOOM_LEVEL:()=>ti,MIN_LAT:()=>la,MIN_MERCATOR_ZOOM_LEVEL:()=>ei,ROOM_MERCATOR_ZOOM_LEVEL:()=>nm,TWO_PI:()=>ua,WHEEL_ZOOM_MULTIPLIER:()=>da,ZRANGE:()=>Hr});f();var Qo=512,la=-85.051129,ca=85.051129,En=1e4,tm={chain:"chain",cancel:"cancel"},ua=Math.PI*2,Hr=100,da=1e4,ei=0,ti=24,rm=17,nm=20,ha=200,pa=["change","pan-start","pan-end","rotate-start","rotate-end","zoom-start","zoom-end","multi-start","multi-end","multi-cancel","pedestal-start","pedestal-change","pedestal-end","user-pan-start","user-pedestal-start","user-rotate-start","user-dolly-start","user-zoom-start","user-tilt-start","user-pan-end","user-pedestal-end","user-rotate-end","user-dolly-end","user-zoom-end","user-tilt-end","position-updated","zoom-updated","tilt-updated","rotation-updated"],om=18,ma=12,im=22,sm=0,am=0;f();f();var gr=class extends Error{};gr.prototype.name="InvalidTokenError";function lm(n){return decodeURIComponent(atob(n).replace(/(.)/g,(e,t)=>{let r=t.charCodeAt(0).toString(16).toUpperCase();return r.length<2&&(r="0"+r),"%"+r}))}function cm(n){let e=n.replace(/-/g,"+").replace(/_/g,"/");switch(e.length%4){case 0:break;case 2:e+="==";break;case 3:e+="=";break;default:throw new Error("base64 string is not of the correct length")}try{return lm(e)}catch{return atob(e)}}function Fu(n,e){if(typeof n!="string")throw new gr("Invalid token specified: must be a string");e||(e={});let t=e.header===!0?0:1,r=n.split(".")[t];if(typeof r!="string")throw new gr(`Invalid token specified: missing part #${t+1}`);let o;try{o=cm(r)}catch(i){throw new gr(`Invalid token specified: invalid base64 for part #${t+1} (${i.message})`)}try{return JSON.parse(o)}catch(i){throw new gr(`Invalid token specified: invalid json for part #${t+1} (${i.message})`)}}f();function Ve(n,e,t,r){return(n<e||n>t)&&_.warn(r),Math.min(t,Math.max(e,n))}function Qx(n){let e=Fu(n);if(e.sub==null)throw new Error("Access token is missing sub claim.");return{sub:e.sub,aud:typeof e.aud=="string"?[e.aud]:e.aud??[],capabilities:e.capabilities??{}}}function Et(n){return n*(Math.PI/180)}function Nu(n){return n*(180/Math.PI)}function ri(n,e){let t=Math.pow(10,e);return Math.sign(n)*Math.round(Math.abs(n)*t)/t}function Bu(n,e){return(n%e+e)%e}function Gu(n,e){let t=Bu(n,Math.PI*2),r=Bu(e,Math.PI*2),o=r-t,i=r+(o>Math.PI?-Math.PI*2:o<-Math.PI?Math.PI*2:0);return{start:t,end:i}}function eS(){return typeof window<"u"&&window!==null}function ku(n,e){let[t,r]=n,[o,i]=e,s=Et(o-t),a=Et(i-r);return Math.sqrt(s*s+a*a)*vt}function Ee(n,e){let[t,r]=n.map(u=>Et(u)),[o,i]=e.map(u=>Et(u)),s=i-r,l=(o-t)*Math.cos((r+i)/2),c=s;return Math.sqrt(l*l+c*c)*vt}function fa(n,e){return Math.sqrt(Math.pow(n.x-e.x,2)+Math.pow(n.y-e.y,2))}function ni(n){let e=Et(n),r=Math.cos(e)*vt;function o(s,a){let l=Et(s[0]),c=Et(s[1]),u=l*r,d=c*vt;return a?(a.x=u,a.y=d,a):{x:u,y:d}}return{toCartesian:o,toGeographic:(s,a)=>{let l=Nu(s/r),c=Nu(a/vt);return{lon:l,lat:c}}}}var oi=!1,um=!1;var Vr=class extends Z{dirty=!1;zoomDirty=!1;rotationDirty=!1;panDirty=!1;stateDirty=!1;#e=ma;zoomSpeed=5;rotateSpeed=100;enabled=!0;enableZoom=!0;enablePan=!0;enablePedestal=!1;maxPedestal=1/0;minPedestal=0;enableRotate=!0;minZoomAltitude=0;maxZoomAltitude=1/0;get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(e){this.minZoomAltitude=this.convertZoomLevelToAltitude(e),this.stateDirty=!0}get defaultMinZoomLevel(){return this.#e}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(e){this.maxZoomAltitude=this.convertZoomLevelToAltitude(e),this.stateDirty=!0}ignoreZoomLimits=!1;zoomFactor=1;panBounds={min:new O(1/0,1/0),max:new O(-1/0,-1/0),center:new O(0,0,0),radius:1/0};minTilt=0;maxTilt=1.2;MOUSE_BUTTONS={ORBIT:go.RIGHT,ZOOM:go.MIDDLE,PAN:go.LEFT};camera;scene;renderer;elevation;orbit;cameraPlane;raycaster=new kt;rendererState;options;state=-1;intersection;viewState=null;tweens=new Map;clock=new cc(!0);coords={mouse:new V,rotateStart:new V,rotateEnd:new V,rotateDelta:new V,panStart:new O,panCameraStart:new O,panEnd:new O,panDelta:new O,initialShiftPos:new V,initialPedestal:0,floorAnchor:new O};touch={origin:{offsetLeft:0,offsetTop:0},touches:[],anchor1:null,anchor2:null,inputs:null};scrollTimer=null;lastWheelTime=0;resetZoom=!1;zoomStart;pedestalScaleFactor=1;isUserZooming=!1;stayInsideBounds=!0;userInteracting=!1;cameraMoving=!1;lastCameraMoveTime=Date.now();constructor(e,t,r,o,i){super(),this.camera=e,this.renderer=r,this.rendererState=o,this.scene=t,this.options=i,this.elevation=e.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=e.position.z,i.mode==="outdoors-overlay"?this.addMovingStateListeners():this.addEventListeners()}addMovingStateListeners=()=>{for(let e of pa)e.endsWith("start")?(this.on(e,this.setCameraMoving),e.startsWith("user")&&this.on(e,this.setUserInteracting)):(e.endsWith("end")||e.endsWith("cancel"))&&(this.on(e,this.unsetCameraMoving),e.startsWith("user")&&this.on(e,this.unsetUserInteracting))};get scrollPercent(){let e=this.minPedestal,t=this.maxPedestal,r=this.getPedestal();return r=Math.min(r,t),r=Math.max(r,e),(r-e)/(t-e)*100}get fov(){return this.camera.fov}get scrolledToBottom(){return this.minPedestal===0||Math.floor(this.getPedestal())<=this.minPedestal}get scrolledToTop(){return this.maxPedestal===0||Math.ceil(this.getPedestal())>=this.maxPedestal}get center(){let e=this.getPosition(),{lat:t,lon:r}=Io(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,e.x,e.y);return[r,t]}setCenter(e,t){let{x:r,y:o}=Oo(this.rendererState.center?.[1]??0,this.rendererState.center?.[0]??0,t,e);this.setPosition(r,o)}raycastToFloor=e=>{this.raycaster.setFromCamera(e,this.camera);let t=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return t?t.point:new O};isUserInteracting=()=>this.userInteracting;getPosition=()=>new O(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z);getPedestal=()=>this.orbit.position.z;pan=(e,t)=>{isNaN(e)||isNaN(t)||(this.setPosition(this.orbit.position.x+e,this.orbit.position.y+t),this.publish("position-updated"))};postRender=()=>{(this.state===2||this.state===6)&&(this.raycaster.setFromCamera(this.coords.mouse,this.camera),this.intersection=this.raycaster.intersectObject(this.cameraPlane,!1)[0],this.intersection&&(this.coords.panStart.set(this.intersection.point.x,this.intersection.point.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0))),this.state===3&&this.resetZoom&&(this.resetZoom=!1,this.zoomStart=this.getZoomAltitude(),this.coords.floorAnchor=this.raycastToFloor(this.coords.mouse),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0)),this.state===7&&this.isAnimating===!1&&(this.state=-1,this.publish("multi-end"))};get isAnimating(){return this.rendererState.internalTweenGroup.getAll().some(e=>e.cameraAnimation)}isCameraMoving=()=>this.cameraMoving;lastCameraStoppedMovingTime=()=>this.lastCameraMoveTime;beginGesture=()=>{this.state=2,this.publish("pan-start")};endGesture=()=>{this.state===2&&(this.state=-1,this.publish("pan-end"))};setPosition=(e,t)=>{e===void 0||t===void 0||isNaN(e)||isNaN(t)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(e,t),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0,this.stateDirty=!0)};updateCameraPosition=(e,t)=>{let r=e-this.panBounds.center.x,o=t-this.panBounds.center.y,i=Math.sqrt(r*r+o*o);if(this.stayInsideBounds&&i>this.panBounds.radius){let s=Math.atan2(o,r),a={x:Math.cos(s)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(s)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=a.x,this.orbit.position.y=a.y}else this.orbit.position.x=e,this.orbit.position.y=t};tilt=e=>{if(isNaN(e))return;this.state===-1&&this.publish("rotate-start");let t=this.stayInsideBounds?Math.max(Math.min(e+this.getTilt(),this.maxTilt),this.minTilt):e+this.getTilt();t!==this.elevation.rotation.x&&(this.elevation.rotation.x=t,this.publish("tilt-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end"),this.stateDirty=!0};zoomIn=(e,t,r)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o/1.5},e,t,r)};zoomOut=(e,t,r)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o*1.5},e,t,r)};getRotation=()=>(-this.orbit.rotation.z+Math.PI*2)%(Math.PI*2);cancelAnimation=()=>{let e=Array.from(this.tweens.keys());if(e.length<1)return;let t=e[e.length-1];t.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(t),this.state===7&&(this.state=-1)};animateCamera=(e,t,r,o,i,s)=>{let a={interruptible:!0,...s},l={},c={},u=this.getPosition();if(e.position!=null&&(e.position.x!==void 0&&(l.x=u.x,c.x=e.position.x),e.position.y!==void 0&&(l.y=u.y,c.y=e.position.y),e.position.z!==void 0&&(l.z=u.z,c.z=e.position.z)),e.zoom!==void 0&&(l.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?c.zoom=e.zoom:c.zoom=Math.min(Math.max(e.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),e.rotation!==void 0){let{start:y,end:v}=Gu(this.getRotation(),e.rotation);l.rotation=y,c.rotation=v}e.tilt!==void 0&&(l.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?c.tilt=e.tilt:c.tilt=Math.max(Math.min(e.tilt,this.maxTilt),this.minTilt));let d=l.zoom!==c.zoom,h=l.rotation!==c.rotation,g=l.tilt!==c.tilt,b=new zl(l).to(c,E.env.TESTING?0:t).onUpdate(y=>{this.setMulti({x:y.x,y:y.y,z:y.z},y.zoom,y.rotation,y.tilt)}).onComplete(()=>{this.completeTween(b),this.publish("multi-end",{zooming:d,rotating:h,tilting:g}),o&&o()}).onStart(()=>{this.state!==7&&(this.state=7,b.state=7,this.publish("multi-start",{zooming:d,rotating:h,tilting:g})),this.publish("change")});this.rendererState.internalTweenGroup.add(b);let M=Array.from(this.tweens.entries()),m=M[M.length-1],p=!1;return m!=null&&(m[1].interruptible?(typeof m[1].cancelledCallback=="function"&&m[1].cancelledCallback(),this.completeTween(m[0])):(p=!0,m[0].chain(b))),this.tweens.set(b,{cancelledCallback:i,interruptible:a.interruptible}),r?b.easing(r):b.easing(ar.Quadratic.In),!e.doNotAutoStart&&!p&&(b.start(),this.publish("change")),b.cameraAnimation=!0,b};setMulti=(e,t,r,o,i=!0)=>{this.state===-1&&this.publish("multi-start");let s=!1;e!=null&&(e.x!==void 0&&!isNaN(e.x)&&e.y!==void 0&&!isNaN(e.y)&&(this.updateCameraPosition(e.x,e.y),s=!0),e.z!==void 0&&!isNaN(e.z)&&(this.setPedestal(e.z,!0,!1),s=!0)),s&&this.publish("position-updated");let a={zooming:!1,tilting:!!t,rotating:!1};if(t!==void 0&&!isNaN(t)){let l=this.stayInsideBounds?Math.min(Math.max(t,this.getZoomScaledMin()),this.getZoomScaledMax()):t;l!==this.camera.position.z&&(a.zooming=!0,this.camera.position.z=l,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?t>En&&(this.camera.near=t-En,this.camera.far=t+En):(this.camera.near=t/Hr,this.camera.far=t*Hr),this.camera.updateProjectionMatrix())}if(r!==void 0&&!isNaN(r)&&r!==this.getRotation()&&(a.rotating=!0,this.orbit.rotation.z=-r,this.publish("rotation-updated")),o!==void 0&&!isNaN(o)){let l=this.stayInsideBounds?Math.max(Math.min(o,this.maxTilt),this.minTilt):o;l!==this.elevation.rotation.x&&(a.tilting=!0,this.elevation.rotation.x=l,this.publish("tilt-updated"))}i&&this.publish("change"),this.state===-1&&this.publish("multi-end",a),this.stateDirty=!0};getZoomScaledMin=()=>this.minZoomAltitude*this.zoomFactor;getZoomScaledMax=()=>{let e=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,e)};setRotation=(e,t)=>{if(isNaN(e))return;this.state===-1&&!t&&this.publish("rotate-start");let r=-(e%ua);r!==this.orbit.rotation.z&&(this.orbit.rotation.z=r,t||this.publish("rotation-updated")),t||this.publish("change"),this.state===-1&&!t&&this.publish("rotate-end"),this.dirty=!0,this.rotationDirty=!0,t||(this.stateDirty=!0)};setZoomAltitude=e=>{if(isNaN(e))return;this.state===-1&&this.publish("zoom-start");let t=this.stayInsideBounds?Math.min(Math.max(e,this.getZoomScaledMin()),this.getZoomScaledMax()):e;t!==this.camera.position.z&&(this.camera.position.z=t,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=t/Hr,this.camera.far=t*Hr,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0,this.stateDirty=!0};setZoomLevel=e=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(e))};getZoomAltitude=()=>this.camera.position.z;getZoomLevel=()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude());setTilt=(e,t)=>{if(isNaN(e))return;this.state===-1&&!t&&this.publish("rotate-start");let r=this.stayInsideBounds?Math.max(Math.min(e,this.maxTilt),this.minTilt):e;r!==this.elevation.rotation.x&&(this.elevation.rotation.x=r,t||this.publish("tilt-updated")),t||this.publish("change"),this.state===-1&&!t&&this.publish("rotate-end"),this.dirty=!0,t||(this.stateDirty=!0)};getTilt=()=>this.elevation.rotation.x;setCameraPlaneElevation=e=>{this.cameraPlane.position.z=e};zoom=e=>{if(isNaN(e))return;this.state===-1&&this.publish("zoom-start");let t=this.getZoomAltitude()-e;this.camera.position.z=this.stayInsideBounds?Math.min(Math.max(t,this.minZoomAltitude*this.zoomFactor),this.maxZoomAltitude*this.zoomFactor):t,this.publish("zoom-updated"),this.zoomDirty=!0,this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.stateDirty=!0};getProjectionScaleFactor=(e,t,r)=>zs(e,t,r);update=()=>{this.orbit.updateMatrixWorld(),this.lastWheelTime>0&&this.state===3&&this.clock.getElapsedTime()-this.lastWheelTime>.2&&(this.lastWheelTime=0,this.state=-1,this.publish("zoom-end"),this.removeMouseMoveEventListeners())};setPedestal=(e,t=!1,r=!0)=>{typeof e=="number"&&!isNaN(e)&&(this.orbit.position.z=e,t&&(this.publishPedestalChangeEvent(e),this.publish("pedestal-change",{pedestal:e})),this.publish("change"),this.dirty=!0,r&&(this.stateDirty=!0))};dispose=()=>{this.scene.remove(this.cameraPlane),this.destroy()};createCameraPlane=()=>{let e=oi?2e3:1e10,t=oi?100:1,r=new Ie(e,e,t,t),o=new Me({color:0,wireframe:oi,visible:oi}),i=new W(r,o);return this.scene.add(i),i};addEventListeners=()=>{let{domElement:e}=this.renderer;this.addMovingStateListeners(),e.addEventListener("contextmenu",this.onContextMenu,{capture:!1,signal:this.signal}),e.addEventListener("mousedown",this.onMouseDown,{capture:!1,signal:this.signal}),e.addEventListener("wheel",this.onMouseWheel,{capture:!1,passive:!1,signal:this.signal}),e.addEventListener("touchstart",this.onTouchStart,{capture:!1,signal:this.signal}),e.addEventListener("touchend",this.onTouchEnd,{capture:!1,signal:this.signal}),e.addEventListener("touchmove",this.onTouchMove,{capture:!1,signal:this.signal})};addMouseEventListeners=()=>{this.addMouseMoveEventListeners(),window.addEventListener("mouseup",this.onMouseUp,{capture:!1,signal:this.signal}),window.addEventListener("mouseout",this.onWindowMouseOut,{capture:!1,signal:this.signal})};onWindowMouseOut=e=>{e.relatedTarget==null&&this.onMouseUp()};addMouseMoveEventListeners=()=>{window.addEventListener("mousemove",this.onMouseMove,{capture:!0,signal:this.signal})};removeMouseMoveEventListeners=()=>{window.removeEventListener("mousemove",this.onMouseMove,{capture:!0})};removeMouseUpEventListeners=()=>{this.removeMouseMoveEventListeners(),window.removeEventListener("mouseup",this.onMouseUp,{capture:!1}),window.removeEventListener("mouseout",this.onWindowMouseOut,{capture:!1})};onContextMenu=e=>{e.preventDefault()};onMouseUp=()=>{if(this.enabled!==!1){switch(this.removeMouseUpEventListeners(),this.state){case 2:this.publish("pan-end"),this.publish("user-pan-end");break;case 1:this.publish("zoom-end"),this.publish("user-dolly-end");break;case 0:this.publish("rotate-end"),this.publish("user-rotate-end");break;case 8:this.publish("pedestal-end"),this.publish("user-pedestal-end");break}this.state=-1,this.panDirty=!1}};onMouseMove=e=>{if(this.enabled!==!1)if(e.preventDefault(),this.mouseToScene(e),this.state===0){if(this.enableRotate===!1)return;this.handleMouseMoveRotate(e)}else if(this.state===2){if(this.enablePan===!1)return;this.handleMouseMovePan()}else this.state===3?(this.resetZoom=!0,this.state=-1):this.state===8&&this.handleMouseMovePedestal(e)};onTouchStart=e=>{if(this.enabled!==!1){switch(this.updateTouchOrigin(),this.touchToScene(e),e.touches.length){case 1:this.enablePedestal?(this.handleTouchStartPedestal(e),this.state=9):this.enablePan&&(this.handleTouchStartPan(e),this.state=6);break;case 2:this.touch.inputs=new Ko(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}};onTouchMove=e=>{if(this.enabled!==!1)switch(this.touchToScene(e),e.touches.length){case 2:e.preventDefault(),e.stopPropagation();let t={...this.touch.inputs.first},r={...this.touch.inputs.second},o=new V(this.touch.touches[0].x,this.touch.touches[0].y),i=new V(this.touch.touches[1].x,this.touch.touches[1].y);if(this.touch.inputs.update(this.touch.touches[0],this.touch.touches[1]),this.enableRotate&&this.state===4)this.handleTouchMoveTilt(e);else if(this.state===5)this.handleTouchMoveDolly();else if(this.state!==5&&this.touch.inputs.totalDistance>.05){let s=t.y<o.y&&r.y<i.y,a=t.y>o.y&&r.y>i.y;this.enableRotate&&this.state!==4&&(a||s)?(this.handleTouchStartTilt(e),this.state=4):(this.handleTouchStartDolly(),this.state=5)}break;case 1:(this.enablePedestal||this.enablePan)&&(e.preventDefault(),e.stopPropagation()),this.enablePedestal&&this.state===9?this.handleTouchMovePedestal(e):this.enablePan&&this.state===6&&this.handleTouchMovePan(e);break;default:this.state=-1}};onTouchEnd=e=>{if(this.enabled!==!1){switch(this.handleTouchEnd(),this.state){case 2:case 6:this.publish("user-pan-end");break;case 4:this.publish("pan-end"),this.publish("user-tilt-end");break;case 1:case 5:this.publish("zoom-end"),this.publish("user-dolly-end");break;case 0:this.publish("rotate-end"),this.publish("user-rotate-end");break;case 8:case 9:this.publish("pedestal-end"),this.publish("user-pedestal-end");break}e.touches.length?this.onTouchStart(e):this.state=-1}};handleTouchMovePan=e=>{let t=Object.hasOwn(e,"x")?new V(e.x,e.y):this.touch.touches[0],r=this.raycastToFloor(t);this.coords.panEnd.set(r.x,r.y,0),this.coords.panDelta.subVectors(this.coords.panEnd,this.coords.panStart),this.setPosition(this.coords.panCameraStart.x-this.coords.panDelta.x,this.coords.panCameraStart.y-this.coords.panDelta.y),this.publish("change"),this.panDirty=!0};handleTouchStartDolly=()=>{let e=this.touch.touches[0].x-this.touch.touches[1].x,t=this.touch.touches[0].y-this.touch.touches[1].y;this.zoomStart=this.getZoomAltitude();let r=new V(this.touch.touches[0].x-e/2,this.touch.touches[0].y-t/2);this.coords.floorAnchor=this.raycastToFloor(r),this.orbit.updateMatrixWorld(),this.touch.anchor1=new Cn(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new Cn(this.touch.touches[1],this.camera,this.cameraPlane),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("user-dolly-start"),this.publish("zoom-start"),this.publish("multi-start")};handleMouseMovePan=()=>{let e=this.raycastToFloor(this.coords.mouse);this.coords.panEnd.set(e.x,e.y,0),this.coords.panDelta.subVectors(this.coords.panEnd,this.coords.panStart),this.setPosition(this.coords.panCameraStart.x-this.coords.panDelta.x,this.coords.panCameraStart.y-this.coords.panDelta.y),this.publish("change"),this.panDirty=!0};handleTouchStartTilt=e=>{this.coords.rotateStart.set(e.touches[1].clientX,e.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")};handleTouchMovePedestal=e=>{this.handleMouseMovePedestal(e.touches[0])};handleTouchMoveTilt=e=>{this.coords.rotateEnd.set(e.touches[1].clientX,e.touches[1].clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd)};handleTouchMoveDolly=()=>{let e=this.touch.inputs.first,t=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:e.x,y:e.y},this.touch.anchor2.viewCoordinate={x:t.x,y:t.y};let r=this.makeTransformFromTouchAnchors(this.touch.anchor1,this.touch.anchor2);r&&this.setCameraFromTransformMatrix(r),this.orbit.updateMatrixWorld(),this.touch.anchor1.updateAnchorState(this.camera,e),this.touch.anchor2.updateAnchorState(this.camera,t)};handleTouchEnd=()=>{this.state===4||this.state===5?this.publish("multi-end"):this.state===6&&this.publish("pan-end"),this.panDirty=!1};handleTouchStartPan=e=>{let t=Object.hasOwn(e,"x")?new V(e.x,e.y):this.touch.touches[0],r=this.raycastToFloor(t);this.coords.panStart.set(r.x,r.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("user-pan-start"),this.publish("pan-start")};handleTouchStartPedestal=e=>{this.handleMouseDownPedestal(e.touches[0])};onMouseDown=e=>{if(this.enabled!==!1){if(this.mouseToScene(e),e.preventDefault(),this.state===3&&this.publish("zoom-end"),e.button===this.MOUSE_BUTTONS.ORBIT){if(this.enableRotate===!1)return;this.handleMouseDownRotate(e),this.state=0}else(e.button===this.MOUSE_BUTTONS.PAN||e.button===this.MOUSE_BUTTONS.ZOOM)&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(e),this.state=8));this.state!==-1&&this.addMouseEventListeners()}};onMouseWheel=e=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3&&this.state!==7||(this.state===7&&this.cancelAnimation(),e.preventDefault(),e.stopPropagation(),this.mouseToScene(e),this.canScrollZoom(e)&&(this.lastWheelTime=this.clock.getElapsedTime(),this.publishUserZoomEvent()),this.state!==3&&this.canScrollZoom(e)&&(this.addMouseMoveEventListeners(),this.state=3,this.zoomStart=this.getZoomAltitude(),this.coords.floorAnchor=this.raycastToFloor(this.coords.mouse),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("zoom-start")),this.scrollTimer!=null&&clearTimeout(this.scrollTimer),this.scrollTimer=setTimeout(()=>{this.publish("zoom-end")},50),this.handleMouseWheel(e))};handleMouseWheel=e=>{if(this.publish("zoom-start"),!this.canScrollZoom(e)){this.lastWheelTime>0&&this.publish("zoom-end"),this.lastWheelTime=0,this.state=-1;return}let t=this.getZoomAltitude(),r=t-aa(e)*t/da*this.zoomSpeed;if(this.setZoomAltitude(r),this.enablePan){let o=this.getZoomAltitude()/this.zoomStart;this.coords.panDelta.subVectors(this.coords.floorAnchor,this.coords.panCameraStart).multiplyScalar(1-o),this.setPosition(this.coords.panCameraStart.x+this.coords.panDelta.x,this.coords.panCameraStart.y+this.coords.panDelta.y)}this.publish("change")};setCameraFromTransformMatrix=e=>{this.orbit.updateMatrixWorld();let t=new xt;t.setFromRotationMatrix(e,"ZYX");let r=(e.elements[14]-this.cameraPlane.position.z)/Math.cos(t.x),o=t.z,i=new O(0,0,1);i.applyEuler(t),i.setLength(r);let s=new O;s.setFromMatrixPosition(e),s.sub(i),this.enablePan&&this.setPosition(s.x,s.y),this.enableZoom&&this.setZoomAltitude(r),this.enableRotate&&this.setRotation(-o)};makeTransformFromTouchAnchors=(e,t)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let r=this.camera.projectionMatrix.clone(),o=e.worldCoordinate,i=t.worldCoordinate,s=e.reUnproject(),a=t.reUnproject();if(!s||!a||!o||!i)return null;let l=e.viewCoordinate,c=t.viewCoordinate,u=i.x-o.x,d=i.y-o.y,h=Math.atan2(d,u),g=a.x-s.x,b=a.y-s.y,M=Math.atan2(b,g),m=Ru(h,M),p=new Y;p.makeRotationZ(-m);let y=p.clone();y.multiply(e.snapHolderMatrix);let v=(rr,nr,or)=>rr.elements[(nr-1)*4+or-1],x=v(r,1,1)*v(y,1,1)-l.x*v(r,3,4)*v(y,3,1),S=v(r,1,1)*v(y,1,2)-l.x*v(r,3,4)*v(y,3,2),w=v(r,1,1)*v(y,1,3)-l.x*v(r,3,4)*v(y,3,3),D=o.x*x+o.y*S+o.z*w,C=v(r,2,2)*v(y,2,1)-l.y*v(r,3,4)*v(y,3,1),T=v(r,2,2)*v(y,2,2)-l.y*v(r,3,4)*v(y,3,2),P=v(r,2,2)*v(y,2,3)-l.y*v(r,3,4)*v(y,3,3),I=o.x*C+o.y*T+o.z*P,L=v(r,1,1)*v(y,1,1)-c.x*v(r,3,4)*v(y,3,1),N=v(r,1,1)*v(y,1,2)-c.x*v(r,3,4)*v(y,3,2),z=v(r,1,1)*v(y,1,3)-c.x*v(r,3,4)*v(y,3,3),j=i.x*L+i.y*N+i.z*z,H=v(r,2,2)*v(y,2,1)-c.y*v(r,3,4)*v(y,3,1),Q=v(r,2,2)*v(y,2,2)-c.y*v(r,3,4)*v(y,3,2),G=v(r,2,2)*v(y,2,3)-c.y*v(r,3,4)*v(y,3,3),J=i.x*H+i.y*Q+i.z*G,ne=Math.abs(L-x),je=Math.abs(N-S),ye=Math.abs(z-w),be=Math.abs(L-C),pt=Math.abs(N-T),Ze=Math.abs(z-P),Qe=Math.abs(H-x),mt=Math.abs(Q-S),et=Math.abs(G-w),It=Math.abs(H-C),Fe=Math.abs(Q-T),Xe=Math.abs(G-P),ft=Math.min(ne+je+ye,be+pt+Ze),Se=Math.min(Qe+mt+et,It+Fe+Xe);ft<Se&&(L=H,N=Q,z=G,j=J);let Ye=C*w-x*P,Ne=T*w-S*P,er=I*w-D*P,Be=L*P-C*z,de=N*P-T*z,ro=j*P-I*z,wr=(ro*Ne-er*de)/(Be*Ne-Ye*de),ws=(ro*Ye-er*Be)/(de*Ye-Ne*Be),tr=T*x-S*C,Ot=P*x-w*C,st=I*x-D*C,Tr=N*C-T*L,rn=z*C-P*L,oo=((j*C-I*L)*tr-st*Tr)/(rn*tr-Ot*Tr),gt=y.clone();return gt.elements[12]=wr,gt.elements[13]=ws,gt.elements[14]=oo,oo>0?gt:null};updateTouchOrigin=()=>{let e=this.renderer.domElement;this.touch.origin.offsetLeft=e.getBoundingClientRect().left,this.touch.origin.offsetTop=e.getBoundingClientRect().top};touchToScene=e=>{this.touch.touches=[];for(let t=0,r=e.touches.length;t<r;t++){let o=e.touches[t],i=_u(o,this.touch.origin);this.touch.touches.push(new V(i.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,-(i.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1))}this.coords.mouse=this.touch.touches[0]};canScrollZoom=e=>{let t=aa(e),r=this.getZoomAltitude();return!(t<0&&r===this.getZoomScaledMax()||t>0&&r===this.getZoomScaledMin())};mouseToScene=e=>{let t=this.getMousePos(e);return this.coords.mouse.x=t.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,this.coords.mouse.y=-(t.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1,this.coords.mouse};getMousePos=e=>{let t=this.renderer.domElement.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}};handleMouseDownRotate=e=>{this.coords.rotateStart.set(e.clientX,e.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")};handleMouseDownPan=()=>{let e=this.raycastToFloor(this.coords.mouse);this.coords.panStart.set(e.x,e.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("pan-start"),this.publish("user-pan-start")};handleMouseDownPedestal=e=>{let t=new V(e.clientX,e.clientY);this.coords.initialShiftPos=t,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=zs(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")};handleMouseMovePedestal=e=>{let t={x:e.clientX,y:e.clientY},r=this.coords.initialPedestal+this.pedestalScaleFactor*(t.y-this.coords.initialShiftPos.y);this.stayInsideBounds&&(r<this.minPedestal?r=Math.max(r,this.minPedestal):r>this.maxPedestal&&(r=Math.min(r,this.maxPedestal))),r!==this.getPedestal()&&this.setPedestal(r,!0)};handleMouseMoveRotate=e=>{this.coords.rotateEnd.set(e.clientX,e.clientY),this.coords.rotateDelta.subVectors(this.coords.rotateEnd,this.coords.rotateStart),this.setRotation(this.getRotation()+this.coords.rotateDelta.x/this.rotateSpeed),this.setTilt(this.getTilt()-this.coords.rotateDelta.y/this.rotateSpeed),this.coords.rotateStart.copy(this.coords.rotateEnd),this.publish("change")};publishUserZoomDebounced=Pr(()=>{this.isUserZooming=!1,this.publish("user-zoom-end")},250);publishUserZoomEvent=()=>{this.isUserZooming?this.publishUserZoomDebounced():(this.publish("user-zoom-start"),this.isUserZooming=!0,this.publishUserZoomDebounced())};setCameraMoving=()=>{this.cameraMoving=!0};unsetCameraMoving=()=>{this.cameraMoving=!1,this.lastCameraMoveTime=Date.now()};setUserInteracting=()=>{this.userInteracting=!0};unsetUserInteracting=()=>{this.userInteracting=!1};publishPedestalChangeEvent=e=>{this.publish("pedestal-change",{pedestal:e,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})};convertAltitudeToZoomLevel=e=>{let[,t]=this.center,r=this.computeMetersPerPixelFromAltitude(e),o=Math.cos(U.degToRad(t))*2*Math.PI*vt/r;return U.clamp(Math.log2(o/512),ei,ti)};convertZoomLevelToAltitude=e=>this.computeMetersPerPixelFromZoomLevel(e)*this.options.canvasHeight/2/Math.tan(U.degToRad(this.camera.fov)/2);completeTween=e=>{e.isPlaying()&&e.stop(),this.rendererState.internalTweenGroup.remove(e),this.tweens.delete(e)};static CAMERA_FRAME_PADDING_SIDES=["top","bottom","left","right"];debugContainer=new Ge;getCameraFrameForCoordinates(e,t){let r=t.minZoom!==void 0?t.minZoom:this.minZoomAltitude,o=t.maxZoom!==void 0?t.maxZoom:this.maxZoomAltitude,i=this.options.canvasWidth,s=this.options.canvasHeight,a=this.getRotation(),l=this.getTilt(),c=this.getPosition();this.setRotation(t.rotation??a,!0),this.setTilt(t.tilt??l,!0);let u=ga(e,{canvasWidth:i,canvasHeight:s,paddingOption:t.padding,verticalPadding:t.verticalPadding,minZoom:r,maxZoom:o,position:c,camera:this.camera,orbit:this.orbit});return this.setRotation(a,!0),this.setTilt(l,!0),{center:u.position,zoomLevel:this.convertAltitudeToZoomLevel(u.zoom)}}focusOn(e,t){if(um){this.debugContainer&&ve(this.debugContainer);let M=new Nt(4,4,4),m=new Me({color:65280,depthTest:!1}),p=new K(M,m,e.length),y=new Y;e.forEach((v,x)=>{y.setPosition(v),p.setMatrixAt(x,y)}),p.instanceMatrix.needsUpdate=!0,this.debugContainer.add(p),this.scene.add(this.debugContainer)}let r=t.curve,o=t.callback,i=t.cancelledCallback,s=t.minZoom!==void 0?t.minZoom:this.minZoomAltitude,a=t.maxZoom!==void 0?t.maxZoom:this.maxZoomAltitude,l=this.options.canvasWidth,c=this.options.canvasHeight,u;t.duration!==void 0?u=t.duration:E.env.TESTING==="true"?u=0:u=ha;let d=t.padding,h=this.getRotation(),g=this.getTilt();t.rotation!=null&&this.setRotation(t.rotation),t.tilt!=null&&this.setTilt(t.tilt);let b=ga(e,{canvasHeight:c,paddingOption:d,canvasWidth:l,minZoom:s,maxZoom:a,camera:this.camera,orbit:this.orbit,position:this.getPosition(),verticalPadding:t.verticalPadding});this.setRotation(h),this.setTilt(g),this.animateCamera({position:b.position,tilt:t.tilt,rotation:t.rotation,zoom:b.zoom},u,r,o,i,t)}resize(e,t){this.options.canvasWidth=e,this.options.canvasHeight=t}computeMetersPerPixelFromZoomLevel(e){let[,t]=this.center,r=U.clamp(e,ei,ti),o=Math.pow(2,r),i=U.clamp(t,la,ca),s=o*512;return Math.cos(U.degToRad(i))*Math.PI*2*vt/s}computeMetersPerPixelFromAltitude(e){return e*2*Math.tan(U.degToRad(this.camera.fov)/2)/this.options.canvasHeight}getCurrentMetersPerPixel(){let e=Math.max(0,this.getPedestal()-this.minPedestal);return this.computeMetersPerPixelFromAltitude(this.getZoomAltitude()+e)}};function ga(n,{canvasWidth:e,orbit:t,paddingOption:r,verticalPadding:o=0,canvasHeight:i,minZoom:s,maxZoom:a,camera:l,position:c}){let u={zoom:s,position:c};if(n.length===0)return u;for(let Ne of Vr.CAMERA_FRAME_PADDING_SIDES)typeof r[Ne]!="number"&&(r[Ne]=0);let d=Ur(r,e,i);if(d.left+d.right>=e||d.top+d.bottom>=i)return u;t.updateMatrixWorld();let h=l.matrixWorldInverse,g=l.fov*(Math.PI/180)/2,b=g,m=Math.atan(Math.tan(g)*(e/i)),p=new O(1/0,1/0,1/0),y=new O(-1/0,-1/0,-1/0),v=new ce,x=new O;for(let Ne=0,er=n.length;Ne<er;Ne++)x.copy(n[Ne]),v.expandByPoint(x),x.applyMatrix4(h),p.min(x),y.max(x),x.copy(n[Ne]),x.z-=o,x.applyMatrix4(h),p.min(x),y.max(x),x.copy(n[Ne]),x.z+=o,x.applyMatrix4(h),p.min(x),y.max(x);let S=y.x-p.x,w=y.y-p.y,D=e-d.left-d.right,C=i-d.top-d.bottom,T=(y.x+p.x)/2,P=(y.y+p.y)/2,I=S/D,L=w/C,N=s,z=a,j=N*Math.tan(m)*2,H=z*Math.tan(m)*2,Q=j/e,G=H/e,J=Math.max(I,L);J=U.clamp(J,Q,G);let ne=D*J,je=C*J,ye={min:{x:T-ne/2-d.left*J,y:P-je/2-d.bottom*J},max:{x:T+ne/2+d.right*J,y:P+je/2+d.top*J}},be=(ye.min.x+ye.max.x)/2,pt=(ye.min.y+ye.max.y)/2,Ze=v.getCenter(new O),Qe=Math.abs(be-ye.min.x),mt=Math.abs(pt-ye.min.y),et=Qe/Math.tan(m),It=mt/Math.tan(b),Fe=new O;Fe.set(be,pt,y.z+Math.max(et,It)),Fe.applyMatrix4(l.matrixWorld);let Xe=new O;Xe.set(be,pt,y.z),Xe.applyMatrix4(l.matrixWorld);let ft=new O().subVectors(Xe,Fe),Se=(Ze.z-Fe.z)/ft.z,Ye=new O().copy(Fe).add(ft.clone().multiplyScalar(Se));return Xe.set(Ye.x,Ye.y,Ye.z),Fe.sub(Xe),{position:Ye,zoom:Fe.length()}}f();import{z as te}from"zod";var dm=te.object({rotation:te.array(te.number()).length(3).optional(),altitude:te.number().optional(),scale:te.array(te.number()).length(3).optional(),interactive:te.boolean().optional(),verticalOffset:te.number().optional(),id:te.union([te.number(),te.string()]).optional()}),hm=te.object({type:te.enum(["Feature"]),geometry:zr,properties:dm}),pm=te.object({type:te.enum(["FeatureCollection"]),features:te.array(hm)}),mm=te.object({color:te.string()}),fm=te.object({url:te.string(),color:te.string().optional(),opacity:te.number().optional(),material:te.record(te.string(),mm).optional()});function zu(n,e,t){te.union([te.number(),te.string()]).parse(n),pm.parse(e),fm.parse(t)}var yr=class{mesh;type="model";positionDirty=!0;outline;geometry;material;feature;instanceIndex=-1;instancingDisabled=!1;constructor(e){this.feature=e}#e=!0;get visible(){return this.#e}set visible(e){this.#e=e}color=new k;clippingPlane;get modelScene(){return this.clippingPlane?this.mesh?.children.find(e=>e.name!=="hole-fill-mesh"):this.mesh}position=new O;#n=0;get altitude(){return this.#n}set altitude(e){this.#n=e}#i=1;get opacity(){return this.#i}set opacity(e){this.#i=e}#o=ue.GEOMETRY;get renderOrder(){return this.#o}set renderOrder(e){this.#o=e}#s=!1;get visibleThroughGeometry(){return this.#s}set visibleThroughGeometry(e){this.#s=e}};f();f();var br={container:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"9998"},focusOnBox:{position:"absolute",border:"2px solid orange",backgroundColor:"transparent",pointerEvents:"none"},getFocusOnTransformBox:{position:"absolute",border:"2px dashed cyan",backgroundColor:"rgba(0, 255, 255, 0.1)",pointerEvents:"none"},animateToBox:{position:"absolute",width:"12px",height:"12px",border:"2px solid lime",backgroundColor:"rgba(0, 255, 0, 0.3)",borderRadius:"50%",transform:"translate(-50%, -50%)",pointerEvents:"none"},label:{position:"absolute",fontSize:"10px",fontFamily:"monospace",color:"white",backgroundColor:"rgba(0, 0, 0, 0.7)",padding:"2px 4px",borderRadius:"2px",whiteSpace:"nowrap"}},ya={container:{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",zIndex:"9999"},top:{position:"absolute",top:"0",left:"0",right:"0",backgroundColor:"rgba(255, 0, 0, 0.2)",borderBottom:"2px dashed rgba(255, 0, 0, 0.6)"},bottom:{position:"absolute",bottom:"0",left:"0",right:"0",backgroundColor:"rgba(0, 255, 0, 0.2)",borderTop:"2px dashed rgba(0, 255, 0, 0.6)"},left:{position:"absolute",top:"0",bottom:"0",left:"0",backgroundColor:"rgba(0, 0, 255, 0.2)",borderRight:"2px dashed rgba(0, 0, 255, 0.6)"},right:{position:"absolute",top:"0",bottom:"0",right:"0",backgroundColor:"rgba(255, 255, 0, 0.2)",borderLeft:"2px dashed rgba(255, 255, 0, 0.6)"},label:{position:"absolute",fontSize:"10px",fontFamily:"monospace",color:"white",backgroundColor:"rgba(0, 0, 0, 0.7)",padding:"2px 4px",borderRadius:"2px"}},ii=class n{#e;#n;#i=!1;#o=null;#s=null;#l=null;#a=null;#h=null;#y=null;#t=null;#d=null;#r=!1;#b=new Map;#m=!1;#c=new Map;#g=!1;static#x={};#C=!1;#p=null;#f=null;#S=null;#E=null;constructor(e,t){this.#e=e,this.#n=t}showCameraTargets(){this.#i||(this.#i=!0,this.#A(),this.#G())}hideCameraTargets(){this.#i&&(this.#i=!1,this.#O(),this.#B())}setFocusOnPointCloud(e,t,r){!this.#i&&!this.#r||(this.#i&&(this.#h=e.map(o=>o.clone()),this.#w()),this.#L(e,t,r))}setGetFocusOnTransformPointCloud(e,t,r){!this.#i&&!this.#r||(this.#i&&(this.#y=e.map(o=>o.clone()),this.#w()),this.#L(e,t,r))}setAnimateToPosition(e){this.#i&&(this.#t=e.clone(),this.#w())}#A(){let e=this.#e.container;if(!e)return;this.#o=document.createElement("div"),this.#o.dataset.debugCameraTargets="true",Object.assign(this.#o.style,br.container),this.#s=document.createElement("div"),this.#s.dataset.debugType="focusOn",Object.assign(this.#s.style,br.focusOnBox),this.#s.style.display="none";let t=document.createElement("span");Object.assign(t.style,br.label),t.style.top="-20px",t.style.left="0",t.style.color="orange",t.textContent="focusOn",this.#s.appendChild(t),this.#l=document.createElement("div"),this.#l.dataset.debugType="getFocusOnTransform",Object.assign(this.#l.style,br.getFocusOnTransformBox),this.#l.style.display="none";let r=document.createElement("span");Object.assign(r.style,br.label),r.style.top="-20px",r.style.left="0",r.style.color="cyan",r.textContent="getFocusOnTransform",this.#l.appendChild(r),this.#a=document.createElement("div"),this.#a.dataset.debugType="animateTo",Object.assign(this.#a.style,br.animateToBox),this.#a.style.display="none";let o=document.createElement("span");Object.assign(o.style,br.label),o.style.top="-20px",o.style.left="50%",o.style.transform="translateX(-50%)",o.style.color="lime",o.textContent="animateTo",this.#a.appendChild(o),this.#o.appendChild(this.#s),this.#o.appendChild(this.#l),this.#o.appendChild(this.#a),e.appendChild(this.#o)}#B(){this.#o&&(this.#o.remove(),this.#o=null),this.#s=null,this.#l=null,this.#a=null}#G(){this.#d=this.#e.on("post-render",()=>{this.#w()})}#O(){this.#d!==null&&(this.#d(),this.#d=null)}#P(e){let t=1/0,r=1/0,o=-1/0,i=-1/0,s=new V;for(let a of e)this.#e.project(s,a),s.x!==-1e3&&(t=Math.min(t,s.x),r=Math.min(r,s.y),o=Math.max(o,s.x),i=Math.max(i,s.y));return t!==1/0?{minX:t,minY:r,maxX:o,maxY:i}:null}#R(e,t){if(!t||t.length===0){e.style.display="none";return}let r=this.#P(t);r?(e.style.display="block",e.style.left=`${r.minX}px`,e.style.top=`${r.minY}px`,e.style.width=`${r.maxX-r.minX}px`,e.style.height=`${r.maxY-r.minY}px`):e.style.display="none"}#w(){if(!(!this.#i||!this.#o))if(this.#s&&this.#R(this.#s,this.#h),this.#l&&this.#R(this.#l,this.#y),this.#a&&this.#t){let e=new V;this.#e.project(e,this.#t),e.x!==-1e3?(this.#a.style.display="block",this.#a.style.left=`${e.x}px`,this.#a.style.top=`${e.y}px`):this.#a.style.display="none"}else this.#a&&(this.#a.style.display="none")}showFocusOnDebug(e){if(e===!1){this.hideFocusOnDebug();return}this.#D(this.#b),this.#D(this.#c),this.#r=!0,this.#m=e.pointCloud===!1?!1:{size:e.pointCloud?.size??2,color:e.pointCloud?.color??"lime"},this.#g=e.boundingBox===!1?!1:{color:e.boundingBox?.color??"lime"}}hideFocusOnDebug(){this.#r&&(this.#r=!1,this.#m=!1,this.#g=!1,this.#D(this.#b),this.#D(this.#c))}#L(e,t,r){if(!this.#r)return;let o=t??n.#x;this.#m!==!1&&this.#_(e,o,r),this.#g!==!1&&this.#I(e,o,r)}#_(e,t,r){let o=this.#e.getThreeScene();if(!o||e.length===0){this.#T(this.#b,t);return}if(this.#m===!1)return;let{size:i,color:s}=this.#m,a=r??s,l=this.#b.get(t);if(!l||l.count!==e.length){this.#T(this.#b,t);let u=new Fr(i,8,6),d=new Me({color:a,depthTest:!1,transparent:!0,opacity:.3});l=new K(u,d,e.length),l.renderOrder=9999,o.add(l),this.#b.set(t,l)}let c=new Ge;for(let u=0;u<e.length;u++)c.position.copy(e[u]),c.updateMatrix(),l.setMatrixAt(u,c.matrix);l.instanceMatrix.needsUpdate=!0,this.#e.render()}#T(e,t){let r=e.get(t);r&&(this.#e.getThreeScene()?.remove(r),r.geometry.dispose(),r.material.dispose(),e.delete(t))}#D(e){let t=this.#e.getThreeScene();for(let r of e.values())t?.remove(r),r.geometry.dispose(),r.material.dispose();e.clear()}#I(e,t,r){let o=this.#e.getThreeScene();if(!o||e.length===0){this.#T(this.#c,t);return}if(this.#g===!1)return;let i=r??this.#g.color,s=this.#e.getThreeCamera(),a=s.matrixWorldInverse,l=e.map(v=>v.clone().applyMatrix4(a)),c=new ce().setFromPoints(l),u=c.getSize(new O),d=c.getCenter(new O),h=new Y().copy(a).invert(),g=d.applyMatrix4(h),b=new _t().setFromRotationMatrix(s.matrixWorld);this.#T(this.#c,t);let M=new Nt(u.x,u.y,u.z),m=new So(M);M.dispose();let p=new Lr({color:i,depthTest:!1,transparent:!0,opacity:.5}),y=new Bt(m,p);y.position.copy(g),y.quaternion.copy(b),y.renderOrder=9999,o.add(y),this.#c.set(t,y),this.#e.render()}showScreenOffsets(){this.#C||(this.#C=!0,this.#F())}hideScreenOffsets(){this.#C&&(this.#C=!1,this.#N())}#F(){let e=this.#e.container;if(!e)return;this.#p=document.createElement("div"),this.#p.dataset.debugScreenOffsets="true",Object.assign(this.#p.style,ya.container);let t=r=>{let o=document.createElement("div");o.dataset.debugOffset=r,Object.assign(o.style,ya[r]);let i=document.createElement("span");switch(Object.assign(i.style,ya.label),i.dataset.debugLabel=r,r){case"top":i.style.bottom="4px",i.style.left="50%",i.style.transform="translateX(-50%)";break;case"bottom":i.style.top="4px",i.style.left="50%",i.style.transform="translateX(-50%)";break;case"left":i.style.right="4px",i.style.top="50%",i.style.transform="translateY(-50%)";break;case"right":i.style.left="4px",i.style.top="50%",i.style.transform="translateY(-50%)";break}return o.appendChild(i),o};this.#f={top:t("top"),bottom:t("bottom"),left:t("left"),right:t("right")},this.#p.appendChild(this.#f.top),this.#p.appendChild(this.#f.bottom),this.#p.appendChild(this.#f.left),this.#p.appendChild(this.#f.right),e.appendChild(this.#p),this.#M(),this.#E=this.#n.on("padding-change",()=>{this.#M()}),this.#S=new ResizeObserver(()=>{this.#M()}),this.#S.observe(e)}#N(){this.#E&&(this.#E(),this.#E=null),this.#S&&(this.#S.disconnect(),this.#S=null),this.#p&&(this.#p.remove(),this.#p=null),this.#f=null}#M(){if(!this.#f||!this.#p)return;let e=this.#n.insetsPadding,t=this.#e.container,r=t.clientWidth,o=t.clientHeight,i=Ur(e,r,o),s=this.#f.top,a=s.querySelector("[data-debug-label]");i.top>0?(s.style.height=`${i.top}px`,s.style.display="block",a&&(a.textContent=`top: ${this.#v(e.top,e.type)}`)):s.style.display="none";let l=this.#f.bottom,c=l.querySelector("[data-debug-label]");i.bottom>0?(l.style.height=`${i.bottom}px`,l.style.display="block",c&&(c.textContent=`bottom: ${this.#v(e.bottom,e.type)}`)):l.style.display="none";let u=this.#f.left,d=u.querySelector("[data-debug-label]");i.left>0?(u.style.height="",u.style.top=`${i.top}px`,u.style.bottom=`${i.bottom}px`,u.style.width=`${i.left}px`,u.style.display="block",d&&(d.textContent=`left: ${this.#v(e.left,e.type)}`)):u.style.display="none";let h=this.#f.right,g=h.querySelector("[data-debug-label]");i.right>0?(h.style.height="",h.style.top=`${i.top}px`,h.style.bottom=`${i.bottom}px`,h.style.width=`${i.right}px`,h.style.display="block",g&&(g.textContent=`right: ${this.#v(e.right,e.type)}`)):h.style.display="none"}#v(e,t){return t==="portion"?`${(e*100).toFixed(1)}%`:`${e}px`}destroy(){this.hideCameraTargets(),this.hideScreenOffsets(),this.hideFocusOnDebug()}};var gm=0,ym=90,bm=(E.env.NODE_ENV==="test",!1),si={linear:ar.Linear.None,"ease-in":ar.Quadratic.In,"ease-out":ar.Quadratic.Out,"ease-in-out":ar.Quadratic.InOut},vm=-50,ai=class extends Z{#e;#n;#i;#o;constructor(e,t,r){super(),this.#e=e,this.#n=t,this.#i=r,this.#o=new ii(e,this),this.#e.map&&this.#e.map.transform.setMinElevationForCurrentTile(vm),this.#n.cameraSystem.on("pedestal-change",({pedestal:o})=>{this.#n.cameraSystem.setCameraPlaneElevation(o),this.#e.mode==="outdoors-overlay"&&typeof this.#e.map?.setCenterElevation=="function"&&this.#e.map.setCenterElevation(this.#n.cameraSystem.getPedestal())})}get center(){return this.#e.mode==="outdoors-overlay"&&this.#e.map?this.#e.map.getCenter?.().toArray():this.#n.cameraSystem.center}setCenter(e){if(this.#e.mode==="outdoors-overlay"&&this.#e.map){this.#e.map?.setCenter(e),this.#n.interactionSystem.handleHover();return}this.#n.cameraSystem.setCenter(e[0],e[1]),this.#n.interactionSystem.handleHover()}get zoomLevel(){return this.#e.mode==="outdoors-overlay"&&this.#e.map?this.#e.map?.getZoom():this.#n.cameraSystem.getZoomLevel()}setZoomLevel(e){this.#e.mode==="outdoors-overlay"&&this.#e.map&&this.#e.map?.setZoom(e),this.#n.cameraSystem.setZoomLevel(Ve(e,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits."))}getState(){return{zoomLevel:this.zoomLevel,minZoomLevel:this.minZoomLevel,maxZoomLevel:this.maxZoomLevel,minPitch:this.minPitch,maxPitch:this.maxPitch,autoMinZoomLevel:this.autoMinZoomLevel,panMode:this.panMode,screenOffsets:this.insetsPadding,center:this.center,bearing:this.bearing,pitch:this.pitch,elevation:this.elevation}}get isAnimating(){return this.#n.cameraSystem.isAnimating}cancelAnimation(){this.#n.cameraSystem.cancelAnimation()}get maxZoomLevel(){return this.#n.cameraSystem.maxZoomLevel}get minZoomLevel(){return this.#n.cameraSystem.minZoomLevel}setAutoMinZoomLevel(e){this.#n.panBoundsSystem.autoMinZoomLevel=e,e&&(this.#n.panBoundsSystem.dirty=!0,this.#n.panBoundsSystem.update())}get autoMinZoomLevel(){return this.#n.panBoundsSystem.autoMinZoomLevel}setMinZoomLevel(e,t=!1){t&&this.setAutoMinZoomLevel(!1);let r=Ve(e,rt.MIN_MERCATOR_ZOOM_LEVEL,this.maxZoomLevel,`setMinZoomLevel was clamped. minZoomLevel must be between ${rt.MIN_MERCATOR_ZOOM_LEVEL} and maxZoomLevel.`);this.#n.cameraSystem.setMinZoomLevel(r),this.zoomLevel<r&&this.setZoomLevel(r),this.#e.map?.setMinZoom(r)}setMaxZoomLevel(e){let t=Ve(e,this.minZoomLevel,rt.MAX_MERCATOR_ZOOM_LEVEL,`setMaxZoomLevel was clamped. maxZoomLevel must be between minZoomLevel and ${rt.MAX_MERCATOR_ZOOM_LEVEL}.`);this.#n.cameraSystem.setMaxZoomLevel(t),this.zoomLevel>t&&this.setZoomLevel(t),this.#e.map?.setMaxZoom(t)}get maxPitch(){return this.#e.mode==="outdoors-overlay"&&this.#e.map?this.#e.map?.getMaxPitch?.():U.radToDeg(this.#n.cameraSystem.maxTilt)}get minPitch(){return this.#e.mode==="outdoors-overlay"&&this.#e.map?this.#e.map?.getMinPitch?.():U.radToDeg(this.#n.cameraSystem.minTilt)}setMinPitch(e){let t=Math.max(gm,e);this.#e.map?.setMinPitch(t),this.#n.cameraSystem.minTilt=U.degToRad(t)}setMaxPitch(e){let t=Math.min(ym,e);this.#e.map?.setMaxPitch(t),this.#n.cameraSystem.maxTilt=U.degToRad(t)}get bearing(){return this.#e.mode==="outdoors-overlay"&&this.#e.map?this.#e.map?.getBearing():U.radToDeg(this.#n.cameraSystem.getRotation())}setBearing(e){if(this.#e.mode==="outdoors-overlay"&&this.#e.map){this.#e.map?.setBearing(e);return}this.#n.cameraSystem.setRotation(U.degToRad(e))}get pitch(){return this.#e.mode==="outdoors-overlay"&&this.#e.map?this.#e.map?.getPitch():U.radToDeg(this.#n.cameraSystem.getTilt())}setPitch(e){if(this.#e.mode==="outdoors-overlay"&&this.#e.map){this.#e.map?.setPitch(e);return}this.#n.cameraSystem.setTilt(U.degToRad(Ve(e,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")))}get elevation(){return this.#n.cameraSystem.getPedestal()}get maxElevation(){return this.#n.cameraSystem.maxPedestal}setMaxElevation(e){this.#n.cameraSystem.maxPedestal=e,this.elevation>e&&this.setElevation(e)}setElevation(e){let t=Ve(e,-1/0,this.maxElevation,"elevation was clamped to maxElevation. Use mapView.Camera.setMaxElevation() to adjust the limit.");this.#n.cameraSystem.setPedestal(t,!0)}#s;animateElevation(e,t){this.#s&&this.#s.stop();let r=Ve(e,-1/0,this.maxElevation,"animateElevation was clamped to maxElevation. Use mapView.Camera.setMaxElevation() to adjust the limit.");return new Promise(o=>{this.#n.cameraSystem.animateCamera({position:{z:r}},t?.duration||300,si[t?.easing||"ease-in-out"],o,o,{interruptible:t?.interruptible??!0})})}get insetsPadding(){return this.#i.insetsPadding}get panMode(){return this.#n.cameraSystem.enablePan===!1&&this.#n.cameraSystem.enablePedestal===!0?"elevation":"default"}setPanMode(e){if(e!=="default"&&e!=="elevation")throw new Error("Invalid pan mode");e!==this.panMode&&(e==="default"?(this.#n.cameraSystem.enablePan=!0,this.#n.cameraSystem.enablePedestal=!1):(this.#n.cameraSystem.enablePan=!1,this.#n.cameraSystem.enablePedestal=!0))}setInsetPadding(e){let t=this.#i.insetsPadding;Object.keys(e).every(r=>e[r]===t[r])||(this.#i.insetsPadding=Object.assign({},t,e),this.publish("padding-change",{padding:this.#i.insetsPadding}))}animateTo(e){let t=e.center?this.#e.convertTo3DMapPosition(e.center[1],e.center[0],e.center[2]||this.elevation):void 0;if(t&&this.#o.setAnimateToPosition(t),this.#e.mode==="outdoors-overlay"&&this.#e.map)return this.#e.map?.flyTo({center:e.center??this.center,zoom:e.zoomLevel??this.zoomLevel,bearing:e.bearing??this.bearing,pitch:e.pitch??this.pitch,duration:e.duration??600}),Promise.resolve();let r=e.zoomLevel!==void 0?this.#n.cameraSystem.convertZoomLevelToAltitude(Ve(e.zoomLevel,this.minZoomLevel,this.maxZoomLevel,"zoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() and mapView.Camera.setMaxZoomLevel() to adjust limits.")):void 0,o=e.bearing!==void 0?U.degToRad(e.bearing):void 0,i=e.pitch!==void 0?U.degToRad(Ve(e.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0;return new Promise(s=>{this.#n.cameraSystem.animateCamera({position:t,zoom:r,rotation:o,tilt:i},e.duration||0,si[e.easing||"ease-in-out"],()=>{this.#n.interactionSystem.handleHover(),s()},s,{interruptible:e?.interruptible??!0})})}getCameraFrameForCoordinates(e,t){let r=this.#l(t||{},()=>Promise.resolve()),{pointCloud:o}=Uu(e,this.#e,this.#i.geometry3DMap);if(o.length===0)return _.error("No valid coordinates found in targets:",e),{center:this.center,zoomLevel:this.zoomLevel};this.#o.setGetFocusOnTransformPointCloud(o,t?.debugKey,t?.debugColor);let{center:i,zoomLevel:s}=this.#n.cameraSystem.getCameraFrameForCoordinates(o,r);return{center:this.#e.convert3DMapPositionToCoordinate(i),zoomLevel:s}}#l(e,t){return{minZoom:e?.maxZoomLevel===void 0?void 0:this.#n.cameraSystem.convertZoomLevelToAltitude(Ve(e.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMaxZoomLevel() to adjust limits.")),maxZoom:e?.minZoomLevel===void 0?void 0:this.#n.cameraSystem.convertZoomLevelToAltitude(Ve(e.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() to adjust limits.")),padding:e?.padding?Object.assign({},Do,e?.padding):this.insetsPadding,curve:si[e?.easing||"ease-in-out"],rotation:e?.bearing===void 0?void 0:U.degToRad(e.bearing),tilt:e?.pitch!==void 0?U.degToRad(Ve(e.pitch,this.minPitch,this.maxPitch,"pitch was clamped to minPitch/maxPitch bounds. Use mapView.Camera.setMinPitch() and mapView.Camera.setMaxPitch() to adjust limits.")):void 0,duration:e?.duration,callback:()=>{this.#n.interactionSystem.handleHover(),t()},cancelledCallback:t,interruptible:e?.interruptible??!0,verticalPadding:e?.verticalPadding}}focusOn(e,t){let{pointCloud:r,geoBounds:o,firstPosition:i}=Uu(e,this.#e,this.#i.geometry3DMap);return r.length===0?(_.error("No valid coordinates found in targets:",e),Promise.resolve()):(this.#o.setFocusOnPointCloud(r,t?.debugKey,t?.debugColor),this.#e.mode==="outdoors-overlay"&&this.#e.map?(r.length===1&&i?this.#e.map?.flyTo({center:[i[0],i[1]],duration:t?.duration||this.#e.map.getBearing(),animate:!0,bearing:t?.bearing===void 0?this.#e.map.getBearing():t?.bearing,pitch:t?.pitch===void 0?this.#e.map.getPitch():t?.pitch,zoom:t?.maxZoomLevel||this.#e.map.getMaxZoom()}):(bm&&xm(this.#e,o),this.#e.map?.fitBounds(o,{duration:t?.duration??rt.DEFAULT_ANIMATION_DURATION,bearing:t?.bearing===void 0?this.#e.map.getBearing():t?.bearing,pitch:t?.pitch===void 0?this.#e.map.getPitch():t?.pitch,maxZoom:t?.maxZoomLevel??this.#e.map.getMaxZoom()})),this.#n.interactionSystem.handleHover(),Promise.resolve()):new Promise(s=>{this.#n.cameraSystem.focusOn(r,this.#l(t||{},s))}))}showCameraTargetsDebug(){this.#o.showCameraTargets()}hideCameraTargetsDebug(){this.#o.hideCameraTargets()}showFocusOnDebug(e){this.#o.showFocusOnDebug(e)}hideFocusOnDebug(){this.#o.hideFocusOnDebug()}showScreenOffsetsDebug(){this.#o.showScreenOffsets()}hideScreenOffsetsDebug(){this.#o.hideScreenOffsets()}destroy(){this.#o.destroy(),super.destroy()}};function ba(n,e){n[0]=Math.min(n[0],e[0]),n[1]=Math.min(n[1],e[1]),n[2]=Math.max(n[2],e[0]),n[3]=Math.max(n[3],e[1])}function Uu(n,e,t){let r=[],o=[1/0,1/0,-1/0,-1/0],i=null;if(!n||!Array.isArray(n)||n.length===0)return{pointCloud:r,geoBounds:o,firstPosition:i};let s=e.getSystems().renderSystem;for(let a of n)if(typeof a=="string"){(s.threeDdirty||s.twoDdirty)&&e.renderSync();let l=t.get(a);if(!l){_.error("Entity not found with id:",a);continue}let c=new ce;Tc(e,"userData"in l?l.userData.entityId??l.id:l.id,r,c,l instanceof ie?l.position.z:void 0);let u=e.convert3DMapPositionToCoordinate(c.min),d=e.convert3DMapPositionToCoordinate(c.max);ba(o,u),ba(o,d),i||(i=e.convert3DMapPositionToCoordinate(c.getCenter(new O)))}else r.push(e.convertTo3DMapPosition(a[1],a[0],a[2]||0)),ba(o,a),i||(i=a);return{pointCloud:r,geoBounds:o,firstPosition:i}}function xm(n,e){let t=[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]],[e[0],e[1]]];n.map?.getLayer("bounds-outline")&&n.map.removeLayer("bounds-outline"),n.map?.getSource("bounds-source")&&n.map.removeSource("bounds-source"),n.map?.addSource("bounds-source",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:t}}}),n.map?.addLayer({id:"bounds-outline",type:"line",source:"bounds-source",layout:{},paint:{"line-color":"#FF0000","line-width":2,"line-opacity":.8}})}f();f();var Hu=`uniform vec4 uSize;
|
|
8
8
|
varying vec2 vUv;
|
|
9
9
|
void main() {
|
|
10
10
|
vUv = uv;
|
|
@@ -16,7 +16,7 @@ void main() {
|
|
|
16
16
|
// Apply left .w and top .z offset
|
|
17
17
|
transformed += vec2(uSize.w, -uSize.z) * 2.0;
|
|
18
18
|
gl_Position = vec4(transformed, 1.0, 1.0);
|
|
19
|
-
}`;f();var
|
|
19
|
+
}`;f();var Vu=`varying vec2 vUv;
|
|
20
20
|
uniform sampler2D uTexture;
|
|
21
21
|
uniform float uOpacity;
|
|
22
22
|
void main() {
|
|
@@ -26,7 +26,7 @@ void main() {
|
|
|
26
26
|
#else
|
|
27
27
|
gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);
|
|
28
28
|
#endif
|
|
29
|
-
}`;f();var
|
|
29
|
+
}`;f();var Wu=4.291666666666667,ju=15,Zu=25,Xu=43/60;f();var Yu=["horizontal","icon"],Sm=new Map([[Yu[0],`<svg viewBox="0 0 206 48">
|
|
30
30
|
<path d="M27.2678 14.2261H22.3187C21.0695 14.2261 20.4695 14.7801 20.4695 15.9852V31.142L10.3966 15.5591C9.69665 14.4784 9.2475 14.2773 7.8475 14.2261H2.97462C1.67462 14.2261 1.07631 14.7801 1.07631 15.9852V44.7665C1.07631 45.9716 1.67462 46.5256 2.97462 46.5256H7.92377C9.22207 46.5256 9.82207 45.9716 9.82207 44.7665V29.6847L19.9441 45.1926C20.695 46.3244 21.095 46.5256 22.4933 46.5256H27.2933C28.5916 46.5256 29.1916 45.9716 29.1916 44.7665V15.9852C29.1407 14.7801 28.5424 14.2261 27.2678 14.2261Z"/>
|
|
31
31
|
<path d="M5.44915 10.9602C8.45863 10.9602 10.8983 8.50669 10.8983 5.48011C10.8983 2.45353 8.45863 0 5.44915 0C2.43967 0 0 2.45353 0 5.48011C0 8.50669 2.43967 10.9602 5.44915 10.9602Z"/>
|
|
32
32
|
<path d="M61.7899 25.0449C63.2306 23.1903 65.078 22.2051 67.556 22.2051C72.0526 22.2051 74.7611 25.3347 74.7611 29.4511V39.2489C74.8187 39.7125 74.5306 39.9443 74.0695 39.9443H72.5136C72.0526 39.9443 71.7645 39.7125 71.8221 39.2489V29.5091C71.8221 27.1909 69.9187 25.2187 67.4984 25.2187C65.1339 25.2187 63.2323 27.1329 63.2323 29.2773V39.2489C63.2899 39.7125 63.0018 39.9443 62.5407 39.9443H60.9831C60.5221 39.9443 60.2916 39.7125 60.2916 39.2489V29.4511C60.2916 27.1329 58.3899 25.2187 56.0255 25.2187C53.7204 25.2187 51.7594 27.075 51.7594 29.2773V39.3068C51.817 39.7705 51.5289 40.0023 51.0102 40.0023H49.5119C49.0509 40.0023 48.7628 39.7705 48.7628 39.3068V23.25C48.7051 22.7864 48.9933 22.4966 49.5119 22.4966H50.9526C51.356 22.4966 51.5289 22.6704 51.5289 23.0182V24.2352C52.7407 22.9602 54.239 22.2648 56.0255 22.2648C58.4475 22.2068 60.3492 23.192 61.7899 25.0466V25.0449ZM77.1255 31.2477C77.1255 26.3216 81.1018 22.2051 86.1187 22.2051C88.539 22.2051 90.6136 23.1903 92.3441 25.1608V23.1903C92.3441 22.7267 92.5746 22.5528 93.0357 22.5528H94.4187C94.8797 22.5528 95.1102 22.7847 95.1102 23.3062V39.3648C95.1102 39.8284 94.8797 40.0602 94.4187 40.0602H93.0357C92.5746 40.0602 92.3441 39.8284 92.3441 39.4227V37.4523C90.6712 39.3648 88.5967 40.35 86.1746 40.35C81.1018 40.2341 77.1238 36.1773 77.1238 31.2477H77.1255ZM92.1136 31.2477C92.1136 27.8284 89.4611 25.2187 86.0594 25.2187C82.7746 25.2187 80.1221 27.8864 80.1221 31.2477C80.1221 34.6687 82.7746 37.2784 86.1187 37.2784C86.9062 37.2789 87.6861 37.1232 88.4138 36.8202C89.1414 36.5173 89.8026 36.0731 90.3593 35.513C90.9161 34.9528 91.3577 34.2878 91.6587 33.556C91.9597 32.8241 92.1143 32.0397 92.1136 31.2477ZM100.992 37.3943V46.3807C101.049 46.8443 100.761 47.1341 100.298 47.1341H98.7424C98.2814 47.1341 97.9933 46.9023 97.9933 46.3807V23.1903C97.9933 22.7267 98.2238 22.4369 98.7424 22.4369H100.183C100.646 22.379 100.934 22.6687 100.934 23.0744V24.9869C102.605 23.0744 104.68 22.1472 107.044 22.1472C112.002 22.1472 116.037 26.2619 116.037 31.1898C116.037 36.1176 112.059 40.2341 107.044 40.2341C104.622 40.2341 102.603 39.3068 100.992 37.3943ZM106.987 25.2187C103.7 25.2187 101.049 27.8864 101.049 31.2477C101.049 34.6687 103.7 37.2784 107.044 37.2784C110.446 37.2784 113.039 34.6108 113.039 31.2477C113.039 27.8864 110.388 25.2187 106.987 25.2187ZM121.11 37.3943V46.3807C121.168 46.8443 120.88 47.1341 120.419 47.1341H118.861C118.4 47.1341 118.112 46.9023 118.112 46.3807V23.1903C118.112 22.7267 118.342 22.4369 118.861 22.4369H120.302C120.764 22.379 121.053 22.6687 121.053 23.0744V24.9869C122.724 23.0744 124.798 22.1472 127.163 22.1472C132.12 22.1472 136.156 26.2619 136.156 31.1898C136.156 36.1176 132.178 40.2341 127.163 40.2341C124.742 40.2341 122.781 39.3068 121.11 37.3943ZM127.105 25.2187C123.819 25.2187 121.168 27.8864 121.168 31.2477C121.168 34.6687 123.819 37.2784 127.163 37.2784C130.564 37.2784 133.158 34.6108 133.158 31.2477C133.158 27.8864 130.507 25.2187 127.107 25.2187H127.105ZM153.97 32.3506H141.054C141.342 35.2483 143.995 37.4523 147.164 37.4523C148.893 37.4523 150.393 37.0466 151.719 36.0597C152.007 35.8858 152.295 35.7699 152.353 35.7699C152.583 35.7699 152.756 35.8858 152.929 36.1773L153.505 37.1625C153.622 37.3364 153.68 37.4523 153.68 37.5682C153.68 37.8 153.507 38.0318 153.103 38.3216C151.258 39.5966 149.183 40.292 146.992 40.292C141.688 40.292 137.883 36.3511 137.883 31.2477C137.883 26.204 141.803 22.2051 146.703 22.2051C151.546 22.2051 154.717 25.7983 154.717 31.0176C154.717 31.5972 154.717 32.3506 153.968 32.3506H153.97ZM141.056 30.0324H151.72C151.432 26.8432 149.473 24.929 146.648 24.929C145.241 24.8904 143.875 25.3995 142.833 26.3501C141.791 27.3007 141.154 28.6194 141.056 30.0307V30.0324ZM156.332 31.2477C156.332 26.3216 160.31 22.2051 165.326 22.2051C167.748 22.2051 169.707 23.1324 171.32 25.0449V16.2324C171.263 15.7687 171.551 15.479 172.012 15.479H173.57C174.031 15.479 174.319 15.7108 174.319 16.2324V39.3068C174.319 39.7705 174.088 40.0023 173.57 40.0023H172.129C171.666 40.0602 171.378 39.7705 171.378 39.3648V37.3943C169.649 39.3068 167.632 40.292 165.268 40.292C160.31 40.2341 156.332 36.1773 156.332 31.2477ZM171.264 31.2477C171.264 27.8284 168.612 25.2187 165.21 25.2187C161.924 25.2187 159.273 27.8864 159.273 31.2477C159.273 34.6687 161.924 37.2784 165.268 37.2784C166.057 37.2838 166.839 37.1316 167.569 36.8304C168.299 36.5292 168.962 36.0852 169.52 35.5241C170.077 34.963 170.519 34.296 170.818 33.5619C171.117 32.8277 171.268 32.0411 171.263 31.2477H171.264ZM177.72 19.0739C177.715 18.8594 177.754 18.646 177.833 18.4468C177.912 18.2476 178.031 18.0667 178.182 17.915C178.333 17.7633 178.512 17.6439 178.71 17.5642C178.909 17.4845 179.121 17.446 179.334 17.4511C179.546 17.4507 179.756 17.4923 179.952 17.5737C180.148 17.6551 180.326 17.7746 180.476 17.9254C180.626 18.0762 180.745 18.2553 180.826 18.4523C180.907 18.6494 180.948 18.8606 180.948 19.0739C180.953 19.2884 180.914 19.5017 180.835 19.7009C180.756 19.9001 180.637 20.081 180.486 20.2327C180.335 20.3845 180.156 20.5038 179.957 20.5835C179.759 20.6633 179.547 20.7017 179.334 20.6966C178.412 20.7545 177.72 20.0591 177.72 19.0739ZM177.836 39.2489V23.1903C177.836 22.7267 178.066 22.4369 178.527 22.4369H180.083C180.544 22.4369 180.832 22.6687 180.775 23.1903V39.2489C180.832 39.7125 180.544 39.9443 180.083 39.9443H178.527C178.066 39.9443 177.836 39.7125 177.836 39.2489ZM186.944 23.0165V24.1756C188.212 22.8426 189.71 22.2051 191.497 22.2051C195.937 22.2051 198.646 25.2767 198.646 29.3932V39.2489C198.703 39.7125 198.415 39.9443 197.954 39.9443H196.398C195.936 39.9443 195.705 39.7125 195.705 39.2489V29.4511C195.705 27.1329 193.803 25.2187 191.439 25.2187C189.134 25.2187 187.175 27.075 187.175 29.2773V39.3068C187.232 39.7705 186.944 40.0023 186.424 40.0023H184.868C184.407 40.0023 184.119 39.7705 184.119 39.3068V23.1903C184.061 22.7267 184.349 22.4949 184.868 22.4949H186.309C186.712 22.4949 186.944 22.6687 186.944 23.0165Z"/>
|
|
@@ -35,10 +35,10 @@ void main() {
|
|
|
35
35
|
<path d="M14.0291 7.06645C14.0291 10.9691 10.8885 14.1329 7.01453 14.1329C3.14051 14.1329 0 10.9691 0 7.06645C0 3.16376 3.14051 0 7.01453 0C10.8885 0 14.0291 3.16376 14.0291 7.06645Z"/>
|
|
36
36
|
<path d="M28.7335 18.3468H35.1045C36.7455 18.3468 37.5178 19.0599 37.5821 20.6158V57.7309C37.5821 59.2868 36.8099 60 35.1367 60H28.9588C27.1569 60 26.642 59.7406 25.6767 58.282L12.6452 38.282V57.7309C12.6452 59.2868 11.8729 60 10.1997 60H3.82873C2.15554 60 1.3833 59.2868 1.3833 57.7309V20.6158C1.3833 19.0599 2.15554 18.3468 3.82873 18.3468H10.1032C11.9051 18.4116 12.4843 18.671 13.3852 20.0648L26.3524 40.162V20.6158C26.3524 19.0599 27.1247 18.3468 28.7335 18.3468Z"/>
|
|
37
37
|
<path d="M41.5 60C42.3362 60 43 59.3143 43 58.5V58.4914C43 57.6771 42.3448 57 41.5 57C40.6638 57 40 57.6857 40 58.5V58.5086C40 59.3229 40.6552 60 41.5 60ZM41.5 59.8371C40.7414 59.8371 40.1724 59.2371 40.1724 58.5086V58.5C40.1724 57.7714 40.75 57.1629 41.5 57.1629C42.2586 57.1629 42.8276 57.7629 42.8276 58.4914V58.5C42.8276 59.2286 42.25 59.8371 41.5 59.8371ZM40.9138 59.2286H41.2069V58.7057H41.5259L41.8879 59.2286H42.2414L41.8362 58.6543C42.0431 58.5943 42.1897 58.44 42.1897 58.1914C42.1897 57.8743 41.9397 57.7114 41.6034 57.7114H40.9138V59.2286ZM41.2069 58.4657V57.9686H41.5776C41.7759 57.9686 41.8879 58.0543 41.8879 58.2171C41.8879 58.3629 41.7759 58.4657 41.5776 58.4657H41.2069Z"/>
|
|
38
|
-
</svg>`]]),Mm=/<svg([^>]*)>/g;function $u(n,e,t,r){let o=Sm.get(n);return o?o.replace(Mm,`<svg$1 width="${t}" height="${r}" xmlns="http://www.w3.org/2000/svg" fill="${e}">`):""}f();var va=class n{static instance;loader;constructor(){this.loader=new Mo}static getInstance(){return n.instance||(n.instance=new n),n.instance}getLoader(){return this.loader}load(e){return new Promise((t,r)=>{this.loader.load(e,t,void 0,r)})}},
|
|
38
|
+
</svg>`]]),Mm=/<svg([^>]*)>/g;function $u(n,e,t,r){let o=Sm.get(n);return o?o.replace(Mm,`<svg$1 width="${t}" height="${r}" xmlns="http://www.w3.org/2000/svg" fill="${e}">`):""}f();var va=class n{static instance;loader;constructor(){this.loader=new Mo}static getInstance(){return n.instance||(n.instance=new n),n.instance}getLoader(){return this.loader}load(e){return new Promise((t,r)=>{this.loader.load(e,t,void 0,r)})}},Wt=va.getInstance();var qu=!1,li=class extends Z{#e={padding:16,scale:1,iconOnly:!1,position:"bottom-left",color:"dark",onClick:()=>{window?.open("https://www.mappedin.com")},interactive:!0,visible:!0};#n;#i;#o;#s=void 0;#l=void 0;#a=0;#h=0;dirty=!0;get color(){return this.#e.color==="light"?"white":"#293136"}get iconName(){return this.#e.iconOnly?"icon":"horizontal"}get minWidth(){return this.#e.iconOnly?ju:75}get defaultWidth(){return this.#e.iconOnly?Zu:150}get aspectRatio(){return this.#e.iconOnly?Xu:Wu}get options(){return{...this.#e}}set options(e){this.#e={padding:e.padding||this.#e.padding,position:e.position||this.#e.position,iconOnly:e.iconOnly||this.#e.iconOnly,color:e.color||this.#e.color,scale:e.scale||this.#e.scale,onClick:this.#e.onClick,interactive:e.interactive??this.#e.interactive,visible:e.visible??this.#e.visible}}get icon(){return $u(this.iconName,this.color,this.#a*this.#n.pixelRatio,this.#h*this.#n.pixelRatio)}constructor(e,t,r){super(),r&&Object.entries(r).forEach(([o,i])=>{i!==void 0&&(this.#e[o]=i)}),this.#i=e,this.#n=t}setSize(e,t){this.#s&&(this.#s.uniforms.uSize.value.x=e,this.#s.uniforms.uSize.value.y=t)}setXY(e,t){this.#s&&(this.#s.uniforms.uSize.value.w=e,this.#s.uniforms.uSize.value.z=t)}get width(){return this.#a}get height(){return this.#h}getPositionAlignedOffset(e,t){return{"top-left":{x:0,y:0},"top-right":{x:-e,y:0},"bottom-left":{x:0,y:-t},"bottom-right":{x:-e,y:-t},center:{x:-(e/2),y:-(t/2)},top:{x:-(e/2),y:0},bottom:{x:-(e/2),y:-t},left:{x:0,y:-(t/2)},right:{x:-e,y:-(t/2)}}[this.#e.position]}getPositionAlignedCanvasCoordinates=(e,t)=>({"top-left":{x:0,y:0},"top-right":{x:e,y:0},"bottom-left":{x:0,y:t},"bottom-right":{x:e,y:t},center:{x:e/2,y:t/2},top:{x:e/2,y:0},bottom:{x:e/2,y:t},left:{x:0,y:t/2},right:{x:e,y:t/2}})[this.#e.position];getPositionAlignedPadding=()=>{let e=this.#e.padding;if(typeof e=="number")return{"top-left":{x:e,y:e},"top-right":{x:-e,y:e},"bottom-left":{x:e,y:-e},"bottom-right":{x:-e,y:-e},center:{x:0,y:0},top:{x:0,y:e},bottom:{x:0,y:-e},left:{x:e,y:0},right:{x:-e,y:0}}[this.#e.position];let t={top:e.top??0,right:e.right??0,bottom:e.bottom??0,left:e.left??0};return{x:t.left-t.right,y:t.top-t.bottom}};insertIntoQuadTree(e){this.#l!=null&&typeof this.#e.onClick=="function"&&this.#e.interactive&&e.insert(this.#l)}resize(e,t){if(this.#e.visible!==!0)return;let r=this.getPositionAlignedCanvasCoordinates(e,t),o=this.getPositionAlignedPadding(),i=this.getPositionAlignedOffset(this.#a,this.#h),s=Math.min(e-this.#a,Math.max(0,r.x+o.x+i.x)),a=Math.min(t-this.#h,Math.max(0,r.y+o.y+i.y));this.setSize(this.#a/e,this.#h/t),this.setXY(s/e,a/t),this.#l=new zt(s,a,this.#a,this.#h,{entityId:"watermark"})}update(){this.dirty&&(this.#e.visible===!0?(this.#a=Math.min(this.#n.canvasWidth,Math.max(this.minWidth,this.defaultWidth*this.#e.scale)),this.#h=this.#a/this.aspectRatio,Wt.getLoader().load(`data:image/svg+xml;base64,${btoa(this.icon)}`,e=>{if(this.#s=new $e({uniforms:{uTexture:{value:e},uSize:{value:new Jl(0,0,0,0)},uOpacity:{value:.7}},vertexShader:Hu,fragmentShader:Vu,depthWrite:!1,depthTest:!1,defines:{debug:qu},wireframe:qu,transparent:!0,visible:!0}),this.#o)this.#o.visible=!0,this.#o.material=this.#s,this.#o.material.needsUpdate=!0;else{let t=new Ie(2,2,1,1);this.#o=new W(t,this.#s),this.#o.position.set(0,0,-1),this.#o.frustumCulled=!1,this.#o.renderOrder=999;let r=new Nt(1,1,1),o=new W(r,new Me({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}));o.frustumCulled=!1,o.layers.set(1),this.#o.add(o),this.#i.add(this.#o)}this.resize(this.#n.canvasWidth,this.#n.canvasHeight),this.publish("texture-loaded")})):this.#o&&(this.#o.visible=!1),this.dirty=!1)}destroy(){this.#o&&(this.#i.remove(this.#o),ve(this.#o)),this.#o=void 0,this.#s&&this.#s.dispose(),this.#s=void 0,this.#l=void 0}};f();var ci=100,wm=!1,di=class extends Z{currentTotalBoundingBox;state;cameraSystem;debugMesh=null;dirty=!0;autoMinZoomLevel=!0;constructor(e,t){super(),this.state=e,this.cameraSystem=t}expandBoundsIfOutside(e){if(this.currentTotalBoundingBox==null){this.dirty=!0;return}this.currentTotalBoundingBox.containsPoint(e)||(this.dirty=!0)}update(){if(this.dirty){this.currentTotalBoundingBox==null&&(this.currentTotalBoundingBox=new ce,this.state.geometryScene.children.length===0?this.currentTotalBoundingBox.setFromCenterAndSize(new O(0,0,0),new O(ci*2,ci*2,0)):(this.currentTotalBoundingBox.setFromObject(this.state.geometryScene),this.currentTotalBoundingBox.expandByScalar(ci)));let e=new ce().setFromObject(this.state.geometryScene);this.currentTotalBoundingBox.union(e);let t=e.getSize(new O),r=Math.max(t.x,t.y,t.z);for(let i of this.state.geometry2DMap.values())i.positionDirty===!0&&(this.currentTotalBoundingBox.expandByPoint(i.position),i.positionDirty=!1);let o=ui.copy(this.currentTotalBoundingBox).expandByScalar(Math.max(r,ci)).getBoundingSphere(Tm).radius;if(this.cameraSystem.panBounds={center:this.currentTotalBoundingBox.getCenter(new O),min:ui.min,max:ui.max,radius:o},this.publish("update"),this.cameraSystem.dirty=!0,this.dirty=!1,wm&&this.state.geometryScene.parent instanceof St){this.debugMesh&&(this.state.geometryScene.parent.remove(this.debugMesh),this.debugMesh=null),this.debugMesh=new Ge,this.debugMesh.add(new W(new Fr(this.cameraSystem.panBounds.radius),new Me({color:16711680,transparent:!0,opacity:.2}))),this.debugMesh.position.copy(this.cameraSystem.panBounds.center),this.state.geometryScene.parent.add(this.debugMesh);let i=new O;ui.getSize(i);let s=new Nt(i.x,i.y,i.z),a=new Me({color:65280,wireframe:!0,transparent:!0,opacity:.5}),l=new W(s,a);l.position.copy(this.currentTotalBoundingBox.getCenter(new O)),this.debugMesh.add(l)}}}},ui=new ce,Tm=new Kl;f();var xa="\xA9 Mappedin",Dm="https://info.mappedin.com/feedback",Ma=["top-left","top-right","bottom-left","bottom-right"],Pm=640,Im=()=>`<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill-rule='evenodd' viewBox='0 0 20 20'>
|
|
39
39
|
<circle cx='10' cy='10' r='5.9' fill='rgba(255,255,255,1)'/>
|
|
40
40
|
<path fill='rgba(0,0,0,0.7)' d='M4 10a6 6 0 1 0 12 0 6 6 0 1 0-12 0m5-3a1 1 0 1 0 2 0 1 1 0 1 0-2 0m0 3a1 1 0 1 1 2 0v3a1 1 0 1 1-2 0'/>
|
|
41
|
-
</svg>`,Sa={custom:[],position:"bottom-right",feedback:!0},hi=class{controlContainerEl;controlPositions;compact=void 0;#e;attribContainerEl;attribInnerEl;attribButtonEl;feedbackLinkEl;attribHTML=xa;customAttributions=[];constructor(e,t={}){this.#e=!!t.outdoorEnabled,this.controlContainerEl=document.createElement("div"),this.controlContainerEl.classList.add("mappedin-control-container"),this.controlContainerEl.style.zIndex="2",e.appendChild(this.controlContainerEl),this.controlPositions=Ma.reduce((r,o)=>{let i=document.createElement("div");return i.classList.add(`mappedin-ctrl-${o}`),this.controlContainerEl.appendChild(i),r[o]=i,r},{})}addAttributionControl(e=Sa){let t=e.position&&Ma.includes(e.position)?e.position:Sa.position;this.attribContainerEl=document.createElement("details"),this.attribContainerEl.classList.add("mappedin-ctrl-attrib",`mappedin-ctrl-attrib-${t}`),this.attribContainerEl.open=!0,this.attribContainerEl.ariaLabel="Attribution",this.controlPositions[t].appendChild(this.attribContainerEl),this.attribButtonEl=document.createElement("summary"),this.attribButtonEl.addEventListener("click",this.toggleAttribution),this.attribButtonEl.classList.add("mappedin-ctrl-attrib-button"),this.attribButtonEl.title="Toggle attribution",this.attribButtonEl.ariaLabel="Toggle attribution",this.attribButtonEl.tabIndex=0,this.attribButtonEl.innerHTML=Im(),this.attribContainerEl.appendChild(this.attribButtonEl),this.attribInnerEl=document.createElement("div"),this.attribInnerEl.classList.add("mappedin-ctrl-attrib-inner"),this.attribHTML=this.#e?xa:"",this.attribInnerEl.innerHTML=this.attribHTML,this.attribContainerEl.appendChild(this.attribInnerEl),(e.feedback??Sa.feedback)&&(this.feedbackLinkEl=document.createElement("a"),this.feedbackLinkEl.href=Dm,this.feedbackLinkEl.target="_blank",this.feedbackLinkEl.rel="noopener",this.feedbackLinkEl.textContent="Provide Feedback",this.feedbackLinkEl.classList.add("mappedin-ctrl-attrib-inner"),this.feedbackLinkEl.classList.add("mappedin-ctrl-attrib-inner-bold"),this.attribContainerEl.appendChild(this.feedbackLinkEl)),e.custom&&(this.customAttributions=e.custom),this.updateAttributionDisplay()}toggleAttribution=e=>{this.attribContainerEl!=null&&(e.preventDefault(),this.attribContainerEl.classList.contains("mappedin-compact")&&(this.attribContainerEl.classList.contains("mappedin-compact-show")?(this.attribContainerEl.removeAttribute("open"),this.attribContainerEl.classList.remove("mappedin-compact-show")):(this.attribContainerEl.classList.add("mappedin-compact-show"),this.attribContainerEl.setAttribute("open",""))))};updateAttribution(e){if(!e.style||!this.attribInnerEl||!this.attribContainerEl)return;let t=this.#e?[xa]:[],r=e.style.sourceCaches;for(let o in r){let i=r[o];if(i.used||i.usedForTerrain){let s=i.getSource();s.attribution&&t.indexOf(s.attribution)<0&&t.push(s.attribution)}}t=t.filter(o=>String(o).trim()),t=t.filter((o,i)=>{for(let s=i+1;s<t.length;s++)if(t[s].indexOf(o)>=0)return!1;return!0}),this.attribHTML=t.join(" "),this.updateAttributionDisplay()}updateAttributionDisplay(){let e=[...new Set([this.attribHTML,...this.customAttributions])].filter(Boolean).join(" ");this.attribInnerEl&&(this.attribInnerEl.innerHTML=e)}resizeAttribution(e){this.attribContainerEl&&(e<=Pm||this.compact?this.compact===!1?this.attribContainerEl.setAttribute("open",""):!this.attribContainerEl.classList.contains("mappedin-compact")&&!this.attribContainerEl.classList.contains("mappedin-attrib-empty")&&(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.add("mappedin-compact","mappedin-compact-show")):(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.contains("mappedin-compact")&&this.attribContainerEl.classList.remove("mappedin-compact","mappedin-compact-show")))}destroyAttributionControl(){this.attribButtonEl&&this.attribButtonEl.removeEventListener("click",this.toggleAttribution),this.attribContainerEl&&(this.attribContainerEl.remove(),this.attribContainerEl=void 0,this.attribInnerEl=void 0,this.attribButtonEl=void 0)}resize(e){this.resizeAttribution(e)}updateData(e){this.updateAttribution(e)}destroy(){this.destroyAttributionControl(),this.controlContainerEl.remove(),this.compact=void 0}};f();var
|
|
41
|
+
</svg>`,Sa={custom:[],position:"bottom-right",feedback:!0},hi=class{controlContainerEl;controlPositions;compact=void 0;#e;attribContainerEl;attribInnerEl;attribButtonEl;feedbackLinkEl;attribHTML=xa;customAttributions=[];constructor(e,t={}){this.#e=!!t.outdoorEnabled,this.controlContainerEl=document.createElement("div"),this.controlContainerEl.classList.add("mappedin-control-container"),this.controlContainerEl.style.zIndex="2",e.appendChild(this.controlContainerEl),this.controlPositions=Ma.reduce((r,o)=>{let i=document.createElement("div");return i.classList.add(`mappedin-ctrl-${o}`),this.controlContainerEl.appendChild(i),r[o]=i,r},{})}addAttributionControl(e=Sa){let t=e.position&&Ma.includes(e.position)?e.position:Sa.position;this.attribContainerEl=document.createElement("details"),this.attribContainerEl.classList.add("mappedin-ctrl-attrib",`mappedin-ctrl-attrib-${t}`),this.attribContainerEl.open=!0,this.attribContainerEl.ariaLabel="Attribution",this.controlPositions[t].appendChild(this.attribContainerEl),this.attribButtonEl=document.createElement("summary"),this.attribButtonEl.addEventListener("click",this.toggleAttribution),this.attribButtonEl.classList.add("mappedin-ctrl-attrib-button"),this.attribButtonEl.title="Toggle attribution",this.attribButtonEl.ariaLabel="Toggle attribution",this.attribButtonEl.tabIndex=0,this.attribButtonEl.innerHTML=Im(),this.attribContainerEl.appendChild(this.attribButtonEl),this.attribInnerEl=document.createElement("div"),this.attribInnerEl.classList.add("mappedin-ctrl-attrib-inner"),this.attribHTML=this.#e?xa:"",this.attribInnerEl.innerHTML=this.attribHTML,this.attribContainerEl.appendChild(this.attribInnerEl),(e.feedback??Sa.feedback)&&(this.feedbackLinkEl=document.createElement("a"),this.feedbackLinkEl.href=Dm,this.feedbackLinkEl.target="_blank",this.feedbackLinkEl.rel="noopener",this.feedbackLinkEl.textContent="Provide Feedback",this.feedbackLinkEl.classList.add("mappedin-ctrl-attrib-inner"),this.feedbackLinkEl.classList.add("mappedin-ctrl-attrib-inner-bold"),this.attribContainerEl.appendChild(this.feedbackLinkEl)),e.custom&&(this.customAttributions=e.custom),this.updateAttributionDisplay()}toggleAttribution=e=>{this.attribContainerEl!=null&&(e.preventDefault(),this.attribContainerEl.classList.contains("mappedin-compact")&&(this.attribContainerEl.classList.contains("mappedin-compact-show")?(this.attribContainerEl.removeAttribute("open"),this.attribContainerEl.classList.remove("mappedin-compact-show")):(this.attribContainerEl.classList.add("mappedin-compact-show"),this.attribContainerEl.setAttribute("open",""))))};updateAttribution(e){if(!e.style||!this.attribInnerEl||!this.attribContainerEl)return;let t=this.#e?[xa]:[],r=e.style.sourceCaches;for(let o in r){let i=r[o];if(i.used||i.usedForTerrain){let s=i.getSource();s.attribution&&t.indexOf(s.attribution)<0&&t.push(s.attribution)}}t=t.filter(o=>String(o).trim()),t=t.filter((o,i)=>{for(let s=i+1;s<t.length;s++)if(t[s].indexOf(o)>=0)return!1;return!0}),this.attribHTML=t.join(" "),this.updateAttributionDisplay()}updateAttributionDisplay(){let e=[...new Set([this.attribHTML,...this.customAttributions])].filter(Boolean).join(" ");this.attribInnerEl&&(this.attribInnerEl.innerHTML=e)}resizeAttribution(e){this.attribContainerEl&&(e<=Pm||this.compact?this.compact===!1?this.attribContainerEl.setAttribute("open",""):!this.attribContainerEl.classList.contains("mappedin-compact")&&!this.attribContainerEl.classList.contains("mappedin-attrib-empty")&&(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.add("mappedin-compact","mappedin-compact-show")):(this.attribContainerEl.setAttribute("open",""),this.attribContainerEl.classList.contains("mappedin-compact")&&this.attribContainerEl.classList.remove("mappedin-compact","mappedin-compact-show")))}destroyAttributionControl(){this.attribButtonEl&&this.attribButtonEl.removeEventListener("click",this.toggleAttribution),this.attribContainerEl&&(this.attribContainerEl.remove(),this.attribContainerEl=void 0,this.attribInnerEl=void 0,this.attribButtonEl=void 0)}resize(e){this.resizeAttribution(e)}updateData(e){this.updateAttribution(e)}destroy(){this.destroyAttributionControl(),this.controlContainerEl.remove(),this.compact=void 0}};f();var Wr=class{mesh;type="custom-geometry";dirty=!0;feature;builder;outline;constructor(e,t){this.mesh=new He,this.feature=e,this.builder=t}get visible(){return this.mesh.visible}set visible(e){this.mesh.visible=e}#e=1;set opacity(e){this.#e=e}get opacity(){return this.#e}color=new k;setColor(e){this.color.set(e)}get position(){return this.mesh?.position}#n=0;get altitude(){return this.#n}set altitude(e){this.mesh&&(this.mesh.position.z=e,this.#n=e)}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(e){this.mesh&&(this.mesh.renderOrder=e)}};f();var pi=class{state;convertTo3DMapPosition;constructor(e,t){this.state=e,this.convertTo3DMapPosition=t}update(){let e,t;for(let r of this.state.geometry3DsInScene)r?.type==="custom-geometry"&&(e=r.components[0],t=r.components[1],e.dirty&&t.visible!==!1&&(e.position.copy(this.convertTo3DMapPosition(e.feature.geometry.coordinates[1],e.feature.geometry.coordinates[0],t.altitude)),e.builder.setup(e.mesh),e.mesh.traverse(o=>{o.userData={...o.userData,entityId:r.id,type:"custom-geometry"}}),e.dirty=!1),t.visible!==!1&&e.builder.update(e.mesh))}};f();f();function wn(n){return n.children.some(e=>e.userData.isOutline)}function Ju(n){return n.children.find(e=>e.userData.isOutline)}function Tn(n,e){let t=n.userData.entities3D.values().next().value;return t?e.geometry3DMap.get(t)?.components[3]!==void 0:!1}function Ku(n,e,t,r,o){let s=n.getAttribute("position").array,a=1/0,l=-1/0;for(let u=0;u<e.count;u++){let h=(e.start+u)*3,g=s[h+2];a=Math.min(a,g),l=Math.max(l,g)}let c=l-a;if(!o||o.thickness===0||c===0)for(let u=0;u<e.count;u++){let h=(e.start+u)*3,g=s[h+2];Math.abs(g-l)<1e-4?s[h+2]=Math.max(t+r,2e-4+r):s[h+2]=r}else{let u=o.thickness,d=a+u,h=a+u,g=l-u,b=l-u,M=r-u,m=r,p=r,y=r+t,v=r+t,x=r+t+u;for(let S=0;S<e.count;S++){let D=(e.start+S)*3,C=s[D+2],T;if(C<=d){let P=u>0?(C-a)/u:0;T=M+P*(m-M)}else if(C>=b){let P=u>0?(C-b)/u:0;T=v+P*(x-v)}else{let P=g-h,I=P>0?(C-h)/P:0;T=p+I*(y-p)}s[D+2]=T}}n.attributes.position.needsUpdate=!0}f();f();var Qu=`// Modified from https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderLib/linedashed.glsl.js
|
|
42
42
|
uniform float scale;
|
|
43
43
|
attribute float lineDistance;
|
|
44
44
|
|
|
@@ -152,7 +152,7 @@ void main() {
|
|
|
152
152
|
discard;
|
|
153
153
|
}
|
|
154
154
|
}
|
|
155
|
-
`;var Dn=class extends Lr{effectUniforms={effectStart:{value:0},effectDistance:{value:0},darkenAmount:{value:0},darkenUseDepth:{value:1},desaturateAmount:{value:0},desaturateUseDepth:{value:1},washOutAmount:{value:0},washOutUseDepth:{value:0}};constructor(e){super(e),this.onBeforeCompile=t=>{t.vertexShader=Qu,t.fragmentShader=ed;let r=this.effectUniforms.effectStart,o=this.effectUniforms.effectDistance,i=this.effectUniforms.darkenAmount,s=this.effectUniforms.darkenUseDepth,a=this.effectUniforms.desaturateAmount,l=this.effectUniforms.desaturateUseDepth,c=this.effectUniforms.washOutAmount,u=this.effectUniforms.washOutUseDepth;this.effectUniforms=t.uniforms,Object.assign(this.effectUniforms,{effectStart:r,effectDistance:o,darkenAmount:i,darkenUseDepth:s,desaturateAmount:a,desaturateUseDepth:l,washOutAmount:c,washOutUseDepth:u})}}setEffectRange(e,t){this.effectUniforms.effectStart.value=e,this.effectUniforms.effectDistance.value=t}getEffectRange(){return{start:this.effectUniforms.effectStart.value,distance:this.effectUniforms.effectDistance.value}}setVisualEffect(e,t,r,o,i,s){this.effectUniforms.darkenAmount.value=e,this.effectUniforms.darkenUseDepth.value=t?1:0,this.effectUniforms.desaturateAmount.value=r,this.effectUniforms.desaturateUseDepth.value=o?1:0,this.effectUniforms.washOutAmount.value=i,this.effectUniforms.washOutUseDepth.value=s?1:0}getVisualEffect(){return{darkenAmount:this.effectUniforms.darkenAmount.value,darkenUseDepth:this.effectUniforms.darkenUseDepth.value,desaturateAmount:this.effectUniforms.desaturateAmount.value,desaturateUseDepth:this.effectUniforms.desaturateUseDepth.value,washOutAmount:this.effectUniforms.washOutAmount.value,washOutUseDepth:this.effectUniforms.washOutUseDepth.value}}};f();var vr=class{#e=[];#n=!1;#i;#o;get size(){return this.#e.length}add(e){this.#e.push(e),this.#n||this.#s()}onComplete(e){this.#i=e}clearOnComplete(){this.#i=void 0}#s(){this.#n=!0,this.#o=requestIdleCallback(e=>{let t=0;for(;this.#e.length>0&&e.timeRemaining()>2;){let r=this.#e.shift();r&&(r(),t++)}if(t===0&&this.#e.length>0&&e.timeRemaining()<2){let r=this.#e.shift();r&&r()}this.#o=void 0,this.#e.length>0?this.#s():(this.#n=!1,this.#i&&this.#i())},{timeout:3e3})}clearAll(){this.#e=[],this.#n=!1,this.#i=void 0,this.#o!==void 0&&(cancelIdleCallback(this.#o),this.#o=void 0)}};var Rm=80,mi=class extends Z{rendererState;maxOpacity;outlineOpacitiesDirty=!0;useIdleFramesOnly=!0;#e=!0;get geometries3DDirty(){return this.#e}set geometries3DDirty(e){this.#e=e}#n=-1/0;idleBuildQueue=new vr;idleComputeBoundingSphereQueue=new vr;constructor(e,t){super(),this.rendererState=e,this.maxOpacity=t?.maxOpacity??1,this.idleBuildQueue.onComplete(this.#o)}#i=new Map;buildOutlines(e){let t=[];for(let d of e.userData.entities3D.values()){let h=this.rendererState.geometry3DMap.get(d);if(h instanceof $&&h.type==="geometry"&&h.components[3]&&h.components[3].dirty===!0&&h.components[0].material!=null){let g=h.components[0].geometry,b=!1;g||(g=bn(h.components[0]),b=!0);let M=h.components[1];t.push([h.components[3],new So(g,M.bevel?.enabled?1:Rm)]),b&&(g?.dispose(),g=void 0)}}if(t.length===0)return;let r=ze(t.map(d=>d[1]),!1);if(r==null)return;let o=r.getAttribute("position"),i=new Float32Array(o.count*4),s=new ke(i,4);r.setAttribute("color",s);let a=new Uint8Array(o.count);a.fill(0);let l=new ke(a,1,!1);r.setAttribute("visibility",l);let c=0;for(let d=0;d<t.length;d++){let[h,g]=t[d],b=g.getAttribute("position").count;h.edgeColors=s,h.edgeVisibility=l,h.geometry=r,h.ranges={count:b,start:c},c+=b,g.dispose()}let u=new Bt(r,new Dn({vertexColors:!0,linewidth:1,transparent:!0,opacity:1,side:yo}));u.userData.isOutline=!0,e.add(u)}update(e,t=!0){if(this.geometries3DDirty){for(let o of this.rendererState.geometry3DsInScene)o.type==="feature-collection"&&Tn(o,this.rendererState)&&!wn(o)&&o.userData.entities3D.size>0&&(this.useIdleFramesOnly?this.idleBuildQueue.add(()=>this.buildOutlines(o)):this.buildOutlines(o));this.#e=!1,this.outlineOpacitiesDirty=!0}for(let o of this.rendererState.geometry3DsInScene)if(o.type==="geometry"&&o.components[3]&&o.components[3].dirty===!0&&o.components[0].material!=null&&o.parentObject3D instanceof Ce){let i=o.components[3].geometry;if(!i)continue;let s=o.components[3];if(!s)continue;let a=s.enabled&&o.components[1].visible;if(s.visible!==a&&(s.visible=a),!s.visible)continue;let l=s.edgeColors;if(!l||!s.ranges)continue;let c=new k(s.color);for(let g=0;g<s.ranges.count;g++){let b=s.ranges.start+g;l.setXYZ(b,c.r,c.g,c.b)}let u=o.components[1].height,d=o.components[1].altitude,h=o.components[1]?.bevel;Ku(i,s.ranges,u,d,h),i.attributes.color.needsUpdate=!0,this.idleComputeBoundingSphereQueue.add(()=>i.computeBoundingSphere()),s.dirty=!1}else if(o.type==="feature-collection"&&wn(o)){let i=Ju(o);if(!i)continue;let s=i.material;if(!(s instanceof Dn))continue;let a;for(let u of o.userData.entities3D.values()){a=u;break}if(a==null)continue;let l=this.rendererState.geometry3DMap.get(a);if(!l||l.type!=="geometry")continue;let c=l.components[1];s.setEffectRange(c.effectStart,c.effectDistance),s.setVisualEffect(c.darkenAmount,c.darkenUseDepth,c.desaturateAmount,c.desaturateUseDepth,c.washOutAmount,c.washOutUseDepth)}let r=t?Os(e,16,19,0,this.maxOpacity):this.#n;if((r!==this.#n||this.outlineOpacitiesDirty)&&this.rendererState.geometry3DsInScene.size>0){for(let o of this.rendererState.geometry3DsInScene)if(o.type==="geometry"&&o.components[0]instanceof oe){let i=o.components[3];if(i&&i.edgeColors&&i.geometry&&i.visible){let s=Math.min(r,o.components[1].opacity*Gr(o));if(i.currentOpacity!==s){for(let a=0;a<i.ranges.count;a++){let l=i.ranges.start+a;i.edgeColors.setW(l,s)}i.geometry.attributes.color.needsUpdate=!0}}}}this.#n=r,this.#e=!1,this.outlineOpacitiesDirty=!1}#o=()=>{this.publish("needs-render")};destroy(){this.#i.clear(),this.idleBuildQueue.clearAll(),this.idleComputeBoundingSphereQueue.clearAll()}};f();f();import{z as Re}from"zod";var fi=class extends V{userData={entityId:"",cacheKey:"",isResizable:!1}},_m=Re.object({flipImageToFaceCamera:Re.boolean().optional(),url:Re.string(),maxImageSize:Re.number().positive().optional(),interactive:Re.boolean().optional()}),Fm=Re.object({type:Re.enum(["Feature"]),properties:Re.object({width:Re.number(),height:Re.number(),rotation:Re.number().min(0).max(360).optional(),verticalOffset:Re.number().optional()}),geometry:zr});function td(n,e,t){Re.union([Re.number(),Re.string()]).parse(n),Fm.parse(e),_m.parse(t)}var Pn=class{mesh=new He;imageMesh;outline;type="image";instanceIndex=-1;geometry;material;feature;constructor(e){this.feature=e}get visible(){return this.mesh?.visible??!1}set visible(e){this.mesh&&(this.mesh.visible=e)}position=new O};f();function Ca(n,e){return{x:n.x*Math.cos(e)-n.y*Math.sin(e),y:n.x*Math.sin(e)+n.y*Math.cos(e)}}function Nm(n,e){return n.map(t=>Ca(t,e))}function Bm(n){let e=1/0,t=1/0,r=-1/0,o=-1/0;for(let i of n)e=Math.min(e,i.x),t=Math.min(t,i.y),r=Math.max(r,i.x),o=Math.max(o,i.y);return{minX:e,minY:t,maxX:r,maxY:o}}function Gm(n,e){let t=!1;for(let r=0,o=e.length-1;r<e.length;o=r++){let i=e[r].x,s=e[r].y,a=e[o].x,l=e[o].y;s>n.y!=l>n.y&&n.x<(a-i)*(n.y-s)/(l-s)+i&&(t=!t)}return t}function rd(n,e,t,r,o){for(let i=0;i<o;i++)for(let s=0;s<r;s++)if(n[t+i][e+s]!==1)return!1;return!0}function km(n,e,t){let r=n.maxX-n.minX,o=n.maxY-n.minY,i,s,a={...n};return r/o>e?(s=o/t,i=s*e,a.minX+=(r-i*t)/2):(i=r/t,s=i/e,a.minY+=(o-s*t)/2),{dx:i,dy:s,gridBounds:a}}function zm(n,e,t,r,o){let i=Array(t).fill(0).map(()=>Array(t).fill(0));for(let s=0;s<t;s++)for(let a=0;a<t;a++){let l={x:e.minX+a*r,y:e.minY+s*o};Gm(l,n)&&(i[s][a]=1)}return i}function Um(n,e){let t=Array(e).fill(0).map(()=>Array(e).fill(0));for(let r=0;r<e;r++)for(let o=0;o<e;o++)if(n[r][o]===1){let i=0;for(let s=1;s<=Math.min(e-o,e-r)&&rd(n,o,r,s,s);s++)i=s;t[r][o]=i}return t}function Hm(n,e,t,r,o,i){let s=0,a=0,l=0;for(let c=0;c<r;c++)for(let u=0;u<r;u++)if(n[c][u]===1){let d=Math.pow(e[c][u],2),h=t.minX+u*o,g=t.minY+c*i;s+=d,a+=h*d,l+=g*d}return{x:a/s,y:l/s}}function Wm(n,e,t,r,o,i,s){let a=-1/0,l=null,c=n.length,u=Math.sqrt(Math.pow(e.maxX-e.minX,2)+Math.pow(e.maxY-e.minY,2));for(let d=0;d<c;d++)for(let h=0;h<c;h++)if(n[d][h]===1)for(let g=1;g<=c-h;g++){let b=g;if(!(b>c-d)&&rd(n,h,d,g,b)){let M=g*b,m=e.minX+(h+g/2)*t,p=e.minY+(d+b/2)*r,y={x:m,y:p},x=Math.sqrt(Math.pow(y.x-o.x,2)+Math.pow(y.y-o.y,2))/u,S=M*(1-i)-x*i*M;S>a&&(a=S,l={center:y,width:g*t*s,height:g*r*s})}}return l}function Ea(n,e,t,r={}){let{scaleFactor:o=.9,centerPriority:i=.5,resolution:s=100,minimumSizeRatio:a=.5}=r,l=Et(t),c=n.width/n.height,u=Nm(e,l),d=Bm(u),{dx:h,dy:g,gridBounds:b}=km(d,c,s),M=zm(u,b,s,h,g),m=Um(M,s),p=Hm(M,m,b,s,h,g),y=Wm(M,b,h,g,p,i,o);return!y||y.width<n.width*a||y.height<n.height*a?n:{...y,center:Ca(y.center,-l),rotation:t,polygonCenter:Ca(p,-l)}}f();var re={HIGH:1,MEDIUM:.5,LOW:.25,VERY_LOW:.125},se={[re.HIGH]:2048,[re.MEDIUM]:1024,[re.LOW]:512,[re.VERY_LOW]:256},nd={[se[re.HIGH]]:65280,[se[re.MEDIUM]]:16776960,[se[re.LOW]]:16753920,[se[re.VERY_LOW]]:16711680},gi={HIGH:50,MEDIUM:100,LOW:250},od="https://resize-worker.mappedin.com",id=["cdn.mappedin.com","cdn.eu.mappedin.com"],wa=["resize-worker.mappedin.com","resize-worker-staging.mappedin.net"],Ta=.01,In=1024,On=256,sd=512,ad=2048,ld=3,cd=37,ud=16*1024*1024;f();function Da(n){try{let t=new URL(n).hostname;return id.includes(t)||wa.includes(t)}catch{return!1}}function Vm(n){try{let e=new URL(n);return wa.includes(e.hostname)}catch{return!1}}function Pa(n,e){return Vm(n)?n.replace(/\/resize:fit:\d+:\d+:(\d+)\//,`/resize:fit:${e}:${e}:$1/`):`${od}/resize:fit:${e}:${e}:0/plain/${n}`}function dd(n){return n<=gi.HIGH?se[re.HIGH]:n<=gi.MEDIUM?se[re.MEDIUM]:n<=gi.LOW?se[re.LOW]:se[re.VERY_LOW]}function hd(n){let e=n*cd;return e<=se[re.LOW]?se[re.LOW]:e<=se[re.MEDIUM]?se[re.MEDIUM]:se[re.HIGH]}function pd(n,e){return Da(n)?n:`${n}|${e??In}`}function yi(n,e){n.color=new k(16777215),n.emissive=new k(nd[e]),n.emissiveIntensity=.5}function bi(n){n.color=new k(16777215),n.emissive=new k(0),n.emissiveIntensity=0}f();function fd(n){let{transformImageRequest:e,getMaxTextureSize:t,publish:r}=n,o=new Map,i=new Set,s=0,a=!1,l={transformImageRequest:e,isDisposed:()=>a};function c(){if(s>0)return s;let m=t(),p=yc().isMobile?sd:se[re.HIGH];return s=Math.min(p,m),s}function u(m){return Math.min(m,c())}function d(m,p){return Math.min(u(dd(p)),hd(m.maxLongEdge))}function h(m,p,y){if(m.base||m.basePending)return;m.basePending=!0;let v=m.isResizable?Pa(p,y):p;md(v,S=>{let w=m.isResizable?S:Ym(S,y);return w.colorSpace=lr,m.base=w,m.basePending=!1,w},()=>{m.basePending=!1},l).then(()=>{a||r()}).catch(()=>{})}function g(m,p,y){m.hiLod!=null&&y<=m.hiLod||m.readyLod!=null&&y<=m.readyLod||(m.ready=p,m.readyLod=y,i.add(m))}function b(m){m.ready=null,m.readyLod=null,i.delete(m)}function M(m,p,y){if(!m.isResizable||m.hiLod!=null&&y<=m.hiLod||m.readyLod!=null&&y<=m.readyLod||m.pendingFetchLOD!=null&&y<=m.pendingFetchLOD)return;m.pendingFetchLOD=y;let v=()=>{m.pendingFetchLOD===y&&(m.pendingFetchLOD=null)},x=Pa(p,y);md(x,w=>(w.colorSpace=lr,g(m,w,y),v(),w),()=>{v()},l).then(()=>{a||r()}).catch(()=>{})}return{register(m,p,y,v,x,S){if(a)return;let w=o.get(m);if(w?(S>w.maxLongEdge&&(w.maxLongEdge=S),x<w.distance&&(w.distance=x)):(w={base:null,hi:null,hiLod:null,ready:null,readyLod:null,basePending:!1,pendingFetchLOD:null,isResizable:v,distance:x,maxLongEdge:S},o.set(m,w)),h(w,p,v?On:y),v){let C=d(w,x);C>On&&M(w,p,C)}},get(m){if(a)return null;let p=o.get(m);return p?p.hi??p.base:null},requestUpgrade(m,p){if(a)return;let y=o.get(m);!y||!y.isResizable||(p<y.distance&&(y.distance=p),M(y,m,d(y,p)))},drainPromotions(){if(a||i.size===0)return;let m=0,p=0,y=Math.min(ld,i.size);for(;m<y;){let v,x=1/0;for(let D of i)D.distance<x&&(x=D.distance,v=D);if(v==null)break;let S=Zm(v.ready);if(p>0&&p+S>ud)break;let w=v.hi;v.hi=v.ready,v.hiLod=v.readyLod,b(v),w?.dispose(),p+=S,m++}i.size>0&&r()},effectiveLOD(m){return o.get(m)?.hiLod??On},residentResolutionBucket(m){let p=o.get(m),y=p?.hi??p?.base;return Xm(jm(y))},dispose(){a=!0;for(let m of o.values())m.base?.dispose(),m.hi?.dispose(),m.ready?.dispose();o.clear(),i.clear()}}}function md(n,e,t,r){let o=i=>new Promise((s,a)=>{if(r.isDisposed()){a(new Error("LOD control disposed"));return}Vt.getLoader().load(i,l=>{if(r.isDisposed()){l.dispose(),a(new Error("LOD control disposed"));return}try{s(e(l))}catch(c){_.error("Failed to process image texture",{url:i,error:c}),t(c),a(c)}},void 0,l=>{if(r.isDisposed()){a(new Error("LOD control disposed"));return}_.error("Failed to load image",{url:i,error:l}),t(l),a(l)})});return r.transformImageRequest?r.transformImageRequest(n).then(i=>o(i.url),i=>(r.isDisposed()||(_.error("Failed to transform image request",{url:n,error:i}),t(i)),Promise.reject(i))):o(n)}var xr={w:0,h:0};function gd(n){let e=n?.image;return e?e instanceof HTMLImageElement?(xr.w=e.naturalWidth||0,xr.h=e.naturalHeight||0):(xr.w=e.width||0,xr.h=e.height||0):(xr.w=0,xr.h=0),xr}function jm(n){let{w:e,h:t}=gd(n);return Math.max(e,t)}function Zm(n){let{w:e,h:t}=gd(n);return e*t*4}function Xm(n){return n>=se[re.HIGH]?se[re.HIGH]:n>=se[re.MEDIUM]?se[re.MEDIUM]:n>=se[re.LOW]?se[re.LOW]:On}function Ym(n,e){let t=n.image,r=t instanceof HTMLImageElement?t.naturalWidth:t.width,o=t instanceof HTMLImageElement?t.naturalHeight:t.height,i=Math.max(r,o);if(i<=e)return n.colorSpace=lr,n;n.dispose();let s=e/i,a=Math.max(1,Math.floor(r*s)),l=Math.max(1,Math.floor(o*s)),c;typeof window<"u"&&window.OffscreenCanvas!=null&&!bc()?c=new OffscreenCanvas(a,l):(c=document.createElement("canvas"),c.width=a,c.height=l);let u=c.getContext("2d");if(!u)throw new Error("Failed to get 2D context for texture capping");u.drawImage(t,0,0,a,l);let d=new rc(c);return d.colorSpace=lr,d.needsUpdate=!0,d}var Ln=Math.PI*2,$m=Math.PI/2,qm=Math.PI*1.5,Jm=ri($m,2),Km=ri(qm,2),vi=class extends Z{rendererState;convertTo3DMapPosition;projectToScreen;initialBearing=0;naturalBearing=0;imagePlacementOptions;cameraFrustum=new Or;cameraWorldPosition=new O;debug={lod:!1,imageContainers:!1};get debugLOD(){return this.debug.lod}set debugLOD(e){let t=this.debug.lod!==e;this.debug.lod=e,t&&(e?this.applyDebugLODColors():this.resetDebugLODColors())}lod;constructor(e,t,r,o=0,i=0,s={},a){super(),this.rendererState=e,this.convertTo3DMapPosition=t,this.projectToScreen=r,this.initialBearing=o,this.naturalBearing=i,this.imagePlacementOptions=s,this.lod=fd({transformImageRequest:a,getMaxTextureSize:()=>this.rendererState.renderer?.capabilities?.maxTextureSize??ad,publish:()=>this.publish("image-loaded")})}createImageMesh(e,t,r,o=0,i,s,a=In){let l={width:r.width,height:r.height,center:this.convertTo3DMapPosition(i),rotation:r.rotation??0},c=this.imagePlacementOptions.mode??"default",u=(()=>{switch(c){case"fit-nearest-90":let x=(this.initialBearing-this.naturalBearing+360)%180;return x>=45&&x<=135?Ea(l,s,l.rotation+90,this.imagePlacementOptions):l;case"fit-initial-bearing":return Ea(l,s,this.initialBearing,this.imagePlacementOptions);case"default":case"none":default:return l}})();if(this.debug.imageContainers&&u.polygonCenter){let x=new V(new Fr(1),new Gt({color:65280}));x.position.set(u.polygonCenter.x,u.polygonCenter.y,o),this.rendererState.geometryScene.add(x)}let d=new Gt({transparent:!0,depthWrite:!1,side:Rt}),h=new Ie(u.width,u.height),g=new fi(h);g.visible=!1,g.renderOrder=ue.IMAGE_MESH;let b=Da(t),M=o+Ta,m=this.rendererState.cameraObject.position.z,p=Math.abs(m-M),y=pd(t,a),v=Math.max(u.width,u.height);if(this.lod.register(y,t,a??In,b,p,v),g.userData.entityId=e,g.userData.cacheKey=y,g.userData.isResizable=b,g.material=d,this.debug.imageContainers){let x=new V(new Ie(r.width,r.height),new Gt({color:"gray"}));g.add(x);let S=new dc;g.add(S),S.scale.set(10,10,10)}return g.position.set(u.center.x,u.center.y,o+Ta),g.rotation.z=(-U.degToRad(u.rotation)+Ln)%Ln,g}applyDebugLODColors(){this.rendererState.cameraObject.getWorldPosition(this.cameraWorldPosition);for(let e of this.rendererState.geometry3DsInScene)if(e.type==="image"){let t=e.components[0];if(t?.imageMesh?.material instanceof Gt){let{cacheKey:r,isResizable:o}=t.imageMesh.userData;o===!0?yi(t.imageMesh.material,this.lod.residentResolutionBucket(r)):bi(t.imageMesh.material)}}else if(e.type==="geometry"){let t=e.components[0];if(Array.isArray(t?.feature))continue;if(t?.imageMesh?.material instanceof Gt){let{cacheKey:r,isResizable:o}=t.imageMesh.userData;o===!0?yi(t.imageMesh.material,this.lod.residentResolutionBucket(r)):bi(t.imageMesh.material)}}}resetDebugLODColors(){for(let e of this.rendererState.geometry3DsInScene){let t;e.type==="image"?t=e.components[0]:e.type==="geometry"&&(t=e.components[0]),t?.imageMesh?.material instanceof Gt&&bi(t.imageMesh.material)}}flipIfNeeded(e,t){if(e.imageMesh==null)return;let r=-t,o=e.imageMesh.rotation.z,i=ri((o-r+Ln)%Ln,2);if(i>Jm&&i<Km){let s=e.imageMesh.matrixWorldAutoUpdate===!1;s&&Lo(e.imageMesh),e.imageMesh.rotation.z=(o+Math.PI)%Ln,e.imageMesh.updateMatrixWorld(),s&&Ic(e.imageMesh)}}currentImageScreenBBoxes=[];viewProjectionMatrix=new Y;lastLODUpdateTime=-1;reconcileMaterialTexture(e,t,r){let o=this.lod.get(t);return e.map!==o&&(e.map=o,e.needsUpdate=!0,this.debug.lod&&r&&yi(e,this.lod.residentResolutionBucket(t))),o!=null}update(e,t,r){this.currentImageScreenBBoxes=[],this.viewProjectionMatrix.identity().multiply(this.rendererState.cameraObject.projectionMatrix).multiply(this.rendererState.cameraObject.matrixWorldInverse),this.cameraFrustum.setFromProjectionMatrix(this.viewProjectionMatrix),this.rendererState.cameraObject.getWorldPosition(this.cameraWorldPosition);let o=!t&&r!==this.lastLODUpdateTime;o&&(this.lastLODUpdateTime=r),this.lod.drainPromotions();let i,s;for(let a of this.rendererState.geometry3DsInScene)if(a.type==="image"){if(i=a.components[0],s=a.components[1],s.url&&i.imageMesh==null){let l=this.convertTo3DMapPosition(i.feature.geometry.coordinates),c={x:l.x,y:l.y};i.imageMesh=this.createImageMesh(a.id,s.url,i.feature.properties,i.feature.properties.verticalOffset,i.feature.geometry.coordinates,[c],s.maxImageSize),i.mesh.add(i.imageMesh),i.position.copy(i.imageMesh.position)}if(i.imageMesh){let{cacheKey:l,isResizable:c}=i.imageMesh.userData;if(o&&s.url){let u=Math.abs(this.cameraWorldPosition.z-i.position.z);this.lod.requestUpgrade(l,u)}if(s.url){let u=i.imageMesh.material;this.reconcileMaterialTexture(u,l,c)&&!i.imageMesh.visible&&(i.imageMesh.visible=!0)}s.flipImageToFaceCamera&&this.flipIfNeeded(i,e),i.imageMesh.material instanceof Gt&&s.dirty&&i.imageMesh.material.opacity!==s.opacity&&(i.imageMesh.material.opacity=s.opacity)}}else if(a?.type==="geometry"){if(i=a.components[0],s=a.components[1],Array.isArray(i.feature))continue;if(s.showImage&&i.feature.properties?.image&&i.imageMesh==null&&i.visible&&i.mesh!=null&&i.mesh.parent!=null&&i.feature.properties?.image.position!=null&&i.feature.geometry.coordinates!=null&&i.feature.geometry.coordinates.length>0){let l=i.feature.geometry.coordinates[0].map(u=>{let d=this.convertTo3DMapPosition(u);return{x:d.x,y:d.y}}),c=this.createImageMesh(a.id,i.feature.properties?.image.path,i.feature.properties?.image,s.height+s.altitude,i.feature.properties?.image.position,l,s.maxImageSize);i.mesh.parent.add(c),i.imageMesh=c}if(i.imageMesh){let l=i.feature.properties?.image?.path,{cacheKey:c,isResizable:u}=i.imageMesh.userData,d=!1;if(o&&l){let h=Math.abs(this.cameraWorldPosition.z-i.imageMesh.position.z);this.lod.requestUpgrade(c,h)}if(l){let h=i.imageMesh.material;d=this.reconcileMaterialTexture(h,c,u)}i.visible?s.showImage&&!i.imageMesh.visible?l?d&&(i.imageMesh.visible=!0):i.imageMesh.visible=!0:!s.showImage&&i.imageMesh.visible&&(i.imageMesh.visible=!1):i.imageMesh.visible=!1,s.flipImageToFaceCamera&&this.flipIfNeeded(i,e),s.enableImageCollisions===!0&&this.updateImageScreenBBoxes(i)}}}destroy(){this.lod.dispose(),super.destroy()}updateImageScreenBBoxes(e){if(e.imageMesh==null||!e.imageMesh.visible)return;let t=e.imageMesh.geometry.boundingBox;if(t==null&&(e.imageMesh.geometry.computeBoundingBox(),t=e.imageMesh.geometry.boundingBox),t){let r=new O;if(e.imageMesh.getWorldPosition(r),!this.cameraFrustum.containsPoint(r))return;let o=new W;this.projectToScreen(o,r);let i=[new O(t.min.x,t.min.y,t.min.z),new O(t.max.x,t.min.y,t.min.z),new O(t.min.x,t.max.y,t.min.z),new O(t.max.x,t.max.y,t.min.z),new O(t.min.x,t.min.y,t.max.z),new O(t.max.x,t.min.y,t.max.z),new O(t.min.x,t.max.y,t.max.z),new O(t.max.x,t.max.y,t.max.z)],s=[];for(let h of i){let g=h.clone().applyMatrix4(e.imageMesh.matrixWorld),b=new W;this.projectToScreen(b,g),s.push(b)}let a=1/0,l=1/0,c=-1/0,u=-1/0;for(let h of s)a=Math.min(a,h.x),l=Math.min(l,h.y),c=Math.max(c,h.x),u=Math.max(u,h.y);let d=new zt(o.x,o.y,c-a,u-l);this.currentImageScreenBBoxes.push(d)}else _.warn("Bounding box for imageMesh does not exist.")}};f();f();function Ia(n){let e=1/0,t=1/0,r=-1/0,o=-1/0;for(let i of n)i.x<e&&(e=i.x),i.x>r&&(r=i.x),i.y<t&&(t=i.y),i.y>o&&(o=i.y);return{minX:e,minY:t,maxX:r,maxY:o}}function Qm(n,e){return!(n.maxX<e.minX||n.minX>e.maxX||n.maxY<e.minY||n.minY>e.maxY)}function ef(n,e){if(!Qm(n,e))return 0;let t=Math.max(n.minX,e.minX),r=Math.min(n.maxX,e.maxX),o=Math.max(n.minY,e.minY),i=Math.min(n.maxY,e.maxY),s=r-t,a=i-o;return s*a}function yd(n,e){let t=ef(n,e);if(t===0)return 0;let r=e.maxX-e.minX,o=e.maxY-e.minY,i=r*o;return i===0?0:t/i}f();function tf(n){let e=0;for(let t=1;t<n.length;t++)(n[t].y<n[e].y||n[t].y===n[e].y&&n[t].x<n[e].x)&&(e=t);return e}function rf(n,e){let t=[...n];return t.sort((r,o)=>{let i=r.point.x-e.x,s=r.point.y-e.y,a=o.point.x-e.x,l=o.point.y-e.y,c=i*l-s*a;if(c===0){let u=i*i+s*s,d=a*a+l*l;return u-d}return c>0?-1:1}),t}function nf(n,e){let t=[e];for(let r=0;r<n.length;r++){for(;t.length>1;){let o=t[t.length-2].point,i=t[t.length-1].point,s=n[r].point,a=i.x-o.x,l=i.y-o.y,c=s.x-i.x,u=s.y-i.y;if(a*u-l*c<=0)t.pop();else break}t.push(n[r])}return t}function bd(n){if(n.length<3)return n.map((i,s)=>({point:i,index:s}));let e=tf(n),t=n.map((i,s)=>({point:i,index:s})),r=t[e];t.splice(e,1);let o=rf(t,r.point);return nf(o,r)}function An(n,e,t,r){if(n.length===0)return[];let o=[],i=n[n.length-1],s=e*i.x+t*i.y+r;for(let a=0;a<n.length;a++){let l=n[a],c=e*l.x+t*l.y+r;if(c>=0){if(s<0){let u=s/(s-c);o.push({x:i.x+u*(l.x-i.x),y:i.y+u*(l.y-i.y)})}o.push(l)}else if(s>=0){let u=s/(s-c);o.push({x:i.x+u*(l.x-i.x),y:i.y+u*(l.y-i.y)})}i=l,s=c}return o}f();var of="2",sf="1000",af="1002";function lf(n,e){let t=document.createElement("div");return t.id=`focus-bbox-${n}`,t.style.position="absolute",t.style.pointerEvents="none",t.style.overflow="hidden",t.style.zIndex=sf,e.appendChild(t),t}function cf(n,e){let t=e.maxX-e.minX,r=e.maxY-e.minY;n.style.left=e.minX+"px",n.style.top=e.minY+"px",n.style.width=t+"px",n.style.height=r+"px"}function uf(n,e){e?(n.style.border="2px solid green",n.style.backgroundColor="rgba(0, 255, 0, 0.1)"):(n.style.border="2px solid red",n.style.backgroundColor="rgba(255, 0, 0, 0.1)")}function df(n){let e=n.querySelector(".entity-id-label");return e||(e=document.createElement("div"),e.className="entity-id-label",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.padding="2px 4px",e.style.color="white",e.style.fontSize="10px",e.style.fontWeight="bold",e.style.fontFamily="monospace",e.style.zIndex="1001",n.appendChild(e)),e}function hf(n){let e=n.querySelector(".score-label");return e||(e=document.createElement("div"),e.className="score-label",e.style.position="absolute",e.style.bottom="0",e.style.right="0",e.style.padding="2px 4px",e.style.color="white",e.style.fontSize="12px",e.style.fontWeight="bold",e.style.fontFamily="monospace",e.style.zIndex="1001",n.appendChild(e)),e}function pf(n,e,t,r,o){r?n.style.backgroundColor="green":n.style.backgroundColor="red",n.textContent=t,o!==void 0?(e.style.backgroundColor=r?"green":"red",e.textContent=o.toFixed(3)):(e.style.backgroundColor=r?"green":"red",e.textContent="")}function vd(n,e){for(let[t,r]of n)e.has(t)||(r.remove(),n.delete(t))}function xd(n,e,t,r,o,i){let s=t.get(n);s||(s=lf(n,r),t.set(n,s)),cf(s,e.clippedScreenBBox??e.screenBBox),uf(s,o);let a=df(s),l=hf(s);return pf(a,l,n,o,i),s}function Sd(){let n=document.createElement("div");return Object.assign(n.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",overflow:"hidden",zIndex:of}),document.body.append(n),n}function Md(n,e){let t=document.createElement("div");t.style.position="absolute",t.style.top=n.minY+"px",t.style.left=n.minX+"px",t.style.width=n.maxX-n.minX+"px",t.style.height=n.maxY-n.minY+"px",t.style.border="2px solid gray",t.style.backgroundColor="rgba(128, 128, 128, 0.1)",t.style.pointerEvents="none",t.style.zIndex=af,e.append(t);let r=document.createElement("div");r.textContent="viewfinder",r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.padding="2px 4px",r.style.backgroundColor="gray",r.style.color="white",r.style.fontSize="12px",r.style.fontWeight="bold",r.style.fontFamily="monospace",r.style.zIndex="1001",t.appendChild(r);let o=document.createElement("div");return o.textContent="",o.style.position="absolute",o.style.bottom="0",o.style.right="0",o.style.padding="2px 4px",o.style.backgroundColor="gray",o.style.color="white",o.style.fontSize="12px",o.style.fontWeight="bold",o.style.fontFamily="monospace",o.style.zIndex="1001",t.appendChild(o),{squareEl:t,labelEl:r,scoreLabelEl:o}}function Cd(n,e){n.textContent=e}function Ed(n,e){e!==void 0?n.textContent=`Score: ${e.toFixed(3)}`:n.textContent=""}f();function wd(n,e,t){if(!n.visible)return;let r=n;if(r.isMesh||r.isLine||r.isPoints){let o=r.geometry;if(o?.isBufferGeometry){let i=o.attributes.position;if(i)for(let s=0;s<i.count;s++)t.fromBufferAttribute(i,s),t.applyMatrix4(n.matrixWorld),e.push(t.clone())}}for(let o of n.children)wd(o,e,t)}function Td(n,e){let t=[];return n instanceof Ge&&wd(n,t,e),t}var jr=.001;function Dd(n){if(n.length===0)return[];let e=[],t=n[n.length-1],r=t.w>jr;for(let o=0;o<n.length;o++){let i=n[o],s=i.w>jr;if(s){if(!r){let a=(jr-t.w)/(i.w-t.w);e.push({x:t.x+a*(i.x-t.x),y:t.y+a*(i.y-t.y),z:t.z+a*(i.z-t.z),w:jr})}e.push(i)}else if(r){let a=(jr-t.w)/(i.w-t.w);e.push({x:t.x+a*(i.x-t.x),y:t.y+a*(i.y-t.y),z:t.z+a*(i.z-t.z),w:jr})}t=i,r=s}return e}function Pd(n,e,t){if(n.length===0)return[];let r=n;return r=An(r,1,0,0),r=An(r,-1,0,e),r=An(r,0,1,0),r=An(r,0,-1,t),r}f();var xi=class{bbox;center;el=null;labelEl=null;scoreLabelEl=null;create(e,t,r,o,i){this.labelEl&&(this.labelEl.remove(),this.labelEl=null),this.scoreLabelEl&&(this.scoreLabelEl.remove(),this.scoreLabelEl=null),this.el&&(this.el.remove(),this.el=null);let s=Ur(r,e,t),a=s.left,l=s.top,c=e-s.left-s.right,u=t-s.top-s.bottom,d=new W(a+c/2,l+u/2),g=c/2*(2-2/1.2)/2,b=Math.max(a,d.x-g),M=Math.min(e-s.right,d.x+g),m=Math.max(l,d.y-g),p=Math.min(t-s.bottom,d.y+g),y=(b+M)/2,v=(m+p)/2;if(this.bbox={minX:b,maxX:M,minY:m,maxY:p},this.center=new W(y,v),o&&i){let{squareEl:x,labelEl:S,scoreLabelEl:w}=Md(this.bbox,i);this.el=x,this.labelEl=S,this.scoreLabelEl=w}}updateLabel(e){this.labelEl&&Cd(this.labelEl,e)}updateScore(e){this.scoreLabelEl&&Ed(this.scoreLabelEl,e)}destroy(){this.labelEl&&(this.labelEl.remove(),this.labelEl=null),this.scoreLabelEl&&(this.scoreLabelEl.remove(),this.scoreLabelEl=null),this.el&&(this.el.remove(),this.el=null)}};var mf=250,Si=class extends Z{cameraDirty=!0;focusablesDirty=!0;state;camera;cameraFrustum=new Or;viewProjectionMatrix=new Y;tempScreenPos=new O;debugEl=null;collisions=new Map;focusableEntities=new Map;debug=!1;debugBBoxElements=new Map;viewfinder=new xi;screenBoundsMap=new Map;screenDiagonal=1;constructor(e,t){super(),this.state=e,this.camera=t,this.resize()}resize(){this.screenDiagonal=Math.sqrt(this.state.canvasWidth*this.state.canvasWidth+this.state.canvasHeight*this.state.canvasHeight),this.createViewfinder()}createViewfinder(){this.debugEl&&this.debugEl.remove();for(let e of this.debugBBoxElements.values())e.remove();this.debugBBoxElements.clear(),this.debug&&(this.debugEl=Sd()),this.viewfinder.create(this.state.canvasWidth,this.state.canvasHeight,this.state.insetsPadding,this.debug,this.debugEl)}simplifyVertices(e){return e.length<3?e:bd(e).map(t=>e[t.index])}computeScreenSpaceBounds(e){let{vertices:t,boundingBox:r}=e;if(t==null||t.length<3||r==null||r.isEmpty()||!this.cameraFrustum.intersectsBox(r))return;let o=this.viewProjectionMatrix.elements,i=t.map(u=>({x:o[0]*u.x+o[4]*u.y+o[8]*u.z+o[12],y:o[1]*u.x+o[5]*u.y+o[9]*u.z+o[13],z:o[2]*u.x+o[6]*u.y+o[10]*u.z+o[14],w:o[3]*u.x+o[7]*u.y+o[11]*u.z+o[15]})),s=Dd(i);if(s.length<3)return;let a=1/0,l=[];for(let u of s){let d=u.x/u.w,h=u.y/u.w;l.push({x:(d+1)/2*this.state.canvasWidth,y:(-h+1)/2*this.state.canvasHeight}),u.w<a&&(a=u.w)}let c=Pd(l,this.state.canvasWidth,this.state.canvasHeight);if(!(c.length<=0))return{screenBBox:Ia(l),clippedScreenBBox:this.debug?Ia(c):void 0,closestZ:a}}updateFocusableEntities(){this.focusableEntities.clear();let e;for(let t of this.state.geometry3DsInScene){if(t==null)continue;let r;if(t.type==="group-container"||t.type==="feature-collection"?r=t.visible:r=t.components[1]?.visible??!0,!!r&&(e=t.type==="group-container"?t.components[1]:t.components[4],e!==void 0&&e.type==="focusable")){let o=String(t.type==="group-container"?t.userData.entityId:t.id);if(e.dirty===!0){let i=null;t instanceof Ge?i=t:"object3d"in t&&t.object3d instanceof Ge&&(i=t.object3d),i&&(e.boundingBox=new ce().setFromObject(i),e.vertices=this.simplifyVertices(Td(i,this.tempScreenPos)),e.dirty=!1)}this.focusableEntities.set(o,e)}}this.focusablesDirty=!1}#e=void 0;update=(e=!1,t=Date.now())=>{this.focusablesDirty&&this.updateFocusableEntities(),!e&&(Date.now()-t>mf||(this.#e&&cancelAnimationFrame(this.#e),this.#e=requestAnimationFrame(()=>{this.updateRaf()})))};updateRaf(){if(this.focusableEntities.size===0){this.publish("geometry-in-focus",[]);return}this.cameraDirty&&this.compute()}updateDebugBBoxes(e,t){if(!(!this.debug||!this.debugEl)){vd(this.debugBBoxElements,e);for(let[r,o]of e){let i=t.has(r),s=this.collisions.get(r);xd(r,o,this.debugBBoxElements,this.debugEl,i,s)}}}compute(){if(this.collisions.clear(),this.screenBoundsMap.clear(),!this.viewfinder.center)return;this.viewProjectionMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),this.cameraFrustum.setFromProjectionMatrix(this.viewProjectionMatrix);let e=[];for(let[r,o]of this.focusableEntities){let i=this.computeScreenSpaceBounds(o);if(!i)continue;this.screenBoundsMap.set(r,i);let{screenBBox:s}=i,a=yd(s,this.viewfinder.bbox);if(a>0){e.push(r);let l=(s.minX+s.maxX)/2,c=(s.minY+s.maxY)/2,u=l-this.viewfinder.center.x,d=c-this.viewfinder.center.y,g=1/(1+Math.sqrt(u*u+d*d)/this.screenDiagonal),b=1/(1+Math.abs(i.closestZ)),M=g*.5+a*.35+b*.15;this.collisions.set(r,M)}}let t=Array.from(this.collisions,([r,o])=>({entityId:r,score:o})).sort((r,o)=>o.score-r.score).map(({entityId:r})=>r);if(this.debug){let r=t[0];this.viewfinder.updateLabel(r||"viewfinder");let o=r?this.collisions.get(r):void 0;this.viewfinder.updateScore(o);let i=new Set(e);this.updateDebugBBoxes(this.screenBoundsMap,i)}this.publish("geometry-in-focus",t),this.cameraDirty=!1}showDebug(){this.debug||(this.debug=!0,this.cameraDirty=!0,this.createViewfinder())}hideDebug(){this.debug&&(this.debug=!1,this.createViewfinder())}destroy(){this.#e&&cancelAnimationFrame(this.#e),this.debugEl&&this.debugEl.remove();for(let e of this.debugBBoxElements.values())e.remove();this.debugBBoxElements.clear(),this.collisions.clear(),this.focusableEntities.clear(),this.viewfinder.destroy()}};f();f();f();f();f();function Mi(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return n.geometry.coordinates;if(n.type==="Point")return n.coordinates}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return n;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Sr(n){if(Array.isArray(n))return n;if(n.type==="Feature"){if(n.geometry!==null)return n.geometry.coordinates}else if(n.coordinates)return n.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Zr(n){return n.type==="Feature"?n.geometry:n}function vE(n,e){return n.type==="FeatureCollection"?"FeatureCollection":n.type==="GeometryCollection"?"GeometryCollection":n.type==="Feature"&&n.geometry!==null?n.geometry.type:n.type}function wt(n,e,t){if(t===void 0&&(t={}),!n)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r=Mi(n),o=Zr(e),i=o.type,s=e.bbox,a=o.coordinates;if(s&&ff(r,s)===!1)return!1;i==="Polygon"&&(a=[a]);for(var l=!1,c=0;c<a.length&&!l;c++)if(Id(r,a[c][0],t.ignoreBoundary)){for(var u=!1,d=1;d<a[c].length&&!u;)Id(r,a[c][d],!t.ignoreBoundary)&&(u=!0),d++;u||(l=!0)}return l}function Id(n,e,t){var r=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var o=0,i=e.length-1;o<e.length;i=o++){var s=e[o][0],a=e[o][1],l=e[i][0],c=e[i][1],u=n[1]*(s-l)+a*(l-n[0])+c*(n[0]-s)===0&&(s-n[0])*(l-n[0])<=0&&(a-n[1])*(c-n[1])<=0;if(u)return!t;var d=a>n[1]!=c>n[1]&&n[0]<(l-s)*(n[1]-a)/(c-a)+s;d&&(r=!r)}return r}function ff(n,e){return e[0]<=n[0]&&e[1]<=n[1]&&e[2]>=n[0]&&e[3]>=n[1]}f();f();function gf(n){if(!n)throw new Error("geojson is required");var e=[];return Lt(n,function(t){yf(t,e)}),ir(e)}function yf(n,e){var t=[],r=n.geometry;if(r!==null){switch(r.type){case"Polygon":t=Sr(r);break;case"LineString":t=[Sr(r)]}t.forEach(function(o){var i=bf(o,n.properties);i.forEach(function(s){s.id=e.length,e.push(s)})})}}function bf(n,e){var t=[];return n.reduce(function(r,o){var i=po([r,o],e);return i.bbox=vf(r,o),t.push(i),o}),t}function vf(n,e){var t=n[0],r=n[1],o=e[0],i=e[1],s=t<o?t:o,a=r<i?r:i,l=t>o?t:o,c=r>i?r:i;return[s,a,l,c]}var Oa=gf;var sh=lo(oh(),1);function bg(n,e){var t={},r=[];if(n.type==="LineString"&&(n=Ts(n)),e.type==="LineString"&&(e=Ts(e)),n.type==="Feature"&&e.type==="Feature"&&n.geometry!==null&&e.geometry!==null&&n.geometry.type==="LineString"&&e.geometry.type==="LineString"&&n.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var o=ih(n,e);return o&&r.push(o),ir(r)}var i=(0,sh.default)();return i.load(Oa(e)),Ps(Oa(n),function(s){Ps(i.search(s),function(a){var l=ih(s,a);if(l){var c=Sr(l).join(",");t[c]||(t[c]=!0,r.push(l))}})}),ir(r)}function ih(n,e){var t=Sr(n),r=Sr(e);if(t.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(r.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var o=t[0][0],i=t[0][1],s=t[1][0],a=t[1][1],l=r[0][0],c=r[0][1],u=r[1][0],d=r[1][1],h=(d-c)*(s-o)-(u-l)*(a-i),g=(u-l)*(i-c)-(d-c)*(o-l),b=(s-o)*(i-c)-(a-i)*(o-l);if(h===0)return null;var M=g/h,m=b/h;if(M>=0&&M<=1&&m>=0&&m<=1){var p=o+M*(s-o),y=i+M*(a-i);return uo([p,y])}return null}var Oi=bg;f();function Li(n,e){e===void 0&&(e={});var t=Zr(n);switch(!e.properties&&n.type==="Feature"&&(e.properties=n.properties),t.type){case"Polygon":return vg(t,e);case"MultiPolygon":return xg(t,e);default:throw new Error("invalid poly")}}function vg(n,e){e===void 0&&(e={});var t=Zr(n),r=t.coordinates,o=e.properties?e.properties:n.type==="Feature"?n.properties:{};return ah(r,o)}function xg(n,e){e===void 0&&(e={});var t=Zr(n),r=t.coordinates,o=e.properties?e.properties:n.type==="Feature"?n.properties:{},i=[];return r.forEach(function(s){i.push(ah(s,o))}),ir(i)}function ah(n,e){return n.length>1?Nl(n,e):po(n[0],e)}function Sg(n,e){var t=!0;return Lt(n,function(r){Lt(e,function(o){if(t===!1)return!1;t=Mg(r.geometry,o.geometry)})}),t}function Mg(n,e){switch(n.type){case"Point":switch(e.type){case"Point":return!Tg(n.coordinates,e.coordinates);case"LineString":return!lh(e,n);case"Polygon":return!wt(n,e)}break;case"LineString":switch(e.type){case"Point":return!lh(n,e);case"LineString":return!Cg(n,e);case"Polygon":return!ch(e,n)}break;case"Polygon":switch(e.type){case"Point":return!wt(e,n);case"LineString":return!ch(n,e);case"Polygon":return!Eg(e,n)}}return!1}function lh(n,e){for(var t=0;t<n.coordinates.length-1;t++)if(wg(n.coordinates[t],n.coordinates[t+1],e.coordinates))return!0;return!1}function Cg(n,e){var t=Oi(n,e);return t.features.length>0}function ch(n,e){for(var t=0,r=e.coordinates;t<r.length;t++){var o=r[t];if(wt(o,n))return!0}var i=Oi(e,Li(n));return i.features.length>0}function Eg(n,e){for(var t=0,r=n.coordinates[0];t<r.length;t++){var o=r[t];if(wt(o,e))return!0}for(var i=0,s=e.coordinates[0];i<s.length;i++){var a=s[i];if(wt(a,n))return!0}var l=Oi(Li(n),Li(e));return l.features.length>0}function wg(n,e,t){var r=t[0]-n[0],o=t[1]-n[1],i=e[0]-n[0],s=e[1]-n[1],a=r*s-o*i;return a!==0?!1:Math.abs(i)>=Math.abs(s)?i>0?n[0]<=t[0]&&t[0]<=e[0]:e[0]<=t[0]&&t[0]<=n[0]:s>0?n[1]<=t[1]&&t[1]<=e[1]:e[1]<=t[1]&&t[1]<=n[1]}function Tg(n,e){return n[0]===e[0]&&n[1]===e[1]}var uh=Sg;function Xa(n,e){var t=!1;return Lt(n,function(r){Lt(e,function(o){if(t===!0)return!0;t=!uh(r.geometry,o.geometry)})}),t}var Dg=5e3,Ya="outdoor-system-debug-container",dh=!1,Ai=class extends Z{#e=!0;#n;idleQueue=new vr;#i="";#o=new Set;#s=[];#l;#a=null;#h=!0;#y=e=>{if(!this.#n)throw new Error("Map not initialized");let r=[[e[0],e[1]],[e[2],e[1]],[e[2],e[3]],[e[0],e[3]]].map(l=>this.#n.project(l)),o=Math.max(...r.map(l=>l.x)),i=Math.min(...r.map(l=>l.x)),s=Math.max(...r.map(l=>l.y)),a=Math.min(...r.map(l=>l.y));return[new Bs(i,a),new Bs(o,s)]};#t=(e,t)=>{if(!this.#n)return;let r=this.#n.on(e,t);r?.unsubscribe&&this.onAbort(()=>r.unsubscribe())};#d=()=>{this.#a&&(clearTimeout(this.#a),this.#a=null,this.#e=!1)};#r=()=>{this.#a&&(clearTimeout(this.#a),this.#a=null),this.#a=setTimeout(()=>{this.#d()},Dg)};#b=()=>{this.#x.clear(),this.#g=[]};hideLayersIntersectingPolygons(e,t){this.#b(),this.#a&&clearTimeout(this.#a),this.#r(),this.#l=e.reduce((r,o)=>{if(o.geometry.type==="Polygon"){let i=ho(o.geometry.coordinates);r.push(i)}else o.geometry.type==="MultiPolygon"&&r.push(...o.geometry.coordinates.map(i=>ho(i)));return r},[]);for(let r of t)this.#o.add(r);this.#e=!0,this.#m(),this.#c()}constructor(e){super(),e&&(this.#n=e,this.#t("styledata",this.#f),this.#t("render",this.#c),this.#t("load",()=>{this.#h=!0})),dh&&this.#S()}#m(){let e=new Set;if(this.#n)for(let t of this.#o)this.#n.getLayer(t)&&e.add(t);this.#s=Array.from(e)}#c=async()=>{if(dh&&this.#l&&this.#E(),!(!this.#n||!this.#h)&&this.#e&&!(!this.#s||this.#s.length===0)&&(this.#C&&this.#p(),this.#l)){this.idleQueue.onComplete(()=>{this.#g.length>0&&(this.#s.forEach(e=>{this.#n?.setFilter(e,["all",...this.#g])}),this.#e=!1),this.#g=[]});for(let e of this.#l){let t=Is(e),r=this.#y(t),o=this.#n.queryRenderedFeatures(r,{layers:this.#s});for(let i of o){let s=i.id;s==null||this.#x.has(s)||this.idleQueue.add(()=>{if(this.#x.add(s),i.geometry!=null&&"coordinates"in i.geometry){let a;if(i.geometry.type==="Polygon"?a=ho(i.geometry.coordinates):i.geometry.type==="MultiPolygon"&&(a=Bl(i.geometry.coordinates)),!a)return;Xa(e,a)&&this.#g.push(["!=",["id"],s])}})}}}};#g=[];#x=new Set;get#C(){return this.idleQueue.size!==0}#p=()=>{this.idleQueue.clearAll()};#f=e=>{if(this.#n&&e&&e.dataType==="style"&&e.type==="styledata"&&this.#o.size>0){let t=e?.style?.stylesheet?.id;(!t||t!==this.#i)&&(this.#b(),this.#i=t,this.#m(),this.#e=!0)}};#S(){if(!document.getElementById(Ya)&&this.#n){let e=document.createElement("div");e.id=Ya,e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.bottom="0",e.style.right="0",e.style.pointerEvents="none",e.style.zIndex="1000",this.#n.getContainer().appendChild(e)}}#E(){let e=document.getElementById(Ya);if(!e||!this.#l||!this.#n)return;let t=e.querySelectorAll('[id^="polygon-box-"]');for(let r=0;r<t.length;r++)t[r].remove();for(let r=0;r<this.#l.length;r++){let o=this.#l[r],i=Is(o),s=this.#y(i),a=document.createElement("div");a.id=`polygon-box-${r}`,a.style.position="absolute",e.appendChild(a);let l=[Math.min(s[0].x,s[1].x),Math.min(s[0].y,s[1].y)],c=[Math.max(s[0].x,s[1].x),Math.max(s[0].y,s[1].y)];a.style.top=l[1]+"px",a.style.left=l[0]+"px",a.style.width=c[0]-l[0]+"px",a.style.height=c[1]-l[1]+"px",a.style.border=`2px solid ${this.#e?"red":"blue"}`}}destroy(){this.idleQueue.clearAll(),super.destroy()}};f();f();f();f();var Ri=class extends Ft{tangentData;parameters;constructor(e,t={}){super(),Object.defineProperty(this,"type",{value:"RibbonGeometry"}),this.parameters={path:e};let r=t.segments??64,o=new O,i=new O,s=new O(0,0,1),a=(r+1)*2,l=new Float32Array(a*3),c=new Float32Array(a*3),u=new Float32Array(a*2),d=new Float32Array(a),h=[];this.tangentData=new Float32Array((r+1)*3);let g=0,b=0,M=0;for(let m=0;m<=r;m++){let p=m/r;e.getPointAt(p,o),e.getTangentAt(p,i);let y=m*3;this.tangentData[y]=i.x,this.tangentData[y+1]=i.y,this.tangentData[y+2]=i.z,l[g++]=o.x,l[g++]=o.y,l[g++]=o.z,l[g++]=o.x,l[g++]=o.y,l[g++]=o.z,d[M++]=-1,d[M++]=1,u[b++]=0,u[b++]=p,u[b++]=1,u[b++]=p;let v=m*2*3;c[v]=s.x,c[v+1]=s.y,c[v+2]=s.z,c[v+3]=s.x,c[v+4]=s.y,c[v+5]=s.z}for(let m=0;m<r;m++){let p=m*2;h.push(p,p+2,p+1),h.push(p+1,p+2,p+3)}this.setIndex(h),this.setAttribute("position",new dr(l,3)),this.setAttribute("normal",new dr(c,3)),this.setAttribute("uv",new dr(u,2)),this.setAttribute("side",new dr(d,1))}};f();var _i=class extends oc{innerCurve;tStart;tEnd;constructor(e,t,r=!1){super(),this.innerCurve=e,r&&t>=4?(this.tStart=1/(t-1),this.tEnd=(t-2)/(t-1)):(this.tStart=0,this.tEnd=1)}get points(){return this.innerCurve.points}get tension(){return this.innerCurve.tension}get isTrimmed(){return this.tStart!==0||this.tEnd!==1}getPoint(e,t=new O){let r=this.tStart+e*(this.tEnd-this.tStart);return this.innerCurve.getPoint(r,t)}};f();var Fi=`// Force the compiler to compute gl_Position the same way across all shader
|
|
155
|
+
`;var Dn=class extends Lr{effectUniforms={effectStart:{value:0},effectDistance:{value:0},darkenAmount:{value:0},darkenUseDepth:{value:1},desaturateAmount:{value:0},desaturateUseDepth:{value:1},washOutAmount:{value:0},washOutUseDepth:{value:0}};constructor(e){super(e),this.onBeforeCompile=t=>{t.vertexShader=Qu,t.fragmentShader=ed;let r=this.effectUniforms.effectStart,o=this.effectUniforms.effectDistance,i=this.effectUniforms.darkenAmount,s=this.effectUniforms.darkenUseDepth,a=this.effectUniforms.desaturateAmount,l=this.effectUniforms.desaturateUseDepth,c=this.effectUniforms.washOutAmount,u=this.effectUniforms.washOutUseDepth;this.effectUniforms=t.uniforms,Object.assign(this.effectUniforms,{effectStart:r,effectDistance:o,darkenAmount:i,darkenUseDepth:s,desaturateAmount:a,desaturateUseDepth:l,washOutAmount:c,washOutUseDepth:u})}}setEffectRange(e,t){this.effectUniforms.effectStart.value=e,this.effectUniforms.effectDistance.value=t}getEffectRange(){return{start:this.effectUniforms.effectStart.value,distance:this.effectUniforms.effectDistance.value}}setVisualEffect(e,t,r,o,i,s){this.effectUniforms.darkenAmount.value=e,this.effectUniforms.darkenUseDepth.value=t?1:0,this.effectUniforms.desaturateAmount.value=r,this.effectUniforms.desaturateUseDepth.value=o?1:0,this.effectUniforms.washOutAmount.value=i,this.effectUniforms.washOutUseDepth.value=s?1:0}getVisualEffect(){return{darkenAmount:this.effectUniforms.darkenAmount.value,darkenUseDepth:this.effectUniforms.darkenUseDepth.value,desaturateAmount:this.effectUniforms.desaturateAmount.value,desaturateUseDepth:this.effectUniforms.desaturateUseDepth.value,washOutAmount:this.effectUniforms.washOutAmount.value,washOutUseDepth:this.effectUniforms.washOutUseDepth.value}}};f();var vr=class{#e=[];#n=!1;#i;#o;get size(){return this.#e.length}add(e){this.#e.push(e),this.#n||this.#s()}onComplete(e){this.#i=e}clearOnComplete(){this.#i=void 0}#s(){this.#n=!0,this.#o=requestIdleCallback(e=>{let t=0;for(;this.#e.length>0&&e.timeRemaining()>2;){let r=this.#e.shift();r&&(r(),t++)}if(t===0&&this.#e.length>0&&e.timeRemaining()<2){let r=this.#e.shift();r&&r()}this.#o=void 0,this.#e.length>0?this.#s():(this.#n=!1,this.#i&&this.#i())},{timeout:3e3})}clearAll(){this.#e=[],this.#n=!1,this.#i=void 0,this.#o!==void 0&&(cancelIdleCallback(this.#o),this.#o=void 0)}};var Rm=80,mi=class extends Z{rendererState;maxOpacity;outlineOpacitiesDirty=!0;useIdleFramesOnly=!0;#e=!0;get geometries3DDirty(){return this.#e}set geometries3DDirty(e){this.#e=e}#n=-1/0;idleBuildQueue=new vr;idleComputeBoundingSphereQueue=new vr;constructor(e,t){super(),this.rendererState=e,this.maxOpacity=t?.maxOpacity??1,this.idleBuildQueue.onComplete(this.#o)}#i=new Map;buildOutlines(e){let t=[];for(let d of e.userData.entities3D.values()){let h=this.rendererState.geometry3DMap.get(d);if(h instanceof $&&h.type==="geometry"&&h.components[3]&&h.components[3].dirty===!0&&h.components[0].material!=null){let g=h.components[0].geometry,b=!1;g||(g=bn(h.components[0]),b=!0);let M=h.components[1];t.push([h.components[3],new So(g,M.bevel?.enabled?1:Rm)]),b&&(g?.dispose(),g=void 0)}}if(t.length===0)return;let r=ze(t.map(d=>d[1]),!1);if(r==null)return;let o=r.getAttribute("position"),i=new Float32Array(o.count*4),s=new ke(i,4);r.setAttribute("color",s);let a=new Uint8Array(o.count);a.fill(0);let l=new ke(a,1,!1);r.setAttribute("visibility",l);let c=0;for(let d=0;d<t.length;d++){let[h,g]=t[d],b=g.getAttribute("position").count;h.edgeColors=s,h.edgeVisibility=l,h.geometry=r,h.ranges={count:b,start:c},c+=b,g.dispose()}let u=new Bt(r,new Dn({vertexColors:!0,linewidth:1,transparent:!0,opacity:1,side:yo}));u.userData.isOutline=!0,e.add(u)}update(e,t=!0){if(this.geometries3DDirty){for(let o of this.rendererState.geometry3DsInScene)o.type==="feature-collection"&&Tn(o,this.rendererState)&&!wn(o)&&o.userData.entities3D.size>0&&(this.useIdleFramesOnly?this.idleBuildQueue.add(()=>this.buildOutlines(o)):this.buildOutlines(o));this.#e=!1,this.outlineOpacitiesDirty=!0}for(let o of this.rendererState.geometry3DsInScene)if(o.type==="geometry"&&o.components[3]&&o.components[3].dirty===!0&&o.components[0].material!=null&&o.parentObject3D instanceof Ce){let i=o.components[3].geometry;if(!i)continue;let s=o.components[3];if(!s)continue;let a=s.enabled&&o.components[1].visible;if(s.visible!==a&&(s.visible=a),!s.visible)continue;let l=s.edgeColors;if(!l||!s.ranges)continue;let c=new k(s.color);for(let g=0;g<s.ranges.count;g++){let b=s.ranges.start+g;l.setXYZ(b,c.r,c.g,c.b)}let u=o.components[1].height,d=o.components[1].altitude,h=o.components[1]?.bevel;Ku(i,s.ranges,u,d,h),i.attributes.color.needsUpdate=!0,this.idleComputeBoundingSphereQueue.add(()=>i.computeBoundingSphere()),s.dirty=!1}else if(o.type==="feature-collection"&&wn(o)){let i=Ju(o);if(!i)continue;let s=i.material;if(!(s instanceof Dn))continue;let a;for(let u of o.userData.entities3D.values()){a=u;break}if(a==null)continue;let l=this.rendererState.geometry3DMap.get(a);if(!l||l.type!=="geometry")continue;let c=l.components[1];s.setEffectRange(c.effectStart,c.effectDistance),s.setVisualEffect(c.darkenAmount,c.darkenUseDepth,c.desaturateAmount,c.desaturateUseDepth,c.washOutAmount,c.washOutUseDepth)}let r=t?Os(e,16,19,0,this.maxOpacity):this.#n;if((r!==this.#n||this.outlineOpacitiesDirty)&&this.rendererState.geometry3DsInScene.size>0){for(let o of this.rendererState.geometry3DsInScene)if(o.type==="geometry"&&o.components[0]instanceof oe){let i=o.components[3];if(i&&i.edgeColors&&i.geometry&&i.visible){let s=Math.min(r,o.components[1].opacity*Gr(o));if(i.currentOpacity!==s){for(let a=0;a<i.ranges.count;a++){let l=i.ranges.start+a;i.edgeColors.setW(l,s)}i.geometry.attributes.color.needsUpdate=!0}}}}this.#n=r,this.#e=!1,this.outlineOpacitiesDirty=!1}#o=()=>{this.publish("needs-render")};destroy(){this.#i.clear(),this.idleBuildQueue.clearAll(),this.idleComputeBoundingSphereQueue.clearAll()}};f();f();import{z as Re}from"zod";var fi=class extends W{userData={entityId:"",cacheKey:"",isResizable:!1}},_m=Re.object({flipImageToFaceCamera:Re.boolean().optional(),url:Re.string(),maxImageSize:Re.number().positive().optional(),interactive:Re.boolean().optional()}),Fm=Re.object({type:Re.enum(["Feature"]),properties:Re.object({width:Re.number(),height:Re.number(),rotation:Re.number().min(0).max(360).optional(),verticalOffset:Re.number().optional()}),geometry:zr});function td(n,e,t){Re.union([Re.number(),Re.string()]).parse(n),Fm.parse(e),_m.parse(t)}var Pn=class{mesh=new He;imageMesh;outline;type="image";instanceIndex=-1;geometry;material;feature;constructor(e){this.feature=e}get visible(){return this.mesh?.visible??!1}set visible(e){this.mesh&&(this.mesh.visible=e)}position=new O};f();function Ca(n,e){return{x:n.x*Math.cos(e)-n.y*Math.sin(e),y:n.x*Math.sin(e)+n.y*Math.cos(e)}}function Nm(n,e){return n.map(t=>Ca(t,e))}function Bm(n){let e=1/0,t=1/0,r=-1/0,o=-1/0;for(let i of n)e=Math.min(e,i.x),t=Math.min(t,i.y),r=Math.max(r,i.x),o=Math.max(o,i.y);return{minX:e,minY:t,maxX:r,maxY:o}}function Gm(n,e){let t=!1;for(let r=0,o=e.length-1;r<e.length;o=r++){let i=e[r].x,s=e[r].y,a=e[o].x,l=e[o].y;s>n.y!=l>n.y&&n.x<(a-i)*(n.y-s)/(l-s)+i&&(t=!t)}return t}function rd(n,e,t,r,o){for(let i=0;i<o;i++)for(let s=0;s<r;s++)if(n[t+i][e+s]!==1)return!1;return!0}function km(n,e,t){let r=n.maxX-n.minX,o=n.maxY-n.minY,i,s,a={...n};return r/o>e?(s=o/t,i=s*e,a.minX+=(r-i*t)/2):(i=r/t,s=i/e,a.minY+=(o-s*t)/2),{dx:i,dy:s,gridBounds:a}}function zm(n,e,t,r,o){let i=Array(t).fill(0).map(()=>Array(t).fill(0));for(let s=0;s<t;s++)for(let a=0;a<t;a++){let l={x:e.minX+a*r,y:e.minY+s*o};Gm(l,n)&&(i[s][a]=1)}return i}function Um(n,e){let t=Array(e).fill(0).map(()=>Array(e).fill(0));for(let r=0;r<e;r++)for(let o=0;o<e;o++)if(n[r][o]===1){let i=0;for(let s=1;s<=Math.min(e-o,e-r)&&rd(n,o,r,s,s);s++)i=s;t[r][o]=i}return t}function Hm(n,e,t,r,o,i){let s=0,a=0,l=0;for(let c=0;c<r;c++)for(let u=0;u<r;u++)if(n[c][u]===1){let d=Math.pow(e[c][u],2),h=t.minX+u*o,g=t.minY+c*i;s+=d,a+=h*d,l+=g*d}return{x:a/s,y:l/s}}function Vm(n,e,t,r,o,i,s){let a=-1/0,l=null,c=n.length,u=Math.sqrt(Math.pow(e.maxX-e.minX,2)+Math.pow(e.maxY-e.minY,2));for(let d=0;d<c;d++)for(let h=0;h<c;h++)if(n[d][h]===1)for(let g=1;g<=c-h;g++){let b=g;if(!(b>c-d)&&rd(n,h,d,g,b)){let M=g*b,m=e.minX+(h+g/2)*t,p=e.minY+(d+b/2)*r,y={x:m,y:p},x=Math.sqrt(Math.pow(y.x-o.x,2)+Math.pow(y.y-o.y,2))/u,S=M*(1-i)-x*i*M;S>a&&(a=S,l={center:y,width:g*t*s,height:g*r*s})}}return l}function Ea(n,e,t,r={}){let{scaleFactor:o=.9,centerPriority:i=.5,resolution:s=100,minimumSizeRatio:a=.5}=r,l=Et(t),c=n.width/n.height,u=Nm(e,l),d=Bm(u),{dx:h,dy:g,gridBounds:b}=km(d,c,s),M=zm(u,b,s,h,g),m=Um(M,s),p=Hm(M,m,b,s,h,g),y=Vm(M,b,h,g,p,i,o);return!y||y.width<n.width*a||y.height<n.height*a?n:{...y,center:Ca(y.center,-l),rotation:t,polygonCenter:Ca(p,-l)}}f();var re={HIGH:1,MEDIUM:.5,LOW:.25,VERY_LOW:.125},se={[re.HIGH]:2048,[re.MEDIUM]:1024,[re.LOW]:512,[re.VERY_LOW]:256},nd={[se[re.HIGH]]:65280,[se[re.MEDIUM]]:16776960,[se[re.LOW]]:16753920,[se[re.VERY_LOW]]:16711680},gi={HIGH:50,MEDIUM:100,LOW:250},od="https://resize-worker.mappedin.com",id=["cdn.mappedin.com","cdn.eu.mappedin.com"],wa=["resize-worker.mappedin.com","resize-worker-staging.mappedin.net"],Ta=.01,In=1024,On=256,sd=512,ad=2048,ld=3,cd=37,ud=16*1024*1024;f();function Da(n){try{let t=new URL(n).hostname;return id.includes(t)||wa.includes(t)}catch{return!1}}function Wm(n){try{let e=new URL(n);return wa.includes(e.hostname)}catch{return!1}}function Pa(n,e){return Wm(n)?n.replace(/\/resize:fit:\d+:\d+:(\d+)\//,`/resize:fit:${e}:${e}:$1/`):`${od}/resize:fit:${e}:${e}:0/plain/${n}`}function dd(n){return n<=gi.HIGH?se[re.HIGH]:n<=gi.MEDIUM?se[re.MEDIUM]:n<=gi.LOW?se[re.LOW]:se[re.VERY_LOW]}function hd(n){let e=n*cd;return e<=se[re.LOW]?se[re.LOW]:e<=se[re.MEDIUM]?se[re.MEDIUM]:se[re.HIGH]}function pd(n,e){return Da(n)?n:`${n}|${e??In}`}function yi(n,e){n.color=new k(16777215),n.emissive=new k(nd[e]),n.emissiveIntensity=.5}function bi(n){n.color=new k(16777215),n.emissive=new k(0),n.emissiveIntensity=0}f();function fd(n){let{transformImageRequest:e,getMaxTextureSize:t,publish:r}=n,o=new Map,i=new Set,s=0,a=!1,l={transformImageRequest:e,isDisposed:()=>a};function c(){if(s>0)return s;let m=t(),p=yc().isMobile?sd:se[re.HIGH];return s=Math.min(p,m),s}function u(m){return Math.min(m,c())}function d(m,p){return Math.min(u(dd(p)),hd(m.maxLongEdge))}function h(m,p,y){if(m.base||m.basePending)return;m.basePending=!0;let v=m.isResizable?Pa(p,y):p;md(v,S=>{let w=m.isResizable?S:Ym(S,y);return w.colorSpace=lr,m.base=w,m.basePending=!1,w},()=>{m.basePending=!1},l).then(()=>{a||r()}).catch(()=>{})}function g(m,p,y){m.hiLod!=null&&y<=m.hiLod||m.readyLod!=null&&y<=m.readyLod||(m.ready=p,m.readyLod=y,i.add(m))}function b(m){m.ready=null,m.readyLod=null,i.delete(m)}function M(m,p,y){if(!m.isResizable||m.hiLod!=null&&y<=m.hiLod||m.readyLod!=null&&y<=m.readyLod||m.pendingFetchLOD!=null&&y<=m.pendingFetchLOD)return;m.pendingFetchLOD=y;let v=()=>{m.pendingFetchLOD===y&&(m.pendingFetchLOD=null)},x=Pa(p,y);md(x,w=>(w.colorSpace=lr,g(m,w,y),v(),w),()=>{v()},l).then(()=>{a||r()}).catch(()=>{})}return{register(m,p,y,v,x,S){if(a)return;let w=o.get(m);if(w?(S>w.maxLongEdge&&(w.maxLongEdge=S),x<w.distance&&(w.distance=x)):(w={base:null,hi:null,hiLod:null,ready:null,readyLod:null,basePending:!1,pendingFetchLOD:null,isResizable:v,distance:x,maxLongEdge:S},o.set(m,w)),h(w,p,v?On:y),v){let C=d(w,x);C>On&&M(w,p,C)}},get(m){if(a)return null;let p=o.get(m);return p?p.hi??p.base:null},requestUpgrade(m,p){if(a)return;let y=o.get(m);!y||!y.isResizable||(p<y.distance&&(y.distance=p),M(y,m,d(y,p)))},drainPromotions(){if(a||i.size===0)return;let m=0,p=0,y=Math.min(ld,i.size);for(;m<y;){let v,x=1/0;for(let D of i)D.distance<x&&(x=D.distance,v=D);if(v==null)break;let S=Zm(v.ready);if(p>0&&p+S>ud)break;let w=v.hi;v.hi=v.ready,v.hiLod=v.readyLod,b(v),w?.dispose(),p+=S,m++}i.size>0&&r()},effectiveLOD(m){return o.get(m)?.hiLod??On},residentResolutionBucket(m){let p=o.get(m),y=p?.hi??p?.base;return Xm(jm(y))},dispose(){a=!0;for(let m of o.values())m.base?.dispose(),m.hi?.dispose(),m.ready?.dispose();o.clear(),i.clear()}}}function md(n,e,t,r){let o=i=>new Promise((s,a)=>{if(r.isDisposed()){a(new Error("LOD control disposed"));return}Wt.getLoader().load(i,l=>{if(r.isDisposed()){l.dispose(),a(new Error("LOD control disposed"));return}try{s(e(l))}catch(c){_.error("Failed to process image texture",{url:i,error:c}),t(c),a(c)}},void 0,l=>{if(r.isDisposed()){a(new Error("LOD control disposed"));return}_.error("Failed to load image",{url:i,error:l}),t(l),a(l)})});return r.transformImageRequest?r.transformImageRequest(n).then(i=>o(i.url),i=>(r.isDisposed()||(_.error("Failed to transform image request",{url:n,error:i}),t(i)),Promise.reject(i))):o(n)}var xr={w:0,h:0};function gd(n){let e=n?.image;return e?e instanceof HTMLImageElement?(xr.w=e.naturalWidth||0,xr.h=e.naturalHeight||0):(xr.w=e.width||0,xr.h=e.height||0):(xr.w=0,xr.h=0),xr}function jm(n){let{w:e,h:t}=gd(n);return Math.max(e,t)}function Zm(n){let{w:e,h:t}=gd(n);return e*t*4}function Xm(n){return n>=se[re.HIGH]?se[re.HIGH]:n>=se[re.MEDIUM]?se[re.MEDIUM]:n>=se[re.LOW]?se[re.LOW]:On}function Ym(n,e){let t=n.image,r=t instanceof HTMLImageElement?t.naturalWidth:t.width,o=t instanceof HTMLImageElement?t.naturalHeight:t.height,i=Math.max(r,o);if(i<=e)return n.colorSpace=lr,n;n.dispose();let s=e/i,a=Math.max(1,Math.floor(r*s)),l=Math.max(1,Math.floor(o*s)),c;typeof window<"u"&&window.OffscreenCanvas!=null&&!bc()?c=new OffscreenCanvas(a,l):(c=document.createElement("canvas"),c.width=a,c.height=l);let u=c.getContext("2d");if(!u)throw new Error("Failed to get 2D context for texture capping");u.drawImage(t,0,0,a,l);let d=new rc(c);return d.colorSpace=lr,d.needsUpdate=!0,d}var Ln=Math.PI*2,$m=Math.PI/2,qm=Math.PI*1.5,Jm=ri($m,2),Km=ri(qm,2),vi=class extends Z{rendererState;convertTo3DMapPosition;projectToScreen;initialBearing=0;naturalBearing=0;imagePlacementOptions;cameraFrustum=new Or;cameraWorldPosition=new O;debug={lod:!1,imageContainers:!1};get debugLOD(){return this.debug.lod}set debugLOD(e){let t=this.debug.lod!==e;this.debug.lod=e,t&&(e?this.applyDebugLODColors():this.resetDebugLODColors())}lod;constructor(e,t,r,o=0,i=0,s={},a){super(),this.rendererState=e,this.convertTo3DMapPosition=t,this.projectToScreen=r,this.initialBearing=o,this.naturalBearing=i,this.imagePlacementOptions=s,this.lod=fd({transformImageRequest:a,getMaxTextureSize:()=>this.rendererState.renderer?.capabilities?.maxTextureSize??ad,publish:()=>this.publish("image-loaded")})}createImageMesh(e,t,r,o=0,i,s,a=In){let l={width:r.width,height:r.height,center:this.convertTo3DMapPosition(i),rotation:r.rotation??0},c=this.imagePlacementOptions.mode??"default",u=(()=>{switch(c){case"fit-nearest-90":let x=(this.initialBearing-this.naturalBearing+360)%180;return x>=45&&x<=135?Ea(l,s,l.rotation+90,this.imagePlacementOptions):l;case"fit-initial-bearing":return Ea(l,s,this.initialBearing,this.imagePlacementOptions);case"default":case"none":default:return l}})();if(this.debug.imageContainers&&u.polygonCenter){let x=new W(new Fr(1),new Gt({color:65280}));x.position.set(u.polygonCenter.x,u.polygonCenter.y,o),this.rendererState.geometryScene.add(x)}let d=new Gt({transparent:!0,depthWrite:!1,side:Rt}),h=new Ie(u.width,u.height),g=new fi(h);g.visible=!1,g.renderOrder=ue.IMAGE_MESH;let b=Da(t),M=o+Ta,m=this.rendererState.cameraObject.position.z,p=Math.abs(m-M),y=pd(t,a),v=Math.max(u.width,u.height);if(this.lod.register(y,t,a??In,b,p,v),g.userData.entityId=e,g.userData.cacheKey=y,g.userData.isResizable=b,g.material=d,this.debug.imageContainers){let x=new W(new Ie(r.width,r.height),new Gt({color:"gray"}));g.add(x);let S=new dc;g.add(S),S.scale.set(10,10,10)}return g.position.set(u.center.x,u.center.y,o+Ta),g.rotation.z=(-U.degToRad(u.rotation)+Ln)%Ln,g}applyDebugLODColors(){this.rendererState.cameraObject.getWorldPosition(this.cameraWorldPosition);for(let e of this.rendererState.geometry3DsInScene)if(e.type==="image"){let t=e.components[0];if(t?.imageMesh?.material instanceof Gt){let{cacheKey:r,isResizable:o}=t.imageMesh.userData;o===!0?yi(t.imageMesh.material,this.lod.residentResolutionBucket(r)):bi(t.imageMesh.material)}}else if(e.type==="geometry"){let t=e.components[0];if(Array.isArray(t?.feature))continue;if(t?.imageMesh?.material instanceof Gt){let{cacheKey:r,isResizable:o}=t.imageMesh.userData;o===!0?yi(t.imageMesh.material,this.lod.residentResolutionBucket(r)):bi(t.imageMesh.material)}}}resetDebugLODColors(){for(let e of this.rendererState.geometry3DsInScene){let t;e.type==="image"?t=e.components[0]:e.type==="geometry"&&(t=e.components[0]),t?.imageMesh?.material instanceof Gt&&bi(t.imageMesh.material)}}flipIfNeeded(e,t){if(e.imageMesh==null)return;let r=-t,o=e.imageMesh.rotation.z,i=ri((o-r+Ln)%Ln,2);if(i>Jm&&i<Km){let s=e.imageMesh.matrixWorldAutoUpdate===!1;s&&Lo(e.imageMesh),e.imageMesh.rotation.z=(o+Math.PI)%Ln,e.imageMesh.updateMatrixWorld(),s&&Ic(e.imageMesh)}}currentImageScreenBBoxes=[];viewProjectionMatrix=new Y;lastLODUpdateTime=-1;reconcileMaterialTexture(e,t,r){let o=this.lod.get(t);return e.map!==o&&(e.map=o,e.needsUpdate=!0,this.debug.lod&&r&&yi(e,this.lod.residentResolutionBucket(t))),o!=null}update(e,t,r){this.currentImageScreenBBoxes=[],this.viewProjectionMatrix.identity().multiply(this.rendererState.cameraObject.projectionMatrix).multiply(this.rendererState.cameraObject.matrixWorldInverse),this.cameraFrustum.setFromProjectionMatrix(this.viewProjectionMatrix),this.rendererState.cameraObject.getWorldPosition(this.cameraWorldPosition);let o=!t&&r!==this.lastLODUpdateTime;o&&(this.lastLODUpdateTime=r),this.lod.drainPromotions();let i,s;for(let a of this.rendererState.geometry3DsInScene)if(a.type==="image"){if(i=a.components[0],s=a.components[1],s.url&&i.imageMesh==null){let l=this.convertTo3DMapPosition(i.feature.geometry.coordinates),c={x:l.x,y:l.y};i.imageMesh=this.createImageMesh(a.id,s.url,i.feature.properties,i.feature.properties.verticalOffset,i.feature.geometry.coordinates,[c],s.maxImageSize),i.mesh.add(i.imageMesh),i.position.copy(i.imageMesh.position)}if(i.imageMesh){let{cacheKey:l,isResizable:c}=i.imageMesh.userData;if(o&&s.url){let u=Math.abs(this.cameraWorldPosition.z-i.position.z);this.lod.requestUpgrade(l,u)}if(s.url){let u=i.imageMesh.material;this.reconcileMaterialTexture(u,l,c)&&!i.imageMesh.visible&&(i.imageMesh.visible=!0)}s.flipImageToFaceCamera&&this.flipIfNeeded(i,e),i.imageMesh.material instanceof Gt&&s.dirty&&i.imageMesh.material.opacity!==s.opacity&&(i.imageMesh.material.opacity=s.opacity)}}else if(a?.type==="geometry"){if(i=a.components[0],s=a.components[1],Array.isArray(i.feature))continue;if(s.showImage&&i.feature.properties?.image&&i.imageMesh==null&&i.visible&&i.mesh!=null&&i.mesh.parent!=null&&i.feature.properties?.image.position!=null&&i.feature.geometry.coordinates!=null&&i.feature.geometry.coordinates.length>0){let l=i.feature.geometry.coordinates[0].map(u=>{let d=this.convertTo3DMapPosition(u);return{x:d.x,y:d.y}}),c=this.createImageMesh(a.id,i.feature.properties?.image.path,i.feature.properties?.image,s.height+s.altitude,i.feature.properties?.image.position,l,s.maxImageSize);i.mesh.parent.add(c),i.imageMesh=c}if(i.imageMesh){let l=i.feature.properties?.image?.path,{cacheKey:c,isResizable:u}=i.imageMesh.userData,d=!1;if(o&&l){let h=Math.abs(this.cameraWorldPosition.z-i.imageMesh.position.z);this.lod.requestUpgrade(c,h)}if(l){let h=i.imageMesh.material;d=this.reconcileMaterialTexture(h,c,u)}i.visible?s.showImage&&!i.imageMesh.visible?l?d&&(i.imageMesh.visible=!0):i.imageMesh.visible=!0:!s.showImage&&i.imageMesh.visible&&(i.imageMesh.visible=!1):i.imageMesh.visible=!1,s.flipImageToFaceCamera&&this.flipIfNeeded(i,e),s.enableImageCollisions===!0&&this.updateImageScreenBBoxes(i)}}}destroy(){this.lod.dispose(),super.destroy()}updateImageScreenBBoxes(e){if(e.imageMesh==null||!e.imageMesh.visible)return;let t=e.imageMesh.geometry.boundingBox;if(t==null&&(e.imageMesh.geometry.computeBoundingBox(),t=e.imageMesh.geometry.boundingBox),t){let r=new O;if(e.imageMesh.getWorldPosition(r),!this.cameraFrustum.containsPoint(r))return;let o=new V;this.projectToScreen(o,r);let i=[new O(t.min.x,t.min.y,t.min.z),new O(t.max.x,t.min.y,t.min.z),new O(t.min.x,t.max.y,t.min.z),new O(t.max.x,t.max.y,t.min.z),new O(t.min.x,t.min.y,t.max.z),new O(t.max.x,t.min.y,t.max.z),new O(t.min.x,t.max.y,t.max.z),new O(t.max.x,t.max.y,t.max.z)],s=[];for(let h of i){let g=h.clone().applyMatrix4(e.imageMesh.matrixWorld),b=new V;this.projectToScreen(b,g),s.push(b)}let a=1/0,l=1/0,c=-1/0,u=-1/0;for(let h of s)a=Math.min(a,h.x),l=Math.min(l,h.y),c=Math.max(c,h.x),u=Math.max(u,h.y);let d=new zt(o.x,o.y,c-a,u-l);this.currentImageScreenBBoxes.push(d)}else _.warn("Bounding box for imageMesh does not exist.")}};f();f();function Ia(n){let e=1/0,t=1/0,r=-1/0,o=-1/0;for(let i of n)i.x<e&&(e=i.x),i.x>r&&(r=i.x),i.y<t&&(t=i.y),i.y>o&&(o=i.y);return{minX:e,minY:t,maxX:r,maxY:o}}function Qm(n,e){return!(n.maxX<e.minX||n.minX>e.maxX||n.maxY<e.minY||n.minY>e.maxY)}function ef(n,e){if(!Qm(n,e))return 0;let t=Math.max(n.minX,e.minX),r=Math.min(n.maxX,e.maxX),o=Math.max(n.minY,e.minY),i=Math.min(n.maxY,e.maxY),s=r-t,a=i-o;return s*a}function yd(n,e){let t=ef(n,e);if(t===0)return 0;let r=e.maxX-e.minX,o=e.maxY-e.minY,i=r*o;return i===0?0:t/i}f();function tf(n){let e=0;for(let t=1;t<n.length;t++)(n[t].y<n[e].y||n[t].y===n[e].y&&n[t].x<n[e].x)&&(e=t);return e}function rf(n,e){let t=[...n];return t.sort((r,o)=>{let i=r.point.x-e.x,s=r.point.y-e.y,a=o.point.x-e.x,l=o.point.y-e.y,c=i*l-s*a;if(c===0){let u=i*i+s*s,d=a*a+l*l;return u-d}return c>0?-1:1}),t}function nf(n,e){let t=[e];for(let r=0;r<n.length;r++){for(;t.length>1;){let o=t[t.length-2].point,i=t[t.length-1].point,s=n[r].point,a=i.x-o.x,l=i.y-o.y,c=s.x-i.x,u=s.y-i.y;if(a*u-l*c<=0)t.pop();else break}t.push(n[r])}return t}function bd(n){if(n.length<3)return n.map((i,s)=>({point:i,index:s}));let e=tf(n),t=n.map((i,s)=>({point:i,index:s})),r=t[e];t.splice(e,1);let o=rf(t,r.point);return nf(o,r)}function An(n,e,t,r){if(n.length===0)return[];let o=[],i=n[n.length-1],s=e*i.x+t*i.y+r;for(let a=0;a<n.length;a++){let l=n[a],c=e*l.x+t*l.y+r;if(c>=0){if(s<0){let u=s/(s-c);o.push({x:i.x+u*(l.x-i.x),y:i.y+u*(l.y-i.y)})}o.push(l)}else if(s>=0){let u=s/(s-c);o.push({x:i.x+u*(l.x-i.x),y:i.y+u*(l.y-i.y)})}i=l,s=c}return o}f();var of="2",sf="1000",af="1002";function lf(n,e){let t=document.createElement("div");return t.id=`focus-bbox-${n}`,t.style.position="absolute",t.style.pointerEvents="none",t.style.overflow="hidden",t.style.zIndex=sf,e.appendChild(t),t}function cf(n,e){let t=e.maxX-e.minX,r=e.maxY-e.minY;n.style.left=e.minX+"px",n.style.top=e.minY+"px",n.style.width=t+"px",n.style.height=r+"px"}function uf(n,e){e?(n.style.border="2px solid green",n.style.backgroundColor="rgba(0, 255, 0, 0.1)"):(n.style.border="2px solid red",n.style.backgroundColor="rgba(255, 0, 0, 0.1)")}function df(n){let e=n.querySelector(".entity-id-label");return e||(e=document.createElement("div"),e.className="entity-id-label",e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.padding="2px 4px",e.style.color="white",e.style.fontSize="10px",e.style.fontWeight="bold",e.style.fontFamily="monospace",e.style.zIndex="1001",n.appendChild(e)),e}function hf(n){let e=n.querySelector(".score-label");return e||(e=document.createElement("div"),e.className="score-label",e.style.position="absolute",e.style.bottom="0",e.style.right="0",e.style.padding="2px 4px",e.style.color="white",e.style.fontSize="12px",e.style.fontWeight="bold",e.style.fontFamily="monospace",e.style.zIndex="1001",n.appendChild(e)),e}function pf(n,e,t,r,o){r?n.style.backgroundColor="green":n.style.backgroundColor="red",n.textContent=t,o!==void 0?(e.style.backgroundColor=r?"green":"red",e.textContent=o.toFixed(3)):(e.style.backgroundColor=r?"green":"red",e.textContent="")}function vd(n,e){for(let[t,r]of n)e.has(t)||(r.remove(),n.delete(t))}function xd(n,e,t,r,o,i){let s=t.get(n);s||(s=lf(n,r),t.set(n,s)),cf(s,e.clippedScreenBBox??e.screenBBox),uf(s,o);let a=df(s),l=hf(s);return pf(a,l,n,o,i),s}function Sd(){let n=document.createElement("div");return Object.assign(n.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none",overflow:"hidden",zIndex:of}),document.body.append(n),n}function Md(n,e){let t=document.createElement("div");t.style.position="absolute",t.style.top=n.minY+"px",t.style.left=n.minX+"px",t.style.width=n.maxX-n.minX+"px",t.style.height=n.maxY-n.minY+"px",t.style.border="2px solid gray",t.style.backgroundColor="rgba(128, 128, 128, 0.1)",t.style.pointerEvents="none",t.style.zIndex=af,e.append(t);let r=document.createElement("div");r.textContent="viewfinder",r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.padding="2px 4px",r.style.backgroundColor="gray",r.style.color="white",r.style.fontSize="12px",r.style.fontWeight="bold",r.style.fontFamily="monospace",r.style.zIndex="1001",t.appendChild(r);let o=document.createElement("div");return o.textContent="",o.style.position="absolute",o.style.bottom="0",o.style.right="0",o.style.padding="2px 4px",o.style.backgroundColor="gray",o.style.color="white",o.style.fontSize="12px",o.style.fontWeight="bold",o.style.fontFamily="monospace",o.style.zIndex="1001",t.appendChild(o),{squareEl:t,labelEl:r,scoreLabelEl:o}}function Cd(n,e){n.textContent=e}function Ed(n,e){e!==void 0?n.textContent=`Score: ${e.toFixed(3)}`:n.textContent=""}f();function wd(n,e,t){if(!n.visible)return;let r=n;if(r.isMesh||r.isLine||r.isPoints){let o=r.geometry;if(o?.isBufferGeometry){let i=o.attributes.position;if(i)for(let s=0;s<i.count;s++)t.fromBufferAttribute(i,s),t.applyMatrix4(n.matrixWorld),e.push(t.clone())}}for(let o of n.children)wd(o,e,t)}function Td(n,e){let t=[];return n instanceof Ge&&wd(n,t,e),t}var jr=.001;function Dd(n){if(n.length===0)return[];let e=[],t=n[n.length-1],r=t.w>jr;for(let o=0;o<n.length;o++){let i=n[o],s=i.w>jr;if(s){if(!r){let a=(jr-t.w)/(i.w-t.w);e.push({x:t.x+a*(i.x-t.x),y:t.y+a*(i.y-t.y),z:t.z+a*(i.z-t.z),w:jr})}e.push(i)}else if(r){let a=(jr-t.w)/(i.w-t.w);e.push({x:t.x+a*(i.x-t.x),y:t.y+a*(i.y-t.y),z:t.z+a*(i.z-t.z),w:jr})}t=i,r=s}return e}function Pd(n,e,t){if(n.length===0)return[];let r=n;return r=An(r,1,0,0),r=An(r,-1,0,e),r=An(r,0,1,0),r=An(r,0,-1,t),r}f();var xi=class{bbox;center;el=null;labelEl=null;scoreLabelEl=null;create(e,t,r,o,i){this.labelEl&&(this.labelEl.remove(),this.labelEl=null),this.scoreLabelEl&&(this.scoreLabelEl.remove(),this.scoreLabelEl=null),this.el&&(this.el.remove(),this.el=null);let s=Ur(r,e,t),a=s.left,l=s.top,c=e-s.left-s.right,u=t-s.top-s.bottom,d=new V(a+c/2,l+u/2),g=c/2*(2-2/1.2)/2,b=Math.max(a,d.x-g),M=Math.min(e-s.right,d.x+g),m=Math.max(l,d.y-g),p=Math.min(t-s.bottom,d.y+g),y=(b+M)/2,v=(m+p)/2;if(this.bbox={minX:b,maxX:M,minY:m,maxY:p},this.center=new V(y,v),o&&i){let{squareEl:x,labelEl:S,scoreLabelEl:w}=Md(this.bbox,i);this.el=x,this.labelEl=S,this.scoreLabelEl=w}}updateLabel(e){this.labelEl&&Cd(this.labelEl,e)}updateScore(e){this.scoreLabelEl&&Ed(this.scoreLabelEl,e)}destroy(){this.labelEl&&(this.labelEl.remove(),this.labelEl=null),this.scoreLabelEl&&(this.scoreLabelEl.remove(),this.scoreLabelEl=null),this.el&&(this.el.remove(),this.el=null)}};var mf=250,Si=class extends Z{cameraDirty=!0;focusablesDirty=!0;state;camera;cameraFrustum=new Or;viewProjectionMatrix=new Y;tempScreenPos=new O;debugEl=null;collisions=new Map;focusableEntities=new Map;debug=!1;debugBBoxElements=new Map;viewfinder=new xi;screenBoundsMap=new Map;screenDiagonal=1;constructor(e,t){super(),this.state=e,this.camera=t,this.resize()}resize(){this.screenDiagonal=Math.sqrt(this.state.canvasWidth*this.state.canvasWidth+this.state.canvasHeight*this.state.canvasHeight),this.createViewfinder()}createViewfinder(){this.debugEl&&this.debugEl.remove();for(let e of this.debugBBoxElements.values())e.remove();this.debugBBoxElements.clear(),this.debug&&(this.debugEl=Sd()),this.viewfinder.create(this.state.canvasWidth,this.state.canvasHeight,this.state.insetsPadding,this.debug,this.debugEl)}simplifyVertices(e){return e.length<3?e:bd(e).map(t=>e[t.index])}computeScreenSpaceBounds(e){let{vertices:t,boundingBox:r}=e;if(t==null||t.length<3||r==null||r.isEmpty()||!this.cameraFrustum.intersectsBox(r))return;let o=this.viewProjectionMatrix.elements,i=t.map(u=>({x:o[0]*u.x+o[4]*u.y+o[8]*u.z+o[12],y:o[1]*u.x+o[5]*u.y+o[9]*u.z+o[13],z:o[2]*u.x+o[6]*u.y+o[10]*u.z+o[14],w:o[3]*u.x+o[7]*u.y+o[11]*u.z+o[15]})),s=Dd(i);if(s.length<3)return;let a=1/0,l=[];for(let u of s){let d=u.x/u.w,h=u.y/u.w;l.push({x:(d+1)/2*this.state.canvasWidth,y:(-h+1)/2*this.state.canvasHeight}),u.w<a&&(a=u.w)}let c=Pd(l,this.state.canvasWidth,this.state.canvasHeight);if(!(c.length<=0))return{screenBBox:Ia(l),clippedScreenBBox:this.debug?Ia(c):void 0,closestZ:a}}updateFocusableEntities(){this.focusableEntities.clear();let e;for(let t of this.state.geometry3DsInScene){if(t==null)continue;let r;if(t.type==="group-container"||t.type==="feature-collection"?r=t.visible:r=t.components[1]?.visible??!0,!!r&&(e=t.type==="group-container"?t.components[1]:t.components[4],e!==void 0&&e.type==="focusable")){let o=String(t.type==="group-container"?t.userData.entityId:t.id);if(e.dirty===!0){let i=null;t instanceof Ge?i=t:"object3d"in t&&t.object3d instanceof Ge&&(i=t.object3d),i&&(e.boundingBox=new ce().setFromObject(i),e.vertices=this.simplifyVertices(Td(i,this.tempScreenPos)),e.dirty=!1)}this.focusableEntities.set(o,e)}}this.focusablesDirty=!1}#e=void 0;update=(e=!1,t=Date.now())=>{this.focusablesDirty&&this.updateFocusableEntities(),!e&&(Date.now()-t>mf||(this.#e&&cancelAnimationFrame(this.#e),this.#e=requestAnimationFrame(()=>{this.updateRaf()})))};updateRaf(){if(this.focusableEntities.size===0){this.publish("geometry-in-focus",[]);return}this.cameraDirty&&this.compute()}updateDebugBBoxes(e,t){if(!(!this.debug||!this.debugEl)){vd(this.debugBBoxElements,e);for(let[r,o]of e){let i=t.has(r),s=this.collisions.get(r);xd(r,o,this.debugBBoxElements,this.debugEl,i,s)}}}compute(){if(this.collisions.clear(),this.screenBoundsMap.clear(),!this.viewfinder.center)return;this.viewProjectionMatrix.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),this.cameraFrustum.setFromProjectionMatrix(this.viewProjectionMatrix);let e=[];for(let[r,o]of this.focusableEntities){let i=this.computeScreenSpaceBounds(o);if(!i)continue;this.screenBoundsMap.set(r,i);let{screenBBox:s}=i,a=yd(s,this.viewfinder.bbox);if(a>0){e.push(r);let l=(s.minX+s.maxX)/2,c=(s.minY+s.maxY)/2,u=l-this.viewfinder.center.x,d=c-this.viewfinder.center.y,g=1/(1+Math.sqrt(u*u+d*d)/this.screenDiagonal),b=1/(1+Math.abs(i.closestZ)),M=g*.5+a*.35+b*.15;this.collisions.set(r,M)}}let t=Array.from(this.collisions,([r,o])=>({entityId:r,score:o})).sort((r,o)=>o.score-r.score).map(({entityId:r})=>r);if(this.debug){let r=t[0];this.viewfinder.updateLabel(r||"viewfinder");let o=r?this.collisions.get(r):void 0;this.viewfinder.updateScore(o);let i=new Set(e);this.updateDebugBBoxes(this.screenBoundsMap,i)}this.publish("geometry-in-focus",t),this.cameraDirty=!1}showDebug(){this.debug||(this.debug=!0,this.cameraDirty=!0,this.createViewfinder())}hideDebug(){this.debug&&(this.debug=!1,this.createViewfinder())}destroy(){this.#e&&cancelAnimationFrame(this.#e),this.debugEl&&this.debugEl.remove();for(let e of this.debugBBoxElements.values())e.remove();this.debugBBoxElements.clear(),this.collisions.clear(),this.focusableEntities.clear(),this.viewfinder.destroy()}};f();f();f();f();f();function Mi(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return n.geometry.coordinates;if(n.type==="Point")return n.coordinates}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return n;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function Sr(n){if(Array.isArray(n))return n;if(n.type==="Feature"){if(n.geometry!==null)return n.geometry.coordinates}else if(n.coordinates)return n.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function Zr(n){return n.type==="Feature"?n.geometry:n}function vE(n,e){return n.type==="FeatureCollection"?"FeatureCollection":n.type==="GeometryCollection"?"GeometryCollection":n.type==="Feature"&&n.geometry!==null?n.geometry.type:n.type}function wt(n,e,t){if(t===void 0&&(t={}),!n)throw new Error("point is required");if(!e)throw new Error("polygon is required");var r=Mi(n),o=Zr(e),i=o.type,s=e.bbox,a=o.coordinates;if(s&&ff(r,s)===!1)return!1;i==="Polygon"&&(a=[a]);for(var l=!1,c=0;c<a.length&&!l;c++)if(Id(r,a[c][0],t.ignoreBoundary)){for(var u=!1,d=1;d<a[c].length&&!u;)Id(r,a[c][d],!t.ignoreBoundary)&&(u=!0),d++;u||(l=!0)}return l}function Id(n,e,t){var r=!1;e[0][0]===e[e.length-1][0]&&e[0][1]===e[e.length-1][1]&&(e=e.slice(0,e.length-1));for(var o=0,i=e.length-1;o<e.length;i=o++){var s=e[o][0],a=e[o][1],l=e[i][0],c=e[i][1],u=n[1]*(s-l)+a*(l-n[0])+c*(n[0]-s)===0&&(s-n[0])*(l-n[0])<=0&&(a-n[1])*(c-n[1])<=0;if(u)return!t;var d=a>n[1]!=c>n[1]&&n[0]<(l-s)*(n[1]-a)/(c-a)+s;d&&(r=!r)}return r}function ff(n,e){return e[0]<=n[0]&&e[1]<=n[1]&&e[2]>=n[0]&&e[3]>=n[1]}f();f();function gf(n){if(!n)throw new Error("geojson is required");var e=[];return Lt(n,function(t){yf(t,e)}),ir(e)}function yf(n,e){var t=[],r=n.geometry;if(r!==null){switch(r.type){case"Polygon":t=Sr(r);break;case"LineString":t=[Sr(r)]}t.forEach(function(o){var i=bf(o,n.properties);i.forEach(function(s){s.id=e.length,e.push(s)})})}}function bf(n,e){var t=[];return n.reduce(function(r,o){var i=po([r,o],e);return i.bbox=vf(r,o),t.push(i),o}),t}function vf(n,e){var t=n[0],r=n[1],o=e[0],i=e[1],s=t<o?t:o,a=r<i?r:i,l=t>o?t:o,c=r>i?r:i;return[s,a,l,c]}var Oa=gf;var sh=lo(oh(),1);function bg(n,e){var t={},r=[];if(n.type==="LineString"&&(n=Ts(n)),e.type==="LineString"&&(e=Ts(e)),n.type==="Feature"&&e.type==="Feature"&&n.geometry!==null&&e.geometry!==null&&n.geometry.type==="LineString"&&e.geometry.type==="LineString"&&n.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var o=ih(n,e);return o&&r.push(o),ir(r)}var i=(0,sh.default)();return i.load(Oa(e)),Ps(Oa(n),function(s){Ps(i.search(s),function(a){var l=ih(s,a);if(l){var c=Sr(l).join(",");t[c]||(t[c]=!0,r.push(l))}})}),ir(r)}function ih(n,e){var t=Sr(n),r=Sr(e);if(t.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(r.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var o=t[0][0],i=t[0][1],s=t[1][0],a=t[1][1],l=r[0][0],c=r[0][1],u=r[1][0],d=r[1][1],h=(d-c)*(s-o)-(u-l)*(a-i),g=(u-l)*(i-c)-(d-c)*(o-l),b=(s-o)*(i-c)-(a-i)*(o-l);if(h===0)return null;var M=g/h,m=b/h;if(M>=0&&M<=1&&m>=0&&m<=1){var p=o+M*(s-o),y=i+M*(a-i);return uo([p,y])}return null}var Oi=bg;f();function Li(n,e){e===void 0&&(e={});var t=Zr(n);switch(!e.properties&&n.type==="Feature"&&(e.properties=n.properties),t.type){case"Polygon":return vg(t,e);case"MultiPolygon":return xg(t,e);default:throw new Error("invalid poly")}}function vg(n,e){e===void 0&&(e={});var t=Zr(n),r=t.coordinates,o=e.properties?e.properties:n.type==="Feature"?n.properties:{};return ah(r,o)}function xg(n,e){e===void 0&&(e={});var t=Zr(n),r=t.coordinates,o=e.properties?e.properties:n.type==="Feature"?n.properties:{},i=[];return r.forEach(function(s){i.push(ah(s,o))}),ir(i)}function ah(n,e){return n.length>1?Nl(n,e):po(n[0],e)}function Sg(n,e){var t=!0;return Lt(n,function(r){Lt(e,function(o){if(t===!1)return!1;t=Mg(r.geometry,o.geometry)})}),t}function Mg(n,e){switch(n.type){case"Point":switch(e.type){case"Point":return!Tg(n.coordinates,e.coordinates);case"LineString":return!lh(e,n);case"Polygon":return!wt(n,e)}break;case"LineString":switch(e.type){case"Point":return!lh(n,e);case"LineString":return!Cg(n,e);case"Polygon":return!ch(e,n)}break;case"Polygon":switch(e.type){case"Point":return!wt(e,n);case"LineString":return!ch(n,e);case"Polygon":return!Eg(e,n)}}return!1}function lh(n,e){for(var t=0;t<n.coordinates.length-1;t++)if(wg(n.coordinates[t],n.coordinates[t+1],e.coordinates))return!0;return!1}function Cg(n,e){var t=Oi(n,e);return t.features.length>0}function ch(n,e){for(var t=0,r=e.coordinates;t<r.length;t++){var o=r[t];if(wt(o,n))return!0}var i=Oi(e,Li(n));return i.features.length>0}function Eg(n,e){for(var t=0,r=n.coordinates[0];t<r.length;t++){var o=r[t];if(wt(o,e))return!0}for(var i=0,s=e.coordinates[0];i<s.length;i++){var a=s[i];if(wt(a,n))return!0}var l=Oi(Li(n),Li(e));return l.features.length>0}function wg(n,e,t){var r=t[0]-n[0],o=t[1]-n[1],i=e[0]-n[0],s=e[1]-n[1],a=r*s-o*i;return a!==0?!1:Math.abs(i)>=Math.abs(s)?i>0?n[0]<=t[0]&&t[0]<=e[0]:e[0]<=t[0]&&t[0]<=n[0]:s>0?n[1]<=t[1]&&t[1]<=e[1]:e[1]<=t[1]&&t[1]<=n[1]}function Tg(n,e){return n[0]===e[0]&&n[1]===e[1]}var uh=Sg;function Xa(n,e){var t=!1;return Lt(n,function(r){Lt(e,function(o){if(t===!0)return!0;t=!uh(r.geometry,o.geometry)})}),t}var Dg=5e3,Ya="outdoor-system-debug-container",dh=!1,Ai=class extends Z{#e=!0;#n;idleQueue=new vr;#i="";#o=new Set;#s=[];#l;#a=null;#h=!0;#y=e=>{if(!this.#n)throw new Error("Map not initialized");let r=[[e[0],e[1]],[e[2],e[1]],[e[2],e[3]],[e[0],e[3]]].map(l=>this.#n.project(l)),o=Math.max(...r.map(l=>l.x)),i=Math.min(...r.map(l=>l.x)),s=Math.max(...r.map(l=>l.y)),a=Math.min(...r.map(l=>l.y));return[new Bs(i,a),new Bs(o,s)]};#t=(e,t)=>{if(!this.#n)return;let r=this.#n.on(e,t);r?.unsubscribe&&this.onAbort(()=>r.unsubscribe())};#d=()=>{this.#a&&(clearTimeout(this.#a),this.#a=null,this.#e=!1)};#r=()=>{this.#a&&(clearTimeout(this.#a),this.#a=null),this.#a=setTimeout(()=>{this.#d()},Dg)};#b=()=>{this.#x.clear(),this.#g=[]};hideLayersIntersectingPolygons(e,t){this.#b(),this.#a&&clearTimeout(this.#a),this.#r(),this.#l=e.reduce((r,o)=>{if(o.geometry.type==="Polygon"){let i=ho(o.geometry.coordinates);r.push(i)}else o.geometry.type==="MultiPolygon"&&r.push(...o.geometry.coordinates.map(i=>ho(i)));return r},[]);for(let r of t)this.#o.add(r);this.#e=!0,this.#m(),this.#c()}constructor(e){super(),e&&(this.#n=e,this.#t("styledata",this.#f),this.#t("render",this.#c),this.#t("load",()=>{this.#h=!0})),dh&&this.#S()}#m(){let e=new Set;if(this.#n)for(let t of this.#o)this.#n.getLayer(t)&&e.add(t);this.#s=Array.from(e)}#c=async()=>{if(dh&&this.#l&&this.#E(),!(!this.#n||!this.#h)&&this.#e&&!(!this.#s||this.#s.length===0)&&(this.#C&&this.#p(),this.#l)){this.idleQueue.onComplete(()=>{this.#g.length>0&&(this.#s.forEach(e=>{this.#n?.setFilter(e,["all",...this.#g])}),this.#e=!1),this.#g=[]});for(let e of this.#l){let t=Is(e),r=this.#y(t),o=this.#n.queryRenderedFeatures(r,{layers:this.#s});for(let i of o){let s=i.id;s==null||this.#x.has(s)||this.idleQueue.add(()=>{if(this.#x.add(s),i.geometry!=null&&"coordinates"in i.geometry){let a;if(i.geometry.type==="Polygon"?a=ho(i.geometry.coordinates):i.geometry.type==="MultiPolygon"&&(a=Bl(i.geometry.coordinates)),!a)return;Xa(e,a)&&this.#g.push(["!=",["id"],s])}})}}}};#g=[];#x=new Set;get#C(){return this.idleQueue.size!==0}#p=()=>{this.idleQueue.clearAll()};#f=e=>{if(this.#n&&e&&e.dataType==="style"&&e.type==="styledata"&&this.#o.size>0){let t=e?.style?.stylesheet?.id;(!t||t!==this.#i)&&(this.#b(),this.#i=t,this.#m(),this.#e=!0)}};#S(){if(!document.getElementById(Ya)&&this.#n){let e=document.createElement("div");e.id=Ya,e.style.position="absolute",e.style.top="0",e.style.left="0",e.style.bottom="0",e.style.right="0",e.style.pointerEvents="none",e.style.zIndex="1000",this.#n.getContainer().appendChild(e)}}#E(){let e=document.getElementById(Ya);if(!e||!this.#l||!this.#n)return;let t=e.querySelectorAll('[id^="polygon-box-"]');for(let r=0;r<t.length;r++)t[r].remove();for(let r=0;r<this.#l.length;r++){let o=this.#l[r],i=Is(o),s=this.#y(i),a=document.createElement("div");a.id=`polygon-box-${r}`,a.style.position="absolute",e.appendChild(a);let l=[Math.min(s[0].x,s[1].x),Math.min(s[0].y,s[1].y)],c=[Math.max(s[0].x,s[1].x),Math.max(s[0].y,s[1].y)];a.style.top=l[1]+"px",a.style.left=l[0]+"px",a.style.width=c[0]-l[0]+"px",a.style.height=c[1]-l[1]+"px",a.style.border=`2px solid ${this.#e?"red":"blue"}`}}destroy(){this.idleQueue.clearAll(),super.destroy()}};f();f();f();f();var Ri=class extends Ft{tangentData;parameters;constructor(e,t={}){super(),Object.defineProperty(this,"type",{value:"RibbonGeometry"}),this.parameters={path:e};let r=t.segments??64,o=new O,i=new O,s=new O(0,0,1),a=(r+1)*2,l=new Float32Array(a*3),c=new Float32Array(a*3),u=new Float32Array(a*2),d=new Float32Array(a),h=[];this.tangentData=new Float32Array((r+1)*3);let g=0,b=0,M=0;for(let m=0;m<=r;m++){let p=m/r;e.getPointAt(p,o),e.getTangentAt(p,i);let y=m*3;this.tangentData[y]=i.x,this.tangentData[y+1]=i.y,this.tangentData[y+2]=i.z,l[g++]=o.x,l[g++]=o.y,l[g++]=o.z,l[g++]=o.x,l[g++]=o.y,l[g++]=o.z,d[M++]=-1,d[M++]=1,u[b++]=0,u[b++]=p,u[b++]=1,u[b++]=p;let v=m*2*3;c[v]=s.x,c[v+1]=s.y,c[v+2]=s.z,c[v+3]=s.x,c[v+4]=s.y,c[v+5]=s.z}for(let m=0;m<r;m++){let p=m*2;h.push(p,p+2,p+1),h.push(p+1,p+2,p+3)}this.setIndex(h),this.setAttribute("position",new dr(l,3)),this.setAttribute("normal",new dr(c,3)),this.setAttribute("uv",new dr(u,2)),this.setAttribute("side",new dr(d,1))}};f();var _i=class extends oc{innerCurve;tStart;tEnd;constructor(e,t,r=!1){super(),this.innerCurve=e,r&&t>=4?(this.tStart=1/(t-1),this.tEnd=(t-2)/(t-1)):(this.tStart=0,this.tEnd=1)}get points(){return this.innerCurve.points}get tension(){return this.innerCurve.tension}get isTrimmed(){return this.tStart!==0||this.tEnd!==1}getPoint(e,t=new O){let r=this.tStart+e*(this.tEnd-this.tStart);return this.innerCurve.getPoint(r,t)}};f();var Fi=`// Force the compiler to compute gl_Position the same way across all shader
|
|
156
156
|
// programs that share this vertex transform. Without this, Apple Silicon /
|
|
157
157
|
// iOS GPU drivers may use different optimized FP paths between shader
|
|
158
158
|
// variants, producing precision drift that shows up as Z-fighting and path
|
|
@@ -774,7 +774,7 @@ void main(void) {
|
|
|
774
774
|
}
|
|
775
775
|
|
|
776
776
|
gl_FragColor = vec4(0.0, 1.0, 0.0, opacity);
|
|
777
|
-
}`;var ph="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAAAAAB5Gfe6AAAQkHpUWHRSYXcgcHJvZmlsZSB0eXBlIGV4aWYAAHjarZpZciQ7rkT/uYpeAicQ5HI4mr0dvOX3ATOl0li3q3SVJkUqFMEBcHc4IuX2///fcf/hK7cSXRatpZXi+cott9h5U/3j63EMPt+fL1/h+fPdeff6NnJMHNPjD2U/7+qcl183aH6eH+/PO52PN7E+B3qZ+Tlgspkjb57X1edAKT7Oh+fvrj3v6/nNdp7ftd057abHnz78npVgLGG8FF3cKSTPz2oXJFaQWuocCz9D0mhnEu8Tx54k6dexc98F77vY+f48n96HwvnyvKB8iNHzfJCvY3cj9HZF4dfM7/6QZ4j+7deb2J2z6jn7sbueC5Eq7rmpl63cd1w4GCrd2wov5Vt4r/fVeFW2OMnYIpuD13ShhUi0T8hhhR5O2Pc4w2SJOe5IuGOMM6Z7rhL+FudNSrZXOFFJz3KpkqtJ1hKn4+tawp233flmqMy8AlfGwGCBOz693Fcn/+b1OtA5Bt0QfH2NFeuKFnCWYZmzn1xFQsJ5xlRufO/LvcGNf5PYRAblhrmywe7HY4gh4Re20s1z4jrx2fkHNYKu5wCEiLmFxYREBnwJSUIJXmPUEIhjJT+dlceU4yADQSSu4A65SamQnBptbu7RcK+NEh+nkRYSIZBGSQ0EIlk5C/jRXMFQlyTZiUgRlSpNekklFymlaDGN6po0q2hR1apNe001V6mlaq211d5iS0iYtNLUtdpa651JO0N37u5c0fuII408ZJSho442+gQ+M0+ZZeqss82+4koL+q+y1K262uo7bKC085Zdtu662+4HrJ108pFTjp562umvWXtm9X3WwofM/T5r4Zk1y1i+1+mvrHFa9WWIYHIiljMyFnMg42oZANDRcuZryDla5ixnvkVIIZGsBbHkrGAZI4N5hygnvObuV+Z+mzcn+Y/yFr/LnLPU/RuZc5a6Z+Y+5+2LrK1+K0q6CTIWWkx9OggbF+zaY+1Wk/766H46wF8ONFY+O8hBMEc7oc4Vdh+8JsE+PUSrVjr70Zz1+H56PH3o9sRR1ql5Ha8bUMQxpe89Tki8Sb0tE23cw3DcfEo+ugnj2G3WEmononVfoag71pVjR+EmAE53eT5tqYfEHl/7ThMusaI+St0jktFa9gKnreiQqCNpZ2mJdSkbaiK6DrovYR4/JhJfRsx5d5EVZnEIPetHnU5KynJPTSuCPuC0lOuXH7n1DNq7DpUtHbhM5lDA0c2bnDCJoOObMnyj+aPjPwx0yiDUxKKsg35VnRnBEVhonKwK5hOk5NttUrhr2+tMOXkPJb1RZ+iAelYjL2MuO3pGRQ78GdxwOOaTAcJZcewq7ilB1RJCSozUdSEdwVJVb6asiBsHH1Bqgbiv3Cmkkis6ktVnZGRRwMNJjUA3Ao2127YWdhAIblxF51hzMcZsVZc0r0dJo5Liqfn41Q+q193SGhhkMkgaLJRNnEpqBtyVvbcVffIk+LE9QPFBTMTQe0aWkMXMnx3dy5sfHreDE60Ql50E+SqRcmfK16L2p0Ol8JFATu3qASXy7SvmiGW2cdMBxsty44CvtLogfGlv7WkCSV0WId2270EaD5Ym40cs+SAwZuNjPSTywAvEfLmzQhtLDntfCnhl/fNmUNnzyA2g76Zn0SP+c+I6bCC0FONUQ4L50e95dif+DH/m9htQjBEhPPpOjYjmm2ChbfEMIUaYtAIxmWJHlilLU8ZRs9pCsHbDpFaRgZljz2QandjDIBPZDGTuoZW1KdlYh52ALzisKJRNWSQmLAWx8iv9mGttT15bBc2oxd57bZtVF98CYtK3UH22Yd/A7WaKa+ZjNTOXEzNhMJ5kmQOvfzsbxbZALJ2xwGBjX2HFQybhi7kpbA7DVpS3RxMJwFyHwGk5gs6a4lrRHVqhYT0QTJC9UZcC9Yrelkn6yXch68NKNtG7CiU3vf/zMZAYXPWdrR9XZ/ctMV1sJQ2wJEGxzaHs7LmmHIwnUwbwnNAapBY9xhE19DNJW3ua0dDk/AjwITacR0PqZxkbyJ+E5jYbxI84x1TBE+y90hwDCYZIM0tqAKPZfCzFrbH8kYCm3eqQkZ2+2GovcL8Suokyg8yyCJes6dcouSLiNSLb0ETJU+/N/WFsBBSOXBbm9Cwp4CzlOag7ro7R2vC19nSsCPmAjIEMiobFwaoVXhjTU2XMpgEsDH/L3Sx54OCTMUSXI/IIA2V4QcLQpwVz12pInI0bY56pIQ2BSGRLL+yLfZ7JkiimbK+aepsbwRStpokx5gCqe1hjdMAwcINbkk5jmedrNRAG5pUXPe0sZIoXy1h7lSDxApzheg24JeDNtDS1oBDBUC4iWZFilBPhZx0Kqx2lihpbG9q4sYidksCN4yRYhNM4nxfBbTi4E3AT6B3igbvs9Gv8ZkHsIfdlep+2HelEDbkJdNjqZQ90B7k6OIoFfkkPNoY+z0gzACa1f2qcBYxVJpT2QQgS19dKQlbC24S92xiEAFRKB5Uy1qrBgOtwIge55G0kRPfIytGx0tMOrGfrijB2FHOk/TKcMjDTMPeBo4FnXD5cQ8vtdgoAN0yuzZQHQI09wm/5vAB6RHyI9rYKiZ6YWC6rbaiLmDtoaToC1bViXQFNtgWsOfEEKCleC3GWPSfgQWRQWMgw/9FDgvOZrFAT3SmsA3DLbqlsSppQG5QeOjPXavUUkxF/qgLM05vW5o7UakuBqo2ZW8Nj0LB7imVJC9QSA+wd7RPztIUZ80xQZq0ROrc8CSVncWzkTA/RwmunldCPAQKjqVC7bhRuTIv0plbk7gOX4m5OAi2YesYZ0KBQRToG8iv9x8dgGtgECYRBeEU87OxoSc8epu+s7Mq/MN0VbBT19dii7ekO66UZwdAMtoAVQd13J5nwZe98OgGslmVqAGBkeLZNVNVlWpV18qihntXKnBZvrDIVgFpx4q5poLqREOVplMPSpTF2KvjBAzDpprkruXIaaUmUD4Xo2yrGWcYlixKIwRFjl0jPQhKznUXZAoSjlg9c/NwAI4p3Q/w5bCNfhUZS7bGfqesHqKAlyZZxZgNrhGevZXccaqBys4NEqB3Vqfptji9uUrhCL6yXFqxtm0hhLyYU3Tjd8I/HZaWD1oyVjnG5hhpCN5yHSf8BQUZlVNd00OP4M0TK+JSM7iqWi01SinFkCQXWxiZJLqqAHiEt3G3I2WYd46KU9pIJIOkoRQYCcEAAPguHo0Y4k8Hl6SW50MoW0uZU8jJOUghKo38Nl5ZSwsJNAUC2/lFZWkfMjrU8dFrTjHpJnUrLCILQIxINiYdQlDXaE/razQ4jjQluN5jW1Eh/S7yYvI5gigSjdLYU9TiFXAcHjISiLhQd9obb3OQmwY+YqVwiBMCkOGLXaK/ljBShh56c1g0uyIb2lBRKO7ZTAFncw5c5UGjGSy3CsI1Jt2mtruZkfhBZmbR+842Yu1eDiWEl0V6LZcGem6Ct+LW4Wy3oAjyNObazKBHomhJ3HMKEKHgiGksH+Ig1nTidfNMyA+oYHqVFaRGLiQreVLc9GvQgftKjW9cfUSKNYL80rqU7Um2rwqQJR1ai31Wq7vzKJEsFHDj0bAEMUKXgvfD5bWbaLPBTKz1Nk/Fg+GUZvUzFw80CLaKtPAACVAWrismh863FU4IJ0716SXBUNVb/SDMVvZgDt34CXoOq1JKvg0n08gPHTwXBNgD5W8pZZ8E9EVWcv1DZMB2NFysIwkqBSaH5QRmsAHdkHB+UANvLJvFpQKAahSmYTLEd2AFO+5rsqRRU6sVv5IP0wsSPLcWsbC1Y95mte71CUm6RJJWwkg6Q4k+xWMM0ByElJPQ6j2ED5hY42ALpZRytx9RlgQlJLijzhKi5eX5JBSIRGfo9o2xhd/0aWku8OS+4D9ZnovHDQMPaYo4qm2mlZbUnd7pR6oQj29Z2BqJ9n3LRT+MTLu3IR+ZP2TCPh3EDw8H1NHpoT7FibNYU8WHd9ESHcY12aDOQCUBddi4Ucp+4yuzz8ybcCCu1h8zvzXhDN4HYLq1R+U0xzUqg5QSA3iSBgdDouy55Ifx0DaeEhgezxBRGmoEJ6AJitVuzwtKPlUskHgU2F0LS7AFIwW5jPu0RUL7sp+fkNk0ee8P6uXYgl40WM+cdCOW21r13e0ivt0ff/mYcUfrQZWs2BiN6G+MDTGz1BKORmUTNQp9YGSHFxAeTkQrKd6FoVUogyytW25OLy3OpaO5oZCQp46aPzb5LnJiFEIwAKkmbYVYIjzVv3vj7rA6HignEeQAXTAHKDhoD7Uujh0QjtsB6fTP1NzO7T1Nzq4F1GnfHdXCG1Yxjwdtjf+PGRGTzEtEAUCz7KLfTdItLwCXuSOAzVjaZB6LvbUZhYGWmifSZlcMDnGHPd6gPeiK9erhpiw7ZP9ahTrMhFDa1J53m9ri2DloziqGETTcVSppCbTDDjExg6RrZ6cPEzB8XArEjQSB29odrUoLyoS/65RfM9fprGGjlHpbhGgbYD8MtmW1eFcAWX5dbcMHcl8sUI2k+H7GPW9VrArw3G+BefcCrCaAT/N53YLvP26Uy0kMFnDEZz0DJkmQqEOlL7SlKweYhH8gxpYeAYi0f9magqPbMYZuUI6007lSZQoyoGfYQHsNRzHXR3MMINTSMZpq1KD2A5MDJgtMLdRU6R4CEOJcKGiIJ7K6P/vAM6xpECHI8rRHsaEj6smkngAUjXTzrRoSI48ZpHOqgOY5OejKVdpnmiYUChQnVdIPa6ekGqRSRgEO119oDHOiIUQ5ciYVgaF1oG8Udo8WYtD+DEi8D/w8rAJE2k2PoyV0oMtpauxreaFjpujAvxFlwBhjuNqM9P0IfI5iD8Nh8y1kG4igjJkDNkOijnlLhItAd9lhRd670yNRTu95cR/Xuu0c5WO4DEFk5YQAPtLvU4TYPGRh4APPEDNiuuwR6SC21JoFbQBBMr+zJmT32QplNI6p16PbculN/pCX1wAyTWGTeJ774aln0gvQikw7TmkfsNbdQNs0adutYUDqNtGc0RqngUYdhUYuHSL1/eLrgvqDTC5neu++vufRkEgP9D2T64Kg/c4n+s7k3dDr3me8nOr0c72MRNmgF7D4WySPP0YAI/bI4eixwc7K13QiRiL85A8fnSsUj+mvTrsZtVUEQZ6sTpVafW8nYJZyaZS0U+0xIb6et9PhhtoObozQbjKAoDf6eiFgx1UUvpUYj1GweH0MNMrofhynfWn7+KYu7n5r83hN9aqm+6qjcH7dUlgvZVLV3xqq4fbP16qv+eofuTz43eomAqfS7GBAB9zEE31WJ37eVIPtdGN5A8nMYPvvLt8t2/V/6gM19G4g/hIL7UXf9JgbuLRZ+AoW//AzyMxTcWyz8BAruLRZ+AgX3r3y2+mT/PwfiN1DoVI+QT3CZDmvb8022JeYb6HiQPQpPPvboFB+i1MZdcqWZqthHmix6vttw0UAI1z8oEnGwVe++c7JamxslC+8xKJE41XJmug1npz+6CUAKyURd9gSxo+kWxvtZth848GBlws/0SKjYhmbZ9IiV+mcGBSdWHk8sqSr2zz5J7QME/0yD+z4Pe+JuGn1MV/vUyZwOHojWPlmPXgf9CuoeN9UAT+FGwaLg44v3dWe6QpvuL3Ln/p3k/2AgqNDcfwHgqUmIIqn+hwAAAAJiS0dEAACqjSMyAAAACXBIWXMAAAsSAAALEgHS3X78AAAAB3RJTUUH4wYRESAMujenGAAAB9FJREFUeNrtnWlsFVUUx899fS1gUoKioEY+WBRUEohGkUhAKxgEjSgGoRGB4AJCNKAIJBJZJSiyGYMKKkIoLlEUKhUraxFkKUE2kU1aCrRgW2jpg9f29R2/sBTo67v3zL2zvfP73MzM+XU6mf+5504BGIZhGIZhGIZhGIZhGMZGGq3JvSmR62++BXHH7Ylbf9ouRMT99yVq/e0PICIiHumUmPV3PooXOf5EItafXoCXOdUn8ep/pgjrUDY40ervX4JXUTEiocoXL5/FawiNEwlU/6hzeB3hqQljQIwJYT3UzEkQA2JiGOslsiAhDIgZ1RiD6NIEMBD8NIKxyQr6vv7FtdgQa31uILg0ig2zsZmv4//yePUj7rjNv/U3yUEJ/r7Xr/XfvBmlOPKwT+vfhpIUdvdj/Wm7UZpTz/mv/g4HUYGyQb5r/+SjEhXD/VV/j5OoSGisj16LRe9iVCY8xTcGxIulSKBmtk8MiKHlSMIn8ViMqkQivojHgfcuIJ0VAc/XPzmMVljrcQOBmdVojY1NvVx/8mcRtEqeh+NxypJatM6+ezxb/7Io6uBwR4/e/1moicJunvz956A2ip/1Xv3Nt6JGSgd6rf47/0KtlHssHrfZi5rxVDwWDx5C7XgoHotHC9AANbO8YqBXERohMt8bv/8X/kNDRDM9cA+IgWVojhWuNxAYXo4mWePyeBwYHUKz5Lo6HidNvICmybvVxfXPqEbz7Gvr2vrn1KAdHH7IpX//8yNoD8dcGY+TM6NoF26MxzLTL26Mx0majtM4q5ed7yhNulVsd5WAxqset/mGS6/d5CIBLXI62/7I6ZKyzjUC0rIfsP+hE3zkxt9c8vy7tPnJbiKfuyP+Xdn8ZDeuiMei+zF0juWOGyBNv+iMxw4bEBkl6CzOxmPx6ll0mryWDtb/ViU6z17H4rEYG0I3cMiheByYFEZ34Ew8Dn5UjW7BiXisY/rFDfGYmgWCCwcngXto0q08z1YBSUsy3NWgb5Qe2WSjgJRlfdy2RJPcNXm9bQIarexpsP5VdxHjcbMcm2Q3/5P64i71U8k/ELuLNsVjcct2cnST+rGg+Jo4XmhLPBZ376GOfoOkAIB5NWTHxuu/nzj9ElkA8gLgA+pLlvF43IU4/VI9G1QEAHnIPjfVaP1PnqRdVngKqAkActDMa2Hw/u9zijjjNg5UBcBr1FbD3jbG6h9QSruk8ovfyFESABnUWSNT8VgMI06/lF7aBqomAJ4n3m+G4nHgbeJfZfHljcCKAqDHcWo87m2g/gnE53LhlS+lqQqATv9S4/FL2u//qcT2T34XoAuAdvuJBspf11z/LOKbyYG6q4bqAqDVTqKByjFa21/U6ZfdaWBNADTdTDQQnqSv/pRMYjrZevVLCUUAiF+JBqpnaqv/J2I+zb3mxZwkAMTPDq8ep1A3P/1y3ZOEJABgiaPxuOnvxLN/B7oEwELq/sPl1utvSdz8VPsl6BMAn1AbBKut1t96F+3ENXOFTgFiehXRwAZL8Vi0JW5+qppW7+HIAgDGnyca2G4hHouOh2knvTARdAuAkedsj8cinTj9Ujka9AuAV87YHI/F08TNT2eHgQkB0I/aIDhGmuIU/YnnKxkAZgTAU8SGHC0eDyJufiqKfTKrAqBrPtFAiXo8HlFBO1VBA7ebZQHQifhUVo7H4p2QgQeOdQHQbp8t8Tg4idj+2dPgwJIGAdBqhw3xmDz9EuelQ4cASP3DeDwOziW+ecdbldEiACDbcDxOWkBs/8QNHpoEAPXjLNFMmfpv+IZ4+PjRU5cAWGwwHqcQNz/J2NUmAMgjavHjMfEPTGpvvz4BQH1MrzMkoHoW2CsAppEaBFskemQUA+HJYLcAeJfQINgpNVuvbiA0FuwXAG8qNwh2S07WqxqQ/saPXgEwRDGu7W8te2Q1A6XSH0HWLAD6nVa5zoPS9asZKJb/DLZuAdDzhPx1Hu2gkobkDRQq/J8w7QJAfstevuI3+WQN1F39dkAAtP9H7jpPdFVtiMgZOKC0Z9aAAEiT+mrbScLQjIyBXWngtABokRf/kKefonRF4xvYqrjmYEQApG6Md8SyvrS+eDwDG5QbzUYExL3QMxnUlZGGD5wFbhEADQ7YVwyhr401YCD6LbhHACyK3SA4N9TK6mhMA5EvwE0CYF6sBkFopLXl8exYq9/gLgHwYf3x+PxoqwMC9RoIvw9uE1D/gH3VeOsjItnSq9/OCqhvwL5qAoABA5XU28qsAHjj2tW8mukABgzEXP12WgAMvrpBEPkYwICB2KvfjguAvnUH7GvnARgwUGRhEt24gLoD9tGvAAwYKLDyySzzAqDzpQH76CIAAwYOWtqNYoMAaH9xwP57AAMG9ljbj2SHALhjJyLijwAGDGyzuCPNFgGQuhlxpfw1yR94dfAxi5cmojI/lRyx+rtaX9XDhADr2CVABc//JycWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWAALYAEsgAWwABbAAlgAC2ABLIAFsAAWwAJYAAtgASyABbAAFsACWIDToH8FyJUWtVWAALedDoFhGIZhGIZhGIZhGIYxyf+YwEMsIhMo/AAAAABJRU5ErkJggg==";f();var Ni=new O,Bi=new O,Yr=new O,mh=new O,Xt=new O,Ig=.5,Og=2;function Lg(n,e,t){let r=n.x-e.x,o=n.y-e.y,i=n.z-e.z,s=t.x-e.x,a=t.y-e.y,l=t.z-e.z,c=r*s+o*a+i*l,u=Math.sqrt(r*r+o*o+i*i),d=Math.sqrt(s*s+a*a+l*l);if(u===0||d===0)return 0;let h=c/(u*d),g=Math.max(-1,Math.min(1,h));return Math.acos(g)}function gh(n,e=20){if(n.length<3||e<=0)return n;let t=e,r=e/2,o=[n[0]];for(let i=1;i<n.length-1;i++){let s=n[i],a=n[i-1],l=n[i+1],c=s.distanceTo(a),u=s.distanceTo(l);c>t&&(Xt.subVectors(s,a).normalize(),Yr.set(s.x-Xt.x*r,s.y-Xt.y*r,s.z-Xt.z*r),o.push(Yr.clone())),o.push(s),u>t&&(Xt.subVectors(l,s).normalize(),Yr.set(s.x+Xt.x*r,s.y+Xt.y*r,s.z+Xt.z*r),o.push(Yr.clone()))}return o.push(n[n.length-1]),o}var fh=.0025;function yh(n,e,t,r=Math.PI*2/3){if(n.length<3||e<=0||t<=0)return n;let o=[n[0]];for(let i=1;i<n.length-1;i++){let s=n[i-1],a=n[i],l=n[i+1],c=a.distanceToSquared(s),u=a.distanceToSquared(l);if(c<fh||u<fh){o.push(a);continue}if(Lg(s,a,l)<r){Ni.subVectors(a,s).normalize(),Bi.subVectors(l,a).normalize();let h=Math.sqrt(c),g=Math.sqrt(u),b=Math.max(Ig,Math.min(Og,e)),M=Math.min(b,h*.5),m=Math.min(b,g*.5);Yr.set(a.x-Ni.x*M,a.y-Ni.y*M,a.z-Ni.z*M),mh.set(a.x+Bi.x*m,a.y+Bi.y*m,a.z+Bi.z*m),o.push(Yr.clone(),mh.clone())}else o.push(a)}return o.push(n[n.length-1]),o}var Mr=8,qa=Rt,Ag=new Mo,Gi=new O,bh={h:0,s:0,l:0};function Ja(n,e,t=.2){return n.getHSL(bh),e.copy(n).offsetHSL(0,-bh.s*t,0)}function Ka(n,e){n.stencilWrite=e,e&&(n.stencilRef=qe.PATH,n.stencilFunc=ur,n.stencilZPass=ln,n.stencilZFail=le,n.stencilFail=le)}function Qa(n){return n===!1?-1:n===!0?0:Math.sin(n*Math.PI/180)}function xh(n,e,t){if(n.length<2){let A=new He;return A.userData={entityId:"",type:"path"},{mesh:A,material:null,center:new O}}let{breakpoint:r,width:o,accentColor:i,completeFraction:s,isVertical:a,visibleThroughGeometry:l,dashed:c,highlightCompleteFraction:u,highlightStartFraction:d,highlightEndFraction:h,highlightColor:g,highlightWidthMultiplier:b,highlightDisplayArrowsOnPath:M,travelledEndFraction:m,travelledColor:p,xrayOpacity:y,xrayStyle:v,__EXPERIMENTAL_BILLBOARDING:x,__EXPERIMENTAL_PREVENT_SELF_OVERLAP:S}=e,{color:w}=t,D=!0,C=0,T=1/0,P=e.displayArrowsOnPath,I=!0,L,N;if(sr(o)){let A=At(o)/2;L=A,N=A}else if(typeof o=="object"){let A=e.parsedOutputValues;L=A[r]/2,N=(A[r+1]??A[r])/2}else L=o/2,N=o/2;let z=e.__EXPERIMENTAL_GEOMETRY==="ribbon",j=z?Qa(x):-1,H=(t.altitude??0)+Rg,Q=0;n[0].z+=H;for(let A=1;A<n.length;++A){n[A].z+=H;let R=n[A].x-n[A-1].x,ee=n[A].z-n[A-1].z;if(a)Q+=Math.sqrt(R*R+ee*ee);else{let ao=n[A].y-n[A-1].y;Q+=Math.sqrt(R*R+ao*ao+ee*ee)}}let G=n,J=e.smoothingCornerRadius??Mt.cornerRadius,ne=e.smoothingTension??Mt.tension,je=J>0&&ne>0;je&&(G=gh(G),G=yh(G,J,ne));let[ye,be]=e.__EXPERIMENTAL_ENDCAP_EXTENSION;if((ye>0||be>0)&&!a&&!z){let A=G[0],R=G[G.length-1],ee=je?.01:-.01;G.push(R.clone().setZ(R.z+ee)),G.unshift(A.clone().setZ(A.z+ee))}if(z&&!a&&G.length>=2){if(ye>0){let A=G[0],R=G[1];Gi.subVectors(R,A).normalize();let ee=A.clone().addScaledVector(Gi,-ye);G.unshift(ee)}if(be>0){let A=G[G.length-1],R=G[G.length-2];Gi.subVectors(A,R).normalize();let ee=A.clone().addScaledVector(Gi,be);G.push(ee)}}let Ze=Ag.load(ph);Ze.colorSpace=lr;let Qe=new k(w),mt=new k(i),et=e.__EXPERIMENTAL_BORDER,It=et?.enabled??!1,Fe=et?.color==="darken",Xe=et?.width??.1,ft=Fe?Qe.clone().multiplyScalar(.6):new k(et?.color??"#000000"),Se={vertexes:{type:"f",value:1},resolution:{type:"v2",value:new W(1,1)},cameraParameters:{type:"v2",value:new W(C,0)},complete:{type:"f",value:D?0:1},color:{type:"c",value:Qe},pathLength:{type:"f",value:Q},nearRadius:{type:"f",value:L},farRadius:{type:"f",value:N},nearZoom:{type:"f",value:C},farZoom:{type:"f",value:T},pulseColor:{type:"c",value:mt},pulse:{type:"f",value:0},pulseLength:{type:"f",value:.075},pathIsVertical:{type:"b",value:a},arrowAnimationTimer:{type:"f",value:0},arrowTexture:{type:"t",value:Ze},displayArrowsOnPath:{type:"b",value:P},showPulse:{type:"b",value:I},opacityMultiplier:{type:"f",value:1},dashed:{type:"b",value:c},xrayDithering:{type:"f",value:0},highlightCompleteFraction:{type:"f",value:u},highlightStartFraction:{type:"f",value:d},highlightEndFraction:{type:"f",value:h},highlightColor:{type:"c",value:new k(g)},highlightWidthMultiplier:{type:"f",value:b},highlightDisplayArrowsOnPath:{type:"b",value:M},travelledEndFraction:{type:"f",value:m},travelledColor:{type:"c",value:new k(p)},dashLength:{type:"f",value:e.dashLength},dashGap:{type:"f",value:e.dashGap},dashRelativeToWidth:{type:"b",value:e.dashRelativeToWidth},dashSize:{type:"f",value:e.dashSize},gapSize:{type:"f",value:e.gapSize},dashAbsolute:{type:"b",value:e.dashAbsolute},dashMeters:{type:"f",value:e.dashMeters},gapMeters:{type:"f",value:e.gapMeters},isRibbon:{type:"b",value:z},billboardThreshold:{type:"f",value:j},borderEnabled:{type:"b",value:It},borderColor:{type:"c",value:ft},borderWidth:{type:"f",value:Xe},borderUseDarken:{type:"b",value:Fe},endcapEnabled:{type:"v2",value:new W(z&&ye>0?1:0,z&&be>0?1:0)},cameraViewMatrix:{type:"m4",value:new Y},screenSpace:{type:"b",value:e.screenSpace},metersPerPixel:{type:"f",value:1}};if(je&&G.length>=2){let A=G[0],R=G[1],ee=G[G.length-1],ao=G[G.length-2],Rp=A.clone().sub(R).normalize(),_p=A.clone().add(Rp.multiplyScalar(vh));G.unshift(_p);let Fp=ee.clone().sub(ao).normalize(),Np=ee.clone().add(Fp.multiplyScalar(vh));G.push(Np)}let Ye=new ic(G);Ye.curveType="catmullrom",Ye.tension=je?ne:0;let Ne=z&&je,er=new _i(Ye,G.length,Ne),Be=_g*G.length,de=z?new Ri(er,{segments:Be,billboarded:j>=0}):new sc(er,Be,L,Mr,!1),ro=new Float32Array(de.attributes.position.count),wr=new ke(ro,1);if(z)for(let A=0;A<=Be;A++){let R=A/Be;wr.setX(A*2,R),wr.setX(A*2+1,R)}else for(let A=0;A<=Be;A++){let R=A/Be;for(let ee=0;ee<=Mr;ee++)wr.setX(A*(Mr+1)+ee,R)}de.setAttribute("pathDistance",wr);let ws=new Float32Array(de.attributes.position.count*3),tr=new ke(ws,3),Ot,st,Tr,rn,no;if(z){let A=de;for(let R=0;R<=Be;R++)st=R*3,Tr=A.tangentData[st],rn=A.tangentData[st+1],no=A.tangentData[st+2],tr.setXYZ(R*2,Tr,rn,no),tr.setXYZ(R*2+1,Tr,rn,no)}else{let A=de;for(let R=0;R<=Be;R++){Ot=A.tangents[R];for(let ee=0;ee<=Mr;ee++)tr.setXYZ(R*(Mr+1)+ee,Ot.x,Ot.y,Ot.z)}}de.setAttribute("pathTangent",tr);let oo=new Float32Array(de.attributes.position.count*3),gt=new ke(oo,3),rr,nr,or,tt=new O,Rl=A=>{a?(rr=A.x*A.y,nr=-1+A.y*A.y,or=A.z*A.y):(rr=-A.x*A.z,nr=-A.y*A.z,or=1-A.z*A.z);let R=Math.sqrt(rr*rr+nr*nr+or*or);return R===0&&(R=1),tt.set(rr/R,nr/R,or/R),tt},io={x:0,y:0,z:0};if(z){let A=de;for(let R=0;R<=Be;R++)st=R*3,io.x=A.tangentData[st],io.y=A.tangentData[st+1],io.z=A.tangentData[st+2],Rl(io),gt.setXYZ(R*2,tt.x,tt.y,tt.z),gt.setXYZ(R*2+1,tt.x,tt.y,tt.z)}else{let A=de;for(let R=0;R<=Be;R++){Ot=A.tangents[R],Rl(Ot);for(let ee=0;ee<=Mr;ee++)gt.setXYZ(R*(Mr+1)+ee,tt.x,tt.y,tt.z)}}de.setAttribute("pathNormal",gt);let so=new $e({uniforms:Se,vertexShader:Fi,fragmentShader:$a,side:qa});so.transparent=!0,so.alphaTest=.5,Se.resolution.value.x=1,Se.resolution.value.y=1,Se.vertexes.value=de.attributes.position.count,Se.arrowTexture.value.wrapS=sn,Se.arrowTexture.value.wrapT=sn,Se.arrowTexture.value.anisotropy=16;let Pe=new V(de,so);Pe.name="path";let yt=Pe.clone();yt.name="xray";let Lp=v?.color?new k(v.color):Qe,Ap=Ja(Lp,new k,v?.tint),bt={...Se,color:{type:"c",value:Ap},opacityMultiplier:{type:"f",value:y},pathIsVertical:{type:"b",value:a},xrayDithering:{type:"f",value:v?.dithering??0}};bt.complete.value=1,yt.material=new $e({uniforms:bt,vertexShader:Fi,fragmentShader:$a,side:qa,transparent:!0}),yt.material.alphaTest=.5,yt.material.depthWrite=!1,yt.material.depthTest=!1,Ka(yt.material,S),bt.resolution.value.x=1,bt.resolution.value.y=1,bt.vertexes.value=de.attributes.position.count,bt.arrowTexture.value.wrapS=sn,bt.arrowTexture.value.wrapT=sn,bt.arrowTexture.value.anisotropy=16,bt.complete.value=s,Pe.userData=yt.userData=e.mesh.userData;let nn=e.mesh;if(!l){let A=new $e({uniforms:Se,vertexShader:Fi,fragmentShader:hh,side:qa}),R=new V(de,A);R.name="stencil",R.material.colorWrite=!1,R.material.stencilWrite=!0,R.material.stencilRef=qe.PATH,R.material.stencilFunc=Ir,R.material.stencilZPass=ln,R.material.stencilZFail=le,R.material.stencilFail=le,R.material.depthWrite=!1,R.material.depthTest=!0,R.userData=e.mesh.userData,nn.add(R),nn.add(yt),yt.renderOrder=ue.XRAY_PATH,Pe.renderOrder=ue.STENCIL_PATH}if(nn.add(Pe),a){let A=new ce().setFromObject(Pe),R=new O;A.getCenter(R),nn.children.forEach(ee=>{ee.geometry.center(),ee.position.copy(R)})}l&&(Pe.material.stencilWrite=!0,Pe.material.stencilRef=qe.PATH,Pe.material.stencilFunc=ur,Pe.material.stencilZPass=le,Pe.material.stencilZFail=le,Pe.material.stencilFail=le,Pe.material.needsUpdate=!0,Pe.layers.disableAll(),Pe.layers.enable(ue.ALWAYS_ON_TOP_PATHS)),de.computeBoundingBox();let _l=new O;return de.boundingBox.getCenter(_l),{mesh:nn,material:so,center:_l}}var Rg=.15,_g=30,vh=.01;var Fg=.5,Sh=new k,Fn=class extends Z{rendererState;verticalDistanceDirty=!0;convertTo3DMapPosition;getParentContainer;convertZoomLevelToAltitude;constructor(e,t,r,o){super(),this.rendererState=e,this.convertTo3DMapPosition=t,this.getParentContainer=r,this.convertZoomLevelToAltitude=o}update(e,t,r,o){let i=!1;for(let s of this.rendererState.geometry3DsInScene)if(s&&s.type==="path"&&s.components[0].type==="path"){let a=s.components[0],l=s.components[1],c=a.isVertical&&this.verticalDistanceDirty;if(!(a instanceof fr))continue;let u=[];if(a.dirty||l.dirty||c){if(a.mesh.parent!=null)for(let d=a.mesh.children.length-1;d>=0;d--)ve(a.mesh.children[0]);if(a.feature.features.length===2&&a.feature.features[0].properties.parentId&&a.feature.features[1].properties.parentId){let d=a.feature.features[0],h=a.feature.features[a.feature.features.length-1],g,b,M=d.geometry.coordinates[2]||0,m=h.geometry.coordinates[2]||0;d.properties.parentId&&(g=this.getParentContainer(d.properties.parentId,!0),g!=null&&g.altitude!=null&&(M+=g.altitude,a.isVertical=!0)),h.properties.parentId&&(b=this.getParentContainer(h.properties.parentId,!0),b!=null&&b.altitude!=null&&(m+=b.altitude,a.isVertical=!0));let p=this.convertTo3DMapPosition(d.geometry.coordinates[1],d.geometry.coordinates[0],M),y=this.convertTo3DMapPosition(h.geometry.coordinates[1],h.geometry.coordinates[0],m);Math.abs(p.z-y.z)>Fg&&g!=null&&g.visible&&b!=null&&b.visible&&(u=[p,y])}else{let d=a.feature.features;for(let h=0;h<d.length;h++)if(h===0||!Ec(d[h].geometry.coordinates,d[h-1].geometry.coordinates)){let g=this.convertTo3DMapPosition(d[h].geometry.coordinates[1],d[h].geometry.coordinates[0],d[h].geometry.coordinates[2]||0);u.push(g)}}if(u.length>1){let{mesh:d,material:h,center:g}=xh(u,a,{color:l.color,altitude:l.altitude,isVertical:a.isVertical});a.mesh=d,a.material=h,a.position=g}a.dirty&&typeof a.width=="object"&&a.width.on==="zoom-level"&&(a.altitudeBreakpoints=a.width.input.map(d=>this.convertZoomLevelToAltitude(d))),a.dirty=!1}l.dirty&&(a.mesh.children.forEach(d=>{d.name!=="stencil"&&(d.name==="xray"?Ch(l.color,a,d.material.uniforms.color.value):d.material.uniforms.color.value.set(l.color),d.material.visible=l.visible,d.material.needsUpdate=!0,d.name!=="xray"&&a.__EXPERIMENTAL_BORDER?.color==="darken"&&d.material.uniforms.borderColor.value.copy(d.material.uniforms.color.value).multiplyScalar(.6))}),a.mesh.position.z=l.altitude,l.dirty=!1),a.material&&(a.mesh.children.forEach(d=>{let h=d.material.uniforms;if(d.name==="stencil"){a.materialDirty&&Mh(a,d.material);return}if(a.materialDirty&&d.name==="xray"&&h.opacityMultiplier&&(h.opacityMultiplier.value=a.xrayOpacity,h.xrayDithering.value=a.xrayStyle?.dithering??0,Ch(l.color,a,h.color.value),Ka(d.material,a.__EXPERIMENTAL_PREVENT_SELF_OVERLAP)),typeof a.width=="object"&&a.width.on==="zoom-level"){a.altitudeBreakpoints&&a.altitudeBreakpoints.length>2&&_.warn("Path width interpolation does not yet support more than 2 breakpoints! This will be added in a future version. Path width will only use the first two breakpoints.");let g=kl(r,a.altitudeBreakpoints?.slice(0,2)??[e,t]);a.breakpoint=g,h.nearZoom.value=a.altitudeBreakpoints?.[g]??e,h.farZoom.value=a.altitudeBreakpoints?.[g+1]??t;let b=a.parsedOutputValues;h.nearRadius.value=b[g]/2,h.farRadius.value=(b[g+1]??b[g])/2}if(h.cameraParameters.value.x=r,h.metersPerPixel.value=o,h.cameraViewMatrix.value.copy(this.rendererState.cameraObject.matrixWorldInverse),a.materialDirty){h.displayArrowsOnPath.value=a.displayArrowsOnPath,h.pulseColor.value.set(a.accentColor),h.complete.value=a.completeFraction,Mh(a,d.material),h.dashed.value=a.dashed,h.dashLength.value=a.dashLength,h.dashGap.value=a.dashGap,h.dashRelativeToWidth.value=a.dashRelativeToWidth,h.dashSize.value=a.dashSize,h.gapSize.value=a.gapSize,h.dashAbsolute.value=a.dashAbsolute,h.dashMeters.value=a.dashMeters,h.gapMeters.value=a.gapMeters;let g=a.__EXPERIMENTAL_BORDER;h.borderEnabled.value=g?.enabled??!1,h.borderWidth.value=g?.width??.1,g?.color==="darken"?h.borderColor.value.copy(h.color.value).multiplyScalar(.6):h.borderColor.value.set(g?.color??"#000000"),h.borderUseDarken.value=g?.color==="darken",h.billboardThreshold.value=Qa(a.__EXPERIMENTAL_BILLBOARDING);let[b,M]=a.__EXPERIMENTAL_ENDCAP_EXTENSION;if(h.endcapEnabled.value.set(b>0?1:0,M>0?1:0),h.screenSpace.value=a.screenSpace,sr(a.width)){h.nearZoom.value=e,h.farZoom.value=t;let m=At(a.width);h.nearRadius.value=m/2,h.farRadius.value=m/2}else typeof a.width=="number"&&(h.nearZoom.value=e,h.farZoom.value=t,h.nearRadius.value=Number(a.width)/2,h.farRadius.value=Number(a.width)/2)}}),(a.displayArrowsOnPath||a.highlightDisplayArrowsOnPath)&&a.animateArrowsOnPath&&(a.mesh.children.forEach(d=>{d.name!=="stencil"&&(d.material.uniforms.arrowAnimationTimer.value=performance.now()/3e3,d.material.needsUpdate=!0)}),i=!0),a.materialDirty=!1)}this.verticalDistanceDirty=!1,i&&this.publish("animate:path")}};function Mh(n,e){let t=e.uniforms;t.highlightCompleteFraction.value=n.highlightCompleteFraction,t.highlightStartFraction.value=n.highlightStartFraction,t.highlightEndFraction.value=n.highlightEndFraction,t.highlightWidthMultiplier.value=n.highlightWidthMultiplier,t.highlightColor.value.set(n.highlightColor),t.highlightDisplayArrowsOnPath.value=n.highlightDisplayArrowsOnPath,t.travelledEndFraction.value=n.travelledEndFraction,t.travelledColor.value.set(n.travelledColor)}function Ch(n,e,t){let r=e.xrayStyle?.color?Sh.set(e.xrayStyle.color):Sh.set(n);Ja(r,t,e.xrayStyle?.tint)}f();var ki=class{rendererState;dirty=!1;constructor(e){this.rendererState=e}#e;#n;#i;#o=new Y;updateOne(e){if(e instanceof $&&e.components[0]instanceof oe&&e.components[1]instanceof ct&&e.parentObject3D instanceof Ce&&(this.#e=e.components[0],this.#i=e.components[1],!this.#e.detached&&this.#e.shouldDetach&&this.#e.mesh!=null&&this.#e.material instanceof fn&&this.#e.batchedProps!=null)){this.#n=e.parentObject3D,this.#e.visible=!1;let t=this.#i.color,r=this.#i.opacity*Gr(e),o=this.#e.material,i=r??1,s=o.clone({color:t,side:zc(this.#i.side,i),opacity:i,transparent:i<1}),a=new Su(1,this.#e.batchedProps.positionCount,0,s);a.layers.enable(Oe.SHOULD_CAST_SHADOWS);let l=Pu(this.#e,a,this.#o);if(l==null)return;a.userData={entities:{0:e.id},detached:!0},this.#e.instanceIndex=l,s.setColor(this.#e.instanceIndex,new k(t),this.#i.topColor?new k(this.#i.topColor):new k(t)),this.#e.mesh=a,this.#e.currentHeight=-1,this.#e.material=s,this.#n.add(a),this.#e.shouldDetach=!1,this.#e.detached=!0,this.#i.dirty=!0}}update(){if(!this.dirty)return;let e;for(let t of this.rendererState.geometry3DIdsInScene)e=this.rendererState.geometry3DMap.get(t),this.updateOne(e);this.dirty=!1,this.cleanup()}cleanup(){this.#e=void 0,this.#n=void 0,this.#i=void 0}};f();f();var Yt=new Y,Nn=new O,zi=new _t,Bn=new O;function el(n,e,t){let r=e||1e-4,o=r/Math.max(t,1e-4);return n.mesh instanceof Wt?(n.mesh.scale.z=o,n.currentHeight=r,!0):n.batchedProps?.range&&kr(n.mesh)&&n.instanceIndex!==-1?(n.mesh.getMatrixAt(n.instanceIndex,Yt),Yt.decompose(Nn,zi,Bn),Bn.z=o,Yt.compose(Nn,zi,Bn),n.mesh.setMatrixAt(n.instanceIndex,Yt),n.material&&(n.material.repeatYFactor=o),n.currentHeight=r,!0):!1}function Eh(n,e){return kr(n.mesh)&&n.instanceIndex!==-1?(n.mesh.getMatrixAt(n.instanceIndex,Yt),Yt.decompose(Nn,zi,Bn),Nn.z=e,Yt.compose(Nn,zi,Bn),n.mesh.setMatrixAt(n.instanceIndex,Yt),n.altitude=e,!0):!1}var Ui=class{rendererState;dirty=!1;constructor(e){this.rendererState=e}#e;#n;updateOne(e){if(e instanceof $&&e.type==="geometry"&&e.components[1]?.dirty&&(this.#e=e.components[0],this.#n=e.components[1],e.type==="geometry"))if(this.#e.mesh instanceof Wt){let t=!1;this.#n.height!==this.#e.currentHeight&&(t=el(this.#e,this.#n.height,this.#n.initialHeight)),this.#n.altitude!==this.#e.altitude&&(this.#e.mesh.position.z=this.#n.altitude),t&&this.#e.mesh!=null&&this.#e.mesh.geometry.computeBoundingSphere()}else{let t=!1;this.#n.height!==this.#e.currentHeight&&(t=el(this.#e,this.#n.height,this.#n.initialHeight)),this.#n.altitude!==this.#e.altitude&&(t=Eh(this.#e,this.#n.altitude)),t&&this.#e.mesh!=null&&this.#e.mesh.computeBoundingSphere()}}update(){for(let e of this.rendererState.geometry3DsInScene)this.updateOne(e);this.cleanup()}cleanup(){this.#e=void 0,this.#n=void 0}};f();var Ng={showPolygonLabelTextAreaMesh:!1,showEnvMap:!1,showCollisionBoxes:!1,showGeometryInFocus:!1,showImageLOD:!1,showModelInstancingStats:!1,showScreenOffsets:!1,showCameraTargets:!1,focusOn:!1},Hi=class{state=Ng;core;constructor(e){this.core=e}update(e){let t={};for(let r of Object.keys(e))r in this.state&&this.state[r]!==e[r]&&(Object.assign(this.state,{[r]:e[r]}),Object.assign(t,{[r]:e[r]}));this.handleUpdate(t)}handleUpdate(e){if(e.showPolygonLabelTextAreaMesh!=null&&(e.showPolygonLabelTextAreaMesh?this.core.getSystems().text3DSystem.showTextAreaMesh():this.core.getSystems().text3DSystem.hideTextAreaMesh()),e.showEnvMap!=null&&(e.showEnvMap?this.core.setEnvironment("basic"):this.core.setEnvironment(!1)),e.showCollisionBoxes!=null&&(e.showCollisionBoxes?this.core.showCollisionBoxes():this.core.hideCollisionBoxes()),e.showGeometryInFocus!=null&&(e.showGeometryInFocus?this.core.getSystems().geometryInFocusSystem.showDebug():this.core.getSystems().geometryInFocusSystem.hideDebug()),e.showImageLOD!=null&&(this.core.getSystems().imageSystem.debugLOD=e.showImageLOD,this.core.render()),e.showModelInstancingStats!=null&&(e.showModelInstancingStats?this.core.getSystems().modelSystem.showDebug():this.core.getSystems().modelSystem.hideDebug()),e.showScreenOffsets!=null&&(e.showScreenOffsets?this.core.camera.showScreenOffsetsDebug():this.core.camera.hideScreenOffsetsDebug()),e.showCameraTargets!=null&&(e.showCameraTargets?this.core.camera.showCameraTargetsDebug():this.core.camera.hideCameraTargetsDebug()),"focusOn"in e){let t=e.focusOn;t===!1||t==null?this.core.camera.hideFocusOnDebug():this.core.camera.showFocusOnDebug(t)}}};f();var Gn=9,Bg=!1,wh=.1,Th=9;function Gg(){return typeof window<"u"&&window.__MAPPEDIN_E2E__===!0}function kg(n,e,t){for(let r=0;r<e;r++){let o=(t&16711680)>>16,i=(t&65280)>>8,s=t&255;n[r*3]=o/255,n[r*3+1]=i/255,n[r*3+2]=s/255}}var Wi=class{state;renderer;renderService;pickingTexture;pickingMaterial;pixelBuffer;width=0;height=0;scale=1/2;color=1;convertTo3DMapPosition;destroyed=!1;enabled=!1;backgroundId=16777215;applyId(e,t){let r=e.attributes.position,o=new Float32Array(r.count*3);kg(o,r.count,t),e.setAttribute("color",new ke(o,3))}createOccluderMesh(e,t){let r=new V(e,this.pickingMaterial);return r.layers.set(Gn),this.applyId(r.geometry,t),r.userData.occluderId=t,r}constructor(e,t,r){if(this.state=e,this.convertTo3DMapPosition=t,r?.renderer==null)throw new Error("No Renderer");this.renderService=r,this.renderer=r.renderer,this.resize(),this.pickingMaterial=new $e({glslVersion:ql,vertexShader:`
|
|
777
|
+
}`;var ph="data:image/png;base64,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";f();var Ni=new O,Bi=new O,Yr=new O,mh=new O,Xt=new O,Ig=.5,Og=2;function Lg(n,e,t){let r=n.x-e.x,o=n.y-e.y,i=n.z-e.z,s=t.x-e.x,a=t.y-e.y,l=t.z-e.z,c=r*s+o*a+i*l,u=Math.sqrt(r*r+o*o+i*i),d=Math.sqrt(s*s+a*a+l*l);if(u===0||d===0)return 0;let h=c/(u*d),g=Math.max(-1,Math.min(1,h));return Math.acos(g)}function gh(n,e=20){if(n.length<3||e<=0)return n;let t=e,r=e/2,o=[n[0]];for(let i=1;i<n.length-1;i++){let s=n[i],a=n[i-1],l=n[i+1],c=s.distanceTo(a),u=s.distanceTo(l);c>t&&(Xt.subVectors(s,a).normalize(),Yr.set(s.x-Xt.x*r,s.y-Xt.y*r,s.z-Xt.z*r),o.push(Yr.clone())),o.push(s),u>t&&(Xt.subVectors(l,s).normalize(),Yr.set(s.x+Xt.x*r,s.y+Xt.y*r,s.z+Xt.z*r),o.push(Yr.clone()))}return o.push(n[n.length-1]),o}var fh=.0025;function yh(n,e,t,r=Math.PI*2/3){if(n.length<3||e<=0||t<=0)return n;let o=[n[0]];for(let i=1;i<n.length-1;i++){let s=n[i-1],a=n[i],l=n[i+1],c=a.distanceToSquared(s),u=a.distanceToSquared(l);if(c<fh||u<fh){o.push(a);continue}if(Lg(s,a,l)<r){Ni.subVectors(a,s).normalize(),Bi.subVectors(l,a).normalize();let h=Math.sqrt(c),g=Math.sqrt(u),b=Math.max(Ig,Math.min(Og,e)),M=Math.min(b,h*.5),m=Math.min(b,g*.5);Yr.set(a.x-Ni.x*M,a.y-Ni.y*M,a.z-Ni.z*M),mh.set(a.x+Bi.x*m,a.y+Bi.y*m,a.z+Bi.z*m),o.push(Yr.clone(),mh.clone())}else o.push(a)}return o.push(n[n.length-1]),o}var Mr=8,qa=Rt,Ag=new Mo,Gi=new O,bh={h:0,s:0,l:0};function Ja(n,e,t=.2){return n.getHSL(bh),e.copy(n).offsetHSL(0,-bh.s*t,0)}function Ka(n,e){n.stencilWrite=e,e&&(n.stencilRef=qe.PATH,n.stencilFunc=ur,n.stencilZPass=ln,n.stencilZFail=le,n.stencilFail=le)}function Qa(n){return n===!1?-1:n===!0?0:Math.sin(n*Math.PI/180)}function xh(n,e,t){if(n.length<2){let A=new He;return A.userData={entityId:"",type:"path"},{mesh:A,material:null,center:new O}}let{breakpoint:r,width:o,accentColor:i,completeFraction:s,isVertical:a,visibleThroughGeometry:l,dashed:c,highlightCompleteFraction:u,highlightStartFraction:d,highlightEndFraction:h,highlightColor:g,highlightWidthMultiplier:b,highlightDisplayArrowsOnPath:M,travelledEndFraction:m,travelledColor:p,xrayOpacity:y,xrayStyle:v,__EXPERIMENTAL_BILLBOARDING:x,__EXPERIMENTAL_PREVENT_SELF_OVERLAP:S}=e,{color:w}=t,D=!0,C=0,T=1/0,P=e.displayArrowsOnPath,I=!0,L,N;if(sr(o)){let A=At(o)/2;L=A,N=A}else if(typeof o=="object"){let A=e.parsedOutputValues;L=A[r]/2,N=(A[r+1]??A[r])/2}else L=o/2,N=o/2;let z=e.__EXPERIMENTAL_GEOMETRY==="ribbon",j=z?Qa(x):-1,H=(t.altitude??0)+Rg,Q=0;n[0].z+=H;for(let A=1;A<n.length;++A){n[A].z+=H;let R=n[A].x-n[A-1].x,ee=n[A].z-n[A-1].z;if(a)Q+=Math.sqrt(R*R+ee*ee);else{let ao=n[A].y-n[A-1].y;Q+=Math.sqrt(R*R+ao*ao+ee*ee)}}let G=n,J=e.smoothingCornerRadius??Mt.cornerRadius,ne=e.smoothingTension??Mt.tension,je=J>0&&ne>0;je&&(G=gh(G),G=yh(G,J,ne));let[ye,be]=e.__EXPERIMENTAL_ENDCAP_EXTENSION;if((ye>0||be>0)&&!a&&!z){let A=G[0],R=G[G.length-1],ee=je?.01:-.01;G.push(R.clone().setZ(R.z+ee)),G.unshift(A.clone().setZ(A.z+ee))}if(z&&!a&&G.length>=2){if(ye>0){let A=G[0],R=G[1];Gi.subVectors(R,A).normalize();let ee=A.clone().addScaledVector(Gi,-ye);G.unshift(ee)}if(be>0){let A=G[G.length-1],R=G[G.length-2];Gi.subVectors(A,R).normalize();let ee=A.clone().addScaledVector(Gi,be);G.push(ee)}}let Ze=Ag.load(ph);Ze.colorSpace=lr;let Qe=new k(w),mt=new k(i),et=e.__EXPERIMENTAL_BORDER,It=et?.enabled??!1,Fe=et?.color==="darken",Xe=et?.width??.1,ft=Fe?Qe.clone().multiplyScalar(.6):new k(et?.color??"#000000"),Se={vertexes:{type:"f",value:1},resolution:{type:"v2",value:new V(1,1)},cameraParameters:{type:"v2",value:new V(C,0)},complete:{type:"f",value:D?0:1},color:{type:"c",value:Qe},pathLength:{type:"f",value:Q},nearRadius:{type:"f",value:L},farRadius:{type:"f",value:N},nearZoom:{type:"f",value:C},farZoom:{type:"f",value:T},pulseColor:{type:"c",value:mt},pulse:{type:"f",value:0},pulseLength:{type:"f",value:.075},pathIsVertical:{type:"b",value:a},arrowAnimationTimer:{type:"f",value:0},arrowTexture:{type:"t",value:Ze},displayArrowsOnPath:{type:"b",value:P},showPulse:{type:"b",value:I},opacityMultiplier:{type:"f",value:1},dashed:{type:"b",value:c},xrayDithering:{type:"f",value:0},highlightCompleteFraction:{type:"f",value:u},highlightStartFraction:{type:"f",value:d},highlightEndFraction:{type:"f",value:h},highlightColor:{type:"c",value:new k(g)},highlightWidthMultiplier:{type:"f",value:b},highlightDisplayArrowsOnPath:{type:"b",value:M},travelledEndFraction:{type:"f",value:m},travelledColor:{type:"c",value:new k(p)},dashLength:{type:"f",value:e.dashLength},dashGap:{type:"f",value:e.dashGap},dashRelativeToWidth:{type:"b",value:e.dashRelativeToWidth},dashSize:{type:"f",value:e.dashSize},gapSize:{type:"f",value:e.gapSize},dashAbsolute:{type:"b",value:e.dashAbsolute},dashMeters:{type:"f",value:e.dashMeters},gapMeters:{type:"f",value:e.gapMeters},isRibbon:{type:"b",value:z},billboardThreshold:{type:"f",value:j},borderEnabled:{type:"b",value:It},borderColor:{type:"c",value:ft},borderWidth:{type:"f",value:Xe},borderUseDarken:{type:"b",value:Fe},endcapEnabled:{type:"v2",value:new V(z&&ye>0?1:0,z&&be>0?1:0)},cameraViewMatrix:{type:"m4",value:new Y},screenSpace:{type:"b",value:e.screenSpace},metersPerPixel:{type:"f",value:1}};if(je&&G.length>=2){let A=G[0],R=G[1],ee=G[G.length-1],ao=G[G.length-2],Rp=A.clone().sub(R).normalize(),_p=A.clone().add(Rp.multiplyScalar(vh));G.unshift(_p);let Fp=ee.clone().sub(ao).normalize(),Np=ee.clone().add(Fp.multiplyScalar(vh));G.push(Np)}let Ye=new ic(G);Ye.curveType="catmullrom",Ye.tension=je?ne:0;let Ne=z&&je,er=new _i(Ye,G.length,Ne),Be=_g*G.length,de=z?new Ri(er,{segments:Be,billboarded:j>=0}):new sc(er,Be,L,Mr,!1),ro=new Float32Array(de.attributes.position.count),wr=new ke(ro,1);if(z)for(let A=0;A<=Be;A++){let R=A/Be;wr.setX(A*2,R),wr.setX(A*2+1,R)}else for(let A=0;A<=Be;A++){let R=A/Be;for(let ee=0;ee<=Mr;ee++)wr.setX(A*(Mr+1)+ee,R)}de.setAttribute("pathDistance",wr);let ws=new Float32Array(de.attributes.position.count*3),tr=new ke(ws,3),Ot,st,Tr,rn,no;if(z){let A=de;for(let R=0;R<=Be;R++)st=R*3,Tr=A.tangentData[st],rn=A.tangentData[st+1],no=A.tangentData[st+2],tr.setXYZ(R*2,Tr,rn,no),tr.setXYZ(R*2+1,Tr,rn,no)}else{let A=de;for(let R=0;R<=Be;R++){Ot=A.tangents[R];for(let ee=0;ee<=Mr;ee++)tr.setXYZ(R*(Mr+1)+ee,Ot.x,Ot.y,Ot.z)}}de.setAttribute("pathTangent",tr);let oo=new Float32Array(de.attributes.position.count*3),gt=new ke(oo,3),rr,nr,or,tt=new O,Rl=A=>{a?(rr=A.x*A.y,nr=-1+A.y*A.y,or=A.z*A.y):(rr=-A.x*A.z,nr=-A.y*A.z,or=1-A.z*A.z);let R=Math.sqrt(rr*rr+nr*nr+or*or);return R===0&&(R=1),tt.set(rr/R,nr/R,or/R),tt},io={x:0,y:0,z:0};if(z){let A=de;for(let R=0;R<=Be;R++)st=R*3,io.x=A.tangentData[st],io.y=A.tangentData[st+1],io.z=A.tangentData[st+2],Rl(io),gt.setXYZ(R*2,tt.x,tt.y,tt.z),gt.setXYZ(R*2+1,tt.x,tt.y,tt.z)}else{let A=de;for(let R=0;R<=Be;R++){Ot=A.tangents[R],Rl(Ot);for(let ee=0;ee<=Mr;ee++)gt.setXYZ(R*(Mr+1)+ee,tt.x,tt.y,tt.z)}}de.setAttribute("pathNormal",gt);let so=new $e({uniforms:Se,vertexShader:Fi,fragmentShader:$a,side:qa});so.transparent=!0,so.alphaTest=.5,Se.resolution.value.x=1,Se.resolution.value.y=1,Se.vertexes.value=de.attributes.position.count,Se.arrowTexture.value.wrapS=sn,Se.arrowTexture.value.wrapT=sn,Se.arrowTexture.value.anisotropy=16;let Pe=new W(de,so);Pe.name="path";let yt=Pe.clone();yt.name="xray";let Lp=v?.color?new k(v.color):Qe,Ap=Ja(Lp,new k,v?.tint),bt={...Se,color:{type:"c",value:Ap},opacityMultiplier:{type:"f",value:y},pathIsVertical:{type:"b",value:a},xrayDithering:{type:"f",value:v?.dithering??0}};bt.complete.value=1,yt.material=new $e({uniforms:bt,vertexShader:Fi,fragmentShader:$a,side:qa,transparent:!0}),yt.material.alphaTest=.5,yt.material.depthWrite=!1,yt.material.depthTest=!1,Ka(yt.material,S),bt.resolution.value.x=1,bt.resolution.value.y=1,bt.vertexes.value=de.attributes.position.count,bt.arrowTexture.value.wrapS=sn,bt.arrowTexture.value.wrapT=sn,bt.arrowTexture.value.anisotropy=16,bt.complete.value=s,Pe.userData=yt.userData=e.mesh.userData;let nn=e.mesh;if(!l){let A=new $e({uniforms:Se,vertexShader:Fi,fragmentShader:hh,side:qa}),R=new W(de,A);R.name="stencil",R.material.colorWrite=!1,R.material.stencilWrite=!0,R.material.stencilRef=qe.PATH,R.material.stencilFunc=Ir,R.material.stencilZPass=ln,R.material.stencilZFail=le,R.material.stencilFail=le,R.material.depthWrite=!1,R.material.depthTest=!0,R.userData=e.mesh.userData,nn.add(R),nn.add(yt),yt.renderOrder=ue.XRAY_PATH,Pe.renderOrder=ue.STENCIL_PATH}if(nn.add(Pe),a){let A=new ce().setFromObject(Pe),R=new O;A.getCenter(R),nn.children.forEach(ee=>{ee.geometry.center(),ee.position.copy(R)})}l&&(Pe.material.stencilWrite=!0,Pe.material.stencilRef=qe.PATH,Pe.material.stencilFunc=ur,Pe.material.stencilZPass=le,Pe.material.stencilZFail=le,Pe.material.stencilFail=le,Pe.material.needsUpdate=!0,Pe.layers.disableAll(),Pe.layers.enable(ue.ALWAYS_ON_TOP_PATHS)),de.computeBoundingBox();let _l=new O;return de.boundingBox.getCenter(_l),{mesh:nn,material:so,center:_l}}var Rg=.15,_g=30,vh=.01;var Fg=.5,Sh=new k,Fn=class extends Z{rendererState;verticalDistanceDirty=!0;convertTo3DMapPosition;getParentContainer;convertZoomLevelToAltitude;constructor(e,t,r,o){super(),this.rendererState=e,this.convertTo3DMapPosition=t,this.getParentContainer=r,this.convertZoomLevelToAltitude=o}update(e,t,r,o){let i=!1;for(let s of this.rendererState.geometry3DsInScene)if(s&&s.type==="path"&&s.components[0].type==="path"){let a=s.components[0],l=s.components[1],c=a.isVertical&&this.verticalDistanceDirty;if(!(a instanceof fr))continue;let u=[];if(a.dirty||l.dirty||c){if(a.mesh.parent!=null)for(let d=a.mesh.children.length-1;d>=0;d--)ve(a.mesh.children[0]);if(a.feature.features.length===2&&a.feature.features[0].properties.parentId&&a.feature.features[1].properties.parentId){let d=a.feature.features[0],h=a.feature.features[a.feature.features.length-1],g,b,M=d.geometry.coordinates[2]||0,m=h.geometry.coordinates[2]||0;d.properties.parentId&&(g=this.getParentContainer(d.properties.parentId,!0),g!=null&&g.altitude!=null&&(M+=g.altitude,a.isVertical=!0)),h.properties.parentId&&(b=this.getParentContainer(h.properties.parentId,!0),b!=null&&b.altitude!=null&&(m+=b.altitude,a.isVertical=!0));let p=this.convertTo3DMapPosition(d.geometry.coordinates[1],d.geometry.coordinates[0],M),y=this.convertTo3DMapPosition(h.geometry.coordinates[1],h.geometry.coordinates[0],m);Math.abs(p.z-y.z)>Fg&&g!=null&&g.visible&&b!=null&&b.visible&&(u=[p,y])}else{let d=a.feature.features;for(let h=0;h<d.length;h++)if(h===0||!Ec(d[h].geometry.coordinates,d[h-1].geometry.coordinates)){let g=this.convertTo3DMapPosition(d[h].geometry.coordinates[1],d[h].geometry.coordinates[0],d[h].geometry.coordinates[2]||0);u.push(g)}}if(u.length>1){let{mesh:d,material:h,center:g}=xh(u,a,{color:l.color,altitude:l.altitude,isVertical:a.isVertical});a.mesh=d,a.material=h,a.position=g}a.dirty&&typeof a.width=="object"&&a.width.on==="zoom-level"&&(a.altitudeBreakpoints=a.width.input.map(d=>this.convertZoomLevelToAltitude(d))),a.dirty=!1}l.dirty&&(a.mesh.children.forEach(d=>{d.name!=="stencil"&&(d.name==="xray"?Ch(l.color,a,d.material.uniforms.color.value):d.material.uniforms.color.value.set(l.color),d.material.visible=l.visible,d.material.needsUpdate=!0,d.name!=="xray"&&a.__EXPERIMENTAL_BORDER?.color==="darken"&&d.material.uniforms.borderColor.value.copy(d.material.uniforms.color.value).multiplyScalar(.6))}),a.mesh.position.z=l.altitude,l.dirty=!1),a.material&&(a.mesh.children.forEach(d=>{let h=d.material.uniforms;if(d.name==="stencil"){a.materialDirty&&Mh(a,d.material);return}if(a.materialDirty&&d.name==="xray"&&h.opacityMultiplier&&(h.opacityMultiplier.value=a.xrayOpacity,h.xrayDithering.value=a.xrayStyle?.dithering??0,Ch(l.color,a,h.color.value),Ka(d.material,a.__EXPERIMENTAL_PREVENT_SELF_OVERLAP)),typeof a.width=="object"&&a.width.on==="zoom-level"){a.altitudeBreakpoints&&a.altitudeBreakpoints.length>2&&_.warn("Path width interpolation does not yet support more than 2 breakpoints! This will be added in a future version. Path width will only use the first two breakpoints.");let g=kl(r,a.altitudeBreakpoints?.slice(0,2)??[e,t]);a.breakpoint=g,h.nearZoom.value=a.altitudeBreakpoints?.[g]??e,h.farZoom.value=a.altitudeBreakpoints?.[g+1]??t;let b=a.parsedOutputValues;h.nearRadius.value=b[g]/2,h.farRadius.value=(b[g+1]??b[g])/2}if(h.cameraParameters.value.x=r,h.metersPerPixel.value=o,h.cameraViewMatrix.value.copy(this.rendererState.cameraObject.matrixWorldInverse),a.materialDirty){h.displayArrowsOnPath.value=a.displayArrowsOnPath,h.pulseColor.value.set(a.accentColor),h.complete.value=a.completeFraction,Mh(a,d.material),h.dashed.value=a.dashed,h.dashLength.value=a.dashLength,h.dashGap.value=a.dashGap,h.dashRelativeToWidth.value=a.dashRelativeToWidth,h.dashSize.value=a.dashSize,h.gapSize.value=a.gapSize,h.dashAbsolute.value=a.dashAbsolute,h.dashMeters.value=a.dashMeters,h.gapMeters.value=a.gapMeters;let g=a.__EXPERIMENTAL_BORDER;h.borderEnabled.value=g?.enabled??!1,h.borderWidth.value=g?.width??.1,g?.color==="darken"?h.borderColor.value.copy(h.color.value).multiplyScalar(.6):h.borderColor.value.set(g?.color??"#000000"),h.borderUseDarken.value=g?.color==="darken",h.billboardThreshold.value=Qa(a.__EXPERIMENTAL_BILLBOARDING);let[b,M]=a.__EXPERIMENTAL_ENDCAP_EXTENSION;if(h.endcapEnabled.value.set(b>0?1:0,M>0?1:0),h.screenSpace.value=a.screenSpace,sr(a.width)){h.nearZoom.value=e,h.farZoom.value=t;let m=At(a.width);h.nearRadius.value=m/2,h.farRadius.value=m/2}else typeof a.width=="number"&&(h.nearZoom.value=e,h.farZoom.value=t,h.nearRadius.value=Number(a.width)/2,h.farRadius.value=Number(a.width)/2)}}),(a.displayArrowsOnPath||a.highlightDisplayArrowsOnPath)&&a.animateArrowsOnPath&&(a.mesh.children.forEach(d=>{d.name!=="stencil"&&(d.material.uniforms.arrowAnimationTimer.value=performance.now()/3e3,d.material.needsUpdate=!0)}),i=!0),a.materialDirty=!1)}this.verticalDistanceDirty=!1,i&&this.publish("animate:path")}};function Mh(n,e){let t=e.uniforms;t.highlightCompleteFraction.value=n.highlightCompleteFraction,t.highlightStartFraction.value=n.highlightStartFraction,t.highlightEndFraction.value=n.highlightEndFraction,t.highlightWidthMultiplier.value=n.highlightWidthMultiplier,t.highlightColor.value.set(n.highlightColor),t.highlightDisplayArrowsOnPath.value=n.highlightDisplayArrowsOnPath,t.travelledEndFraction.value=n.travelledEndFraction,t.travelledColor.value.set(n.travelledColor)}function Ch(n,e,t){let r=e.xrayStyle?.color?Sh.set(e.xrayStyle.color):Sh.set(n);Ja(r,t,e.xrayStyle?.tint)}f();var ki=class{rendererState;dirty=!1;constructor(e){this.rendererState=e}#e;#n;#i;#o=new Y;updateOne(e){if(e instanceof $&&e.components[0]instanceof oe&&e.components[1]instanceof ct&&e.parentObject3D instanceof Ce&&(this.#e=e.components[0],this.#i=e.components[1],!this.#e.detached&&this.#e.shouldDetach&&this.#e.mesh!=null&&this.#e.material instanceof fn&&this.#e.batchedProps!=null)){this.#n=e.parentObject3D,this.#e.visible=!1;let t=this.#i.color,r=this.#i.opacity*Gr(e),o=this.#e.material,i=r??1,s=o.clone({color:t,side:zc(this.#i.side,i),opacity:i,transparent:i<1}),a=new Su(1,this.#e.batchedProps.positionCount,0,s);a.layers.enable(Oe.SHOULD_CAST_SHADOWS);let l=Pu(this.#e,a,this.#o);if(l==null)return;a.userData={entities:{0:e.id},detached:!0},this.#e.instanceIndex=l,s.setColor(this.#e.instanceIndex,new k(t),this.#i.topColor?new k(this.#i.topColor):new k(t)),this.#e.mesh=a,this.#e.currentHeight=-1,this.#e.material=s,this.#n.add(a),this.#e.shouldDetach=!1,this.#e.detached=!0,this.#i.dirty=!0}}update(){if(!this.dirty)return;let e;for(let t of this.rendererState.geometry3DIdsInScene)e=this.rendererState.geometry3DMap.get(t),this.updateOne(e);this.dirty=!1,this.cleanup()}cleanup(){this.#e=void 0,this.#n=void 0,this.#i=void 0}};f();f();var Yt=new Y,Nn=new O,zi=new _t,Bn=new O;function el(n,e,t){let r=e||1e-4,o=r/Math.max(t,1e-4);return n.mesh instanceof Vt?(n.mesh.scale.z=o,n.currentHeight=r,!0):n.batchedProps?.range&&kr(n.mesh)&&n.instanceIndex!==-1?(n.mesh.getMatrixAt(n.instanceIndex,Yt),Yt.decompose(Nn,zi,Bn),Bn.z=o,Yt.compose(Nn,zi,Bn),n.mesh.setMatrixAt(n.instanceIndex,Yt),n.material&&(n.material.repeatYFactor=o),n.currentHeight=r,!0):!1}function Eh(n,e){return kr(n.mesh)&&n.instanceIndex!==-1?(n.mesh.getMatrixAt(n.instanceIndex,Yt),Yt.decompose(Nn,zi,Bn),Nn.z=e,Yt.compose(Nn,zi,Bn),n.mesh.setMatrixAt(n.instanceIndex,Yt),n.altitude=e,!0):!1}var Ui=class{rendererState;dirty=!1;constructor(e){this.rendererState=e}#e;#n;updateOne(e){if(e instanceof $&&e.type==="geometry"&&e.components[1]?.dirty&&(this.#e=e.components[0],this.#n=e.components[1],e.type==="geometry"))if(this.#e.mesh instanceof Vt){let t=!1;this.#n.height!==this.#e.currentHeight&&(t=el(this.#e,this.#n.height,this.#n.initialHeight)),this.#n.altitude!==this.#e.altitude&&(this.#e.mesh.position.z=this.#n.altitude),t&&this.#e.mesh!=null&&this.#e.mesh.geometry.computeBoundingSphere()}else{let t=!1;this.#n.height!==this.#e.currentHeight&&(t=el(this.#e,this.#n.height,this.#n.initialHeight)),this.#n.altitude!==this.#e.altitude&&(t=Eh(this.#e,this.#n.altitude)),t&&this.#e.mesh!=null&&this.#e.mesh.computeBoundingSphere()}}update(){for(let e of this.rendererState.geometry3DsInScene)this.updateOne(e);this.cleanup()}cleanup(){this.#e=void 0,this.#n=void 0}};f();var Ng={showPolygonLabelTextAreaMesh:!1,showEnvMap:!1,showCollisionBoxes:!1,showGeometryInFocus:!1,showImageLOD:!1,showModelInstancingStats:!1,showScreenOffsets:!1,showCameraTargets:!1,focusOn:!1},Hi=class{state=Ng;core;constructor(e){this.core=e}update(e){let t={};for(let r of Object.keys(e))r in this.state&&this.state[r]!==e[r]&&(Object.assign(this.state,{[r]:e[r]}),Object.assign(t,{[r]:e[r]}));this.handleUpdate(t)}handleUpdate(e){if(e.showPolygonLabelTextAreaMesh!=null&&(e.showPolygonLabelTextAreaMesh?this.core.getSystems().text3DSystem.showTextAreaMesh():this.core.getSystems().text3DSystem.hideTextAreaMesh()),e.showEnvMap!=null&&(e.showEnvMap?this.core.setEnvironment("basic"):this.core.setEnvironment(!1)),e.showCollisionBoxes!=null&&(e.showCollisionBoxes?this.core.showCollisionBoxes():this.core.hideCollisionBoxes()),e.showGeometryInFocus!=null&&(e.showGeometryInFocus?this.core.getSystems().geometryInFocusSystem.showDebug():this.core.getSystems().geometryInFocusSystem.hideDebug()),e.showImageLOD!=null&&(this.core.getSystems().imageSystem.debugLOD=e.showImageLOD,this.core.render()),e.showModelInstancingStats!=null&&(e.showModelInstancingStats?this.core.getSystems().modelSystem.showDebug():this.core.getSystems().modelSystem.hideDebug()),e.showScreenOffsets!=null&&(e.showScreenOffsets?this.core.camera.showScreenOffsetsDebug():this.core.camera.hideScreenOffsetsDebug()),e.showCameraTargets!=null&&(e.showCameraTargets?this.core.camera.showCameraTargetsDebug():this.core.camera.hideCameraTargetsDebug()),"focusOn"in e){let t=e.focusOn;t===!1||t==null?this.core.camera.hideFocusOnDebug():this.core.camera.showFocusOnDebug(t)}}};f();var Gn=9,Bg=!1,wh=.1,Th=9;function Gg(){return typeof window<"u"&&window.__MAPPEDIN_E2E__===!0}function kg(n,e,t){for(let r=0;r<e;r++){let o=(t&16711680)>>16,i=(t&65280)>>8,s=t&255;n[r*3]=o/255,n[r*3+1]=i/255,n[r*3+2]=s/255}}var Vi=class{state;renderer;renderService;pickingTexture;pickingMaterial;pixelBuffer;width=0;height=0;scale=1/2;color=1;convertTo3DMapPosition;destroyed=!1;enabled=!1;backgroundId=16777215;applyId(e,t){let r=e.attributes.position,o=new Float32Array(r.count*3);kg(o,r.count,t),e.setAttribute("color",new ke(o,3))}createOccluderMesh(e,t){let r=new W(e,this.pickingMaterial);return r.layers.set(Gn),this.applyId(r.geometry,t),r.userData.occluderId=t,r}constructor(e,t,r){if(this.state=e,this.convertTo3DMapPosition=t,r?.renderer==null)throw new Error("No Renderer");this.renderService=r,this.renderer=r.renderer,this.resize(),this.pickingMaterial=new $e({glslVersion:ql,vertexShader:`
|
|
778
778
|
attribute vec3 color;
|
|
779
779
|
varying vec3 vColor;
|
|
780
780
|
void main() {
|
|
@@ -788,7 +788,7 @@ void main(void) {
|
|
|
788
788
|
void main() {
|
|
789
789
|
fragColor = vec4(vColor, 1.0);
|
|
790
790
|
}
|
|
791
|
-
`})}reserveOccluderId(){return this.color++,this.color}enable(){this.enabled=!0}disable(){this.enabled=!1}resize=()=>{let e=this.state.pixelRatio;this.width=Math.floor(this.renderer.domElement.width/e*this.scale),this.height=Math.floor(this.renderer.domElement.height/e*this.scale),this.pixelBuffer=new Uint8Array(4*this.width*this.height),this.pickingTexture=new cn(this.width,this.height,{format:Xl,type:jl,internalFormat:"RGBA"})};shouldShowByXY=(e,t,r)=>{if(this.pixelBuffer==null)return!1;let o=e+(this.height-t-1)*this.width,i=this.pixelBuffer[o*4],s=this.pixelBuffer[o*4+1],a=this.pixelBuffer[o*4+2],l=i<<16|s<<8|a;return l===r||l===this.backgroundId};activeOccluders=new Set;framesSinceLastUpdate=Th;update=()=>{if(Gg()){this.updateImmediately();return}this.framesSinceLastUpdate++,this.framesSinceLastUpdate>=Th&&(this.framesSinceLastUpdate=0,this.updateImmediately())};updateImmediately=()=>{if(!this.enabled||this.destroyed||(this.activeOccluders.clear(),this.activeOccluders.add(this.backgroundId),!this.pickingTexture||!this.pixelBuffer))return;let e,t;for(let o of this.state.geometry3DsInScene)if(o?.type==="group-container"&&o.userData.occluderFeature!=null&&o.userData.occluderId!=null&&(this.activeOccluders.add(o.userData.occluderId),o.userData.occluderDirty)){if(e=o.userData.occluderFeature,e.geometry.type==="Polygon"&&e.geometry.coordinates.length>0){let i=jo(e,this.convertTo3DMapPosition,{color:"white",height:wh});t=this.createOccluderMesh(i,o.userData.occluderId),o.add(t)}else if(e.geometry.type==="MultiPolygon"){let i=Zo(e,this.convertTo3DMapPosition,{color:"white",height:wh});t=this.createOccluderMesh(i,o.userData.occluderId),o?.add(t)}o.userData.occluderDirty=!1}this.renderer.setRenderTarget(this.pickingTexture);let r=new k(this.backgroundId);this.renderer.setClearColor(r),this.renderer.clear(),this.state.cameraObject.layers.disableAll(),this.state.cameraObject.layers.enable(Gn),this.renderService.renderScene(this.state.geometryScene.parent,this.state.cameraObject),this.renderer.setRenderTarget(null),this.state.cameraObject.layers.disable(Gn),Bg?this.renderService.enabledLayers.add(Gn):this.renderService.enabledLayers.delete(Gn),this.renderer.readRenderTargetPixelsAsync(this.pickingTexture,0,0,this.width,this.height,this.pixelBuffer).then(()=>{if(!this.destroyed)for(let o of this.state.geometry2DsInScene){let i=o?.components[2];if(o&&i?.id!=null&&this.activeOccluders.has(i.id)&&i?.enabled){let s=o.components[0].projection,a=Math.floor(s.x*this.scale),l=Math.floor(s.y*this.scale),c=this.shouldShowByXY(a,l,i.id);o.components[0].isOccluded=!c}else o&&i&&!i.enabled&&(o.components[0].isOccluded=!1)}}).catch(o=>{this.destroyed||_.error(o)})};destroy(){this.destroyed=!0,this.pickingTexture?.dispose(),this.pickingMaterial.dispose(),this.pickingTexture=void 0,this.pixelBuffer=void 0}};f();var Vi=class{constructor(e){this.state=e}dirty=!0;update(){if(this.dirty){for(let e of this.state.geometry3DIdsInScene){let t=this.state.geometry3DMap.get(e);if(t instanceof $&&t.type==="geometry"&&t.components[0]?.geometry!=null){let r=t.components[0];if(r.mesh instanceof Wt)continue;r.geometry&&(r.geometry.dispose(),r.geometry=void 0)}}this.dirty=!1}}};f();var ji=class extends Z{dirty=!0;state;constructor(e){super(),this.state=e}texturePromiseCache=new Map;async loadTexture(e){if(this.texturePromiseCache.has(e))return this.texturePromiseCache.get(e);let t=new Promise((r,o)=>{Vt.getLoader().load(e,r,void 0,o)});return this.texturePromiseCache.set(e,t),t}update(){for(let e of this.state.geometry3DsInScene){if(!(e instanceof $))continue;let t=e.components[6];if(!(t instanceof pr))continue;let r=e.components[0];if(!(r instanceof oe)||!t.dirty)continue;let o=mn(r);o!=null&&(t.texture!=null&&(t.texture.path===""?(o.texture=null,o.hideTextures(r.instanceIndex),t.dirty=!1):this.loadTexture(t.texture.path).then(i=>{i&&(t.textureInstance=i,o.texture=i,o.blendTexture=!0,o.showTextures(r.instanceIndex)),this.publish("texture-added")})),t.topTexture!=null&&(t.topTexture.path===""?(o.topTexture=null,o.hideTextures(r.instanceIndex),t.dirty=!1):this.loadTexture(t.topTexture.path).then(i=>{i&&(t.topTextureInstance=i,o.topTexture=i,o.blendTexture=!0,o.showTextures(r.instanceIndex)),this.publish("texture-added")})),t.dirty=!1)}}destroy(){this.texturePromiseCache.forEach(async e=>{(await e).dispose()}),this.texturePromiseCache.clear()}};f();var Zi=class{currentOrder=ue.ALWAYS_ON_TOP_MODELS;assignedOrders=new WeakMap;state;constructor(e){this.state=e}assignOrder(e){return this.assignedOrders.has(e)?this.assignedOrders.get(e):(this.currentOrder+=1,this.assignedOrders.set(e,this.currentOrder),this.currentOrder)}releaseOrder(e){return this.assignedOrders.delete(e),ue.GEOMETRY}getHighestOrder(){return this.currentOrder}getOrder(e){return this.assignedOrders.get(e)}update(){let e,t;for(let r of this.state.geometry3DsInScene)if(r&&r.type==="model"&&(e=r.components[1],e?.renderOrderDirty)){if(t=r.components[0],!t.mesh)continue;if(t.visibleThroughGeometry=e.visibleThroughGeometry,e.visibleThroughGeometry===!0){let o=this.assignOrder(t);t.renderOrder=o,this.applyRenderOrder(t)}else t.renderOrder>ue.GEOMETRY&&(t.renderOrder=this.releaseOrder(t),this.applyRenderOrder(t));e.renderOrderDirty=!1}}applyRenderOrder(e){if(!e.mesh)return;let t=e.renderOrder,r=e.visibleThroughGeometry;if(e.mesh.children[0]instanceof K){e.mesh.renderOrder=t;for(let i of e.mesh.children)i instanceof K&&(i.renderOrder=t);if(e.mesh.userData?.detached)for(let i of e.mesh.children)i instanceof K&&(Array.isArray(i.material)?i.material.forEach(s=>{s.depthWrite=!r,s.depthTest=!r,r&&(s.transparent=!0),s.needsUpdate=!0}):(i.material.depthWrite=!r,i.material.depthTest=!r,r&&(i.material.transparent=!0),i.material.needsUpdate=!0))}else e.mesh.traverse(o=>{let i=o;"isMesh"in i&&i.isMesh===!0&&i.material&&(i.renderOrder=t,Array.isArray(i.material)?i.material.forEach(s=>{s.depthWrite=!r,s.depthTest=!r,r&&(s.transparent=!0),s.needsUpdate=!0}):(i.material.depthWrite=!r,i.material.depthTest=!r,r&&(i.material.transparent=!0),i.material.needsUpdate=!0))})}};f();var Xi=class n{state;constructor(e){this.state=e}applyMask(e,t,r){this.disableMask(e,t),r.mode==="mask"&&r.maskId!=null&&r.enabled?this.enableMaskProducer(e,t,r):r.mode==="masked-object"&&r.maskId!=null&&r.enabled&&this.enableMaskReciever(e,r)}update(){let e;for(let t of this.state.geometry3DsInScene)t?.type==="feature-collection"&&(!Tn(t,this.state)||wn(t)&&Tn(t,this.state))&&(e=t.components[0],e?.dirty&&(t.traverse(r=>{(r instanceof V||r instanceof Bt)&&r.material instanceof Ql&&e!=null&&!r.userData.detached&&(this.disableMask(r.material,r),this.applyMask(r.material,r,e))}),e.dirty=!1))}static MASK_RENDER_ORDER=-1e3;enableMaskProducer(e,t,r){e.stencilWrite=!0,e.colorWrite=!1,e.stencilRef=r.maskId,e.stencilFunc=Ir,e.stencilZPass=ln,e.stencilZFail=le,e.stencilFail=le,e.needsUpdate=!0,e.depthWrite=!1,t.userData.originalTransparent===void 0&&(t.userData.originalTransparent=e.transparent),e.transparent=!1,t.layers.disableAll(),t.layers.set(ue.GEOMETRY),t.userData.originalRenderOrder===void 0&&(t.userData.originalRenderOrder=t.renderOrder),t.renderOrder=n.MASK_RENDER_ORDER}enableMaskReciever(e,t){e.stencilWrite=!0,e.stencilRef=t.maskId,e.stencilFunc=t.effect==="reveal"?bo:ur,e.stencilZPass=le,e.stencilZFail=le,e.stencilFail=le,e.needsUpdate=!0}disableMask(e,t){e.stencilWrite=!1,e.colorWrite=!0,t.userData.originalTransparent!==void 0&&(e.transparent=t.userData.originalTransparent,delete t.userData.originalTransparent),e.needsUpdate=!0,t.layers.disableAll(),t.layers.set(ue.GEOMETRY),t.userData.originalRenderOrder!==void 0&&(t.renderOrder=t.userData.originalRenderOrder,delete t.userData.originalRenderOrder)}};f();var Dh=.5,Yi=class{rendererState;dirty=!1;constructor(e){this.rendererState=e}update(){let e,t,r;for(let o of this.rendererState.geometry3DsInScene)if(t=o.components[0],r=o.components[1],e=o.components[7],o.type==="model"&&e!=null&&r?.EXPERIMENTAL_clippingEnabled&&(e.dirty&&t.mesh!=null&&(e.plane==null&&(e.plane=new tc(new O(0,0,-1),e.verticalOffset),this.process(t,e)),e.plane.constant!==e.verticalOffset&&(e.plane.constant=e.verticalOffset),e.topColor!=null&&e.holeFillMesh?.material instanceof un&&e.holeFillMesh.material.color.set(e.topColor),e.topVisible!=null&&e.holeFillMesh!=null&&(e.holeFillMesh.visible=e.topVisible,e.holeFillGroup!=null&&(e.holeFillGroup.visible=e.topVisible)),e.dirty=!1),e.plane!=null&&e.holeFillMesh!=null&&e.topVisible===!0)){let i=e.holeFillMesh,s=e.verticalOffset,a=e.bboxCenter?.x??0,l=e.bboxCenter?.y??0;i.position.set(a,l,s),i.lookAt(a,l,s+1)}}process(e,t){if(e.mesh==null)return;let r=e.mesh.parent,o=[];e.mesh.traverse(p=>{if(p instanceof V){let y=p.geometry.clone();if(p instanceof K){let v=e.instanceIndex??0,x=new Y;p.getMatrixAt(v,x),y.applyMatrix4(x)}else p.updateWorldMatrix(!0,!1),y.applyMatrix4(p.matrixWorld);o.push(y),y.computeVertexNormals(),p.material.clippingPlanes=[t.plane]}});let i=ze(o),s=new vo,a=new vo;i.computeBoundingBox();let l=i.boundingBox,c=(l.min.x+l.max.x)/2,u=(l.min.y+l.max.y)/2,d=l.max.x-l.min.x+Dh*2,h=l.max.y-l.min.y+Dh*2;t.bboxCenter={x:c,y:u};let g=new Ie(d,h),b=this.createHoleFillGeometry(i,t.plane,1);b.name="hole-fill-group",t.holeFillGroup=b;let M=new un({color:t.topColor??"#E67B5B",clippingPlanes:[],stencilWrite:!0,stencilRef:qe.CLIPPING_BIT,stencilFunc:bo,stencilFuncMask:qe.CLIPPING_BIT,stencilWriteMask:qe.CLIPPING_BIT,stencilFail:le,stencilZFail:le,stencilZPass:$l}),m=new V(g,M);m.name="hole-fill-mesh",t.holeFillMesh=m,m.renderOrder=1.1,a.add(b),a.add(e.mesh),s.add(a),s.add(m),r?.add(s),e.mesh=s}createHoleFillGeometry(e,t,r=0){let o=new vo,i=new Me;i.depthWrite=!1,i.depthTest=!1,i.colorWrite=!1,i.stencilWrite=!0,i.stencilFunc=Ir,i.stencilWriteMask=qe.CLIPPING_BIT;let s=i.clone();s.side=Hl,s.clippingPlanes=[t],s.stencilFail=cr,s.stencilZFail=cr,s.stencilZPass=cr;let a=new V(e,s);a.renderOrder=r,o.add(a);let l=i.clone();l.side=yo,l.clippingPlanes=[t],l.stencilFail=cr,l.stencilZFail=cr,l.stencilZPass=cr;let c=new V(e,l);return c.renderOrder=r,o.add(c),o}};f();var $i=class{plugins=new Set;registerPlugin(e){this.plugins.add(e)}unregisterPlugin(e){this.plugins.delete(e)}update(e){for(let t of this.plugins)t.update(e)}};f();var qi=class{type="occlusion2d";enabled=!0;id;constructor(e){this.id=e}};f();f();f();var Ph=`varying vec4 vWorldPosition;
|
|
791
|
+
`})}reserveOccluderId(){return this.color++,this.color}enable(){this.enabled=!0}disable(){this.enabled=!1}resize=()=>{let e=this.state.pixelRatio;this.width=Math.floor(this.renderer.domElement.width/e*this.scale),this.height=Math.floor(this.renderer.domElement.height/e*this.scale),this.pixelBuffer=new Uint8Array(4*this.width*this.height),this.pickingTexture=new cn(this.width,this.height,{format:Xl,type:jl,internalFormat:"RGBA"})};shouldShowByXY=(e,t,r)=>{if(this.pixelBuffer==null)return!1;let o=e+(this.height-t-1)*this.width,i=this.pixelBuffer[o*4],s=this.pixelBuffer[o*4+1],a=this.pixelBuffer[o*4+2],l=i<<16|s<<8|a;return l===r||l===this.backgroundId};activeOccluders=new Set;framesSinceLastUpdate=Th;update=()=>{if(Gg()){this.updateImmediately();return}this.framesSinceLastUpdate++,this.framesSinceLastUpdate>=Th&&(this.framesSinceLastUpdate=0,this.updateImmediately())};updateImmediately=()=>{if(!this.enabled||this.destroyed||(this.activeOccluders.clear(),this.activeOccluders.add(this.backgroundId),!this.pickingTexture||!this.pixelBuffer))return;let e,t;for(let o of this.state.geometry3DsInScene)if(o?.type==="group-container"&&o.userData.occluderFeature!=null&&o.userData.occluderId!=null&&(this.activeOccluders.add(o.userData.occluderId),o.userData.occluderDirty)){if(e=o.userData.occluderFeature,e.geometry.type==="Polygon"&&e.geometry.coordinates.length>0){let i=jo(e,this.convertTo3DMapPosition,{color:"white",height:wh});t=this.createOccluderMesh(i,o.userData.occluderId),o.add(t)}else if(e.geometry.type==="MultiPolygon"){let i=Zo(e,this.convertTo3DMapPosition,{color:"white",height:wh});t=this.createOccluderMesh(i,o.userData.occluderId),o?.add(t)}o.userData.occluderDirty=!1}this.renderer.setRenderTarget(this.pickingTexture);let r=new k(this.backgroundId);this.renderer.setClearColor(r),this.renderer.clear(),this.state.cameraObject.layers.disableAll(),this.state.cameraObject.layers.enable(Gn),this.renderService.renderScene(this.state.geometryScene.parent,this.state.cameraObject),this.renderer.setRenderTarget(null),this.state.cameraObject.layers.disable(Gn),Bg?this.renderService.enabledLayers.add(Gn):this.renderService.enabledLayers.delete(Gn),this.renderer.readRenderTargetPixelsAsync(this.pickingTexture,0,0,this.width,this.height,this.pixelBuffer).then(()=>{if(!this.destroyed)for(let o of this.state.geometry2DsInScene){let i=o?.components[2];if(o&&i?.id!=null&&this.activeOccluders.has(i.id)&&i?.enabled){let s=o.components[0].projection,a=Math.floor(s.x*this.scale),l=Math.floor(s.y*this.scale),c=this.shouldShowByXY(a,l,i.id);o.components[0].isOccluded=!c}else o&&i&&!i.enabled&&(o.components[0].isOccluded=!1)}}).catch(o=>{this.destroyed||_.error(o)})};destroy(){this.destroyed=!0,this.pickingTexture?.dispose(),this.pickingMaterial.dispose(),this.pickingTexture=void 0,this.pixelBuffer=void 0}};f();var Wi=class{constructor(e){this.state=e}dirty=!0;update(){if(this.dirty){for(let e of this.state.geometry3DIdsInScene){let t=this.state.geometry3DMap.get(e);if(t instanceof $&&t.type==="geometry"&&t.components[0]?.geometry!=null){let r=t.components[0];if(r.mesh instanceof Vt)continue;r.geometry&&(r.geometry.dispose(),r.geometry=void 0)}}this.dirty=!1}}};f();var ji=class extends Z{dirty=!0;state;constructor(e){super(),this.state=e}texturePromiseCache=new Map;async loadTexture(e){if(this.texturePromiseCache.has(e))return this.texturePromiseCache.get(e);let t=new Promise((r,o)=>{Wt.getLoader().load(e,r,void 0,o)});return this.texturePromiseCache.set(e,t),t}update(){for(let e of this.state.geometry3DsInScene){if(!(e instanceof $))continue;let t=e.components[6];if(!(t instanceof pr))continue;let r=e.components[0];if(!(r instanceof oe)||!t.dirty)continue;let o=mn(r);o!=null&&(t.texture!=null&&(t.texture.path===""?(o.texture=null,o.hideTextures(r.instanceIndex),t.dirty=!1):this.loadTexture(t.texture.path).then(i=>{i&&(t.textureInstance=i,o.texture=i,o.blendTexture=!0,o.showTextures(r.instanceIndex)),this.publish("texture-added")})),t.topTexture!=null&&(t.topTexture.path===""?(o.topTexture=null,o.hideTextures(r.instanceIndex),t.dirty=!1):this.loadTexture(t.topTexture.path).then(i=>{i&&(t.topTextureInstance=i,o.topTexture=i,o.blendTexture=!0,o.showTextures(r.instanceIndex)),this.publish("texture-added")})),t.dirty=!1)}}destroy(){this.texturePromiseCache.forEach(async e=>{(await e).dispose()}),this.texturePromiseCache.clear()}};f();var Zi=class{currentOrder=ue.ALWAYS_ON_TOP_MODELS;assignedOrders=new WeakMap;state;constructor(e){this.state=e}assignOrder(e){return this.assignedOrders.has(e)?this.assignedOrders.get(e):(this.currentOrder+=1,this.assignedOrders.set(e,this.currentOrder),this.currentOrder)}releaseOrder(e){return this.assignedOrders.delete(e),ue.GEOMETRY}getHighestOrder(){return this.currentOrder}getOrder(e){return this.assignedOrders.get(e)}update(){let e,t;for(let r of this.state.geometry3DsInScene)if(r&&r.type==="model"&&(e=r.components[1],e?.renderOrderDirty)){if(t=r.components[0],!t.mesh)continue;if(t.visibleThroughGeometry=e.visibleThroughGeometry,e.visibleThroughGeometry===!0){let o=this.assignOrder(t);t.renderOrder=o,this.applyRenderOrder(t)}else t.renderOrder>ue.GEOMETRY&&(t.renderOrder=this.releaseOrder(t),this.applyRenderOrder(t));e.renderOrderDirty=!1}}applyRenderOrder(e){if(!e.mesh)return;let t=e.renderOrder,r=e.visibleThroughGeometry;if(e.mesh.children[0]instanceof K){e.mesh.renderOrder=t;for(let i of e.mesh.children)i instanceof K&&(i.renderOrder=t);if(e.mesh.userData?.detached)for(let i of e.mesh.children)i instanceof K&&(Array.isArray(i.material)?i.material.forEach(s=>{s.depthWrite=!r,s.depthTest=!r,r&&(s.transparent=!0),s.needsUpdate=!0}):(i.material.depthWrite=!r,i.material.depthTest=!r,r&&(i.material.transparent=!0),i.material.needsUpdate=!0))}else e.mesh.traverse(o=>{let i=o;"isMesh"in i&&i.isMesh===!0&&i.material&&(i.renderOrder=t,Array.isArray(i.material)?i.material.forEach(s=>{s.depthWrite=!r,s.depthTest=!r,r&&(s.transparent=!0),s.needsUpdate=!0}):(i.material.depthWrite=!r,i.material.depthTest=!r,r&&(i.material.transparent=!0),i.material.needsUpdate=!0))})}};f();var Xi=class n{state;constructor(e){this.state=e}applyMask(e,t,r){this.disableMask(e,t),r.mode==="mask"&&r.maskId!=null&&r.enabled?this.enableMaskProducer(e,t,r):r.mode==="masked-object"&&r.maskId!=null&&r.enabled&&this.enableMaskReciever(e,r)}update(){let e;for(let t of this.state.geometry3DsInScene)t?.type==="feature-collection"&&(!Tn(t,this.state)||wn(t)&&Tn(t,this.state))&&(e=t.components[0],e?.dirty&&(t.traverse(r=>{(r instanceof W||r instanceof Bt)&&r.material instanceof Ql&&e!=null&&!r.userData.detached&&(this.disableMask(r.material,r),this.applyMask(r.material,r,e))}),e.dirty=!1))}static MASK_RENDER_ORDER=-1e3;enableMaskProducer(e,t,r){e.stencilWrite=!0,e.colorWrite=!1,e.stencilRef=r.maskId,e.stencilFunc=Ir,e.stencilZPass=ln,e.stencilZFail=le,e.stencilFail=le,e.needsUpdate=!0,e.depthWrite=!1,t.userData.originalTransparent===void 0&&(t.userData.originalTransparent=e.transparent),e.transparent=!1,t.layers.disableAll(),t.layers.set(ue.GEOMETRY),t.userData.originalRenderOrder===void 0&&(t.userData.originalRenderOrder=t.renderOrder),t.renderOrder=n.MASK_RENDER_ORDER}enableMaskReciever(e,t){e.stencilWrite=!0,e.stencilRef=t.maskId,e.stencilFunc=t.effect==="reveal"?bo:ur,e.stencilZPass=le,e.stencilZFail=le,e.stencilFail=le,e.needsUpdate=!0}disableMask(e,t){e.stencilWrite=!1,e.colorWrite=!0,t.userData.originalTransparent!==void 0&&(e.transparent=t.userData.originalTransparent,delete t.userData.originalTransparent),e.needsUpdate=!0,t.layers.disableAll(),t.layers.set(ue.GEOMETRY),t.userData.originalRenderOrder!==void 0&&(t.renderOrder=t.userData.originalRenderOrder,delete t.userData.originalRenderOrder)}};f();var Dh=.5,Yi=class{rendererState;dirty=!1;constructor(e){this.rendererState=e}update(){let e,t,r;for(let o of this.rendererState.geometry3DsInScene)if(t=o.components[0],r=o.components[1],e=o.components[7],o.type==="model"&&e!=null&&r?.EXPERIMENTAL_clippingEnabled&&(e.dirty&&t.mesh!=null&&(e.plane==null&&(e.plane=new tc(new O(0,0,-1),e.verticalOffset),this.process(t,e)),e.plane.constant!==e.verticalOffset&&(e.plane.constant=e.verticalOffset),e.topColor!=null&&e.holeFillMesh?.material instanceof un&&e.holeFillMesh.material.color.set(e.topColor),e.topVisible!=null&&e.holeFillMesh!=null&&(e.holeFillMesh.visible=e.topVisible,e.holeFillGroup!=null&&(e.holeFillGroup.visible=e.topVisible)),e.dirty=!1),e.plane!=null&&e.holeFillMesh!=null&&e.topVisible===!0)){let i=e.holeFillMesh,s=e.verticalOffset,a=e.bboxCenter?.x??0,l=e.bboxCenter?.y??0;i.position.set(a,l,s),i.lookAt(a,l,s+1)}}process(e,t){if(e.mesh==null)return;let r=e.mesh.parent,o=[];e.mesh.traverse(p=>{if(p instanceof W){let y=p.geometry.clone();if(p instanceof K){let v=e.instanceIndex??0,x=new Y;p.getMatrixAt(v,x),y.applyMatrix4(x)}else p.updateWorldMatrix(!0,!1),y.applyMatrix4(p.matrixWorld);o.push(y),y.computeVertexNormals(),p.material.clippingPlanes=[t.plane]}});let i=ze(o),s=new vo,a=new vo;i.computeBoundingBox();let l=i.boundingBox,c=(l.min.x+l.max.x)/2,u=(l.min.y+l.max.y)/2,d=l.max.x-l.min.x+Dh*2,h=l.max.y-l.min.y+Dh*2;t.bboxCenter={x:c,y:u};let g=new Ie(d,h),b=this.createHoleFillGeometry(i,t.plane,1);b.name="hole-fill-group",t.holeFillGroup=b;let M=new un({color:t.topColor??"#E67B5B",clippingPlanes:[],stencilWrite:!0,stencilRef:qe.CLIPPING_BIT,stencilFunc:bo,stencilFuncMask:qe.CLIPPING_BIT,stencilWriteMask:qe.CLIPPING_BIT,stencilFail:le,stencilZFail:le,stencilZPass:$l}),m=new W(g,M);m.name="hole-fill-mesh",t.holeFillMesh=m,m.renderOrder=1.1,a.add(b),a.add(e.mesh),s.add(a),s.add(m),r?.add(s),e.mesh=s}createHoleFillGeometry(e,t,r=0){let o=new vo,i=new Me;i.depthWrite=!1,i.depthTest=!1,i.colorWrite=!1,i.stencilWrite=!0,i.stencilFunc=Ir,i.stencilWriteMask=qe.CLIPPING_BIT;let s=i.clone();s.side=Hl,s.clippingPlanes=[t],s.stencilFail=cr,s.stencilZFail=cr,s.stencilZPass=cr;let a=new W(e,s);a.renderOrder=r,o.add(a);let l=i.clone();l.side=yo,l.clippingPlanes=[t],l.stencilFail=cr,l.stencilZFail=cr,l.stencilZPass=cr;let c=new W(e,l);return c.renderOrder=r,o.add(c),o}};f();var $i=class{plugins=new Set;registerPlugin(e){this.plugins.add(e)}unregisterPlugin(e){this.plugins.delete(e)}update(e){for(let t of this.plugins)t.update(e)}};f();var qi=class{type="occlusion2d";enabled=!0;id;constructor(e){this.id=e}};f();f();f();var Ph=`varying vec4 vWorldPosition;
|
|
792
792
|
|
|
793
793
|
void main() {
|
|
794
794
|
vWorldPosition = modelMatrix * vec4(position, 1.0);
|
|
@@ -916,7 +916,7 @@ void main() {
|
|
|
916
916
|
|
|
917
917
|
`;var Ji=class extends $e{pcfSampleCount=4;constructor(){super({vertexShader:Ph,fragmentShader:`#define PCF_SAMPLES 4
|
|
918
918
|
`+tl,uniforms:{shadowMap:{value:null},lightMatrix:{value:new Y},shadowBias:{value:8e-5},shadowOpacity:{value:.25},baseColor:{value:new k(8421504)},shadowMapSize:{value:4096},pcfSpread:{value:3.5},depthRangeMax:{value:1},shadowEnabled:{value:!1}},transparent:!0,depthWrite:!1,side:Rt,stencilWrite:!0,stencilFunc:ur,stencilRef:qe.UNDERGROUND_MASK,stencilFail:le,stencilZFail:le,stencilZPass:le})}setShadowUniforms(e,t,r,o,i,s,a,l,c,u){this.uniforms.shadowMap.value=e,this.uniforms.lightMatrix.value.copy(t),this.uniforms.shadowBias.value=r,this.uniforms.shadowOpacity.value=o,this.uniforms.baseColor.value=i,this.uniforms.shadowMapSize.value=s,this.uniforms.pcfSpread.value=a,this.uniforms.depthRangeMax.value=c,this.uniforms.shadowEnabled.value=u,l!==this.pcfSampleCount&&(this.pcfSampleCount=l,this.fragmentShader=`#define PCF_SAMPLES ${l}
|
|
919
|
-
`+tl,this.needsUpdate=!0)}};var Je={enabled:!0,debug:!1,baseColor:"#a0a0a0",shadowOpacity:.25,pcfSamples:4,pcfSpread:3,shadowBias:.001,normalBias:.12,shadowMapSize:"auto",sunAzimuth:225,sunElevation:45,visibleAtZoomLevel:18},Ih=1e4,Ug=-.05,Hg=999,
|
|
919
|
+
`+tl,this.needsUpdate=!0)}};var Je={enabled:!0,debug:!1,baseColor:"#a0a0a0",shadowOpacity:.25,pcfSamples:4,pcfSpread:3,shadowBias:.001,normalBias:.12,shadowMapSize:"auto",sunAzimuth:225,sunElevation:45,visibleAtZoomLevel:18},Ih=1e4,Ug=-.05,Hg=999,Vg=4096,Wg=2048,jg=20.5,Zg=19.5,Oh=.1,Xg=400,Yg=-200,$g=50,qg=100,Jg=-50,Kg=40,$r=15,Tt=22,Qg=100,ey=5,ty=50,ry=50,ny=40,oy=5,iy=.5,rl=1,Lh=1,sy=5,fe=256,ay=65535,ly=.5,Ki=.1,cy=1e3,uy=16737792,dy=.2,Ah=.2,hy=1001,py=8900331,nl=!0,Qi=class{state;rendererService;depthMaterial;cameraOrbit;lightCamera;shadowRenderTarget;lightMatrix=new Y;currentSnapX=0;currentSnapY=0;shadowCenter=new O;shadowPlane=null;shadowPlaneMaterial=null;shadowPlaneEnabled=!0;visibleAtCurrentZoom=!0;zoomOpacityFactor=1;lightCameraHelper=null;debugEnabled=!1;debugGrid=null;debugCurrentCell=null;debugCurrentCellMaterial=null;debugCanvas=null;debugCanvasCtx=null;debugRenderTarget=null;debugDepthMaterial=null;debugDepthQuad=null;debugDepthScene=null;debugDepthCamera=null;options;internal;shadowResolutionSizes={high:Vg,low:Wg};shadowResolutionZoomThresholds={high:jg,low:Zg};constructor(e,t,r,o){this.state=e,this.cameraOrbit=r,this.rendererService=t,this.options=Object.freeze({enabled:o?.enabled??Je.enabled,debug:o?.debug??Je.debug,baseColor:o?.baseColor??Je.baseColor,shadowOpacity:o?.shadowOpacity??Je.shadowOpacity,pcfSamples:o?.pcfSamples??Je.pcfSamples,pcfSpread:o?.pcfSpread??Je.pcfSpread,shadowBias:o?.shadowBias??Je.shadowBias,normalBias:o?.normalBias??Je.normalBias,shadowMapSize:o?.shadowMapSize??Je.shadowMapSize,sunAzimuth:o?.sunAzimuth??Je.sunAzimuth,sunElevation:o?.sunElevation??Je.sunElevation,visibleAtZoomLevel:o?.visibleAtZoomLevel??Je.visibleAtZoomLevel});let i=this.options.shadowMapSize==="auto"?this.shadowResolutionSizes.high:this.options.shadowMapSize;this.internal={baseColor:new k(this.options.baseColor),lightOrthoSize:$g,sunDistance:qg,groundZPosition:Jg,snapGridSize:Kg,currentShadowMapSize:i,currentShadowResolutionMode:(this.options.shadowMapSize==="auto",null),sunDirection:new O,sunAzimuth:this.options.sunAzimuth,sunElevation:this.options.sunElevation},this.updateSunDirection(),this.lightCamera=new Ns(-this.internal.lightOrthoSize,this.internal.lightOrthoSize,this.internal.lightOrthoSize,-this.internal.lightOrthoSize,Oh,Xg),this.lightCamera.layers.disableAll(),this.lightCamera.layers.enable(Oe.SHOULD_CAST_SHADOWS),this.lightCamera.position.copy(this.internal.sunDirection.clone().multiplyScalar(Yg)),this.lightCamera.lookAt(new O(0,0,0)),this.lightCamera.updateMatrixWorld(),this.lightCamera.updateProjectionMatrix(),this.shadowRenderTarget=this.createShadowRenderTarget(i),this.depthMaterial=new ac,this.depthMaterial.depthPacking=Yl,this.depthMaterial.blending=Vl,this.createShadowPlane(),this.options.debug&&this.setDebugEnabled(!0)}createShadowRenderTarget(e){let t=new cn(e,e);return t.texture.minFilter=an,t.texture.magFilter=an,t.texture.generateMipmaps=!1,t.depthBuffer=!0,t.stencilBuffer=!1,t.depthTexture=new nc(e,e,Zl),t}resizeShadowRenderTarget(e){this.shadowRenderTarget.setSize(e,e),this.shadowRenderTarget.depthTexture&&(this.shadowRenderTarget.depthTexture.image.width=e,this.shadowRenderTarget.depthTexture.image.height=e,this.shadowRenderTarget.depthTexture.needsUpdate=!0)}createShadowPlane(){let e=new Ie(Ih,Ih);e.rotateX(0),this.shadowPlaneMaterial=new Ji,this.shadowPlane=new W(e,this.shadowPlaneMaterial),this.shadowPlane.position.set(0,0,Ug),this.shadowPlane.renderOrder=Hg,this.shadowPlane.frustumCulled=!1,this.shadowPlane.name="ShadowPlane",this.shadowPlaneEnabled&&this.state.threeJSScene.add(this.shadowPlane)}setShadowPlaneEnabled(e){this.shadowPlaneEnabled!==e&&(this.shadowPlaneEnabled=e,this.shadowPlane&&(e?this.state.threeJSScene.add(this.shadowPlane):this.state.threeJSScene.remove(this.shadowPlane)))}isShadowPlaneEnabled(){return this.shadowPlaneEnabled}updateShadowPlanePosition(){this.shadowPlane&&(this.shadowPlane.position.x=this.shadowCenter.x,this.shadowPlane.position.y=this.shadowCenter.y)}setDebugEnabled(e){this.debugEnabled!==e&&(this.debugEnabled=e,e?this.createDebugHelpers():this.disposeDebugHelpers())}isDebugEnabled(){return this.debugEnabled}createDebugHelpers(){this.debugEnabled=!0,!this.lightCameraHelper&&this.lightCamera&&(this.lightCameraHelper=new uc(this.lightCamera),this.lightCameraHelper.name="ShadowLightCameraHelper",this.state.threeJSScene.add(this.lightCameraHelper)),this.createDebugGrid(),this.createDebugCurrentCell(),this.createDebugCanvas()}createDebugGrid(){if(this.debugGrid)return;let e=this.internal.snapGridSize,t=sy,r=e*t*2,o=[];for(let a=-t;a<=t;a++){let l=a*e;o.push(l,-r/2,Ki),o.push(l,r/2,Ki)}for(let a=-t;a<=t;a++){let l=a*e;o.push(-r/2,l,Ki),o.push(r/2,l,Ki)}let i=new Ft;i.setAttribute("position",new dr(o,3));let s=new Lr({color:ay,transparent:!0,opacity:ly,depthTest:!1});this.debugGrid=new Bt(i,s),this.debugGrid.name="ShadowDebugGrid",this.debugGrid.renderOrder=cy,this.debugGrid.frustumCulled=!1,this.state.threeJSScene.add(this.debugGrid)}createDebugCurrentCell(){if(this.debugCurrentCell)return;let e=this.internal.snapGridSize,t=new Ie(e,e);this.debugCurrentCellMaterial=new Me({color:uy,transparent:!0,opacity:dy,depthTest:!1,side:2}),this.debugCurrentCell=new W(t,this.debugCurrentCellMaterial),this.debugCurrentCell.name="ShadowDebugCurrentCell",this.debugCurrentCell.renderOrder=hy,this.debugCurrentCell.frustumCulled=!1,this.debugCurrentCell.position.set(this.currentSnapX+e/2,this.currentSnapY+e/2,Ah),this.state.threeJSScene.add(this.debugCurrentCell)}createDebugCanvas(){if(this.debugCanvas)return;this.debugCanvas=document.createElement("canvas"),this.debugCanvas.width=fe,this.debugCanvas.height=fe,this.debugCanvas.style.cssText=`
|
|
920
920
|
position: fixed;
|
|
921
921
|
bottom: 16px;
|
|
922
922
|
transform: rotate(-270deg);
|
|
@@ -951,7 +951,7 @@ void main() {
|
|
|
951
951
|
// Invert so near is bright, far is dark
|
|
952
952
|
gl_FragColor = vec4(vec3(1.0 - depth), 1.0);
|
|
953
953
|
}
|
|
954
|
-
`});let t=new Ie(2,2);this.debugDepthQuad=new V(t,this.debugDepthMaterial),this.debugDepthScene=new St,this.debugDepthScene.add(this.debugDepthQuad),this.debugDepthCamera=new Ns(-1,1,1,-1,0,1)}}debugPixelBuffer=null;updateDebugCanvas(){if(!this.debugCanvas||!this.debugCanvasCtx||!this.rendererService.renderer||!this.debugRenderTarget)return;let e=this.rendererService.renderer,t=fe*fe*4;(!this.debugPixelBuffer||this.debugPixelBuffer.length!==t)&&(this.debugPixelBuffer=new Uint8Array(t)),nl&&this.debugDepthScene&&this.debugDepthCamera&&this.debugDepthMaterial?(this.debugDepthMaterial.uniforms.depthTexture.value=this.shadowRenderTarget.depthTexture,e.setRenderTarget(this.debugRenderTarget),e.clear(),e.render(this.debugDepthScene,this.debugDepthCamera),e.setRenderTarget(null)):(e.setRenderTarget(this.debugRenderTarget),e.setClearColor(py,1),e.clear(),e.render(this.state.threeJSScene,this.lightCamera),e.setRenderTarget(null)),e.readRenderTargetPixels(this.debugRenderTarget,0,0,fe,fe,this.debugPixelBuffer);let r=this.debugCanvasCtx.createImageData(fe,fe),o=r.data,i,s;for(let a=0;a<fe;a++)for(let l=0;l<fe;l++)i=((fe-1-a)*fe+l)*4,s=(a*fe+l)*4,o[s]=this.debugPixelBuffer[i],o[s+1]=this.debugPixelBuffer[i+1],o[s+2]=this.debugPixelBuffer[i+2],o[s+3]=255;this.debugCanvasCtx.putImageData(r,0,0)}disposeDebugHelpers(){this.lightCameraHelper&&(this.state.threeJSScene.remove(this.lightCameraHelper),this.lightCameraHelper.dispose(),this.lightCameraHelper=null),this.debugGrid&&(this.state.threeJSScene.remove(this.debugGrid),this.debugGrid.geometry.dispose(),this.debugGrid.material.dispose(),this.debugGrid=null),this.debugCurrentCell&&(this.state.threeJSScene.remove(this.debugCurrentCell),this.debugCurrentCell.geometry.dispose(),this.debugCurrentCell=null),this.debugCurrentCellMaterial&&(this.debugCurrentCellMaterial.dispose(),this.debugCurrentCellMaterial=null),this.debugCanvas&&(this.debugCanvas.remove(),this.debugCanvas=null,this.debugCanvasCtx=null),this.debugPixelBuffer=null,this.debugRenderTarget&&(this.debugRenderTarget.dispose(),this.debugRenderTarget=null),this.debugDepthQuad&&(this.debugDepthQuad.geometry.dispose(),this.debugDepthQuad=null),this.debugDepthMaterial&&(this.debugDepthMaterial.dispose(),this.debugDepthMaterial=null),this.debugDepthScene=null,this.debugDepthCamera=null;let e=document.getElementById("shadow-debug-label");e&&e.remove()}updateDebugHelpers(){if(this.debugEnabled&&(this.lightCameraHelper&&this.lightCameraHelper.update(),this.debugGrid&&this.debugGrid.position.set(this.currentSnapX,this.currentSnapY,0),this.debugCurrentCell)){let e=this.internal.snapGridSize;this.debugCurrentCell.position.set(this.currentSnapX+e/2,this.currentSnapY+e/2,Ah)}}updateSunDirection(){let e=this.internal.sunAzimuth*Math.PI/180,t=this.internal.sunElevation*Math.PI/180,r=Math.cos(t);this.internal.sunDirection.set(r*Math.sin(e),r*Math.cos(e),-Math.sin(t)),this.internal.sunDirection.normalize()}updateLightCamera(){this.lightCamera&&(this.lightCamera.left=-this.internal.lightOrthoSize,this.lightCamera.right=this.internal.lightOrthoSize,this.lightCamera.top=this.internal.lightOrthoSize,this.lightCamera.bottom=-this.internal.lightOrthoSize,this.lightCamera.updateProjectionMatrix())}bias=new Y().set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);matrix=new Y;updateLightMatrix(){this.lightCamera.position.copy(this.shadowCenter).add(this.internal.sunDirection.clone().multiplyScalar(-this.internal.sunDistance)),this.lightCamera.lookAt(this.shadowCenter),this.lightCamera.near=Oh,this.lightCamera.far=this.internal.sunDistance*2,this.lightCamera.left=-this.internal.lightOrthoSize,this.lightCamera.right=this.internal.lightOrthoSize,this.lightCamera.top=this.internal.lightOrthoSize,this.lightCamera.bottom=-this.internal.lightOrthoSize,this.lightCamera.updateMatrixWorld(!0),this.lightCamera.updateProjectionMatrix(),this.matrix.identity(),this.matrix.multiplyMatrices(this.lightCamera.projectionMatrix,this.lightCamera.matrixWorldInverse),this.lightMatrix.multiplyMatrices(this.bias,this.matrix)}updateAutoSunDistance(e,t){let r=Math.max($r,Math.min(Tt,e)),o=(Tt-r)/(Tt-$r),i=Math.max(t,Qg*Math.pow(ey,o));Math.abs(this.internal.sunDistance-i)>rl&&(this.internal.sunDistance=i,this.updateSunDirection(),this.needsRender=!0)}updateAutoShadowResolution(e){if(this.options.shadowMapSize!=="auto")return;let t=this.internal.currentShadowResolutionMode;if(this.internal.currentShadowResolutionMode===null?e>=this.shadowResolutionZoomThresholds.high?t="high":t="low":this.internal.currentShadowResolutionMode==="low"?e>=this.shadowResolutionZoomThresholds.high&&(t="high"):this.internal.currentShadowResolutionMode==="high"&&e<=this.shadowResolutionZoomThresholds.low&&(t="low"),t!==this.internal.currentShadowResolutionMode&&t!==null){let r=this.shadowResolutionSizes[t];this.internal.currentShadowResolutionMode=t,this.internal.currentShadowMapSize=r,this.resizeShadowRenderTarget(r),this.needsRender=!0}}updateAutoLightSize(e,t){let r=Math.max($r,Math.min(Tt,e)),o=(Tt-r)/(Tt-$r),i=Math.max(t,ty*Math.pow(ry,o));Math.abs(this.internal.lightOrthoSize-i)>rl&&(this.internal.lightOrthoSize=i,this.updateLightCamera(),this.needsRender=!0)}updateZoomVisibility(e){let t=this.options.visibleAtZoomLevel-Lh,r=this.options.visibleAtZoomLevel,o;e>=r?o=1:e<=t?o=0:o=(e-t)/Lh;let i=o>0;(i!==this.visibleAtCurrentZoom||o!==this.zoomOpacityFactor)&&(this.visibleAtCurrentZoom=i,this.zoomOpacityFactor=o,this.needsRender=!0)}isVisibleAtCurrentZoom(){return this.visibleAtCurrentZoom}updateAutoSnapGridSize(e){let t=Math.max($r,Math.min(Tt,e)),r=(Tt-t)/(Tt-$r),o=ny*Math.pow(oy,r);Math.abs(this.internal.snapGridSize-o)>rl&&(this.internal.snapGridSize=o,this.debugEnabled&&this.recreateDebugGrid())}recreateDebugGrid(){this.debugGrid&&(this.state.threeJSScene.remove(this.debugGrid),this.debugGrid.geometry.dispose(),this.debugGrid.material.dispose(),this.debugGrid=null),this.debugCurrentCell&&(this.state.threeJSScene.remove(this.debugCurrentCell),this.debugCurrentCell.geometry.dispose(),this.debugCurrentCell=null),this.createDebugGrid(),this.createDebugCurrentCell()}transparentGeometryVisibilityStateMap=new Map;renderShadowMap(){let e=this.state.threeJSScene.overrideMaterial;this.state.threeJSScene.overrideMaterial=this.depthMaterial,this.rendererService.renderer?.setRenderTarget(this.shadowRenderTarget),this.rendererService.clear(),this.rendererService.renderScene(this.state.threeJSScene,this.lightCamera),this.rendererService.renderer?.setRenderTarget(null),this.state.threeJSScene.overrideMaterial=e,this.debugEnabled&&this.updateDebugCanvas()}updateShadowUniforms(){let e=this.options.enabled&&this.visibleAtCurrentZoom,t=this.options.shadowOpacity*this.zoomOpacityFactor,r;for(let o of this.state.geometry3DsInScene)if(r=o.components[0],r?.mesh&&r?.mesh?.material instanceof fn){let i=r.mesh.material;i instanceof fn&&i.setShadowUniforms(this.shadowRenderTarget.depthTexture,this.lightMatrix,this.lightCamera.near,this.lightCamera.far,this.options.shadowBias,t,this.internal.baseColor,this.internal.currentShadowMapSize,this.options.pcfSpread,this.options.pcfSamples,this.internal.sunDirection,this.options.normalBias,this.state.depthRangeFor3D[1],e)}this.shadowPlaneMaterial&&this.shadowPlaneMaterial.setShadowUniforms(this.shadowRenderTarget.depthTexture,this.lightMatrix,this.options.shadowBias,t,this.internal.baseColor,this.internal.currentShadowMapSize,this.options.pcfSpread,this.options.pcfSamples,this.state.depthRangeFor3D[1],e)}lastZoomLevel=null;lastCameraElevation=null;zoomOrElevationChanged(e,t){if(this.lastZoomLevel===null||this.lastCameraElevation===null)return this.lastZoomLevel=e,this.lastCameraElevation=t,!0;let r=Math.abs(e-this.lastZoomLevel)>=iy,o=t!==this.lastCameraElevation;return r||o?(this.lastZoomLevel=e,this.lastCameraElevation=t,!0):!1}updateSnap(){let e=this.cameraOrbit.position.x||0,t=this.cameraOrbit.position.y||0,r=Math.floor(e/this.internal.snapGridSize)*this.internal.snapGridSize,o=Math.floor(t/this.internal.snapGridSize)*this.internal.snapGridSize;(r!==this.currentSnapX||o!==this.currentSnapY)&&(this.currentSnapX=r,this.currentSnapY=o,this.shadowCenter.set(r,o,this.internal.groundZPosition),this.needsRender=!0)}needsRender=!0;needsCompute=!0;update(e,t){this.updateZoomVisibility(e),(this.needsCompute||this.zoomOrElevationChanged(e,t))&&(this.updateAutoShadowResolution(e),this.updateAutoLightSize(e,t),this.updateAutoSunDistance(e,t),this.updateAutoSnapGridSize(e)),this.updateSnap(),this.needsRender&&(this.updateLightMatrix(),this.visibleAtCurrentZoom&&this.renderShadowMap(),this.updateShadowPlanePosition(),this.updateShadowUniforms()),this.updateDebugHelpers(),this.needsRender=!1,this.needsCompute=!1}destroy(){this.disposeDebugHelpers(),this.shadowPlane&&(this.state.threeJSScene.remove(this.shadowPlane),this.shadowPlane.geometry.dispose(),this.shadowPlane=null),this.shadowPlaneMaterial&&(this.shadowPlaneMaterial.dispose(),this.shadowPlaneMaterial=null),this.shadowRenderTarget&&(this.shadowRenderTarget.dispose(),this.shadowRenderTarget.depthTexture&&this.shadowRenderTarget.depthTexture.dispose()),this.depthMaterial&&this.depthMaterial.dispose(),this.transparentGeometryVisibilityStateMap.clear()}};f();f();var my=[100,500,2e3,1e4];function kn(n,e){return n.set(U.degToRad(e?.[0]??Ht[0]),U.degToRad(e?.[1]??Ht[1]),U.degToRad(e?.[2]??Ht[2]))}function zn(n,e){return n.set(e?.[0]??Ut[0],e?.[1]??Ut[1],e?.[2]??Ut[2])}function Un(n){let e=n.components[0],t=n.components[1];if(t.opacity!=null&&t.opacity!==e.opacity&&(e.opacity=t.opacity),!(e.mesh?.children[0]instanceof K)){let s=t.material,a=t.color;if(s||a){let l=Rh(a,s);e.mesh?.traverse(c=>{c instanceof V&&c.material&&(Array.isArray(c.material)?c.material.forEach(u=>{l[u.name]?(u.color.set(l[u.name].color),u.vertexColors=!1):a&&u.color.set(a)}):l[c.material.name]?(c.material.color.set(l[c.material.name].color),c.material.vertexColors=!1):a&&c.material.color.set(a))})}}let o=e.feature.geometry.coordinates[2]??0,i=(t.verticalOffset??0)+o;e.altitude!==i&&(e.altitude=i),t.visible!==e.visible&&(e.visible=t.visible),t.visibleThroughGeometry!==e.visibleThroughGeometry&&(e.visibleThroughGeometry=t.visibleThroughGeometry)}function Rh(n,e){let t={};if(e)for(let r in e)e[r].color&&(t[r]={color:e[r].color});if(n){let r=["Default","Fabric","Mpdn_Logo","CouchLogo"];for(let o of r)t[o]||(t[o]={color:n})}return t}function es(n){n.traverse(e=>{e instanceof K&&e.computeBoundingSphere()})}function _h(n,e=my){for(let t of e)if(t>n)return t;return n*2}function ts(n){for(;n.children.length>0;){let e=n.children[0];if(e instanceof K)if(e.geometry?.dispose(),Array.isArray(e.material))for(let t of e.material)t.dispose();else e.material&&e.material.dispose();n.remove(e)}n.parent?.remove(n)}function rs(n,e,t,r){let o=r||t?Rh(t,r):void 0;for(let i of n.children){if(!(i instanceof K))continue;let s=Array.isArray(i.material)?i.material[0]?.name:i.material?.name,a=o?.[s],l=a?new k(a.color):t?new k(t):i.userData.originalColor;l&&(i.setColorAt(e,l),i.instanceColor&&(i.instanceColor.needsUpdate=!0))}}function qr(n,e){let t=new He;return n.scene.updateWorldMatrix(!0,!0),n.scene.traverse(r=>{let o=r;if("isMesh"in o&&o.isMesh===!0){let i=o.geometry.clone();i.applyMatrix4(o.matrixWorld);let s=o.material,a;Array.isArray(s)?(a=s[0].color?.clone(),s=s.map(u=>{let d=u.clone();return d.color?.setRGB(1,1,1),d})):(a=s.color?.clone(),s=s.clone(),s.color?.setRGB(1,1,1));let l=new K(i,s,e);l.count=0,l.frustumCulled=!1,l.layers.enable(Oe.SHOULD_CAST_SHADOWS),l.userData={entities:{},originalColor:a},t.add(l)}}),t}function ol(n,e){let t=typeof e=="string"?new k(e):e;n.traverse(r=>{let o=r;"isMesh"in o&&o.isMesh===!0&&(Array.isArray(o.material)?o.material.forEach(i=>{"color"in i&&i.color.copy(t)}):"color"in o.material&&o.material.color.copy(t))})}function il(n,e,t=!1){let r=o=>{o.userData.intrinsicOpacity==null&&(o.userData.intrinsicOpacity=o.opacity);let i=o.userData.intrinsicOpacity*e;(!t||!o.transparent)&&(o.transparent=i<1),o.opacity=i};n.traverse(o=>{let i=o;"isMesh"in i&&i.isMesh===!0&&(Array.isArray(i.material)?i.material.forEach(r):r(i.material))})}function Fh(n,e){n.traverse(t=>{let r=t;"isMesh"in r&&r.isMesh===!0&&(Array.isArray(r.material)?r.material.forEach(o=>{o.depthWrite=!e,o.depthTest=!e,e&&(o.transparent=!0)}):(r.material.depthWrite=!e,r.material.depthTest=!e,e&&(r.material.transparent=!0)))})}function Jr(n,e){n.traverse(t=>{t instanceof K&&t.material&&(Array.isArray(t.material)?t.material.forEach(r=>{r.transparent=e<1,r.opacity=e}):(t.material.transparent=e<1,t.material.opacity=e))})}function sl(n){n.traverse(e=>{let t=e;"isMesh"in t&&t.isMesh===!0&&(t.geometry?.dispose(),Array.isArray(t.material)?t.material.forEach(r=>r.dispose()):t.material?.dispose())})}function Nh(n){n.traverse(e=>{e instanceof K&&(e.geometry.dispose(),Array.isArray(e.material)?e.material.forEach(t=>t.dispose()):e.material?.dispose())})}function $t(n,e){let t=e!==0,r=!1;return n.traverse(o=>{if(!(o instanceof K)&&!("isMesh"in o&&o.isMesh))return;let i=o.layers.isEnabled(Oe.SHOULD_CAST_SHADOWS);t&&!i?(o.layers.enable(Oe.SHOULD_CAST_SHADOWS),r=!0):!t&&i&&(o.layers.disable(Oe.SHOULD_CAST_SHADOWS),r=!0)}),r}f();var ns=class{element=null;enabled=!1;show(){this.enabled||(this.enabled=!0,this.create())}hide(){this.enabled&&(this.enabled=!1,this.element&&(this.element.remove(),this.element=null))}isEnabled(){return this.enabled}create(){this.element=document.createElement("div"),this.element.id="model-debug-ui",this.element.style.cssText=`
|
|
954
|
+
`});let t=new Ie(2,2);this.debugDepthQuad=new W(t,this.debugDepthMaterial),this.debugDepthScene=new St,this.debugDepthScene.add(this.debugDepthQuad),this.debugDepthCamera=new Ns(-1,1,1,-1,0,1)}}debugPixelBuffer=null;updateDebugCanvas(){if(!this.debugCanvas||!this.debugCanvasCtx||!this.rendererService.renderer||!this.debugRenderTarget)return;let e=this.rendererService.renderer,t=fe*fe*4;(!this.debugPixelBuffer||this.debugPixelBuffer.length!==t)&&(this.debugPixelBuffer=new Uint8Array(t)),nl&&this.debugDepthScene&&this.debugDepthCamera&&this.debugDepthMaterial?(this.debugDepthMaterial.uniforms.depthTexture.value=this.shadowRenderTarget.depthTexture,e.setRenderTarget(this.debugRenderTarget),e.clear(),e.render(this.debugDepthScene,this.debugDepthCamera),e.setRenderTarget(null)):(e.setRenderTarget(this.debugRenderTarget),e.setClearColor(py,1),e.clear(),e.render(this.state.threeJSScene,this.lightCamera),e.setRenderTarget(null)),e.readRenderTargetPixels(this.debugRenderTarget,0,0,fe,fe,this.debugPixelBuffer);let r=this.debugCanvasCtx.createImageData(fe,fe),o=r.data,i,s;for(let a=0;a<fe;a++)for(let l=0;l<fe;l++)i=((fe-1-a)*fe+l)*4,s=(a*fe+l)*4,o[s]=this.debugPixelBuffer[i],o[s+1]=this.debugPixelBuffer[i+1],o[s+2]=this.debugPixelBuffer[i+2],o[s+3]=255;this.debugCanvasCtx.putImageData(r,0,0)}disposeDebugHelpers(){this.lightCameraHelper&&(this.state.threeJSScene.remove(this.lightCameraHelper),this.lightCameraHelper.dispose(),this.lightCameraHelper=null),this.debugGrid&&(this.state.threeJSScene.remove(this.debugGrid),this.debugGrid.geometry.dispose(),this.debugGrid.material.dispose(),this.debugGrid=null),this.debugCurrentCell&&(this.state.threeJSScene.remove(this.debugCurrentCell),this.debugCurrentCell.geometry.dispose(),this.debugCurrentCell=null),this.debugCurrentCellMaterial&&(this.debugCurrentCellMaterial.dispose(),this.debugCurrentCellMaterial=null),this.debugCanvas&&(this.debugCanvas.remove(),this.debugCanvas=null,this.debugCanvasCtx=null),this.debugPixelBuffer=null,this.debugRenderTarget&&(this.debugRenderTarget.dispose(),this.debugRenderTarget=null),this.debugDepthQuad&&(this.debugDepthQuad.geometry.dispose(),this.debugDepthQuad=null),this.debugDepthMaterial&&(this.debugDepthMaterial.dispose(),this.debugDepthMaterial=null),this.debugDepthScene=null,this.debugDepthCamera=null;let e=document.getElementById("shadow-debug-label");e&&e.remove()}updateDebugHelpers(){if(this.debugEnabled&&(this.lightCameraHelper&&this.lightCameraHelper.update(),this.debugGrid&&this.debugGrid.position.set(this.currentSnapX,this.currentSnapY,0),this.debugCurrentCell)){let e=this.internal.snapGridSize;this.debugCurrentCell.position.set(this.currentSnapX+e/2,this.currentSnapY+e/2,Ah)}}updateSunDirection(){let e=this.internal.sunAzimuth*Math.PI/180,t=this.internal.sunElevation*Math.PI/180,r=Math.cos(t);this.internal.sunDirection.set(r*Math.sin(e),r*Math.cos(e),-Math.sin(t)),this.internal.sunDirection.normalize()}updateLightCamera(){this.lightCamera&&(this.lightCamera.left=-this.internal.lightOrthoSize,this.lightCamera.right=this.internal.lightOrthoSize,this.lightCamera.top=this.internal.lightOrthoSize,this.lightCamera.bottom=-this.internal.lightOrthoSize,this.lightCamera.updateProjectionMatrix())}bias=new Y().set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1);matrix=new Y;updateLightMatrix(){this.lightCamera.position.copy(this.shadowCenter).add(this.internal.sunDirection.clone().multiplyScalar(-this.internal.sunDistance)),this.lightCamera.lookAt(this.shadowCenter),this.lightCamera.near=Oh,this.lightCamera.far=this.internal.sunDistance*2,this.lightCamera.left=-this.internal.lightOrthoSize,this.lightCamera.right=this.internal.lightOrthoSize,this.lightCamera.top=this.internal.lightOrthoSize,this.lightCamera.bottom=-this.internal.lightOrthoSize,this.lightCamera.updateMatrixWorld(!0),this.lightCamera.updateProjectionMatrix(),this.matrix.identity(),this.matrix.multiplyMatrices(this.lightCamera.projectionMatrix,this.lightCamera.matrixWorldInverse),this.lightMatrix.multiplyMatrices(this.bias,this.matrix)}updateAutoSunDistance(e,t){let r=Math.max($r,Math.min(Tt,e)),o=(Tt-r)/(Tt-$r),i=Math.max(t,Qg*Math.pow(ey,o));Math.abs(this.internal.sunDistance-i)>rl&&(this.internal.sunDistance=i,this.updateSunDirection(),this.needsRender=!0)}updateAutoShadowResolution(e){if(this.options.shadowMapSize!=="auto")return;let t=this.internal.currentShadowResolutionMode;if(this.internal.currentShadowResolutionMode===null?e>=this.shadowResolutionZoomThresholds.high?t="high":t="low":this.internal.currentShadowResolutionMode==="low"?e>=this.shadowResolutionZoomThresholds.high&&(t="high"):this.internal.currentShadowResolutionMode==="high"&&e<=this.shadowResolutionZoomThresholds.low&&(t="low"),t!==this.internal.currentShadowResolutionMode&&t!==null){let r=this.shadowResolutionSizes[t];this.internal.currentShadowResolutionMode=t,this.internal.currentShadowMapSize=r,this.resizeShadowRenderTarget(r),this.needsRender=!0}}updateAutoLightSize(e,t){let r=Math.max($r,Math.min(Tt,e)),o=(Tt-r)/(Tt-$r),i=Math.max(t,ty*Math.pow(ry,o));Math.abs(this.internal.lightOrthoSize-i)>rl&&(this.internal.lightOrthoSize=i,this.updateLightCamera(),this.needsRender=!0)}updateZoomVisibility(e){let t=this.options.visibleAtZoomLevel-Lh,r=this.options.visibleAtZoomLevel,o;e>=r?o=1:e<=t?o=0:o=(e-t)/Lh;let i=o>0;(i!==this.visibleAtCurrentZoom||o!==this.zoomOpacityFactor)&&(this.visibleAtCurrentZoom=i,this.zoomOpacityFactor=o,this.needsRender=!0)}isVisibleAtCurrentZoom(){return this.visibleAtCurrentZoom}updateAutoSnapGridSize(e){let t=Math.max($r,Math.min(Tt,e)),r=(Tt-t)/(Tt-$r),o=ny*Math.pow(oy,r);Math.abs(this.internal.snapGridSize-o)>rl&&(this.internal.snapGridSize=o,this.debugEnabled&&this.recreateDebugGrid())}recreateDebugGrid(){this.debugGrid&&(this.state.threeJSScene.remove(this.debugGrid),this.debugGrid.geometry.dispose(),this.debugGrid.material.dispose(),this.debugGrid=null),this.debugCurrentCell&&(this.state.threeJSScene.remove(this.debugCurrentCell),this.debugCurrentCell.geometry.dispose(),this.debugCurrentCell=null),this.createDebugGrid(),this.createDebugCurrentCell()}transparentGeometryVisibilityStateMap=new Map;renderShadowMap(){let e=this.state.threeJSScene.overrideMaterial;this.state.threeJSScene.overrideMaterial=this.depthMaterial,this.rendererService.renderer?.setRenderTarget(this.shadowRenderTarget),this.rendererService.clear(),this.rendererService.renderScene(this.state.threeJSScene,this.lightCamera),this.rendererService.renderer?.setRenderTarget(null),this.state.threeJSScene.overrideMaterial=e,this.debugEnabled&&this.updateDebugCanvas()}updateShadowUniforms(){let e=this.options.enabled&&this.visibleAtCurrentZoom,t=this.options.shadowOpacity*this.zoomOpacityFactor,r;for(let o of this.state.geometry3DsInScene)if(r=o.components[0],r?.mesh&&r?.mesh?.material instanceof fn){let i=r.mesh.material;i instanceof fn&&i.setShadowUniforms(this.shadowRenderTarget.depthTexture,this.lightMatrix,this.lightCamera.near,this.lightCamera.far,this.options.shadowBias,t,this.internal.baseColor,this.internal.currentShadowMapSize,this.options.pcfSpread,this.options.pcfSamples,this.internal.sunDirection,this.options.normalBias,this.state.depthRangeFor3D[1],e)}this.shadowPlaneMaterial&&this.shadowPlaneMaterial.setShadowUniforms(this.shadowRenderTarget.depthTexture,this.lightMatrix,this.options.shadowBias,t,this.internal.baseColor,this.internal.currentShadowMapSize,this.options.pcfSpread,this.options.pcfSamples,this.state.depthRangeFor3D[1],e)}lastZoomLevel=null;lastCameraElevation=null;zoomOrElevationChanged(e,t){if(this.lastZoomLevel===null||this.lastCameraElevation===null)return this.lastZoomLevel=e,this.lastCameraElevation=t,!0;let r=Math.abs(e-this.lastZoomLevel)>=iy,o=t!==this.lastCameraElevation;return r||o?(this.lastZoomLevel=e,this.lastCameraElevation=t,!0):!1}updateSnap(){let e=this.cameraOrbit.position.x||0,t=this.cameraOrbit.position.y||0,r=Math.floor(e/this.internal.snapGridSize)*this.internal.snapGridSize,o=Math.floor(t/this.internal.snapGridSize)*this.internal.snapGridSize;(r!==this.currentSnapX||o!==this.currentSnapY)&&(this.currentSnapX=r,this.currentSnapY=o,this.shadowCenter.set(r,o,this.internal.groundZPosition),this.needsRender=!0)}needsRender=!0;needsCompute=!0;update(e,t){this.updateZoomVisibility(e),(this.needsCompute||this.zoomOrElevationChanged(e,t))&&(this.updateAutoShadowResolution(e),this.updateAutoLightSize(e,t),this.updateAutoSunDistance(e,t),this.updateAutoSnapGridSize(e)),this.updateSnap(),this.needsRender&&(this.updateLightMatrix(),this.visibleAtCurrentZoom&&this.renderShadowMap(),this.updateShadowPlanePosition(),this.updateShadowUniforms()),this.updateDebugHelpers(),this.needsRender=!1,this.needsCompute=!1}destroy(){this.disposeDebugHelpers(),this.shadowPlane&&(this.state.threeJSScene.remove(this.shadowPlane),this.shadowPlane.geometry.dispose(),this.shadowPlane=null),this.shadowPlaneMaterial&&(this.shadowPlaneMaterial.dispose(),this.shadowPlaneMaterial=null),this.shadowRenderTarget&&(this.shadowRenderTarget.dispose(),this.shadowRenderTarget.depthTexture&&this.shadowRenderTarget.depthTexture.dispose()),this.depthMaterial&&this.depthMaterial.dispose(),this.transparentGeometryVisibilityStateMap.clear()}};f();f();var my=[100,500,2e3,1e4];function kn(n,e){return n.set(U.degToRad(e?.[0]??Ht[0]),U.degToRad(e?.[1]??Ht[1]),U.degToRad(e?.[2]??Ht[2]))}function zn(n,e){return n.set(e?.[0]??Ut[0],e?.[1]??Ut[1],e?.[2]??Ut[2])}function Un(n){let e=n.components[0],t=n.components[1];if(t.opacity!=null&&t.opacity!==e.opacity&&(e.opacity=t.opacity),!(e.mesh?.children[0]instanceof K)){let s=t.material,a=t.color;if(s||a){let l=Rh(a,s);e.mesh?.traverse(c=>{c instanceof W&&c.material&&(Array.isArray(c.material)?c.material.forEach(u=>{l[u.name]?(u.color.set(l[u.name].color),u.vertexColors=!1):a&&u.color.set(a)}):l[c.material.name]?(c.material.color.set(l[c.material.name].color),c.material.vertexColors=!1):a&&c.material.color.set(a))})}}let o=e.feature.geometry.coordinates[2]??0,i=(t.verticalOffset??0)+o;e.altitude!==i&&(e.altitude=i),t.visible!==e.visible&&(e.visible=t.visible),t.visibleThroughGeometry!==e.visibleThroughGeometry&&(e.visibleThroughGeometry=t.visibleThroughGeometry)}function Rh(n,e){let t={};if(e)for(let r in e)e[r].color&&(t[r]={color:e[r].color});if(n){let r=["Default","Fabric","Mpdn_Logo","CouchLogo"];for(let o of r)t[o]||(t[o]={color:n})}return t}function es(n){n.traverse(e=>{e instanceof K&&e.computeBoundingSphere()})}function _h(n,e=my){for(let t of e)if(t>n)return t;return n*2}function ts(n){for(;n.children.length>0;){let e=n.children[0];if(e instanceof K)if(e.geometry?.dispose(),Array.isArray(e.material))for(let t of e.material)t.dispose();else e.material&&e.material.dispose();n.remove(e)}n.parent?.remove(n)}function rs(n,e,t,r){let o=r||t?Rh(t,r):void 0;for(let i of n.children){if(!(i instanceof K))continue;let s=Array.isArray(i.material)?i.material[0]?.name:i.material?.name,a=o?.[s],l=a?new k(a.color):t?new k(t):i.userData.originalColor;l&&(i.setColorAt(e,l),i.instanceColor&&(i.instanceColor.needsUpdate=!0))}}function qr(n,e){let t=new He;return n.scene.updateWorldMatrix(!0,!0),n.scene.traverse(r=>{let o=r;if("isMesh"in o&&o.isMesh===!0){let i=o.geometry.clone();i.applyMatrix4(o.matrixWorld);let s=o.material,a;Array.isArray(s)?(a=s[0].color?.clone(),s=s.map(u=>{let d=u.clone();return d.color?.setRGB(1,1,1),d})):(a=s.color?.clone(),s=s.clone(),s.color?.setRGB(1,1,1));let l=new K(i,s,e);l.count=0,l.frustumCulled=!1,l.layers.enable(Oe.SHOULD_CAST_SHADOWS),l.userData={entities:{},originalColor:a},t.add(l)}}),t}function ol(n,e){let t=typeof e=="string"?new k(e):e;n.traverse(r=>{let o=r;"isMesh"in o&&o.isMesh===!0&&(Array.isArray(o.material)?o.material.forEach(i=>{"color"in i&&i.color.copy(t)}):"color"in o.material&&o.material.color.copy(t))})}function il(n,e,t=!1){let r=o=>{o.userData.intrinsicOpacity==null&&(o.userData.intrinsicOpacity=o.opacity);let i=o.userData.intrinsicOpacity*e;(!t||!o.transparent)&&(o.transparent=i<1),o.opacity=i};n.traverse(o=>{let i=o;"isMesh"in i&&i.isMesh===!0&&(Array.isArray(i.material)?i.material.forEach(r):r(i.material))})}function Fh(n,e){n.traverse(t=>{let r=t;"isMesh"in r&&r.isMesh===!0&&(Array.isArray(r.material)?r.material.forEach(o=>{o.depthWrite=!e,o.depthTest=!e,e&&(o.transparent=!0)}):(r.material.depthWrite=!e,r.material.depthTest=!e,e&&(r.material.transparent=!0)))})}function Jr(n,e){n.traverse(t=>{t instanceof K&&t.material&&(Array.isArray(t.material)?t.material.forEach(r=>{r.transparent=e<1,r.opacity=e}):(t.material.transparent=e<1,t.material.opacity=e))})}function sl(n){n.traverse(e=>{let t=e;"isMesh"in t&&t.isMesh===!0&&(t.geometry?.dispose(),Array.isArray(t.material)?t.material.forEach(r=>r.dispose()):t.material?.dispose())})}function Nh(n){n.traverse(e=>{e instanceof K&&(e.geometry.dispose(),Array.isArray(e.material)?e.material.forEach(t=>t.dispose()):e.material?.dispose())})}function $t(n,e){let t=e!==0,r=!1;return n.traverse(o=>{if(!(o instanceof K)&&!("isMesh"in o&&o.isMesh))return;let i=o.layers.isEnabled(Oe.SHOULD_CAST_SHADOWS);t&&!i?(o.layers.enable(Oe.SHOULD_CAST_SHADOWS),r=!0):!t&&i&&(o.layers.disable(Oe.SHOULD_CAST_SHADOWS),r=!0)}),r}f();var ns=class{element=null;enabled=!1;show(){this.enabled||(this.enabled=!0,this.create())}hide(){this.enabled&&(this.enabled=!1,this.element&&(this.element.remove(),this.element=null))}isEnabled(){return this.enabled}create(){this.element=document.createElement("div"),this.element.id="model-debug-ui",this.element.style.cssText=`
|
|
955
955
|
position: fixed;
|
|
956
956
|
bottom: 10px;
|
|
957
957
|
left: 10px;
|
|
@@ -965,4 +965,4 @@ void main() {
|
|
|
965
965
|
max-height: 300px;
|
|
966
966
|
overflow-y: auto;
|
|
967
967
|
min-width: 200px;
|
|
968
|
-
`,document.body.appendChild(this.element)}getActualInstanceCount(e){for(let t of e.mesh.children)if(t.isInstancedMesh)return t.count;return e.count}update(e,t,r){if(!this.enabled||!this.element)return;let o='<div style="margin-bottom: 5px; font-weight: bold; border-bottom: 1px solid #666; padding-bottom: 5px;">Model Batches</div>';if(e.size===0)o+='<div style="color: #888;">No models loaded</div>';else{let i=0,s=0,a=Array.from(e.keys()).sort((l,c)=>{let u=t.get(l)??"",d=t.get(c)??"";return u.localeCompare(d)});for(let l of a){let c=e.get(l);if(!c||c.size===0)continue;let u=t.get(l)??`unknown_${l}`,d=0;for(let g of c)d+=this.getActualInstanceCount(g);i+=c.size,s+=d,o+='<div style="margin: 6px 0 2px 0;">',o+=`<span style="color: #4fc3f7; font-weight: bold;">"${u}"</span>`,o+=`<span style="color: #aaa;"> (${d} total, ${c.size} batch${c.size!==1?"es":""})</span>`,o+="</div>";let h=Array.from(c).sort((g,b)=>g.id.localeCompare(b.id));for(let g of h){let b=this.getActualInstanceCount(g),M=g.count,m=b!==M,p=g.opacity===1?"":` @${(g.opacity*100).toFixed(0)}%`;o+='<div style="margin-left: 12px; color: #ccc; font-size: 11px;">',o+=`<span style="color: #81c784;">${g.id}</span>`,m?o+=`<span style="color: #e57373;">: ${b} actual / ${M} tracked</span>`:o+=`<span style="color: #fff;">: ${b} instance${b!==1?"s":""}</span>`,p&&(o+=`<span style="color: #ffb74d;">${p}</span>`),o+="</div>"}}o+='<div style="margin-top: 8px; padding-top: 5px; border-top: 1px solid #666; color: #fff;">',o+=`Total: <span style="color: #81c784;">${s} instance${s!==1?"s":""}</span>`,o+=`, <span style="color: #e57373;">${i} draw call${i!==1?"s":""}</span>`,o+="</div>"}if(r.size>0){o+='<div style="margin-top: 8px; border-top: 1px solid #666; padding-top: 5px;">',o+='<div style="margin-bottom: 5px; font-weight: bold; color: #ff9800;">Non-instanced Models</div>',o+=`<span style="color: #aaa;">(${r.size} total, ${r.size} draw call${r.size!==1?"s":""})</span>`;let i=new Map;for(let[s,a]of r){let l=i.get(a.urlHash)??[];l.push(s),i.set(a.urlHash,l)}for(let[s,a]of i){let l=t.get(s)??`unknown_${s}`;o+='<div style="margin: 6px 0 2px 0;">',o+=`<span style="color: #ff9800;">"${l}"</span>`,o+=`<span style="color: #aaa;"> (${a.length} model${a.length!==1?"s":""})</span>`,o+="</div>";for(let c of a)o+=`<div style="margin-left: 12px; color: #ccc; font-size: 11px;">${c}</div>`}o+="</div>"}this.element.innerHTML=o}destroy(){this.element&&(this.element.remove(),this.element=null)}};var Kr=100,fy=!0,os=class extends Z{transparencyChanged=!1;state;convertTo3DMapPosition;loader;loadPromises=[];gltfCache=new Map;gltfLoadPromises=new Map;instanceMap=new Map;debugUI;modelNames=new Map;batchCounter=0;batchByMesh=new Map;batchesByUrlHash=new Map;nonInstancedModels=new Map;pendingOpacityChanges=new Map;detachedEntityIds=new Set;tempMatrix=new Y;tempQuaternion=new _t;tempEuler=new xt;tempScale=new O;tempColor=new k;constructor(e,t){super(),this.state=e,this.convertTo3DMapPosition=t,this.debugUI=new ns}createBatch(e,t,r,o,i){this.batchCounter++;let s={id:`batch_${this.batchCounter}`,mesh:e,count:0,maxCount:i,opacity:o,urlHash:t,containerId:r};return e.userData.batchId=s.id,this.batchByMesh.set(e,s),this.batchesByUrlHash.has(t)||this.batchesByUrlHash.set(t,new Set),this.batchesByUrlHash.get(t).add(s),s}removeBatch(e){this.batchByMesh.delete(e.mesh),this.batchesByUrlHash.get(e.urlHash)?.delete(e),this.batchesByUrlHash.get(e.urlHash)?.size===0&&this.batchesByUrlHash.delete(e.urlHash)}getBatchForMesh(e){return this.batchByMesh.get(e)}updateDebugUI(){this.debugUI.update(this.batchesByUrlHash,this.modelNames,this.nonInstancedModels)}showDebug(){this.debugUI.show(),this.updateDebugUI()}hideDebug(){this.debugUI.hide()}async getGLTFLoader(){if(this.loader)return this.loader;let{GLTFLoader:e}=await import("./GLTFLoader-MAX3PCDM.js");return this.loader=new e,this.loader}async getOrLoadGLTF(e,t){let r=this.gltfCache.get(t);if(r)return r;let o=this.gltfLoadPromises.get(t);if(o)return o;let i=await this.getGLTFLoader(),s=new Promise((a,l)=>{let c=d=>{this.gltfCache.set(t,d),this.gltfLoadPromises.delete(t),a(d)},u=d=>{this.gltfLoadPromises.delete(t),l(d)};jc(e)?i.parse(Zc(e),"",c,u):Xc(e)?i.parse(Yc(e),"",c,u):i.load(e,c,void 0,u)});return this.gltfLoadPromises.set(t,s),s}createNonInstancedModel(e,t,r,o){let i=e.components[0],s=e.components[1],a=i.feature,l=t.scene.clone(!0);l.updateWorldMatrix(!0,!0);let c=new He;c.userData={nonInstanced:!0,entityId:String(e.id),type:"model"},l.traverse(m=>{let p=m;if("isMesh"in p&&p.isMesh===!0){let y=p.clone();y.geometry=p.geometry.clone(),y.geometry.applyMatrix4(p.matrixWorld),y.position.set(0,0,0),y.rotation.set(0,0,0),y.scale.set(1,1,1),Array.isArray(p.material)?y.material=p.material.map(v=>v.clone()):y.material=p.material.clone(),y.userData={entityId:String(e.id)},c.add(y)}});let{x:u,y:d}=this.convertTo3DMapPosition(a.geometry.coordinates[1],a.geometry.coordinates[0],0),h=a.geometry.coordinates[2]??0,g=(s.verticalOffset??0)+h;i.altitude=g,i.position.set(u,d,i.altitude);let b=s.scale??Ut,M=s.rotation??Ht;if(c.position.copy(i.position),c.rotation.set(U.degToRad(M[0]),U.degToRad(M[1]),U.degToRad(M[2])),c.scale.set(b[0],b[1],b[2]),s.color&&ol(c,s.color),s.opacity!=null&&s.opacity!==1&&il(c,s.opacity),s.visibleThroughGeometry&&Fh(c,!0),!s.EXPERIMENTAL_clippingEnabled){let m=s.opacity??1;$t(c,m)}r.add(c),i.mesh=c,i.instanceIndex=-1,Un(e),this.nonInstancedModels.set(e.id,{urlHash:o,mesh:c}),this.updateDebugUI()}resizeInstanceContainer(e,t){let r=_h(e.maxCount),o=qr(t,r),i=e.object.children,s=o.children;for(let l=0;l<i.length;l++){let c=i[l],u=s[l];if(!(!(c instanceof K)||!(u instanceof K))){for(let d=0;d<e.count;d++)c.getMatrixAt(d,this.tempMatrix),u.setMatrixAt(d,this.tempMatrix),u.userData.entities[d]=c.userData.entities[d],c.instanceColor&&(c.getColorAt(d,this.tempColor),u.setColorAt(d,this.tempColor));u.count=e.count,u.instanceMatrix.needsUpdate=!0}}let a=e.object.parent;return a&&(a.remove(e.object),a.add(o)),e.object=o,e.maxCount=r,e}getOrCreateInstanceContainer(e,t,r){let o=this.instanceMap.get(e);o||(o=new Map,this.instanceMap.set(e,o));let i=o.get(t);if(i){let s=this.getBatchForMesh(i.object);s&&(i.count=s.count)}else{let s=qr(r,Kr);i={object:s,count:0,maxCount:Kr},o.set(t,i);let a=this.createBatch(s,t,e,1,Kr);i.batch=a}return i}createModelFromFeature(e,t,r){let o=new yr(t),i={...r};t.properties.verticalOffset!=null&&(i.verticalOffset=t.properties.verticalOffset),t.properties.rotation!=null&&(i.rotation=t.properties.rotation),t.properties.scale!=null&&(i.scale=t.properties.scale);let s=new _o(i);o.instancingDisabled=s.visibleThroughGeometry===!0||s.EXPERIMENTAL_clippingEnabled===!0;let a=new $(o,s);return a.id=e,s.EXPERIMENTAL_clippingEnabled&&(a.components[7]=new No),a}async populateModelGroup(e,t,r){let o=on(t),i=this.getOrLoadGLTF(t,o).then(l=>{let c=r.parent;if(!(c instanceof ie))return;let u=c.userData.entityId,d=this.getOrCreateInstanceContainer(u,o,l);d.count+e.size>d.maxCount&&(d=this.resizeInstanceContainer(d,l)),d.object.parent||r.add(d.object);let g=new Y,b=new xt,M=new _t,m=new O,p,y,v;for(let x of e.values()){if(v=this.state.geometry3DMap.get(x),!v||v?.type!=="model")continue;let S=v.components[0],w=v.components[1];if(S.instanceIndex!=null&&S.instanceIndex>=0||S.instancingDisabled&&S.mesh)continue;if(y=S.feature,S.instancingDisabled){this.createNonInstancedModel(v,l,r,o);continue}let D=w.opacity!=null&&w.opacity!==1;if(D){let P=w.opacity??1,I=Math.round(P*100),L,N,z=this.batchesByUrlHash.get(o);if(z){for(let H of z)if(H.containerId===c.userData.entityId&&Math.round(H.opacity*100)===I&&H.count<H.maxCount){L=H,N=H.mesh;break}}if(!L||!N){let H=qr(l,Kr);H.userData.detached=!0,H.userData.sharedOpacity=P,r.add(H),L=this.createBatch(H,o,c.userData.entityId,P,Kr),N=H,Jr(H,P),$t(H,P)}let j=L.count;S.mesh=N,S.instanceIndex=j,L.count++,this.detachedEntityIds.add(v.id)}else S.mesh=d.object,S.instanceIndex=d.count;Un(v),w.dirty=!1,p=this.convertTo3DMapPosition(y.geometry.coordinates[1],y.geometry.coordinates[0],0),S.position.set(p.x,p.y,S.altitude),kn(b,w.rotation),zn(m,w.scale),M.setFromEuler(b),g.compose(S.position,M,m);let C=S.mesh,T=S.instanceIndex;for(let P of C.children)P instanceof K&&(P.setMatrixAt(T,g),P.userData.entities[T]=v.id,P.count=T+1,P.instanceMatrix.needsUpdate=!0);if(rs(C,T,w.color,w.material),!D){d.count++;let P=this.getBatchForMesh(d.object);P&&(P.count=d.count)}es(S.mesh)}this.publish("model-loaded")});this.loadPromises.push(i);let s=r.parent?.userData?.entityId;return this.instanceMap.get(s)?.get(o)?.object??new He}update(){for(let t of this.state.geometryGroupIdsToLoad.values()){let r=this.state.geometry3DMap.get(t);r instanceof Ce&&r.userData.dirty&&r.userData.modelURL&&(this.populateModelGroup(r.userData.entities3D,r.userData.modelURL,r),r.userData.dirty=!1,r.userData.localCenter=void 0)}this.updateModelStyles(),this.rebatchDetachedInstances(),this.flushPendingOpacityChanges(),this.updateDebugUI();let e=this.loadPromises;return this.loadPromises=[],Promise.all(e)}rebatchDetachedInstances(){if(!fy||this.detachedEntityIds.size===0)return;let e=new Map;for(let t of this.detachedEntityIds){let r=this.state.geometry3DMap.get(t);if(!r||r.type!=="model")continue;let o=r.components[0],i=r.components[1],s=o.mesh?.userData;if(!o.mesh?.parent)continue;let a=i.opacity??1,l=s?.sharedOpacity;if(Math.round(a*100)===100&&l!==void 0){this.pendingOpacityChanges.set(r.id,{entity:r,targetOpacity:a});continue}if(l!==void 0&&Math.abs(a-l)<=.01)continue;if(l!==void 0&&Math.abs(a-l)>.01){this.pendingOpacityChanges.set(r.id,{entity:r,targetOpacity:a});continue}let u=o.mesh.parent;if(!(u instanceof Ce))continue;let d=u.userData.modelURL;if(!d)continue;let h=on(d),g=i.opacity??1,b=Math.round(g*100);e.has(h)||e.set(h,new Map);let M=e.get(h);M.has(b)||M.set(b,[]),M.get(b).push(r)}for(let[t,r]of e.entries()){let o=this.gltfCache.get(t);if(o)for(let[i,s]of r.entries()){if(s.length<2)continue;let a=i/100;this.createSharedBatchForDetached(s,o,a,t)}}this.publish("batch-changed")}createSharedBatchForDetached(e,t,r,o){if(e.length<2)return;let s=e[0].components[0].mesh?.parent;if(!s)return;let a=s.parent,l=a instanceof ie?a.userData.entityId:"unknown",c=qr(t,e.length);c.userData.detached=!0,c.userData.sharedOpacity=r,s.add(c);let u=this.createBatch(c,o,l,r,e.length);Jr(c,r),$t(c,r);let d=new Y,h=new xt,g=new _t,b=new O,M,m,p=0;for(let y of e){let v=y.components[0],x=y.components[1],S=v.mesh;if(S){let w=this.getBatchForMesh(S);w&&this.removeBatch(w),ts(S)}v.mesh=c,v.instanceIndex=p,m=v.feature,M=this.convertTo3DMapPosition(m.geometry.coordinates[1],m.geometry.coordinates[0],0),v.position.set(M.x,M.y,v.altitude),kn(h,x.rotation),zn(b,x.scale),x.visible===!1&&b.set(0,0,0),g.setFromEuler(h),d.compose(v.position,g,b);for(let w of c.children)w instanceof K&&(w.setMatrixAt(p,d),w.userData.entities[p]=y.id,w.count=p+1,w.instanceMatrix.needsUpdate=!0);rs(c,p,x.color,x.material),p++}u.count=p,es(c)}removeInstanceFromBatch(e,t,r){let o=e.count-1,i=e.opacity===1&&t.userData?.detached!==!0;if(e.count===1){if(i){e.count=0;for(let u of t.children)u instanceof K&&(u.count=0,u.instanceMatrix.needsUpdate=!0);let c=this.instanceMap.get(e.containerId)?.get(e.urlHash);c&&c.object===e.mesh&&(c.count=0),this.updateDebugUI();return}this.removeBatch(e),ts(t),this.updateDebugUI();return}for(let l of t.children)if(l instanceof K){if(r!==o){l.getMatrixAt(o,this.tempMatrix),l.getColorAt(o,this.tempColor),l.setMatrixAt(r,this.tempMatrix),l.setColorAt(r,this.tempColor);let c=l.userData.entities[o];if(c){l.userData.entities[r]=c;let u=this.state.geometry3DMap.get(c);u&&(u.components[0].instanceIndex=r)}}delete l.userData.entities[o],l.count=o,l.instanceMatrix.needsUpdate=!0,l.instanceColor&&(l.instanceColor.needsUpdate=!0)}e.count=o;let a=this.instanceMap.get(e.containerId)?.get(e.urlHash);a&&a.object===e.mesh&&(a.count=o),this.updateDebugUI()}updateModelStyles(){for(let e of this.state.geometry3DsInScene){if(e?.type!=="model")continue;let t=e.components[1],r=e.components[0];if(!t.dirty&&!r.positionDirty)continue;if(r.instancingDisabled){this.updateNonInstancedModelStyle(e),t.dirty=!1,r.positionDirty=!1;continue}let o=r.mesh?.userData,i=o?.detached,s=t.opacity!=null&&t.opacity!==1,a=t.opacity??1,l=o?.sharedOpacity,c=l!==void 0&&Math.abs(a-l)>.01;if((s&&!i&&r.mesh||c)&&this.pendingOpacityChanges.set(e.id,{entity:e,targetOpacity:a}),Un(e),this.updateInstanceTransform(e),this.updateInstanceColor(e,t.color,t.material),r.mesh?.userData?.detached&&r.mesh){let d=t.opacity??1;Jr(r.mesh,d),$t(r.mesh,d)&&(this.transparencyChanged=!0)}t.dirty=!1,r.positionDirty=!1}}flushPendingOpacityChanges(){if(this.pendingOpacityChanges.size===0)return;let e=new Map,t=new Map,r=(o,i,s,a,l,c)=>{let u=Math.round(i*100),d=`${s}_${a}_${u}`,h=t.get(d);h||(h={entities:[],targetOpacity:i,urlHash:s,containerId:a,gltf:l,parent:c},t.set(d,h)),h.entities.push(o)};for(let{entity:o,targetOpacity:i}of this.pendingOpacityChanges.values()){let s=o.components[0];if(!s.mesh||s.instanceIndex==null)continue;let a=s.mesh,l=this.getBatchForMesh(a),c=a.parent;if(!(c instanceof Ce))continue;let u=c.userData.modelURL;if(!u)continue;let d=on(u),h=this.gltfCache.get(d);if(!h)continue;let g=c.parent,b=g instanceof ie?g.userData.entityId:"unknown";if(l){let M=e.get(l);M||(M={entities:[],targetOpacity:i},e.set(l,M)),Math.round(M.targetOpacity*100)===Math.round(i*100)?M.entities.push(o):r(o,i,d,b,h,c)}else r(o,i,d,b,h,c)}for(let[o,i]of e){let{entities:s,targetOpacity:a}=i,l=o.mesh.userData?.detached===!0,c=Math.round(a*100)===100;if(s.length===o.count&&l&&!c)o.opacity=a,o.mesh.userData.sharedOpacity=a,Jr(o.mesh,a),$t(o.mesh,a)&&(this.transparencyChanged=!0);else{let h=s[0]?.components[0]?.mesh?.parent;if(h instanceof Ce){let g=h.userData.modelURL;if(g){let b=on(g),M=this.gltfCache.get(b),m=h.parent,p=m instanceof ie?m.userData.entityId:"unknown";if(M)for(let y of s)r(y,a,b,p,M,h)}}}}for(let o of t.values()){let{entities:i,targetOpacity:s,urlHash:a,containerId:l,gltf:c,parent:u}=o,d=Math.round(s*100);for(let p of i){let y=p.components[0],v=y.mesh,x=this.getBatchForMesh(v),S=y.instanceIndex;x&&S!=null&&S>=0&&this.removeInstanceFromBatch(x,v,S)}let h,g,b=this.batchesByUrlHash.get(a);if(b){for(let p of b)if(p.containerId===l&&Math.round(p.opacity*100)===d&&p.count+i.length<=p.maxCount){h=p,g=p.mesh;break}}if(!h||!g){let p=Math.max(Kr,i.length),y=qr(c,p);y.userData.detached=!0,y.userData.sharedOpacity=s,u.add(y),h=this.createBatch(y,a,l,s,p),g=y,Jr(y,s),$t(y,s)&&(this.transparencyChanged=!0)}let M,m;for(let p of i){let y=p.components[0],v=p.components[1],x=h.count;y.mesh=g,y.instanceIndex=x,m=y.feature,M=this.convertTo3DMapPosition(m.geometry.coordinates[1],m.geometry.coordinates[0],0),y.position.set(M.x,M.y,y.altitude),kn(this.tempEuler,v.rotation),zn(this.tempScale,v.scale),v.visible===!1&&this.tempScale.set(0,0,0),this.tempQuaternion.setFromEuler(this.tempEuler),this.tempMatrix.compose(y.position,this.tempQuaternion,this.tempScale);for(let S of g.children)S instanceof K&&(S.setMatrixAt(x,this.tempMatrix),S.userData.entities[x]=p.id,S.count=x+1,S.instanceMatrix.needsUpdate=!0);this.updateInstanceColor(p,v.color,v.material),h.count++,g.userData.detached?this.detachedEntityIds.add(p.id):this.detachedEntityIds.delete(p.id)}es(g),this.publish("batch-changed")}this.pendingOpacityChanges.clear(),this.updateDebugUI()}updateInstanceTransform(e){let t=e.components[0],r=e.components[1];if(!t.mesh)return;let o=t.feature,{x:i,y:s}=this.convertTo3DMapPosition(o.geometry.coordinates[1],o.geometry.coordinates[0],0);if(t.position.set(i,s,t.altitude),kn(this.tempEuler,r.rotation),r.visible===!1?this.tempScale.set(0,0,0):zn(this.tempScale,r.scale),t.instancingDisabled){t.mesh.position.copy(t.position),t.mesh.rotation.set(this.tempEuler.x,this.tempEuler.y,this.tempEuler.z),t.mesh.scale.copy(this.tempScale);return}if(!(t.instanceIndex==null||t.instanceIndex<0)){this.tempQuaternion.setFromEuler(this.tempEuler),this.tempMatrix.compose(t.position,this.tempQuaternion,this.tempScale);for(let a of t.mesh.children)a instanceof K&&(a.setMatrixAt(t.instanceIndex,this.tempMatrix),a.instanceMatrix.needsUpdate=!0)}}updateNonInstancedModelStyle(e){let t=e.components[0],r=e.components[1];if(!t.mesh)return;Un(e),this.updateInstanceTransform(e);let o=r.opacity??1;il(t.mesh,o,r.visibleThroughGeometry),r.EXPERIMENTAL_clippingEnabled||$t(t.mesh,o)&&(this.transparencyChanged=!0),r.color&&ol(t.mesh,r.color)}updateInstanceColor(e,t,r){let o=e.components[0];!o.mesh||o.instanceIndex==null||o.instanceIndex<0||rs(o.mesh,o.instanceIndex,t,r)}removeInstance(e){let t=e.components[0];if(this.detachedEntityIds.delete(e.id),this.nonInstancedModels.has(e.id)){let c=this.nonInstancedModels.get(e.id);return c?.mesh&&(sl(c.mesh),c.mesh.parent?.remove(c.mesh)),this.nonInstancedModels.delete(e.id),t.mesh=null,this.updateDebugUI(),!0}if(!t.mesh||t.instanceIndex==null||t.instanceIndex<0)return!0;let r=this.getBatchForMesh(t.mesh);if(!r)return!0;let o=t.instanceIndex,i=r.count-1,s=r.opacity===1&&t.mesh.userData?.detached!==!0;if(r.count===1){if(s){r.count=0;for(let b of t.mesh.children)b instanceof K&&(b.count=0,b.instanceMatrix.needsUpdate=!0);let g=this.instanceMap.get(r.containerId)?.get(r.urlHash);return g&&g.object===r.mesh&&(g.count=0),t.mesh.parent&&t.mesh.parent.remove(t.mesh),t.mesh=null,this.updateDebugUI(),!1}let c=r.urlHash;this.removeBatch(r);let u=this.batchesByUrlHash.get(c),d=!1;if(u){for(let h of u)if(h.count>0){d=!0;break}}return ts(t.mesh),t.mesh=null,this.updateDebugUI(),!d}for(let c of t.mesh.children)if(c instanceof K){if(o!==i){c.getMatrixAt(i,this.tempMatrix),c.getColorAt(i,this.tempColor),c.setMatrixAt(o,this.tempMatrix),c.setColorAt(o,this.tempColor);let u=c.userData.entities[i];if(u){c.userData.entities[o]=u;let d=this.state.geometry3DMap.get(u);d?d.components[0].instanceIndex=o:_.warn("[removeInstance] Could not find lastEntity in geometry3DMap:",u)}}delete c.userData.entities[i],c.count=i,c.instanceMatrix.needsUpdate=!0,c.instanceColor&&(c.instanceColor.needsUpdate=!0)}r.count=i;let l=this.instanceMap.get(r.containerId)?.get(r.urlHash);return l&&l.object===r.mesh&&(l.count=i),t.mesh=null,this.updateDebugUI(),!1}destroy(){this.gltfCache.clear(),this.gltfLoadPromises.clear();for(let e of this.instanceMap.values())for(let t of e.values())Nh(t.object);this.instanceMap.clear(),this.modelNames.clear(),this.batchByMesh.clear(),this.batchesByUrlHash.clear(),this.batchCounter=0;for(let e of this.nonInstancedModels.values())e.mesh&&(sl(e.mesh),e.mesh.parent?.remove(e.mesh));this.nonInstancedModels.clear(),this.debugUI.destroy(),this.loadPromises=[],this.loader=void 0}endFrame=()=>{this.transparencyChanged=!1}};f();var is=class{#e;#n;#i=new O;#o=new W;constructor(e,t,r,o,i={}){this.#e=t,this.#n=new vc(e,r,this.#s(o),i)}#s(e){return(t,r,o)=>(this.#i.set(t,r,o),this.#o.set(0,0),e(this.#o,this.#i),this.#o.x===0&&this.#o.y===0?null:{x:this.#o.x,y:this.#o.y})}get pipeline(){return this.#n}get labelCanvas(){return this.#n.labelCanvas}get interactiveCollidersQTree(){return this.#n.collisionSystem.interactiveCollidersQTree}get visibleCollidersQTree(){return this.#n.collisionSystem.visibleCollidersQTree}resize(){this.#n.resize()}syncTwoDEntities(){this.#n.clearEntities();for(let e of this.#e.geometry2DsInScene)e.syncPosition(),this.#n.addEntity(e.entity2D)}update(e,t,r,o=[]){this.#l(),this.#n.update(e,t,r,o)}#l(){let e,t;for(let r of this.#e.geometry2DsInScene){t=r.components[0];let o=r.attachedTo?this.#e.geometry3DMap.get(r.attachedTo):void 0;if(o instanceof $)if(this.#e.geometry3DsInScene.has(o)){if(e=o.components[1],e.dirty||t.attachedDirty){let s=e.height,a=e.altitude;r.setAltitude(s+a)}let i=e.visible;t.visible!==i&&(t.visible=i)}else t.visible===!0&&(t.visible=!1);t.attachedDirty=!1}}markDirty(){this.#n.markDirty()}get collidersNeedRecomputing(){return this.#n.collidersNeedRecomputing}set collidersNeedRecomputing(e){this.#n.collidersNeedRecomputing=e}updateWatermark(e){this.#n.updateWatermark(e)}cancelPendingFrames(){this.#n.cancelPendingFrames()}setCollidersDirty(){this.#n.collisionSystem.collidersDirty=!0}deleteTextCacheEntry(e){delete this.#n.drawSystem.textCache[e]}showCollisionBoxes(){this.#n.showCollisionBoxes()}hideCollisionBoxes(){this.#n.hideCollisionBoxes()}destroy(){this.#n.destroy()}};var Bh=new kt;var{DEFAULT_PITCH:ll,DEFAULT_BEARING:cl,DEFAULT_ZOOM_LEVEL:ul,DEFAULT_MIN_ZOOM_LEVEL:gy,DEFAULT_MAX_ZOOM_LEVEL:yy}=rt,by=U.radToDeg(.6435011087932844),al=class extends Z{options;container;Debug;#e;#n;#i;#o;get viewCamera(){return this.#o}get cameraObject(){return this.#n}#s;#l;#a;#h;get canvasWidth(){return this.#t.canvasWidth}get canvasHeight(){return this.#t.canvasHeight}rendererDomElement;get resolutionScale(){return this.map?._getClampedPixelRatio(this.canvasWidth,this.canvasHeight)??Br()}#y(e){this.#p!=="outdoors-overlay"&&this.map?.setPixelRatio(e),this.#t.pixelRatio=this.resolutionScale}get aspect(){return this.canvasWidth/this.canvasHeight}get labelsCanvas(){return this.#r.twoDEntitySystem?.labelCanvas??null}#t;camera;#d;#r={};#b=null;map;#m=()=>{this.signal?.aborted||!this.#r?.renderSystem||(this.#r.renderSystem.twoDdirty=!0)};#c=()=>{this.signal?.aborted||!this.#r?.renderSystem||(this.#r.renderSystem.threeDdirty=!0)};#g=()=>{this.map&&(this.#t.depthRangeFor3D=this.map.painter.depthRangeFor3D)};#x=(e,t)=>{e.addEventListener("childadded",t),e.addEventListener("childremoved",t),this.onAbort(()=>{e.removeEventListener("childadded",t),e.removeEventListener("childremoved",t)})};#C(){this.#r.twoDEntitySystem.markDirty()}#p="standalone";get mode(){return this.#p}constructor(e,t={}){super();let r={geometry3DMap:new Map,geometry2DMap:new Map,geometry2DIdsInScene:new Set,geometry3DIdsInScene:new Set,geometryGroupIdsToLoad:new Set,geometry3DsInScene:new Set,geometry2DsInScene:new Set,geometryScene:new ie("__scene"),hoverColor:"#f6efff",text3dHoverColor:"white",insetsPadding:Do,shouldMeasureCanvas:!0,pixelRatio:this.resolutionScale,canvasWidth:0,canvasHeight:0,internalTweenGroup:new As,externalTweenGroup:new As,cameraObject:new Fs,naturalBearing:0,containerOffset:[0,0],useStandaloneCamera:!1,directionalLight:new Co(16777215,.3*Math.PI),ambientLight:new lc(16777215,.741*Math.PI),renderer:void 0,threeJSScene:new St,depthRangeFor3D:[0,1],geometry2DState:{entities:new Set,entityMap:new Map,entityIds:new Set,get pixelRatio(){return r.pixelRatio}}};if(this.#t=r,this.#t.useStandaloneCamera=t.useStandaloneCamera??!1,this.#t.naturalBearing=t.naturalBearing??0,this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),!e.clientWidth||!e.clientHeight)throw new Error("[MappedinJS] Container width and height must be greater than 0");(t.mode==="outdoors-interleaved"||t.mode==="outdoors-overlay")&&t.map&&(this.#p=t.mode,this.map=t.map),this.#x(this.#t.geometryScene,()=>{this.#c(),this.#m()}),this.#t.geometry3DMap.set(this.#t.geometryScene.userData.entityId,this.#t.geometryScene),t.center&&(this.#t.center=t.center?[...t.center]:[0,0]),this.options=t,this.container=e,this.#r.htmlControlsSystem=this.#u(new hi(this.container,{outdoorEnabled:!!this.map})),this.#r.maskingSystem=this.#u(new Xi(this.#t)),this.#p!=="outdoors-overlay"&&this.#r.htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),E.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),this.#d=new Uo({antialias:typeof t.antialias=="boolean"?t.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?t.gl?.canvas:void 0,onWebGLContextCreationError:t.onWebGLContextCreationError,onWebGLContextLost:t.onWebGLContextLost,onWebGLContextRestored:b=>{t.onWebGLContextRestored?.(b),this.#m(),this.#c(),this.render()},onWebGLRendererError:t.onWebGLRendererError,backgroundColor:t.backgroundColor||"#ffffff",backgroundAlpha:t.backgroundAlpha??1}),this.#t.renderer=this.#d.renderer,this.#e=this.#t.threeJSScene,this.#e.matrixWorldAutoUpdate=!1,this.#p!=="standalone"&&this.#e.add(Fc()),this.#e.add(this.#t.geometryScene);let o=window.__THREE_DEVTOOLS__;E.env.NODE_ENV==="dev"&&typeof o<"u"&&(o.dispatchEvent(new CustomEvent("observe",{detail:this.#e})),o.dispatchEvent(new CustomEvent("observe",{detail:this.#d}))),this.#n=new Fs(by,this.aspect,50,1e5),this.#t.cameraObject=this.#n,this.#o=new ec,this.#o.matrixWorldAutoUpdate=!1,this.#n.renderOrder=999;let i=new Ge;i.add(this.#n),this.#h=new Ge,this.#h.add(i),this.#e.add(this.#h),this.#n.updateProjectionMatrix(),this.#n.updateMatrixWorld(!0),t.__EXPERIMENTAL_shadows?.enabled&&(this.#r.shadowsSystem=this.#u(new Qi(this.#t,this.#d,this.#h,t.__EXPERIMENTAL_shadows)),this.map&&this.onMapLibreEvent("render",this.#g)),this.#O=this.mode==="standalone"?this.#n:this.#o,this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:()=>0,georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=this.#d.domElement(),this.#s=new W;let s=new Ie(1e6,1e6),a=new Me({color:0,visible:!1});this.#l=new V(s,a),this.#l.name="worldPlane",this.#e.add(this.#l),t.gl?.canvas||e.appendChild(this.rendererDomElement),window.addEventListener("resize",this.#G,{capture:!1,signal:this.signal}),this.#A(),document.addEventListener("visibilitychange",this.#B,{signal:this.signal}),typeof ResizeObserver=="function"&&E.env?.NODE_ENV!=="test"&&(this.#a=new ResizeObserver(co(b=>{this.#P(b[0].contentRect.width,b[0].contentRect.height)},50)),this.#a?.observe(e),this.#a&&this.onAbort(()=>this.#a?.disconnect())),e.classList.add("mappedin-map"),e.style.isolation="isolate",this.rendererDomElement.style.width=globalThis.MappedinDebug?.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=globalThis.MappedinDebug?.TEST_IOS?"1920px":"100%",E.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),this.mode!=="outdoors-overlay"&&this.rendererDomElement.tabIndex!==void 0&&this.rendererDomElement.removeAttribute("tabindex"),Object.defineProperty(this.#t,"canvasWidth",{configurable:!0,enumerable:!0,get:()=>this.rendererDomElement.clientWidth}),Object.defineProperty(this.#t,"canvasHeight",{configurable:!0,enumerable:!0,get:()=>this.rendererDomElement.clientHeight}),this.rendererDomElement.style.touchAction="manipulation";let l=this.canvasWidth,c=this.canvasHeight;this.#r.watermarkSystem=this.#u(new li(this.#n,this.#t,t?.watermark)),this.#r.watermarkSystem.on("texture-loaded",this.render),this.#t.shouldMeasureCanvas=!0,this.#t.pixelRatio=this.resolutionScale,this.#L(Math.floor(l*this.resolutionScale),Math.floor(c*this.resolutionScale)),this.#t.directionalLight.position.set(-150,-150,350),this.#e.add(this.#t.directionalLight),this.#e.add(this.#t.ambientLight),this.#r.cameraSystem=this.#u(new Wr(this.#n,this.#e,this.#d.renderer,this.#t,{mode:this.mode,canvasHeight:c,canvasWidth:l})),globalThis.MappedinDebug?.__idleCallbackInteractionState&&(globalThis.MappedinDebug.__idleCallbackInteractionState.registerInteractionChecker(this.#r.cameraSystem.isUserInteracting),globalThis.MappedinDebug.__idleCallbackInteractionState.registerInteractionChecker(this.#r.cameraSystem.isCameraMoving)),this.#r.cameraSystem.on("user-dolly-start",this.#M,{signal:this.signal}),this.#r.cameraSystem.on("user-pan-start",this.#M,{signal:this.signal}),this.#r.cameraSystem.on("user-rotate-start",this.#M,{signal:this.signal}),this.#r.cameraSystem.on("user-zoom-start",this.#M,{signal:this.signal}),this.#r.cameraSystem.on("user-tilt-start",this.#M,{signal:this.signal}),this.#r.cameraSystem.on("user-pedestal-start",this.#M,{signal:this.signal}),this.#r.cameraSystem.on("user-dolly-end",this.#v,{signal:this.signal}),this.#r.cameraSystem.on("user-pan-end",this.#v,{signal:this.signal}),this.#r.cameraSystem.on("user-rotate-end",this.#v,{signal:this.signal}),this.#r.cameraSystem.on("user-zoom-end",this.#v,{signal:this.signal}),this.#r.cameraSystem.on("user-tilt-end",this.#v,{signal:this.signal}),this.#r.cameraSystem.on("user-pedestal-end",this.#v,{signal:this.signal}),this.#r.cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),this.#r.geometryInFocusSystem&&(this.#r.geometryInFocusSystem.cameraDirty=!0),this.render()}),this.#r.pathSystem=this.#u(new Fn(this.#t,this.convertTo3DMapPosition,this.getParentContainer,this.#r.cameraSystem.convertZoomLevelToAltitude)),this.#r.pathSystem.on("animate:path",this.render,{signal:this.signal}),this.#r.panBoundsSystem=this.#u(new di(this.#t,this.#r.cameraSystem));let u=()=>{let{panBounds:b,fov:M,convertAltitudeToZoomLevel:m}=this.#r.cameraSystem;if(this.#r.panBoundsSystem.autoMinZoomLevel){if(b.radius<=0)return;let p=Math.min(this.#t.canvasWidth/this.#t.canvasHeight,1),y=M*Math.PI/180*p,v=Math.tan(y/2),{radius:x,center:S}=this.#r.cameraSystem.panBounds,w=x/v,D=this.getThreeCamera().getWorldPosition(new O),C=S.distanceTo(D),T=Math.abs(D.z-S.z),P=w*T/C,I=m(P);_c(I,this.camera.minZoomLevel)&&this.camera.setMinZoomLevel(I)}this.publish("pan-bounds-change",this.#r.cameraSystem.panBounds)};this.#r.panBoundsSystem.on("update",u,{signal:this.signal}),this.camera=this.#u(new ai(this,this.#r,this.#t));let d=()=>{this.#r.geometryInFocusSystem&&this.#r.geometryInFocusSystem.resize(),this.render()};this.camera.on("padding-change",d,{signal:this.signal}),this.camera.setZoomLevel(t.zoomLevel??ul),this.camera.setBearing(t.bearing??cl),this.camera.setPitch(t.pitch??ll),this.camera.setMaxZoomLevel(yy),this.camera.setMinZoomLevel(gy),this.#r.twoDEntitySystem=this.#u(new is(this.container,this.#t,this.#t.geometry2DState,this.project,{workerUrl:Rs||void 0,useCollisionWorker:(t.useCollisionWorker??!0)&&(t.useWorkers??!0),transformImageRequest:t.transformImageRequest,watermark:{width:0,height:0,position:"bottom-left"}})),this.#r.interactionSystem=this.#u(new yn(this.rendererDomElement,this.#t,this.#n,this.#l,this.#r.cameraSystem.isUserInteracting)),this.#r.interactionSystem.on("doubletap-with-onefinger",b=>{this.#r.cameraSystem.enableZoom&&this.camera.animateTo({center:this.projectScreenXYToCoordinate(b.clientX,b.clientY)?.coordinate,zoomLevel:this.camera.zoomLevel+1,duration:ks,easing:"ease-out"})}),this.#r.interactionSystem.on("singletap-with-twofinger",()=>{this.#r.cameraSystem.enableZoom&&this.camera.animateTo({zoomLevel:this.camera.zoomLevel-1,duration:ks,easing:"ease-out"})}),this.#r.interactionSystem.on("hover",this.render),this.#r.interactionSystem.on("click",b=>{if(b.entity2D.some(m=>m.id==="watermark")&&typeof this.#r.watermarkSystem.options.onClick=="function"&&this.#r.watermarkSystem.options.interactive){this.#r.watermarkSystem.options.onClick();return}if(!b.position){_.error("Pointer event outside world-plane");return}this.publish("click",{...this.#D(b,b.position),pointerEvent:b.pointerEvent})}),this.#r.interactionSystem.on("hover",b=>{b.position&&this.publish("hover",this.#D(b,b.position))}),this.#r.geometryInFocusSystem=this.#u(new Si(this.#t,this.#O));let h=b=>{this.publish("geometry-in-focus",b)};this.#r.geometryInFocusSystem.on("geometry-in-focus",h,{signal:this.signal}),this.#r.drawSystem=this.#u(new $o(this.#t,this.convertTo3DMapPosition,this.convert3DMapPositionToCoordinate)),this.#r.exporterSystem=this.#u(new vn(this.#t)),this.#r.batchedMeshSystem=this.#u(new Xo(this.#t,this.convertTo3DMapPosition)),this.#r.batchedMeshSystem.on("geometry-2d-added",this.render,{signal:this.signal}),this.#r.batchedMeshSystem.on("geometry-group-added",this.#f,{signal:this.signal}),this.#r.modelSystem=this.#u(new os(this.#t,this.convertTo3DMapPosition)),this.#r.modelSystem.on("model-loaded",()=>{this.#r.shadowsSystem&&(this.#r.shadowsSystem.needsRender=!0),this.render()},{signal:this.signal}),this.#r.modelSystem.on("batch-changed",()=>{this.#r.interactionSystem.dirty3D=!0},{signal:this.signal}),this.#r.meshDetachmentSystem=this.#u(new ki(this.#t)),this.#r.meshModificationSystem=this.#u(new Ui(this.#t)),this.#r.geometryDisposalSystem=this.#u(new Vi(this.#t)),this.#r.textureSystem=this.#u(new ji(this.#t)),this.#r.textureSystem.on("texture-added",this.render,{signal:this.signal}),this.#r.borderSystem=this.#u(new xu(this.#t,this.convertTo3DMapPosition)),this.#r.clippingPlaneSystem=this.#u(new Yi(this.#t)),this.#r.renderOrderSystem=this.#u(new Zi(this.#t)),this.#r.pluginSystem=this.#u(new $i),this.#r.customGeometrySystem=this.#u(new pi(this.#t,this.convertTo3DMapPosition));let g=typeof t.outlines=="object"?t.outlines:void 0;g&&(this.#t.outlinesOptions=g),this.#r.outlineInterpolationSystem=this.#u(new mi(this.#t,g)),this.#r.outlineInterpolationSystem.on("needs-render",this.render,{signal:this.signal}),this.#r.renderSystem=this.#u(new qo(this.#d,this.#t,this.mode,this.#e,this.#n,this.viewCamera,this.#r)),this.#r.imageSystem=this.#u(new vi(this.#t,this.convertTo3DMapPosition,this.project,t.bearing,t.naturalBearing,t.imagePlacementOptions,t.transformImageRequest)),this.#r.text3DSystem=this.#u(new Bc(this.#t,this.convertTo3DMapPosition,t.useWorkers??!0)),this.#r.text3DSystem.on("render",this.render,{signal:this.signal}),this.#r.imageSystem.on("image-loaded",this.render,{signal:this.signal}),this.#r.renderSystem.on("pre-render",()=>this.publish("pre-render"),{signal:this.signal}),this.#r.renderSystem.on("post-render",()=>this.publish("post-render"),{signal:this.signal}),this.#r.renderSystem.on("measure-canvas",this.#_,{signal:this.signal}),this.#r.outdoorLayersSystem=this.#u(new Ai(this.map)),this.#r.occlusion2DSystem=this.#u(new Wi(this.#t,this.convertTo3DMapPosition,this.#d)),t.occlusionEnabled&&this.#r.occlusion2DSystem.enable(),this.Debug=new Hi(this),t.environment!==!1&&(this.#i=this.#z()),this.#R()}#f=()=>{this.#r.geometryDisposalSystem.dirty=!0,this.render()};#S=e=>Math.trunc(e*10)/10;#E=()=>{this.#y(Br()),this.#r.twoDEntitySystem.markDirty(),this.#P(void 0,void 0,!0)};#A=()=>{this.signal?.aborted||typeof window>"u"||(this.#b=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),this.#b.addEventListener("change",()=>{this.#E(),this.#A()},{once:!0,signal:this.signal}))};#B=()=>{document.visibilityState==="visible"&&this.#P(void 0,void 0,!0)};#G=()=>{this.#P()};#O;#P=(e,t,r=!1)=>{let o=e??this.rendererDomElement.clientWidth,i=t??this.rendererDomElement.clientHeight;if((o===0||i===0)&&!r)return;if(this.#r.twoDEntitySystem.resize(),this.#y(Br()),this.#_(),this.#C(),this.#r.cameraSystem.resize(this.canvasWidth,this.canvasHeight),this.#r.cameraSystem.dirty=!0,this.#r.cameraSystem.stateDirty=!0,this.map!=null){Ro(this.map,this.camera.minZoomLevel,this.camera.maxZoomLevel);let l=this.camera.zoomLevel,c=U.clamp(l,this.camera.minZoomLevel,this.camera.maxZoomLevel);c!==l&&this.camera.setZoomLevel(c)}this.#r.watermarkSystem.resize(this.canvasWidth,this.canvasHeight),this.#r.htmlControlsSystem.resize(this.canvasWidth),this.#r.geometryInFocusSystem.resize(),this.#r.occlusion2DSystem.resize(),this.#r.twoDEntitySystem.resize();let{top:s,left:a}=this.container.getBoundingClientRect();this.#t.containerOffset=[s,a],this.publish("resize"),this.map!=null&&this.publish("camera-change",this.camera),this.render()};#R=()=>{this.renderSync()};#w=new O;project=(e,t)=>{if(this.#n.position.z+this.camera.elevation>t.z){this.#w.copy(t);let r=this.#w.project(this.#O),o=(r.x+1)/2*this.canvasWidth-0/2,i=(-r.y+1)/2*this.canvasHeight-0/2,s=this.#S(o),a=this.#S(i);e.x=s,e.y=a,e instanceof O&&(e.z=r.z)}else e.x=-1e3,e.y=-1e3,e instanceof O&&(e.z=1/0)};#L=(e,t)=>{this.#d.setBufferSize(e,t),this.#n.aspect=e/t,this.#n.updateProjectionMatrix(),this.#n.updateMatrixWorld(!0),this.#s.x=e,this.#s.y=t};#_=()=>{let e=this.rendererDomElement.clientWidth,t=this.rendererDomElement.clientHeight,r=Math.floor(e*this.resolutionScale),o=Math.floor(t*this.resolutionScale);this.#L(r,o),this.map?.resize(),this.#t.shouldMeasureCanvas=!1};addGroupContainer(e,t,r){if(!this.#t.geometry3DMap.has(e)&&!this.#t.geometry2DMap.has(e)){let o=new ie(e);this.#x(o,()=>{this.#c(),this.#m()}),t?.visible!==void 0&&(o.visible=t.visible),t?.altitude!==void 0&&o.setAltitude(t.altitude),t?.interactive!==void 0&&Le(o,t.interactive,this.#t),t?.focusable!==void 0&&ko(o,t.focusable),t?.preloadGeometry!==void 0&&(o.userData.preloadGeometry=t.preloadGeometry),this.#t.geometry3DMap.set(e,o);let i=this.getParentContainer(r);i instanceof ie&&i.addEntity(o),this.#c(),this.render()}else _.error(`Group container with ID '${e}' already exists. The group container cannot be added.`);return{id:e,type:"group-container"}}getParentContainer=(e,t=!0)=>{if(!e)return t?this.#t.geometryScene:void 0;if(typeof e=="string"||typeof e=="number"){let r=this.#t.geometry3DMap.get(e);return r instanceof ie?r:(_.warn(`Parent (${typeof e=="object"?e.id:e}) is not a valid container, adding to scene`),t?this.#t.geometryScene:void 0)}else if(e.type==="group-container"){let r=this.#t.geometry3DMap.get(e.id);if(r instanceof ie)return r}return t?this.#t.geometryScene:void 0};addCustomGeometry(e,t,r,o,i){if(this.#t.geometry3DMap.has(e))_.error(`Custom geometry with ID '${e}' already exists. The custom geometry cannot be added.`);else{let s=new Vr(t,r),a=new $(s,new ct(o));o?.interactive!==void 0&&Le(a,o.interactive,this.#t),a.id=e,s.mesh.userData={entityId:e,type:"custom-geometry"},this.#t.geometry3DMap.set(a.id,a);let l=this.getParentContainer(i);i&&l instanceof ie?l.addEntity(a):this.#t.geometryScene.addEntity(a),this.#r.panBoundsSystem.dirty=!0,this.#c(),this.render()}return{id:e,type:"custom-geometry"}}registerPlugin(e){this.#r.pluginSystem.registerPlugin(e)}unregisterPlugin(e){this.#r.pluginSystem.unregisterPlugin(e)}addFeatureCollection(e,t,r,o,i){if(!this.#t.geometry3DMap.has(e)&&!this.#t.geometry2DMap.has(e)){let s=new Ce(e);this.#x(s,()=>{this.#c(),this.#m()}),s.userData.dirty=!0,o?.altitude!==void 0&&(s.position.z=o.altitude),o?.visible!==void 0&&(s.visible=o.visible);let a="merged",l;if(typeof r=="function"?(a="batched",l=r):typeof r=="object"?l=()=>r:l=()=>({color:zo}),this.#t.geometry3DMap.set(e,s),a==="batched")for(let d of t.features){if(d.geometry==null||!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(d.geometry.type))continue;let h=d?.id||d?.properties?.id||Dr(),g=l(d)??{color:zo},b=this.#r.batchedMeshSystem.createEntityFromFeature(h,d,{outline:!0,...g});this.#t.geometry3DMap.set(h,b),s.userData.entities3D.add(h),this.#r.textureSystem.dirty=!0}else if(a==="merged"){let d=l()??{color:zo},h=this.#r.batchedMeshSystem.createEntityFromFeature(e,t.features,{outline:!0,...d});this.#t.geometry3DMap.set(h.id,h),s.userData.entities3D.add(h.id),s.userData.isMerged=!0,this.#r.textureSystem.dirty=!0}let c=t.features.length>0?l(t.features[0]):void 0;c?.__EXPERIMENTAL_maskEnabled===!0&&Ys(s,{enabled:c.__EXPERIMENTAL_maskEnabled,maskId:c.__EXPERIMENTAL_maskId,effect:c.__EXPERIMENTAL_maskEffect,mode:c.__EXPERIMENTAL_maskMode});let u=this.getParentContainer(i);u instanceof ie&&u.addEntity(s),this.#r.panBoundsSystem.dirty=!0,this.#c(),this.render()}else _.error(`Feature collection with ID '${e}' already exists. The feature collection cannot be added.`);return this.#r.outlineInterpolationSystem.geometries3DDirty=!0,{id:e,type:"feature-collection"}}addOccluder(e,t){let r=this.getParentContainer(t),o=this.#r.occlusion2DSystem.reserveOccluderId();return r?.addOccluderFeature(e,o),o}addImage(e,t,r,o){try{td(e,t,r)}catch(i){_.error(i);return}if(!this.#t.geometry3DMap.has(e)&&!this.#t.geometry2DMap.has(e)){let i=new Pn(t),s=new $(i,new ct(r));s.id=e||Dr(),i.mesh.userData={entityId:s.id,type:"path"},this.#t.geometry3DMap.set(s.id,s),r?.interactive!=null&&Le(s,r.interactive,this.#t);let a=this.getParentContainer(o);a instanceof ie&&a.addEntity(s);let l=t.geometry.coordinates;if(l){let c=this.convertTo3DMapPosition(l[1],l[0],l[2]??0);this.#r.panBoundsSystem.expandBoundsIfOutside(c)}this.#c(),this.render()}else _.error(`Image with ID '${e}' already exists. The image cannot be added.`);return{id:e,type:"image"}}addModelGroup(e,t,r,{parent:o,onComplete:i}={}){try{zu(e,t,r)}catch(s){_.error(s);return}if(!this.#t.geometry3DMap.has(e)&&!this.#t.geometry2DMap.has(e)){let s=new Ce(e);this.#x(s,()=>{this.#c(),this.#m()}),this.#t.geometry3DMap.set(e,s),s.userData.dirty=!0,s.userData.modelURL=r.url;for(let c of t.features){let u=c.id||c.properties.id||Dr(),d=this.#r.modelSystem.createModelFromFeature(u,c,{...r});(c.properties.interactive!==void 0||r.interactive!=null)&&Le(d,c.properties.interactive??r.interactive,this.#t),r.clippingPlaneZOffset!=null&&(d.components[7]=new No,d.components[7].verticalOffset=r.clippingPlaneZOffset,r.clippingPlaneTopColor!=null&&(d.components[7].topColor=r.clippingPlaneTopColor),r.clippingPlaneTopVisible!=null&&(d.components[7].topVisible=r.clippingPlaneTopVisible)),d.parentId=s.userData.entityId,this.#t.geometry3DMap.set(u,d),s.userData.entities3D.add(u)}let a=this.getParentContainer(o);a instanceof ie&&a.addEntity(s);let l=t.features[0]?.geometry.coordinates;if(l){let c=this.convertTo3DMapPosition(l[1],l[0],l[2]??0);this.#r.panBoundsSystem.expandBoundsIfOutside(c)}this.#c(),this.render()?.then(i)}else _.error(`Model group with ID '${e}' already exists. The model group cannot be added.`);return{id:e,type:"feature-collection"}}#T(e,t,r,o){let i=new Gs(t,this.convertTo3DMapPosition(e[1],e[0],e[2]||0),o);return i.components[2]=new qi(r??this.#r.occlusion2DSystem.backgroundId),this.#t.geometry2DMap.set(i.id,i),i}addMarker2D(e,t,r,o){let i=r?.id;try{Sc(e,t,r||{})}catch(s){_.error(s);return}if(i===void 0||!this.#t.geometry2DMap.has(i)&&!this.#t.geometry3DMap.has(i)){let s=this.#T(e,new wo(t,r),r?.occluderId,r?.verticalOffset);s.id=i||String(s.id),i=s.id,r?.interactive!=null&&r.interactive!=="pointer-events-auto"&&Le(s,r?.interactive,this.#t),r?.enabled!=null&&Bo(s,r.enabled),r?.occlude!=null&&js(s,r.occlude);let a=typeof r?.attachTo=="string"||typeof r?.attachTo=="number"?this.#t.geometry3DMap.get(r.attachTo):void 0;a instanceof $&&a.attach(s),this.getParentContainer(o)?.addEntity(s),this.#r.panBoundsSystem.expandBoundsIfOutside(s.object3d.position),this.render()}else _.error(`Marker2D with ID '${i}' already exists. The marker cannot be added.`);return{id:i,type:"marker"}}addText3D(e,t,r,o){if(!this.#t.geometry3DMap.has(e)&&!this.#t.geometry2DMap.has(e)){let i=new Fo({...t,properties:{...t.properties,id:e,content:t.properties.text}}),s=new $(i,new pn(r?.appearance));s.id=e,i.mesh.userData.entityId=e.toString(),i.mesh.userData.type="text3d",this.#t.geometry3DMap.set(e,s);let a=this.getParentContainer(o);a instanceof ie&&a.addEntity(s);let l=t.geometry.coordinates;if(l){let c=this.convertTo3DMapPosition(l[1],l[0],l[2]??0);this.#r.panBoundsSystem.expandBoundsIfOutside(c)}this.#c(),this.render()}else _.error(`Text3D with ID '${e}' already exists. The text3d cannot be added.`);return{id:e,type:"text3d"}}labelText3D(e,t,r={}){try{if(!t||!e)throw new Error("content and meshGeometryId are required");Gc.parse(r)}catch(c){_.error(c);return}let o=this.#t.geometry3DMap.get(e);if(o?.type!=="geometry"){_.error(".labelText3D failed: target incorrect");return}let i=o?.components[0],s=!Array.isArray(i.feature)&&i.feature.properties.textArea;if(!s)return;if(i.textEntityId){let c=this.#t.geometry3DMap.get(i.textEntityId);if(c?.type!=="text3d"){_.error(".labelText3D failed: existing text3d not found");return}return{id:c.id,type:c.type}}let a=new Fo({type:"Feature",geometry:{coordinates:s?.position,type:"Point"},properties:{textArea:s,content:t,id:Dr()}});a.polygonEntityId=e;let l=new $(a,new pn(r?.appearance));return i.textEntityId=l.id.toString(),a.mesh.userData.entityId=l.id.toString(),a.mesh.userData.type="text3d",this.#t.geometry3DMap.set(l.id.toString(),l),r.parentId&&this.getParentContainer(r.parentId)?.addEntity(l),this.#c(),this.render(),{id:l.id,type:"text3d"}}addLabel2D(e,t,r,o){let i=r?.id;try{xc(e,t,r||{})}catch(s){_.error(s);return}if(i===void 0||!this.#t.geometry2DMap.has(i)&&!this.#t.geometry3DMap.has(i)){let s=this.#T(e,new Eo(t,r||{},this.#t.pixelRatio),r?.occluderId,r?.verticalOffset);s.id=i||String(s.id),i=s.id,r?.interactive!=null&&Le(s,r?.interactive,this.#t),r?.enabled!=null&&Bo(s,r.enabled),r?.occlude!=null&&js(s,r.occlude);let a=typeof r?.attachTo=="string"||typeof r?.attachTo=="number"?this.#t.geometry3DMap.get(r.attachTo):void 0;a instanceof $&&a.attach(s),this.getParentContainer(o)?.addEntity(s),this.#r.panBoundsSystem.expandBoundsIfOutside(s.object3d.position),this.#m(),this.render()}else _.error(`Label2D with ID '${i}' already exists. The label cannot be added.`);return{id:i,type:"label"}}addPath(e,t={},r){try{Au(e,t||{})}catch(a){_.error(a);return}let o=new fr(e,hu(t)),i=new $(o,new ct({color:t?.color??"#ff834c",altitude:t?.verticalOffset??.1}));i.id=t?.id||Dr(),o.mesh.userData={entityId:i.id,type:"path"},this.#t.geometry3DMap.set(i.id,i),t?.interactive!=null&&Le(i,t?.interactive,this.#t);let s=this.getParentContainer(r);return s instanceof ie&&s.addEntity(i),this.#r.panBoundsSystem.dirty=!0,this.#c(),this.render(),{id:i.id,type:"path"}}updateWatermark(e){this.#r.watermarkSystem.options=e,this.#r.watermarkSystem.dirty=!0,this.#r.twoDEntitySystem.setCollidersDirty(),this.render()}remove(e){let t;if(typeof e=="string"||typeof e=="number"?(t=this.#t.geometry2DMap.get(e),t==null&&(t=this.#t.geometry3DMap.get(e))):typeof e.id=="string"||typeof e.id=="number"?(t=this.#t.geometry2DMap.get(e.id),t==null&&(t=this.#t.geometry3DMap.get(e.id))):t=e,t!=null){if(t.type==="custom-geometry")this.#t.geometry3DMap.delete(t.id),t.object3d&&ve(t.object3d),this.#c();else if(t.type==="group-container"){this.#t.geometry3DMap.delete(t.userData.entityId);for(let r of t.childrenIds.values())this.remove(r),t.userData.entities2D.delete(r);ve(t),this.#c()}else if(t.type==="feature-collection"){this.#t.geometry3DMap.delete(t.userData.entityId);for(let r of t.userData.entities3D.values())this.remove(r),t.userData.entities3D.delete(r);ve(t),this.#c()}else if(t.type==="geometry"||t.type==="model"||t.type==="path"){let r=t.components[0];if(t.entities2D.size>0){for(let i of t.entities2D.values())this.remove(i);t.removeAllEntities()}let o=t.parentObject3D?.userData.entityId??t.parentId;if(o){let i=this.#t.geometry3DMap.get(o);i instanceof Ce&&i.userData.entities3D.delete(t.id)}if(t.type==="model"){if(this.#r.modelSystem.removeInstance(t)&&t.object3d&&ve(t.object3d),o){let s=this.#t.geometry3DMap.get(o);if(s instanceof Ce&&s.userData.entities3D.size===0){let a=!1;for(let l of s.children)if(l.children.length>0){let c=l.children[0];if(c.isInstancedMesh&&(c.count??0)>0){a=!0;break}}a||this.remove(o)}}}else t.object3d&&ve(t.object3d);if(t.type==="geometry"){let i=t.components[3];i&&(i.enabled=!1,i.dirty=!0)}"textMesh"in r&&r.textMesh!=null&&this.remove(r.textMesh.userData.entityId),this.#t.geometry3DMap.delete(t.id),this.#c()}else if(t.type==="marker"||t.type==="label"){let r=t.attachedTo;if(r){let o=this.#t.geometry3DMap.get(r);o instanceof $&&o.detach(t)}t.object3d&&ve(t.object3d),t.type==="label"&&this.#r.twoDEntitySystem.deleteTextCacheEntry(t.id),this.#t.geometry2DMap.delete(t.id),this.#m()}else if(t.type==="image")t.object3d&&ve(t.object3d),this.#t.geometry3DMap.delete(t.id),this.#c();else if(t.type==="text3d"){ve(t.object3d);let{batchedText:r,textMesh:o,polygonEntityId:i}=t.components[0];if(o&&(r&&r.removeText(o),ve(o)),i){this.#r.text3DSystem.remove(i);let s=this.#t.geometry3DMap.get(i);s?.type==="geometry"&&(s.components[0].textMesh=void 0,s.components[0].textEntityId=void 0)}this.#t.geometry3DMap.delete(t.id),this.#c()}this.render()}}showCollisionBoxes=()=>{this.#r.twoDEntitySystem.showCollisionBoxes(),this.render()};hideCollisionBoxes=()=>{this.#r.twoDEntitySystem.hideCollisionBoxes(),this.render()};getScene(){return this.getState("__scene")}getThreeScene(){return this.#e}getThreeCamera(){return this.#n}async setEnvironment(e){if(this.#e)if(e==="basic"){this.#i||(this.#i=this.#z());let t=await this.#i;this.#e.environment=t}else this.#e.environment=null}getEnvironment(){return this.#e?.environment?"basic":!1}getCurrentSceneGLTF(e){return this.#r.exporterSystem.getCurrentSceneGLTF(e)}getBoundingArea(e){(this.#r.renderSystem.threeDdirty||this.#r.renderSystem.twoDdirty)&&this.renderSync();let t=new ce;if(e==null)t.setFromObject(this.#t.geometryScene);else{let r=hr(this.#t,e);if(r?.type==="geometry"&&r?.object3d!=null){let o=r.components[0],i=o instanceof oe?o.geometry:void 0;o.mesh instanceof xo&&i?(i.computeBoundingBox(),i.boundingBox&&t.union(i.boundingBox)):t.setFromObject(r.object3d)}else(r?.type==="feature-collection"||r?.type==="group-container")&&r?.userData.entityId!=null&&t.setFromObject(r)}if(Nr(t))return wc(t).map(this.convert3DMapPositionToCoordinate)}hasState(e){return hr(this.#t,e)!=null}getState(e){if(e==null)return{type:"map-view",hoverColor:this.#t.hoverColor,text3dHoverColor:this.#t.text3dHoverColor};let t=hr(this.#t,e);if(t?.type==="custom-geometry"){let r=t.components[0],o=t.components[1];return{id:t.id,type:"custom-geometry",visible:o.visible,altitude:o.altitude,parent:t.parentObject3D?.userData.entityId,position:this.convert3DMapPositionToCoordinate(r.position)}}else if(t?.type==="feature-collection"){let r=Array.from(t.userData.entities3D.values()),o=r?.[0],i=o?this.getState(o):{},s=this.#t,a=this.convert3DMapPositionToCoordinate;return{id:t.userData.entityId,type:"feature-collection",initialColor:i?.initialColor,color:i?.color,hoverColor:i?.hoverColor,side:i?.side??"double",opacity:i?.opacity,height:i?.height,texture:i?.texture,topColor:i?.topColor,topTexture:i?.topTexture,visible:t.visible,altitude:t.position.z,interactive:bu(t,this.#t),children:r,bevel:i?.bevel,maskId:t.components[0]?.maskId,maskEnabled:t.components[0]?.enabled,maskEffect:t.components[0]?.effect,maskMode:t.components[0]?.mode,get position(){return yu(t,s,a)}}}else{if(t?.type==="group-container")return{id:t.userData.entityId,type:"group-container",visible:t.visible,altitude:t.position.z,opacity:t.opacity,interactive:!!t.components[0],children:Array.from(t.childrenIds.values()).map(r=>this.getState(r)).filter(Boolean)};if(t?.type==="label"){let r=t.components[0],o=t.object3d.parent,i=o?.userData.entityId;return{id:t.id,type:"label",text:r.text||"",parent:{id:i,type:o?.type},position:this.convert3DMapPositionToCoordinate(t.position),enabled:r.enabled,visible:r.visible,initialRank:dn(r.initialRank),verticalOffset:t.verticalOffset,options:{rank:dn(r.rank),appearance:r.appearance,interactive:t.components[1]!=null,verticalOffset:t.verticalOffset,attachTo:t.attachedTo,occlude:t.components[2]?.enabled??!1}}}else if(t?.type==="marker"){let r=t.components[0],o=t.object3d.parent,i=o?.userData.entityId;return{id:t.id,type:"marker",enabled:r.enabled,visible:r.visible,placement:r.options.placement,dynamicResize:r.options.dynamicResize,parent:{id:i,type:o?.type},position:this.convert3DMapPositionToCoordinate(t.position),element:r.containerEl,initialRank:dn(r.initialRank),contentHTML:r.contentHtml,options:{rank:dn(r.rank),interactive:t.components[1]!=null||!1,verticalOffset:t.verticalOffset,attachTo:t.attachedTo,lowPriorityPin:r.options.lowPriorityPin,occlude:t.components[2]?.enabled??!1,zIndex:r.options.zIndex,animated:r.options.animated}}}else if(t?.type==="geometry"){let{color:r,hoverColor:o,initialColor:i,initialTopColor:s,topColor:a,altitude:l}=t.components[1],c=t.components[0],u=t.components[4],d=t.components[1],h=t.components[6],g=t.components[2],b=t.components[3],M=t.parentObject3D;return{id:t.id,type:"geometry",opacity:d.opacity,initialColor:i,color:r,focusable:u!=null&&u.vertices!=null&&u.vertices.length>0,initialTopColor:s,topColor:a,side:d.side,hoverColor:o,hovered:!!g?.hover,height:d.height,visible:d.visible,outline:b?.enabled,showImage:d.showImage,texture:h?.texture?.path,topTexture:h?.topTexture?.path,flipImageToFaceCamera:d.flipImageToFaceCamera,enableImageCollisions:d.enableImageCollisions,parent:{id:M?.userData.entityId,type:M?.type},altitude:l,bevel:d.bevel,position:this.convert3DMapPositionToCoordinate(c.position),interactive:c.pointerEventsPassThrough?"pass-through":t.components[2]!=null,borderVisible:d.borderVisible,borderColor:d.borderColor,borderWidth:d.borderWidth}}else if(t?.type==="model"){let r=t.components[0],o=t.components[1],i=t.components[2],s=t.components[7],a=r.feature.geometry.coordinates,l=[a[0],a[1],a[2]??0];return{id:t.id,type:"model",position:l,interactive:i!=null,material:o.material,parent:t.parentObject3D?.parent?{id:t.parentObject3D.parent.userData.entityId,type:t.parentObject3D.parent.type}:void 0,visible:o.visible,verticalOffset:o.verticalOffset,color:o.color,opacity:o.opacity,rotation:o.rotation??Ht,scale:o.scale??Ut,clippingPlaneZOffset:s?.verticalOffset??o.clippingPlaneZOffset,clippingPlaneTopColor:s?.topColor??o.clippingPlaneTopColor,clippingPlaneTopVisible:s?.topVisible??o.clippingPlaneTopVisible}}else if(t?.type==="path"){let r=t.components[0],o=t.components[2],i=t.components[1];return{id:t.id,type:"path",position:this.convert3DMapPositionToCoordinate(r.position),visible:i.visible,interactive:o!=null,completeFraction:r.completeFraction,color:i.color,accentColor:r.accentColor,width:r.width,animateArrowsOnPath:r.animateArrowsOnPath,displayArrowsOnPath:r.displayArrowsOnPath,verticalOffset:i.altitude,highlightCompleteFraction:r.highlightCompleteFraction,highlightStartFraction:r.highlightStartFraction,highlightEndFraction:r.highlightEndFraction,highlightColor:r.highlightColor,highlightWidthMultiplier:r.highlightWidthMultiplier,highlightDisplayArrowsOnPath:r.highlightDisplayArrowsOnPath,travelledEndFraction:r.travelledEndFraction,travelledColor:r.travelledColor,xrayOpacity:r.xrayOpacity,xrayStyle:r.xrayStyle,smoothingTension:r.smoothingTension,smoothingCornerRadius:r.smoothingCornerRadius,dashed:r.dashed,dashLength:r.dashLength,dashGap:r.dashGap,dashRelativeToWidth:r.dashRelativeToWidth,dashSize:r.dashSize,gapSize:r.gapSize,dashAbsolute:r.dashAbsolute,dashMeters:r.dashMeters,gapMeters:r.gapMeters,__EXPERIMENTAL_GEOMETRY:r.__EXPERIMENTAL_GEOMETRY,__EXPERIMENTAL_ENDCAP_EXTENSION:r.__EXPERIMENTAL_ENDCAP_EXTENSION,__EXPERIMENTAL_BILLBOARDING:r.__EXPERIMENTAL_BILLBOARDING,__EXPERIMENTAL_BORDER:r.__EXPERIMENTAL_BORDER,__EXPERIMENTAL_PREVENT_SELF_OVERLAP:r.__EXPERIMENTAL_PREVENT_SELF_OVERLAP}}else if(t?.type==="image"){let r=t.components[0],o=t.components[2];return{id:t.id,type:"image",position:this.convert3DMapPositionToCoordinate(r.position),visible:t.components[1].visible,verticalOffset:r.feature.properties.verticalOffset??0,opacity:t.components[1].opacity,flipImageToFaceCamera:t.components[1].flipImageToFaceCamera,width:r.feature.properties.width??0,height:r.feature.properties.height??0,rotation:r.feature.properties.rotation??0,interactive:o!=null}}else if(t?.type==="text3d"&&t.components[0]instanceof Fo){pu(t);let r=t.components[0],o=t.components[1],{textMesh:i}=r,s=r.feature.properties,a=r.mesh?.parent;a instanceof ie&&a.children.find(h=>h.type==="batchedtext")?.getWorldPosition(this.#U),this.#k.set(0,0,0);let l=i?i.getWorldPosition(this.#k):this.#k,c=s.rotation??s.textArea?.rotation??0,u=s.content??s.text??"";return Object.assign({},Ct,o.getState(),{id:t.id,type:"text3d",position:this.convert3DMapPositionToCoordinate(l.add(this.#U)),visible:r.visible??!1,content:u,rotation:c})}else return}}getRenderedState(e){let t=typeof e=="string"||typeof e=="number"?e:e.id,r=hr(this.#t,t);if(r&&r.type==="label")return{textVisible:r.components[0].textVisible}}setState(e,t){if(typeof e=="object"&&t==null){"hoverColor"in e&&(mc(e.hoverColor)?this.#t.hoverColor=e.hoverColor??this.#t.hoverColor:_.warn(`Failed to update global hover color. Invalid color "${e.hoverColor}".`)),"text3dHoverColor"in e&&(this.#t.text3dHoverColor=e.text3dHoverColor??this.#t.text3dHoverColor);return}let r=hr(this.#t,e);if(r!=null){if(r.type==="custom-geometry"){let o=this.#t.geometry3DMap.get(r.id);if(o instanceof $&&o.components[0]instanceof Vr){let i=t;mr(r,this.#t,i.visible),gn(r,this.#t,i.altitude),Ws(r,i.position,this.convertTo3DMapPosition,this.#r.panBoundsSystem),Vs(r,this.getParentContainer(i.parent,!1)),Le(r,i.interactive,this.#t)&&this.#c()}}else if(r.type==="path"){let o=t;Le(r,o.interactive,this.#t)&&this.#c(),gn(r,this.#t,o.verticalOffset),du(r,this.#t,o)}else if(r.type==="model"){let o=t;Le(r,o.interactive,this.#t)&&this.#c(),mr(r,this.#t,o.visible),fu(r,o,this.convertTo3DMapPosition,this.#r.panBoundsSystem),gu(r,o)}else if(r.type==="group-container"){let o=t;mr(r,this.#t,o.visible)&&(this.#r.pathSystem.verticalDistanceDirty=!0,this.#r.geometryInFocusSystem.focusablesDirty=!0),gn(r,this.#t,o.altitude)&&(this.#r.pathSystem.verticalDistanceDirty=!0),Le(r,o.interactive,this.#t)&&this.#c(),Go(r,this.#t,o.opacity)&&(this.#r.outlineInterpolationSystem.outlineOpacitiesDirty=!0),o.preloadGeometry&&r.userData.preloadGeometry!==!0&&(r.userData.preloadGeometry=!0,this.#r.outlineInterpolationSystem.geometries3DDirty=!0),ko(r,o.focusable)&&(this.#r.geometryInFocusSystem.focusablesDirty=!0)}else if(r.type==="feature-collection"){let o=t;o.visible!==void 0&&r.visible!==o.visible&&(r.visible=o.visible,this.#c()),o.altitude!==void 0&&r.position.z!==o.altitude&&(r.position.z=o.altitude,this.#c()),qc(r,this.#t,o),nu(r,this.#t,o.hoverColor),$s(r,this.#t,o.outline),o.height!=null&&Hs(r,this.#t,o.height),Xs(r,this.#t,o)&&(this.#r.textureSystem.dirty=!0),Xs(r,this.#t,o),Jc(r,this.#t,o.shading),Go(r,this.#t,o.opacity)&&(this.#r.outlineInterpolationSystem.outlineOpacitiesDirty=!0),Le(r,o.interactive,this.#t)&&(this.#c(),this.#m(),this.#r.interactionSystem.dirty3D=!0),qs(r,this.#t,o.side),Ys(r,{maskId:o.maskId,enabled:o.maskEnabled,effect:o.maskEffect,mode:o.maskMode}),au(r,this.#t,{effectStart:o.effectStart,effectDistance:o.effectDistance,darkenAmount:o.darkenAmount,darkenUseDepth:o.darkenUseDepth,desaturateAmount:o.desaturateAmount,desaturateUseDepth:o.desaturateUseDepth,washOutAmount:o.washOutAmount,washOutUseDepth:o.washOutUseDepth}),o.position!=null&&(r.userData.centroid=[o.position[0],o.position[1]],r.userData.positionDirty=!0)}else if(r.type==="geometry"){if(r.components[0]instanceof oe){let o=t;if(mr(r,this.#t,o.visible)&&this.#c(),$s(r,this.#t,o.outline),Kc(r,o),ko(r,o.focusable)&&(this.#r.geometryInFocusSystem.focusablesDirty=!0),cu(r,o.renderOrder)&&(this.#r.meshDetachmentSystem.dirty=!0),lu(r,o.opacity)&&(this.#r.meshDetachmentSystem.dirty=!0,this.#r.interactionSystem.dirty3D=!0,this.#r.outlineInterpolationSystem.outlineOpacitiesDirty=!0),Zs(r,o.flipImageToFaceCamera),iu(r,o.enableImageCollisions),gn(r,this.#t,o.altitude)){let i=r.components[1],s=(i.altitude??0)+(i.height??0);this.#r.panBoundsSystem.expandBoundsIfOutside(new O(0,0,s)),this.#r.shadowsSystem&&(this.#r.shadowsSystem.needsRender=!0)}if(o.height!=null&&Hs(r,this.#t,o.height)){let i=r.components[1],s=(i.altitude??0)+(i.height??0);this.#r.panBoundsSystem.expandBoundsIfOutside(new O(0,0,s)),this.#r.shadowsSystem&&(this.#r.shadowsSystem.needsRender=!0)}su(r,o)&&(this.#r.meshDetachmentSystem.dirty=!0,this.#r.textureSystem.dirty=!0),Qc(r,o,this.#t.outlinesOptions?.darkenFactor),ru(r,o.hoverColor),Le(r,o.interactive,this.#t)&&(this.#r.interactionSystem.dirty3D=!0),ou(r,o.hovered),qs(r,this.#t,o.side),uu(r,o)}}else if(r.type==="label"||r.type==="marker"){let o=t;tu(r,o,this.#t),eu(r,o,this.#t)&&(this.#m(),this.#r.twoDEntitySystem.markDirty()),Ws(r,o.position,this.convertTo3DMapPosition,this.#r.panBoundsSystem),Vs(r,this.getParentContainer(o.parent,!1))&&(this.#m(),this.#r.panBoundsSystem.dirty=!0),Bo(r,o.enabled),mr(r,this.#t,o.visible)}else if(r.type==="image"){let o=t;mr(r,this.#t,o.visible),Go(r,this.#t,o.opacity),Zs(r,o.flipImageToFaceCamera),Le(r,o.interactive,this.#t)&&this.#c()}else if(r.type==="text3d"){let o=t;mu(r,this.#t,o)}this.render()}}projectScreenXYToCoordinate=(e,t,r=!1)=>{let o=this.container.getBoundingClientRect(),i=(e-o.left)/this.#t.canvasWidth*2-1,s=-((t-o.top)/this.#t.canvasHeight)*2+1,a=new W(i,s),l,c;if(r?(Bh.setFromCamera(a,this.#n),l=Bh.intersectObject(this.#l,!1)[0]?.point):(l=this.#r.interactionSystem.getThreeDIntersectsFromXY(a)?.[0]?.point,c=this.#r.interactionSystem.getGroupContainerIntersectsFromXY(a)),l)return{coordinate:this.convert3DMapPositionToCoordinate(l),groupContainers:c}};projectCoordinateToScreenXY=e=>{let t=this.convertTo3DMapPosition(e[1],e[0],e[2]||0),r=new W;return this.project(r,t),{x:r.x,y:r.y}};convertTo3DMapPosition(e,t,r=0,o){if(Array.isArray(e))return this.convertTo3DMapPosition(e[1],e[0],e[2]??r,typeof t=="function"?t:void 0);if(typeof t!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:i,y:s}=Oo(this.#t.center?.[1]??0,this.#t.center?.[0]??0,e,t);return o?(o.set(i,s,r),o):new O(i,s,r)}convert3DMapPositionToCoordinate=e=>{let{lat:t,lon:r}=Io(this.#t.center?.[1]??0,this.#t.center?.[0]??0,e.x,e.y);return[r,t,e.z]};#D=(e,t)=>{let r=e.entity3D?[e.entity3D.id]:[];e.entity3D?.parentObject3D?.userData?.entityId&&r.push(e.entity3D.parentObject3D.userData.entityId);let o=[],i=[];for(let l of e.entity2D)l.components&&(l.components[0]instanceof wo?o.push(l.id):l.components[0]instanceof Eo&&i.push(l.id));let s=e.entity3D?.components[0],a=e.entity3D?.id;return{coordinate:this.convert3DMapPositionToCoordinate(t),geometry:r,paths:s instanceof fr&&a!==void 0?[a]:[],markers:o,models:s instanceof yr&&a!==void 0?[a]:[],images:s instanceof Pn&&a!==void 0?[a]:[],labels:i,containers:Array.isArray(e.groupContainers)?e.groupContainers.map(l=>l.userData.entityId):[]}};setBackgroundColor=(e,t)=>{this.#d.setBackgroundColor(e,t)};get backgroundColor(){return typeof this.#d.backgroundColor=="string"?this.#d.backgroundColor:`#${this.#d.backgroundColor.getHexString()}`}get backgroundAlpha(){return this.#d.backgroundAlpha}getThreeRenderer(){return this.#d}getMetersPerPixel=()=>this.#r.cameraSystem.getCurrentMetersPerPixel();hideOutdoorLayersIntersectingPolygons=(e,t)=>{this.#r.outdoorLayersSystem.hideLayersIntersectingPolygons(e,t),this.render()};getCenter(e){let t=Array.isArray(e)?e:this.getBoundingArea(e);return t?Rc(t):void 0}#I=new Or;#F=new Y;isInView(e){let t=hr(this.#t,e);if(this.#F.identity().multiply(this.#n.projectionMatrix).multiply(this.#n.matrixWorldInverse),this.#I.setFromProjectionMatrix(this.#F),t instanceof Gs)return this.#I.containsPoint(t.position);if(t instanceof $){let r=t?.components[0];if(r instanceof Vr||r instanceof yr)return this.#I.containsPoint(this.convertTo3DMapPosition(r.feature.geometry.coordinates));if(r instanceof oe){let o=new ce(this.convertTo3DMapPosition(r.featureBbox[1],r.featureBbox[0],0),this.convertTo3DMapPosition(r.featureBbox[3],r.featureBbox[2],0));return this.#I.intersectsBox(o)}}return!1}queryGeometry2DInView(e){let{screenOffsets:t,fullyContains:r}=e??{},[o,i,s,a]=Nc(this.container,t),l=new zt(o,i,s,a);return this.#r.twoDEntitySystem.visibleCollidersQTree.queryRect(l).filter(h=>r?l.contains(h):l.intersects(h)).map(h=>this.#t.geometry2DMap.get(h.userData.entityId)).filter(h=>h!=null).filter(h=>h.components[0]instanceof Eo||h.components[0]instanceof wo).map(h=>h.id.toString())}#N=e=>{_.error("Render failed: ",e,e.stack??"No stack trace available"),this.publish("render-error",{error:e})};render=()=>{if(!(this.#r?.renderSystem==null||this.signal?.aborted))if(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay"))this.map.triggerRepaint();else return this.#r.renderSystem.update().catch(this.#N)};renderSync=()=>this.signal?.aborted?Promise.resolve():this.#r.renderSystem.update(!0).catch(this.#N);#M=Pr(()=>{this.publish("user-interaction-start",void 0)},0,!0);#v=Pr(()=>{this.publish("user-interaction-end",void 0),this.render()},0,!0);onMapLibreEvent(e,t){if(!this.map){_.warn(`Tried to add event listener "${e}" but MapLibre map is not initialized.`);return}let r=this.map.on(e,t);r?.unsubscribe&&this.onAbort(()=>r.unsubscribe())}offMapLibreEvent(e,t){this.map&&this.map.off(e,t)}getSystems(){return this.#r}getInternalState(){return this.#t}getInternalTweenGroup(){return this.#t.internalTweenGroup}getExternalTweenGroup(){return this.#t.externalTweenGroup}async#z(){return Vt.load(Mu).then(e=>(this.#e&&(this.#e.environment?.dispose(),e.mapping=Vl,this.#e.environment=e,this.render()),e))}computeMinZOffsetBetweenContainers(e,t,r){if(!e||!t)return-1;Ks(e,"group-container"),Ks(t,"group-container"),e.updateMatrixWorld(!0),t.updateMatrixWorld(!0);let o=Ao(e,this.getThreeCamera()),i=t.clone(!0);Lo(i,!0),i.updateMatrixWorld();let s=Ao(i,this.getThreeCamera());if(!Nr(o)||!Nr(s))return-1;let a=0,l;r&&this.container.querySelectorAll(".debug-box").forEach(u=>u.remove());do{if(a>1e4)return-1;if(a+=20,i.setAltitude(a),s.makeEmpty(),Ao(i,this.#n,s),l=o.intersectsBox(s),r){let c=Us(o,"blue",this.container),u=Us(s,l?"red":"green",this.container);c.classList.add("debug-box"),u.classList.add("debug-box")}}while(l);return a}on=(e,t,r)=>{let o=super.on(e,t,r);return["outdoor-view-loaded","outdoor-style-loaded"].includes(e)&&this.mode==="standalone"&&E.env.NODE_ENV!=="test"&&(_.warn(`"${e}" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.`),this.publish(e),o()),o};off=(e,t)=>{super.off(e,t)};getCursor=()=>this.#r.interactionSystem.getCursor();#H=()=>{try{this.#p!=="outdoors-overlay"&&(this.map&&this.map.remove(),this.container&&this.rendererDomElement&&this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement))}catch(e){_.warn("Error during DOM cleanup, some elements may not have been removed:",e)}};#u=e=>(this.onAbort(()=>{e&&typeof e=="object"&&("destroy"in e&&typeof e.destroy=="function"?e.destroy():"dispose"in e&&typeof e.dispose=="function"&&e.dispose())}),e);destroy=()=>{!this.#r||this.signal?.aborted||(super.destroy(),globalThis.MappedinDebug?.__idleCallbackInteractionState&&(globalThis.MappedinDebug.__idleCallbackInteractionState.unregisterInteractionChecker(this.#r.cameraSystem.isUserInteracting),globalThis.MappedinDebug.__idleCallbackInteractionState.unregisterInteractionChecker(this.#r.cameraSystem.isCameraMoving)),this.remove("__scene"),this.#d.destroy(),this.#e?.traverse(e=>{ve(e),"dispose"in e&&typeof e.dispose=="function"&&e.dispose()}),this.#e=void 0,this.#r=void 0,this.#H(),this.#d=void 0)};#k=new O;#U=new O},qt=al;f();function Gh(n,e){let{cameraSystem:t}=n.getSystems(),r={center:e.getCenter().toArray(),zoom:e.getZoom(),bearing:e.getBearing(),pitch:e.getPitch(),elevation:e.getCenterElevation()},o=!1;n.on("camera-change",i=>{if(!o){r.center=i.center,r.zoom=i.zoomLevel,r.bearing=i.bearing,r.pitch=i.pitch,r.elevation=i.elevation,o=!0;try{e.jumpTo(r)}finally{o=!1}}}),n.onMapLibreEvent("move",()=>{if(!o){o=!0;try{let i=e.getCenter();t.setCenter(i.lng,i.lat),t.setZoomLevel(e.getZoom()),t.setRotation(U.degToRad(e.getBearing())),t.setTilt(U.degToRad(e.getPitch())),t.setPedestal(Math.min(e.getCenterElevation(),t.maxPedestal),!0)}finally{o=!1}}}),n.onMapLibreEvent("movestart",()=>{o||t.beginGesture()}),n.onMapLibreEvent("moveend",()=>{o||t.endGesture()})}f();function vy(n,e){xy(n,e)(n.getScene(),e),Sy(n,e),e.addFolder("Export").add({export:async()=>{let s=await n.getCurrentSceneGLTF({binary:!0}),a=new Blob([s],{type:"application/octet-stream"});var l=document.createElement("a");document.body.appendChild(l),l.style.display="none";let c=window.URL.createObjectURL(a);l.href=c,l.download="scene.glb",l.click(),window.URL.revokeObjectURL(c)}},"export");let o=e.addFolder("Camera"),i={get bearing(){return n.camera.bearing},set bearing(s){n.camera.setBearing(s)},get pitch(){return n.camera.pitch},set pitch(s){n.camera.setPitch(s)},get zoomLevel(){return n.camera.zoomLevel},set zoomLevel(s){n.camera.setZoomLevel(s)}};o.add(i,"bearing",-359,359,1),o.add(i,"pitch",n.camera.minPitch,n.camera.maxPitch,1),o.add(i,"zoomLevel",n.camera.minZoomLevel,n.camera.maxZoomLevel,.1)}function xy(n,e){let t=e;return function r(o,i){let s=i.addFolder(`${[o.type]} ${o.id.slice(0,16)}`);if(i.close(),o.type==="geometry"||o.type==="model"||o.type==="path"||o.type==="image"){let a={get height(){let l=n.getState(o.id);return l?.type==="geometry"?l.height:0},set height(l){n.getState(o.id)?.type==="geometry"&&n.setState(o,{height:l})},set flipImageToFaceCamera(l){n.getState(o.id)?.type==="image"&&n.setState(o,{flipImageToFaceCamera:l})},get flipImageToFaceCamera(){let l=n.getState(o.id);return l?.type==="image"?l.flipImageToFaceCamera:!1},set visible(l){let c=n.getState(o.id);(c?.type==="geometry"||c?.type==="path"||c?.type==="image")&&n.setState(o,{visible:l})},get visible(){let l=n.getState(o.id);return l?.type==="geometry"||l?.type==="path"||l?.type==="image"?l.visible:!1},set outline(l){n.getState(o.id)?.type==="geometry"&&n.setState(o,{outline:l})},get outline(){let l=n.getState(o.id);return l?.type==="geometry"?l.outline:!1},get opacity(){let l=n.getState(o.id);return l?.type==="geometry"?l.opacity:1},set opacity(l){let c=n.getState(o.id);c?.type==="geometry"&&n.setState(c,{opacity:l})},get color(){let l=n.getState(o.id);return l?.type==="geometry"&&l.color?fc(l.color).toHexString():"#ffffff"},set color(l){let c=n.getState(o.id);c?.type==="geometry"&&n.setState(c,{color:l})},set interactive(l){let c=n.getState(o.id);(c?.type==="geometry"||c?.type==="model"||c?.type==="path")&&(n.setState(o,{interactive:l}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get interactive(){let l=n.getState(o.id);return l?.type==="geometry"||l?.type==="model"||l?.type==="path"?l.interactive:!1},get completeFraction(){let l=n.getState(o.id);return l?.type==="path"?l.completeFraction:1},set completeFraction(l){let c=n.getState(o.id);c?.type==="path"&&n.setState(c,{completeFraction:l})},focus:()=>{}};s.add(a,"focus").onChange(()=>{let l=n.getState(o.id);l?.type==="model"||l?.type==="path"||l?.type==="image"?n.camera.focusOn([l.position]):l?.type==="geometry"&&n.camera.focusOn(n.getBoundingArea(l))}),s.add(a,"visible"),o.type==="image"?s.add(a,"flipImageToFaceCamera"):(s.add(a,"interactive"),o.type==="path"&&s.add(a,"completeFraction",0,1,.1),o.type!=="model"&&(s.addColor(a,"color"),s.add(a,"outline"))),o.type==="geometry"&&(s.add(a,"height"),s.add(a,"opacity",0,1,.1))}else if(o.type==="marker"){let a={get interactive(){let l=n.getState(o.id);return l?.type==="marker"?l.options?.interactive:!1},set interactive(l){let c=n.getState(o.id);c?.type==="marker"&&(n.setState(c,{options:{interactive:l}}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},focus:()=>{}};s.add(a,"focus").onChange(()=>{let l=n.getState(o.id);l?.type==="marker"&&n.camera.focusOn([l.position])}),s.add(a,"interactive")}else if(o.type==="label"){let a={get interactive(){let l=n.getState(o.id);return l?.type==="label"?l.options?.interactive:!1},set interactive(l){let c=n.getState(o.id);c?.type==="label"&&(n.setState(c,{options:{interactive:l}}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get text(){let l=n.getState(o.id);return l?.type==="label"?l.text:""},set text(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:l})},get"Text Color"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.textColor:"#000000"},set"Text Color"(l){n.getState(o.id)?.type==="label"&&n.setState(o.id,{text:a.text,options:{appearance:{textColor:l}}})},get"Text Size"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.textSize:10},set"Text Size"(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:a.text,options:{appearance:{textSize:l}}})},get"Icon Size"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.iconSize:10},set"Icon Size"(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:a.text,options:{appearance:{iconSize:l}}})},get"Pin Color"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.pinColor:"#000000"},set"Pin Color"(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:a.text,options:{appearance:{pinColor:l}}})},get"Pin Color Inactive"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.pinColorInactive:"#000000"},set"Pin Color Inactive"(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:a.text,options:{appearance:{pinColorInactive:l}}})},get"Pin Outline Color"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.pinOutlineColor:"#000000"},set"Pin Outline Color"(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:a.text,options:{appearance:{pinOutlineColor:l}}})},get"Pin Outline Color Inactive"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.pinOutlineColorInactive:"#000000"},set"Pin Outline Color Inactive"(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:a.text,options:{appearance:{pinOutlineColorInactive:l}}})},focus:()=>{}};s.add(a,"focus").onChange(()=>{let l=n.getState(o.id);l?.type==="label"&&n.camera.focusOn([l.position])}),s.add(a,"interactive"),s.add(a,"text"),s.add(a,"Text Size",10,50),s.add(a,"Icon Size",10,50),s.addColor(a,"Text Color"),s.addColor(a,"Active Background Color"),s.addColor(a,"Inactive Background Color"),s.addColor(a,"Active Foreground Color"),s.addColor(a,"Inactive Foreground Color")}else if(o.type==="feature-collection"){let a={get opacity(){let l=n.getState(o.id);return l?.type==="feature-collection"?l.opacity:1},set opacity(l){n.getState(o.id)?.type==="feature-collection"&&n.setState(o,{opacity:l})},set outline(l){n.getState(o.id)?.type==="feature-collection"&&n.setState(o,{outline:l})},get outline(){let l=n.getState(o.id);return l?.type==="feature-collection"?l.outline:!1},set interactive(l){n.getState(o.id)?.type==="feature-collection"&&(n.setState(o,{interactive:l}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get interactive(){let l=n.getState(o.id);return l?.type==="feature-collection"?l.interactive:!1},get shadingStart(){let l=n.getState(o.id);return l?.type==="feature-collection"?l.shading?.start??0:0},set shadingStart(l){let c=n.getState(o.id);c?.type==="feature-collection"&&n.setState(c,{shading:{start:l}})},get shadingEnd(){let l=n.getState(o.id);return l?.type==="feature-collection"?l.shading?.end??0:0},set shadingEnd(l){let c=n.getState(o.id);c?.type==="feature-collection"&&n.setState(c,{shading:{end:l}})},get shadingIntensity(){let l=n.getState(o.id);return l?.type==="feature-collection"?l.shading?.intensity??0:0},set shadingIntensity(l){let c=n.getState(o.id);c?.type==="feature-collection"&&n.setState(c,{shading:{intensity:l}})}};s.add(a,"opacity",0,1,.1),s.add(a,"interactive"),s.add(a,"outline"),s.add(a,"shadingStart",0,1,.1),s.add(a,"shadingEnd",0,1,.1),s.add(a,"shadingIntensity",0,1,.1)}else if(o.type==="group-container"){let a={set visible(l){n.getState(o.id)?.type==="group-container"&&n.setState(o,{visible:l})},get visible(){let l=n.getState(o.id);return l?.type==="group-container"?l.visible:!1},set interactive(l){let c=n.getState(o.id);c?.type==="group-container"&&(n.setState(c,{interactive:l}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get interactive(){let l=n.getState(o.id);return l?.type==="group-container"?l.interactive:!1}};s.add(a,"visible"),s.add(a,"interactive")}if(s.close(),o.children)for(let a of o.children.values())r(a,s)}}function Sy(n,e){let t=e.addFolder("Watermark"),r={padding:16,iconOnly:!1,position:"bottom-left",color:"dark",scale:1};t.add(r,"padding",0,100,1),t.add(r,"scale",.5,1.5,.1),t.add(r,"color",["dark","light"]),t.add(r,"position",["top-left","top-right","bottom-left","bottom-right","center","top","bottom","left","right"]),t.add(r,"iconOnly"),t.onChange(()=>{n.updateWatermark(r)})}f();var dl=class extends Z{gl;options;el=document.createElement("div");core;origin;map;layer;cameraSystem;constructor(e,t){super(),this.origin=e,this.options=t}handleStyleChange=()=>{!this.map||!this.layer||this.map.getLayer(this.layer.id)||(this.map.addLayer(this.layer),this.core.camera.setMinZoomLevel(this.map.getMinZoom()),this.core.camera.setMaxZoomLevel(this.map.getMaxZoom()),this.core.camera.setMinPitch(this.map.getMinPitch()),this.core.camera.setMaxPitch(this.map.getMaxPitch()))};handleMoveStart=()=>{this.cameraSystem.beginGesture()};handleMove=()=>{if(!this.map)return;let[e,t]=this.map.getCenter().toArray();this.cameraSystem.setCenter(e,t),this.cameraSystem.setZoomLevel(this.map.getZoom()),this.cameraSystem.setRotation(U.degToRad(this.map.getBearing())),this.cameraSystem.setTilt(U.degToRad(this.map.getPitch()))};handleMoveEnd=()=>{this.cameraSystem.endGesture()};handleError=e=>{_.warn(e)};onAdd(e){this.origin=this.origin||e.getCenter().toArray(),this.gl=e.painter.context.gl,this.core=new qt(e._container,{...this.options,center:this.origin,zoomLevel:e.getZoom(),pitch:e.getPitch(),bearing:e.getBearing(),gl:this.gl,map:e,mode:"outdoors-overlay"}),this.map=e,this.cameraSystem=this.core.getSystems().cameraSystem,this.core.camera.setMinZoomLevel(e.getMinZoom()),this.core.camera.setMaxZoomLevel(e.getMaxZoom()),this.core.camera.setMinPitch(e.getMinPitch()),this.core.camera.setMaxPitch(e.getMaxPitch()),this.map.on("error",this.handleError);let t=To.fromLngLat(this.origin,0);return this.layer=Po(t,this.core.viewCamera,()=>{this.core.renderSync()}),this.map.on("styledata",this.handleStyleChange),this.map.on("movestart",this.handleMoveStart),this.map.on("move",this.handleMove),this.map.on("moveend",this.handleMoveEnd),this.handleStyleChange(),this.el}onRemove(){this.map&&(this.map.off("styledata",this.handleStyleChange),this.map.off("movestart",this.handleMoveStart),this.map.off("move",this.handleMove),this.map.off("moveend",this.handleMoveEnd),this.map.off("error",this.handleError),this.layer&&this.map.removeLayer(this.layer.id)),this.layer=void 0,this.map=void 0,this.core&&this.core.destroy(),this.core=void 0}};f();f();f();f();f();f();var _e=class{origin;destination;distance;angle;weight;constructor({origin:e,destination:t,distance:r=0,angle:o=0,pathWeight:i=0,multiplicativeDistanceWeightScaling:s=!0}){if(this.origin=e,this.destination=t,this.distance=r,this.angle=o,this.weight=i||0,s?e.properties.floor===t.properties.floor&&(this.weight=(this.weight>=0?this.distance*this.weight:0)+this.distance):e.properties.map===t.properties.map&&(this.weight=this.weight>=0?this.distance+this.weight:0),isNaN(this.angle))throw new Error("Invalid angle: Expected a numeric value, but received NaN.")}};f();f();f();f();f();function xe([n,e],[t,r]){let o=e-r,i=n-t;return(Math.atan2(i,o)+Math.PI*3)%(Math.PI*2)}f();f();function ss(n,e,t,r){let[o,i]=n,[s,a]=e,[l,c]=t,[u,d]=r;if(i===a&&o===s||c===d&&l===u)return null;let h=(u-l)*(a-i)-(d-c)*(s-o);if(h===0)return null;let g=((d-c)*(o-l)-(u-l)*(i-c))/h,b=((a-i)*(o-l)-(s-o)*(i-c))/h;if(g<0||g>1||b<0||b>1)return null;let M=i+g*(a-i);return[o+g*(s-o),M]}f();f();function as(n,e,t,r){r===void 0&&(r={});var o=Mi(n),i=mo(o[0]),s=mo(o[1]),a=mo(t),l=Gl(e,r.units),c=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a)),u=i+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(c)),d=Ds(u),h=Ds(c);return uo([d,h],r.properties)}function hl(n,e,t,r){let o=as(n,t/1e3,r),i=as(e,t/1e3,r);return[o.geometry.coordinates,i.geometry.coordinates]}f();function pl(n){let e=n*(180/Math.PI);return e=e%360,e>180?e-=360:e<-180&&(e+=360),Object.is(e,-0)?0:e}var kh=111e3;function nt(n,e,t=[],r=0){let o=!0,i=n.geometry.coordinates,s=e.geometry.coordinates,a=pl(xe(i,s)-Math.PI/2),l=pl(xe(i,s)+Math.PI/2),c=r/kh,u=r/(kh*Math.cos(i[1]*Math.PI/180)),d=Math.min(i[1],s[1])-c,h=Math.max(i[1],s[1])+c,g=Math.min(i[0],s[0])-u,b=Math.max(i[0],s[0])+u;for(let M of t)if(!(Math.max(M[0][1],M[1][1])<d||Math.min(M[0][1],M[1][1])>h||Math.max(M[0][0],M[1][0])<g||Math.min(M[0][0],M[1][0])>b)){if(r>0){let m=hl(i,s,r,a),p=hl(i,s,r,l);if(ss(m[0],m[1],M[0],M[1])||ss(p[0],p[1],M[0],M[1]))return o=!1,!1}else if(ss(i,s,M[0],M[1]))return o=!1,!1}return o}f();function zh(n,e=.5){let[t,r]=n,o=(t.x+r.x)/2,i=(t.y+r.y)/2,s=r.x-t.x,l=-(r.y-t.y),c=s,u=Math.sqrt(l*l+c*c),d=l/u,h=c/u,g={x:o+d*e,y:i+h*e},b={x:o-d*e,y:i-h*e};return[g,b]}var Hn=.4,ls=class{edges={};nodesById;nodesByGroup=new Map;#e;constructor({nodes:e,groupBy:t,multiplicativeDistanceWeightScaling:r}){this.#e=t;let{features:o}=e;this.nodesById=this.#i(o),this.#o(),this.#s(o,t,{multiplicativeDistanceWeightScaling:r})}getShortestEuclideanDistance(e,t){return t.reduce((r,o)=>{let i=ku(e.geometry.coordinates,o.geometry.coordinates);return Math.min(r,i)},Number.MAX_VALUE)}hasLineOfSight=(e,t,r=[],o=Hn)=>nt({type:"Feature",properties:{id:"origin",neighbors:[]},geometry:{type:"Point",coordinates:e}},{type:"Feature",properties:{id:"destination",neighbors:[]},geometry:{type:"Point",coordinates:t}},r,o)===!0;dijkstraFindWithinTravelDistance(e,t,r,o,i,s){let a=this.nodesById[e];if(!a)return[];let l=[],c={},u={},d=new Set,h=[];for(l.push({node:a,distance:0}),c[a.properties.id]=null,u[a.properties.id]=0;l.length>0;){l.sort((m,p)=>m.distance-p.distance);let g=l.shift();if(!g)break;let b=g.node,M=g.distance;if(!d.has(b.properties.id)){if(d.add(b.properties.id),h.length>=s)break;b.properties.id!=null&&r.includes(b.properties.id?.toString())&&(i?this.hasLineOfSight(a.geometry.coordinates,b.geometry.coordinates,o)&&h.push({feature:b,distance:M}):h.push({feature:b,distance:M}));for(let m of this.edges[b.properties.id]){let p=m.destination,y=M+m.distance,v=u[b.properties.id]+m.weight;y>t||d.has(p.properties.id)||u[p.properties.id]!==void 0&&v>=u[p.properties.id]||(u[p.properties.id]=v,c[p.properties.id]=m,l.push({node:p,distance:y}))}}}return h.sort((g,b)=>g.distance-b.distance)}aStar({originIds:e,destinationNodeIds:t,disabledConnectionNodeIds:r,zones:o,overrideEdgeWeights:i,disabledNodeIds:s}){let a=this.#n(e),l=this.#n(t);if(a.length===0||l.length===0)return[];let{frontier:c,cameFrom:u,costSoFar:d}=this.#l(a,l);for(;c.length>0;){let h=c.shift();if(!h)break;if(this.#a(h.origin,l))return this.#h(u,h.origin.properties.id);for(let g of this.edges[h.origin.properties.id]){let b=i?.get(g)??g.weight,M=g.destination.properties.map!==g.origin.properties.map,m=r?.has(g.destination.properties.id);if(r?.has(g.origin.properties.id)&&(M||m)||s?.has(g.origin.properties.id))continue;let p=d[h.origin.properties.id]+b+this.#y(g.destination,o);if(p!==1/0&&(d[g.destination.properties.id]==null||p<d[g.destination.properties.id])){let y=p+this.getShortestEuclideanDistance(g.destination,l);d[g.destination.properties.id]=p,u[g.destination.properties.id]=g,c.push({origin:g.destination,priority:y})}}c.sort((g,b)=>g.priority-b.priority)}return[]}#n(e){return e.map(t=>this.nodesById[t]).filter(Boolean)}#i(e){return e.reduce((t,r)=>(t[r.properties.id]=r,t),{})}#o(){for(let e in this.nodesById)this.nodesById.hasOwnProperty(e)&&(this.nodesById[e].properties.neighbors=this.nodesById[e].properties.neighbors.filter(({id:t})=>!!this.nodesById[t]))}#s(e,t,r){e.forEach(o=>{let i=t==="default"?t:o.properties[t];this.nodesByGroup.has(i)||this.nodesByGroup.set(i,[]),this.nodesByGroup.get(i).push(o),this.edges[o.properties.id]=o.properties.neighbors.map(({id:s,weight:a})=>{let l=this.nodesById[s],c=Ee(o.geometry.coordinates,l.geometry.coordinates),u=xe(o.geometry.coordinates,l.geometry.coordinates);return new _e({origin:o,destination:l,pathWeight:a,distance:c,angle:u,multiplicativeDistanceWeightScaling:r?.multiplicativeDistanceWeightScaling})})})}#l(e,t){let r=[],o={},i={};return e.forEach(s=>{let a=this.getShortestEuclideanDistance(s,t);r.push({origin:s,priority:a}),o[s.properties.id]=null,i[s.properties.id]=0}),r.sort((s,a)=>s.priority-a.priority),{frontier:r,cameFrom:o,costSoFar:i}}#a(e,t){return t.some(r=>r.properties.id===e.properties.id)}#h(e,t){let r=[],o=e[t];for(;o;)r.push(o),o=e[o.origin.properties.id];return r.reverse()}#y=(e,t)=>{let r=0;for(let o of t)(!o[this.#e]||o[this.#e]===e.properties[this.#e])&&wt(e.geometry.coordinates,o.geometry.geometry)&&(r+=Math.max(0,o.cost));return r}};f();function My(n,e,t,r){let o=t[n].origin,i=e===t.length?r:t[e].origin;return Ee(o.geometry.coordinates,i.geometry.coordinates)}function Uh(n,e,t,r=Hn){if(n.length<3)return n;let o=1e-4,i=n.length,s=new Set;for(let h=0;h<i;h++)n[h].origin.properties.preventSmoothing&&s.add(h);let a=n[i-1].destination,l=new Array(i+1).fill(null).map(()=>({cost:1/0,prev:-1}));l[0]={cost:0,prev:-1};for(let h=0;h<i;h++){let g=!0;if(l[h].cost!==1/0){for(let b=h+1;b<=i;b++){let M=b===i?a:n[b].origin;if(Ee(n[h].origin.geometry.coordinates,M.geometry.coordinates)<.01)continue;let p=b===h+1&&b<i&&s.has(b),y=b===h+1&&s.has(h);if(!p&&!y&&!nt(n[h].origin,M,e,r))continue;if(b>h+1){let D=!1;for(let C=h+1;C<b;C++)if(s.has(C)){D=!0;break}if(D)continue}let v=My(h,b,n,a),S=(b-h-1)*o,w=l[h].cost+v-S;w<l[b].cost&&(l[b]={cost:w,prev:h},g=!1)}g&&l[h+1].cost===1/0&&(l[h+1].cost=l[h].cost,l[h+1].prev=h)}}let c=[],u=i;for(;u!==-1;)c.unshift(u),u=l[u].prev===-1?u-1:l[u].prev;let d=[];for(let h=0;h<c.length-1;h++){let g=c[h],b=c[h+1],M=n[g].origin,m=b===i?a:n[b].origin;d.push(new _e({origin:M,destination:m,distance:Ee(M.geometry.coordinates,m.geometry.coordinates),angle:xe(M.geometry.coordinates,m.geometry.coordinates),multiplicativeDistanceWeightScaling:t}))}return d}f();var Vh=lo(ml());f();var Hh=Fl("Navigator");function us(n,e,t){if(n==null||n[e]==null)return!1;let r=1<<t;return(n[e]&r)!==0}f();var Cy=.5;function Wh(n,e,t,r,o,i){if(!n?.geoJSON?.geometry?.coordinates)return null;let[s,a]=zh(r,Cy),l=s,c=a;if(o){let b=Math.sqrt(Math.pow(s.x-o.x,2)+Math.pow(s.y-o.y,2));Math.sqrt(Math.pow(a.x-o.x,2)+Math.pow(a.y-o.y,2))<b&&(l=a,c=s)}let u=i(l.x,l.y),d=i(c.x,c.y),h={type:"Feature",geometry:{type:"Point",coordinates:[u.lon,u.lat]},properties:{id:`${e}_buffer_entry`,map:t,neighbors:[],preventSmoothing:!0}},g={type:"Feature",geometry:{type:"Point",coordinates:[d.lon,d.lat]},properties:{id:`${e}_buffer_exit`,map:t,neighbors:[],preventSmoothing:!0}};return{entryNode:h,exitNode:g,entryMeters:l,exitMeters:c}}function Dt(n){return n.properties.floor??n.properties.map}function jh(n,e,t,r){let o=[n[0].origin];for(let C=0;C<n.length;C++)o.push(n[C].destination);let i=new Map,s=new Map;for(let C=0;C<o.length;C++)i.set(o[C].properties.id,o[C]),s.set(C,o[C]);let a=o[0].geometry.coordinates[1],{toCartesian:l,toGeographic:c}=ni(a),u=o.map((C,T)=>{let P={x:0,y:0,nodeId:C.properties.id,originalIndex:T};return l(C.geometry.coordinates,P),P}),d=new Set,h=new Map,g=new Set;for(let C=0;C<o.length;C++){let T=e(o[C].properties.id);if(T&&(d.add(C),h.set(C,T)),C<o.length-1){let P=Dt(o[C]),I=Dt(o[C+1]);P!==I&&(g.add(C),g.add(C+1),C>0&&g.add(C-1))}}if(n.length<3&&d.size===0)return n;let b=n.length>=3?(0,Vh.default)(u,.7,!1):u,M=new Set;for(let C=0;C<b.length;C++)M.add(b[C].originalIndex);let m=[];for(let C of d)M.has(C)||m.push(C);let p=b.slice(),y=.25;for(let C of g){if(M.has(C))continue;let T=s.get(C);if(!T)continue;let P=-1;for(let I=0;I<p.length-1;I++)if(p[I].originalIndex<C&&p[I+1].originalIndex>C){P=I+1;break}if(P!==-1){let I={x:0,y:0,nodeId:T.properties.id,originalIndex:C};l(T.geometry.coordinates,I),p.splice(P,0,I)}}for(let C of m){let T=s.get(C);if(!T)continue;let P=-1;for(let I=0;I<p.length-1;I++)if(p[I].originalIndex<C&&p[I+1].originalIndex>C){P=I+1;break}if(P!==-1){let I={x:0,y:0,nodeId:T.properties.id,originalIndex:C};l(T.geometry.coordinates,I);let L=fa(I,p[P-1]),N=fa(I,p[P]);L<y?p[P-1]=I:N<y?p[P]=I:p.splice(P,0,I)}}let v=[],x={x:0,y:0},S={x:0,y:0},w=new Map;for(let C=0;C<p.length;C++)w.set(p[C].originalIndex,C);for(let C of d){let T=s.get(C);if(!T)continue;let P=h.get(C);if(!P)continue;let I=w.get(C)??-1;if(I!==-1){let L;I>0&&(L={x:p[I-1].x,y:p[I-1].y});let N=P.geoJSON.geometry.coordinates;l(N[0],x),l(N[1],S);let z=[x,S],j=T.properties.id,H=Dt(T)||"test-floor",Q=Wh(P,j,H,z,L,c);if(Q){let G={x:Q.entryMeters.x,y:Q.entryMeters.y,nodeId:Q.entryNode.properties.id,originalIndex:C-.5},J={x:Q.exitMeters.x,y:Q.exitMeters.y,nodeId:Q.exitNode.properties.id,originalIndex:C+.5};i.set(Q.entryNode.properties.id,Q.entryNode),i.set(Q.exitNode.properties.id,Q.exitNode),v.push(G,J)}}}if(p.push(...v),p.sort((C,T)=>C.originalIndex-T.originalIndex),r&&p.length>=3)for(let C=0;C<p.length-1;C++){let T=p[C];if(T.nodeId.endsWith("_buffer_exit")){let P=p[p.length-1];if(C<p.length-2){let I=!1;for(let L=C+1;L<p.length-1;L++)if(p[L].nodeId.endsWith("_buffer_entry")||p[L].nodeId.endsWith("_buffer_exit")){I=!0;break}if(!I){let L=i.get(T.nodeId),N=i.get(P.nodeId);if(L&&N){if(Dt(L)!==Dt(N))continue;if(nt(L,N,r,.1)){let z=p.length-C-2;p.splice(C+1,z)}}}}}}if(r&&p.length>=3){let C=p[0],T=-1;for(let P=1;P<p.length;P++)if(p[P].nodeId.endsWith("_buffer_entry")){T=P;break}if(T>1){let P=!1;for(let I=1;I<T;I++)if(p[I].nodeId.endsWith("_buffer_entry")||p[I].nodeId.endsWith("_buffer_exit")){P=!0;break}if(!P){let I=p[T],L=i.get(C.nodeId),N=i.get(I.nodeId);if(L&&N&&Dt(L)===Dt(N)){if(nt(L,N,r,.1)){let z=T-1;p.splice(1,z)}}}}}let D=[];for(let C=0;C<p.length-1;C++){let T=p[C],P=p[C+1],I=i.get(T.nodeId),L=i.get(P.nodeId);I&&L?D.push(new _e({origin:I,destination:L,distance:Ee(I.geometry.coordinates,L.geometry.coordinates),angle:xe(I.geometry.coordinates,L.geometry.coordinates),multiplicativeDistanceWeightScaling:t})):Hh.warn(`Origin or destination node not found for point ${T.nodeId} or ${P.nodeId}`)}return D}function De(n,e){return new _e({origin:n,destination:e,distance:Ee(n.geometry.coordinates,e.geometry.coordinates),angle:xe(n.geometry.coordinates,e.geometry.coordinates)})}function Zh(n,e,t,r=!0){if(n.length<3)return n;let o=new Set;for(let a=0;a<n.length;a++)if(n[a].origin.properties.preventSmoothing){if(o.add(a),r){for(let l=a-1;l>=0;l--)if(!n[l].origin.properties.preventSmoothing){o.add(l);break}}if(r){for(let l=a+1;l<n.length;l++)if(!n[l].origin.properties.preventSmoothing){o.add(l);break}}}if(n.length>0&&n[n.length-1].destination.properties.preventSmoothing&&(o.add(n.length-1),r)){for(let a=n.length-2;a>=0;a--)if(!n[a].origin.properties.preventSmoothing){o.add(a);break}}let i=[],s=0;for(let a=1;a<n.length;a++){let l=a===n.length-1,c=o.has(a),u=l?.05:.7,d=nt(n[s].origin,n[a].origin,e,u),h=n[a].origin.properties.preventSmoothing,g=a-1;if(c){s!==a&&(d?(i.push(De(n[s].origin,n[a].origin)),s=a):(s!==g&&(i.push(De(n[s].origin,n[g].origin)),s=g),s!==a&&(i.push(De(n[s].origin,n[a].origin)),s=a))),l&&i.push(De(n[a].origin,n[a].destination));continue}if(h)d?(i.push(De(n[s].origin,n[a].origin)),s=a):s!==g&&(i.push(De(n[s].origin,n[g].origin)),s=g),i.push(De(n[s].origin,n[a].origin)),s=a,l&&i.push(De(n[a].origin,n[a].destination));else if(d)l&&(nt(n[s].origin,n[a].destination,e,.7)?i.push(De(n[s].origin,n[a].destination)):(i.push(De(n[s].origin,n[a].origin)),i.push(De(n[a].origin,n[a].destination))),s=a);else{if(s===g){l&&(i.push(De(n[s].origin,n[a].origin)),i.push(De(n[a].origin,n[a].destination)));continue}i.push(De(n[s].origin,n[g].origin)),s=g,l&&(i.push(De(n[s].origin,n[a].origin)),i.push(De(n[a].origin,n[a].destination)))}}if(!1){let a=i[i.length-1];window.__DEBUG_PATH.finalSteps.push({nodeId:a.destination.properties.id,coordinate:a.destination.geometry.coordinates,floorId:Dt(a.destination)})}return i}f();function Xh(n,e,t=.2,r={},o){if(n.length<3)return n;let i=[n[0]],s=1;for(let a=s+2;a<n.length;a++)if("outdoors"in r&&us(n[s]?.origin?.properties?.flags??[],r.outdoors.index,r.outdoors.bit)||n[s].origin.properties.preventSmoothing||!nt(n[s].origin,n[a].origin,e,t)){let l=a-1;i.push(new _e({...n[s],destination:n[l].origin,distance:Ee(n[s].origin.geometry.coordinates,n[l].origin.geometry.coordinates),angle:xe(n[s].origin.geometry.coordinates,n[l].origin.geometry.coordinates)})),s=l}return i.push(new _e({...n[s],destination:n[n.length-1].origin,distance:Ee(n[s].origin.geometry.coordinates,n[n.length-1].origin.geometry.coordinates),angle:xe(n[s].origin.geometry.coordinates,n[n.length-1].origin.geometry.coordinates),multiplicativeDistanceWeightScaling:o}),n[n.length-1]),i}f();var Yh=lo(ml());function $h(n,e){let t=new Set;if(n.length<2)return t;let r=[n[0].origin];for(let b=0;b<n.length;b++)r.push(n[b].destination);let o=r[0].geometry.coordinates[1],{toCartesian:i}=ni(o),s=e;if(!s)return t;let a=r.map((b,M)=>{let m={x:0,y:0,nodeId:b.properties.id,originalIndex:M};return i(b.geometry.coordinates,m),m}),l=new Set,c=new Set;for(let b=0;b<a.length;b++)s(a[b].nodeId)&&(l.add(b),c.add(a[b].nodeId));if(l.size===0)return t;let u=a.length>=3?(0,Yh.default)(a,.7,!1):a,d=new Map;for(let b=0;b<u.length;b++)d.set(u[b].originalIndex,b);let h=new Set;for(let b of l){let M=d.get(b);if(M!==void 0){if(M>0){let m=u[M-1].nodeId;h.add(m)}if(M<u.length-1){let m=u[M+1].nodeId;h.add(m)}}else{let m,p;for(let y=0;y<u.length-1;y++){let v=u[y].originalIndex,x=u[y+1].originalIndex;if(v<b&&b<x){m=u[y].nodeId,p=u[y+1].nodeId;break}}m&&h.add(m),p&&h.add(p)}}let g=0;for(let b of n)h.has(b.origin.properties.id)&&(b.origin.properties.preventSmoothing||(b.origin.properties.preventSmoothing=!0,t.add(b.origin.properties.id))),h.has(b.destination.properties.id)&&(b.destination.properties.preventSmoothing||(b.destination.properties.preventSmoothing=!0,t.add(b.destination.properties.id))),g++;return t}f();f();var ds={accessible:"accessible",outdoors:"outdoors",public:"public"};f();f();function Vn(n,e,t=[]){let r={...n};for(let[o,i]of Object.entries(e))if(i!==void 0)if(o in r){let s=o;if(Array.isArray(i)&&i.length>0){let a=Ey(i[0],t);if(a){let l=r[s];if(!Array.isArray(l))throw new Error(`Expected array at ${o}, got ${typeof l}`);let c=new Map(i.map(h=>[qh(h,a),h])),d=l.map(h=>{let g=c.get(qh(h,a));return g?Vn(h,g,t):h});r[s]=d}else r[s]=i}else{let a=r[s];typeof a=="object"&&a!==null&&typeof i=="object"&&i!==null?Object.keys(i).length===0?r[s]=i:r[s]=Vn(a,i,t):r[o]=i}}else r[o]=i;return r}function Ey(n,e){function t(r){if(typeof r!="object"||r===null)return null;for(let o of e)if(o in r&&typeof r[o]<"u")return[o];if(Array.isArray(r))return null;for(let[o,i]of Object.entries(r)){let s=t(i);if(s)return[o,...s]}return null}return t(n)}function qh(n,e){return e.reduce((t,r)=>{if(t&&typeof t=="object")return t[r]},n)}f();var wy=n=>{if(n==="space"||n==="obstruction"||n==="entrance")return{}},Ty=/\.json|\.geojson$/,hs=(n,e,t)=>{let r=n[e];if(typeof r!="object"||Object.keys(r).length===0)return wy(e);let o={};for(let[i,s]of Object.entries(r)){let a=i.replace(Ty,"");o[a]=JSON.parse(t(s))}return o},Dy=["floorstack.json","styles.json","shapes.json","mapstack.json","floor.geojson","tileset.json","location.json","category.json","navigationFlags.json","annotation-symbols.json"],Py=Dy,Iy=["annotation","textAreas","enterprise","floorImages","shapeInstances","modelInstances","window","area","facade"],Oy=Iy,Ly=n=>{let e=new TextDecoder("utf-8"),t=e.decode.bind(e),r={"manifest.geojson":JSON.parse(t(n["manifest.geojson"])),"mapstack.geojson":JSON.parse(t(n["mapstack.geojson"])),"map.geojson":JSON.parse(t(n["map.geojson"])),"node.geojson":JSON.parse(t(n["node.geojson"])),"connection.json":JSON.parse(t(n["connection.json"])),space:hs(n,"space",t),obstruction:hs(n,"obstruction",t),entrance:hs(n,"entrance",t)};for(let o of Py)n[o]&&(r[o]=JSON.parse(t(n[o])));for(let o of Oy)n[o]&&(r[o]=hs(n,o,t));return r};f();f();f();var jn=["agriculture","airport","casino","city-district","convention-center","entertainment","event-centre","first-responder-building","government-building","grocery-store","healthcare","higher-education","hotel","library","manufacturing","medical-centre","mixed-use","multifamily","museum","office-building","oil-and-energy","other","parking-facility","religious-institution","resort","retail-store","schools-k-12","shopping-mall","stadium-or-arena","storage-facility","theme-park","transit","transportation-hub","warehousing"],Ay=[...jn,"unknown"],fl=Object.freeze(Object.fromEntries([...jn,"unknown"].map(n=>[n,n])));f();var Zn=["reference-point","checkpoint","checkpoint-passport","parent"],Ry=[...Zn,"unknown"],_y=Object.freeze(Object.fromEntries([...Zn,"unknown"].map(n=>[n,n])));var Xn=["closed-temporarily","new","pop-up","coming-soon","relocated"],Fy=[...Xn,"unknown"],Ny=Object.freeze(Object.fromEntries([...Xn,"unknown"].map(n=>[n,n])));f();var Yn=["left","center","right"],By=[...Yn,"unknown"],Gy=Object.freeze(Object.fromEntries([...Yn,"unknown"].map(n=>[n,n])));f();var $n=["near","center"],ky=[...$n,"unknown"],zy=Object.freeze(Object.fromEntries([...$n,"unknown"].map(n=>[n,n])));f();var qn=["top","side"],Uy=[...qn,"unknown"],Hy=Object.freeze(Object.fromEntries([...qn,"unknown"].map(n=>[n,n])));var Jn=["inside","outside","both"],Wy=[...Jn,"unknown"],Vy=Object.freeze(Object.fromEntries([...Jn,"unknown"].map(n=>[n,n])));f();var ps=["elevator","escalator","travelator","stairs","door","ramp","ladder"],$2=[...ps,"unknown"],gl=Object.freeze(Object.fromEntries([...ps,"unknown"].map(n=>[n,n])));f();var ms=["room","hallway","wall","object","poi","area","window"],K2=[...ms,"unknown"],Q2=Object.freeze(Object.fromEntries([...ms,"unknown"].map(n=>[n,n])));f();f();var fs=class{_value;constructor(e){this._value=e}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let e=this._value;return this._value=null,{done:!1,value:e}}},gs=class{_tag="Some";_value;constructor(e){this._value=e}get value(){return this._value}isSome(){return!0}isSomeAnd(e){return e(this.value)}isNone(){return!1}equals(e){return e.isSome()&&e.value===this.value}expect(e){return this.value}unwrap(){return this.value}unwrapOr(e){return this.value}unwrapOrElse(e){return this.value}inspect(e){return e(this.value),this}inspectNone(e){return this}map(e){return Jh(e(this.value))}mapAsync(e){return e(this.value).then(t=>Jh(t))}mapOr(e,t){return this.map(e).unwrapOr(t)}mapOrAsync(e,t){return this.mapAsync(e).then(r=>r.unwrapOr(t))}mapOrElse(e,t){return this.map(e).unwrapOrElse(t)}mapOrElseAsync(e,t){return this.mapAsync(e).then(r=>r.unwrapOrElse(t))}and(e){return e}andThen(e){return e(this.value)}andThenAsync(e){return e(this.value)}filter(e){return e(this.value)?this:Jt()}or(e){return this}orElse(e){return this}xor(e){return e.isSome()?Jt():this}toString(){return`Some(${this.value})`}okOr(e){return dt(this.value)}okOrElse(e){return dt(this.value)}iter(){return new fs(this.value)}[Symbol.iterator](){return this.iter()}zip(e){return e.isSome()?Qr([this.value,e.value]):Jt()}zipWith(e,t){return e.isSome()?Qr(t(this.value,e.value)):Jt()}get[Symbol.toStringTag](){return"Some"}},ys=class{_tag="None";get value(){return null}isSome(){return!1}isSomeAnd(e){return!1}isNone(){return!0}equals(e){return e.isNone()}expect(e){throw new Error(e)}unwrap(){throw new Error("Tried to unwrap a None value!")}unwrapOr(e){return e}unwrapOrElse(e){return e()}inspect(e){return this}inspectNone(e){return e(),this}map(e){return this}mapAsync(e){return Promise.resolve(this)}mapOr(e,t){return t}mapOrAsync(e,t){return Promise.resolve(t)}mapOrElse(e,t){return t()}mapOrElseAsync(e,t){return t()}and(e){return this}andThen(e){return this}andThenAsync(e){return Promise.resolve(this)}filter(e){return this}or(e){return e}orElse(e){return e()}xor(e){return e}toString(){return"None"}okOr(e){return Cr(e)}okOrElse(e){return Cr(e())}iter(){return new fs(null)}[Symbol.iterator](){return this.iter()}zip(e){return this}zipWith(e,t){return this}get[Symbol.toStringTag](){return"None"}},Qr=n=>new gs(n),Jt=()=>new ys,Jh=n=>n instanceof gs||n instanceof ys?n:n==null?Jt():Qr(n);var bs=class{_value;constructor(e){this._value=e}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let e=this._value;return this._value=null,{done:!1,value:e}}},yl=class{_tag="Ok";_value;constructor(e){this._value=e}get value(){return this._value}get error(){return null}isOk(){return!0}isOkAnd(e){return e(this.value)}isErr(){return!1}isErrAnd(e){return!1}ok(){return Qr(this.value)}err(){return Jt()}expect(e){return this.value}expectErr(e){throw new Error(e)}unwrap(){return this.value}unwrapOr(e){return this.value}unwrapOrElse(e){return this.value}inspect(e){return e(this.value),this}inspectErr(){return this}map(e){return dt(e(this.value))}async mapAsync(e){return e(this.value).then(dt)}mapOr(e,t){return e(this.value)}async mapOrAsync(e,t){return e(this.value)}mapOrElse(e,t){return e(this.value)}async mapOrElseAsync(e,t){return e(this.value)}mapErr(e){return this}iter(){return new bs(this.value)}[Symbol.iterator](){return this.iter()}and(e){return e}andThen(e){return e(this.value)}or(e){return this}orElse(e){return this}async andThenAsync(e){return e(this.value)}toString(){return`Ok(${this.value})`}get[Symbol.toStringTag](){return"Ok"}},bl=class n{_tag="Err";_error;constructor(e){this._error=e}get value(){return null}get error(){return this._error}isOk(){return!1}isOkAnd(e){return!1}isErr(){return!0}isErrAnd(e){return e(this.error)}ok(){return Jt()}err(){return Qr(this.error)}expect(e){throw new Error(e)}expectErr(e){return this.error}unwrap(){throw this.error}unwrapOr(e){return e}unwrapOrElse(e){return e()}inspect(){return this}inspectErr(e){return e(this.error),this}map(e){return this}iter(){return new bs(null)}[Symbol.iterator](){return this.iter()}async mapAsync(e){return this}mapOr(e,t){return t}async mapOrAsync(e,t){return t}mapOrElse(e,t){return t()}async mapOrElseAsync(e,t){return t()}mapErr(e){return new n(e(this.error))}and(e){return this}andThen(e){return this}async andThenAsync(e){return this}or(e){return e}orElse(e){return e(this.error)}toString(){return`Err(${this.error})`}get[Symbol.toStringTag](){return"Err"}},dt=n=>new yl(n),Cr=n=>new bl(n);f();var Ve=Uint8Array,en=Uint16Array,jy=Int32Array,Kh=new Ve([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]),Qh=new Ve([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]),Zy=new Ve([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ep=function(n,e){for(var t=new en(31),r=0;r<31;++r)t[r]=e+=1<<n[r-1];for(var o=new jy(t[30]),r=1;r<30;++r)for(var i=t[r];i<t[r+1];++i)o[i]=i-t[r]<<5|r;return{b:t,r:o}},tp=ep(Kh,2),rp=tp.b,Xy=tp.r;rp[28]=258,Xy[258]=28;var np=ep(Qh,0),Yy=np.b,l3=np.r,Ml=new en(32768);for(q=0;q<32768;++q)Pt=(q&43690)>>1|(q&21845)<<1,Pt=(Pt&52428)>>2|(Pt&13107)<<2,Pt=(Pt&61680)>>4|(Pt&3855)<<4,Ml[q]=((Pt&65280)>>8|(Pt&255)<<8)>>1;var Pt,q,Kn=(function(n,e,t){for(var r=n.length,o=0,i=new en(e);o<r;++o)n[o]&&++i[n[o]-1];var s=new en(e);for(o=1;o<e;++o)s[o]=s[o-1]+i[o-1]<<1;var a;if(t){a=new en(1<<e);var l=15-e;for(o=0;o<r;++o)if(n[o])for(var c=o<<4|n[o],u=e-n[o],d=s[n[o]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)a[Ml[d]>>l]=c}else for(a=new en(r),o=0;o<r;++o)n[o]&&(a[o]=Ml[s[n[o]-1]++]>>15-n[o]);return a}),Qn=new Ve(288);for(q=0;q<144;++q)Qn[q]=8;var q;for(q=144;q<256;++q)Qn[q]=9;var q;for(q=256;q<280;++q)Qn[q]=7;var q;for(q=280;q<288;++q)Qn[q]=8;var q,op=new Ve(32);for(q=0;q<32;++q)op[q]=5;var q;var $y=Kn(Qn,9,1);var qy=Kn(op,5,1),vl=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},ot=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},xl=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},Jy=function(n){return(n+7)/8|0},El=function(n,e,t){return(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length),new Ve(n.subarray(e,t))};var Ky=["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"],Ke=function(n,e,t){var r=new Error(e||Ky[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Ke),!t)throw r;return r},Qy=function(n,e,t,r){var o=n.length,i=r?r.length:0;if(!o||e.f&&!e.l)return t||new Ve(0);var s=!t,a=s||e.i!=2,l=e.i;s&&(t=new Ve(o*3));var c=function(Xe){var ft=t.length;if(Xe>ft){var Se=new Ve(Math.max(ft*2,Xe));Se.set(t),t=Se}},u=e.f||0,d=e.p||0,h=e.b||0,g=e.l,b=e.d,M=e.m,m=e.n,p=o*8;do{if(!g){u=ot(n,d,1);var y=ot(n,d+1,3);if(d+=3,y)if(y==1)g=$y,b=qy,M=9,m=5;else if(y==2){var w=ot(n,d,31)+257,D=ot(n,d+10,15)+4,C=w+ot(n,d+5,31)+1;d+=14;for(var T=new Ve(C),P=new Ve(19),I=0;I<D;++I)P[Zy[I]]=ot(n,d+I*3,7);d+=D*3;for(var L=vl(P),N=(1<<L)-1,z=Kn(P,L,1),I=0;I<C;){var j=z[ot(n,d,N)];d+=j&15;var v=j>>4;if(v<16)T[I++]=v;else{var H=0,Q=0;for(v==16?(Q=3+ot(n,d,3),d+=2,H=T[I-1]):v==17?(Q=3+ot(n,d,7),d+=3):v==18&&(Q=11+ot(n,d,127),d+=7);Q--;)T[I++]=H}}var G=T.subarray(0,w),J=T.subarray(w);M=vl(G),m=vl(J),g=Kn(G,M,1),b=Kn(J,m,1)}else Ke(1);else{var v=Jy(d)+4,x=n[v-4]|n[v-3]<<8,S=v+x;if(S>o){l&&Ke(0);break}a&&c(h+x),t.set(n.subarray(v,S),h),e.b=h+=x,e.p=d=S*8,e.f=u;continue}if(d>p){l&&Ke(0);break}}a&&c(h+131072);for(var ne=(1<<M)-1,je=(1<<m)-1,ye=d;;ye=d){var H=g[xl(n,d)&ne],be=H>>4;if(d+=H&15,d>p){l&&Ke(0);break}if(H||Ke(2),be<256)t[h++]=be;else if(be==256){ye=d,g=null;break}else{var pt=be-254;if(be>264){var I=be-257,Ze=Kh[I];pt=ot(n,d,(1<<Ze)-1)+rp[I],d+=Ze}var Qe=b[xl(n,d)&je],mt=Qe>>4;Qe||Ke(3),d+=Qe&15;var J=Yy[mt];if(mt>3){var Ze=Qh[mt];J+=xl(n,d)&(1<<Ze)-1,d+=Ze}if(d>p){l&&Ke(0);break}a&&c(h+131072);var et=h+pt;if(h<J){var It=i-J,Fe=Math.min(J,et);for(It+h<0&&Ke(3);h<Fe;++h)t[h]=r[It+h]}for(;h<et;++h)t[h]=t[h-J]}}e.l=g,e.p=ye,e.b=h,e.f=u,g&&(u=1,e.m=M,e.d=b,e.n=m)}while(!u);return h!=t.length&&s?El(t,0,h):t.subarray(0,h)};var eb=new Ve(0);var ht=function(n,e){return n[e]|n[e+1]<<8},it=function(n,e){return(n[e]|n[e+1]<<8|n[e+2]<<16|n[e+3]<<24)>>>0},Sl=function(n,e){return it(n,e)+it(n,e+4)*4294967296};function tb(n,e){return Qy(n,{i:2},e&&e.out,e&&e.dictionary)}var Cl=typeof TextDecoder<"u"&&new TextDecoder,rb=0;try{Cl.decode(eb,{stream:!0}),rb=1}catch{}var nb=function(n){for(var e="",t=0;;){var r=n[t++],o=(r>127)+(r>223)+(r>239);if(t+o>n.length)return{s:e,r:El(n,t-1)};o?o==3?(r=((r&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|r>>10,56320|r&1023)):o&1?e+=String.fromCharCode((r&31)<<6|n[t++]&63):e+=String.fromCharCode((r&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(r)}};function wl(n,e){if(e){for(var t="",r=0;r<n.length;r+=16384)t+=String.fromCharCode.apply(null,n.subarray(r,r+16384));return t}else{if(Cl)return Cl.decode(n);var o=nb(n),i=o.s,t=o.r;return t.length&&Ke(8),i}}var ob=function(n,e){return e+30+ht(n,e+26)+ht(n,e+28)},ib=function(n,e,t){var r=ht(n,e+28),o=wl(n.subarray(e+46,e+46+r),!(ht(n,e+8)&2048)),i=e+46+r,s=it(n,e+20),a=t&&s==4294967295?sb(n,i):[s,it(n,e+24),it(n,e+42)],l=a[0],c=a[1],u=a[2];return[ht(n,e+10),l,c,o,i+ht(n,e+30)+ht(n,e+32),u]},sb=function(n,e){for(;ht(n,e)!=1;e+=4+ht(n,e+2));return[Sl(n,e+12),Sl(n,e+4),Sl(n,e+20)]};function ip(n,e){for(var t={},r=n.length-22;it(n,r)!=101010256;--r)(!r||n.length-r>65558)&&Ke(13);var o=ht(n,r+8);if(!o)return{};var i=it(n,r+16),s=i==4294967295||o==65535;if(s){var a=it(n,r-12);s=it(n,a)==101075792,s&&(o=it(n,a+32),i=it(n,a+48))}for(var l=e&&e.filter,c=0;c<o;++c){var u=ib(n,i,s),d=u[0],h=u[1],g=u[2],b=u[3],M=u[4],m=u[5],p=ob(n,m);i=M,(!l||l({name:b,size:h,originalSize:g,compression:d}))&&(d?d==8?t[b]=tb(n.subarray(p,p+h),{out:new Ve(g)}):Ke(14,"unknown compression type "+d):t[b]=El(n,p,p+h))}return t}f();f();f();f();var ge=n=>Object.entries(n);f();var eo=n=>Object.keys(n);function sp(n){return n.replace(/^g_/,"s_")}function vs(n){return n.replace(/^g_/,"o_")}function ab(n){return n.replace(/^g_/,"w_")}function ap(n){return n.replace(/^loci_/,"eli_")}function to(n){return n.replace(/^loc_/,"el_")}function xs(n){return n.replace(/^lcat_/,"ec_")}function lb(n){return n.replace(/^g_/,"ar_")}function lp(n){return n.replace(/^n_/,"s_")}function cb(n,e,t){switch(n.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":{let r=[],o=0,i=n.geometry.type.replace("Multi","");for(let s of n.geometry.coordinates)r.push({...n,geometry:{type:i,coordinates:s},properties:{...n.properties,id:`${e}-${o++}`,kind:t}});return r}default:return[{...n,properties:{...n.properties,id:e,kind:t}}]}}function tn(n,e,t,r){let o=new Map;for(let{feature:i,floorId:s}of n){let a=i.properties.id,l=r.get(a);if(e.has(a)){let c=cb(i,t(a),l),u=c.map(h=>h.properties.id),d=u.map(h=>({geometryId:h,floorId:s}));o.set(a,{ids:u,features:c,anchors:d})}}return o}function cp(n){let e={space:new Map,obstruction:new Map,area:new Map,window:new Map,object:new Map};if(!n.geometry)return e;let t=ub(n),r=ge(n.geometry).flatMap(([c,u])=>(u?.features??[]).map(d=>({feature:d,floorId:c}))).flat(),o=new Set(Object.values(n.walkable??{}).filter(c=>c!==void 0).flatMap(eo)),i=new Set(Object.values(n.nonwalkable??{}).filter(c=>c!==void 0).flatMap(eo)),s=new Set(Array.from(t.entries()).filter(([c,u])=>u==="area").map(([c])=>c)),a=new Set(Array.from(t.entries()).filter(([c,u])=>u==="object").map(([c])=>c)),l=new Set(Array.from(t.entries()).filter(([c,u])=>u==="window").map(([c])=>c));return o.size>0&&(e.space=tn(r,o,sp,t)),i.size>0&&(e.obstruction=tn(r,i,vs,t)),s.size>0&&(e.area=tn(r,s,lb,t)),a.size>0&&(e.object=tn(r,a,vs,t)),l.size>0&&(e.window=tn(r,l,ab,t)),o.size===0&&i.size===0&&s.size===0&&(e.space=tn(r,new Set(r.map(c=>c.feature.properties.id)),sp,t)),e}function ub(n){let e=new Map(Object.values(n.kinds??{}).filter(t=>t!==void 0).flatMap(ge));for(let t of n.connections?.filter(r=>r.type!=="door")??[]){for(let r of t.entrances)e.set(r.geometryId,`connection.${t.type}`);for(let r of t.exits)e.set(r.geometryId,`connection.${t.type}`)}return e}function up(n){if(!n||n.length===0)return[];let e=Math.max(...n.map(t=>t.length));return n.reduce((t,r)=>t.map((o,i)=>o|(r[i]??0)),Array(e).fill(0))}function dp(n){let{nodesByGeometryId:e,incomingEdgesByNodeId:t,nodesById:r}=db(n),o=cp(n),i=hb(n),s=n.navigationFlags??{};return{geometryMaps:o,nodesByGeometryId:e,geometryFeatureById:i,navigationFlags:s,incomingEdgesByNodeId:t,nodesById:r}}function db(n){let e=new Map,t=new Map,r=new Map;for(let o of Object.values(n.nodes??{}))for(let i of o?.features??[]){if(r.set(i.properties.id,i),i.properties.geometryIds.length>0)for(let s of i.properties.geometryIds){let a=e.get(s)??[];a.push(i.properties.id),e.set(s,a)}if(i.properties.neighbors.length>0)for(let s of i.properties.neighbors){let a=t.get(s.id);a!=null?a.push(s):t.set(s.id,[s])}}return{nodesByGeometryId:e,incomingEdgesByNodeId:t,nodesById:r}}function hb(n){let e=new Map;for(let t of Object.values(n.geometry??{}))for(let r of t?.features??[])e.set(r.properties.id,r);return e}f();function hp(n,e){if(!n.annotations||!n.annotationSymbols||!n.geometry)return{};let t={};for(let[r,o]of ge(n.annotations)){if(!o||o.length===0||!n.geometry[r]||n.geometry[r].features.length===0)continue;let i=new Map(n.geometry[r].features.map(a=>[a.properties.id,a])),s={type:"FeatureCollection",features:[]};for(let a of o){let l=i.get(a.geometryId);if(!l||l.geometry.type!=="Point")continue;let c={id:a.id,externalId:a.externalId,symbolId:a.symbolKey};s.features.push({type:"Feature",geometry:l.geometry,properties:c})}t[r]=s}return{annotation:t}}f();f();function Er(n,e){return e&&(n.flags[e.index]&1<<e.bit)!==0}f();var Tl={accessible:"accessible",outdoors:"outdoors",public:"public"};function pp(n,{nodesByGeometryId:e}){let t={"connection.json":[],entrance:{}},r=n.navigationFlags?.[Tl.accessible],o=n.navigationFlags?.[Tl.outdoors],i=new Map(Object.values(n.geometry??{}).flatMap(s=>s?.features??[]).map(s=>[s.properties.id,s]));for(let s of n.connections??[]){if(Dl(s,i)&&!pb(s)){let d=mb(s,i,e,o);for(let[h,g]of d)t.entrance[h]||(t.entrance[h]={type:"FeatureCollection",features:[]}),t.entrance[h].features.push(g);continue}let a=r!=null&&s.entrances.some(d=>Er(d,r))&&s.exits.some(d=>Er(d,r)),l=Array.from(new Set([...s.entrances.map(d=>e.get(d.geometryId)),...s.exits.map(d=>e.get(d.geometryId))].flat().filter(d=>d!=null))),c=up([...s.entrances.map(d=>d.flags),...s.exits.map(d=>d.flags)]),u={id:s.id,externalId:s.details?.externalId??"",type:s.type,accessible:a,nodes:l,flags:c};s.details?.name&&(u.details={name:s.details.name}),s.extra&&(u.extra=s.extra),t["connection.json"].push(u)}return t}function Dl(n,e){return n.type==gl.door&&n.entrances.every(t=>e.get(t.geometryId)?.geometry.type==="LineString")}function pb(n){return n.entrances.length===0||n.exits.length===0?!1:new Set([...n.entrances.map(t=>t.floorId),...n.exits.map(t=>t.floorId)]).size>=2}function mb(n,e,t,r){if(n.type!==gl.door)return[];let o=[];for(let i of n.entrances){let s=e.get(i.geometryId);if(s?.geometry.type==="LineString"){let a={type:"Feature",geometry:s.geometry,properties:{id:n.id,externalId:n.details?.externalId??"",isExterior:fb(n,r)}},l=n.details;l&&(a.properties.details={name:l.name,description:l.description},l.icon&&(a.properties.details.images=[{url:l.icon,altText:`${l.name} icon`}]));let c=t.get(i.geometryId);c&&c.length>0&&(a.properties.node=c[0]),o.push([i.floorId,a])}}return o}function fb(n,e){return n.entrances.some(t=>Er(t,e))||n.exits.some(t=>Er(t,e))}f();function fp(n,{geometryMaps:e,nodesByGeometryId:t}){let r={categories:[],locations:[],locationInstances:[],layers:[],venue:{slug:"",name:"",externalId:"",defaultLanguage:{name:"English",code:"en"},languages:[]}},o=n.manifest?.features[0];o&&(r.venue.defaultFloor=o.properties.defaultFloor,r.venue.tzid=o.properties.tzid,r.venue.name=o.properties.name,r.venue.defaultLanguage={name:o.properties.language??"English",code:o.properties.language??"en"});let i=n.cms?.venue;i&&(r.venue={...r.venue,slug:i.slug,name:i.details?.name??r.venue.name??o.properties.name,externalId:i.details?.externalId??"",defaultLanguage:i.defaultLanguage,languages:i.languages??[],countrycode:i.countrycode,coverImage:i.coverImage,logo:i.logo,icon:i.details?.icon,extra:i.extra,mappedinWebUrl:i.mappedinWebUrl,operationHours:i.operationHours,topLocations:i.topLocations,type:i.type&&i.type in fl?i.type:"unknown",propertyImage:i.propertyImage});let s=new Map,a=n.locations??[],l=n.cms?.locations??[],c=n.cms?.categories??[],u=new Map((c??[]).map(v=>[v.categoryId,v]));if(a.length>0){let v=new Map(l.map(x=>[x.locationId,x]));for(let x of a){let S=v.get(x.id)??{};if(x){let w=x.details,D={id:S?.cmsId!==void 0?`el_${S?.cmsId}`:to(x.id),name:w.name,externalId:w.externalId??"",type:S.type??"location",sortOrder:S.sortOrder??0,amenity:S.amenity,description:w.description,extra:x.extra,links:x.links,operationHours:x.openingHours,gallery:S.gallery,logo:x.logo,shortName:w.shortName,picture:S.picture,showFloatingLabelWhenImagePresent:S.showFloatingLabelWhenImagePresent,showLogo:S.showLogo,siblingGroups:S.siblingGroups,states:S.states,tags:S.tags,spaces:[],nodes:[],polygons:[],headerImage:S.headerImage};if(x.phone&&(D.phone={number:x.phone}),S.primaryCategory){let T=u.get(S.primaryCategory);T&&(D.primaryCategory=T.id)}let C=mp(x.social);x.website&&(C.website=x.website.url),D.social=C;for(let T of x.geometryAnchors){let P=e.space.get(T.geometryId),I=e.obstruction.get(T.geometryId),L=P??I;if(L){let z=new Set(L.features.filter(j=>j.geometry.type==="Polygon").map(j=>j.properties.id));for(let j of L.anchors)P!=null&&L===P&&D.spaces.push({floor:j.floorId,id:j.geometryId}),z.has(j.geometryId)&&D.polygons.push({map:j.floorId,id:j.geometryId})}let N=t.get(T.geometryId);for(let z of N??[])D.nodes.push({map:T.floorId,id:z})}r.locations.push(D);for(let T of x.categories)s.set(T,[...s.get(T)??[],x.id])}}}let d=n.cms?.locationInstances??[],h=n.locationInstances;if(h){let v=new Map(d.map(S=>[S.locationInstanceId,S])),x=[];for(let S of h){let w=v.get(S.id)??{};if(S){let D={id:ap(S.id),parent:w.parentId??to(S.parentId),name:S.details?.name,externalId:S.details?.externalId,type:w.type,sortOrder:w.sortOrder,amenity:w.amenity,description:S.details?.description,extra:S.extra,links:S.links,operationHours:S.openingHours,gallery:w.gallery,picture:w.picture,showFloatingLabelWhenImagePresent:w.showFloatingLabelWhenImagePresent,showLogo:w.showLogo,siblingGroups:w.siblingGroups,states:w.states,tags:w.tags,logo:S.logo,shortName:S.details?.shortName,headerImage:w.headerImage};S.phone&&(D.phone={number:S.phone});let C=mp(S.social??[]);if(S.website&&(C.website=S.website.url),Object.keys(C).length>0&&(D.social=C),S.geometryAnchors?.length){let T=S.geometryAnchors.flatMap(P=>e.space.get(P.geometryId)?.anchors??[]);T.length>0&&(D.spaces=T.map(P=>({floor:P.floorId,id:P.geometryId})))}if(S.geometryAnchors){D.spaces=[],D.polygons=[],D.nodes=[];for(let T of S.geometryAnchors){let P=e.space.get(T.geometryId);if(P){let L=new Set(P.features.filter(N=>N.geometry.type==="Polygon").map(N=>N.properties.id));for(let N of P.anchors)D.spaces.push({floor:N.floorId,id:N.geometryId}),L.has(N.geometryId)&&D.polygons.push({map:N.floorId,id:N.geometryId})}let I=t.get(T.geometryId);for(let L of I??[])D.nodes.push({map:T.floorId,id:L})}}x.push(D)}}x.length>0&&(r.locationInstances=x)}let g=n.locationCategories;if(g){let v=[],x=new Map(g.map(C=>[C.id,C])),S=new Map((c??[]).map(C=>[C.categoryId,C])),w=new Map;for(let C of g){let T=x.get(C.parent);if(T){let P=w.get(T.id)??[];P.push(C.id),w.set(T.id,P)}}for(let C of g){let T=S.get(C.id);if(C){let P=(w.get(C.id)??[]).map(xs),I={id:xs(C.id),name:C.details.name,externalId:C.details.externalId??"",sortOrder:T?.sortOrder??0,children:P,locations:(s.get(C.id)??[]).map(to),icon:C.details.icon,picture:T?.picture,color:T?.color,extra:C.extra,iconFromDefaultList:T?.iconFromDefaultList};v.push(I)}}r.categories=v;let D={};for(let C of a)D[to(C.id)]=C.categories.map(xs).filter(T=>T!==void 0);r.categoryPriorities=D}let b={};for(let[v,x]of Object.entries(n.defaultStyle??{}))if(x.buffer){let S=x.geometryAnchors.flatMap(w=>e.space.get(w.geometryId)?.anchors??[]);b[v]={edgeOffset:x.buffer,geometryAnchors:S}}Object.keys(b).length>0&&(r.enterpriseStyles=b);let M=new Map;for(let v of Object.values(n.cms?.layers??{}))if(v)for(let[x,S]of ge(v)){if(typeof S!="string")continue;let w=M.get(S)??{name:S,id:`ely_${S}`,spaces:[]};w.spaces.push(...e.space.get(x)?.anchors.map(D=>({floorId:D.floorId,spaceId:D.geometryId}))??[]),M.set(S,w)}M.size>0&&(r.layers=Array.from(M.values()));let m=[];for(let v of Object.values(n.cms?.textures??{}))for(let x of v){let S=e.space.get(x.geometryId)?.anchors;!S||S.length<1||x.face==="unknown"||x.surface==="unknown"||m.push({repeat:x.repeat,offset:x.offset,rotation:x.rotation,path:x.path,face:x.face,surface:x.surface,bounds:x.bounds,geometryAnchors:S})}m.length>0&&(r.textures=m);let p={};for(let[v,x]of Object.entries(n.cms?.floorText??{})){let S={type:"FeatureCollection",features:[]};for(let w of x.features){if(w.properties.align==="unknown")continue;let D={align:w.properties.align,color:w.properties.color,fontFamily:w.properties.fontFamily,fontSize:w.properties.fontSize,rotation:w.properties.rotation,text:w.properties.text,visible:w.properties.visible};"geometryId"in w.properties?D.geometryId=w.properties.geometryId:D.verticalOffset=w.properties.verticalOffset,S.features.push({type:"Feature",geometry:w.geometry,properties:D})}S.features.length>0&&(p[v]=S)}Object.keys(p).length>0&&(r.floorText=p);let y={enterprise:r};if(n.cms?.textAreas){let v={};for(let[x,S]of ge(n.cms.textAreas)){let w={type:"FeatureCollection",features:[]};for(let D of S.features){if(D.properties.align==="unknown")continue;let C={align:D.properties.align,maxWidth:D.properties.maxWidth,maxHeight:D.properties.maxHeight,rotation:D.properties.rotation};"geometryId"in D.properties?C.anchorId=D.properties.geometryId:C.verticalOffset=D.properties.verticalOffset;let T={type:"Feature",geometry:D.geometry,properties:C};w.features.push(T)}v[x]=w}y.textAreas=v}return y}var gb=["facebook","instagram","twitter"];function mp(n){let e={};for(let{name:t,url:r}of n){let o=t.toLowerCase();gb.includes(o)&&(e[o]=r)}return e}f();var yb=n=>`fc_${n.slice(3)}`;function gp(n,{geometryMaps:e}){if(!n.facade)return{};let t={},r={};for(let[o,i]of ge(n.facade))if(i)for(let s of Object.values(i)){let{floorStackId:a,geometryIds:l}=s,c=yb(a);r[a]??={id:c,spaces:[]},r[a].spaces.push(...l.map(u=>({floorId:o,spaceId:e.space.get(u)?.ids[0]??""})))}return Object.keys(r).length>0&&(t.facade=r),t}f();function yp(n,e={}){let t={type:"FeatureCollection",features:[]},r=[];for(let o of n.floors.features)r.push({id:o.properties.id,externalId:o.properties.details?.externalId??"",elevation:o.properties.elevation,name:o.properties.details?.name??"",shortName:o.properties.details?.shortName??"",subtitle:o.properties.subtitle,maxHeight:o.properties.maxHeight}),t.features.push({type:"Feature",geometry:o.geometry,properties:{id:o.properties.id,externalId:o.properties.details?.externalId??"",elevation:o.properties.elevation,name:o.properties.details?.name??"",shortName:o.properties.details?.shortName??"",subtitle:o.properties.subtitle,maxHeight:o.properties.maxHeight}});return{"floor.geojson":t,"map.geojson":r}}f();function bp(n,{geometryMaps:e}){let t={},r={};for(let[o,i]of ge(n.floorImages??{})){let s={features:[],type:"FeatureCollection"};for(let a of i?.features??[])if("verticalOffset"in a.properties)s.features.push(a);else{let{geometryId:l,...c}=a.properties,u=e.space.get(l)?.ids[0]??e.obstruction.get(l)?.ids[0];if(!u)continue;let d={geometry:a.geometry,properties:{...c,anchorId:u},type:a.type};s.features.push(d)}r[o]=s}return Object.keys(r).length>0&&(t.floorImages=r),t}f();function vp(n,e={}){let t=[];for(let o of n?.floorStacks??[]){let i={id:o.id,floors:o.floors,maps:o.floors,externalId:o.details?.externalId??"",name:o.details?.name??"",shortName:o.details?.shortName??"",type:"Building"};o.defaultFloor&&(i.defaultFloor=o.defaultFloor),t.push(i)}if(n.outdoors&&n.outdoors.floors.length>0){let o={id:"outdoors",floors:n.outdoors.floors,maps:n.outdoors.floors,type:"Outdoor",name:"Outdoors",externalId:"outdoors"};t.push(o)}return{"floorstack.json":t,"mapstack.geojson":t}}f();f();var Cp=lo(Mp(),1),Mb=n=>{let e=n.geometry.coordinates[0],t=0;for(let r=0;r<e.length-1;r++)t+=e[r][0]*e[r+1][1]-e[r+1][0]*e[r][1];return Math.abs(t/2)},Cb=(n,e)=>{let[t,r]=n,o=e.geometry.coordinates[0],i=!1;for(let s=0,a=o.length-1;s<o.length;a=s++){let[l,c]=o[s],[u,d]=o[a];c>r!=d>r&&t<(u-l)*(r-c)/(d-c)+l&&(i=!i)}return i},Eb=n=>{let e=n.geometry.coordinates[0],t=0,r=0;for(let o=0;o<e.length-1;o++)t+=e[o][0],r+=e[o][1];return{geometry:{coordinates:[t/(e.length-1),r/(e.length-1)]}}},wb=n=>{let e=Mb(n),t=Number.isFinite(e)?Math.max(e,1):1;return Math.sqrt(t)*1e-6},Ms=n=>{try{let t=Eb(n).geometry.coordinates;if(!Cb(t,n)){let o=(0,Cp.default)(n.geometry.coordinates,wb(n));return dt([o[0],o[1]])}return dt(t)}catch{return Cr(new Error("Unable to calculate center of polygon"))}};function Ll(n){return n?.geometry?.type==="Polygon"}function wp(n,{geometryMaps:e,nodesByGeometryId:t,nodesById:r}){let o=Ib(n.defaultStyle),i={},s={},a={},l={};for(let u of eo(n.geometry)){let d=n.geometry[u];if(!d)continue;let h=[],g=[],b=[],M=[];for(let m of d.features){let p=m.properties.id,y=o.has(p),v=t.get(p)??[];for(let x of e.space.get(p)?.features??[])h.push(Ep(x,v));for(let x of e.obstruction.get(p)?.features??[])if(g.push(Tb(x,y)),e.object.has(p)){let S=t.get(p)??[],w=S.map(D=>r.get(D)).filter(D=>D!=null);for(let D of w){let C=Ep({type:"Feature",geometry:D.geometry,properties:{id:lp(D.properties.id),kind:"desk-entrance",details:{externalId:vs(p)}}},S);h.push(C)}}for(let x of e.area.get(p)?.features??[])b.push(Db(x,v));for(let x of e.window.get(p)?.features??[])M.push(Pb(x))}h.length>0&&(i[u]={type:"FeatureCollection",features:h.filter(m=>m!==null)}),g.length>0&&(s[u]={type:"FeatureCollection",features:g.filter(m=>m!==null)}),b.length>0&&(a[u]={type:"FeatureCollection",features:b.filter(m=>m!==null)}),M.length>0&&(l[u]={type:"FeatureCollection",features:M.filter(m=>m!==null)})}let c={space:i,obstruction:s};return Object.keys(a).length>0&&(c.area=a),Object.keys(l).length>0&&(c.window=l),c}function Ep(n,e){switch(n.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":return null}let t={type:"Feature",geometry:n.geometry,properties:{destinationNodes:e,id:n.properties.id,externalId:n.properties.details?.externalId??"",kind:n.properties.kind}};return n.properties.details&&(t.properties.details={name:n.properties.details.name,description:n.properties.details.description,images:n.properties.details.icon?[{url:n.properties.details.icon,altText:n.properties.details.name?`${n.properties.details.name} icon`:"icon"}]:void 0}),Ll(t)&&(t.properties.center=Ms(t).unwrapOr(void 0)),t}function Tb(n,e){switch(n.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"Point":return null}let t=n.properties,r={type:"Feature",geometry:n.geometry,properties:{id:t.id,externalId:t.details?.externalId??"",entrances:[],kind:t.kind,footprintComponent:e}};return Ll(r)&&(r.properties.center=Ms(r).unwrapOr(void 0)),t.details&&(r.properties.details={name:t.details.name,description:t.details.description,images:t.details.icon?[{url:t.details.icon,altText:t.details.name?`${t.details.name} icon`:"icon"}]:void 0}),r}function Db(n,e){if(n.geometry.type!=="Polygon")return null;let t=n.properties,r={type:"Feature",geometry:n.geometry,properties:{id:t.id,externalId:t.details?.externalId??"",destinationNodes:e}};return Ll(r)&&(r.properties.center=Ms(r).unwrapOr(void 0)),t.details&&(r.properties.details={name:t.details.name,description:t.details.description,images:t.details.icon?[{url:t.details.icon,altText:t.details.name?`${t.details.name} icon`:"icon"}]:void 0}),r}function Pb(n){return n.geometry.type!=="LineString"?null:{type:"Feature",geometry:n.geometry,properties:{id:n.properties.id}}}function Ib(n){return new Set((n?.ExteriorWalls?.geometryAnchors??[]).map(t=>t.geometryId))}f();function Tp(n,{geometryMaps:e,geometryFeatureById:t}){if(!n.locationCategories&&!n.locations)return{};let r={};if(n.locationCategories?.length){let o=[];for(let i of n.locationCategories){let s={id:i.id,name:i.details.name,icon:i.details.icon??""};i.parent&&(s.parent=i.parent),o.push(s)}r["category.json"]=o}if(n.locations?.length){let o=Ob(n,{geometryFeatureById:t}),i=[];for(let s of n.locations){let a={id:s.id,name:s.details.name,categories:s.categories,spaces:[],obstructions:[],areas:[],annotations:[],connections:[],entrances:[],links:s.links,openingHoursSpecification:s.openingHours??[],pictures:s.images,social:s.social,description:s.details.description,externalId:s.details.externalId,icon:s.details.icon,logo:s.logo,phone:s.phone,website:s.website,searchTags:s.searchTags};i.push(a);for(let{geometryId:l,floorId:c}of s.geometryAnchors)a.spaces.push(...e.space.get(l)?.ids.map(u=>({id:u,floor:c}))??[]),a.obstructions.push(...e.obstruction.get(l)?.ids.map(u=>({id:u,floor:c}))??[]),a.areas.push(...e.area.get(l)?.ids.map(u=>({id:u,floor:c}))??[]),a.entrances.push(...o.entrancesByGeometryId.get(l)??[]),a.connections.push(...o.connectionsByGeometryId.get(l)??[]),a.annotations.push(...o.annotationsByGeometryId.get(l)??[])}r["location.json"]=i}return r}function Ob(n,{geometryFeatureById:e}){let t={annotationsByGeometryId:new Map,connectionsByGeometryId:new Map,entrancesByGeometryId:new Map};if(n.annotations)for(let[r,o]of ge(n.annotations))for(let i of o??[]){let s=i.geometryId,a=i.id,l=t.annotationsByGeometryId.get(s)??[];l.push({floor:r,id:a}),t.annotationsByGeometryId.set(s,l)}if(n.connections)for(let r of n.connections){let o=Dl(r,e),i=Array.from(new Map([...r.entrances,...r.exits].map(s=>[`${s.geometryId}_${s.floorId}`,s])).values());for(let s of i){let a=s.geometryId;if(o){let l=t.entrancesByGeometryId.get(a)??[];l.push({floor:s.floorId,id:r.id}),t.entrancesByGeometryId.set(a,l)}else{let l=t.connectionsByGeometryId.get(a)??[];l.push(r.id),t.connectionsByGeometryId.set(a,l)}}}return t}f();function Dp(n,e){let t={features:[],type:"FeatureCollection"},r={"manifest.geojson":t},o=n.manifest;if(o.features.length>0){let i=o.features[0],s=i.properties,a=s.details!=null?{...s.details.externalId!=null&&{externalId:s.details.externalId}}:void 0,l={type:"Feature",geometry:i.geometry,properties:{folder_struct:[],version:"2.0.0",time:s.time,name:s.name,naturalBearing:s.naturalBearing,tzid:s.tzid,map:s.mapId,org_id:s.orgId,language:s.language,...a!=null&&Object.keys(a).length>0&&{details:a}}};t.features.push(l)}return r}f();function Pp(n,{geometryMaps:e,navigationFlags:t,incomingEdgesByNodeId:r}){let o={"node.geojson":{type:"FeatureCollection",features:[]}},i=o["node.geojson"].features,s=Lb(n),a=Ab(n),l=Rb(n,a,s);for(let[c,u]of ge(n.nodes??{}))for(let d of u?.features??[]){let h=e.space.get(d.properties.geometryIds[0])?.features[0],g=h?.geometry.type==="Point"&&h?.properties.details?.externalId?h.properties.details.externalId:"",b=r.get(d.properties.id)??[],M=Object.keys(t??{}),m=[];for(let y of b)for(let v of M)Er(y,t[v])&&m.push(t[v]);let p={type:"Feature",geometry:d.geometry,properties:{id:d.properties.id,floor:c,space:d.properties.geometryIds.map(y=>e.space.get(y)?.ids).flat().filter(y=>y!==void 0),neighbors:[...d.properties.neighbors.map(y=>({id:y.id,weight:y.extraCost})),...l.get(d.properties.id)??[]],map:c,externalId:g,flags:m.length>0?_b(m):void 0}};i.push(p)}return o}function Lb(n){let e=new Map;for(let t of n.floors?.features??[])e.set(t.properties.id,t.properties.elevation);return e}function Ab(n){let e=new Map;for(let t of Object.values(n.nodes??{}))for(let r of t?.features??[])if(r.properties.geometryIds.length!==0)for(let o of r.properties.geometryIds){let i=e.get(o)??[];i.includes(r.properties.id)||(i.push(r.properties.id),e.set(o,i))}return e}function Rb(n,e,t){let r=new Map;for(let o of n.connections??[]){let i=o.exits.map(s=>({...s,nodes:e.get(s.geometryId)??[]}));for(let s of o.entrances){let a=e.get(s.geometryId)??[];for(let l of a)for(let c of i){let u=Math.abs((t.get(s.floorId)??0)-(t.get(c.floorId)??0))*o.floorCostMultiplier,d=r.get(l)??[];d.push(...c.nodes.filter(h=>h!==l).map(h=>({id:h,weight:u+o.entryCost}))),r.set(l,d)}}}return r}function _b(n){if(n==null||n.length===0)return;let e=new Array(Math.max(...n.map(t=>t.index))+1).fill(0);for(let t of n)e[t.index]|=1<<t.bit;return e}f();function Fb(n,e){let t={};for(let r of n){let o=e.get(r);o&&(t[o]??=[],t[o].push(r))}return t}function Ip(n,{geometryMaps:e}){if(!n.defaultStyle)return{};let t={},r={};t["styles.json"]=r;let o=[...Array.from(e.space.values()).map(s=>s.features),...Array.from(e.obstruction.values()).map(s=>s.features)],i=new Map(o.flatMap(s=>s.map(a=>[a.properties.id,a.geometry.type])));for(let[s,a]of ge(n.defaultStyle)){let l=Fb(a.geometryAnchors.flatMap(c=>[...e.space.get(c.geometryId)?.ids??[],...e.obstruction.get(c.geometryId)?.ids??[]]),i);if(l.Point&&l.Point.length>0){let c={points:Array.from(l.Point.values()),showImage:a.extra?.showImage!==void 0?a.extra?.showImage===!0:a.opacity!==0};r[`${s}.Point`]=c}if(l.LineString&&l.LineString.length>0){let c={lineStrings:Array.from(l.LineString.values()),altitude:a.altitude,color:a.color,height:a.height,opacity:a.opacity,width:a.buffer};a.topColor!==void 0&&(c.topColor=a.topColor),r[`${s}.LineString`]=c}if(l.Polygon&&l.Polygon.length>0){let c={polygons:Array.from(l.Polygon.values()),altitude:a.altitude,color:a.color,height:a.height,opacity:a.opacity};a.extra?.showImage!==void 0&&(c.showImage=a.extra.showImage===!0),a.topColor!==void 0&&(c.topColor=a.topColor),r[`${s}.Polygon`]=c}}return t}function Op(n){let e=dp(n),t=yp(n,e),r=wp(n,e),o=Pp(n,e),i=pp(n,e),s=Ip(n,e),a=vp(n,e),l=bp(n,e),c=gp(n,e),u=hp(n,e),d=Tp(n,e),h=fp(n,e),g=Dp(n,e);return{...n.tileset?{"tileset.json":n.tileset}:{},...n.navigationFlags?{"navigationFlags.json":n.navigationFlags}:{},...n.annotationSymbols?{"annotation-symbols.json":n.annotationSymbols}:{},...t,...r,...o,...i,...s,...a,...l,...c,...u,...d,...h,...g}}var ae=n=>JSON.parse(wl(n)),Nb=/^geometry\/(.+)\.geojson$/,Bb=/^nodes\/(.+)\.(geo)?json$/,Gb=/^floorImages\/(.+)\.geojson$/,kb=/^facade\/(.+)\.json$/,zb=/^walkable\/(.+)\.json$/,Ub=/^nonwalkable\/(.+)\.json$/,Hb=/^kinds\/(.+)\.json$/,Wb=/^annotations\/(.+)\.json$/,Vb=/^cms\/(?:([^/]+)\/)?([^/]+)\.(?:json|geojson)$/,jb=[(n,e)=>n==="manifest.geojson"?{manifest:ae(e)}:void 0,(n,e)=>n==="floors.geojson"?{floors:ae(e)}:void 0,(n,e)=>{let t=n.match(Nb);return t?{geometry:{[t[1]]:ae(e)}}:void 0},(n,e)=>n==="connections.json"?{connections:ae(e)}:void 0,(n,e)=>n==="navigationFlags.json"?{navigationFlags:ae(e)}:void 0,(n,e)=>{let t=n.match(Bb);return t?{nodes:{[t[1]]:ae(e)}}:void 0},(n,e)=>n==="default-style.json"?{defaultStyle:ae(e)}:void 0,(n,e)=>n==="floor-stacks.json"?{floorStacks:ae(e)}:void 0,(n,e)=>n==="outdoors.json"?{outdoors:ae(e)}:void 0,(n,e)=>n==="tileset.json"?{tileset:ae(e)}:void 0,(n,e)=>{let t=n.match(Gb);return t?{floorImages:{[t[1]]:ae(e)}}:void 0},(n,e)=>{let t=n.match(kb);return t?{facade:{[t[1]]:ae(e)}}:void 0},(n,e)=>{let t=n.match(zb);return t?{walkable:{[t[1]]:ae(e)}}:void 0},(n,e)=>{let t=n.match(Ub);return t?{nonwalkable:{[t[1]]:ae(e)}}:void 0},(n,e)=>{let t=n.match(Hb);return t?{kinds:{[t[1]]:ae(e)}}:void 0},(n,e)=>n==="annotation-symbols.json"?{annotationSymbols:ae(e)}:void 0,(n,e)=>{let t=n.match(Wb);return t?{annotations:{[t[1]]:ae(e)}}:void 0},(n,e)=>n==="locations.json"?{locations:ae(e)}:void 0,(n,e)=>n==="location-categories.json"?{locationCategories:ae(e)}:void 0,(n,e)=>n==="location-instances.json"?{locationInstances:ae(e)}:void 0,(n,e)=>{let t=n.match(Vb);if(!t)return;let[,r,o]=t;return r==="floorText"||r==="textures"||r==="textAreas"?{cms:{[r]:{[o]:ae(e)}}}:{cms:{[o]:ae(e)}}}],Zb=new Set(ps),Xb=new Set(ms),Yb=new Set(jn),$b=new Set(Xn),qb=new Set(Zn),Jb=new Set(Yn),Kb=new Set($n),Qb=new Set(qn),ev=new Set(Jn);function Qt(n,e){return typeof n=="string"&&e.has(n)?n:"unknown"}function tv(n){let e=n.connections;if(Array.isArray(e))for(let a of e)a&&typeof a=="object"&&"type"in a&&(a.type=Qt(a.type,Zb));let t=n.kinds;if(t&&typeof t=="object"){for(let a of Object.values(t))if(a&&typeof a=="object"){let l=a;for(let c of Object.keys(l))l[c]=Qt(l[c],Xb)}}let r=n.cms;if(!r||typeof r!="object")return;let o=r,i=o.locations;if(Array.isArray(i))for(let a of i){if(!a||typeof a!="object")continue;let l=a;if("type"in l&&(l.type=Qt(l.type,Yb)),Array.isArray(l.states))for(let c of l.states)c&&typeof c=="object"&&"type"in c&&(c.type=Qt(c.type,$b));if(Array.isArray(l.siblingGroups))for(let c of l.siblingGroups)c&&typeof c=="object"&&"type"in c&&(c.type=Qt(c.type,qb))}for(let a of["floorText","textAreas"]){let l=a==="floorText"?Jb:Kb,c=o[a];if(!(!c||typeof c!="object"))for(let u of Object.values(c)){if(!u||typeof u!="object")continue;let d=u.features;if(Array.isArray(d))for(let h of d){if(!h||typeof h!="object")continue;let g=h.properties;g&&typeof g=="object"&&"alignment"in g&&(g.alignment=Qt(g.alignment,l))}}}let s=o.textures;if(s&&typeof s=="object"){for(let a of Object.values(s))if(Array.isArray(a))for(let l of a){if(!l||typeof l!="object")continue;let c=l;"face"in c&&(c.face=Qt(c.face,Qb)),"surface"in c&&(c.surface=Qt(c.surface,ev))}}}function rv(n){let e=ip(n),t={};for(let r of Object.keys(e))for(let o of jb){let i=o(r,e[r]);if(i){t=Vn(t,i,[]);break}}return tv(t),t}function Cs(n){try{return dt(rv(n))}catch(e){return Cr(e instanceof Error?e:new Error(String(e)))}}var nv={decompressUnsafeSync:n=>Cs(n),decompressUnsafe:n=>Promise.resolve(Cs(n)),decompressSync:n=>Cs(n),decompress:n=>Promise.resolve(Cs(n))};var Es=class{groupBy;graph;geometryEdgesByMapId=new Map;flagDeclarations={};getDoorByNodeId;nonPublicNodeIds;constructor({nodes:e,geojsonCollection:t,groupBy:r="default",multiplicativeDistanceWeightScaling:o,flagDeclarations:i,getDoorByNodeId:s}){this.groupBy=r,this.graph=new ls({nodes:e,groupBy:this.groupBy,multiplicativeDistanceWeightScaling:o});let a=t?.features||[];this.flagDeclarations=i??{},this.getDoorByNodeId=s,this.nonPublicNodeIds=this.getNonPublicNodeIds(),a.forEach(l=>{let c=null;if(l.geometry.type==="LineString"?c=l.geometry.coordinates:l.geometry.type==="Polygon"&&(c=l.geometry.coordinates.flat()),c){let u=this.groupBy==="default"?this.groupBy:l.properties[this.groupBy];this.geometryEdgesByMapId.has(u)||this.geometryEdgesByMapId.set(u,[]),c.forEach((d,h)=>{this.geometryEdgesByMapId.get(u).push([d,c[h+1]||c[0]])})}})}getNonPublicNodeIds(){let e=new Set;if(ds.public in this.flagDeclarations)for(let t in this.graph.nodesById)us(this.graph.nodesById[t].properties.flags,this.flagDeclarations[ds.public].index,this.flagDeclarations[ds.public].bit)||e.add(t);return e}getDirections({zones:e,originIds:t,from:r,to:o,destinationNodeIds:i,disabledConnectionNodeIds:s,simplify:a,multiplicativeDistanceWeightScaling:l,overrideEdgeWeights:c,includeNonPublic:u}){let d=a?.enabled??!0,h=e??[],g=this.graph.aStar({originIds:t,destinationNodeIds:i,zones:h,disabledConnectionNodeIds:new Set(s),overrideEdgeWeights:c,disabledNodeIds:u?void 0:this.nonPublicNodeIds});if(g.length===0)return{type:"FeatureCollection",features:[]};if(a?.__EXPERIMENTAL_METHOD!=="greedy-los"&&r&&o&&r.length===1&&o.length===1){let b=new _e({origin:r[0],destination:g[0].origin,distance:Ee(r[0].geometry.coordinates,g[0].origin.geometry.coordinates),angle:xe(r[0].geometry.coordinates,g[0].origin.geometry.coordinates),multiplicativeDistanceWeightScaling:l}),M=g.slice(),m=new _e({origin:g[g.length-1].destination,destination:o[0],distance:Ee(g[g.length-1].destination.geometry.coordinates,o[0].geometry.coordinates),angle:xe(g[g.length-1].destination.geometry.coordinates,o[0].geometry.coordinates),multiplicativeDistanceWeightScaling:l});M.unshift(b),M.push(m),g=M}return d&&(g=this.simplifyAllSteps(g,a,l)),this.generatePath(g)}generatePath=e=>{let{destination:t}=e[e.length-1],r={type:"FeatureCollection",features:[]};for(let i=0;i<e.length;i++){let{origin:s,destination:a}=e[i],l={id:s.properties.id,angle:e[i].angle,distance:e[i].distance,destination:a.properties.id,edges:this.graph.edges[s.properties.id]};this.groupBy!=="default"&&(l.groupBy=s.properties[this.groupBy]),r.features.push({type:"Feature",geometry:{type:"Point",coordinates:[s.geometry.coordinates[0],s.geometry.coordinates[1]]},properties:l})}let o={id:t.properties.id,edges:this.graph.edges[t.properties.id]};return this.groupBy!=="default"&&(o.groupBy=t.properties[this.groupBy]),r.features.push({type:"Feature",geometry:{type:"Point",coordinates:[t.geometry.coordinates[0],t.geometry.coordinates[1]]},properties:o}),r};simplifyAllSteps(e,t={enabled:!0,__EXPERIMENTAL_METHOD:"greedy-los"},r){let o=[],i=[e[0]],s=t.__EXPERIMENTAL_METHOD??"greedy-los",a=t.radius??Hn,l=s==="dp-optimal"?this.simplifyStepsWithDPMethod.bind(this):s==="rdp"?this.simplifyStepsImprovedWithSimplifyBeforeLoSChecks.bind(this):this.simplifySteps.bind(this);for(let h=1;h<e.length;h++)if(this.groupBy!=="default"&&e[h].origin.properties[this.groupBy]!==e[h-1].origin.properties[this.groupBy]){let g=e[h-1].origin.properties[this.groupBy],b=this.geometryEdgesByMapId.get(g)??[];o.push(...l(i,b,a,r,t)),i=[e[h]]}else i.push(e[h]);let c=e[e.length-1],u=this.groupBy==="default"?this.groupBy:c.origin.properties[this.groupBy],d=this.geometryEdgesByMapId.get(u)??[];return o.push(...l(i,d,a,r,t)),o}findNearestNodesOnGraph=(e,t,r,o,i=!1,s=1/0)=>this.graph.dijkstraFindWithinTravelDistance(e,t,o,this.geometryEdgesByMapId.get(r)??[],i,s);hasLineOfSight=(e,t,r,o)=>this.graph.hasLineOfSight(e,t,this.geometryEdgesByMapId.get(r),o);simplifySteps(e,t,r,o,i){return Xh(e,t,r,this.flagDeclarations,o)}simplifyStepsImprovedWithSimplifyBeforeLoSChecks(e,t,r,o,i){if(e.length<3)return e;!1,e=jh(e,this.getDoorByNodeId,o,t);let s=i?.__EXPERIMENTAL_METHOD==="rdp"?i.mustIncludeDoorBufferNodes??!0:!0;return Zh(e,t,o,s)}simplifyStepsWithDPMethod(e,t,r,o,i){if(e.length<3)return e;let s=new Set;(i?.__EXPERIMENTAL_METHOD==="dp-optimal"?i.includeDoorBufferNodes??!1:!1)&&(s=$h(e,this.getDoorByNodeId));for(let u=0;u<e.length-1;u++){let d=e[u].origin.properties.floor,h=e[u+1].origin.properties.floor;d!==h&&(e[u].origin.properties.preventSmoothing||(e[u].origin.properties.preventSmoothing=!0,s.add(e[u].origin.properties.id)),e[u+1].origin.properties.preventSmoothing||(e[u+1].origin.properties.preventSmoothing=!0,s.add(e[u+1].origin.properties.id)))}let l=e[e.length-1];l.origin.properties.floor!==l.destination.properties.floor&&(l.origin.properties.preventSmoothing||(l.origin.properties.preventSmoothing=!0,s.add(l.origin.properties.id))),!1;let c=Uh(e,t,o,r);if(!1){let u=c[c.length-1];window.__DEBUG_PATH.finalSteps.push({nodeId:u.destination.properties.id,coordinate:u.destination.geometry.coordinates,floorId:u.destination.properties.map})}for(let u of e)s.has(u.origin.properties.id)&&delete u.origin.properties.preventSmoothing,s.has(u.destination.properties.id)&&delete u.destination.properties.preventSmoothing;return c}getDistance=(e,t)=>Ee(e,t);getAngle=(e,t)=>xe(e,t)};var Al="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",ov="https://auth.mappedin.com/oauth2/token";async function WL(n,e){let t=e?.useWorkers??!0,r={...e,watermark:e?.watermark,attribution:e?.attribution,antialias:e?.antialias,occlusionEnabled:e?.occlusionEnabled,transformImageRequest:e?.transformImageRequest,naturalBearing:e?.naturalBearing??0,imagePlacementOptions:e?.imagePlacementOptions,onWebGLContextCreationError:e?.onWebGLContextCreationError,onWebGLContextLost:e?.onWebGLContextLost,onWebGLContextRestored:e?.onWebGLContextRestored,onWebGLRendererError:e?.onWebGLRendererError,useStandaloneCamera:e?.useStandaloneCamera??!1,useCollisionWorker:e?.useCollisionWorker??!0,useWorkers:t};if(t===!0&&e?.outdoorView?.enabled){let o=e.outdoorView.headers;o==null&&(o=await Ac(ov));let i=e.center||[0,0];_s&&Cc(_s);let s=null,a=null;try{s=new Mc({container:n,style:e.outdoorView.style||Al,center:i,attributionControl:!1,zoom:e.zoomLevel??ul,pitch:e.pitch??ll,bearing:e.bearing??cl,transformRequest:Dc(o),trackResize:!1,pixelRatio:e.outdoorView.lowDpi?1:Br(),canvasContextAttributes:{antialias:typeof e.antialias=="boolean"?e.antialias:!0,powerPreference:"high-performance"},interactive:!1,validateStyle:!1,centerClampedToGround:!1,boxZoom:!1,doubleClickZoom:!1,scrollZoom:!1,dragPan:!1,dragRotate:!1,keyboard:!1,touchZoomRotate:!1}),await Pc(s,{timeout:1e4,styleUrl:e.outdoorView?.style||Al})}catch(c){if(a=c,_.warn(`[MappedinJS] Outdoor view initialization failed: ${a.message}. Falling back to indoor-only rendering.`),s){try{s.remove()}catch{}s=null}}if(!s||a){let c=new qt(n,r);return c.publish("outdoor-style-error",{error:a}),c}let l=null;try{let c=s.painter.context.gl;l=new qt(n,{center:i,zoomLevel:s.getZoom(),pitch:s.getPitch(),bearing:s.getBearing(),gl:c,map:s,mode:"outdoors-interleaved",...r}),Ro(s,l.camera.minZoomLevel,l.camera.maxZoomLevel),s.setMaxPitch(l.camera.maxPitch),s.setMinPitch(l.camera.minPitch),Gh(l,s);let u=To.fromLngLat(i,0),d=Po(u,l.viewCamera,()=>{l?.renderSync()}),h=async()=>{s&&(s.addLayer(d),l?.renderSync())};l.onMapLibreEvent("style.load",h),h();let g=!1,b=!1,M=()=>{s&&(g||(l?.publish("outdoor-view-loaded"),g=!0),b||(b=!0,l?.publish("outdoor-style-loaded")))};l.onMapLibreEvent("idle",M);let m=v=>{v&&(v.sourceDataType==="metadata"||v.sourceDataType==="visibility"||v.dataType==="style"||v.type==="terrain")&&l?.getSystems().htmlControlsSystem.updateData(s)},p=v=>{s&&v&&v.dataType==="style"&&v.type==="styledata"&&(b=!1),m(v)};l.onMapLibreEvent("styledata",p),l.onMapLibreEvent("sourcedata",m),l.onMapLibreEvent("terrain",m);let y=v=>{if(v.error?.url===Al){_.error(`Failed to load outdoor view style, possibly due to invalid token "${o["x-mappedin-tiles-key"]}"`);return}_.warn(v)};return l.onMapLibreEvent("error",y),l}catch(c){if(l)try{l.destroy()}catch{}if(s)try{s.remove()}catch{}_.warn("Failed to initialize outdoor view, falling back to indoor-only rendering:",c);let u=new qt(n,r);return u.publish("outdoor-style-error",{error:c}),u}}else return new qt(n,r)}export{Qx as a,ri as b,eS as c,Ee as d,fa as e,ni as f,Mi as g,Sr as h,Zr as i,vE as j,Vn as k,Ly as l,Op as m,nv as n,as as o,Oi as p,wt as q,Es as r,Ks as s,si as t,Ma as u,qt as v,vy as w,dl as x,WL as y};
|
|
968
|
+
`,document.body.appendChild(this.element)}getActualInstanceCount(e){for(let t of e.mesh.children)if(t.isInstancedMesh)return t.count;return e.count}update(e,t,r){if(!this.enabled||!this.element)return;let o='<div style="margin-bottom: 5px; font-weight: bold; border-bottom: 1px solid #666; padding-bottom: 5px;">Model Batches</div>';if(e.size===0)o+='<div style="color: #888;">No models loaded</div>';else{let i=0,s=0,a=Array.from(e.keys()).sort((l,c)=>{let u=t.get(l)??"",d=t.get(c)??"";return u.localeCompare(d)});for(let l of a){let c=e.get(l);if(!c||c.size===0)continue;let u=t.get(l)??`unknown_${l}`,d=0;for(let g of c)d+=this.getActualInstanceCount(g);i+=c.size,s+=d,o+='<div style="margin: 6px 0 2px 0;">',o+=`<span style="color: #4fc3f7; font-weight: bold;">"${u}"</span>`,o+=`<span style="color: #aaa;"> (${d} total, ${c.size} batch${c.size!==1?"es":""})</span>`,o+="</div>";let h=Array.from(c).sort((g,b)=>g.id.localeCompare(b.id));for(let g of h){let b=this.getActualInstanceCount(g),M=g.count,m=b!==M,p=g.opacity===1?"":` @${(g.opacity*100).toFixed(0)}%`;o+='<div style="margin-left: 12px; color: #ccc; font-size: 11px;">',o+=`<span style="color: #81c784;">${g.id}</span>`,m?o+=`<span style="color: #e57373;">: ${b} actual / ${M} tracked</span>`:o+=`<span style="color: #fff;">: ${b} instance${b!==1?"s":""}</span>`,p&&(o+=`<span style="color: #ffb74d;">${p}</span>`),o+="</div>"}}o+='<div style="margin-top: 8px; padding-top: 5px; border-top: 1px solid #666; color: #fff;">',o+=`Total: <span style="color: #81c784;">${s} instance${s!==1?"s":""}</span>`,o+=`, <span style="color: #e57373;">${i} draw call${i!==1?"s":""}</span>`,o+="</div>"}if(r.size>0){o+='<div style="margin-top: 8px; border-top: 1px solid #666; padding-top: 5px;">',o+='<div style="margin-bottom: 5px; font-weight: bold; color: #ff9800;">Non-instanced Models</div>',o+=`<span style="color: #aaa;">(${r.size} total, ${r.size} draw call${r.size!==1?"s":""})</span>`;let i=new Map;for(let[s,a]of r){let l=i.get(a.urlHash)??[];l.push(s),i.set(a.urlHash,l)}for(let[s,a]of i){let l=t.get(s)??`unknown_${s}`;o+='<div style="margin: 6px 0 2px 0;">',o+=`<span style="color: #ff9800;">"${l}"</span>`,o+=`<span style="color: #aaa;"> (${a.length} model${a.length!==1?"s":""})</span>`,o+="</div>";for(let c of a)o+=`<div style="margin-left: 12px; color: #ccc; font-size: 11px;">${c}</div>`}o+="</div>"}this.element.innerHTML=o}destroy(){this.element&&(this.element.remove(),this.element=null)}};var Kr=100,fy=!0,os=class extends Z{transparencyChanged=!1;state;convertTo3DMapPosition;loader;loadPromises=[];gltfCache=new Map;gltfLoadPromises=new Map;instanceMap=new Map;debugUI;modelNames=new Map;batchCounter=0;batchByMesh=new Map;batchesByUrlHash=new Map;nonInstancedModels=new Map;pendingOpacityChanges=new Map;detachedEntityIds=new Set;tempMatrix=new Y;tempQuaternion=new _t;tempEuler=new xt;tempScale=new O;tempColor=new k;constructor(e,t){super(),this.state=e,this.convertTo3DMapPosition=t,this.debugUI=new ns}createBatch(e,t,r,o,i){this.batchCounter++;let s={id:`batch_${this.batchCounter}`,mesh:e,count:0,maxCount:i,opacity:o,urlHash:t,containerId:r};return e.userData.batchId=s.id,this.batchByMesh.set(e,s),this.batchesByUrlHash.has(t)||this.batchesByUrlHash.set(t,new Set),this.batchesByUrlHash.get(t).add(s),s}removeBatch(e){this.batchByMesh.delete(e.mesh),this.batchesByUrlHash.get(e.urlHash)?.delete(e),this.batchesByUrlHash.get(e.urlHash)?.size===0&&this.batchesByUrlHash.delete(e.urlHash)}getBatchForMesh(e){return this.batchByMesh.get(e)}updateDebugUI(){this.debugUI.update(this.batchesByUrlHash,this.modelNames,this.nonInstancedModels)}showDebug(){this.debugUI.show(),this.updateDebugUI()}hideDebug(){this.debugUI.hide()}async getGLTFLoader(){if(this.loader)return this.loader;let{GLTFLoader:e}=await import("./GLTFLoader-HBT4C4QX.js");return this.loader=new e,this.loader}async getOrLoadGLTF(e,t){let r=this.gltfCache.get(t);if(r)return r;let o=this.gltfLoadPromises.get(t);if(o)return o;let i=await this.getGLTFLoader(),s=new Promise((a,l)=>{let c=d=>{this.gltfCache.set(t,d),this.gltfLoadPromises.delete(t),a(d)},u=d=>{this.gltfLoadPromises.delete(t),l(d)};jc(e)?i.parse(Zc(e),"",c,u):Xc(e)?i.parse(Yc(e),"",c,u):i.load(e,c,void 0,u)});return this.gltfLoadPromises.set(t,s),s}createNonInstancedModel(e,t,r,o){let i=e.components[0],s=e.components[1],a=i.feature,l=t.scene.clone(!0);l.updateWorldMatrix(!0,!0);let c=new He;c.userData={nonInstanced:!0,entityId:String(e.id),type:"model"},l.traverse(m=>{let p=m;if("isMesh"in p&&p.isMesh===!0){let y=p.clone();y.geometry=p.geometry.clone(),y.geometry.applyMatrix4(p.matrixWorld),y.position.set(0,0,0),y.rotation.set(0,0,0),y.scale.set(1,1,1),Array.isArray(p.material)?y.material=p.material.map(v=>v.clone()):y.material=p.material.clone(),y.userData={entityId:String(e.id)},c.add(y)}});let{x:u,y:d}=this.convertTo3DMapPosition(a.geometry.coordinates[1],a.geometry.coordinates[0],0),h=a.geometry.coordinates[2]??0,g=(s.verticalOffset??0)+h;i.altitude=g,i.position.set(u,d,i.altitude);let b=s.scale??Ut,M=s.rotation??Ht;if(c.position.copy(i.position),c.rotation.set(U.degToRad(M[0]),U.degToRad(M[1]),U.degToRad(M[2])),c.scale.set(b[0],b[1],b[2]),s.color&&ol(c,s.color),s.opacity!=null&&s.opacity!==1&&il(c,s.opacity),s.visibleThroughGeometry&&Fh(c,!0),!s.EXPERIMENTAL_clippingEnabled){let m=s.opacity??1;$t(c,m)}r.add(c),i.mesh=c,i.instanceIndex=-1,Un(e),this.nonInstancedModels.set(e.id,{urlHash:o,mesh:c}),this.updateDebugUI()}resizeInstanceContainer(e,t){let r=_h(e.maxCount),o=qr(t,r),i=e.object.children,s=o.children;for(let l=0;l<i.length;l++){let c=i[l],u=s[l];if(!(!(c instanceof K)||!(u instanceof K))){for(let d=0;d<e.count;d++)c.getMatrixAt(d,this.tempMatrix),u.setMatrixAt(d,this.tempMatrix),u.userData.entities[d]=c.userData.entities[d],c.instanceColor&&(c.getColorAt(d,this.tempColor),u.setColorAt(d,this.tempColor));u.count=e.count,u.instanceMatrix.needsUpdate=!0}}let a=e.object.parent;return a&&(a.remove(e.object),a.add(o)),e.object=o,e.maxCount=r,e}getOrCreateInstanceContainer(e,t,r){let o=this.instanceMap.get(e);o||(o=new Map,this.instanceMap.set(e,o));let i=o.get(t);if(i){let s=this.getBatchForMesh(i.object);s&&(i.count=s.count)}else{let s=qr(r,Kr);i={object:s,count:0,maxCount:Kr},o.set(t,i);let a=this.createBatch(s,t,e,1,Kr);i.batch=a}return i}createModelFromFeature(e,t,r){let o=new yr(t),i={...r};t.properties.verticalOffset!=null&&(i.verticalOffset=t.properties.verticalOffset),t.properties.rotation!=null&&(i.rotation=t.properties.rotation),t.properties.scale!=null&&(i.scale=t.properties.scale);let s=new _o(i);o.instancingDisabled=s.visibleThroughGeometry===!0||s.EXPERIMENTAL_clippingEnabled===!0;let a=new $(o,s);return a.id=e,s.EXPERIMENTAL_clippingEnabled&&(a.components[7]=new No),a}async populateModelGroup(e,t,r){let o=on(t),i=this.getOrLoadGLTF(t,o).then(l=>{let c=r.parent;if(!(c instanceof ie))return;let u=c.userData.entityId,d=this.getOrCreateInstanceContainer(u,o,l);d.count+e.size>d.maxCount&&(d=this.resizeInstanceContainer(d,l)),d.object.parent||r.add(d.object);let g=new Y,b=new xt,M=new _t,m=new O,p,y,v;for(let x of e.values()){if(v=this.state.geometry3DMap.get(x),!v||v?.type!=="model")continue;let S=v.components[0],w=v.components[1];if(S.instanceIndex!=null&&S.instanceIndex>=0||S.instancingDisabled&&S.mesh)continue;if(y=S.feature,S.instancingDisabled){this.createNonInstancedModel(v,l,r,o);continue}let D=w.opacity!=null&&w.opacity!==1;if(D){let P=w.opacity??1,I=Math.round(P*100),L,N,z=this.batchesByUrlHash.get(o);if(z){for(let H of z)if(H.containerId===c.userData.entityId&&Math.round(H.opacity*100)===I&&H.count<H.maxCount){L=H,N=H.mesh;break}}if(!L||!N){let H=qr(l,Kr);H.userData.detached=!0,H.userData.sharedOpacity=P,r.add(H),L=this.createBatch(H,o,c.userData.entityId,P,Kr),N=H,Jr(H,P),$t(H,P)}let j=L.count;S.mesh=N,S.instanceIndex=j,L.count++,this.detachedEntityIds.add(v.id)}else S.mesh=d.object,S.instanceIndex=d.count;Un(v),w.dirty=!1,p=this.convertTo3DMapPosition(y.geometry.coordinates[1],y.geometry.coordinates[0],0),S.position.set(p.x,p.y,S.altitude),kn(b,w.rotation),zn(m,w.scale),M.setFromEuler(b),g.compose(S.position,M,m);let C=S.mesh,T=S.instanceIndex;for(let P of C.children)P instanceof K&&(P.setMatrixAt(T,g),P.userData.entities[T]=v.id,P.count=T+1,P.instanceMatrix.needsUpdate=!0);if(rs(C,T,w.color,w.material),!D){d.count++;let P=this.getBatchForMesh(d.object);P&&(P.count=d.count)}es(S.mesh)}this.publish("model-loaded")});this.loadPromises.push(i);let s=r.parent?.userData?.entityId;return this.instanceMap.get(s)?.get(o)?.object??new He}update(){for(let t of this.state.geometryGroupIdsToLoad.values()){let r=this.state.geometry3DMap.get(t);r instanceof Ce&&r.userData.dirty&&r.userData.modelURL&&(this.populateModelGroup(r.userData.entities3D,r.userData.modelURL,r),r.userData.dirty=!1,r.userData.localCenter=void 0)}this.updateModelStyles(),this.rebatchDetachedInstances(),this.flushPendingOpacityChanges(),this.updateDebugUI();let e=this.loadPromises;return this.loadPromises=[],Promise.all(e)}rebatchDetachedInstances(){if(!fy||this.detachedEntityIds.size===0)return;let e=new Map;for(let t of this.detachedEntityIds){let r=this.state.geometry3DMap.get(t);if(!r||r.type!=="model")continue;let o=r.components[0],i=r.components[1],s=o.mesh?.userData;if(!o.mesh?.parent)continue;let a=i.opacity??1,l=s?.sharedOpacity;if(Math.round(a*100)===100&&l!==void 0){this.pendingOpacityChanges.set(r.id,{entity:r,targetOpacity:a});continue}if(l!==void 0&&Math.abs(a-l)<=.01)continue;if(l!==void 0&&Math.abs(a-l)>.01){this.pendingOpacityChanges.set(r.id,{entity:r,targetOpacity:a});continue}let u=o.mesh.parent;if(!(u instanceof Ce))continue;let d=u.userData.modelURL;if(!d)continue;let h=on(d),g=i.opacity??1,b=Math.round(g*100);e.has(h)||e.set(h,new Map);let M=e.get(h);M.has(b)||M.set(b,[]),M.get(b).push(r)}for(let[t,r]of e.entries()){let o=this.gltfCache.get(t);if(o)for(let[i,s]of r.entries()){if(s.length<2)continue;let a=i/100;this.createSharedBatchForDetached(s,o,a,t)}}this.publish("batch-changed")}createSharedBatchForDetached(e,t,r,o){if(e.length<2)return;let s=e[0].components[0].mesh?.parent;if(!s)return;let a=s.parent,l=a instanceof ie?a.userData.entityId:"unknown",c=qr(t,e.length);c.userData.detached=!0,c.userData.sharedOpacity=r,s.add(c);let u=this.createBatch(c,o,l,r,e.length);Jr(c,r),$t(c,r);let d=new Y,h=new xt,g=new _t,b=new O,M,m,p=0;for(let y of e){let v=y.components[0],x=y.components[1],S=v.mesh;if(S){let w=this.getBatchForMesh(S);w&&this.removeBatch(w),ts(S)}v.mesh=c,v.instanceIndex=p,m=v.feature,M=this.convertTo3DMapPosition(m.geometry.coordinates[1],m.geometry.coordinates[0],0),v.position.set(M.x,M.y,v.altitude),kn(h,x.rotation),zn(b,x.scale),x.visible===!1&&b.set(0,0,0),g.setFromEuler(h),d.compose(v.position,g,b);for(let w of c.children)w instanceof K&&(w.setMatrixAt(p,d),w.userData.entities[p]=y.id,w.count=p+1,w.instanceMatrix.needsUpdate=!0);rs(c,p,x.color,x.material),p++}u.count=p,es(c)}removeInstanceFromBatch(e,t,r){let o=e.count-1,i=e.opacity===1&&t.userData?.detached!==!0;if(e.count===1){if(i){e.count=0;for(let u of t.children)u instanceof K&&(u.count=0,u.instanceMatrix.needsUpdate=!0);let c=this.instanceMap.get(e.containerId)?.get(e.urlHash);c&&c.object===e.mesh&&(c.count=0),this.updateDebugUI();return}this.removeBatch(e),ts(t),this.updateDebugUI();return}for(let l of t.children)if(l instanceof K){if(r!==o){l.getMatrixAt(o,this.tempMatrix),l.getColorAt(o,this.tempColor),l.setMatrixAt(r,this.tempMatrix),l.setColorAt(r,this.tempColor);let c=l.userData.entities[o];if(c){l.userData.entities[r]=c;let u=this.state.geometry3DMap.get(c);u&&(u.components[0].instanceIndex=r)}}delete l.userData.entities[o],l.count=o,l.instanceMatrix.needsUpdate=!0,l.instanceColor&&(l.instanceColor.needsUpdate=!0)}e.count=o;let a=this.instanceMap.get(e.containerId)?.get(e.urlHash);a&&a.object===e.mesh&&(a.count=o),this.updateDebugUI()}updateModelStyles(){for(let e of this.state.geometry3DsInScene){if(e?.type!=="model")continue;let t=e.components[1],r=e.components[0];if(!t.dirty&&!r.positionDirty)continue;if(r.instancingDisabled){this.updateNonInstancedModelStyle(e),t.dirty=!1,r.positionDirty=!1;continue}let o=r.mesh?.userData,i=o?.detached,s=t.opacity!=null&&t.opacity!==1,a=t.opacity??1,l=o?.sharedOpacity,c=l!==void 0&&Math.abs(a-l)>.01;if((s&&!i&&r.mesh||c)&&this.pendingOpacityChanges.set(e.id,{entity:e,targetOpacity:a}),Un(e),this.updateInstanceTransform(e),this.updateInstanceColor(e,t.color,t.material),r.mesh?.userData?.detached&&r.mesh){let d=t.opacity??1;Jr(r.mesh,d),$t(r.mesh,d)&&(this.transparencyChanged=!0)}t.dirty=!1,r.positionDirty=!1}}flushPendingOpacityChanges(){if(this.pendingOpacityChanges.size===0)return;let e=new Map,t=new Map,r=(o,i,s,a,l,c)=>{let u=Math.round(i*100),d=`${s}_${a}_${u}`,h=t.get(d);h||(h={entities:[],targetOpacity:i,urlHash:s,containerId:a,gltf:l,parent:c},t.set(d,h)),h.entities.push(o)};for(let{entity:o,targetOpacity:i}of this.pendingOpacityChanges.values()){let s=o.components[0];if(!s.mesh||s.instanceIndex==null)continue;let a=s.mesh,l=this.getBatchForMesh(a),c=a.parent;if(!(c instanceof Ce))continue;let u=c.userData.modelURL;if(!u)continue;let d=on(u),h=this.gltfCache.get(d);if(!h)continue;let g=c.parent,b=g instanceof ie?g.userData.entityId:"unknown";if(l){let M=e.get(l);M||(M={entities:[],targetOpacity:i},e.set(l,M)),Math.round(M.targetOpacity*100)===Math.round(i*100)?M.entities.push(o):r(o,i,d,b,h,c)}else r(o,i,d,b,h,c)}for(let[o,i]of e){let{entities:s,targetOpacity:a}=i,l=o.mesh.userData?.detached===!0,c=Math.round(a*100)===100;if(s.length===o.count&&l&&!c)o.opacity=a,o.mesh.userData.sharedOpacity=a,Jr(o.mesh,a),$t(o.mesh,a)&&(this.transparencyChanged=!0);else{let h=s[0]?.components[0]?.mesh?.parent;if(h instanceof Ce){let g=h.userData.modelURL;if(g){let b=on(g),M=this.gltfCache.get(b),m=h.parent,p=m instanceof ie?m.userData.entityId:"unknown";if(M)for(let y of s)r(y,a,b,p,M,h)}}}}for(let o of t.values()){let{entities:i,targetOpacity:s,urlHash:a,containerId:l,gltf:c,parent:u}=o,d=Math.round(s*100);for(let p of i){let y=p.components[0],v=y.mesh,x=this.getBatchForMesh(v),S=y.instanceIndex;x&&S!=null&&S>=0&&this.removeInstanceFromBatch(x,v,S)}let h,g,b=this.batchesByUrlHash.get(a);if(b){for(let p of b)if(p.containerId===l&&Math.round(p.opacity*100)===d&&p.count+i.length<=p.maxCount){h=p,g=p.mesh;break}}if(!h||!g){let p=Math.max(Kr,i.length),y=qr(c,p);y.userData.detached=!0,y.userData.sharedOpacity=s,u.add(y),h=this.createBatch(y,a,l,s,p),g=y,Jr(y,s),$t(y,s)&&(this.transparencyChanged=!0)}let M,m;for(let p of i){let y=p.components[0],v=p.components[1],x=h.count;y.mesh=g,y.instanceIndex=x,m=y.feature,M=this.convertTo3DMapPosition(m.geometry.coordinates[1],m.geometry.coordinates[0],0),y.position.set(M.x,M.y,y.altitude),kn(this.tempEuler,v.rotation),zn(this.tempScale,v.scale),v.visible===!1&&this.tempScale.set(0,0,0),this.tempQuaternion.setFromEuler(this.tempEuler),this.tempMatrix.compose(y.position,this.tempQuaternion,this.tempScale);for(let S of g.children)S instanceof K&&(S.setMatrixAt(x,this.tempMatrix),S.userData.entities[x]=p.id,S.count=x+1,S.instanceMatrix.needsUpdate=!0);this.updateInstanceColor(p,v.color,v.material),h.count++,g.userData.detached?this.detachedEntityIds.add(p.id):this.detachedEntityIds.delete(p.id)}es(g),this.publish("batch-changed")}this.pendingOpacityChanges.clear(),this.updateDebugUI()}updateInstanceTransform(e){let t=e.components[0],r=e.components[1];if(!t.mesh)return;let o=t.feature,{x:i,y:s}=this.convertTo3DMapPosition(o.geometry.coordinates[1],o.geometry.coordinates[0],0);if(t.position.set(i,s,t.altitude),kn(this.tempEuler,r.rotation),r.visible===!1?this.tempScale.set(0,0,0):zn(this.tempScale,r.scale),t.instancingDisabled){t.mesh.position.copy(t.position),t.mesh.rotation.set(this.tempEuler.x,this.tempEuler.y,this.tempEuler.z),t.mesh.scale.copy(this.tempScale);return}if(!(t.instanceIndex==null||t.instanceIndex<0)){this.tempQuaternion.setFromEuler(this.tempEuler),this.tempMatrix.compose(t.position,this.tempQuaternion,this.tempScale);for(let a of t.mesh.children)a instanceof K&&(a.setMatrixAt(t.instanceIndex,this.tempMatrix),a.instanceMatrix.needsUpdate=!0)}}updateNonInstancedModelStyle(e){let t=e.components[0],r=e.components[1];if(!t.mesh)return;Un(e),this.updateInstanceTransform(e);let o=r.opacity??1;il(t.mesh,o,r.visibleThroughGeometry),r.EXPERIMENTAL_clippingEnabled||$t(t.mesh,o)&&(this.transparencyChanged=!0),r.color&&ol(t.mesh,r.color)}updateInstanceColor(e,t,r){let o=e.components[0];!o.mesh||o.instanceIndex==null||o.instanceIndex<0||rs(o.mesh,o.instanceIndex,t,r)}removeInstance(e){let t=e.components[0];if(this.detachedEntityIds.delete(e.id),this.nonInstancedModels.has(e.id)){let c=this.nonInstancedModels.get(e.id);return c?.mesh&&(sl(c.mesh),c.mesh.parent?.remove(c.mesh)),this.nonInstancedModels.delete(e.id),t.mesh=null,this.updateDebugUI(),!0}if(!t.mesh||t.instanceIndex==null||t.instanceIndex<0)return!0;let r=this.getBatchForMesh(t.mesh);if(!r)return!0;let o=t.instanceIndex,i=r.count-1,s=r.opacity===1&&t.mesh.userData?.detached!==!0;if(r.count===1){if(s){r.count=0;for(let b of t.mesh.children)b instanceof K&&(b.count=0,b.instanceMatrix.needsUpdate=!0);let g=this.instanceMap.get(r.containerId)?.get(r.urlHash);return g&&g.object===r.mesh&&(g.count=0),t.mesh.parent&&t.mesh.parent.remove(t.mesh),t.mesh=null,this.updateDebugUI(),!1}let c=r.urlHash;this.removeBatch(r);let u=this.batchesByUrlHash.get(c),d=!1;if(u){for(let h of u)if(h.count>0){d=!0;break}}return ts(t.mesh),t.mesh=null,this.updateDebugUI(),!d}for(let c of t.mesh.children)if(c instanceof K){if(o!==i){c.getMatrixAt(i,this.tempMatrix),c.getColorAt(i,this.tempColor),c.setMatrixAt(o,this.tempMatrix),c.setColorAt(o,this.tempColor);let u=c.userData.entities[i];if(u){c.userData.entities[o]=u;let d=this.state.geometry3DMap.get(u);d?d.components[0].instanceIndex=o:_.warn("[removeInstance] Could not find lastEntity in geometry3DMap:",u)}}delete c.userData.entities[i],c.count=i,c.instanceMatrix.needsUpdate=!0,c.instanceColor&&(c.instanceColor.needsUpdate=!0)}r.count=i;let l=this.instanceMap.get(r.containerId)?.get(r.urlHash);return l&&l.object===r.mesh&&(l.count=i),t.mesh=null,this.updateDebugUI(),!1}destroy(){this.gltfCache.clear(),this.gltfLoadPromises.clear();for(let e of this.instanceMap.values())for(let t of e.values())Nh(t.object);this.instanceMap.clear(),this.modelNames.clear(),this.batchByMesh.clear(),this.batchesByUrlHash.clear(),this.batchCounter=0;for(let e of this.nonInstancedModels.values())e.mesh&&(sl(e.mesh),e.mesh.parent?.remove(e.mesh));this.nonInstancedModels.clear(),this.debugUI.destroy(),this.loadPromises=[],this.loader=void 0}endFrame=()=>{this.transparencyChanged=!1}};f();var is=class{#e;#n;#i=new O;#o=new V;constructor(e,t,r,o,i={}){this.#e=t,this.#n=new vc(e,r,this.#s(o),i)}#s(e){return(t,r,o)=>(this.#i.set(t,r,o),this.#o.set(0,0),e(this.#o,this.#i),this.#o.x===0&&this.#o.y===0?null:{x:this.#o.x,y:this.#o.y})}get pipeline(){return this.#n}get labelCanvas(){return this.#n.labelCanvas}get interactiveCollidersQTree(){return this.#n.collisionSystem.interactiveCollidersQTree}get visibleCollidersQTree(){return this.#n.collisionSystem.visibleCollidersQTree}resize(){this.#n.resize()}syncTwoDEntities(){this.#n.clearEntities();for(let e of this.#e.geometry2DsInScene)e.syncPosition(),this.#n.addEntity(e.entity2D)}update(e,t,r,o=[]){this.#l(),this.#n.update(e,t,r,o)}#l(){let e,t;for(let r of this.#e.geometry2DsInScene){t=r.components[0];let o=r.attachedTo?this.#e.geometry3DMap.get(r.attachedTo):void 0;if(o instanceof $)if(this.#e.geometry3DsInScene.has(o)){if(e=o.components[1],e.dirty||t.attachedDirty){let s=e.height,a=e.altitude;r.setAltitude(s+a)}let i=e.visible;t.visible!==i&&(t.visible=i)}else t.visible===!0&&(t.visible=!1);t.attachedDirty=!1}}markDirty(){this.#n.markDirty()}get collidersNeedRecomputing(){return this.#n.collidersNeedRecomputing}set collidersNeedRecomputing(e){this.#n.collidersNeedRecomputing=e}updateWatermark(e){this.#n.updateWatermark(e)}cancelPendingFrames(){this.#n.cancelPendingFrames()}setCollidersDirty(){this.#n.collisionSystem.collidersDirty=!0}deleteTextCacheEntry(e){delete this.#n.drawSystem.textCache[e]}showCollisionBoxes(){this.#n.showCollisionBoxes()}hideCollisionBoxes(){this.#n.hideCollisionBoxes()}destroy(){this.#n.destroy()}};var Bh=new kt;var{DEFAULT_PITCH:ll,DEFAULT_BEARING:cl,DEFAULT_ZOOM_LEVEL:ul,DEFAULT_MIN_ZOOM_LEVEL:gy,DEFAULT_MAX_ZOOM_LEVEL:yy}=rt,by=U.radToDeg(.6435011087932844),al=class extends Z{options;container;Debug;#e;#n;#i;#o;get viewCamera(){return this.#o}get cameraObject(){return this.#n}#s;#l;#a;#h;get canvasWidth(){return this.#t.canvasWidth}get canvasHeight(){return this.#t.canvasHeight}rendererDomElement;get resolutionScale(){return this.map?._getClampedPixelRatio(this.canvasWidth,this.canvasHeight)??Br()}#y(e){this.#p!=="outdoors-overlay"&&this.map?.setPixelRatio(e),this.#t.pixelRatio=this.resolutionScale}get aspect(){return this.canvasWidth/this.canvasHeight}get labelsCanvas(){return this.#r.twoDEntitySystem?.labelCanvas??null}#t;camera;#d;#r={};#b=null;map;#m=()=>{this.signal?.aborted||!this.#r?.renderSystem||(this.#r.renderSystem.twoDdirty=!0)};#c=()=>{this.signal?.aborted||!this.#r?.renderSystem||(this.#r.renderSystem.threeDdirty=!0)};#g=()=>{this.map&&(this.#t.depthRangeFor3D=this.map.painter.depthRangeFor3D)};#x=(e,t)=>{e.addEventListener("childadded",t),e.addEventListener("childremoved",t),this.onAbort(()=>{e.removeEventListener("childadded",t),e.removeEventListener("childremoved",t)})};#C(){this.#r.twoDEntitySystem.markDirty()}#p="standalone";get mode(){return this.#p}constructor(e,t={}){super();let r={geometry3DMap:new Map,geometry2DMap:new Map,geometry2DIdsInScene:new Set,geometry3DIdsInScene:new Set,geometryGroupIdsToLoad:new Set,geometry3DsInScene:new Set,geometry2DsInScene:new Set,geometryScene:new ie("__scene"),hoverColor:"#f6efff",text3dHoverColor:"white",disableUpdateStateValidation:t.disableUpdateStateValidation??!1,insetsPadding:Do,shouldMeasureCanvas:!0,pixelRatio:this.resolutionScale,canvasWidth:0,canvasHeight:0,internalTweenGroup:new As,externalTweenGroup:new As,cameraObject:new Fs,naturalBearing:0,containerOffset:[0,0],useStandaloneCamera:!1,directionalLight:new Co(16777215,.3*Math.PI),ambientLight:new lc(16777215,.741*Math.PI),renderer:void 0,threeJSScene:new St,depthRangeFor3D:[0,1],geometry2DState:{entities:new Set,entityMap:new Map,entityIds:new Set,get pixelRatio(){return r.pixelRatio}}};if(this.#t=r,this.#t.useStandaloneCamera=t.useStandaloneCamera??!1,this.#t.naturalBearing=t.naturalBearing??0,this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),!e.clientWidth||!e.clientHeight)throw new Error("[MappedinJS] Container width and height must be greater than 0");(t.mode==="outdoors-interleaved"||t.mode==="outdoors-overlay")&&t.map&&(this.#p=t.mode,this.map=t.map),this.#x(this.#t.geometryScene,()=>{this.#c(),this.#m()}),this.#t.geometry3DMap.set(this.#t.geometryScene.userData.entityId,this.#t.geometryScene),t.center&&(this.#t.center=t.center?[...t.center]:[0,0]),this.options=t,this.container=e,this.#r.htmlControlsSystem=this.#u(new hi(this.container,{outdoorEnabled:!!this.map})),this.#r.maskingSystem=this.#u(new Xi(this.#t)),this.#p!=="outdoors-overlay"&&this.#r.htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),E.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),this.#d=new Uo({antialias:typeof t.antialias=="boolean"?t.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?t.gl?.canvas:void 0,onWebGLContextCreationError:t.onWebGLContextCreationError,onWebGLContextLost:t.onWebGLContextLost,onWebGLContextRestored:b=>{t.onWebGLContextRestored?.(b),this.#m(),this.#c(),this.render()},onWebGLRendererError:t.onWebGLRendererError,backgroundColor:t.backgroundColor||"#ffffff",backgroundAlpha:t.backgroundAlpha??1}),this.#t.renderer=this.#d.renderer,this.#e=this.#t.threeJSScene,this.#e.matrixWorldAutoUpdate=!1,this.#p!=="standalone"&&this.#e.add(Fc()),this.#e.add(this.#t.geometryScene);let o=window.__THREE_DEVTOOLS__;E.env.NODE_ENV==="dev"&&typeof o<"u"&&(o.dispatchEvent(new CustomEvent("observe",{detail:this.#e})),o.dispatchEvent(new CustomEvent("observe",{detail:this.#d}))),this.#n=new Fs(by,this.aspect,50,1e5),this.#t.cameraObject=this.#n,this.#o=new ec,this.#o.matrixWorldAutoUpdate=!1,this.#n.renderOrder=999;let i=new Ge;i.add(this.#n),this.#h=new Ge,this.#h.add(i),this.#e.add(this.#h),this.#n.updateProjectionMatrix(),this.#n.updateMatrixWorld(!0),t.__EXPERIMENTAL_shadows?.enabled&&(this.#r.shadowsSystem=this.#u(new Qi(this.#t,this.#d,this.#h,t.__EXPERIMENTAL_shadows)),this.map&&this.onMapLibreEvent("render",this.#g)),this.#O=this.mode==="standalone"?this.#n:this.#o,this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:()=>0,georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=this.#d.domElement(),this.#s=new V;let s=new Ie(1e6,1e6),a=new Me({color:0,visible:!1});this.#l=new W(s,a),this.#l.name="worldPlane",this.#e.add(this.#l),t.gl?.canvas||e.appendChild(this.rendererDomElement),window.addEventListener("resize",this.#G,{capture:!1,signal:this.signal}),this.#A(),document.addEventListener("visibilitychange",this.#B,{signal:this.signal}),typeof ResizeObserver=="function"&&E.env?.NODE_ENV!=="test"&&(this.#a=new ResizeObserver(co(b=>{this.#P(b[0].contentRect.width,b[0].contentRect.height)},50)),this.#a?.observe(e),this.#a&&this.onAbort(()=>this.#a?.disconnect())),e.classList.add("mappedin-map"),e.style.isolation="isolate",this.rendererDomElement.style.width=globalThis.MappedinDebug?.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=globalThis.MappedinDebug?.TEST_IOS?"1920px":"100%",E.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),this.mode!=="outdoors-overlay"&&this.rendererDomElement.tabIndex!==void 0&&this.rendererDomElement.removeAttribute("tabindex"),Object.defineProperty(this.#t,"canvasWidth",{configurable:!0,enumerable:!0,get:()=>this.rendererDomElement.clientWidth}),Object.defineProperty(this.#t,"canvasHeight",{configurable:!0,enumerable:!0,get:()=>this.rendererDomElement.clientHeight}),this.rendererDomElement.style.touchAction="manipulation";let l=this.canvasWidth,c=this.canvasHeight;this.#r.watermarkSystem=this.#u(new li(this.#n,this.#t,t?.watermark)),this.#r.watermarkSystem.on("texture-loaded",this.render),this.#t.shouldMeasureCanvas=!0,this.#t.pixelRatio=this.resolutionScale,this.#L(Math.floor(l*this.resolutionScale),Math.floor(c*this.resolutionScale)),this.#t.directionalLight.position.set(-150,-150,350),this.#e.add(this.#t.directionalLight),this.#e.add(this.#t.ambientLight),this.#r.cameraSystem=this.#u(new Vr(this.#n,this.#e,this.#d.renderer,this.#t,{mode:this.mode,canvasHeight:c,canvasWidth:l})),globalThis.MappedinDebug?.__idleCallbackInteractionState&&(globalThis.MappedinDebug.__idleCallbackInteractionState.registerInteractionChecker(this.#r.cameraSystem.isUserInteracting),globalThis.MappedinDebug.__idleCallbackInteractionState.registerInteractionChecker(this.#r.cameraSystem.isCameraMoving)),this.#r.cameraSystem.on("user-dolly-start",this.#M,{signal:this.signal}),this.#r.cameraSystem.on("user-pan-start",this.#M,{signal:this.signal}),this.#r.cameraSystem.on("user-rotate-start",this.#M,{signal:this.signal}),this.#r.cameraSystem.on("user-zoom-start",this.#M,{signal:this.signal}),this.#r.cameraSystem.on("user-tilt-start",this.#M,{signal:this.signal}),this.#r.cameraSystem.on("user-pedestal-start",this.#M,{signal:this.signal}),this.#r.cameraSystem.on("user-dolly-end",this.#v,{signal:this.signal}),this.#r.cameraSystem.on("user-pan-end",this.#v,{signal:this.signal}),this.#r.cameraSystem.on("user-rotate-end",this.#v,{signal:this.signal}),this.#r.cameraSystem.on("user-zoom-end",this.#v,{signal:this.signal}),this.#r.cameraSystem.on("user-tilt-end",this.#v,{signal:this.signal}),this.#r.cameraSystem.on("user-pedestal-end",this.#v,{signal:this.signal}),this.#r.cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),this.#r.geometryInFocusSystem&&(this.#r.geometryInFocusSystem.cameraDirty=!0),this.render()}),this.#r.pathSystem=this.#u(new Fn(this.#t,this.convertTo3DMapPosition,this.getParentContainer,this.#r.cameraSystem.convertZoomLevelToAltitude)),this.#r.pathSystem.on("animate:path",this.render,{signal:this.signal}),this.#r.panBoundsSystem=this.#u(new di(this.#t,this.#r.cameraSystem));let u=()=>{let{panBounds:b,fov:M,convertAltitudeToZoomLevel:m}=this.#r.cameraSystem;if(this.#r.panBoundsSystem.autoMinZoomLevel){if(b.radius<=0)return;let p=Math.min(this.#t.canvasWidth/this.#t.canvasHeight,1),y=M*Math.PI/180*p,v=Math.tan(y/2),{radius:x,center:S}=this.#r.cameraSystem.panBounds,w=x/v,D=this.getThreeCamera().getWorldPosition(new O),C=S.distanceTo(D),T=Math.abs(D.z-S.z),P=w*T/C,I=m(P);_c(I,this.camera.minZoomLevel)&&this.camera.setMinZoomLevel(I)}this.publish("pan-bounds-change",this.#r.cameraSystem.panBounds)};this.#r.panBoundsSystem.on("update",u,{signal:this.signal}),this.camera=this.#u(new ai(this,this.#r,this.#t));let d=()=>{this.#r.geometryInFocusSystem&&this.#r.geometryInFocusSystem.resize(),this.render()};this.camera.on("padding-change",d,{signal:this.signal}),this.camera.setZoomLevel(t.zoomLevel??ul),this.camera.setBearing(t.bearing??cl),this.camera.setPitch(t.pitch??ll),this.camera.setMaxZoomLevel(yy),this.camera.setMinZoomLevel(gy),this.#r.twoDEntitySystem=this.#u(new is(this.container,this.#t,this.#t.geometry2DState,this.project,{workerUrl:Rs||void 0,useCollisionWorker:(t.useCollisionWorker??!0)&&(t.useWorkers??!0),transformImageRequest:t.transformImageRequest,watermark:{width:0,height:0,position:"bottom-left"}})),this.#r.interactionSystem=this.#u(new yn(this.rendererDomElement,this.#t,this.#n,this.#l,this.#r.cameraSystem.isUserInteracting)),this.#r.interactionSystem.on("doubletap-with-onefinger",b=>{this.#r.cameraSystem.enableZoom&&this.camera.animateTo({center:this.projectScreenXYToCoordinate(b.clientX,b.clientY)?.coordinate,zoomLevel:this.camera.zoomLevel+1,duration:ks,easing:"ease-out"})}),this.#r.interactionSystem.on("singletap-with-twofinger",()=>{this.#r.cameraSystem.enableZoom&&this.camera.animateTo({zoomLevel:this.camera.zoomLevel-1,duration:ks,easing:"ease-out"})}),this.#r.interactionSystem.on("hover",this.render),this.#r.interactionSystem.on("click",b=>{if(b.entity2D.some(m=>m.id==="watermark")&&typeof this.#r.watermarkSystem.options.onClick=="function"&&this.#r.watermarkSystem.options.interactive){this.#r.watermarkSystem.options.onClick();return}if(!b.position){_.error("Pointer event outside world-plane");return}this.publish("click",{...this.#D(b,b.position),pointerEvent:b.pointerEvent})}),this.#r.interactionSystem.on("hover",b=>{b.position&&this.publish("hover",this.#D(b,b.position))}),this.#r.geometryInFocusSystem=this.#u(new Si(this.#t,this.#O));let h=b=>{this.publish("geometry-in-focus",b)};this.#r.geometryInFocusSystem.on("geometry-in-focus",h,{signal:this.signal}),this.#r.drawSystem=this.#u(new $o(this.#t,this.convertTo3DMapPosition,this.convert3DMapPositionToCoordinate)),this.#r.exporterSystem=this.#u(new vn(this.#t)),this.#r.batchedMeshSystem=this.#u(new Xo(this.#t,this.convertTo3DMapPosition)),this.#r.batchedMeshSystem.on("geometry-2d-added",this.render,{signal:this.signal}),this.#r.batchedMeshSystem.on("geometry-group-added",this.#f,{signal:this.signal}),this.#r.modelSystem=this.#u(new os(this.#t,this.convertTo3DMapPosition)),this.#r.modelSystem.on("model-loaded",()=>{this.#r.shadowsSystem&&(this.#r.shadowsSystem.needsRender=!0),this.render()},{signal:this.signal}),this.#r.modelSystem.on("batch-changed",()=>{this.#r.interactionSystem.dirty3D=!0},{signal:this.signal}),this.#r.meshDetachmentSystem=this.#u(new ki(this.#t)),this.#r.meshModificationSystem=this.#u(new Ui(this.#t)),this.#r.geometryDisposalSystem=this.#u(new Wi(this.#t)),this.#r.textureSystem=this.#u(new ji(this.#t)),this.#r.textureSystem.on("texture-added",this.render,{signal:this.signal}),this.#r.borderSystem=this.#u(new xu(this.#t,this.convertTo3DMapPosition)),this.#r.clippingPlaneSystem=this.#u(new Yi(this.#t)),this.#r.renderOrderSystem=this.#u(new Zi(this.#t)),this.#r.pluginSystem=this.#u(new $i),this.#r.customGeometrySystem=this.#u(new pi(this.#t,this.convertTo3DMapPosition));let g=typeof t.outlines=="object"?t.outlines:void 0;g&&(this.#t.outlinesOptions=g),this.#r.outlineInterpolationSystem=this.#u(new mi(this.#t,g)),this.#r.outlineInterpolationSystem.on("needs-render",this.render,{signal:this.signal}),this.#r.renderSystem=this.#u(new qo(this.#d,this.#t,this.mode,this.#e,this.#n,this.viewCamera,this.#r)),this.#r.imageSystem=this.#u(new vi(this.#t,this.convertTo3DMapPosition,this.project,t.bearing,t.naturalBearing,t.imagePlacementOptions,t.transformImageRequest)),this.#r.text3DSystem=this.#u(new Bc(this.#t,this.convertTo3DMapPosition,t.useWorkers??!0)),this.#r.text3DSystem.on("render",this.render,{signal:this.signal}),this.#r.imageSystem.on("image-loaded",this.render,{signal:this.signal}),this.#r.renderSystem.on("pre-render",()=>this.publish("pre-render"),{signal:this.signal}),this.#r.renderSystem.on("post-render",()=>this.publish("post-render"),{signal:this.signal}),this.#r.renderSystem.on("measure-canvas",this.#_,{signal:this.signal}),this.#r.outdoorLayersSystem=this.#u(new Ai(this.map)),this.#r.occlusion2DSystem=this.#u(new Vi(this.#t,this.convertTo3DMapPosition,this.#d)),t.occlusionEnabled&&this.#r.occlusion2DSystem.enable(),this.Debug=new Hi(this),t.environment!==!1&&(this.#i=this.#z()),this.#R()}#f=()=>{this.#r.geometryDisposalSystem.dirty=!0,this.render()};#S=e=>Math.trunc(e*10)/10;#E=()=>{this.#y(Br()),this.#r.twoDEntitySystem.markDirty(),this.#P(void 0,void 0,!0)};#A=()=>{this.signal?.aborted||typeof window>"u"||(this.#b=window.matchMedia(`(resolution: ${window.devicePixelRatio}dppx)`),this.#b.addEventListener("change",()=>{this.#E(),this.#A()},{once:!0,signal:this.signal}))};#B=()=>{document.visibilityState==="visible"&&this.#P(void 0,void 0,!0)};#G=()=>{this.#P()};#O;#P=(e,t,r=!1)=>{let o=e??this.rendererDomElement.clientWidth,i=t??this.rendererDomElement.clientHeight;if((o===0||i===0)&&!r)return;if(this.#r.twoDEntitySystem.resize(),this.#y(Br()),this.#_(),this.#C(),this.#r.cameraSystem.resize(this.canvasWidth,this.canvasHeight),this.#r.cameraSystem.dirty=!0,this.#r.cameraSystem.stateDirty=!0,this.map!=null){Ro(this.map,this.camera.minZoomLevel,this.camera.maxZoomLevel);let l=this.camera.zoomLevel,c=U.clamp(l,this.camera.minZoomLevel,this.camera.maxZoomLevel);c!==l&&this.camera.setZoomLevel(c)}this.#r.watermarkSystem.resize(this.canvasWidth,this.canvasHeight),this.#r.htmlControlsSystem.resize(this.canvasWidth),this.#r.geometryInFocusSystem.resize(),this.#r.occlusion2DSystem.resize(),this.#r.twoDEntitySystem.resize();let{top:s,left:a}=this.container.getBoundingClientRect();this.#t.containerOffset=[s,a],this.publish("resize"),this.map!=null&&this.publish("camera-change",this.camera),this.render()};#R=()=>{this.renderSync()};#w=new O;project=(e,t)=>{if(this.#n.position.z+this.camera.elevation>t.z){this.#w.copy(t);let r=this.#w.project(this.#O),o=(r.x+1)/2*this.canvasWidth-0/2,i=(-r.y+1)/2*this.canvasHeight-0/2,s=this.#S(o),a=this.#S(i);e.x=s,e.y=a,e instanceof O&&(e.z=r.z)}else e.x=-1e3,e.y=-1e3,e instanceof O&&(e.z=1/0)};#L=(e,t)=>{this.#d.setBufferSize(e,t),this.#n.aspect=e/t,this.#n.updateProjectionMatrix(),this.#n.updateMatrixWorld(!0),this.#s.x=e,this.#s.y=t};#_=()=>{let e=this.rendererDomElement.clientWidth,t=this.rendererDomElement.clientHeight,r=Math.floor(e*this.resolutionScale),o=Math.floor(t*this.resolutionScale);this.#L(r,o),this.map?.resize(),this.#t.shouldMeasureCanvas=!1};addGroupContainer(e,t,r){if(!this.#t.geometry3DMap.has(e)&&!this.#t.geometry2DMap.has(e)){let o=new ie(e);this.#x(o,()=>{this.#c(),this.#m()}),t?.visible!==void 0&&(o.visible=t.visible),t?.altitude!==void 0&&o.setAltitude(t.altitude),t?.interactive!==void 0&&Le(o,t.interactive,this.#t),t?.focusable!==void 0&&ko(o,t.focusable),t?.preloadGeometry!==void 0&&(o.userData.preloadGeometry=t.preloadGeometry),this.#t.geometry3DMap.set(e,o);let i=this.getParentContainer(r);i instanceof ie&&i.addEntity(o),this.#c(),this.render()}else _.error(`Group container with ID '${e}' already exists. The group container cannot be added.`);return{id:e,type:"group-container"}}getParentContainer=(e,t=!0)=>{if(!e)return t?this.#t.geometryScene:void 0;if(typeof e=="string"||typeof e=="number"){let r=this.#t.geometry3DMap.get(e);return r instanceof ie?r:(_.warn(`Parent (${typeof e=="object"?e.id:e}) is not a valid container, adding to scene`),t?this.#t.geometryScene:void 0)}else if(e.type==="group-container"){let r=this.#t.geometry3DMap.get(e.id);if(r instanceof ie)return r}return t?this.#t.geometryScene:void 0};addCustomGeometry(e,t,r,o,i){if(this.#t.geometry3DMap.has(e))_.error(`Custom geometry with ID '${e}' already exists. The custom geometry cannot be added.`);else{let s=new Wr(t,r),a=new $(s,new ct(o));o?.interactive!==void 0&&Le(a,o.interactive,this.#t),a.id=e,s.mesh.userData={entityId:e,type:"custom-geometry"},this.#t.geometry3DMap.set(a.id,a);let l=this.getParentContainer(i);i&&l instanceof ie?l.addEntity(a):this.#t.geometryScene.addEntity(a),this.#r.panBoundsSystem.dirty=!0,this.#c(),this.render()}return{id:e,type:"custom-geometry"}}registerPlugin(e){this.#r.pluginSystem.registerPlugin(e)}unregisterPlugin(e){this.#r.pluginSystem.unregisterPlugin(e)}addFeatureCollection(e,t,r,o,i){if(!this.#t.geometry3DMap.has(e)&&!this.#t.geometry2DMap.has(e)){let s=new Ce(e);this.#x(s,()=>{this.#c(),this.#m()}),s.userData.dirty=!0,o?.altitude!==void 0&&(s.position.z=o.altitude),o?.visible!==void 0&&(s.visible=o.visible);let a="merged",l;if(typeof r=="function"?(a="batched",l=r):typeof r=="object"?l=()=>r:l=()=>({color:zo}),this.#t.geometry3DMap.set(e,s),a==="batched")for(let d of t.features){if(d.geometry==null||!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(d.geometry.type))continue;let h=d?.id||d?.properties?.id||Dr(),g=l(d)??{color:zo},b=this.#r.batchedMeshSystem.createEntityFromFeature(h,d,{outline:!0,...g});this.#t.geometry3DMap.set(h,b),s.userData.entities3D.add(h),this.#r.textureSystem.dirty=!0}else if(a==="merged"){let d=l()??{color:zo},h=this.#r.batchedMeshSystem.createEntityFromFeature(e,t.features,{outline:!0,...d});this.#t.geometry3DMap.set(h.id,h),s.userData.entities3D.add(h.id),s.userData.isMerged=!0,this.#r.textureSystem.dirty=!0}let c=t.features.length>0?l(t.features[0]):void 0;c?.__EXPERIMENTAL_maskEnabled===!0&&Ys(s,{enabled:c.__EXPERIMENTAL_maskEnabled,maskId:c.__EXPERIMENTAL_maskId,effect:c.__EXPERIMENTAL_maskEffect,mode:c.__EXPERIMENTAL_maskMode});let u=this.getParentContainer(i);u instanceof ie&&u.addEntity(s),this.#r.panBoundsSystem.dirty=!0,this.#c(),this.render()}else _.error(`Feature collection with ID '${e}' already exists. The feature collection cannot be added.`);return this.#r.outlineInterpolationSystem.geometries3DDirty=!0,{id:e,type:"feature-collection"}}addOccluder(e,t){let r=this.getParentContainer(t),o=this.#r.occlusion2DSystem.reserveOccluderId();return r?.addOccluderFeature(e,o),o}addImage(e,t,r,o){try{td(e,t,r)}catch(i){_.error(i);return}if(!this.#t.geometry3DMap.has(e)&&!this.#t.geometry2DMap.has(e)){let i=new Pn(t),s=new $(i,new ct(r));s.id=e||Dr(),i.mesh.userData={entityId:s.id,type:"path"},this.#t.geometry3DMap.set(s.id,s),r?.interactive!=null&&Le(s,r.interactive,this.#t);let a=this.getParentContainer(o);a instanceof ie&&a.addEntity(s);let l=t.geometry.coordinates;if(l){let c=this.convertTo3DMapPosition(l[1],l[0],l[2]??0);this.#r.panBoundsSystem.expandBoundsIfOutside(c)}this.#c(),this.render()}else _.error(`Image with ID '${e}' already exists. The image cannot be added.`);return{id:e,type:"image"}}addModelGroup(e,t,r,{parent:o,onComplete:i}={}){try{zu(e,t,r)}catch(s){_.error(s);return}if(!this.#t.geometry3DMap.has(e)&&!this.#t.geometry2DMap.has(e)){let s=new Ce(e);this.#x(s,()=>{this.#c(),this.#m()}),this.#t.geometry3DMap.set(e,s),s.userData.dirty=!0,s.userData.modelURL=r.url;for(let c of t.features){let u=c.id||c.properties.id||Dr(),d=this.#r.modelSystem.createModelFromFeature(u,c,{...r});(c.properties.interactive!==void 0||r.interactive!=null)&&Le(d,c.properties.interactive??r.interactive,this.#t),r.clippingPlaneZOffset!=null&&(d.components[7]=new No,d.components[7].verticalOffset=r.clippingPlaneZOffset,r.clippingPlaneTopColor!=null&&(d.components[7].topColor=r.clippingPlaneTopColor),r.clippingPlaneTopVisible!=null&&(d.components[7].topVisible=r.clippingPlaneTopVisible)),d.parentId=s.userData.entityId,this.#t.geometry3DMap.set(u,d),s.userData.entities3D.add(u)}let a=this.getParentContainer(o);a instanceof ie&&a.addEntity(s);let l=t.features[0]?.geometry.coordinates;if(l){let c=this.convertTo3DMapPosition(l[1],l[0],l[2]??0);this.#r.panBoundsSystem.expandBoundsIfOutside(c)}this.#c(),this.render()?.then(i)}else _.error(`Model group with ID '${e}' already exists. The model group cannot be added.`);return{id:e,type:"feature-collection"}}#T(e,t,r,o){let i=new Gs(t,this.convertTo3DMapPosition(e[1],e[0],e[2]||0),o);return i.components[2]=new qi(r??this.#r.occlusion2DSystem.backgroundId),this.#t.geometry2DMap.set(i.id,i),i}addMarker2D(e,t,r,o){let i=r?.id;if(!this.#t.disableUpdateStateValidation)try{Sc(e,t,r||{})}catch(s){_.error(s);return}if(i===void 0||!this.#t.geometry2DMap.has(i)&&!this.#t.geometry3DMap.has(i)){let s=this.#T(e,new wo(t,r),r?.occluderId,r?.verticalOffset);s.id=i||String(s.id),i=s.id,r?.interactive!=null&&r.interactive!=="pointer-events-auto"&&Le(s,r?.interactive,this.#t),r?.enabled!=null&&Bo(s,r.enabled),r?.occlude!=null&&js(s,r.occlude);let a=typeof r?.attachTo=="string"||typeof r?.attachTo=="number"?this.#t.geometry3DMap.get(r.attachTo):void 0;a instanceof $&&a.attach(s),this.getParentContainer(o)?.addEntity(s),this.#r.panBoundsSystem.expandBoundsIfOutside(s.object3d.position),this.render()}else _.error(`Marker2D with ID '${i}' already exists. The marker cannot be added.`);return{id:i,type:"marker"}}addText3D(e,t,r,o){if(!this.#t.geometry3DMap.has(e)&&!this.#t.geometry2DMap.has(e)){let i=new Fo({...t,properties:{...t.properties,id:e,content:t.properties.text}}),s=new $(i,new pn(r?.appearance));s.id=e,i.mesh.userData.entityId=e.toString(),i.mesh.userData.type="text3d",this.#t.geometry3DMap.set(e,s);let a=this.getParentContainer(o);a instanceof ie&&a.addEntity(s);let l=t.geometry.coordinates;if(l){let c=this.convertTo3DMapPosition(l[1],l[0],l[2]??0);this.#r.panBoundsSystem.expandBoundsIfOutside(c)}this.#c(),this.render()}else _.error(`Text3D with ID '${e}' already exists. The text3d cannot be added.`);return{id:e,type:"text3d"}}labelText3D(e,t,r={}){try{if(!t||!e)throw new Error("content and meshGeometryId are required");Gc.parse(r)}catch(c){_.error(c);return}let o=this.#t.geometry3DMap.get(e);if(o?.type!=="geometry"){_.error(".labelText3D failed: target incorrect");return}let i=o?.components[0],s=!Array.isArray(i.feature)&&i.feature.properties.textArea;if(!s)return;if(i.textEntityId){let c=this.#t.geometry3DMap.get(i.textEntityId);if(c?.type!=="text3d"){_.error(".labelText3D failed: existing text3d not found");return}return{id:c.id,type:c.type}}let a=new Fo({type:"Feature",geometry:{coordinates:s?.position,type:"Point"},properties:{textArea:s,content:t,id:Dr()}});a.polygonEntityId=e;let l=new $(a,new pn(r?.appearance));return i.textEntityId=l.id.toString(),a.mesh.userData.entityId=l.id.toString(),a.mesh.userData.type="text3d",this.#t.geometry3DMap.set(l.id.toString(),l),r.parentId&&this.getParentContainer(r.parentId)?.addEntity(l),this.#c(),this.render(),{id:l.id,type:"text3d"}}addLabel2D(e,t,r,o){let i=r?.id;if(!this.#t.disableUpdateStateValidation)try{xc(e,t,r||{})}catch(s){_.error(s);return}if(i===void 0||!this.#t.geometry2DMap.has(i)&&!this.#t.geometry3DMap.has(i)){let s=this.#T(e,new Eo(t,r||{},this.#t.pixelRatio),r?.occluderId,r?.verticalOffset);s.id=i||String(s.id),i=s.id,r?.interactive!=null&&Le(s,r?.interactive,this.#t),r?.enabled!=null&&Bo(s,r.enabled),r?.occlude!=null&&js(s,r.occlude);let a=typeof r?.attachTo=="string"||typeof r?.attachTo=="number"?this.#t.geometry3DMap.get(r.attachTo):void 0;a instanceof $&&a.attach(s),this.getParentContainer(o)?.addEntity(s),this.#r.panBoundsSystem.expandBoundsIfOutside(s.object3d.position),this.#m(),this.render()}else _.error(`Label2D with ID '${i}' already exists. The label cannot be added.`);return{id:i,type:"label"}}addPath(e,t={},r){try{Au(e,t||{})}catch(a){_.error(a);return}let o=new fr(e,hu(t)),i=new $(o,new ct({color:t?.color??"#ff834c",altitude:t?.verticalOffset??.1}));i.id=t?.id||Dr(),o.mesh.userData={entityId:i.id,type:"path"},this.#t.geometry3DMap.set(i.id,i),t?.interactive!=null&&Le(i,t?.interactive,this.#t);let s=this.getParentContainer(r);return s instanceof ie&&s.addEntity(i),this.#r.panBoundsSystem.dirty=!0,this.#c(),this.render(),{id:i.id,type:"path"}}updateWatermark(e){this.#r.watermarkSystem.options=e,this.#r.watermarkSystem.dirty=!0,this.#r.twoDEntitySystem.setCollidersDirty(),this.render()}remove(e){let t;if(typeof e=="string"||typeof e=="number"?(t=this.#t.geometry2DMap.get(e),t==null&&(t=this.#t.geometry3DMap.get(e))):typeof e.id=="string"||typeof e.id=="number"?(t=this.#t.geometry2DMap.get(e.id),t==null&&(t=this.#t.geometry3DMap.get(e.id))):t=e,t!=null){if(t.type==="custom-geometry")this.#t.geometry3DMap.delete(t.id),t.object3d&&ve(t.object3d),this.#c();else if(t.type==="group-container"){this.#t.geometry3DMap.delete(t.userData.entityId);for(let r of t.childrenIds.values())this.remove(r),t.userData.entities2D.delete(r);ve(t),this.#c()}else if(t.type==="feature-collection"){this.#t.geometry3DMap.delete(t.userData.entityId);for(let r of t.userData.entities3D.values())this.remove(r),t.userData.entities3D.delete(r);ve(t),this.#c()}else if(t.type==="geometry"||t.type==="model"||t.type==="path"){let r=t.components[0];if(t.entities2D.size>0){for(let i of t.entities2D.values())this.remove(i);t.removeAllEntities()}let o=t.parentObject3D?.userData.entityId??t.parentId;if(o){let i=this.#t.geometry3DMap.get(o);i instanceof Ce&&i.userData.entities3D.delete(t.id)}if(t.type==="model"){if(this.#r.modelSystem.removeInstance(t)&&t.object3d&&ve(t.object3d),o){let s=this.#t.geometry3DMap.get(o);if(s instanceof Ce&&s.userData.entities3D.size===0){let a=!1;for(let l of s.children)if(l.children.length>0){let c=l.children[0];if(c.isInstancedMesh&&(c.count??0)>0){a=!0;break}}a||this.remove(o)}}}else t.object3d&&ve(t.object3d);if(t.type==="geometry"){let i=t.components[3];i&&(i.enabled=!1,i.dirty=!0)}"textMesh"in r&&r.textMesh!=null&&this.remove(r.textMesh.userData.entityId),this.#t.geometry3DMap.delete(t.id),this.#c()}else if(t.type==="marker"||t.type==="label"){let r=t.attachedTo;if(r){let o=this.#t.geometry3DMap.get(r);o instanceof $&&o.detach(t)}t.object3d&&ve(t.object3d),t.type==="label"&&this.#r.twoDEntitySystem.deleteTextCacheEntry(t.id),this.#t.geometry2DMap.delete(t.id),this.#m()}else if(t.type==="image")t.object3d&&ve(t.object3d),this.#t.geometry3DMap.delete(t.id),this.#c();else if(t.type==="text3d"){ve(t.object3d);let{batchedText:r,textMesh:o,polygonEntityId:i}=t.components[0];if(o&&(r&&r.removeText(o),ve(o)),i){this.#r.text3DSystem.remove(i);let s=this.#t.geometry3DMap.get(i);s?.type==="geometry"&&(s.components[0].textMesh=void 0,s.components[0].textEntityId=void 0)}this.#t.geometry3DMap.delete(t.id),this.#c()}this.render()}}showCollisionBoxes=()=>{this.#r.twoDEntitySystem.showCollisionBoxes(),this.render()};hideCollisionBoxes=()=>{this.#r.twoDEntitySystem.hideCollisionBoxes(),this.render()};getScene(){return this.getState("__scene")}getThreeScene(){return this.#e}getThreeCamera(){return this.#n}async setEnvironment(e){if(this.#e)if(e==="basic"){this.#i||(this.#i=this.#z());let t=await this.#i;this.#e.environment=t}else this.#e.environment=null}getEnvironment(){return this.#e?.environment?"basic":!1}getCurrentSceneGLTF(e){return this.#r.exporterSystem.getCurrentSceneGLTF(e)}getBoundingArea(e){(this.#r.renderSystem.threeDdirty||this.#r.renderSystem.twoDdirty)&&this.renderSync();let t=new ce;if(e==null)t.setFromObject(this.#t.geometryScene);else{let r=hr(this.#t,e);if(r?.type==="geometry"&&r?.object3d!=null){let o=r.components[0],i=o instanceof oe?o.geometry:void 0;o.mesh instanceof xo&&i?(i.computeBoundingBox(),i.boundingBox&&t.union(i.boundingBox)):t.setFromObject(r.object3d)}else(r?.type==="feature-collection"||r?.type==="group-container")&&r?.userData.entityId!=null&&t.setFromObject(r)}if(Nr(t))return wc(t).map(this.convert3DMapPositionToCoordinate)}hasState(e){return hr(this.#t,e)!=null}getState(e){if(e==null)return{type:"map-view",hoverColor:this.#t.hoverColor,text3dHoverColor:this.#t.text3dHoverColor};let t=hr(this.#t,e);if(t?.type==="custom-geometry"){let r=t.components[0],o=t.components[1];return{id:t.id,type:"custom-geometry",visible:o.visible,altitude:o.altitude,parent:t.parentObject3D?.userData.entityId,position:this.convert3DMapPositionToCoordinate(r.position)}}else if(t?.type==="feature-collection"){let r=Array.from(t.userData.entities3D.values()),o=r?.[0],i=o?this.getState(o):{},s=this.#t,a=this.convert3DMapPositionToCoordinate;return{id:t.userData.entityId,type:"feature-collection",initialColor:i?.initialColor,color:i?.color,hoverColor:i?.hoverColor,side:i?.side??"double",opacity:i?.opacity,height:i?.height,texture:i?.texture,topColor:i?.topColor,topTexture:i?.topTexture,visible:t.visible,altitude:t.position.z,interactive:bu(t,this.#t),children:r,bevel:i?.bevel,maskId:t.components[0]?.maskId,maskEnabled:t.components[0]?.enabled,maskEffect:t.components[0]?.effect,maskMode:t.components[0]?.mode,get position(){return yu(t,s,a)}}}else{if(t?.type==="group-container")return{id:t.userData.entityId,type:"group-container",visible:t.visible,altitude:t.position.z,opacity:t.opacity,interactive:!!t.components[0],children:Array.from(t.childrenIds.values()).map(r=>this.getState(r)).filter(Boolean)};if(t?.type==="label"){let r=t.components[0],o=t.object3d.parent,i=o?.userData.entityId;return{id:t.id,type:"label",text:r.text||"",parent:{id:i,type:o?.type},position:this.convert3DMapPositionToCoordinate(t.position),enabled:r.enabled,visible:r.visible,initialRank:dn(r.initialRank),verticalOffset:t.verticalOffset,options:{rank:dn(r.rank),appearance:r.appearance,interactive:t.components[1]!=null,verticalOffset:t.verticalOffset,attachTo:t.attachedTo,occlude:t.components[2]?.enabled??!1}}}else if(t?.type==="marker"){let r=t.components[0],o=t.object3d.parent,i=o?.userData.entityId;return{id:t.id,type:"marker",enabled:r.enabled,visible:r.visible,placement:r.options.placement,dynamicResize:r.options.dynamicResize,parent:{id:i,type:o?.type},position:this.convert3DMapPositionToCoordinate(t.position),element:r.containerEl,initialRank:dn(r.initialRank),contentHTML:r.contentHtml,options:{rank:dn(r.rank),interactive:t.components[1]!=null||!1,verticalOffset:t.verticalOffset,attachTo:t.attachedTo,lowPriorityPin:r.options.lowPriorityPin,occlude:t.components[2]?.enabled??!1,zIndex:r.options.zIndex,animated:r.options.animated}}}else if(t?.type==="geometry"){let{color:r,hoverColor:o,initialColor:i,initialTopColor:s,topColor:a,altitude:l}=t.components[1],c=t.components[0],u=t.components[4],d=t.components[1],h=t.components[6],g=t.components[2],b=t.components[3],M=t.parentObject3D;return{id:t.id,type:"geometry",opacity:d.opacity,initialColor:i,color:r,focusable:u!=null&&u.vertices!=null&&u.vertices.length>0,initialTopColor:s,topColor:a,side:d.side,hoverColor:o,hovered:!!g?.hover,height:d.height,visible:d.visible,outline:b?.enabled,showImage:d.showImage,texture:h?.texture?.path,topTexture:h?.topTexture?.path,flipImageToFaceCamera:d.flipImageToFaceCamera,enableImageCollisions:d.enableImageCollisions,parent:{id:M?.userData.entityId,type:M?.type},altitude:l,bevel:d.bevel,position:this.convert3DMapPositionToCoordinate(c.position),interactive:c.pointerEventsPassThrough?"pass-through":t.components[2]!=null,borderVisible:d.borderVisible,borderColor:d.borderColor,borderWidth:d.borderWidth}}else if(t?.type==="model"){let r=t.components[0],o=t.components[1],i=t.components[2],s=t.components[7],a=r.feature.geometry.coordinates,l=[a[0],a[1],a[2]??0];return{id:t.id,type:"model",position:l,interactive:i!=null,material:o.material,parent:t.parentObject3D?.parent?{id:t.parentObject3D.parent.userData.entityId,type:t.parentObject3D.parent.type}:void 0,visible:o.visible,verticalOffset:o.verticalOffset,color:o.color,opacity:o.opacity,rotation:o.rotation??Ht,scale:o.scale??Ut,clippingPlaneZOffset:s?.verticalOffset??o.clippingPlaneZOffset,clippingPlaneTopColor:s?.topColor??o.clippingPlaneTopColor,clippingPlaneTopVisible:s?.topVisible??o.clippingPlaneTopVisible}}else if(t?.type==="path"){let r=t.components[0],o=t.components[2],i=t.components[1];return{id:t.id,type:"path",position:this.convert3DMapPositionToCoordinate(r.position),visible:i.visible,interactive:o!=null,completeFraction:r.completeFraction,color:i.color,accentColor:r.accentColor,width:r.width,animateArrowsOnPath:r.animateArrowsOnPath,displayArrowsOnPath:r.displayArrowsOnPath,verticalOffset:i.altitude,highlightCompleteFraction:r.highlightCompleteFraction,highlightStartFraction:r.highlightStartFraction,highlightEndFraction:r.highlightEndFraction,highlightColor:r.highlightColor,highlightWidthMultiplier:r.highlightWidthMultiplier,highlightDisplayArrowsOnPath:r.highlightDisplayArrowsOnPath,travelledEndFraction:r.travelledEndFraction,travelledColor:r.travelledColor,xrayOpacity:r.xrayOpacity,xrayStyle:r.xrayStyle,smoothingTension:r.smoothingTension,smoothingCornerRadius:r.smoothingCornerRadius,dashed:r.dashed,dashLength:r.dashLength,dashGap:r.dashGap,dashRelativeToWidth:r.dashRelativeToWidth,dashSize:r.dashSize,gapSize:r.gapSize,dashAbsolute:r.dashAbsolute,dashMeters:r.dashMeters,gapMeters:r.gapMeters,__EXPERIMENTAL_GEOMETRY:r.__EXPERIMENTAL_GEOMETRY,__EXPERIMENTAL_ENDCAP_EXTENSION:r.__EXPERIMENTAL_ENDCAP_EXTENSION,__EXPERIMENTAL_BILLBOARDING:r.__EXPERIMENTAL_BILLBOARDING,__EXPERIMENTAL_BORDER:r.__EXPERIMENTAL_BORDER,__EXPERIMENTAL_PREVENT_SELF_OVERLAP:r.__EXPERIMENTAL_PREVENT_SELF_OVERLAP}}else if(t?.type==="image"){let r=t.components[0],o=t.components[2];return{id:t.id,type:"image",position:this.convert3DMapPositionToCoordinate(r.position),visible:t.components[1].visible,verticalOffset:r.feature.properties.verticalOffset??0,opacity:t.components[1].opacity,flipImageToFaceCamera:t.components[1].flipImageToFaceCamera,width:r.feature.properties.width??0,height:r.feature.properties.height??0,rotation:r.feature.properties.rotation??0,interactive:o!=null}}else if(t?.type==="text3d"&&t.components[0]instanceof Fo){pu(t);let r=t.components[0],o=t.components[1],{textMesh:i}=r,s=r.feature.properties,a=r.mesh?.parent;a instanceof ie&&a.children.find(h=>h.type==="batchedtext")?.getWorldPosition(this.#U),this.#k.set(0,0,0);let l=i?i.getWorldPosition(this.#k):this.#k,c=s.rotation??s.textArea?.rotation??0,u=s.content??s.text??"";return Object.assign({},Ct,o.getState(),{id:t.id,type:"text3d",position:this.convert3DMapPositionToCoordinate(l.add(this.#U)),visible:r.visible??!1,content:u,rotation:c})}else return}}getRenderedState(e){let t=typeof e=="string"||typeof e=="number"?e:e.id,r=hr(this.#t,t);if(r&&r.type==="label")return{textVisible:r.components[0].textVisible}}setState(e,t){if(typeof e=="object"&&t==null){"hoverColor"in e&&(mc(e.hoverColor)?this.#t.hoverColor=e.hoverColor??this.#t.hoverColor:_.warn(`Failed to update global hover color. Invalid color "${e.hoverColor}".`)),"text3dHoverColor"in e&&(this.#t.text3dHoverColor=e.text3dHoverColor??this.#t.text3dHoverColor);return}let r=hr(this.#t,e);if(r!=null){if(r.type==="custom-geometry"){let o=this.#t.geometry3DMap.get(r.id);if(o instanceof $&&o.components[0]instanceof Wr){let i=t;mr(r,this.#t,i.visible),gn(r,this.#t,i.altitude),Vs(r,i.position,this.convertTo3DMapPosition,this.#r.panBoundsSystem),Ws(r,this.getParentContainer(i.parent,!1)),Le(r,i.interactive,this.#t)&&this.#c()}}else if(r.type==="path"){let o=t;Le(r,o.interactive,this.#t)&&this.#c(),gn(r,this.#t,o.verticalOffset),du(r,this.#t,o)}else if(r.type==="model"){let o=t;Le(r,o.interactive,this.#t)&&this.#c(),mr(r,this.#t,o.visible),fu(r,o,this.convertTo3DMapPosition,this.#r.panBoundsSystem),gu(r,o)}else if(r.type==="group-container"){let o=t;mr(r,this.#t,o.visible)&&(this.#r.pathSystem.verticalDistanceDirty=!0,this.#r.geometryInFocusSystem.focusablesDirty=!0),gn(r,this.#t,o.altitude)&&(this.#r.pathSystem.verticalDistanceDirty=!0),Le(r,o.interactive,this.#t)&&this.#c(),Go(r,this.#t,o.opacity)&&(this.#r.outlineInterpolationSystem.outlineOpacitiesDirty=!0),o.preloadGeometry&&r.userData.preloadGeometry!==!0&&(r.userData.preloadGeometry=!0,this.#r.outlineInterpolationSystem.geometries3DDirty=!0),ko(r,o.focusable)&&(this.#r.geometryInFocusSystem.focusablesDirty=!0)}else if(r.type==="feature-collection"){let o=t;o.visible!==void 0&&r.visible!==o.visible&&(r.visible=o.visible,this.#c()),o.altitude!==void 0&&r.position.z!==o.altitude&&(r.position.z=o.altitude,this.#c()),qc(r,this.#t,o),nu(r,this.#t,o.hoverColor),$s(r,this.#t,o.outline),o.height!=null&&Hs(r,this.#t,o.height),Xs(r,this.#t,o)&&(this.#r.textureSystem.dirty=!0),Xs(r,this.#t,o),Jc(r,this.#t,o.shading),Go(r,this.#t,o.opacity)&&(this.#r.outlineInterpolationSystem.outlineOpacitiesDirty=!0),Le(r,o.interactive,this.#t)&&(this.#c(),this.#m(),this.#r.interactionSystem.dirty3D=!0),qs(r,this.#t,o.side),Ys(r,{maskId:o.maskId,enabled:o.maskEnabled,effect:o.maskEffect,mode:o.maskMode}),au(r,this.#t,{effectStart:o.effectStart,effectDistance:o.effectDistance,darkenAmount:o.darkenAmount,darkenUseDepth:o.darkenUseDepth,desaturateAmount:o.desaturateAmount,desaturateUseDepth:o.desaturateUseDepth,washOutAmount:o.washOutAmount,washOutUseDepth:o.washOutUseDepth}),o.position!=null&&(r.userData.centroid=[o.position[0],o.position[1]],r.userData.positionDirty=!0)}else if(r.type==="geometry"){if(r.components[0]instanceof oe){let o=t;if(mr(r,this.#t,o.visible)&&this.#c(),$s(r,this.#t,o.outline),Kc(r,o),ko(r,o.focusable)&&(this.#r.geometryInFocusSystem.focusablesDirty=!0),cu(r,o.renderOrder)&&(this.#r.meshDetachmentSystem.dirty=!0),lu(r,o.opacity)&&(this.#r.meshDetachmentSystem.dirty=!0,this.#r.interactionSystem.dirty3D=!0,this.#r.outlineInterpolationSystem.outlineOpacitiesDirty=!0),Zs(r,o.flipImageToFaceCamera),iu(r,o.enableImageCollisions),gn(r,this.#t,o.altitude)){let i=r.components[1],s=(i.altitude??0)+(i.height??0);this.#r.panBoundsSystem.expandBoundsIfOutside(new O(0,0,s)),this.#r.shadowsSystem&&(this.#r.shadowsSystem.needsRender=!0)}if(o.height!=null&&Hs(r,this.#t,o.height)){let i=r.components[1],s=(i.altitude??0)+(i.height??0);this.#r.panBoundsSystem.expandBoundsIfOutside(new O(0,0,s)),this.#r.shadowsSystem&&(this.#r.shadowsSystem.needsRender=!0)}su(r,o)&&(this.#r.meshDetachmentSystem.dirty=!0,this.#r.textureSystem.dirty=!0),Qc(r,o,this.#t.outlinesOptions?.darkenFactor),ru(r,o.hoverColor),Le(r,o.interactive,this.#t)&&(this.#r.interactionSystem.dirty3D=!0),ou(r,o.hovered),qs(r,this.#t,o.side),uu(r,o)}}else if(r.type==="label"||r.type==="marker"){let o=t;tu(r,o,this.#t),eu(r,o,this.#t)&&(this.#m(),this.#r.twoDEntitySystem.markDirty()),Vs(r,o.position,this.convertTo3DMapPosition,this.#r.panBoundsSystem),Ws(r,this.getParentContainer(o.parent,!1))&&(this.#m(),this.#r.panBoundsSystem.dirty=!0),Bo(r,o.enabled),mr(r,this.#t,o.visible)}else if(r.type==="image"){let o=t;mr(r,this.#t,o.visible),Go(r,this.#t,o.opacity),Zs(r,o.flipImageToFaceCamera),Le(r,o.interactive,this.#t)&&this.#c()}else if(r.type==="text3d"){let o=t;mu(r,this.#t,o)}this.render()}}projectScreenXYToCoordinate=(e,t,r=!1)=>{let o=this.container.getBoundingClientRect(),i=(e-o.left)/this.#t.canvasWidth*2-1,s=-((t-o.top)/this.#t.canvasHeight)*2+1,a=new V(i,s),l,c;if(r?(Bh.setFromCamera(a,this.#n),l=Bh.intersectObject(this.#l,!1)[0]?.point):(l=this.#r.interactionSystem.getThreeDIntersectsFromXY(a)?.[0]?.point,c=this.#r.interactionSystem.getGroupContainerIntersectsFromXY(a)),l)return{coordinate:this.convert3DMapPositionToCoordinate(l),groupContainers:c}};projectCoordinateToScreenXY=e=>{let t=this.convertTo3DMapPosition(e[1],e[0],e[2]||0),r=new V;return this.project(r,t),{x:r.x,y:r.y}};convertTo3DMapPosition(e,t,r=0,o){if(Array.isArray(e))return this.convertTo3DMapPosition(e[1],e[0],e[2]??r,typeof t=="function"?t:void 0);if(typeof t!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:i,y:s}=Oo(this.#t.center?.[1]??0,this.#t.center?.[0]??0,e,t);return o?(o.set(i,s,r),o):new O(i,s,r)}convert3DMapPositionToCoordinate=e=>{let{lat:t,lon:r}=Io(this.#t.center?.[1]??0,this.#t.center?.[0]??0,e.x,e.y);return[r,t,e.z]};#D=(e,t)=>{let r=e.entity3D?[e.entity3D.id]:[];e.entity3D?.parentObject3D?.userData?.entityId&&r.push(e.entity3D.parentObject3D.userData.entityId);let o=[],i=[];for(let l of e.entity2D)l.components&&(l.components[0]instanceof wo?o.push(l.id):l.components[0]instanceof Eo&&i.push(l.id));let s=e.entity3D?.components[0],a=e.entity3D?.id;return{coordinate:this.convert3DMapPositionToCoordinate(t),geometry:r,paths:s instanceof fr&&a!==void 0?[a]:[],markers:o,models:s instanceof yr&&a!==void 0?[a]:[],images:s instanceof Pn&&a!==void 0?[a]:[],labels:i,containers:Array.isArray(e.groupContainers)?e.groupContainers.map(l=>l.userData.entityId):[]}};setBackgroundColor=(e,t)=>{this.#d.setBackgroundColor(e,t)};get backgroundColor(){return typeof this.#d.backgroundColor=="string"?this.#d.backgroundColor:`#${this.#d.backgroundColor.getHexString()}`}get backgroundAlpha(){return this.#d.backgroundAlpha}getThreeRenderer(){return this.#d}getMetersPerPixel=()=>this.#r.cameraSystem.getCurrentMetersPerPixel();hideOutdoorLayersIntersectingPolygons=(e,t)=>{this.#r.outdoorLayersSystem.hideLayersIntersectingPolygons(e,t),this.render()};getCenter(e){let t=Array.isArray(e)?e:this.getBoundingArea(e);return t?Rc(t):void 0}#I=new Or;#F=new Y;isInView(e){let t=hr(this.#t,e);if(this.#F.identity().multiply(this.#n.projectionMatrix).multiply(this.#n.matrixWorldInverse),this.#I.setFromProjectionMatrix(this.#F),t instanceof Gs)return this.#I.containsPoint(t.position);if(t instanceof $){let r=t?.components[0];if(r instanceof Wr||r instanceof yr)return this.#I.containsPoint(this.convertTo3DMapPosition(r.feature.geometry.coordinates));if(r instanceof oe){let o=new ce(this.convertTo3DMapPosition(r.featureBbox[1],r.featureBbox[0],0),this.convertTo3DMapPosition(r.featureBbox[3],r.featureBbox[2],0));return this.#I.intersectsBox(o)}}return!1}queryGeometry2DInView(e){let{screenOffsets:t,fullyContains:r}=e??{},[o,i,s,a]=Nc(this.container,t),l=new zt(o,i,s,a);return this.#r.twoDEntitySystem.visibleCollidersQTree.queryRect(l).filter(h=>r?l.contains(h):l.intersects(h)).map(h=>this.#t.geometry2DMap.get(h.userData.entityId)).filter(h=>h!=null).filter(h=>h.components[0]instanceof Eo||h.components[0]instanceof wo).map(h=>h.id.toString())}#N=e=>{_.error("Render failed: ",e,e.stack??"No stack trace available"),this.publish("render-error",{error:e})};render=()=>{if(!(this.#r?.renderSystem==null||this.signal?.aborted))if(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay"))this.map.triggerRepaint();else return this.#r.renderSystem.update().catch(this.#N)};renderSync=()=>this.signal?.aborted?Promise.resolve():this.#r.renderSystem.update(!0).catch(this.#N);#M=Pr(()=>{this.publish("user-interaction-start",void 0)},0,!0);#v=Pr(()=>{this.publish("user-interaction-end",void 0),this.render()},0,!0);onMapLibreEvent(e,t){if(!this.map){_.warn(`Tried to add event listener "${e}" but MapLibre map is not initialized.`);return}let r=this.map.on(e,t);r?.unsubscribe&&this.onAbort(()=>r.unsubscribe())}offMapLibreEvent(e,t){this.map&&this.map.off(e,t)}getSystems(){return this.#r}getInternalState(){return this.#t}getInternalTweenGroup(){return this.#t.internalTweenGroup}getExternalTweenGroup(){return this.#t.externalTweenGroup}async#z(){return Wt.load(Mu).then(e=>(this.#e&&(this.#e.environment?.dispose(),e.mapping=Wl,this.#e.environment=e,this.render()),e))}computeMinZOffsetBetweenContainers(e,t,r){if(!e||!t)return-1;Ks(e,"group-container"),Ks(t,"group-container"),e.updateMatrixWorld(!0),t.updateMatrixWorld(!0);let o=Ao(e,this.getThreeCamera()),i=t.clone(!0);Lo(i,!0),i.updateMatrixWorld();let s=Ao(i,this.getThreeCamera());if(!Nr(o)||!Nr(s))return-1;let a=0,l;r&&this.container.querySelectorAll(".debug-box").forEach(u=>u.remove());do{if(a>1e4)return-1;if(a+=20,i.setAltitude(a),s.makeEmpty(),Ao(i,this.#n,s),l=o.intersectsBox(s),r){let c=Us(o,"blue",this.container),u=Us(s,l?"red":"green",this.container);c.classList.add("debug-box"),u.classList.add("debug-box")}}while(l);return a}on=(e,t,r)=>{let o=super.on(e,t,r);return["outdoor-view-loaded","outdoor-style-loaded"].includes(e)&&this.mode==="standalone"&&E.env.NODE_ENV!=="test"&&(_.warn(`"${e}" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.`),this.publish(e),o()),o};off=(e,t)=>{super.off(e,t)};getCursor=()=>this.#r.interactionSystem.getCursor();#H=()=>{try{this.#p!=="outdoors-overlay"&&(this.map&&this.map.remove(),this.container&&this.rendererDomElement&&this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement))}catch(e){_.warn("Error during DOM cleanup, some elements may not have been removed:",e)}};#u=e=>(this.onAbort(()=>{e&&typeof e=="object"&&("destroy"in e&&typeof e.destroy=="function"?e.destroy():"dispose"in e&&typeof e.dispose=="function"&&e.dispose())}),e);destroy=()=>{!this.#r||this.signal?.aborted||(super.destroy(),globalThis.MappedinDebug?.__idleCallbackInteractionState&&(globalThis.MappedinDebug.__idleCallbackInteractionState.unregisterInteractionChecker(this.#r.cameraSystem.isUserInteracting),globalThis.MappedinDebug.__idleCallbackInteractionState.unregisterInteractionChecker(this.#r.cameraSystem.isCameraMoving)),this.remove("__scene"),this.#d.destroy(),this.#e?.traverse(e=>{ve(e),"dispose"in e&&typeof e.dispose=="function"&&e.dispose()}),this.#e=void 0,this.#r=void 0,this.#H(),this.#d=void 0)};#k=new O;#U=new O},qt=al;f();function Gh(n,e){let{cameraSystem:t}=n.getSystems(),r={center:e.getCenter().toArray(),zoom:e.getZoom(),bearing:e.getBearing(),pitch:e.getPitch(),elevation:e.getCenterElevation()},o=!1;n.on("camera-change",i=>{if(!o){r.center=i.center,r.zoom=i.zoomLevel,r.bearing=i.bearing,r.pitch=i.pitch,r.elevation=i.elevation,o=!0;try{e.jumpTo(r)}finally{o=!1}}}),n.onMapLibreEvent("move",()=>{if(!o){o=!0;try{let i=e.getCenter();t.setCenter(i.lng,i.lat),t.setZoomLevel(e.getZoom()),t.setRotation(U.degToRad(e.getBearing())),t.setTilt(U.degToRad(e.getPitch())),t.setPedestal(Math.min(e.getCenterElevation(),t.maxPedestal),!0)}finally{o=!1}}}),n.onMapLibreEvent("movestart",()=>{o||t.beginGesture()}),n.onMapLibreEvent("moveend",()=>{o||t.endGesture()})}f();function vy(n,e){xy(n,e)(n.getScene(),e),Sy(n,e),e.addFolder("Export").add({export:async()=>{let s=await n.getCurrentSceneGLTF({binary:!0}),a=new Blob([s],{type:"application/octet-stream"});var l=document.createElement("a");document.body.appendChild(l),l.style.display="none";let c=window.URL.createObjectURL(a);l.href=c,l.download="scene.glb",l.click(),window.URL.revokeObjectURL(c)}},"export");let o=e.addFolder("Camera"),i={get bearing(){return n.camera.bearing},set bearing(s){n.camera.setBearing(s)},get pitch(){return n.camera.pitch},set pitch(s){n.camera.setPitch(s)},get zoomLevel(){return n.camera.zoomLevel},set zoomLevel(s){n.camera.setZoomLevel(s)}};o.add(i,"bearing",-359,359,1),o.add(i,"pitch",n.camera.minPitch,n.camera.maxPitch,1),o.add(i,"zoomLevel",n.camera.minZoomLevel,n.camera.maxZoomLevel,.1)}function xy(n,e){let t=e;return function r(o,i){let s=i.addFolder(`${[o.type]} ${o.id.slice(0,16)}`);if(i.close(),o.type==="geometry"||o.type==="model"||o.type==="path"||o.type==="image"){let a={get height(){let l=n.getState(o.id);return l?.type==="geometry"?l.height:0},set height(l){n.getState(o.id)?.type==="geometry"&&n.setState(o,{height:l})},set flipImageToFaceCamera(l){n.getState(o.id)?.type==="image"&&n.setState(o,{flipImageToFaceCamera:l})},get flipImageToFaceCamera(){let l=n.getState(o.id);return l?.type==="image"?l.flipImageToFaceCamera:!1},set visible(l){let c=n.getState(o.id);(c?.type==="geometry"||c?.type==="path"||c?.type==="image")&&n.setState(o,{visible:l})},get visible(){let l=n.getState(o.id);return l?.type==="geometry"||l?.type==="path"||l?.type==="image"?l.visible:!1},set outline(l){n.getState(o.id)?.type==="geometry"&&n.setState(o,{outline:l})},get outline(){let l=n.getState(o.id);return l?.type==="geometry"?l.outline:!1},get opacity(){let l=n.getState(o.id);return l?.type==="geometry"?l.opacity:1},set opacity(l){let c=n.getState(o.id);c?.type==="geometry"&&n.setState(c,{opacity:l})},get color(){let l=n.getState(o.id);return l?.type==="geometry"&&l.color?fc(l.color).toHexString():"#ffffff"},set color(l){let c=n.getState(o.id);c?.type==="geometry"&&n.setState(c,{color:l})},set interactive(l){let c=n.getState(o.id);(c?.type==="geometry"||c?.type==="model"||c?.type==="path")&&(n.setState(o,{interactive:l}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get interactive(){let l=n.getState(o.id);return l?.type==="geometry"||l?.type==="model"||l?.type==="path"?l.interactive:!1},get completeFraction(){let l=n.getState(o.id);return l?.type==="path"?l.completeFraction:1},set completeFraction(l){let c=n.getState(o.id);c?.type==="path"&&n.setState(c,{completeFraction:l})},focus:()=>{}};s.add(a,"focus").onChange(()=>{let l=n.getState(o.id);l?.type==="model"||l?.type==="path"||l?.type==="image"?n.camera.focusOn([l.position]):l?.type==="geometry"&&n.camera.focusOn(n.getBoundingArea(l))}),s.add(a,"visible"),o.type==="image"?s.add(a,"flipImageToFaceCamera"):(s.add(a,"interactive"),o.type==="path"&&s.add(a,"completeFraction",0,1,.1),o.type!=="model"&&(s.addColor(a,"color"),s.add(a,"outline"))),o.type==="geometry"&&(s.add(a,"height"),s.add(a,"opacity",0,1,.1))}else if(o.type==="marker"){let a={get interactive(){let l=n.getState(o.id);return l?.type==="marker"?l.options?.interactive:!1},set interactive(l){let c=n.getState(o.id);c?.type==="marker"&&(n.setState(c,{options:{interactive:l}}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},focus:()=>{}};s.add(a,"focus").onChange(()=>{let l=n.getState(o.id);l?.type==="marker"&&n.camera.focusOn([l.position])}),s.add(a,"interactive")}else if(o.type==="label"){let a={get interactive(){let l=n.getState(o.id);return l?.type==="label"?l.options?.interactive:!1},set interactive(l){let c=n.getState(o.id);c?.type==="label"&&(n.setState(c,{options:{interactive:l}}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get text(){let l=n.getState(o.id);return l?.type==="label"?l.text:""},set text(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:l})},get"Text Color"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.textColor:"#000000"},set"Text Color"(l){n.getState(o.id)?.type==="label"&&n.setState(o.id,{text:a.text,options:{appearance:{textColor:l}}})},get"Text Size"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.textSize:10},set"Text Size"(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:a.text,options:{appearance:{textSize:l}}})},get"Icon Size"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.iconSize:10},set"Icon Size"(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:a.text,options:{appearance:{iconSize:l}}})},get"Pin Color"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.pinColor:"#000000"},set"Pin Color"(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:a.text,options:{appearance:{pinColor:l}}})},get"Pin Color Inactive"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.pinColorInactive:"#000000"},set"Pin Color Inactive"(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:a.text,options:{appearance:{pinColorInactive:l}}})},get"Pin Outline Color"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.pinOutlineColor:"#000000"},set"Pin Outline Color"(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:a.text,options:{appearance:{pinOutlineColor:l}}})},get"Pin Outline Color Inactive"(){let l=n.getState(o.id);return l?.type==="label"?l.options.appearance?.pinOutlineColorInactive:"#000000"},set"Pin Outline Color Inactive"(l){let c=n.getState(o.id);c?.type==="label"&&n.setState(c,{text:a.text,options:{appearance:{pinOutlineColorInactive:l}}})},focus:()=>{}};s.add(a,"focus").onChange(()=>{let l=n.getState(o.id);l?.type==="label"&&n.camera.focusOn([l.position])}),s.add(a,"interactive"),s.add(a,"text"),s.add(a,"Text Size",10,50),s.add(a,"Icon Size",10,50),s.addColor(a,"Text Color"),s.addColor(a,"Active Background Color"),s.addColor(a,"Inactive Background Color"),s.addColor(a,"Active Foreground Color"),s.addColor(a,"Inactive Foreground Color")}else if(o.type==="feature-collection"){let a={get opacity(){let l=n.getState(o.id);return l?.type==="feature-collection"?l.opacity:1},set opacity(l){n.getState(o.id)?.type==="feature-collection"&&n.setState(o,{opacity:l})},set outline(l){n.getState(o.id)?.type==="feature-collection"&&n.setState(o,{outline:l})},get outline(){let l=n.getState(o.id);return l?.type==="feature-collection"?l.outline:!1},set interactive(l){n.getState(o.id)?.type==="feature-collection"&&(n.setState(o,{interactive:l}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get interactive(){let l=n.getState(o.id);return l?.type==="feature-collection"?l.interactive:!1},get shadingStart(){let l=n.getState(o.id);return l?.type==="feature-collection"?l.shading?.start??0:0},set shadingStart(l){let c=n.getState(o.id);c?.type==="feature-collection"&&n.setState(c,{shading:{start:l}})},get shadingEnd(){let l=n.getState(o.id);return l?.type==="feature-collection"?l.shading?.end??0:0},set shadingEnd(l){let c=n.getState(o.id);c?.type==="feature-collection"&&n.setState(c,{shading:{end:l}})},get shadingIntensity(){let l=n.getState(o.id);return l?.type==="feature-collection"?l.shading?.intensity??0:0},set shadingIntensity(l){let c=n.getState(o.id);c?.type==="feature-collection"&&n.setState(c,{shading:{intensity:l}})}};s.add(a,"opacity",0,1,.1),s.add(a,"interactive"),s.add(a,"outline"),s.add(a,"shadingStart",0,1,.1),s.add(a,"shadingEnd",0,1,.1),s.add(a,"shadingIntensity",0,1,.1)}else if(o.type==="group-container"){let a={set visible(l){n.getState(o.id)?.type==="group-container"&&n.setState(o,{visible:l})},get visible(){let l=n.getState(o.id);return l?.type==="group-container"?l.visible:!1},set interactive(l){let c=n.getState(o.id);c?.type==="group-container"&&(n.setState(c,{interactive:l}),t.controllersRecursive().forEach(u=>u.updateDisplay()))},get interactive(){let l=n.getState(o.id);return l?.type==="group-container"?l.interactive:!1}};s.add(a,"visible"),s.add(a,"interactive")}if(s.close(),o.children)for(let a of o.children.values())r(a,s)}}function Sy(n,e){let t=e.addFolder("Watermark"),r={padding:16,iconOnly:!1,position:"bottom-left",color:"dark",scale:1};t.add(r,"padding",0,100,1),t.add(r,"scale",.5,1.5,.1),t.add(r,"color",["dark","light"]),t.add(r,"position",["top-left","top-right","bottom-left","bottom-right","center","top","bottom","left","right"]),t.add(r,"iconOnly"),t.onChange(()=>{n.updateWatermark(r)})}f();var dl=class extends Z{gl;options;el=document.createElement("div");core;origin;map;layer;cameraSystem;constructor(e,t){super(),this.origin=e,this.options=t}handleStyleChange=()=>{!this.map||!this.layer||this.map.getLayer(this.layer.id)||(this.map.addLayer(this.layer),this.core.camera.setMinZoomLevel(this.map.getMinZoom()),this.core.camera.setMaxZoomLevel(this.map.getMaxZoom()),this.core.camera.setMinPitch(this.map.getMinPitch()),this.core.camera.setMaxPitch(this.map.getMaxPitch()))};handleMoveStart=()=>{this.cameraSystem.beginGesture()};handleMove=()=>{if(!this.map)return;let[e,t]=this.map.getCenter().toArray();this.cameraSystem.setCenter(e,t),this.cameraSystem.setZoomLevel(this.map.getZoom()),this.cameraSystem.setRotation(U.degToRad(this.map.getBearing())),this.cameraSystem.setTilt(U.degToRad(this.map.getPitch()))};handleMoveEnd=()=>{this.cameraSystem.endGesture()};handleError=e=>{_.warn(e)};onAdd(e){this.origin=this.origin||e.getCenter().toArray(),this.gl=e.painter.context.gl,this.core=new qt(e._container,{...this.options,center:this.origin,zoomLevel:e.getZoom(),pitch:e.getPitch(),bearing:e.getBearing(),gl:this.gl,map:e,mode:"outdoors-overlay"}),this.map=e,this.cameraSystem=this.core.getSystems().cameraSystem,this.core.camera.setMinZoomLevel(e.getMinZoom()),this.core.camera.setMaxZoomLevel(e.getMaxZoom()),this.core.camera.setMinPitch(e.getMinPitch()),this.core.camera.setMaxPitch(e.getMaxPitch()),this.map.on("error",this.handleError);let t=To.fromLngLat(this.origin,0);return this.layer=Po(t,this.core.viewCamera,()=>{this.core.renderSync()}),this.map.on("styledata",this.handleStyleChange),this.map.on("movestart",this.handleMoveStart),this.map.on("move",this.handleMove),this.map.on("moveend",this.handleMoveEnd),this.handleStyleChange(),this.el}onRemove(){this.map&&(this.map.off("styledata",this.handleStyleChange),this.map.off("movestart",this.handleMoveStart),this.map.off("move",this.handleMove),this.map.off("moveend",this.handleMoveEnd),this.map.off("error",this.handleError),this.layer&&this.map.removeLayer(this.layer.id)),this.layer=void 0,this.map=void 0,this.core&&this.core.destroy(),this.core=void 0}};f();f();f();f();f();f();var _e=class{origin;destination;distance;angle;weight;constructor({origin:e,destination:t,distance:r=0,angle:o=0,pathWeight:i=0,multiplicativeDistanceWeightScaling:s=!0}){if(this.origin=e,this.destination=t,this.distance=r,this.angle=o,this.weight=i||0,s?e.properties.floor===t.properties.floor&&(this.weight=(this.weight>=0?this.distance*this.weight:0)+this.distance):e.properties.map===t.properties.map&&(this.weight=this.weight>=0?this.distance+this.weight:0),isNaN(this.angle))throw new Error("Invalid angle: Expected a numeric value, but received NaN.")}};f();f();f();f();f();function xe([n,e],[t,r]){let o=e-r,i=n-t;return(Math.atan2(i,o)+Math.PI*3)%(Math.PI*2)}f();f();function ss(n,e,t,r){let[o,i]=n,[s,a]=e,[l,c]=t,[u,d]=r;if(i===a&&o===s||c===d&&l===u)return null;let h=(u-l)*(a-i)-(d-c)*(s-o);if(h===0)return null;let g=((d-c)*(o-l)-(u-l)*(i-c))/h,b=((a-i)*(o-l)-(s-o)*(i-c))/h;if(g<0||g>1||b<0||b>1)return null;let M=i+g*(a-i);return[o+g*(s-o),M]}f();f();function as(n,e,t,r){r===void 0&&(r={});var o=Mi(n),i=mo(o[0]),s=mo(o[1]),a=mo(t),l=Gl(e,r.units),c=Math.asin(Math.sin(s)*Math.cos(l)+Math.cos(s)*Math.sin(l)*Math.cos(a)),u=i+Math.atan2(Math.sin(a)*Math.sin(l)*Math.cos(s),Math.cos(l)-Math.sin(s)*Math.sin(c)),d=Ds(u),h=Ds(c);return uo([d,h],r.properties)}function hl(n,e,t,r){let o=as(n,t/1e3,r),i=as(e,t/1e3,r);return[o.geometry.coordinates,i.geometry.coordinates]}f();function pl(n){let e=n*(180/Math.PI);return e=e%360,e>180?e-=360:e<-180&&(e+=360),Object.is(e,-0)?0:e}var kh=111e3;function nt(n,e,t=[],r=0){let o=!0,i=n.geometry.coordinates,s=e.geometry.coordinates,a=pl(xe(i,s)-Math.PI/2),l=pl(xe(i,s)+Math.PI/2),c=r/kh,u=r/(kh*Math.cos(i[1]*Math.PI/180)),d=Math.min(i[1],s[1])-c,h=Math.max(i[1],s[1])+c,g=Math.min(i[0],s[0])-u,b=Math.max(i[0],s[0])+u;for(let M of t)if(!(Math.max(M[0][1],M[1][1])<d||Math.min(M[0][1],M[1][1])>h||Math.max(M[0][0],M[1][0])<g||Math.min(M[0][0],M[1][0])>b)){if(r>0){let m=hl(i,s,r,a),p=hl(i,s,r,l);if(ss(m[0],m[1],M[0],M[1])||ss(p[0],p[1],M[0],M[1]))return o=!1,!1}else if(ss(i,s,M[0],M[1]))return o=!1,!1}return o}f();function zh(n,e=.5){let[t,r]=n,o=(t.x+r.x)/2,i=(t.y+r.y)/2,s=r.x-t.x,l=-(r.y-t.y),c=s,u=Math.sqrt(l*l+c*c),d=l/u,h=c/u,g={x:o+d*e,y:i+h*e},b={x:o-d*e,y:i-h*e};return[g,b]}var Hn=.4,ls=class{edges={};nodesById;nodesByGroup=new Map;#e;constructor({nodes:e,groupBy:t,multiplicativeDistanceWeightScaling:r}){this.#e=t;let{features:o}=e;this.nodesById=this.#i(o),this.#o(),this.#s(o,t,{multiplicativeDistanceWeightScaling:r})}getShortestEuclideanDistance(e,t){return t.reduce((r,o)=>{let i=ku(e.geometry.coordinates,o.geometry.coordinates);return Math.min(r,i)},Number.MAX_VALUE)}hasLineOfSight=(e,t,r=[],o=Hn)=>nt({type:"Feature",properties:{id:"origin",neighbors:[]},geometry:{type:"Point",coordinates:e}},{type:"Feature",properties:{id:"destination",neighbors:[]},geometry:{type:"Point",coordinates:t}},r,o)===!0;dijkstraFindWithinTravelDistance(e,t,r,o,i,s){let a=this.nodesById[e];if(!a)return[];let l=[],c={},u={},d=new Set,h=[];for(l.push({node:a,distance:0}),c[a.properties.id]=null,u[a.properties.id]=0;l.length>0;){l.sort((m,p)=>m.distance-p.distance);let g=l.shift();if(!g)break;let b=g.node,M=g.distance;if(!d.has(b.properties.id)){if(d.add(b.properties.id),h.length>=s)break;b.properties.id!=null&&r.includes(b.properties.id?.toString())&&(i?this.hasLineOfSight(a.geometry.coordinates,b.geometry.coordinates,o)&&h.push({feature:b,distance:M}):h.push({feature:b,distance:M}));for(let m of this.edges[b.properties.id]){let p=m.destination,y=M+m.distance,v=u[b.properties.id]+m.weight;y>t||d.has(p.properties.id)||u[p.properties.id]!==void 0&&v>=u[p.properties.id]||(u[p.properties.id]=v,c[p.properties.id]=m,l.push({node:p,distance:y}))}}}return h.sort((g,b)=>g.distance-b.distance)}aStar({originIds:e,destinationNodeIds:t,disabledConnectionNodeIds:r,zones:o,overrideEdgeWeights:i,disabledNodeIds:s}){let a=this.#n(e),l=this.#n(t);if(a.length===0||l.length===0)return[];let{frontier:c,cameFrom:u,costSoFar:d}=this.#l(a,l);for(;c.length>0;){let h=c.shift();if(!h)break;if(this.#a(h.origin,l))return this.#h(u,h.origin.properties.id);for(let g of this.edges[h.origin.properties.id]){let b=i?.get(g)??g.weight,M=g.destination.properties.map!==g.origin.properties.map,m=r?.has(g.destination.properties.id);if(r?.has(g.origin.properties.id)&&(M||m)||s?.has(g.origin.properties.id))continue;let p=d[h.origin.properties.id]+b+this.#y(g.destination,o);if(p!==1/0&&(d[g.destination.properties.id]==null||p<d[g.destination.properties.id])){let y=p+this.getShortestEuclideanDistance(g.destination,l);d[g.destination.properties.id]=p,u[g.destination.properties.id]=g,c.push({origin:g.destination,priority:y})}}c.sort((g,b)=>g.priority-b.priority)}return[]}#n(e){return e.map(t=>this.nodesById[t]).filter(Boolean)}#i(e){return e.reduce((t,r)=>(t[r.properties.id]=r,t),{})}#o(){for(let e in this.nodesById)this.nodesById.hasOwnProperty(e)&&(this.nodesById[e].properties.neighbors=this.nodesById[e].properties.neighbors.filter(({id:t})=>!!this.nodesById[t]))}#s(e,t,r){e.forEach(o=>{let i=t==="default"?t:o.properties[t];this.nodesByGroup.has(i)||this.nodesByGroup.set(i,[]),this.nodesByGroup.get(i).push(o),this.edges[o.properties.id]=o.properties.neighbors.map(({id:s,weight:a})=>{let l=this.nodesById[s],c=Ee(o.geometry.coordinates,l.geometry.coordinates),u=xe(o.geometry.coordinates,l.geometry.coordinates);return new _e({origin:o,destination:l,pathWeight:a,distance:c,angle:u,multiplicativeDistanceWeightScaling:r?.multiplicativeDistanceWeightScaling})})})}#l(e,t){let r=[],o={},i={};return e.forEach(s=>{let a=this.getShortestEuclideanDistance(s,t);r.push({origin:s,priority:a}),o[s.properties.id]=null,i[s.properties.id]=0}),r.sort((s,a)=>s.priority-a.priority),{frontier:r,cameFrom:o,costSoFar:i}}#a(e,t){return t.some(r=>r.properties.id===e.properties.id)}#h(e,t){let r=[],o=e[t];for(;o;)r.push(o),o=e[o.origin.properties.id];return r.reverse()}#y=(e,t)=>{let r=0;for(let o of t)(!o[this.#e]||o[this.#e]===e.properties[this.#e])&&wt(e.geometry.coordinates,o.geometry.geometry)&&(r+=Math.max(0,o.cost));return r}};f();function My(n,e,t,r){let o=t[n].origin,i=e===t.length?r:t[e].origin;return Ee(o.geometry.coordinates,i.geometry.coordinates)}function Uh(n,e,t,r=Hn){if(n.length<3)return n;let o=1e-4,i=n.length,s=new Set;for(let h=0;h<i;h++)n[h].origin.properties.preventSmoothing&&s.add(h);let a=n[i-1].destination,l=new Array(i+1).fill(null).map(()=>({cost:1/0,prev:-1}));l[0]={cost:0,prev:-1};for(let h=0;h<i;h++){let g=!0;if(l[h].cost!==1/0){for(let b=h+1;b<=i;b++){let M=b===i?a:n[b].origin;if(Ee(n[h].origin.geometry.coordinates,M.geometry.coordinates)<.01)continue;let p=b===h+1&&b<i&&s.has(b),y=b===h+1&&s.has(h);if(!p&&!y&&!nt(n[h].origin,M,e,r))continue;if(b>h+1){let D=!1;for(let C=h+1;C<b;C++)if(s.has(C)){D=!0;break}if(D)continue}let v=My(h,b,n,a),S=(b-h-1)*o,w=l[h].cost+v-S;w<l[b].cost&&(l[b]={cost:w,prev:h},g=!1)}g&&l[h+1].cost===1/0&&(l[h+1].cost=l[h].cost,l[h+1].prev=h)}}let c=[],u=i;for(;u!==-1;)c.unshift(u),u=l[u].prev===-1?u-1:l[u].prev;let d=[];for(let h=0;h<c.length-1;h++){let g=c[h],b=c[h+1],M=n[g].origin,m=b===i?a:n[b].origin;d.push(new _e({origin:M,destination:m,distance:Ee(M.geometry.coordinates,m.geometry.coordinates),angle:xe(M.geometry.coordinates,m.geometry.coordinates),multiplicativeDistanceWeightScaling:t}))}return d}f();var Wh=lo(ml());f();var Hh=Fl("Navigator");function us(n,e,t){if(n==null||n[e]==null)return!1;let r=1<<t;return(n[e]&r)!==0}f();var Cy=.5;function Vh(n,e,t,r,o,i){if(!n?.geoJSON?.geometry?.coordinates)return null;let[s,a]=zh(r,Cy),l=s,c=a;if(o){let b=Math.sqrt(Math.pow(s.x-o.x,2)+Math.pow(s.y-o.y,2));Math.sqrt(Math.pow(a.x-o.x,2)+Math.pow(a.y-o.y,2))<b&&(l=a,c=s)}let u=i(l.x,l.y),d=i(c.x,c.y),h={type:"Feature",geometry:{type:"Point",coordinates:[u.lon,u.lat]},properties:{id:`${e}_buffer_entry`,map:t,neighbors:[],preventSmoothing:!0}},g={type:"Feature",geometry:{type:"Point",coordinates:[d.lon,d.lat]},properties:{id:`${e}_buffer_exit`,map:t,neighbors:[],preventSmoothing:!0}};return{entryNode:h,exitNode:g,entryMeters:l,exitMeters:c}}function Dt(n){return n.properties.floor??n.properties.map}function jh(n,e,t,r){let o=[n[0].origin];for(let C=0;C<n.length;C++)o.push(n[C].destination);let i=new Map,s=new Map;for(let C=0;C<o.length;C++)i.set(o[C].properties.id,o[C]),s.set(C,o[C]);let a=o[0].geometry.coordinates[1],{toCartesian:l,toGeographic:c}=ni(a),u=o.map((C,T)=>{let P={x:0,y:0,nodeId:C.properties.id,originalIndex:T};return l(C.geometry.coordinates,P),P}),d=new Set,h=new Map,g=new Set;for(let C=0;C<o.length;C++){let T=e(o[C].properties.id);if(T&&(d.add(C),h.set(C,T)),C<o.length-1){let P=Dt(o[C]),I=Dt(o[C+1]);P!==I&&(g.add(C),g.add(C+1),C>0&&g.add(C-1))}}if(n.length<3&&d.size===0)return n;let b=n.length>=3?(0,Wh.default)(u,.7,!1):u,M=new Set;for(let C=0;C<b.length;C++)M.add(b[C].originalIndex);let m=[];for(let C of d)M.has(C)||m.push(C);let p=b.slice(),y=.25;for(let C of g){if(M.has(C))continue;let T=s.get(C);if(!T)continue;let P=-1;for(let I=0;I<p.length-1;I++)if(p[I].originalIndex<C&&p[I+1].originalIndex>C){P=I+1;break}if(P!==-1){let I={x:0,y:0,nodeId:T.properties.id,originalIndex:C};l(T.geometry.coordinates,I),p.splice(P,0,I)}}for(let C of m){let T=s.get(C);if(!T)continue;let P=-1;for(let I=0;I<p.length-1;I++)if(p[I].originalIndex<C&&p[I+1].originalIndex>C){P=I+1;break}if(P!==-1){let I={x:0,y:0,nodeId:T.properties.id,originalIndex:C};l(T.geometry.coordinates,I);let L=fa(I,p[P-1]),N=fa(I,p[P]);L<y?p[P-1]=I:N<y?p[P]=I:p.splice(P,0,I)}}let v=[],x={x:0,y:0},S={x:0,y:0},w=new Map;for(let C=0;C<p.length;C++)w.set(p[C].originalIndex,C);for(let C of d){let T=s.get(C);if(!T)continue;let P=h.get(C);if(!P)continue;let I=w.get(C)??-1;if(I!==-1){let L;I>0&&(L={x:p[I-1].x,y:p[I-1].y});let N=P.geoJSON.geometry.coordinates;l(N[0],x),l(N[1],S);let z=[x,S],j=T.properties.id,H=Dt(T)||"test-floor",Q=Vh(P,j,H,z,L,c);if(Q){let G={x:Q.entryMeters.x,y:Q.entryMeters.y,nodeId:Q.entryNode.properties.id,originalIndex:C-.5},J={x:Q.exitMeters.x,y:Q.exitMeters.y,nodeId:Q.exitNode.properties.id,originalIndex:C+.5};i.set(Q.entryNode.properties.id,Q.entryNode),i.set(Q.exitNode.properties.id,Q.exitNode),v.push(G,J)}}}if(p.push(...v),p.sort((C,T)=>C.originalIndex-T.originalIndex),r&&p.length>=3)for(let C=0;C<p.length-1;C++){let T=p[C];if(T.nodeId.endsWith("_buffer_exit")){let P=p[p.length-1];if(C<p.length-2){let I=!1;for(let L=C+1;L<p.length-1;L++)if(p[L].nodeId.endsWith("_buffer_entry")||p[L].nodeId.endsWith("_buffer_exit")){I=!0;break}if(!I){let L=i.get(T.nodeId),N=i.get(P.nodeId);if(L&&N){if(Dt(L)!==Dt(N))continue;if(nt(L,N,r,.1)){let z=p.length-C-2;p.splice(C+1,z)}}}}}}if(r&&p.length>=3){let C=p[0],T=-1;for(let P=1;P<p.length;P++)if(p[P].nodeId.endsWith("_buffer_entry")){T=P;break}if(T>1){let P=!1;for(let I=1;I<T;I++)if(p[I].nodeId.endsWith("_buffer_entry")||p[I].nodeId.endsWith("_buffer_exit")){P=!0;break}if(!P){let I=p[T],L=i.get(C.nodeId),N=i.get(I.nodeId);if(L&&N&&Dt(L)===Dt(N)){if(nt(L,N,r,.1)){let z=T-1;p.splice(1,z)}}}}}let D=[];for(let C=0;C<p.length-1;C++){let T=p[C],P=p[C+1],I=i.get(T.nodeId),L=i.get(P.nodeId);I&&L?D.push(new _e({origin:I,destination:L,distance:Ee(I.geometry.coordinates,L.geometry.coordinates),angle:xe(I.geometry.coordinates,L.geometry.coordinates),multiplicativeDistanceWeightScaling:t})):Hh.warn(`Origin or destination node not found for point ${T.nodeId} or ${P.nodeId}`)}return D}function De(n,e){return new _e({origin:n,destination:e,distance:Ee(n.geometry.coordinates,e.geometry.coordinates),angle:xe(n.geometry.coordinates,e.geometry.coordinates)})}function Zh(n,e,t,r=!0){if(n.length<3)return n;let o=new Set;for(let a=0;a<n.length;a++)if(n[a].origin.properties.preventSmoothing){if(o.add(a),r){for(let l=a-1;l>=0;l--)if(!n[l].origin.properties.preventSmoothing){o.add(l);break}}if(r){for(let l=a+1;l<n.length;l++)if(!n[l].origin.properties.preventSmoothing){o.add(l);break}}}if(n.length>0&&n[n.length-1].destination.properties.preventSmoothing&&(o.add(n.length-1),r)){for(let a=n.length-2;a>=0;a--)if(!n[a].origin.properties.preventSmoothing){o.add(a);break}}let i=[],s=0;for(let a=1;a<n.length;a++){let l=a===n.length-1,c=o.has(a),u=l?.05:.7,d=nt(n[s].origin,n[a].origin,e,u),h=n[a].origin.properties.preventSmoothing,g=a-1;if(c){s!==a&&(d?(i.push(De(n[s].origin,n[a].origin)),s=a):(s!==g&&(i.push(De(n[s].origin,n[g].origin)),s=g),s!==a&&(i.push(De(n[s].origin,n[a].origin)),s=a))),l&&i.push(De(n[a].origin,n[a].destination));continue}if(h)d?(i.push(De(n[s].origin,n[a].origin)),s=a):s!==g&&(i.push(De(n[s].origin,n[g].origin)),s=g),i.push(De(n[s].origin,n[a].origin)),s=a,l&&i.push(De(n[a].origin,n[a].destination));else if(d)l&&(nt(n[s].origin,n[a].destination,e,.7)?i.push(De(n[s].origin,n[a].destination)):(i.push(De(n[s].origin,n[a].origin)),i.push(De(n[a].origin,n[a].destination))),s=a);else{if(s===g){l&&(i.push(De(n[s].origin,n[a].origin)),i.push(De(n[a].origin,n[a].destination)));continue}i.push(De(n[s].origin,n[g].origin)),s=g,l&&(i.push(De(n[s].origin,n[a].origin)),i.push(De(n[a].origin,n[a].destination)))}}if(!1){let a=i[i.length-1];window.__DEBUG_PATH.finalSteps.push({nodeId:a.destination.properties.id,coordinate:a.destination.geometry.coordinates,floorId:Dt(a.destination)})}return i}f();function Xh(n,e,t=.2,r={},o){if(n.length<3)return n;let i=[n[0]],s=1;for(let a=s+2;a<n.length;a++)if("outdoors"in r&&us(n[s]?.origin?.properties?.flags??[],r.outdoors.index,r.outdoors.bit)||n[s].origin.properties.preventSmoothing||!nt(n[s].origin,n[a].origin,e,t)){let l=a-1;i.push(new _e({...n[s],destination:n[l].origin,distance:Ee(n[s].origin.geometry.coordinates,n[l].origin.geometry.coordinates),angle:xe(n[s].origin.geometry.coordinates,n[l].origin.geometry.coordinates)})),s=l}return i.push(new _e({...n[s],destination:n[n.length-1].origin,distance:Ee(n[s].origin.geometry.coordinates,n[n.length-1].origin.geometry.coordinates),angle:xe(n[s].origin.geometry.coordinates,n[n.length-1].origin.geometry.coordinates),multiplicativeDistanceWeightScaling:o}),n[n.length-1]),i}f();var Yh=lo(ml());function $h(n,e){let t=new Set;if(n.length<2)return t;let r=[n[0].origin];for(let b=0;b<n.length;b++)r.push(n[b].destination);let o=r[0].geometry.coordinates[1],{toCartesian:i}=ni(o),s=e;if(!s)return t;let a=r.map((b,M)=>{let m={x:0,y:0,nodeId:b.properties.id,originalIndex:M};return i(b.geometry.coordinates,m),m}),l=new Set,c=new Set;for(let b=0;b<a.length;b++)s(a[b].nodeId)&&(l.add(b),c.add(a[b].nodeId));if(l.size===0)return t;let u=a.length>=3?(0,Yh.default)(a,.7,!1):a,d=new Map;for(let b=0;b<u.length;b++)d.set(u[b].originalIndex,b);let h=new Set;for(let b of l){let M=d.get(b);if(M!==void 0){if(M>0){let m=u[M-1].nodeId;h.add(m)}if(M<u.length-1){let m=u[M+1].nodeId;h.add(m)}}else{let m,p;for(let y=0;y<u.length-1;y++){let v=u[y].originalIndex,x=u[y+1].originalIndex;if(v<b&&b<x){m=u[y].nodeId,p=u[y+1].nodeId;break}}m&&h.add(m),p&&h.add(p)}}let g=0;for(let b of n)h.has(b.origin.properties.id)&&(b.origin.properties.preventSmoothing||(b.origin.properties.preventSmoothing=!0,t.add(b.origin.properties.id))),h.has(b.destination.properties.id)&&(b.destination.properties.preventSmoothing||(b.destination.properties.preventSmoothing=!0,t.add(b.destination.properties.id))),g++;return t}f();f();var ds={accessible:"accessible",outdoors:"outdoors",public:"public"};f();f();function Wn(n,e,t=[]){let r={...n};for(let[o,i]of Object.entries(e))if(i!==void 0)if(o in r){let s=o;if(Array.isArray(i)&&i.length>0){let a=Ey(i[0],t);if(a){let l=r[s];if(!Array.isArray(l))throw new Error(`Expected array at ${o}, got ${typeof l}`);let c=new Map(i.map(h=>[qh(h,a),h])),d=l.map(h=>{let g=c.get(qh(h,a));return g?Wn(h,g,t):h});r[s]=d}else r[s]=i}else{let a=r[s];typeof a=="object"&&a!==null&&typeof i=="object"&&i!==null?Object.keys(i).length===0?r[s]=i:r[s]=Wn(a,i,t):r[o]=i}}else r[o]=i;return r}function Ey(n,e){function t(r){if(typeof r!="object"||r===null)return null;for(let o of e)if(o in r&&typeof r[o]<"u")return[o];if(Array.isArray(r))return null;for(let[o,i]of Object.entries(r)){let s=t(i);if(s)return[o,...s]}return null}return t(n)}function qh(n,e){return e.reduce((t,r)=>{if(t&&typeof t=="object")return t[r]},n)}f();var wy=n=>{if(n==="space"||n==="obstruction"||n==="entrance")return{}},Ty=/\.json|\.geojson$/,hs=(n,e,t)=>{let r=n[e];if(typeof r!="object"||Object.keys(r).length===0)return wy(e);let o={};for(let[i,s]of Object.entries(r)){let a=i.replace(Ty,"");o[a]=JSON.parse(t(s))}return o},Dy=["floorstack.json","styles.json","shapes.json","mapstack.json","floor.geojson","tileset.json","location.json","category.json","navigationFlags.json","annotation-symbols.json"],Py=Dy,Iy=["annotation","textAreas","enterprise","floorImages","shapeInstances","modelInstances","window","area","facade"],Oy=Iy,Ly=n=>{let e=new TextDecoder("utf-8"),t=e.decode.bind(e),r={"manifest.geojson":JSON.parse(t(n["manifest.geojson"])),"mapstack.geojson":JSON.parse(t(n["mapstack.geojson"])),"map.geojson":JSON.parse(t(n["map.geojson"])),"node.geojson":JSON.parse(t(n["node.geojson"])),"connection.json":JSON.parse(t(n["connection.json"])),space:hs(n,"space",t),obstruction:hs(n,"obstruction",t),entrance:hs(n,"entrance",t)};for(let o of Py)n[o]&&(r[o]=JSON.parse(t(n[o])));for(let o of Oy)n[o]&&(r[o]=hs(n,o,t));return r};f();f();f();var jn=["agriculture","airport","casino","city-district","convention-center","entertainment","event-centre","first-responder-building","government-building","grocery-store","healthcare","higher-education","hotel","library","manufacturing","medical-centre","mixed-use","multifamily","museum","office-building","oil-and-energy","other","parking-facility","religious-institution","resort","retail-store","schools-k-12","shopping-mall","stadium-or-arena","storage-facility","theme-park","transit","transportation-hub","warehousing"],Ay=[...jn,"unknown"],fl=Object.freeze(Object.fromEntries([...jn,"unknown"].map(n=>[n,n])));f();var Zn=["reference-point","checkpoint","checkpoint-passport","parent"],Ry=[...Zn,"unknown"],_y=Object.freeze(Object.fromEntries([...Zn,"unknown"].map(n=>[n,n])));var Xn=["closed-temporarily","new","pop-up","coming-soon","relocated"],Fy=[...Xn,"unknown"],Ny=Object.freeze(Object.fromEntries([...Xn,"unknown"].map(n=>[n,n])));f();var Yn=["left","center","right"],By=[...Yn,"unknown"],Gy=Object.freeze(Object.fromEntries([...Yn,"unknown"].map(n=>[n,n])));f();var $n=["near","center"],ky=[...$n,"unknown"],zy=Object.freeze(Object.fromEntries([...$n,"unknown"].map(n=>[n,n])));f();var qn=["top","side"],Uy=[...qn,"unknown"],Hy=Object.freeze(Object.fromEntries([...qn,"unknown"].map(n=>[n,n])));var Jn=["inside","outside","both"],Vy=[...Jn,"unknown"],Wy=Object.freeze(Object.fromEntries([...Jn,"unknown"].map(n=>[n,n])));f();var ps=["elevator","escalator","travelator","stairs","door","ramp","ladder"],$2=[...ps,"unknown"],gl=Object.freeze(Object.fromEntries([...ps,"unknown"].map(n=>[n,n])));f();var ms=["room","hallway","wall","object","poi","area","window"],K2=[...ms,"unknown"],Q2=Object.freeze(Object.fromEntries([...ms,"unknown"].map(n=>[n,n])));f();f();var fs=class{_value;constructor(e){this._value=e}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let e=this._value;return this._value=null,{done:!1,value:e}}},gs=class{_tag="Some";_value;constructor(e){this._value=e}get value(){return this._value}isSome(){return!0}isSomeAnd(e){return e(this.value)}isNone(){return!1}equals(e){return e.isSome()&&e.value===this.value}expect(e){return this.value}unwrap(){return this.value}unwrapOr(e){return this.value}unwrapOrElse(e){return this.value}inspect(e){return e(this.value),this}inspectNone(e){return this}map(e){return Jh(e(this.value))}mapAsync(e){return e(this.value).then(t=>Jh(t))}mapOr(e,t){return this.map(e).unwrapOr(t)}mapOrAsync(e,t){return this.mapAsync(e).then(r=>r.unwrapOr(t))}mapOrElse(e,t){return this.map(e).unwrapOrElse(t)}mapOrElseAsync(e,t){return this.mapAsync(e).then(r=>r.unwrapOrElse(t))}and(e){return e}andThen(e){return e(this.value)}andThenAsync(e){return e(this.value)}filter(e){return e(this.value)?this:Jt()}or(e){return this}orElse(e){return this}xor(e){return e.isSome()?Jt():this}toString(){return`Some(${this.value})`}okOr(e){return dt(this.value)}okOrElse(e){return dt(this.value)}iter(){return new fs(this.value)}[Symbol.iterator](){return this.iter()}zip(e){return e.isSome()?Qr([this.value,e.value]):Jt()}zipWith(e,t){return e.isSome()?Qr(t(this.value,e.value)):Jt()}get[Symbol.toStringTag](){return"Some"}},ys=class{_tag="None";get value(){return null}isSome(){return!1}isSomeAnd(e){return!1}isNone(){return!0}equals(e){return e.isNone()}expect(e){throw new Error(e)}unwrap(){throw new Error("Tried to unwrap a None value!")}unwrapOr(e){return e}unwrapOrElse(e){return e()}inspect(e){return this}inspectNone(e){return e(),this}map(e){return this}mapAsync(e){return Promise.resolve(this)}mapOr(e,t){return t}mapOrAsync(e,t){return Promise.resolve(t)}mapOrElse(e,t){return t()}mapOrElseAsync(e,t){return t()}and(e){return this}andThen(e){return this}andThenAsync(e){return Promise.resolve(this)}filter(e){return this}or(e){return e}orElse(e){return e()}xor(e){return e}toString(){return"None"}okOr(e){return Cr(e)}okOrElse(e){return Cr(e())}iter(){return new fs(null)}[Symbol.iterator](){return this.iter()}zip(e){return this}zipWith(e,t){return this}get[Symbol.toStringTag](){return"None"}},Qr=n=>new gs(n),Jt=()=>new ys,Jh=n=>n instanceof gs||n instanceof ys?n:n==null?Jt():Qr(n);var bs=class{_value;constructor(e){this._value=e}[Symbol.iterator](){return this}next(){if(this._value==null)return{done:!0,value:void 0};let e=this._value;return this._value=null,{done:!1,value:e}}},yl=class{_tag="Ok";_value;constructor(e){this._value=e}get value(){return this._value}get error(){return null}isOk(){return!0}isOkAnd(e){return e(this.value)}isErr(){return!1}isErrAnd(e){return!1}ok(){return Qr(this.value)}err(){return Jt()}expect(e){return this.value}expectErr(e){throw new Error(e)}unwrap(){return this.value}unwrapOr(e){return this.value}unwrapOrElse(e){return this.value}inspect(e){return e(this.value),this}inspectErr(){return this}map(e){return dt(e(this.value))}async mapAsync(e){return e(this.value).then(dt)}mapOr(e,t){return e(this.value)}async mapOrAsync(e,t){return e(this.value)}mapOrElse(e,t){return e(this.value)}async mapOrElseAsync(e,t){return e(this.value)}mapErr(e){return this}iter(){return new bs(this.value)}[Symbol.iterator](){return this.iter()}and(e){return e}andThen(e){return e(this.value)}or(e){return this}orElse(e){return this}async andThenAsync(e){return e(this.value)}toString(){return`Ok(${this.value})`}get[Symbol.toStringTag](){return"Ok"}},bl=class n{_tag="Err";_error;constructor(e){this._error=e}get value(){return null}get error(){return this._error}isOk(){return!1}isOkAnd(e){return!1}isErr(){return!0}isErrAnd(e){return e(this.error)}ok(){return Jt()}err(){return Qr(this.error)}expect(e){throw new Error(e)}expectErr(e){return this.error}unwrap(){throw this.error}unwrapOr(e){return e}unwrapOrElse(e){return e()}inspect(){return this}inspectErr(e){return e(this.error),this}map(e){return this}iter(){return new bs(null)}[Symbol.iterator](){return this.iter()}async mapAsync(e){return this}mapOr(e,t){return t}async mapOrAsync(e,t){return t}mapOrElse(e,t){return t()}async mapOrElseAsync(e,t){return t()}mapErr(e){return new n(e(this.error))}and(e){return this}andThen(e){return this}async andThenAsync(e){return this}or(e){return e}orElse(e){return e(this.error)}toString(){return`Err(${this.error})`}get[Symbol.toStringTag](){return"Err"}},dt=n=>new yl(n),Cr=n=>new bl(n);f();var We=Uint8Array,en=Uint16Array,jy=Int32Array,Kh=new We([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]),Qh=new We([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]),Zy=new We([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),ep=function(n,e){for(var t=new en(31),r=0;r<31;++r)t[r]=e+=1<<n[r-1];for(var o=new jy(t[30]),r=1;r<30;++r)for(var i=t[r];i<t[r+1];++i)o[i]=i-t[r]<<5|r;return{b:t,r:o}},tp=ep(Kh,2),rp=tp.b,Xy=tp.r;rp[28]=258,Xy[258]=28;var np=ep(Qh,0),Yy=np.b,l3=np.r,Ml=new en(32768);for(q=0;q<32768;++q)Pt=(q&43690)>>1|(q&21845)<<1,Pt=(Pt&52428)>>2|(Pt&13107)<<2,Pt=(Pt&61680)>>4|(Pt&3855)<<4,Ml[q]=((Pt&65280)>>8|(Pt&255)<<8)>>1;var Pt,q,Kn=(function(n,e,t){for(var r=n.length,o=0,i=new en(e);o<r;++o)n[o]&&++i[n[o]-1];var s=new en(e);for(o=1;o<e;++o)s[o]=s[o-1]+i[o-1]<<1;var a;if(t){a=new en(1<<e);var l=15-e;for(o=0;o<r;++o)if(n[o])for(var c=o<<4|n[o],u=e-n[o],d=s[n[o]-1]++<<u,h=d|(1<<u)-1;d<=h;++d)a[Ml[d]>>l]=c}else for(a=new en(r),o=0;o<r;++o)n[o]&&(a[o]=Ml[s[n[o]-1]++]>>15-n[o]);return a}),Qn=new We(288);for(q=0;q<144;++q)Qn[q]=8;var q;for(q=144;q<256;++q)Qn[q]=9;var q;for(q=256;q<280;++q)Qn[q]=7;var q;for(q=280;q<288;++q)Qn[q]=8;var q,op=new We(32);for(q=0;q<32;++q)op[q]=5;var q;var $y=Kn(Qn,9,1);var qy=Kn(op,5,1),vl=function(n){for(var e=n[0],t=1;t<n.length;++t)n[t]>e&&(e=n[t]);return e},ot=function(n,e,t){var r=e/8|0;return(n[r]|n[r+1]<<8)>>(e&7)&t},xl=function(n,e){var t=e/8|0;return(n[t]|n[t+1]<<8|n[t+2]<<16)>>(e&7)},Jy=function(n){return(n+7)/8|0},El=function(n,e,t){return(e==null||e<0)&&(e=0),(t==null||t>n.length)&&(t=n.length),new We(n.subarray(e,t))};var Ky=["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"],Ke=function(n,e,t){var r=new Error(e||Ky[n]);if(r.code=n,Error.captureStackTrace&&Error.captureStackTrace(r,Ke),!t)throw r;return r},Qy=function(n,e,t,r){var o=n.length,i=r?r.length:0;if(!o||e.f&&!e.l)return t||new We(0);var s=!t,a=s||e.i!=2,l=e.i;s&&(t=new We(o*3));var c=function(Xe){var ft=t.length;if(Xe>ft){var Se=new We(Math.max(ft*2,Xe));Se.set(t),t=Se}},u=e.f||0,d=e.p||0,h=e.b||0,g=e.l,b=e.d,M=e.m,m=e.n,p=o*8;do{if(!g){u=ot(n,d,1);var y=ot(n,d+1,3);if(d+=3,y)if(y==1)g=$y,b=qy,M=9,m=5;else if(y==2){var w=ot(n,d,31)+257,D=ot(n,d+10,15)+4,C=w+ot(n,d+5,31)+1;d+=14;for(var T=new We(C),P=new We(19),I=0;I<D;++I)P[Zy[I]]=ot(n,d+I*3,7);d+=D*3;for(var L=vl(P),N=(1<<L)-1,z=Kn(P,L,1),I=0;I<C;){var j=z[ot(n,d,N)];d+=j&15;var v=j>>4;if(v<16)T[I++]=v;else{var H=0,Q=0;for(v==16?(Q=3+ot(n,d,3),d+=2,H=T[I-1]):v==17?(Q=3+ot(n,d,7),d+=3):v==18&&(Q=11+ot(n,d,127),d+=7);Q--;)T[I++]=H}}var G=T.subarray(0,w),J=T.subarray(w);M=vl(G),m=vl(J),g=Kn(G,M,1),b=Kn(J,m,1)}else Ke(1);else{var v=Jy(d)+4,x=n[v-4]|n[v-3]<<8,S=v+x;if(S>o){l&&Ke(0);break}a&&c(h+x),t.set(n.subarray(v,S),h),e.b=h+=x,e.p=d=S*8,e.f=u;continue}if(d>p){l&&Ke(0);break}}a&&c(h+131072);for(var ne=(1<<M)-1,je=(1<<m)-1,ye=d;;ye=d){var H=g[xl(n,d)&ne],be=H>>4;if(d+=H&15,d>p){l&&Ke(0);break}if(H||Ke(2),be<256)t[h++]=be;else if(be==256){ye=d,g=null;break}else{var pt=be-254;if(be>264){var I=be-257,Ze=Kh[I];pt=ot(n,d,(1<<Ze)-1)+rp[I],d+=Ze}var Qe=b[xl(n,d)&je],mt=Qe>>4;Qe||Ke(3),d+=Qe&15;var J=Yy[mt];if(mt>3){var Ze=Qh[mt];J+=xl(n,d)&(1<<Ze)-1,d+=Ze}if(d>p){l&&Ke(0);break}a&&c(h+131072);var et=h+pt;if(h<J){var It=i-J,Fe=Math.min(J,et);for(It+h<0&&Ke(3);h<Fe;++h)t[h]=r[It+h]}for(;h<et;++h)t[h]=t[h-J]}}e.l=g,e.p=ye,e.b=h,e.f=u,g&&(u=1,e.m=M,e.d=b,e.n=m)}while(!u);return h!=t.length&&s?El(t,0,h):t.subarray(0,h)};var eb=new We(0);var ht=function(n,e){return n[e]|n[e+1]<<8},it=function(n,e){return(n[e]|n[e+1]<<8|n[e+2]<<16|n[e+3]<<24)>>>0},Sl=function(n,e){return it(n,e)+it(n,e+4)*4294967296};function tb(n,e){return Qy(n,{i:2},e&&e.out,e&&e.dictionary)}var Cl=typeof TextDecoder<"u"&&new TextDecoder,rb=0;try{Cl.decode(eb,{stream:!0}),rb=1}catch{}var nb=function(n){for(var e="",t=0;;){var r=n[t++],o=(r>127)+(r>223)+(r>239);if(t+o>n.length)return{s:e,r:El(n,t-1)};o?o==3?(r=((r&15)<<18|(n[t++]&63)<<12|(n[t++]&63)<<6|n[t++]&63)-65536,e+=String.fromCharCode(55296|r>>10,56320|r&1023)):o&1?e+=String.fromCharCode((r&31)<<6|n[t++]&63):e+=String.fromCharCode((r&15)<<12|(n[t++]&63)<<6|n[t++]&63):e+=String.fromCharCode(r)}};function wl(n,e){if(e){for(var t="",r=0;r<n.length;r+=16384)t+=String.fromCharCode.apply(null,n.subarray(r,r+16384));return t}else{if(Cl)return Cl.decode(n);var o=nb(n),i=o.s,t=o.r;return t.length&&Ke(8),i}}var ob=function(n,e){return e+30+ht(n,e+26)+ht(n,e+28)},ib=function(n,e,t){var r=ht(n,e+28),o=wl(n.subarray(e+46,e+46+r),!(ht(n,e+8)&2048)),i=e+46+r,s=it(n,e+20),a=t&&s==4294967295?sb(n,i):[s,it(n,e+24),it(n,e+42)],l=a[0],c=a[1],u=a[2];return[ht(n,e+10),l,c,o,i+ht(n,e+30)+ht(n,e+32),u]},sb=function(n,e){for(;ht(n,e)!=1;e+=4+ht(n,e+2));return[Sl(n,e+12),Sl(n,e+4),Sl(n,e+20)]};function ip(n,e){for(var t={},r=n.length-22;it(n,r)!=101010256;--r)(!r||n.length-r>65558)&&Ke(13);var o=ht(n,r+8);if(!o)return{};var i=it(n,r+16),s=i==4294967295||o==65535;if(s){var a=it(n,r-12);s=it(n,a)==101075792,s&&(o=it(n,a+32),i=it(n,a+48))}for(var l=e&&e.filter,c=0;c<o;++c){var u=ib(n,i,s),d=u[0],h=u[1],g=u[2],b=u[3],M=u[4],m=u[5],p=ob(n,m);i=M,(!l||l({name:b,size:h,originalSize:g,compression:d}))&&(d?d==8?t[b]=tb(n.subarray(p,p+h),{out:new We(g)}):Ke(14,"unknown compression type "+d):t[b]=El(n,p,p+h))}return t}f();f();f();f();var ge=n=>Object.entries(n);f();var eo=n=>Object.keys(n);function sp(n){return n.replace(/^g_/,"s_")}function vs(n){return n.replace(/^g_/,"o_")}function ab(n){return n.replace(/^g_/,"w_")}function ap(n){return n.replace(/^loci_/,"eli_")}function to(n){return n.replace(/^loc_/,"el_")}function xs(n){return n.replace(/^lcat_/,"ec_")}function lb(n){return n.replace(/^g_/,"ar_")}function lp(n){return n.replace(/^n_/,"s_")}function cb(n,e,t){switch(n.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":{let r=[],o=0,i=n.geometry.type.replace("Multi","");for(let s of n.geometry.coordinates)r.push({...n,geometry:{type:i,coordinates:s},properties:{...n.properties,id:`${e}-${o++}`,kind:t}});return r}default:return[{...n,properties:{...n.properties,id:e,kind:t}}]}}function tn(n,e,t,r){let o=new Map;for(let{feature:i,floorId:s}of n){let a=i.properties.id,l=r.get(a);if(e.has(a)){let c=cb(i,t(a),l),u=c.map(h=>h.properties.id),d=u.map(h=>({geometryId:h,floorId:s}));o.set(a,{ids:u,features:c,anchors:d})}}return o}function cp(n){let e={space:new Map,obstruction:new Map,area:new Map,window:new Map,object:new Map};if(!n.geometry)return e;let t=ub(n),r=ge(n.geometry).flatMap(([c,u])=>(u?.features??[]).map(d=>({feature:d,floorId:c}))).flat(),o=new Set(Object.values(n.walkable??{}).filter(c=>c!==void 0).flatMap(eo)),i=new Set(Object.values(n.nonwalkable??{}).filter(c=>c!==void 0).flatMap(eo)),s=new Set(Array.from(t.entries()).filter(([c,u])=>u==="area").map(([c])=>c)),a=new Set(Array.from(t.entries()).filter(([c,u])=>u==="object").map(([c])=>c)),l=new Set(Array.from(t.entries()).filter(([c,u])=>u==="window").map(([c])=>c));return o.size>0&&(e.space=tn(r,o,sp,t)),i.size>0&&(e.obstruction=tn(r,i,vs,t)),s.size>0&&(e.area=tn(r,s,lb,t)),a.size>0&&(e.object=tn(r,a,vs,t)),l.size>0&&(e.window=tn(r,l,ab,t)),o.size===0&&i.size===0&&s.size===0&&(e.space=tn(r,new Set(r.map(c=>c.feature.properties.id)),sp,t)),e}function ub(n){let e=new Map(Object.values(n.kinds??{}).filter(t=>t!==void 0).flatMap(ge));for(let t of n.connections?.filter(r=>r.type!=="door")??[]){for(let r of t.entrances)e.set(r.geometryId,`connection.${t.type}`);for(let r of t.exits)e.set(r.geometryId,`connection.${t.type}`)}return e}function up(n){if(!n||n.length===0)return[];let e=Math.max(...n.map(t=>t.length));return n.reduce((t,r)=>t.map((o,i)=>o|(r[i]??0)),Array(e).fill(0))}function dp(n){let{nodesByGeometryId:e,incomingEdgesByNodeId:t,nodesById:r}=db(n),o=cp(n),i=hb(n),s=n.navigationFlags??{};return{geometryMaps:o,nodesByGeometryId:e,geometryFeatureById:i,navigationFlags:s,incomingEdgesByNodeId:t,nodesById:r}}function db(n){let e=new Map,t=new Map,r=new Map;for(let o of Object.values(n.nodes??{}))for(let i of o?.features??[]){if(r.set(i.properties.id,i),i.properties.geometryIds.length>0)for(let s of i.properties.geometryIds){let a=e.get(s)??[];a.push(i.properties.id),e.set(s,a)}if(i.properties.neighbors.length>0)for(let s of i.properties.neighbors){let a=t.get(s.id);a!=null?a.push(s):t.set(s.id,[s])}}return{nodesByGeometryId:e,incomingEdgesByNodeId:t,nodesById:r}}function hb(n){let e=new Map;for(let t of Object.values(n.geometry??{}))for(let r of t?.features??[])e.set(r.properties.id,r);return e}f();function hp(n,e){if(!n.annotations||!n.annotationSymbols||!n.geometry)return{};let t={};for(let[r,o]of ge(n.annotations)){if(!o||o.length===0||!n.geometry[r]||n.geometry[r].features.length===0)continue;let i=new Map(n.geometry[r].features.map(a=>[a.properties.id,a])),s={type:"FeatureCollection",features:[]};for(let a of o){let l=i.get(a.geometryId);if(!l||l.geometry.type!=="Point")continue;let c={id:a.id,externalId:a.externalId,symbolId:a.symbolKey};s.features.push({type:"Feature",geometry:l.geometry,properties:c})}t[r]=s}return{annotation:t}}f();f();function Er(n,e){return e&&(n.flags[e.index]&1<<e.bit)!==0}f();var Tl={accessible:"accessible",outdoors:"outdoors",public:"public"};function pp(n,{nodesByGeometryId:e}){let t={"connection.json":[],entrance:{}},r=n.navigationFlags?.[Tl.accessible],o=n.navigationFlags?.[Tl.outdoors],i=new Map(Object.values(n.geometry??{}).flatMap(s=>s?.features??[]).map(s=>[s.properties.id,s]));for(let s of n.connections??[]){if(Dl(s,i)&&!pb(s)){let d=mb(s,i,e,o);for(let[h,g]of d)t.entrance[h]||(t.entrance[h]={type:"FeatureCollection",features:[]}),t.entrance[h].features.push(g);continue}let a=r!=null&&s.entrances.some(d=>Er(d,r))&&s.exits.some(d=>Er(d,r)),l=Array.from(new Set([...s.entrances.map(d=>e.get(d.geometryId)),...s.exits.map(d=>e.get(d.geometryId))].flat().filter(d=>d!=null))),c=up([...s.entrances.map(d=>d.flags),...s.exits.map(d=>d.flags)]),u={id:s.id,externalId:s.details?.externalId??"",type:s.type,accessible:a,nodes:l,flags:c};s.details?.name&&(u.details={name:s.details.name}),s.extra&&(u.extra=s.extra),t["connection.json"].push(u)}return t}function Dl(n,e){return n.type==gl.door&&n.entrances.every(t=>e.get(t.geometryId)?.geometry.type==="LineString")}function pb(n){return n.entrances.length===0||n.exits.length===0?!1:new Set([...n.entrances.map(t=>t.floorId),...n.exits.map(t=>t.floorId)]).size>=2}function mb(n,e,t,r){if(n.type!==gl.door)return[];let o=[];for(let i of n.entrances){let s=e.get(i.geometryId);if(s?.geometry.type==="LineString"){let a={type:"Feature",geometry:s.geometry,properties:{id:n.id,externalId:n.details?.externalId??"",isExterior:fb(n,r)}},l=n.details;l&&(a.properties.details={name:l.name,description:l.description},l.icon&&(a.properties.details.images=[{url:l.icon,altText:`${l.name} icon`}]));let c=t.get(i.geometryId);c&&c.length>0&&(a.properties.node=c[0]),o.push([i.floorId,a])}}return o}function fb(n,e){return n.entrances.some(t=>Er(t,e))||n.exits.some(t=>Er(t,e))}f();function fp(n,{geometryMaps:e,nodesByGeometryId:t}){let r={categories:[],locations:[],locationInstances:[],layers:[],venue:{slug:"",name:"",externalId:"",defaultLanguage:{name:"English",code:"en"},languages:[]}},o=n.manifest?.features[0];o&&(r.venue.defaultFloor=o.properties.defaultFloor,r.venue.tzid=o.properties.tzid,r.venue.name=o.properties.name,r.venue.defaultLanguage={name:o.properties.language??"English",code:o.properties.language??"en"});let i=n.cms?.venue;i&&(r.venue={...r.venue,slug:i.slug,name:i.details?.name??r.venue.name??o.properties.name,externalId:i.details?.externalId??"",defaultLanguage:i.defaultLanguage,languages:i.languages??[],countrycode:i.countrycode,coverImage:i.coverImage,logo:i.logo,icon:i.details?.icon,extra:i.extra,mappedinWebUrl:i.mappedinWebUrl,operationHours:i.operationHours,topLocations:i.topLocations,type:i.type&&i.type in fl?i.type:"unknown",propertyImage:i.propertyImage});let s=new Map,a=n.locations??[],l=n.cms?.locations??[],c=n.cms?.categories??[],u=new Map((c??[]).map(v=>[v.categoryId,v]));if(a.length>0){let v=new Map(l.map(x=>[x.locationId,x]));for(let x of a){let S=v.get(x.id)??{};if(x){let w=x.details,D={id:S?.cmsId!==void 0?`el_${S?.cmsId}`:to(x.id),name:w.name,externalId:w.externalId??"",type:S.type??"location",sortOrder:S.sortOrder??0,amenity:S.amenity,description:w.description,extra:x.extra,links:x.links,operationHours:x.openingHours,gallery:S.gallery,logo:x.logo,shortName:w.shortName,picture:S.picture,showFloatingLabelWhenImagePresent:S.showFloatingLabelWhenImagePresent,showLogo:S.showLogo,siblingGroups:S.siblingGroups,states:S.states,tags:S.tags,spaces:[],nodes:[],polygons:[],headerImage:S.headerImage};if(x.phone&&(D.phone={number:x.phone}),S.primaryCategory){let T=u.get(S.primaryCategory);T&&(D.primaryCategory=T.id)}let C=mp(x.social);x.website&&(C.website=x.website.url),D.social=C;for(let T of x.geometryAnchors){let P=e.space.get(T.geometryId),I=e.obstruction.get(T.geometryId),L=P??I;if(L){let z=new Set(L.features.filter(j=>j.geometry.type==="Polygon").map(j=>j.properties.id));for(let j of L.anchors)P!=null&&L===P&&D.spaces.push({floor:j.floorId,id:j.geometryId}),z.has(j.geometryId)&&D.polygons.push({map:j.floorId,id:j.geometryId})}let N=t.get(T.geometryId);for(let z of N??[])D.nodes.push({map:T.floorId,id:z})}r.locations.push(D);for(let T of x.categories)s.set(T,[...s.get(T)??[],x.id])}}}let d=n.cms?.locationInstances??[],h=n.locationInstances;if(h){let v=new Map(d.map(S=>[S.locationInstanceId,S])),x=[];for(let S of h){let w=v.get(S.id)??{};if(S){let D={id:ap(S.id),parent:w.parentId??to(S.parentId),name:S.details?.name,externalId:S.details?.externalId,type:w.type,sortOrder:w.sortOrder,amenity:w.amenity,description:S.details?.description,extra:S.extra,links:S.links,operationHours:S.openingHours,gallery:w.gallery,picture:w.picture,showFloatingLabelWhenImagePresent:w.showFloatingLabelWhenImagePresent,showLogo:w.showLogo,siblingGroups:w.siblingGroups,states:w.states,tags:w.tags,logo:S.logo,shortName:S.details?.shortName,headerImage:w.headerImage};S.phone&&(D.phone={number:S.phone});let C=mp(S.social??[]);if(S.website&&(C.website=S.website.url),Object.keys(C).length>0&&(D.social=C),S.geometryAnchors?.length){let T=S.geometryAnchors.flatMap(P=>e.space.get(P.geometryId)?.anchors??[]);T.length>0&&(D.spaces=T.map(P=>({floor:P.floorId,id:P.geometryId})))}if(S.geometryAnchors){D.spaces=[],D.polygons=[],D.nodes=[];for(let T of S.geometryAnchors){let P=e.space.get(T.geometryId);if(P){let L=new Set(P.features.filter(N=>N.geometry.type==="Polygon").map(N=>N.properties.id));for(let N of P.anchors)D.spaces.push({floor:N.floorId,id:N.geometryId}),L.has(N.geometryId)&&D.polygons.push({map:N.floorId,id:N.geometryId})}let I=t.get(T.geometryId);for(let L of I??[])D.nodes.push({map:T.floorId,id:L})}}x.push(D)}}x.length>0&&(r.locationInstances=x)}let g=n.locationCategories;if(g){let v=[],x=new Map(g.map(C=>[C.id,C])),S=new Map((c??[]).map(C=>[C.categoryId,C])),w=new Map;for(let C of g){let T=x.get(C.parent);if(T){let P=w.get(T.id)??[];P.push(C.id),w.set(T.id,P)}}for(let C of g){let T=S.get(C.id);if(C){let P=(w.get(C.id)??[]).map(xs),I={id:xs(C.id),name:C.details.name,externalId:C.details.externalId??"",sortOrder:T?.sortOrder??0,children:P,locations:(s.get(C.id)??[]).map(to),icon:C.details.icon,picture:T?.picture,color:T?.color,extra:C.extra,iconFromDefaultList:T?.iconFromDefaultList};v.push(I)}}r.categories=v;let D={};for(let C of a)D[to(C.id)]=C.categories.map(xs).filter(T=>T!==void 0);r.categoryPriorities=D}let b={};for(let[v,x]of Object.entries(n.defaultStyle??{}))if(x.buffer){let S=x.geometryAnchors.flatMap(w=>e.space.get(w.geometryId)?.anchors??[]);b[v]={edgeOffset:x.buffer,geometryAnchors:S}}Object.keys(b).length>0&&(r.enterpriseStyles=b);let M=new Map;for(let v of Object.values(n.cms?.layers??{}))if(v)for(let[x,S]of ge(v)){if(typeof S!="string")continue;let w=M.get(S)??{name:S,id:`ely_${S}`,spaces:[]};w.spaces.push(...e.space.get(x)?.anchors.map(D=>({floorId:D.floorId,spaceId:D.geometryId}))??[]),M.set(S,w)}M.size>0&&(r.layers=Array.from(M.values()));let m=[];for(let v of Object.values(n.cms?.textures??{}))for(let x of v){let S=e.space.get(x.geometryId)?.anchors;!S||S.length<1||x.face==="unknown"||x.surface==="unknown"||m.push({repeat:x.repeat,offset:x.offset,rotation:x.rotation,path:x.path,face:x.face,surface:x.surface,bounds:x.bounds,geometryAnchors:S})}m.length>0&&(r.textures=m);let p={};for(let[v,x]of Object.entries(n.cms?.floorText??{})){let S={type:"FeatureCollection",features:[]};for(let w of x.features){if(w.properties.align==="unknown")continue;let D={align:w.properties.align,color:w.properties.color,fontFamily:w.properties.fontFamily,fontSize:w.properties.fontSize,rotation:w.properties.rotation,text:w.properties.text,visible:w.properties.visible};"geometryId"in w.properties?D.geometryId=w.properties.geometryId:D.verticalOffset=w.properties.verticalOffset,S.features.push({type:"Feature",geometry:w.geometry,properties:D})}S.features.length>0&&(p[v]=S)}Object.keys(p).length>0&&(r.floorText=p);let y={enterprise:r};if(n.cms?.textAreas){let v={};for(let[x,S]of ge(n.cms.textAreas)){let w={type:"FeatureCollection",features:[]};for(let D of S.features){if(D.properties.align==="unknown")continue;let C={align:D.properties.align,maxWidth:D.properties.maxWidth,maxHeight:D.properties.maxHeight,rotation:D.properties.rotation};"geometryId"in D.properties?C.anchorId=D.properties.geometryId:C.verticalOffset=D.properties.verticalOffset;let T={type:"Feature",geometry:D.geometry,properties:C};w.features.push(T)}v[x]=w}y.textAreas=v}return y}var gb=["facebook","instagram","twitter"];function mp(n){let e={};for(let{name:t,url:r}of n){let o=t.toLowerCase();gb.includes(o)&&(e[o]=r)}return e}f();var yb=n=>`fc_${n.slice(3)}`;function gp(n,{geometryMaps:e}){if(!n.facade)return{};let t={},r={};for(let[o,i]of ge(n.facade))if(i)for(let s of Object.values(i)){let{floorStackId:a,geometryIds:l}=s,c=yb(a);r[a]??={id:c,spaces:[]},r[a].spaces.push(...l.map(u=>({floorId:o,spaceId:e.space.get(u)?.ids[0]??""})))}return Object.keys(r).length>0&&(t.facade=r),t}f();function yp(n,e={}){let t={type:"FeatureCollection",features:[]},r=[];for(let o of n.floors.features)r.push({id:o.properties.id,externalId:o.properties.details?.externalId??"",elevation:o.properties.elevation,name:o.properties.details?.name??"",shortName:o.properties.details?.shortName??"",subtitle:o.properties.subtitle,maxHeight:o.properties.maxHeight}),t.features.push({type:"Feature",geometry:o.geometry,properties:{id:o.properties.id,externalId:o.properties.details?.externalId??"",elevation:o.properties.elevation,name:o.properties.details?.name??"",shortName:o.properties.details?.shortName??"",subtitle:o.properties.subtitle,maxHeight:o.properties.maxHeight}});return{"floor.geojson":t,"map.geojson":r}}f();function bp(n,{geometryMaps:e}){let t={},r={};for(let[o,i]of ge(n.floorImages??{})){let s={features:[],type:"FeatureCollection"};for(let a of i?.features??[])if("verticalOffset"in a.properties)s.features.push(a);else{let{geometryId:l,...c}=a.properties,u=e.space.get(l)?.ids[0]??e.obstruction.get(l)?.ids[0];if(!u)continue;let d={geometry:a.geometry,properties:{...c,anchorId:u},type:a.type};s.features.push(d)}r[o]=s}return Object.keys(r).length>0&&(t.floorImages=r),t}f();function vp(n,e={}){let t=[];for(let o of n?.floorStacks??[]){let i={id:o.id,floors:o.floors,maps:o.floors,externalId:o.details?.externalId??"",name:o.details?.name??"",shortName:o.details?.shortName??"",type:"Building"};o.defaultFloor&&(i.defaultFloor=o.defaultFloor),t.push(i)}if(n.outdoors&&n.outdoors.floors.length>0){let o={id:"outdoors",floors:n.outdoors.floors,maps:n.outdoors.floors,type:"Outdoor",name:"Outdoors",externalId:"outdoors"};t.push(o)}return{"floorstack.json":t,"mapstack.geojson":t}}f();f();var Cp=lo(Mp(),1),Mb=n=>{let e=n.geometry.coordinates[0],t=0;for(let r=0;r<e.length-1;r++)t+=e[r][0]*e[r+1][1]-e[r+1][0]*e[r][1];return Math.abs(t/2)},Cb=(n,e)=>{let[t,r]=n,o=e.geometry.coordinates[0],i=!1;for(let s=0,a=o.length-1;s<o.length;a=s++){let[l,c]=o[s],[u,d]=o[a];c>r!=d>r&&t<(u-l)*(r-c)/(d-c)+l&&(i=!i)}return i},Eb=n=>{let e=n.geometry.coordinates[0],t=0,r=0;for(let o=0;o<e.length-1;o++)t+=e[o][0],r+=e[o][1];return{geometry:{coordinates:[t/(e.length-1),r/(e.length-1)]}}},wb=n=>{let e=Mb(n),t=Number.isFinite(e)?Math.max(e,1):1;return Math.sqrt(t)*1e-6},Ms=n=>{try{let t=Eb(n).geometry.coordinates;if(!Cb(t,n)){let o=(0,Cp.default)(n.geometry.coordinates,wb(n));return dt([o[0],o[1]])}return dt(t)}catch{return Cr(new Error("Unable to calculate center of polygon"))}};function Ll(n){return n?.geometry?.type==="Polygon"}function wp(n,{geometryMaps:e,nodesByGeometryId:t,nodesById:r}){let o=Ib(n.defaultStyle),i={},s={},a={},l={};for(let u of eo(n.geometry)){let d=n.geometry[u];if(!d)continue;let h=[],g=[],b=[],M=[];for(let m of d.features){let p=m.properties.id,y=o.has(p),v=t.get(p)??[];for(let x of e.space.get(p)?.features??[])h.push(Ep(x,v));for(let x of e.obstruction.get(p)?.features??[])if(g.push(Tb(x,y)),e.object.has(p)){let S=t.get(p)??[],w=S.map(D=>r.get(D)).filter(D=>D!=null);for(let D of w){let C=Ep({type:"Feature",geometry:D.geometry,properties:{id:lp(D.properties.id),kind:"desk-entrance",details:{externalId:vs(p)}}},S);h.push(C)}}for(let x of e.area.get(p)?.features??[])b.push(Db(x,v));for(let x of e.window.get(p)?.features??[])M.push(Pb(x))}h.length>0&&(i[u]={type:"FeatureCollection",features:h.filter(m=>m!==null)}),g.length>0&&(s[u]={type:"FeatureCollection",features:g.filter(m=>m!==null)}),b.length>0&&(a[u]={type:"FeatureCollection",features:b.filter(m=>m!==null)}),M.length>0&&(l[u]={type:"FeatureCollection",features:M.filter(m=>m!==null)})}let c={space:i,obstruction:s};return Object.keys(a).length>0&&(c.area=a),Object.keys(l).length>0&&(c.window=l),c}function Ep(n,e){switch(n.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":return null}let t={type:"Feature",geometry:n.geometry,properties:{destinationNodes:e,id:n.properties.id,externalId:n.properties.details?.externalId??"",kind:n.properties.kind}};return n.properties.details&&(t.properties.details={name:n.properties.details.name,description:n.properties.details.description,images:n.properties.details.icon?[{url:n.properties.details.icon,altText:n.properties.details.name?`${n.properties.details.name} icon`:"icon"}]:void 0}),Ll(t)&&(t.properties.center=Ms(t).unwrapOr(void 0)),t}function Tb(n,e){switch(n.geometry.type){case"MultiPoint":case"MultiLineString":case"MultiPolygon":case"Point":return null}let t=n.properties,r={type:"Feature",geometry:n.geometry,properties:{id:t.id,externalId:t.details?.externalId??"",entrances:[],kind:t.kind,footprintComponent:e}};return Ll(r)&&(r.properties.center=Ms(r).unwrapOr(void 0)),t.details&&(r.properties.details={name:t.details.name,description:t.details.description,images:t.details.icon?[{url:t.details.icon,altText:t.details.name?`${t.details.name} icon`:"icon"}]:void 0}),r}function Db(n,e){if(n.geometry.type!=="Polygon")return null;let t=n.properties,r={type:"Feature",geometry:n.geometry,properties:{id:t.id,externalId:t.details?.externalId??"",destinationNodes:e}};return Ll(r)&&(r.properties.center=Ms(r).unwrapOr(void 0)),t.details&&(r.properties.details={name:t.details.name,description:t.details.description,images:t.details.icon?[{url:t.details.icon,altText:t.details.name?`${t.details.name} icon`:"icon"}]:void 0}),r}function Pb(n){return n.geometry.type!=="LineString"?null:{type:"Feature",geometry:n.geometry,properties:{id:n.properties.id}}}function Ib(n){return new Set((n?.ExteriorWalls?.geometryAnchors??[]).map(t=>t.geometryId))}f();function Tp(n,{geometryMaps:e,geometryFeatureById:t}){if(!n.locationCategories&&!n.locations)return{};let r={};if(n.locationCategories?.length){let o=[];for(let i of n.locationCategories){let s={id:i.id,name:i.details.name,icon:i.details.icon??""};i.parent&&(s.parent=i.parent),o.push(s)}r["category.json"]=o}if(n.locations?.length){let o=Ob(n,{geometryFeatureById:t}),i=[];for(let s of n.locations){let a={id:s.id,name:s.details.name,categories:s.categories,spaces:[],obstructions:[],areas:[],annotations:[],connections:[],entrances:[],links:s.links,openingHoursSpecification:s.openingHours??[],pictures:s.images,social:s.social,description:s.details.description,externalId:s.details.externalId,icon:s.details.icon,logo:s.logo,phone:s.phone,website:s.website,searchTags:s.searchTags};i.push(a);for(let{geometryId:l,floorId:c}of s.geometryAnchors)a.spaces.push(...e.space.get(l)?.ids.map(u=>({id:u,floor:c}))??[]),a.obstructions.push(...e.obstruction.get(l)?.ids.map(u=>({id:u,floor:c}))??[]),a.areas.push(...e.area.get(l)?.ids.map(u=>({id:u,floor:c}))??[]),a.entrances.push(...o.entrancesByGeometryId.get(l)??[]),a.connections.push(...o.connectionsByGeometryId.get(l)??[]),a.annotations.push(...o.annotationsByGeometryId.get(l)??[])}r["location.json"]=i}return r}function Ob(n,{geometryFeatureById:e}){let t={annotationsByGeometryId:new Map,connectionsByGeometryId:new Map,entrancesByGeometryId:new Map};if(n.annotations)for(let[r,o]of ge(n.annotations))for(let i of o??[]){let s=i.geometryId,a=i.id,l=t.annotationsByGeometryId.get(s)??[];l.push({floor:r,id:a}),t.annotationsByGeometryId.set(s,l)}if(n.connections)for(let r of n.connections){let o=Dl(r,e),i=Array.from(new Map([...r.entrances,...r.exits].map(s=>[`${s.geometryId}_${s.floorId}`,s])).values());for(let s of i){let a=s.geometryId;if(o){let l=t.entrancesByGeometryId.get(a)??[];l.push({floor:s.floorId,id:r.id}),t.entrancesByGeometryId.set(a,l)}else{let l=t.connectionsByGeometryId.get(a)??[];l.push(r.id),t.connectionsByGeometryId.set(a,l)}}}return t}f();function Dp(n,e){let t={features:[],type:"FeatureCollection"},r={"manifest.geojson":t},o=n.manifest;if(o.features.length>0){let i=o.features[0],s=i.properties,a=s.details!=null?{...s.details.externalId!=null&&{externalId:s.details.externalId}}:void 0,l={type:"Feature",geometry:i.geometry,properties:{folder_struct:[],version:"2.0.0",time:s.time,name:s.name,naturalBearing:s.naturalBearing,tzid:s.tzid,map:s.mapId,org_id:s.orgId,language:s.language,...a!=null&&Object.keys(a).length>0&&{details:a}}};t.features.push(l)}return r}f();function Pp(n,{geometryMaps:e,navigationFlags:t,incomingEdgesByNodeId:r}){let o={"node.geojson":{type:"FeatureCollection",features:[]}},i=o["node.geojson"].features,s=Lb(n),a=Ab(n),l=Rb(n,a,s);for(let[c,u]of ge(n.nodes??{}))for(let d of u?.features??[]){let h=e.space.get(d.properties.geometryIds[0])?.features[0],g=h?.geometry.type==="Point"&&h?.properties.details?.externalId?h.properties.details.externalId:"",b=r.get(d.properties.id)??[],M=Object.keys(t??{}),m=[];for(let y of b)for(let v of M)Er(y,t[v])&&m.push(t[v]);let p={type:"Feature",geometry:d.geometry,properties:{id:d.properties.id,floor:c,space:d.properties.geometryIds.map(y=>e.space.get(y)?.ids).flat().filter(y=>y!==void 0),neighbors:[...d.properties.neighbors.map(y=>({id:y.id,weight:y.extraCost})),...l.get(d.properties.id)??[]],map:c,externalId:g,flags:m.length>0?_b(m):void 0}};i.push(p)}return o}function Lb(n){let e=new Map;for(let t of n.floors?.features??[])e.set(t.properties.id,t.properties.elevation);return e}function Ab(n){let e=new Map;for(let t of Object.values(n.nodes??{}))for(let r of t?.features??[])if(r.properties.geometryIds.length!==0)for(let o of r.properties.geometryIds){let i=e.get(o)??[];i.includes(r.properties.id)||(i.push(r.properties.id),e.set(o,i))}return e}function Rb(n,e,t){let r=new Map;for(let o of n.connections??[]){let i=o.exits.map(s=>({...s,nodes:e.get(s.geometryId)??[]}));for(let s of o.entrances){let a=e.get(s.geometryId)??[];for(let l of a)for(let c of i){let u=Math.abs((t.get(s.floorId)??0)-(t.get(c.floorId)??0))*o.floorCostMultiplier,d=r.get(l)??[];d.push(...c.nodes.filter(h=>h!==l).map(h=>({id:h,weight:u+o.entryCost}))),r.set(l,d)}}}return r}function _b(n){if(n==null||n.length===0)return;let e=new Array(Math.max(...n.map(t=>t.index))+1).fill(0);for(let t of n)e[t.index]|=1<<t.bit;return e}f();function Fb(n,e){let t={};for(let r of n){let o=e.get(r);o&&(t[o]??=[],t[o].push(r))}return t}function Ip(n,{geometryMaps:e}){if(!n.defaultStyle)return{};let t={},r={};t["styles.json"]=r;let o=[...Array.from(e.space.values()).map(s=>s.features),...Array.from(e.obstruction.values()).map(s=>s.features)],i=new Map(o.flatMap(s=>s.map(a=>[a.properties.id,a.geometry.type])));for(let[s,a]of ge(n.defaultStyle)){let l=Fb(a.geometryAnchors.flatMap(c=>[...e.space.get(c.geometryId)?.ids??[],...e.obstruction.get(c.geometryId)?.ids??[]]),i);if(l.Point&&l.Point.length>0){let c={points:Array.from(l.Point.values()),showImage:a.extra?.showImage!==void 0?a.extra?.showImage===!0:a.opacity!==0};r[`${s}.Point`]=c}if(l.LineString&&l.LineString.length>0){let c={lineStrings:Array.from(l.LineString.values()),altitude:a.altitude,color:a.color,height:a.height,opacity:a.opacity,width:a.buffer};a.topColor!==void 0&&(c.topColor=a.topColor),r[`${s}.LineString`]=c}if(l.Polygon&&l.Polygon.length>0){let c={polygons:Array.from(l.Polygon.values()),altitude:a.altitude,color:a.color,height:a.height,opacity:a.opacity};a.extra?.showImage!==void 0&&(c.showImage=a.extra.showImage===!0),a.topColor!==void 0&&(c.topColor=a.topColor),r[`${s}.Polygon`]=c}}return t}function Op(n){let e=dp(n),t=yp(n,e),r=wp(n,e),o=Pp(n,e),i=pp(n,e),s=Ip(n,e),a=vp(n,e),l=bp(n,e),c=gp(n,e),u=hp(n,e),d=Tp(n,e),h=fp(n,e),g=Dp(n,e);return{...n.tileset?{"tileset.json":n.tileset}:{},...n.navigationFlags?{"navigationFlags.json":n.navigationFlags}:{},...n.annotationSymbols?{"annotation-symbols.json":n.annotationSymbols}:{},...t,...r,...o,...i,...s,...a,...l,...c,...u,...d,...h,...g}}var ae=n=>JSON.parse(wl(n)),Nb=/^geometry\/(.+)\.geojson$/,Bb=/^nodes\/(.+)\.(geo)?json$/,Gb=/^floorImages\/(.+)\.geojson$/,kb=/^facade\/(.+)\.json$/,zb=/^walkable\/(.+)\.json$/,Ub=/^nonwalkable\/(.+)\.json$/,Hb=/^kinds\/(.+)\.json$/,Vb=/^annotations\/(.+)\.json$/,Wb=/^cms\/(?:([^/]+)\/)?([^/]+)\.(?:json|geojson)$/,jb=[(n,e)=>n==="manifest.geojson"?{manifest:ae(e)}:void 0,(n,e)=>n==="floors.geojson"?{floors:ae(e)}:void 0,(n,e)=>{let t=n.match(Nb);return t?{geometry:{[t[1]]:ae(e)}}:void 0},(n,e)=>n==="connections.json"?{connections:ae(e)}:void 0,(n,e)=>n==="navigationFlags.json"?{navigationFlags:ae(e)}:void 0,(n,e)=>{let t=n.match(Bb);return t?{nodes:{[t[1]]:ae(e)}}:void 0},(n,e)=>n==="default-style.json"?{defaultStyle:ae(e)}:void 0,(n,e)=>n==="floor-stacks.json"?{floorStacks:ae(e)}:void 0,(n,e)=>n==="outdoors.json"?{outdoors:ae(e)}:void 0,(n,e)=>n==="tileset.json"?{tileset:ae(e)}:void 0,(n,e)=>{let t=n.match(Gb);return t?{floorImages:{[t[1]]:ae(e)}}:void 0},(n,e)=>{let t=n.match(kb);return t?{facade:{[t[1]]:ae(e)}}:void 0},(n,e)=>{let t=n.match(zb);return t?{walkable:{[t[1]]:ae(e)}}:void 0},(n,e)=>{let t=n.match(Ub);return t?{nonwalkable:{[t[1]]:ae(e)}}:void 0},(n,e)=>{let t=n.match(Hb);return t?{kinds:{[t[1]]:ae(e)}}:void 0},(n,e)=>n==="annotation-symbols.json"?{annotationSymbols:ae(e)}:void 0,(n,e)=>{let t=n.match(Vb);return t?{annotations:{[t[1]]:ae(e)}}:void 0},(n,e)=>n==="locations.json"?{locations:ae(e)}:void 0,(n,e)=>n==="location-categories.json"?{locationCategories:ae(e)}:void 0,(n,e)=>n==="location-instances.json"?{locationInstances:ae(e)}:void 0,(n,e)=>{let t=n.match(Wb);if(!t)return;let[,r,o]=t;return r==="floorText"||r==="textures"||r==="textAreas"?{cms:{[r]:{[o]:ae(e)}}}:{cms:{[o]:ae(e)}}}],Zb=new Set(ps),Xb=new Set(ms),Yb=new Set(jn),$b=new Set(Xn),qb=new Set(Zn),Jb=new Set(Yn),Kb=new Set($n),Qb=new Set(qn),ev=new Set(Jn);function Qt(n,e){return typeof n=="string"&&e.has(n)?n:"unknown"}function tv(n){let e=n.connections;if(Array.isArray(e))for(let a of e)a&&typeof a=="object"&&"type"in a&&(a.type=Qt(a.type,Zb));let t=n.kinds;if(t&&typeof t=="object"){for(let a of Object.values(t))if(a&&typeof a=="object"){let l=a;for(let c of Object.keys(l))l[c]=Qt(l[c],Xb)}}let r=n.cms;if(!r||typeof r!="object")return;let o=r,i=o.locations;if(Array.isArray(i))for(let a of i){if(!a||typeof a!="object")continue;let l=a;if("type"in l&&(l.type=Qt(l.type,Yb)),Array.isArray(l.states))for(let c of l.states)c&&typeof c=="object"&&"type"in c&&(c.type=Qt(c.type,$b));if(Array.isArray(l.siblingGroups))for(let c of l.siblingGroups)c&&typeof c=="object"&&"type"in c&&(c.type=Qt(c.type,qb))}for(let a of["floorText","textAreas"]){let l=a==="floorText"?Jb:Kb,c=o[a];if(!(!c||typeof c!="object"))for(let u of Object.values(c)){if(!u||typeof u!="object")continue;let d=u.features;if(Array.isArray(d))for(let h of d){if(!h||typeof h!="object")continue;let g=h.properties;g&&typeof g=="object"&&"alignment"in g&&(g.alignment=Qt(g.alignment,l))}}}let s=o.textures;if(s&&typeof s=="object"){for(let a of Object.values(s))if(Array.isArray(a))for(let l of a){if(!l||typeof l!="object")continue;let c=l;"face"in c&&(c.face=Qt(c.face,Qb)),"surface"in c&&(c.surface=Qt(c.surface,ev))}}}function rv(n){let e=ip(n),t={};for(let r of Object.keys(e))for(let o of jb){let i=o(r,e[r]);if(i){t=Wn(t,i,[]);break}}return tv(t),t}function Cs(n){try{return dt(rv(n))}catch(e){return Cr(e instanceof Error?e:new Error(String(e)))}}var nv={decompressUnsafeSync:n=>Cs(n),decompressUnsafe:n=>Promise.resolve(Cs(n)),decompressSync:n=>Cs(n),decompress:n=>Promise.resolve(Cs(n))};var Es=class{groupBy;graph;geometryEdgesByMapId=new Map;flagDeclarations={};getDoorByNodeId;nonPublicNodeIds;constructor({nodes:e,geojsonCollection:t,groupBy:r="default",multiplicativeDistanceWeightScaling:o,flagDeclarations:i,getDoorByNodeId:s}){this.groupBy=r,this.graph=new ls({nodes:e,groupBy:this.groupBy,multiplicativeDistanceWeightScaling:o});let a=t?.features||[];this.flagDeclarations=i??{},this.getDoorByNodeId=s,this.nonPublicNodeIds=this.getNonPublicNodeIds(),a.forEach(l=>{let c=null;if(l.geometry.type==="LineString"?c=l.geometry.coordinates:l.geometry.type==="Polygon"&&(c=l.geometry.coordinates.flat()),c){let u=this.groupBy==="default"?this.groupBy:l.properties[this.groupBy];this.geometryEdgesByMapId.has(u)||this.geometryEdgesByMapId.set(u,[]),c.forEach((d,h)=>{this.geometryEdgesByMapId.get(u).push([d,c[h+1]||c[0]])})}})}getNonPublicNodeIds(){let e=new Set;if(ds.public in this.flagDeclarations)for(let t in this.graph.nodesById)us(this.graph.nodesById[t].properties.flags,this.flagDeclarations[ds.public].index,this.flagDeclarations[ds.public].bit)||e.add(t);return e}getDirections({zones:e,originIds:t,from:r,to:o,destinationNodeIds:i,disabledConnectionNodeIds:s,simplify:a,multiplicativeDistanceWeightScaling:l,overrideEdgeWeights:c,includeNonPublic:u}){let d=a?.enabled??!0,h=e??[],g=this.graph.aStar({originIds:t,destinationNodeIds:i,zones:h,disabledConnectionNodeIds:new Set(s),overrideEdgeWeights:c,disabledNodeIds:u?void 0:this.nonPublicNodeIds});if(g.length===0)return{type:"FeatureCollection",features:[]};if(a?.__EXPERIMENTAL_METHOD!=="greedy-los"&&r&&o&&r.length===1&&o.length===1){let b=new _e({origin:r[0],destination:g[0].origin,distance:Ee(r[0].geometry.coordinates,g[0].origin.geometry.coordinates),angle:xe(r[0].geometry.coordinates,g[0].origin.geometry.coordinates),multiplicativeDistanceWeightScaling:l}),M=g.slice(),m=new _e({origin:g[g.length-1].destination,destination:o[0],distance:Ee(g[g.length-1].destination.geometry.coordinates,o[0].geometry.coordinates),angle:xe(g[g.length-1].destination.geometry.coordinates,o[0].geometry.coordinates),multiplicativeDistanceWeightScaling:l});M.unshift(b),M.push(m),g=M}return d&&(g=this.simplifyAllSteps(g,a,l)),this.generatePath(g)}generatePath=e=>{let{destination:t}=e[e.length-1],r={type:"FeatureCollection",features:[]};for(let i=0;i<e.length;i++){let{origin:s,destination:a}=e[i],l={id:s.properties.id,angle:e[i].angle,distance:e[i].distance,destination:a.properties.id,edges:this.graph.edges[s.properties.id]};this.groupBy!=="default"&&(l.groupBy=s.properties[this.groupBy]),r.features.push({type:"Feature",geometry:{type:"Point",coordinates:[s.geometry.coordinates[0],s.geometry.coordinates[1]]},properties:l})}let o={id:t.properties.id,edges:this.graph.edges[t.properties.id]};return this.groupBy!=="default"&&(o.groupBy=t.properties[this.groupBy]),r.features.push({type:"Feature",geometry:{type:"Point",coordinates:[t.geometry.coordinates[0],t.geometry.coordinates[1]]},properties:o}),r};simplifyAllSteps(e,t={enabled:!0,__EXPERIMENTAL_METHOD:"greedy-los"},r){let o=[],i=[e[0]],s=t.__EXPERIMENTAL_METHOD??"greedy-los",a=t.radius??Hn,l=s==="dp-optimal"?this.simplifyStepsWithDPMethod.bind(this):s==="rdp"?this.simplifyStepsImprovedWithSimplifyBeforeLoSChecks.bind(this):this.simplifySteps.bind(this);for(let h=1;h<e.length;h++)if(this.groupBy!=="default"&&e[h].origin.properties[this.groupBy]!==e[h-1].origin.properties[this.groupBy]){let g=e[h-1].origin.properties[this.groupBy],b=this.geometryEdgesByMapId.get(g)??[];o.push(...l(i,b,a,r,t)),i=[e[h]]}else i.push(e[h]);let c=e[e.length-1],u=this.groupBy==="default"?this.groupBy:c.origin.properties[this.groupBy],d=this.geometryEdgesByMapId.get(u)??[];return o.push(...l(i,d,a,r,t)),o}findNearestNodesOnGraph=(e,t,r,o,i=!1,s=1/0)=>this.graph.dijkstraFindWithinTravelDistance(e,t,o,this.geometryEdgesByMapId.get(r)??[],i,s);hasLineOfSight=(e,t,r,o)=>this.graph.hasLineOfSight(e,t,this.geometryEdgesByMapId.get(r),o);simplifySteps(e,t,r,o,i){return Xh(e,t,r,this.flagDeclarations,o)}simplifyStepsImprovedWithSimplifyBeforeLoSChecks(e,t,r,o,i){if(e.length<3)return e;!1,e=jh(e,this.getDoorByNodeId,o,t);let s=i?.__EXPERIMENTAL_METHOD==="rdp"?i.mustIncludeDoorBufferNodes??!0:!0;return Zh(e,t,o,s)}simplifyStepsWithDPMethod(e,t,r,o,i){if(e.length<3)return e;let s=new Set;(i?.__EXPERIMENTAL_METHOD==="dp-optimal"?i.includeDoorBufferNodes??!1:!1)&&(s=$h(e,this.getDoorByNodeId));for(let u=0;u<e.length-1;u++){let d=e[u].origin.properties.floor,h=e[u+1].origin.properties.floor;d!==h&&(e[u].origin.properties.preventSmoothing||(e[u].origin.properties.preventSmoothing=!0,s.add(e[u].origin.properties.id)),e[u+1].origin.properties.preventSmoothing||(e[u+1].origin.properties.preventSmoothing=!0,s.add(e[u+1].origin.properties.id)))}let l=e[e.length-1];l.origin.properties.floor!==l.destination.properties.floor&&(l.origin.properties.preventSmoothing||(l.origin.properties.preventSmoothing=!0,s.add(l.origin.properties.id))),!1;let c=Uh(e,t,o,r);if(!1){let u=c[c.length-1];window.__DEBUG_PATH.finalSteps.push({nodeId:u.destination.properties.id,coordinate:u.destination.geometry.coordinates,floorId:u.destination.properties.map})}for(let u of e)s.has(u.origin.properties.id)&&delete u.origin.properties.preventSmoothing,s.has(u.destination.properties.id)&&delete u.destination.properties.preventSmoothing;return c}getDistance=(e,t)=>Ee(e,t);getAngle=(e,t)=>xe(e,t)};var Al="https://tiles-cdn.mappedin.com/styles/mappedin/style.json",ov="https://auth.mappedin.com/oauth2/token";async function VL(n,e){let t=e?.useWorkers??!0,r={...e,watermark:e?.watermark,attribution:e?.attribution,antialias:e?.antialias,occlusionEnabled:e?.occlusionEnabled,transformImageRequest:e?.transformImageRequest,naturalBearing:e?.naturalBearing??0,imagePlacementOptions:e?.imagePlacementOptions,onWebGLContextCreationError:e?.onWebGLContextCreationError,onWebGLContextLost:e?.onWebGLContextLost,onWebGLContextRestored:e?.onWebGLContextRestored,onWebGLRendererError:e?.onWebGLRendererError,useStandaloneCamera:e?.useStandaloneCamera??!1,useCollisionWorker:e?.useCollisionWorker??!0,useWorkers:t};if(t===!0&&e?.outdoorView?.enabled){let o=e.outdoorView.headers;o==null&&(o=await Ac(ov));let i=e.center||[0,0];_s&&Cc(_s);let s=null,a=null;try{s=new Mc({container:n,style:e.outdoorView.style||Al,center:i,attributionControl:!1,zoom:e.zoomLevel??ul,pitch:e.pitch??ll,bearing:e.bearing??cl,transformRequest:Dc(o),trackResize:!1,pixelRatio:e.outdoorView.lowDpi?1:Br(),canvasContextAttributes:{antialias:typeof e.antialias=="boolean"?e.antialias:!0,powerPreference:"high-performance"},interactive:!1,validateStyle:!1,centerClampedToGround:!1,boxZoom:!1,doubleClickZoom:!1,scrollZoom:!1,dragPan:!1,dragRotate:!1,keyboard:!1,touchZoomRotate:!1}),await Pc(s,{timeout:1e4,styleUrl:e.outdoorView?.style||Al})}catch(c){if(a=c,_.warn(`[MappedinJS] Outdoor view initialization failed: ${a.message}. Falling back to indoor-only rendering.`),s){try{s.remove()}catch{}s=null}}if(!s||a){let c=new qt(n,r);return c.publish("outdoor-style-error",{error:a}),c}let l=null;try{let c=s.painter.context.gl;l=new qt(n,{center:i,zoomLevel:s.getZoom(),pitch:s.getPitch(),bearing:s.getBearing(),gl:c,map:s,mode:"outdoors-interleaved",...r}),Ro(s,l.camera.minZoomLevel,l.camera.maxZoomLevel),s.setMaxPitch(l.camera.maxPitch),s.setMinPitch(l.camera.minPitch),Gh(l,s);let u=To.fromLngLat(i,0),d=Po(u,l.viewCamera,()=>{l?.renderSync()}),h=async()=>{s&&(s.addLayer(d),l?.renderSync())};l.onMapLibreEvent("style.load",h),h();let g=!1,b=!1,M=()=>{s&&(g||(l?.publish("outdoor-view-loaded"),g=!0),b||(b=!0,l?.publish("outdoor-style-loaded")))};l.onMapLibreEvent("idle",M);let m=v=>{v&&(v.sourceDataType==="metadata"||v.sourceDataType==="visibility"||v.dataType==="style"||v.type==="terrain")&&l?.getSystems().htmlControlsSystem.updateData(s)},p=v=>{s&&v&&v.dataType==="style"&&v.type==="styledata"&&(b=!1),m(v)};l.onMapLibreEvent("styledata",p),l.onMapLibreEvent("sourcedata",m),l.onMapLibreEvent("terrain",m);let y=v=>{if(v.error?.url===Al){_.error(`Failed to load outdoor view style, possibly due to invalid token "${o["x-mappedin-tiles-key"]}"`);return}_.warn(v)};return l.onMapLibreEvent("error",y),l}catch(c){if(l)try{l.destroy()}catch{}if(s)try{s.remove()}catch{}_.warn("Failed to initialize outdoor view, falling back to indoor-only rendering:",c);let u=new qt(n,r);return u.publish("outdoor-style-error",{error:c}),u}}else return new qt(n,r)}export{Qx as a,ri as b,eS as c,Ee as d,fa as e,ni as f,Mi as g,Sr as h,Zr as i,vE as j,Wn as k,Ly as l,Op as m,nv as n,as as o,Oi as p,wt as q,Es as r,Ks as s,si as t,Ma as u,qt as v,vy as w,dl as x,VL as y};
|