@mappedin/maplibre-overlay 6.0.1-beta.55 → 6.0.1-beta.56
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-R6F7IFS2.js → GLTFExporter-BPHG4XL7.js} +1 -1
- package/lib/esm/{GLTFLoader-NEDVOJZ7.js → GLTFLoader-5XXRE2UW.js} +1 -1
- package/lib/esm/{chunk-BJJSORNB.js → chunk-6UGO67X2.js} +1 -1
- package/lib/esm/{chunk-VXAB6NBV.js → chunk-BI3F3KS7.js} +1 -1
- package/lib/esm/{chunk-V373UAUS.js → chunk-F44NIQPP.js} +1 -1
- package/lib/esm/chunk-IYKJ3SDZ.js +1 -0
- package/lib/esm/{chunk-FWRW5PDC.js → chunk-Q3N6EADX.js} +1 -1
- package/lib/esm/index.css +1 -1
- package/lib/esm/index.js +1 -1
- package/lib/esm/{outdoor-context-v5-SDXFT2FP.js → outdoor-context-v5-FSCVFUVV.js} +1 -1
- package/lib/esm/text3d-M57DIX3E.css +1 -0
- package/lib/esm/text3d-YQOBP3BF.js +1 -0
- package/package.json +19 -18
- package/lib/esm/chunk-JL7KYJFU.js +0 -1
- package/lib/esm/text3d-242FO3DA.js +0 -1
package/lib/esm/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as ta,A as yi,B as ip,C as np,D as op,E as Kt,F as $s,G as Ne,H as xt,I as sp,J as gi,K as Bt,L as fe,M as Ie,N as Js,O as uo,P as Ks,Q as mc,R as ap,S as fn,T as lp,U as ho,V as po,W as cp,X as Qs,Y as up,Z as fc,_ as ea,a as cc,aa as hp,b as uc,ba as dp,c as Ws,ca as pp,d as Vs,da as yc,e as fi,ea as mp,f as Hd,fa as gc,g as Wd,ga as fp,h as hc,ha as yp,i as zr,ia as yn,j as Vd,ja as gp,k as te,ka as vp,l as dc,la as ra,m as $t,ma as vc,n as qd,na as mo,o as $d,oa as gn,p as mn,pa as ia,q as Jd,qa as vn,r as Kd,ra as bn,s as qs,t as pc,u as Jt,v as me,w as Qd,x as ep,y as tp,z as rp}from"./chunk-JL7KYJFU.js";import{X as oc,k as Td,w as wd}from"./chunk-FWRW5PDC.js";import{a as Pt}from"./chunk-VXAB6NBV.js";import{$ as be,$a as Zd,A as Id,Aa as lc,B as Xs,Ba as Gr,C as zs,Ca as Xr,D as Ed,Da as Nt,E as Dd,Ea as Us,Fa as Xd,G as Od,Ga as zd,H as ue,I as ae,Ia as mi,M as Ld,N as Ad,O as kd,P as pi,Q as H,R as it,S as Rd,Sa as js,T as bt,U as mr,V as fr,W as Ee,Wa as Hs,Xa as Yd,Y as st,Z as ct,_ as Ys,aa as kr,b as Bs,bb as qt,c as hi,ca as Rr,d as co,da as Nd,db as Ud,e as Rt,ea as sc,f as Md,fb as jd,g as Vt,ga as Nr,la as Bd,oa as Br,p as Fs,pa as Fd,qa as Zs,r as Gs,ra as ac,ta as pn,ya as Gd,z as di,za as Fr}from"./chunk-BJJSORNB.js";import{a as v,b as E}from"./chunk-V373UAUS.js";import{a as O,b as j,c as a,d as _d,f as Ar,g as Pd,h as Ns,i as p,j as c,k as L,l as R,m as _e}from"./chunk-CU2O7JF6.js";var Mm=Ar((wo,Ln)=>{v();var Ib=200,sm="__lodash_hash_undefined__",Eb=800,Db=16,am=9007199254740991,lm="[object Arguments]",Ob="[object Array]",Lb="[object AsyncFunction]",Ab="[object Boolean]",kb="[object Date]",Rb="[object Error]",cm="[object Function]",Nb="[object GeneratorFunction]",Bb="[object Map]",Fb="[object Number]",Gb="[object Null]",um="[object Object]",Xb="[object Proxy]",zb="[object RegExp]",Yb="[object Set]",Zb="[object String]",Ub="[object Undefined]",jb="[object WeakMap]",Hb="[object ArrayBuffer]",Wb="[object DataView]",Vb="[object Float32Array]",qb="[object Float64Array]",$b="[object Int8Array]",Jb="[object Int16Array]",Kb="[object Int32Array]",Qb="[object Uint8Array]",e0="[object Uint8ClampedArray]",t0="[object Uint16Array]",r0="[object Uint32Array]",i0=/[\\^$.*+?()[\]{}|]/g,n0=/^\[object .+?Constructor\]$/,o0=/^(?:0|[1-9]\d*)$/,Oe={};Oe[Vb]=Oe[qb]=Oe[$b]=Oe[Jb]=Oe[Kb]=Oe[Qb]=Oe[e0]=Oe[t0]=Oe[r0]=!0;Oe[lm]=Oe[Ob]=Oe[Hb]=Oe[Ab]=Oe[Wb]=Oe[kb]=Oe[Rb]=Oe[cm]=Oe[Bb]=Oe[Fb]=Oe[um]=Oe[zb]=Oe[Yb]=Oe[Zb]=Oe[jb]=!1;var hm=typeof global=="object"&&global&&global.Object===Object&&global,s0=typeof self=="object"&&self&&self.Object===Object&&self,Eo=hm||s0||Function("return this")(),dm=typeof wo=="object"&&wo&&!wo.nodeType&&wo,Mo=dm&&typeof Ln=="object"&&Ln&&!Ln.nodeType&&Ln,pm=Mo&&Mo.exports===dm,Kc=pm&&hm.process,Jp=function(){try{var t=Mo&&Mo.require&&Mo.require("util").types;return t||Kc&&Kc.binding&&Kc.binding("util")}catch(e){}}(),Kp=Jp&&Jp.isTypedArray;function mm(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}a(mm,"apply");function a0(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i}a(a0,"baseTimes");function l0(t){return function(e){return t(e)}}a(l0,"baseUnary");function c0(t,e){return t==null?void 0:t[e]}a(c0,"getValue");function u0(t,e){return function(r){return t(e(r))}}a(u0,"overArg");var h0=Array.prototype,d0=Function.prototype,Sa=Object.prototype,Qc=Eo["__core-js_shared__"],Ca=d0.toString,_r=Sa.hasOwnProperty,Qp=function(){var t=/[^.]+$/.exec(Qc&&Qc.keys&&Qc.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),fm=Sa.toString,p0=Ca.call(Object),m0=RegExp("^"+Ca.call(_r).replace(i0,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),ba=pm?Eo.Buffer:void 0,em=Eo.Symbol,tm=Eo.Uint8Array,rm=ba?ba.allocUnsafe:void 0,ym=u0(Object.getPrototypeOf,Object),im=Object.create,f0=Sa.propertyIsEnumerable,y0=h0.splice,Bi=em?em.toStringTag:void 0,xa=function(){try{var t=su(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),g0=ba?ba.isBuffer:void 0,nm=Math.max,v0=Date.now,gm=su(Eo,"Map"),Io=su(Object,"create"),b0=function(){function t(){}return a(t,"object"),function(e){if(!Cr(e))return{};if(im)return im(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function Fi(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}a(Fi,"Hash");function x0(){this.__data__=Io?Io(null):{},this.size=0}a(x0,"hashClear");function S0(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}a(S0,"hashDelete");function C0(t){var e=this.__data__;if(Io){var r=e[t];return r===sm?void 0:r}return _r.call(e,t)?e[t]:void 0}a(C0,"hashGet");function _0(t){var e=this.__data__;return Io?e[t]!==void 0:_r.call(e,t)}a(_0,"hashHas");function P0(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Io&&e===void 0?sm:e,this}a(P0,"hashSet");Fi.prototype.clear=x0;Fi.prototype.delete=S0;Fi.prototype.get=C0;Fi.prototype.has=_0;Fi.prototype.set=P0;function Pr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}a(Pr,"ListCache");function T0(){this.__data__=[],this.size=0}a(T0,"listCacheClear");function w0(t){var e=this.__data__,r=_a(e,t);if(r<0)return!1;var i=e.length-1;return r==i?e.pop():y0.call(e,r,1),--this.size,!0}a(w0,"listCacheDelete");function M0(t){var e=this.__data__,r=_a(e,t);return r<0?void 0:e[r][1]}a(M0,"listCacheGet");function I0(t){return _a(this.__data__,t)>-1}a(I0,"listCacheHas");function E0(t,e){var r=this.__data__,i=_a(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}a(E0,"listCacheSet");Pr.prototype.clear=T0;Pr.prototype.delete=w0;Pr.prototype.get=M0;Pr.prototype.has=I0;Pr.prototype.set=E0;function An(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}a(An,"MapCache");function D0(){this.size=0,this.__data__={hash:new Fi,map:new(gm||Pr),string:new Fi}}a(D0,"mapCacheClear");function O0(t){var e=Ta(this,t).delete(t);return this.size-=e?1:0,e}a(O0,"mapCacheDelete");function L0(t){return Ta(this,t).get(t)}a(L0,"mapCacheGet");function A0(t){return Ta(this,t).has(t)}a(A0,"mapCacheHas");function k0(t,e){var r=Ta(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}a(k0,"mapCacheSet");An.prototype.clear=D0;An.prototype.delete=O0;An.prototype.get=L0;An.prototype.has=A0;An.prototype.set=k0;function kn(t){var e=this.__data__=new Pr(t);this.size=e.size}a(kn,"Stack");function R0(){this.__data__=new Pr,this.size=0}a(R0,"stackClear");function N0(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}a(N0,"stackDelete");function B0(t){return this.__data__.get(t)}a(B0,"stackGet");function F0(t){return this.__data__.has(t)}a(F0,"stackHas");function G0(t,e){var r=this.__data__;if(r instanceof Pr){var i=r.__data__;if(!gm||i.length<Ib-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new An(i)}return r.set(t,e),this.size=r.size,this}a(G0,"stackSet");kn.prototype.clear=R0;kn.prototype.delete=N0;kn.prototype.get=B0;kn.prototype.has=F0;kn.prototype.set=G0;function X0(t,e){var r=iu(t),i=!r&&ru(t),n=!r&&!i&&Cm(t),o=!r&&!i&&!n&&Pm(t),s=r||i||n||o,l=s?a0(t.length,String):[],u=l.length;for(var h in t)(e||_r.call(t,h))&&!(s&&(h=="length"||n&&(h=="offset"||h=="parent")||o&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||xm(h,u)))&&l.push(h);return l}a(X0,"arrayLikeKeys");function eu(t,e,r){(r!==void 0&&!wa(t[e],r)||r===void 0&&!(e in t))&&nu(t,e,r)}a(eu,"assignMergeValue");function z0(t,e,r){var i=t[e];(!(_r.call(t,e)&&wa(i,r))||r===void 0&&!(e in t))&&nu(t,e,r)}a(z0,"assignValue");function _a(t,e){for(var r=t.length;r--;)if(wa(t[r][0],e))return r;return-1}a(_a,"assocIndexOf");function nu(t,e,r){e=="__proto__"&&xa?xa(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}a(nu,"baseAssignValue");var Y0=ex();function Pa(t){return t==null?t===void 0?Ub:Gb:Bi&&Bi in Object(t)?tx(t):ax(t)}a(Pa,"baseGetTag");function om(t){return Do(t)&&Pa(t)==lm}a(om,"baseIsArguments");function Z0(t){if(!Cr(t)||ox(t))return!1;var e=lu(t)?m0:n0;return e.test(hx(t))}a(Z0,"baseIsNative");function U0(t){return Do(t)&&_m(t.length)&&!!Oe[Pa(t)]}a(U0,"baseIsTypedArray");function j0(t){if(!Cr(t))return sx(t);var e=Sm(t),r=[];for(var i in t)i=="constructor"&&(e||!_r.call(t,i))||r.push(i);return r}a(j0,"baseKeysIn");function ou(t,e,r,i,n){t!==e&&Y0(e,function(o,s){if(n||(n=new kn),Cr(o))H0(t,e,s,r,ou,i,n);else{var l=i?i(tu(t,s),o,s+"",t,e,n):void 0;l===void 0&&(l=o),eu(t,s,l)}},Tm)}a(ou,"baseMerge");function H0(t,e,r,i,n,o,s){var l=tu(t,r),u=tu(e,r),h=s.get(u);if(h){eu(t,r,h);return}var m=o?o(l,u,r+"",t,e,s):void 0,f=m===void 0;if(f){var b=iu(u),y=!b&&Cm(u),_=!b&&!y&&Pm(u);m=u,b||y||_?iu(l)?m=l:dx(l)?m=J0(l):y?(f=!1,m=V0(u,!0)):_?(f=!1,m=$0(u,!0)):m=[]:px(u)||ru(u)?(m=l,ru(l)?m=mx(l):(!Cr(l)||lu(l))&&(m=rx(u))):f=!1}f&&(s.set(u,m),n(m,u,i,o,s),s.delete(u)),eu(t,r,m)}a(H0,"baseMergeDeep");function vm(t,e){return cx(lx(t,e,wm),t+"")}a(vm,"baseRest");var W0=xa?function(t,e){return xa(t,"toString",{configurable:!0,enumerable:!1,value:gx(e),writable:!0})}:wm;function V0(t,e){if(e)return t.slice();var r=t.length,i=rm?rm(r):new t.constructor(r);return t.copy(i),i}a(V0,"cloneBuffer");function q0(t){var e=new t.constructor(t.byteLength);return new tm(e).set(new tm(t)),e}a(q0,"cloneArrayBuffer");function $0(t,e){var r=e?q0(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}a($0,"cloneTypedArray");function J0(t,e){var r=-1,i=t.length;for(e||(e=Array(i));++r<i;)e[r]=t[r];return e}a(J0,"copyArray");function K0(t,e,r,i){var n=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var l=e[o],u=i?i(r[l],t[l],l,r,t):void 0;u===void 0&&(u=t[l]),n?nu(r,l,u):z0(r,l,u)}return r}a(K0,"copyObject");function Q0(t){return vm(function(e,r){var i=-1,n=r.length,o=n>1?r[n-1]:void 0,s=n>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(n--,o):void 0,s&&ix(r[0],r[1],s)&&(o=n<3?void 0:o,n=1),e=Object(e);++i<n;){var l=r[i];l&&t(e,l,i,o)}return e})}a(Q0,"createAssigner");function ex(t){return function(e,r,i){for(var n=-1,o=Object(e),s=i(e),l=s.length;l--;){var u=s[t?l:++n];if(r(o[u],u,o)===!1)break}return e}}a(ex,"createBaseFor");function bm(t,e,r,i,n,o){return Cr(t)&&Cr(e)&&(o.set(e,t),ou(t,e,void 0,bm,o),o.delete(e)),t}a(bm,"customDefaultsMerge");function Ta(t,e){var r=t.__data__;return nx(e)?r[typeof e=="string"?"string":"hash"]:r.map}a(Ta,"getMapData");function su(t,e){var r=c0(t,e);return Z0(r)?r:void 0}a(su,"getNative");function tx(t){var e=_r.call(t,Bi),r=t[Bi];try{t[Bi]=void 0;var i=!0}catch(o){}var n=fm.call(t);return i&&(e?t[Bi]=r:delete t[Bi]),n}a(tx,"getRawTag");function rx(t){return typeof t.constructor=="function"&&!Sm(t)?b0(ym(t)):{}}a(rx,"initCloneObject");function xm(t,e){var r=typeof t;return e=e==null?am:e,!!e&&(r=="number"||r!="symbol"&&o0.test(t))&&t>-1&&t%1==0&&t<e}a(xm,"isIndex");function ix(t,e,r){if(!Cr(r))return!1;var i=typeof e;return(i=="number"?au(r)&&xm(e,r.length):i=="string"&&e in r)?wa(r[e],t):!1}a(ix,"isIterateeCall");function nx(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}a(nx,"isKeyable");function ox(t){return!!Qp&&Qp in t}a(ox,"isMasked");function Sm(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Sa;return t===r}a(Sm,"isPrototype");function sx(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}a(sx,"nativeKeysIn");function ax(t){return fm.call(t)}a(ax,"objectToString");function lx(t,e,r){return e=nm(e===void 0?t.length-1:e,0),function(){for(var i=arguments,n=-1,o=nm(i.length-e,0),s=Array(o);++n<o;)s[n]=i[e+n];n=-1;for(var l=Array(e+1);++n<e;)l[n]=i[n];return l[e]=r(s),mm(t,this,l)}}a(lx,"overRest");function tu(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}a(tu,"safeGet");var cx=ux(W0);function ux(t){var e=0,r=0;return function(){var i=v0(),n=Db-(i-r);if(r=i,n>0){if(++e>=Eb)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}a(ux,"shortOut");function hx(t){if(t!=null){try{return Ca.call(t)}catch(e){}try{return t+""}catch(e){}}return""}a(hx,"toSource");function wa(t,e){return t===e||t!==t&&e!==e}a(wa,"eq");var ru=om(function(){return arguments}())?om:function(t){return Do(t)&&_r.call(t,"callee")&&!f0.call(t,"callee")},iu=Array.isArray;function au(t){return t!=null&&_m(t.length)&&!lu(t)}a(au,"isArrayLike");function dx(t){return Do(t)&&au(t)}a(dx,"isArrayLikeObject");var Cm=g0||vx;function lu(t){if(!Cr(t))return!1;var e=Pa(t);return e==cm||e==Nb||e==Lb||e==Xb}a(lu,"isFunction");function _m(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=am}a(_m,"isLength");function Cr(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}a(Cr,"isObject");function Do(t){return t!=null&&typeof t=="object"}a(Do,"isObjectLike");function px(t){if(!Do(t)||Pa(t)!=um)return!1;var e=ym(t);if(e===null)return!0;var r=_r.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Ca.call(r)==p0}a(px,"isPlainObject");var Pm=Kp?l0(Kp):U0;function mx(t){return K0(t,Tm(t))}a(mx,"toPlainObject");var fx=vm(function(t){return t.push(void 0,bm),mm(yx,void 0,t)});function Tm(t){return au(t)?X0(t,!0):j0(t)}a(Tm,"keysIn");var yx=Q0(function(t,e,r,i){ou(t,e,r,i)});function gx(t){return function(){return t}}a(gx,"constant");function wm(t){return t}a(wm,"identity");function vx(){return!1}a(vx,"stubFalse");Ln.exports=fx});var mf=Ar((Oo,Rn)=>{v();var Ox=200,Vm="__lodash_hash_undefined__",Lx=800,Ax=16,qm=9007199254740991,$m="[object Arguments]",kx="[object Array]",Rx="[object AsyncFunction]",Nx="[object Boolean]",Bx="[object Date]",Fx="[object Error]",Jm="[object Function]",Gx="[object GeneratorFunction]",Xx="[object Map]",zx="[object Number]",Yx="[object Null]",Km="[object Object]",Zx="[object Proxy]",Ux="[object RegExp]",jx="[object Set]",Hx="[object String]",Wx="[object Undefined]",Vx="[object WeakMap]",qx="[object ArrayBuffer]",$x="[object DataView]",Jx="[object Float32Array]",Kx="[object Float64Array]",Qx="[object Int8Array]",eS="[object Int16Array]",tS="[object Int32Array]",rS="[object Uint8Array]",iS="[object Uint8ClampedArray]",nS="[object Uint16Array]",oS="[object Uint32Array]",sS=/[\\^$.*+?()[\]{}|]/g,aS=/^\[object .+?Constructor\]$/,lS=/^(?:0|[1-9]\d*)$/,Le={};Le[Jx]=Le[Kx]=Le[Qx]=Le[eS]=Le[tS]=Le[rS]=Le[iS]=Le[nS]=Le[oS]=!0;Le[$m]=Le[kx]=Le[qx]=Le[Nx]=Le[$x]=Le[Bx]=Le[Fx]=Le[Jm]=Le[Xx]=Le[zx]=Le[Km]=Le[Ux]=Le[jx]=Le[Hx]=Le[Vx]=!1;var Qm=typeof global=="object"&&global&&global.Object===Object&&global,cS=typeof self=="object"&&self&&self.Object===Object&&self,ko=Qm||cS||Function("return this")(),ef=typeof Oo=="object"&&Oo&&!Oo.nodeType&&Oo,Lo=ef&&typeof Rn=="object"&&Rn&&!Rn.nodeType&&Rn,tf=Lo&&Lo.exports===ef,du=tf&&Qm.process,Gm=function(){try{var t=Lo&&Lo.require&&Lo.require("util").types;return t||du&&du.binding&&du.binding("util")}catch(e){}}(),Xm=Gm&&Gm.isTypedArray;function uS(t,e,r){switch(r.length){case 0:return t.call(e);case 1:return t.call(e,r[0]);case 2:return t.call(e,r[0],r[1]);case 3:return t.call(e,r[0],r[1],r[2])}return t.apply(e,r)}a(uS,"apply");function hS(t,e){for(var r=-1,i=Array(t);++r<t;)i[r]=e(r);return i}a(hS,"baseTimes");function dS(t){return function(e){return t(e)}}a(dS,"baseUnary");function pS(t,e){return t==null?void 0:t[e]}a(pS,"getValue");function mS(t,e){return function(r){return t(e(r))}}a(mS,"overArg");var fS=Array.prototype,yS=Function.prototype,Ea=Object.prototype,pu=ko["__core-js_shared__"],Da=yS.toString,Tr=Ea.hasOwnProperty,zm=function(){var t=/[^.]+$/.exec(pu&&pu.keys&&pu.keys.IE_PROTO||"");return t?"Symbol(src)_1."+t:""}(),rf=Ea.toString,gS=Da.call(Object),vS=RegExp("^"+Da.call(Tr).replace(sS,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Ma=tf?ko.Buffer:void 0,Ym=ko.Symbol,Zm=ko.Uint8Array,Um=Ma?Ma.allocUnsafe:void 0,nf=mS(Object.getPrototypeOf,Object),jm=Object.create,bS=Ea.propertyIsEnumerable,xS=fS.splice,Xi=Ym?Ym.toStringTag:void 0,Ia=function(){try{var t=bu(Object,"defineProperty");return t({},"",{}),t}catch(e){}}(),SS=Ma?Ma.isBuffer:void 0,Hm=Math.max,CS=Date.now,of=bu(ko,"Map"),Ao=bu(Object,"create"),_S=function(){function t(){}return a(t,"object"),function(e){if(!Yi(e))return{};if(jm)return jm(e);t.prototype=e;var r=new t;return t.prototype=void 0,r}}();function zi(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}a(zi,"Hash");function PS(){this.__data__=Ao?Ao(null):{},this.size=0}a(PS,"hashClear");function TS(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e}a(TS,"hashDelete");function wS(t){var e=this.__data__;if(Ao){var r=e[t];return r===Vm?void 0:r}return Tr.call(e,t)?e[t]:void 0}a(wS,"hashGet");function MS(t){var e=this.__data__;return Ao?e[t]!==void 0:Tr.call(e,t)}a(MS,"hashHas");function IS(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=Ao&&e===void 0?Vm:e,this}a(IS,"hashSet");zi.prototype.clear=PS;zi.prototype.delete=TS;zi.prototype.get=wS;zi.prototype.has=MS;zi.prototype.set=IS;function wr(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}a(wr,"ListCache");function ES(){this.__data__=[],this.size=0}a(ES,"listCacheClear");function DS(t){var e=this.__data__,r=Oa(e,t);if(r<0)return!1;var i=e.length-1;return r==i?e.pop():xS.call(e,r,1),--this.size,!0}a(DS,"listCacheDelete");function OS(t){var e=this.__data__,r=Oa(e,t);return r<0?void 0:e[r][1]}a(OS,"listCacheGet");function LS(t){return Oa(this.__data__,t)>-1}a(LS,"listCacheHas");function AS(t,e){var r=this.__data__,i=Oa(r,t);return i<0?(++this.size,r.push([t,e])):r[i][1]=e,this}a(AS,"listCacheSet");wr.prototype.clear=ES;wr.prototype.delete=DS;wr.prototype.get=OS;wr.prototype.has=LS;wr.prototype.set=AS;function Nn(t){var e=-1,r=t==null?0:t.length;for(this.clear();++e<r;){var i=t[e];this.set(i[0],i[1])}}a(Nn,"MapCache");function kS(){this.size=0,this.__data__={hash:new zi,map:new(of||wr),string:new zi}}a(kS,"mapCacheClear");function RS(t){var e=Aa(this,t).delete(t);return this.size-=e?1:0,e}a(RS,"mapCacheDelete");function NS(t){return Aa(this,t).get(t)}a(NS,"mapCacheGet");function BS(t){return Aa(this,t).has(t)}a(BS,"mapCacheHas");function FS(t,e){var r=Aa(this,t),i=r.size;return r.set(t,e),this.size+=r.size==i?0:1,this}a(FS,"mapCacheSet");Nn.prototype.clear=kS;Nn.prototype.delete=RS;Nn.prototype.get=NS;Nn.prototype.has=BS;Nn.prototype.set=FS;function Bn(t){var e=this.__data__=new wr(t);this.size=e.size}a(Bn,"Stack");function GS(){this.__data__=new wr,this.size=0}a(GS,"stackClear");function XS(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r}a(XS,"stackDelete");function zS(t){return this.__data__.get(t)}a(zS,"stackGet");function YS(t){return this.__data__.has(t)}a(YS,"stackHas");function ZS(t,e){var r=this.__data__;if(r instanceof wr){var i=r.__data__;if(!of||i.length<Ox-1)return i.push([t,e]),this.size=++r.size,this;r=this.__data__=new Nn(i)}return r.set(t,e),this.size=r.size,this}a(ZS,"stackSet");Bn.prototype.clear=GS;Bn.prototype.delete=XS;Bn.prototype.get=zS;Bn.prototype.has=YS;Bn.prototype.set=ZS;function US(t,e){var r=gu(t),i=!r&&yu(t),n=!r&&!i&&cf(t),o=!r&&!i&&!n&&hf(t),s=r||i||n||o,l=s?hS(t.length,String):[],u=l.length;for(var h in t)(e||Tr.call(t,h))&&!(s&&(h=="length"||n&&(h=="offset"||h=="parent")||o&&(h=="buffer"||h=="byteLength"||h=="byteOffset")||af(h,u)))&&l.push(h);return l}a(US,"arrayLikeKeys");function mu(t,e,r){(r!==void 0&&!ka(t[e],r)||r===void 0&&!(e in t))&&vu(t,e,r)}a(mu,"assignMergeValue");function jS(t,e,r){var i=t[e];(!(Tr.call(t,e)&&ka(i,r))||r===void 0&&!(e in t))&&vu(t,e,r)}a(jS,"assignValue");function Oa(t,e){for(var r=t.length;r--;)if(ka(t[r][0],e))return r;return-1}a(Oa,"assocIndexOf");function vu(t,e,r){e=="__proto__"&&Ia?Ia(t,e,{configurable:!0,enumerable:!0,value:r,writable:!0}):t[e]=r}a(vu,"baseAssignValue");var HS=oC();function La(t){return t==null?t===void 0?Wx:Yx:Xi&&Xi in Object(t)?sC(t):dC(t)}a(La,"baseGetTag");function Wm(t){return Ro(t)&&La(t)==$m}a(Wm,"baseIsArguments");function WS(t){if(!Yi(t)||uC(t))return!1;var e=Su(t)?vS:aS;return e.test(yC(t))}a(WS,"baseIsNative");function VS(t){return Ro(t)&&uf(t.length)&&!!Le[La(t)]}a(VS,"baseIsTypedArray");function qS(t){if(!Yi(t))return hC(t);var e=lf(t),r=[];for(var i in t)i=="constructor"&&(e||!Tr.call(t,i))||r.push(i);return r}a(qS,"baseKeysIn");function sf(t,e,r,i,n){t!==e&&HS(e,function(o,s){if(n||(n=new Bn),Yi(o))$S(t,e,s,r,sf,i,n);else{var l=i?i(fu(t,s),o,s+"",t,e,n):void 0;l===void 0&&(l=o),mu(t,s,l)}},df)}a(sf,"baseMerge");function $S(t,e,r,i,n,o,s){var l=fu(t,r),u=fu(e,r),h=s.get(u);if(h){mu(t,r,h);return}var m=o?o(l,u,r+"",t,e,s):void 0,f=m===void 0;if(f){var b=gu(u),y=!b&&cf(u),_=!b&&!y&&hf(u);m=u,b||y||_?gu(l)?m=l:gC(l)?m=rC(l):y?(f=!1,m=QS(u,!0)):_?(f=!1,m=tC(u,!0)):m=[]:vC(u)||yu(u)?(m=l,yu(l)?m=bC(l):(!Yi(l)||Su(l))&&(m=aC(u))):f=!1}f&&(s.set(u,m),n(m,u,i,o,s),s.delete(u)),mu(t,r,m)}a($S,"baseMergeDeep");function JS(t,e){return mC(pC(t,e,pf),t+"")}a(JS,"baseRest");var KS=Ia?function(t,e){return Ia(t,"toString",{configurable:!0,enumerable:!1,value:SC(e),writable:!0})}:pf;function QS(t,e){if(e)return t.slice();var r=t.length,i=Um?Um(r):new t.constructor(r);return t.copy(i),i}a(QS,"cloneBuffer");function eC(t){var e=new t.constructor(t.byteLength);return new Zm(e).set(new Zm(t)),e}a(eC,"cloneArrayBuffer");function tC(t,e){var r=e?eC(t.buffer):t.buffer;return new t.constructor(r,t.byteOffset,t.length)}a(tC,"cloneTypedArray");function rC(t,e){var r=-1,i=t.length;for(e||(e=Array(i));++r<i;)e[r]=t[r];return e}a(rC,"copyArray");function iC(t,e,r,i){var n=!r;r||(r={});for(var o=-1,s=e.length;++o<s;){var l=e[o],u=i?i(r[l],t[l],l,r,t):void 0;u===void 0&&(u=t[l]),n?vu(r,l,u):jS(r,l,u)}return r}a(iC,"copyObject");function nC(t){return JS(function(e,r){var i=-1,n=r.length,o=n>1?r[n-1]:void 0,s=n>2?r[2]:void 0;for(o=t.length>3&&typeof o=="function"?(n--,o):void 0,s&&lC(r[0],r[1],s)&&(o=n<3?void 0:o,n=1),e=Object(e);++i<n;){var l=r[i];l&&t(e,l,i,o)}return e})}a(nC,"createAssigner");function oC(t){return function(e,r,i){for(var n=-1,o=Object(e),s=i(e),l=s.length;l--;){var u=s[t?l:++n];if(r(o[u],u,o)===!1)break}return e}}a(oC,"createBaseFor");function Aa(t,e){var r=t.__data__;return cC(e)?r[typeof e=="string"?"string":"hash"]:r.map}a(Aa,"getMapData");function bu(t,e){var r=pS(t,e);return WS(r)?r:void 0}a(bu,"getNative");function sC(t){var e=Tr.call(t,Xi),r=t[Xi];try{t[Xi]=void 0;var i=!0}catch(o){}var n=rf.call(t);return i&&(e?t[Xi]=r:delete t[Xi]),n}a(sC,"getRawTag");function aC(t){return typeof t.constructor=="function"&&!lf(t)?_S(nf(t)):{}}a(aC,"initCloneObject");function af(t,e){var r=typeof t;return e=e==null?qm:e,!!e&&(r=="number"||r!="symbol"&&lS.test(t))&&t>-1&&t%1==0&&t<e}a(af,"isIndex");function lC(t,e,r){if(!Yi(r))return!1;var i=typeof e;return(i=="number"?xu(r)&&af(e,r.length):i=="string"&&e in r)?ka(r[e],t):!1}a(lC,"isIterateeCall");function cC(t){var e=typeof t;return e=="string"||e=="number"||e=="symbol"||e=="boolean"?t!=="__proto__":t===null}a(cC,"isKeyable");function uC(t){return!!zm&&zm in t}a(uC,"isMasked");function lf(t){var e=t&&t.constructor,r=typeof e=="function"&&e.prototype||Ea;return t===r}a(lf,"isPrototype");function hC(t){var e=[];if(t!=null)for(var r in Object(t))e.push(r);return e}a(hC,"nativeKeysIn");function dC(t){return rf.call(t)}a(dC,"objectToString");function pC(t,e,r){return e=Hm(e===void 0?t.length-1:e,0),function(){for(var i=arguments,n=-1,o=Hm(i.length-e,0),s=Array(o);++n<o;)s[n]=i[e+n];n=-1;for(var l=Array(e+1);++n<e;)l[n]=i[n];return l[e]=r(s),uS(t,this,l)}}a(pC,"overRest");function fu(t,e){if(!(e==="constructor"&&typeof t[e]=="function")&&e!="__proto__")return t[e]}a(fu,"safeGet");var mC=fC(KS);function fC(t){var e=0,r=0;return function(){var i=CS(),n=Ax-(i-r);if(r=i,n>0){if(++e>=Lx)return arguments[0]}else e=0;return t.apply(void 0,arguments)}}a(fC,"shortOut");function yC(t){if(t!=null){try{return Da.call(t)}catch(e){}try{return t+""}catch(e){}}return""}a(yC,"toSource");function ka(t,e){return t===e||t!==t&&e!==e}a(ka,"eq");var yu=Wm(function(){return arguments}())?Wm:function(t){return Ro(t)&&Tr.call(t,"callee")&&!bS.call(t,"callee")},gu=Array.isArray;function xu(t){return t!=null&&uf(t.length)&&!Su(t)}a(xu,"isArrayLike");function gC(t){return Ro(t)&&xu(t)}a(gC,"isArrayLikeObject");var cf=SS||CC;function Su(t){if(!Yi(t))return!1;var e=La(t);return e==Jm||e==Gx||e==Rx||e==Zx}a(Su,"isFunction");function uf(t){return typeof t=="number"&&t>-1&&t%1==0&&t<=qm}a(uf,"isLength");function Yi(t){var e=typeof t;return t!=null&&(e=="object"||e=="function")}a(Yi,"isObject");function Ro(t){return t!=null&&typeof t=="object"}a(Ro,"isObjectLike");function vC(t){if(!Ro(t)||La(t)!=Km)return!1;var e=nf(t);if(e===null)return!0;var r=Tr.call(e,"constructor")&&e.constructor;return typeof r=="function"&&r instanceof r&&Da.call(r)==gS}a(vC,"isPlainObject");var hf=Xm?dS(Xm):VS;function bC(t){return iC(t,df(t))}a(bC,"toPlainObject");function df(t){return xu(t)?US(t,!0):qS(t)}a(df,"keysIn");var xC=nC(function(t,e,r){sf(t,e,r)});function SC(t){return function(){return t}}a(SC,"constant");function pf(t){return t}a(pf,"identity");function CC(){return!1}a(CC,"stubFalse");Rn.exports=xC});var gy=Ar((wL,Qo)=>{"use strict";v();var c_=!1,Vi=!1,uy=!0,hy=!1,d={},dy=!1;typeof Qo<"u"&&Qo.exports?(Qo.exports=d,dy=!0):typeof document<"u"?window.ClipperLib=d:self.ClipperLib=d;var ll;dy?(We="chrome",ll="Netscape"):(We=navigator.userAgent.toString().toLowerCase(),ll=navigator.appName);var We,de={};We.indexOf("chrome")!=-1&&We.indexOf("chromium")==-1?de.chrome=1:de.chrome=0;We.indexOf("chromium")!=-1?de.chromium=1:de.chromium=0;We.indexOf("safari")!=-1&&We.indexOf("chrome")==-1&&We.indexOf("chromium")==-1?de.safari=1:de.safari=0;We.indexOf("firefox")!=-1?de.firefox=1:de.firefox=0;We.indexOf("firefox/17")!=-1?de.firefox17=1:de.firefox17=0;We.indexOf("firefox/15")!=-1?de.firefox15=1:de.firefox15=0;We.indexOf("firefox/3")!=-1?de.firefox3=1:de.firefox3=0;We.indexOf("opera")!=-1?de.opera=1:de.opera=0;We.indexOf("msie 10")!=-1?de.msie10=1:de.msie10=0;We.indexOf("msie 9")!=-1?de.msie9=1:de.msie9=0;We.indexOf("msie 8")!=-1?de.msie8=1:de.msie8=0;We.indexOf("msie 7")!=-1?de.msie7=1:de.msie7=0;We.indexOf("msie ")!=-1?de.msie=1:de.msie=0;d.biginteger_used=null;var Kr,u_=0xdeadbeefcafe,ly=(u_&16777215)==15715070;function B(t,e,r){d.biginteger_used=1,t!=null&&(typeof t=="number"&&typeof e>"u"?this.fromInt(t):typeof t=="number"?this.fromNumber(t,e,r):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}a(B,"BigInteger");function ye(){return new B(null)}a(ye,"nbi");function h_(t,e,r,i,n,o){for(;--o>=0;){var s=e*this[t++]+r[i]+n;n=Math.floor(s/67108864),r[i++]=s&67108863}return n}a(h_,"am1");function d_(t,e,r,i,n,o){for(var s=e&32767,l=e>>15;--o>=0;){var u=this[t]&32767,h=this[t++]>>15,m=l*u+h*s;u=s*u+((m&32767)<<15)+r[i]+(n&1073741823),n=(u>>>30)+(m>>>15)+l*h+(n>>>30),r[i++]=u&1073741823}return n}a(d_,"am2");function p_(t,e,r,i,n,o){for(var s=e&16383,l=e>>14;--o>=0;){var u=this[t]&16383,h=this[t++]>>14,m=l*u+h*s;u=s*u+((m&16383)<<14)+r[i]+n,n=(u>>28)+(m>>14)+l*h,r[i++]=u&268435455}return n}a(p_,"am3");ly&&ll=="Microsoft Internet Explorer"?(B.prototype.am=d_,Kr=30):ly&&ll!="Netscape"?(B.prototype.am=h_,Kr=26):(B.prototype.am=p_,Kr=28);B.prototype.DB=Kr;B.prototype.DM=(1<<Kr)-1;B.prototype.DV=1<<Kr;var ph=52;B.prototype.FV=Math.pow(2,ph);B.prototype.F1=ph-Kr;B.prototype.F2=2*Kr-ph;var m_="0123456789abcdefghijklmnopqrstuvwxyz",ul=new Array,Wn,Ot;Wn=48;for(Ot=0;Ot<=9;++Ot)ul[Wn++]=Ot;Wn=97;for(Ot=10;Ot<36;++Ot)ul[Wn++]=Ot;Wn=65;for(Ot=10;Ot<36;++Ot)ul[Wn++]=Ot;function cy(t){return m_.charAt(t)}a(cy,"int2char");function py(t,e){var r=ul[t.charCodeAt(e)];return r==null?-1:r}a(py,"intAt");function f_(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}a(f_,"bnpCopyTo");function y_(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}a(y_,"bnpFromInt");function Jr(t){var e=ye();return e.fromInt(t),e}a(Jr,"nbv");function g_(t,e){var r;if(e==16)r=4;else if(e==8)r=3;else if(e==256)r=8;else if(e==2)r=1;else if(e==32)r=5;else if(e==4)r=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var i=t.length,n=!1,o=0;--i>=0;){var s=r==8?t[i]&255:py(t,i);if(s<0){t.charAt(i)=="-"&&(n=!0);continue}n=!1,o==0?this[this.t++]=s:o+r>this.DB?(this[this.t-1]|=(s&(1<<this.DB-o)-1)<<o,this[this.t++]=s>>this.DB-o):this[this.t-1]|=s<<o,o+=r,o>=this.DB&&(o-=this.DB)}r==8&&(t[0]&128)!=0&&(this.s=-1,o>0&&(this[this.t-1]|=(1<<this.DB-o)-1<<o)),this.clamp(),n&&B.ZERO.subTo(this,this)}a(g_,"bnpFromString");function v_(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}a(v_,"bnpClamp");function b_(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var r=(1<<e)-1,i,n=!1,o="",s=this.t,l=this.DB-s*this.DB%e;if(s-- >0)for(l<this.DB&&(i=this[s]>>l)>0&&(n=!0,o=cy(i));s>=0;)l<e?(i=(this[s]&(1<<l)-1)<<e-l,i|=this[--s]>>(l+=this.DB-e)):(i=this[s]>>(l-=e)&r,l<=0&&(l+=this.DB,--s)),i>0&&(n=!0),n&&(o+=cy(i));return n?o:"0"}a(b_,"bnToString");function x_(){var t=ye();return B.ZERO.subTo(this,t),t}a(x_,"bnNegate");function S_(){return this.s<0?this.negate():this}a(S_,"bnAbs");function C_(t){var e=this.s-t.s;if(e!=0)return e;var r=this.t;if(e=r-t.t,e!=0)return this.s<0?-e:e;for(;--r>=0;)if((e=this[r]-t[r])!=0)return e;return 0}a(C_,"bnCompareTo");function hl(t){var e=1,r;return(r=t>>>16)!=0&&(t=r,e+=16),(r=t>>8)!=0&&(t=r,e+=8),(r=t>>4)!=0&&(t=r,e+=4),(r=t>>2)!=0&&(t=r,e+=2),(r=t>>1)!=0&&(t=r,e+=1),e}a(hl,"nbits");function __(){return this.t<=0?0:this.DB*(this.t-1)+hl(this[this.t-1]^this.s&this.DM)}a(__,"bnBitLength");function P_(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s}a(P_,"bnpDLShiftTo");function T_(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s}a(T_,"bnpDRShiftTo");function w_(t,e){var r=t%this.DB,i=this.DB-r,n=(1<<i)-1,o=Math.floor(t/this.DB),s=this.s<<r&this.DM,l;for(l=this.t-1;l>=0;--l)e[l+o+1]=this[l]>>i|s,s=(this[l]&n)<<r;for(l=o-1;l>=0;--l)e[l]=0;e[o]=s,e.t=this.t+o+1,e.s=this.s,e.clamp()}a(w_,"bnpLShiftTo");function M_(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var i=t%this.DB,n=this.DB-i,o=(1<<i)-1;e[0]=this[r]>>i;for(var s=r+1;s<this.t;++s)e[s-r-1]|=(this[s]&o)<<n,e[s-r]=this[s]>>i;i>0&&(e[this.t-r-1]|=(this.s&o)<<n),e.t=this.t-r,e.clamp()}a(M_,"bnpRShiftTo");function I_(t,e){for(var r=0,i=0,n=Math.min(t.t,this.t);r<n;)i+=this[r]-t[r],e[r++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i-=t.s;r<this.t;)i+=this[r],e[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<t.t;)i-=t[r],e[r++]=i&this.DM,i>>=this.DB;i-=t.s}e.s=i<0?-1:0,i<-1?e[r++]=this.DV+i:i>0&&(e[r++]=i),e.t=r,e.clamp()}a(I_,"bnpSubTo");function E_(t,e){var r=this.abs(),i=t.abs(),n=r.t;for(e.t=n+i.t;--n>=0;)e[n]=0;for(n=0;n<i.t;++n)e[n+r.t]=r.am(0,i[n],e,n,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&B.ZERO.subTo(e,e)}a(E_,"bnpMultiplyTo");function D_(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var i=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,i,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()}a(D_,"bnpSquareTo");function O_(t,e,r){var i=t.abs();if(!(i.t<=0)){var n=this.abs();if(n.t<i.t){e!=null&&e.fromInt(0),r!=null&&this.copyTo(r);return}r==null&&(r=ye());var o=ye(),s=this.s,l=t.s,u=this.DB-hl(i[i.t-1]);u>0?(i.lShiftTo(u,o),n.lShiftTo(u,r)):(i.copyTo(o),n.copyTo(r));var h=o.t,m=o[h-1];if(m!=0){var f=m*(1<<this.F1)+(h>1?o[h-2]>>this.F2:0),b=this.FV/f,y=(1<<this.F1)/f,_=1<<this.F2,T=r.t,g=T-h,x=e==null?ye():e;for(o.dlShiftTo(g,x),r.compareTo(x)>=0&&(r[r.t++]=1,r.subTo(x,r)),B.ONE.dlShiftTo(h,x),x.subTo(o,o);o.t<h;)o[o.t++]=0;for(;--g>=0;){var P=r[--T]==m?this.DM:Math.floor(r[T]*b+(r[T-1]+_)*y);if((r[T]+=o.am(0,P,r,g,0,h))<P)for(o.dlShiftTo(g,x),r.subTo(x,r);r[T]<--P;)r.subTo(x,r)}e!=null&&(r.drShiftTo(h,e),s!=l&&B.ZERO.subTo(e,e)),r.t=h,r.clamp(),u>0&&r.rShiftTo(u,r),s<0&&B.ZERO.subTo(r,r)}}}a(O_,"bnpDivRemTo");function L_(t){var e=ye();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(B.ZERO)>0&&t.subTo(e,e),e}a(L_,"bnMod");function qi(t){this.m=t}a(qi,"Classic");function A_(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}a(A_,"cConvert");function k_(t){return t}a(k_,"cRevert");function R_(t){t.divRemTo(this.m,null,t)}a(R_,"cReduce");function N_(t,e,r){t.multiplyTo(e,r),this.reduce(r)}a(N_,"cMulTo");function B_(t,e){t.squareTo(e),this.reduce(e)}a(B_,"cSqrTo");qi.prototype.convert=A_;qi.prototype.revert=k_;qi.prototype.reduce=R_;qi.prototype.mulTo=N_;qi.prototype.sqrTo=B_;function F_(){if(this.t<1)return 0;var t=this[0];if((t&1)==0)return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}a(F_,"bnpInvDigit");function $i(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}a($i,"Montgomery");function G_(t){var e=ye();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(B.ZERO)>0&&this.m.subTo(e,e),e}a(G_,"montConvert");function X_(t){var e=ye();return t.copyTo(e),this.reduce(e),e}a(X_,"montRevert");function z_(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=t[e]&32767,i=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t[r]+=this.m.am(0,i,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}a(z_,"montReduce");function Y_(t,e){t.squareTo(e),this.reduce(e)}a(Y_,"montSqrTo");function Z_(t,e,r){t.multiplyTo(e,r),this.reduce(r)}a(Z_,"montMulTo");$i.prototype.convert=G_;$i.prototype.revert=X_;$i.prototype.reduce=z_;$i.prototype.mulTo=Z_;$i.prototype.sqrTo=Y_;function U_(){return(this.t>0?this[0]&1:this.s)==0}a(U_,"bnpIsEven");function j_(t,e){if(t>4294967295||t<1)return B.ONE;var r=ye(),i=ye(),n=e.convert(this),o=hl(t)-1;for(n.copyTo(r);--o>=0;)if(e.sqrTo(r,i),(t&1<<o)>0)e.mulTo(i,n,r);else{var s=r;r=i,i=s}return e.revert(r)}a(j_,"bnpExp");function H_(t,e){var r;return t<256||e.isEven()?r=new qi(e):r=new $i(e),this.exp(t,r)}a(H_,"bnModPowInt");B.prototype.copyTo=f_;B.prototype.fromInt=y_;B.prototype.fromString=g_;B.prototype.clamp=v_;B.prototype.dlShiftTo=P_;B.prototype.drShiftTo=T_;B.prototype.lShiftTo=w_;B.prototype.rShiftTo=M_;B.prototype.subTo=I_;B.prototype.multiplyTo=E_;B.prototype.squareTo=D_;B.prototype.divRemTo=O_;B.prototype.invDigit=F_;B.prototype.isEven=U_;B.prototype.exp=j_;B.prototype.toString=b_;B.prototype.negate=x_;B.prototype.abs=S_;B.prototype.compareTo=C_;B.prototype.bitLength=__;B.prototype.mod=L_;B.prototype.modPowInt=H_;B.ZERO=Jr(0);B.ONE=Jr(1);function W_(){var t=ye();return this.copyTo(t),t}a(W_,"bnClone");function V_(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}a(V_,"bnIntValue");function q_(){return this.t==0?this.s:this[0]<<24>>24}a(q_,"bnByteValue");function $_(){return this.t==0?this.s:this[0]<<16>>16}a($_,"bnShortValue");function J_(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}a(J_,"bnpChunkSize");function K_(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}a(K_,"bnSigNum");function Q_(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),i=Jr(r),n=ye(),o=ye(),s="";for(this.divRemTo(i,n,o);n.signum()>0;)s=(r+o.intValue()).toString(t).substr(1)+s,n.divRemTo(i,n,o);return o.intValue().toString(t)+s}a(Q_,"bnpToRadix");function eP(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),i=Math.pow(e,r),n=!1,o=0,s=0,l=0;l<t.length;++l){var u=py(t,l);if(u<0){t.charAt(l)=="-"&&this.signum()==0&&(n=!0);continue}s=e*s+u,++o>=r&&(this.dMultiply(i),this.dAddOffset(s,0),o=0,s=0)}o>0&&(this.dMultiply(Math.pow(e,o)),this.dAddOffset(s,0)),n&&B.ZERO.subTo(this,this)}a(eP,"bnpFromRadix");function tP(t,e,r){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(B.ONE.shiftLeft(t-1),mh,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(B.ONE.shiftLeft(t-1),this);else{var i=new Array,n=t&7;i.length=(t>>3)+1,e.nextBytes(i),n>0?i[0]&=(1<<n)-1:i[0]=0,this.fromString(i,256)}}a(tP,"bnpFromNumber");function rP(){var t=this.t,e=new Array;e[0]=this.s;var r=this.DB-t*this.DB%8,i,n=0;if(t-- >0)for(r<this.DB&&(i=this[t]>>r)!=(this.s&this.DM)>>r&&(e[n++]=i|this.s<<this.DB-r);t>=0;)r<8?(i=(this[t]&(1<<r)-1)<<8-r,i|=this[--t]>>(r+=this.DB-8)):(i=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),(i&128)!=0&&(i|=-256),n==0&&(this.s&128)!=(i&128)&&++n,(n>0||i!=this.s)&&(e[n++]=i);return e}a(rP,"bnToByteArray");function iP(t){return this.compareTo(t)==0}a(iP,"bnEquals");function nP(t){return this.compareTo(t)<0?this:t}a(nP,"bnMin");function oP(t){return this.compareTo(t)>0?this:t}a(oP,"bnMax");function sP(t,e,r){var i,n,o=Math.min(t.t,this.t);for(i=0;i<o;++i)r[i]=e(this[i],t[i]);if(t.t<this.t){for(n=t.s&this.DM,i=o;i<this.t;++i)r[i]=e(this[i],n);r.t=this.t}else{for(n=this.s&this.DM,i=o;i<t.t;++i)r[i]=e(n,t[i]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()}a(sP,"bnpBitwiseTo");function aP(t,e){return t&e}a(aP,"op_and");function lP(t){var e=ye();return this.bitwiseTo(t,aP,e),e}a(lP,"bnAnd");function mh(t,e){return t|e}a(mh,"op_or");function cP(t){var e=ye();return this.bitwiseTo(t,mh,e),e}a(cP,"bnOr");function my(t,e){return t^e}a(my,"op_xor");function uP(t){var e=ye();return this.bitwiseTo(t,my,e),e}a(uP,"bnXor");function fy(t,e){return t&~e}a(fy,"op_andnot");function hP(t){var e=ye();return this.bitwiseTo(t,fy,e),e}a(hP,"bnAndNot");function dP(){for(var t=ye(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t}a(dP,"bnNot");function pP(t){var e=ye();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}a(pP,"bnShiftLeft");function mP(t){var e=ye();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}a(mP,"bnShiftRight");function fP(t){if(t==0)return-1;var e=0;return(t&65535)==0&&(t>>=16,e+=16),(t&255)==0&&(t>>=8,e+=8),(t&15)==0&&(t>>=4,e+=4),(t&3)==0&&(t>>=2,e+=2),(t&1)==0&&++e,e}a(fP,"lbit");function yP(){for(var t=0;t<this.t;++t)if(this[t]!=0)return t*this.DB+fP(this[t]);return this.s<0?this.t*this.DB:-1}a(yP,"bnGetLowestSetBit");function gP(t){for(var e=0;t!=0;)t&=t-1,++e;return e}a(gP,"cbit");function vP(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=gP(this[r]^e);return t}a(vP,"bnBitCount");function bP(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this[e]&1<<t%this.DB)!=0}a(bP,"bnTestBit");function xP(t,e){var r=B.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r}a(xP,"bnpChangeBit");function SP(t){return this.changeBit(t,mh)}a(SP,"bnSetBit");function CP(t){return this.changeBit(t,fy)}a(CP,"bnClearBit");function _P(t){return this.changeBit(t,my)}a(_P,"bnFlipBit");function PP(t,e){for(var r=0,i=0,n=Math.min(t.t,this.t);r<n;)i+=this[r]+t[r],e[r++]=i&this.DM,i>>=this.DB;if(t.t<this.t){for(i+=t.s;r<this.t;)i+=this[r],e[r++]=i&this.DM,i>>=this.DB;i+=this.s}else{for(i+=this.s;r<t.t;)i+=t[r],e[r++]=i&this.DM,i>>=this.DB;i+=t.s}e.s=i<0?-1:0,i>0?e[r++]=i:i<-1&&(e[r++]=this.DV+i),e.t=r,e.clamp()}a(PP,"bnpAddTo");function TP(t){var e=ye();return this.addTo(t,e),e}a(TP,"bnAdd");function wP(t){var e=ye();return this.subTo(t,e),e}a(wP,"bnSubtract");function MP(t){var e=ye();return this.multiplyTo(t,e),e}a(MP,"bnMultiply");function IP(){var t=ye();return this.squareTo(t),t}a(IP,"bnSquare");function EP(t){var e=ye();return this.divRemTo(t,e,null),e}a(EP,"bnDivide");function DP(t){var e=ye();return this.divRemTo(t,null,e),e}a(DP,"bnRemainder");function OP(t){var e=ye(),r=ye();return this.divRemTo(t,e,r),new Array(e,r)}a(OP,"bnDivideAndRemainder");function LP(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}a(LP,"bnpDMultiply");function AP(t,e){if(t!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}a(AP,"bnpDAddOffset");function es(){}a(es,"NullExp");function yy(t){return t}a(yy,"nNop");function kP(t,e,r){t.multiplyTo(e,r)}a(kP,"nMulTo");function RP(t,e){t.squareTo(e)}a(RP,"nSqrTo");es.prototype.convert=yy;es.prototype.revert=yy;es.prototype.mulTo=kP;es.prototype.sqrTo=RP;function NP(t){return this.exp(t,new es)}a(NP,"bnPow");function BP(t,e,r){var i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r[--i]=0;var n;for(n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,t[i],r,i,0,this.t);for(n=Math.min(t.t,e);i<n;++i)this.am(0,t[i],r,i,0,e-i);r.clamp()}a(BP,"bnpMultiplyLowerTo");function FP(t,e,r){--e;var i=r.t=this.t+t.t-e;for(r.s=0;--i>=0;)r[i]=0;for(i=Math.max(e-this.t,0);i<t.t;++i)r[this.t+i-e]=this.am(e-i,t[i],r,0,0,this.t+i-e);r.clamp(),r.drShiftTo(1,r)}a(FP,"bnpMultiplyUpperTo");function Vn(t){this.r2=ye(),this.q3=ye(),B.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}a(Vn,"Barrett");function GP(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=ye();return t.copyTo(e),this.reduce(e),e}a(GP,"barrettConvert");function XP(t){return t}a(XP,"barrettRevert");function zP(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}a(zP,"barrettReduce");function YP(t,e){t.squareTo(e),this.reduce(e)}a(YP,"barrettSqrTo");function ZP(t,e,r){t.multiplyTo(e,r),this.reduce(r)}a(ZP,"barrettMulTo");Vn.prototype.convert=GP;Vn.prototype.revert=XP;Vn.prototype.reduce=zP;Vn.prototype.mulTo=ZP;Vn.prototype.sqrTo=YP;function UP(t,e){var r=t.bitLength(),i,n=Jr(1),o;if(r<=0)return n;r<18?i=1:r<48?i=3:r<144?i=4:r<768?i=5:i=6,r<8?o=new qi(e):e.isEven()?o=new Vn(e):o=new $i(e);var s=new Array,l=3,u=i-1,h=(1<<i)-1;if(s[1]=o.convert(this),i>1){var m=ye();for(o.sqrTo(s[1],m);l<=h;)s[l]=ye(),o.mulTo(m,s[l-2],s[l]),l+=2}var f=t.t-1,b,y=!0,_=ye(),T;for(r=hl(t[f])-1;f>=0;){for(r>=u?b=t[f]>>r-u&h:(b=(t[f]&(1<<r+1)-1)<<u-r,f>0&&(b|=t[f-1]>>this.DB+r-u)),l=i;(b&1)==0;)b>>=1,--l;if((r-=l)<0&&(r+=this.DB,--f),y)s[b].copyTo(n),y=!1;else{for(;l>1;)o.sqrTo(n,_),o.sqrTo(_,n),l-=2;l>0?o.sqrTo(n,_):(T=n,n=_,_=T),o.mulTo(_,s[b],n)}for(;f>=0&&(t[f]&1<<r)==0;)o.sqrTo(n,_),T=n,n=_,_=T,--r<0&&(r=this.DB-1,--f)}return o.revert(n)}a(UP,"bnModPow");function jP(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var i=e;e=r,r=i}var n=e.getLowestSetBit(),o=r.getLowestSetBit();if(o<0)return e;for(n<o&&(o=n),o>0&&(e.rShiftTo(o,e),r.rShiftTo(o,r));e.signum()>0;)(n=e.getLowestSetBit())>0&&e.rShiftTo(n,e),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return o>0&&r.lShiftTo(o,r),r}a(jP,"bnGCD");function HP(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(e==0)r=this[0]%t;else for(var i=this.t-1;i>=0;--i)r=(e*r+this[i])%t;return r}a(HP,"bnpModInt");function WP(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return B.ZERO;for(var r=t.clone(),i=this.clone(),n=Jr(1),o=Jr(0),s=Jr(0),l=Jr(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!n.isEven()||!o.isEven())&&(n.addTo(this,n),o.subTo(t,o)),n.rShiftTo(1,n)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);for(;i.isEven();)i.rShiftTo(1,i),e?((!s.isEven()||!l.isEven())&&(s.addTo(this,s),l.subTo(t,l)),s.rShiftTo(1,s)):l.isEven()||l.subTo(t,l),l.rShiftTo(1,l);r.compareTo(i)>=0?(r.subTo(i,r),e&&n.subTo(s,n),o.subTo(l,o)):(i.subTo(r,i),e&&s.subTo(n,s),l.subTo(o,l))}if(i.compareTo(B.ONE)!=0)return B.ZERO;if(l.compareTo(t)>=0)return l.subtract(t);if(l.signum()<0)l.addTo(t,l);else return l;return l.signum()<0?l.add(t):l}a(WP,"bnModInverse");var ut=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],VP=(1<<26)/ut[ut.length-1];function qP(t){var e,r=this.abs();if(r.t==1&&r[0]<=ut[ut.length-1]){for(e=0;e<ut.length;++e)if(r[0]==ut[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<ut.length;){for(var i=ut[e],n=e+1;n<ut.length&&i<VP;)i*=ut[n++];for(i=r.modInt(i);e<n;)if(i%ut[e++]==0)return!1}return r.millerRabin(t)}a(qP,"bnIsProbablePrime");function $P(t){var e=this.subtract(B.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var i=e.shiftRight(r);t=t+1>>1,t>ut.length&&(t=ut.length);for(var n=ye(),o=0;o<t;++o){n.fromInt(ut[Math.floor(Math.random()*ut.length)]);var s=n.modPow(i,this);if(s.compareTo(B.ONE)!=0&&s.compareTo(e)!=0){for(var l=1;l++<r&&s.compareTo(e)!=0;)if(s=s.modPowInt(2,this),s.compareTo(B.ONE)==0)return!1;if(s.compareTo(e)!=0)return!1}}return!0}a($P,"bnpMillerRabin");B.prototype.chunkSize=J_;B.prototype.toRadix=Q_;B.prototype.fromRadix=eP;B.prototype.fromNumber=tP;B.prototype.bitwiseTo=sP;B.prototype.changeBit=xP;B.prototype.addTo=PP;B.prototype.dMultiply=LP;B.prototype.dAddOffset=AP;B.prototype.multiplyLowerTo=BP;B.prototype.multiplyUpperTo=FP;B.prototype.modInt=HP;B.prototype.millerRabin=$P;B.prototype.clone=W_;B.prototype.intValue=V_;B.prototype.byteValue=q_;B.prototype.shortValue=$_;B.prototype.signum=K_;B.prototype.toByteArray=rP;B.prototype.equals=iP;B.prototype.min=nP;B.prototype.max=oP;B.prototype.and=lP;B.prototype.or=cP;B.prototype.xor=uP;B.prototype.andNot=hP;B.prototype.not=dP;B.prototype.shiftLeft=pP;B.prototype.shiftRight=mP;B.prototype.getLowestSetBit=yP;B.prototype.bitCount=vP;B.prototype.testBit=bP;B.prototype.setBit=SP;B.prototype.clearBit=CP;B.prototype.flipBit=_P;B.prototype.add=TP;B.prototype.subtract=wP;B.prototype.multiply=MP;B.prototype.divide=EP;B.prototype.remainder=DP;B.prototype.divideAndRemainder=OP;B.prototype.modPow=UP;B.prototype.modInverse=WP;B.prototype.pow=NP;B.prototype.gcd=jP;B.prototype.isProbablePrime=qP;B.prototype.square=IP;var ce=B;ce.prototype.IsNegative=function(){return this.compareTo(ce.ZERO)==-1};ce.op_Equality=function(t,e){return t.compareTo(e)==0};ce.op_Inequality=function(t,e){return t.compareTo(e)!=0};ce.op_GreaterThan=function(t,e){return t.compareTo(e)>0};ce.op_LessThan=function(t,e){return t.compareTo(e)<0};ce.op_Addition=function(t,e){return new ce(t).add(new ce(e))};ce.op_Subtraction=function(t,e){return new ce(t).subtract(new ce(e))};ce.Int128Mul=function(t,e){return new ce(t).multiply(new ce(e))};ce.op_Division=function(t,e){return t.divide(e)};ce.prototype.ToDouble=function(){return parseFloat(this.toString())};typeof cl>"u"&&(cl=a(function(t,e){var r;if(typeof Object.getOwnPropertyNames>"u"){for(r in e.prototype)(typeof t.prototype[r]>"u"||t.prototype[r]==Object.prototype[r])&&(t.prototype[r]=e.prototype[r]);for(r in e)typeof t[r]>"u"&&(t[r]=e[r]);t.$baseCtor=e}else{for(var i=Object.getOwnPropertyNames(e.prototype),n=0;n<i.length;n++)typeof Object.getOwnPropertyDescriptor(t.prototype,i[n])>"u"&&Object.defineProperty(t.prototype,i[n],Object.getOwnPropertyDescriptor(e.prototype,i[n]));for(r in e)typeof t[r]>"u"&&(t[r]=e[r]);t.$baseCtor=e}},"Inherit"));var cl;d.Path=function(){return[]};d.Paths=function(){return[]};d.DoublePoint=function(){var t=arguments;this.X=0,this.Y=0,t.length==1?(this.X=t[0].X,this.Y=t[0].Y):t.length==2&&(this.X=t[0],this.Y=t[1])};d.DoublePoint0=function(){this.X=0,this.Y=0};d.DoublePoint1=function(t){this.X=t.X,this.Y=t.Y};d.DoublePoint2=function(t,e){this.X=t,this.Y=e};d.PolyNode=function(){this.m_Parent=null,this.m_polygon=new d.Path,this.m_Index=0,this.m_jointype=0,this.m_endtype=0,this.m_Childs=[],this.IsOpen=!1};d.PolyNode.prototype.IsHoleNode=function(){for(var t=!0,e=this.m_Parent;e!==null;)t=!t,e=e.m_Parent;return t};d.PolyNode.prototype.ChildCount=function(){return this.m_Childs.length};d.PolyNode.prototype.Contour=function(){return this.m_polygon};d.PolyNode.prototype.AddChild=function(t){var e=this.m_Childs.length;this.m_Childs.push(t),t.m_Parent=this,t.m_Index=e};d.PolyNode.prototype.GetNext=function(){return this.m_Childs.length>0?this.m_Childs[0]:this.GetNextSiblingUp()};d.PolyNode.prototype.GetNextSiblingUp=function(){return this.m_Parent===null?null:this.m_Index==this.m_Parent.m_Childs.length-1?this.m_Parent.GetNextSiblingUp():this.m_Parent.m_Childs[this.m_Index+1]};d.PolyNode.prototype.Childs=function(){return this.m_Childs};d.PolyNode.prototype.Parent=function(){return this.m_Parent};d.PolyNode.prototype.IsHole=function(){return this.IsHoleNode()};d.PolyTree=function(){this.m_AllPolys=[],d.PolyNode.call(this)};d.PolyTree.prototype.Clear=function(){for(var t=0,e=this.m_AllPolys.length;t<e;t++)this.m_AllPolys[t]=null;this.m_AllPolys.length=0,this.m_Childs.length=0};d.PolyTree.prototype.GetFirst=function(){return this.m_Childs.length>0?this.m_Childs[0]:null};d.PolyTree.prototype.Total=function(){return this.m_AllPolys.length};cl(d.PolyTree,d.PolyNode);d.Math_Abs_Int64=d.Math_Abs_Int32=d.Math_Abs_Double=function(t){return Math.abs(t)};d.Math_Max_Int32_Int32=function(t,e){return Math.max(t,e)};de.msie||de.opera||de.safari?d.Cast_Int32=function(t){return t|0}:d.Cast_Int32=function(t){return~~t};de.chrome?d.Cast_Int64=function(t){return t<-2147483648||t>2147483647?t<0?Math.ceil(t):Math.floor(t):~~t}:de.firefox&&typeof Number.toInteger=="function"?d.Cast_Int64=function(t){return Number.toInteger(t)}:de.msie7||de.msie8?d.Cast_Int64=function(t){return parseInt(t,10)}:de.msie?d.Cast_Int64=function(t){return t<-2147483648||t>2147483647?t<0?Math.ceil(t):Math.floor(t):t|0}:d.Cast_Int64=function(t){return t<0?Math.ceil(t):Math.floor(t)};d.Clear=function(t){t.length=0};d.PI=3.141592653589793;d.PI2=2*3.141592653589793;d.IntPoint=function(){var t=arguments,e=t.length;if(this.X=0,this.Y=0,Vi)if(this.Z=0,e==3)this.X=t[0],this.Y=t[1],this.Z=t[2];else if(e==2)this.X=t[0],this.Y=t[1],this.Z=0;else if(e==1)if(t[0]instanceof d.DoublePoint){var r=t[0];this.X=d.Clipper.Round(r.X),this.Y=d.Clipper.Round(r.Y),this.Z=0}else{var i=t[0];typeof i.Z>"u"&&(i.Z=0),this.X=i.X,this.Y=i.Y,this.Z=i.Z}else this.X=0,this.Y=0,this.Z=0;else if(e==2)this.X=t[0],this.Y=t[1];else if(e==1)if(t[0]instanceof d.DoublePoint){var r=t[0];this.X=d.Clipper.Round(r.X),this.Y=d.Clipper.Round(r.Y)}else{var i=t[0];this.X=i.X,this.Y=i.Y}else this.X=0,this.Y=0};d.IntPoint.op_Equality=function(t,e){return t.X==e.X&&t.Y==e.Y};d.IntPoint.op_Inequality=function(t,e){return t.X!=e.X||t.Y!=e.Y};Vi?(d.IntPoint0=function(){this.X=0,this.Y=0,this.Z=0},d.IntPoint1=function(t){this.X=t.X,this.Y=t.Y,this.Z=t.Z},d.IntPoint1dp=function(t){this.X=d.Clipper.Round(t.X),this.Y=d.Clipper.Round(t.Y),this.Z=0},d.IntPoint2=function(t,e){this.X=t,this.Y=e,this.Z=0},d.IntPoint3=function(t,e,r){this.X=t,this.Y=e,this.Z=r}):(d.IntPoint0=function(){this.X=0,this.Y=0},d.IntPoint1=function(t){this.X=t.X,this.Y=t.Y},d.IntPoint1dp=function(t){this.X=d.Clipper.Round(t.X),this.Y=d.Clipper.Round(t.Y)},d.IntPoint2=function(t,e){this.X=t,this.Y=e});d.IntRect=function(){var t=arguments,e=t.length;e==4?(this.left=t[0],this.top=t[1],this.right=t[2],this.bottom=t[3]):e==1?(this.left=ir.left,this.top=ir.top,this.right=ir.right,this.bottom=ir.bottom):(this.left=0,this.top=0,this.right=0,this.bottom=0)};d.IntRect0=function(){this.left=0,this.top=0,this.right=0,this.bottom=0};d.IntRect1=function(t){this.left=t.left,this.top=t.top,this.right=t.right,this.bottom=t.bottom};d.IntRect4=function(t,e,r,i){this.left=t,this.top=e,this.right=r,this.bottom=i};d.ClipType={ctIntersection:0,ctUnion:1,ctDifference:2,ctXor:3};d.PolyType={ptSubject:0,ptClip:1};d.PolyFillType={pftEvenOdd:0,pftNonZero:1,pftPositive:2,pftNegative:3};d.JoinType={jtSquare:0,jtRound:1,jtMiter:2};d.EndType={etOpenSquare:0,etOpenRound:1,etOpenButt:2,etClosedLine:3,etClosedPolygon:4};hy&&(d.EndType_={etSquare:0,etRound:1,etButt:2,etClosed:3});d.EdgeSide={esLeft:0,esRight:1};d.Direction={dRightToLeft:0,dLeftToRight:1};d.TEdge=function(){this.Bot=new d.IntPoint,this.Curr=new d.IntPoint,this.Top=new d.IntPoint,this.Delta=new d.IntPoint,this.Dx=0,this.PolyTyp=d.PolyType.ptSubject,this.Side=d.EdgeSide.esLeft,this.WindDelta=0,this.WindCnt=0,this.WindCnt2=0,this.OutIdx=0,this.Next=null,this.Prev=null,this.NextInLML=null,this.NextInAEL=null,this.PrevInAEL=null,this.NextInSEL=null,this.PrevInSEL=null};d.IntersectNode=function(){this.Edge1=null,this.Edge2=null,this.Pt=new d.IntPoint};d.MyIntersectNodeSort=function(){};d.MyIntersectNodeSort.Compare=function(t,e){return e.Pt.Y-t.Pt.Y};d.LocalMinima=function(){this.Y=0,this.LeftBound=null,this.RightBound=null,this.Next=null};d.Scanbeam=function(){this.Y=0,this.Next=null};d.OutRec=function(){this.Idx=0,this.IsHole=!1,this.IsOpen=!1,this.FirstLeft=null,this.Pts=null,this.BottomPt=null,this.PolyNode=null};d.OutPt=function(){this.Idx=0,this.Pt=new d.IntPoint,this.Next=null,this.Prev=null};d.Join=function(){this.OutPt1=null,this.OutPt2=null,this.OffPt=new d.IntPoint};d.ClipperBase=function(){this.m_MinimaList=null,this.m_CurrentLM=null,this.m_edges=new Array,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1,this.PreserveCollinear=!1,this.m_MinimaList=null,this.m_CurrentLM=null,this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};d.ClipperBase.horizontal=-9007199254740992;d.ClipperBase.Skip=-2;d.ClipperBase.Unassigned=-1;d.ClipperBase.tolerance=1e-20;c_?(d.ClipperBase.loRange=46340,d.ClipperBase.hiRange=46340):(d.ClipperBase.loRange=47453132,d.ClipperBase.hiRange=0xfffffffffffff);d.ClipperBase.near_zero=function(t){return t>-d.ClipperBase.tolerance&&t<d.ClipperBase.tolerance};d.ClipperBase.IsHorizontal=function(t){return t.Delta.Y===0};d.ClipperBase.prototype.PointIsVertex=function(t,e){var r=e;do{if(d.IntPoint.op_Equality(r.Pt,t))return!0;r=r.Next}while(r!=e);return!1};d.ClipperBase.prototype.PointOnLineSegment=function(t,e,r,i){return i?t.X==e.X&&t.Y==e.Y||t.X==r.X&&t.Y==r.Y||t.X>e.X==t.X<r.X&&t.Y>e.Y==t.Y<r.Y&&ce.op_Equality(ce.Int128Mul(t.X-e.X,r.Y-e.Y),ce.Int128Mul(r.X-e.X,t.Y-e.Y)):t.X==e.X&&t.Y==e.Y||t.X==r.X&&t.Y==r.Y||t.X>e.X==t.X<r.X&&t.Y>e.Y==t.Y<r.Y&&(t.X-e.X)*(r.Y-e.Y)==(r.X-e.X)*(t.Y-e.Y)};d.ClipperBase.prototype.PointOnPolygon=function(t,e,r){for(var i=e;;){if(this.PointOnLineSegment(t,i.Pt,i.Next.Pt,r))return!0;if(i=i.Next,i==e)break}return!1};d.ClipperBase.prototype.SlopesEqual=d.ClipperBase.SlopesEqual=function(){var t=arguments,e=t.length,r,i,n,o,s,l,u;return e==3?(r=t[0],i=t[1],u=t[2],u?ce.op_Equality(ce.Int128Mul(r.Delta.Y,i.Delta.X),ce.Int128Mul(r.Delta.X,i.Delta.Y)):d.Cast_Int64(r.Delta.Y*i.Delta.X)==d.Cast_Int64(r.Delta.X*i.Delta.Y)):e==4?(n=t[0],o=t[1],s=t[2],u=t[3],u?ce.op_Equality(ce.Int128Mul(n.Y-o.Y,o.X-s.X),ce.Int128Mul(n.X-o.X,o.Y-s.Y)):d.Cast_Int64((n.Y-o.Y)*(o.X-s.X))-d.Cast_Int64((n.X-o.X)*(o.Y-s.Y))===0):(n=t[0],o=t[1],s=t[2],l=t[3],u=t[4],u?ce.op_Equality(ce.Int128Mul(n.Y-o.Y,s.X-l.X),ce.Int128Mul(n.X-o.X,s.Y-l.Y)):d.Cast_Int64((n.Y-o.Y)*(s.X-l.X))-d.Cast_Int64((n.X-o.X)*(s.Y-l.Y))===0)};d.ClipperBase.SlopesEqual3=function(t,e,r){return r?ce.op_Equality(ce.Int128Mul(t.Delta.Y,e.Delta.X),ce.Int128Mul(t.Delta.X,e.Delta.Y)):d.Cast_Int64(t.Delta.Y*e.Delta.X)==d.Cast_Int64(t.Delta.X*e.Delta.Y)};d.ClipperBase.SlopesEqual4=function(t,e,r,i){return i?ce.op_Equality(ce.Int128Mul(t.Y-e.Y,e.X-r.X),ce.Int128Mul(t.X-e.X,e.Y-r.Y)):d.Cast_Int64((t.Y-e.Y)*(e.X-r.X))-d.Cast_Int64((t.X-e.X)*(e.Y-r.Y))===0};d.ClipperBase.SlopesEqual5=function(t,e,r,i,n){return n?ce.op_Equality(ce.Int128Mul(t.Y-e.Y,r.X-i.X),ce.Int128Mul(t.X-e.X,r.Y-i.Y)):d.Cast_Int64((t.Y-e.Y)*(r.X-i.X))-d.Cast_Int64((t.X-e.X)*(r.Y-i.Y))===0};d.ClipperBase.prototype.Clear=function(){this.DisposeLocalMinimaList();for(var t=0,e=this.m_edges.length;t<e;++t){for(var r=0,i=this.m_edges[t].length;r<i;++r)this.m_edges[t][r]=null;d.Clear(this.m_edges[t])}d.Clear(this.m_edges),this.m_UseFullRange=!1,this.m_HasOpenPaths=!1};d.ClipperBase.prototype.DisposeLocalMinimaList=function(){for(;this.m_MinimaList!==null;){var t=this.m_MinimaList.Next;this.m_MinimaList=null,this.m_MinimaList=t}this.m_CurrentLM=null};d.ClipperBase.prototype.RangeTest=function(t,e){e.Value?(t.X>d.ClipperBase.hiRange||t.Y>d.ClipperBase.hiRange||-t.X>d.ClipperBase.hiRange||-t.Y>d.ClipperBase.hiRange)&&d.Error("Coordinate outside allowed range in RangeTest()."):(t.X>d.ClipperBase.loRange||t.Y>d.ClipperBase.loRange||-t.X>d.ClipperBase.loRange||-t.Y>d.ClipperBase.loRange)&&(e.Value=!0,this.RangeTest(t,e))};d.ClipperBase.prototype.InitEdge=function(t,e,r,i){t.Next=e,t.Prev=r,t.Curr.X=i.X,t.Curr.Y=i.Y,t.OutIdx=-1};d.ClipperBase.prototype.InitEdge2=function(t,e){t.Curr.Y>=t.Next.Curr.Y?(t.Bot.X=t.Curr.X,t.Bot.Y=t.Curr.Y,t.Top.X=t.Next.Curr.X,t.Top.Y=t.Next.Curr.Y):(t.Top.X=t.Curr.X,t.Top.Y=t.Curr.Y,t.Bot.X=t.Next.Curr.X,t.Bot.Y=t.Next.Curr.Y),this.SetDx(t),t.PolyTyp=e};d.ClipperBase.prototype.FindNextLocMin=function(t){for(var e;;){for(;d.IntPoint.op_Inequality(t.Bot,t.Prev.Bot)||d.IntPoint.op_Equality(t.Curr,t.Top);)t=t.Next;if(t.Dx!=d.ClipperBase.horizontal&&t.Prev.Dx!=d.ClipperBase.horizontal)break;for(;t.Prev.Dx==d.ClipperBase.horizontal;)t=t.Prev;for(e=t;t.Dx==d.ClipperBase.horizontal;)t=t.Next;if(t.Top.Y!=t.Prev.Bot.Y){e.Prev.Bot.X<t.Bot.X&&(t=e);break}}return t};d.ClipperBase.prototype.ProcessBound=function(t,e){var r=t,i=t,n,o;if(t.Dx==d.ClipperBase.horizontal&&(e?o=t.Prev.Bot.X:o=t.Next.Bot.X,t.Bot.X!=o&&this.ReverseHorizontal(t)),i.OutIdx!=d.ClipperBase.Skip)if(e){for(;i.Top.Y==i.Next.Bot.Y&&i.Next.OutIdx!=d.ClipperBase.Skip;)i=i.Next;if(i.Dx==d.ClipperBase.horizontal&&i.Next.OutIdx!=d.ClipperBase.Skip){for(n=i;n.Prev.Dx==d.ClipperBase.horizontal;)n=n.Prev;n.Prev.Top.X==i.Next.Top.X?e||(i=n.Prev):n.Prev.Top.X>i.Next.Top.X&&(i=n.Prev)}for(;t!=i;)t.NextInLML=t.Next,t.Dx==d.ClipperBase.horizontal&&t!=r&&t.Bot.X!=t.Prev.Top.X&&this.ReverseHorizontal(t),t=t.Next;t.Dx==d.ClipperBase.horizontal&&t!=r&&t.Bot.X!=t.Prev.Top.X&&this.ReverseHorizontal(t),i=i.Next}else{for(;i.Top.Y==i.Prev.Bot.Y&&i.Prev.OutIdx!=d.ClipperBase.Skip;)i=i.Prev;if(i.Dx==d.ClipperBase.horizontal&&i.Prev.OutIdx!=d.ClipperBase.Skip){for(n=i;n.Next.Dx==d.ClipperBase.horizontal;)n=n.Next;n.Next.Top.X==i.Prev.Top.X?e||(i=n.Next):n.Next.Top.X>i.Prev.Top.X&&(i=n.Next)}for(;t!=i;)t.NextInLML=t.Prev,t.Dx==d.ClipperBase.horizontal&&t!=r&&t.Bot.X!=t.Next.Top.X&&this.ReverseHorizontal(t),t=t.Prev;t.Dx==d.ClipperBase.horizontal&&t!=r&&t.Bot.X!=t.Next.Top.X&&this.ReverseHorizontal(t),i=i.Prev}if(i.OutIdx==d.ClipperBase.Skip){if(t=i,e){for(;t.Top.Y==t.Next.Bot.Y;)t=t.Next;for(;t!=i&&t.Dx==d.ClipperBase.horizontal;)t=t.Prev}else{for(;t.Top.Y==t.Prev.Bot.Y;)t=t.Prev;for(;t!=i&&t.Dx==d.ClipperBase.horizontal;)t=t.Next}if(t==i)e?i=t.Next:i=t.Prev;else{e?t=i.Next:t=i.Prev;var s=new d.LocalMinima;s.Next=null,s.Y=t.Bot.Y,s.LeftBound=null,s.RightBound=t,s.RightBound.WindDelta=0,i=this.ProcessBound(s.RightBound,e),this.InsertLocalMinima(s)}}return i};d.ClipperBase.prototype.AddPath=function(t,e,r){uy?!r&&e==d.PolyType.ptClip&&d.Error("AddPath: Open paths must be subject."):r||d.Error("AddPath: Open paths have been disabled.");var i=t.length-1;if(r)for(;i>0&&d.IntPoint.op_Equality(t[i],t[0]);)--i;for(;i>0&&d.IntPoint.op_Equality(t[i],t[i-1]);)--i;if(r&&i<2||!r&&i<1)return!1;for(var n=new Array,o=0;o<=i;o++)n.push(new d.TEdge);var s=!0;n[1].Curr.X=t[1].X,n[1].Curr.Y=t[1].Y;var l={Value:this.m_UseFullRange};this.RangeTest(t[0],l),this.m_UseFullRange=l.Value,l.Value=this.m_UseFullRange,this.RangeTest(t[i],l),this.m_UseFullRange=l.Value,this.InitEdge(n[0],n[1],n[i],t[0]),this.InitEdge(n[i],n[0],n[i-1],t[i]);for(var o=i-1;o>=1;--o)l.Value=this.m_UseFullRange,this.RangeTest(t[o],l),this.m_UseFullRange=l.Value,this.InitEdge(n[o],n[o+1],n[o-1],t[o]);for(var u=n[0],h=u,m=u;;){if(d.IntPoint.op_Equality(h.Curr,h.Next.Curr)){if(h==h.Next)break;h==u&&(u=h.Next),h=this.RemoveEdge(h),m=h;continue}if(h.Prev==h.Next)break;if(r&&d.ClipperBase.SlopesEqual(h.Prev.Curr,h.Curr,h.Next.Curr,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(h.Prev.Curr,h.Curr,h.Next.Curr))){h==u&&(u=h.Next),h=this.RemoveEdge(h),h=h.Prev,m=h;continue}if(h=h.Next,h==m)break}if(!r&&h==h.Next||r&&h.Prev==h.Next)return!1;r||(this.m_HasOpenPaths=!0,u.Prev.OutIdx=d.ClipperBase.Skip);var f=u;h=u;do this.InitEdge2(h,e),h=h.Next,s&&h.Curr.Y!=u.Curr.Y&&(s=!1);while(h!=u);if(s){if(r)return!1;h.Prev.OutIdx=d.ClipperBase.Skip,h.Prev.Bot.X<h.Prev.Top.X&&this.ReverseHorizontal(h.Prev);var b=new d.LocalMinima;for(b.Next=null,b.Y=h.Bot.Y,b.LeftBound=null,b.RightBound=h,b.RightBound.Side=d.EdgeSide.esRight,b.RightBound.WindDelta=0;h.Next.OutIdx!=d.ClipperBase.Skip;)h.NextInLML=h.Next,h.Bot.X!=h.Prev.Top.X&&this.ReverseHorizontal(h),h=h.Next;return this.InsertLocalMinima(b),this.m_edges.push(n),!0}this.m_edges.push(n);for(var y,_=null;h=this.FindNextLocMin(h),h!=_;){_==null&&(_=h);var b=new d.LocalMinima;b.Next=null,b.Y=h.Bot.Y,h.Dx<h.Prev.Dx?(b.LeftBound=h.Prev,b.RightBound=h,y=!1):(b.LeftBound=h,b.RightBound=h.Prev,y=!0),b.LeftBound.Side=d.EdgeSide.esLeft,b.RightBound.Side=d.EdgeSide.esRight,r?b.LeftBound.Next==b.RightBound?b.LeftBound.WindDelta=-1:b.LeftBound.WindDelta=1:b.LeftBound.WindDelta=0,b.RightBound.WindDelta=-b.LeftBound.WindDelta,h=this.ProcessBound(b.LeftBound,y);var T=this.ProcessBound(b.RightBound,!y);b.LeftBound.OutIdx==d.ClipperBase.Skip?b.LeftBound=null:b.RightBound.OutIdx==d.ClipperBase.Skip&&(b.RightBound=null),this.InsertLocalMinima(b),y||(h=T)}return!0};d.ClipperBase.prototype.AddPaths=function(t,e,r){for(var i=!1,n=0,o=t.length;n<o;++n)this.AddPath(t[n],e,r)&&(i=!0);return i};d.ClipperBase.prototype.Pt2IsBetweenPt1AndPt3=function(t,e,r){return d.IntPoint.op_Equality(t,r)||d.IntPoint.op_Equality(t,e)||d.IntPoint.op_Equality(r,e)?!1:t.X!=r.X?e.X>t.X==e.X<r.X:e.Y>t.Y==e.Y<r.Y};d.ClipperBase.prototype.RemoveEdge=function(t){t.Prev.Next=t.Next,t.Next.Prev=t.Prev;var e=t.Next;return t.Prev=null,e};d.ClipperBase.prototype.SetDx=function(t){t.Delta.X=t.Top.X-t.Bot.X,t.Delta.Y=t.Top.Y-t.Bot.Y,t.Delta.Y===0?t.Dx=d.ClipperBase.horizontal:t.Dx=t.Delta.X/t.Delta.Y};d.ClipperBase.prototype.InsertLocalMinima=function(t){if(this.m_MinimaList===null)this.m_MinimaList=t;else if(t.Y>=this.m_MinimaList.Y)t.Next=this.m_MinimaList,this.m_MinimaList=t;else{for(var e=this.m_MinimaList;e.Next!==null&&t.Y<e.Next.Y;)e=e.Next;t.Next=e.Next,e.Next=t}};d.ClipperBase.prototype.PopLocalMinima=function(){this.m_CurrentLM!==null&&(this.m_CurrentLM=this.m_CurrentLM.Next)};d.ClipperBase.prototype.ReverseHorizontal=function(t){var e=t.Top.X;t.Top.X=t.Bot.X,t.Bot.X=e,Vi&&(e=t.Top.Z,t.Top.Z=t.Bot.Z,t.Bot.Z=e)};d.ClipperBase.prototype.Reset=function(){if(this.m_CurrentLM=this.m_MinimaList,this.m_CurrentLM!=null)for(var t=this.m_MinimaList;t!=null;){var e=t.LeftBound;e!=null&&(e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,e.Side=d.EdgeSide.esLeft,e.OutIdx=d.ClipperBase.Unassigned),e=t.RightBound,e!=null&&(e.Curr.X=e.Bot.X,e.Curr.Y=e.Bot.Y,e.Side=d.EdgeSide.esRight,e.OutIdx=d.ClipperBase.Unassigned),t=t.Next}};d.Clipper=function(t){typeof t>"u"&&(t=0),this.m_PolyOuts=null,this.m_ClipType=d.ClipType.ctIntersection,this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=null,this.m_IntersectNodeComparer=null,this.m_ExecuteLocked=!1,this.m_ClipFillType=d.PolyFillType.pftEvenOdd,this.m_SubjFillType=d.PolyFillType.pftEvenOdd,this.m_Joins=null,this.m_GhostJoins=null,this.m_UsingPolyTree=!1,this.ReverseSolution=!1,this.StrictlySimple=!1,d.ClipperBase.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null,this.m_IntersectList=new Array,this.m_IntersectNodeComparer=d.MyIntersectNodeSort.Compare,this.m_ExecuteLocked=!1,this.m_UsingPolyTree=!1,this.m_PolyOuts=new Array,this.m_Joins=new Array,this.m_GhostJoins=new Array,this.ReverseSolution=(1&t)!==0,this.StrictlySimple=(2&t)!==0,this.PreserveCollinear=(4&t)!==0,Vi&&(this.ZFillFunction=null)};d.Clipper.ioReverseSolution=1;d.Clipper.ioStrictlySimple=2;d.Clipper.ioPreserveCollinear=4;d.Clipper.prototype.Clear=function(){this.m_edges.length!==0&&(this.DisposeAllPolyPts(),d.ClipperBase.prototype.Clear.call(this))};d.Clipper.prototype.DisposeScanbeamList=function(){for(;this.m_Scanbeam!==null;){var t=this.m_Scanbeam.Next;this.m_Scanbeam=null,this.m_Scanbeam=t}};d.Clipper.prototype.Reset=function(){d.ClipperBase.prototype.Reset.call(this),this.m_Scanbeam=null,this.m_ActiveEdges=null,this.m_SortedEdges=null;for(var t=this.m_MinimaList;t!==null;)this.InsertScanbeam(t.Y),t=t.Next};d.Clipper.prototype.InsertScanbeam=function(t){if(this.m_Scanbeam===null)this.m_Scanbeam=new d.Scanbeam,this.m_Scanbeam.Next=null,this.m_Scanbeam.Y=t;else if(t>this.m_Scanbeam.Y){var e=new d.Scanbeam;e.Y=t,e.Next=this.m_Scanbeam,this.m_Scanbeam=e}else{for(var r=this.m_Scanbeam;r.Next!==null&&t<=r.Next.Y;)r=r.Next;if(t==r.Y)return;var e=new d.Scanbeam;e.Y=t,e.Next=r.Next,r.Next=e}};d.Clipper.prototype.Execute=function(){var t=arguments,e=t.length,r=t[1]instanceof d.PolyTree;if(e==4&&!r){var i=t[0],n=t[1],o=t[2],s=t[3];if(this.m_ExecuteLocked)return!1;this.m_HasOpenPaths&&d.Error("Error: PolyTree struct is need for open path clipping."),this.m_ExecuteLocked=!0,d.Clear(n),this.m_SubjFillType=o,this.m_ClipFillType=s,this.m_ClipType=i,this.m_UsingPolyTree=!1;try{var l=this.ExecuteInternal();l&&this.BuildResult(n)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(e==4&&r){var i=t[0],u=t[1],o=t[2],s=t[3];if(this.m_ExecuteLocked)return!1;this.m_ExecuteLocked=!0,this.m_SubjFillType=o,this.m_ClipFillType=s,this.m_ClipType=i,this.m_UsingPolyTree=!0;try{var l=this.ExecuteInternal();l&&this.BuildResult2(u)}finally{this.DisposeAllPolyPts(),this.m_ExecuteLocked=!1}return l}else if(e==2&&!r){var i=t[0],n=t[1];return this.Execute(i,n,d.PolyFillType.pftEvenOdd,d.PolyFillType.pftEvenOdd)}else if(e==2&&r){var i=t[0],u=t[1];return this.Execute(i,u,d.PolyFillType.pftEvenOdd,d.PolyFillType.pftEvenOdd)}};d.Clipper.prototype.FixHoleLinkage=function(t){if(!(t.FirstLeft===null||t.IsHole!=t.FirstLeft.IsHole&&t.FirstLeft.Pts!==null)){for(var e=t.FirstLeft;e!==null&&(e.IsHole==t.IsHole||e.Pts===null);)e=e.FirstLeft;t.FirstLeft=e}};d.Clipper.prototype.ExecuteInternal=function(){try{if(this.Reset(),this.m_CurrentLM===null)return!1;var t=this.PopScanbeam();do{if(this.InsertLocalMinimaIntoAEL(t),d.Clear(this.m_GhostJoins),this.ProcessHorizontals(!1),this.m_Scanbeam===null)break;var e=this.PopScanbeam();if(!this.ProcessIntersections(t,e))return!1;this.ProcessEdgesAtTopOfScanbeam(e),t=e}while(this.m_Scanbeam!==null||this.m_CurrentLM!==null);for(var r=0,i=this.m_PolyOuts.length;r<i;r++){var n=this.m_PolyOuts[r];n.Pts===null||n.IsOpen||(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)}this.JoinCommonEdges();for(var r=0,i=this.m_PolyOuts.length;r<i;r++){var n=this.m_PolyOuts[r];n.Pts!==null&&!n.IsOpen&&this.FixupOutPolygon(n)}return this.StrictlySimple&&this.DoSimplePolygons(),!0}finally{d.Clear(this.m_Joins),d.Clear(this.m_GhostJoins)}};d.Clipper.prototype.PopScanbeam=function(){var t=this.m_Scanbeam.Y,e=this.m_Scanbeam;return this.m_Scanbeam=this.m_Scanbeam.Next,e=null,t};d.Clipper.prototype.DisposeAllPolyPts=function(){for(var t=0,e=this.m_PolyOuts.length;t<e;++t)this.DisposeOutRec(t);d.Clear(this.m_PolyOuts)};d.Clipper.prototype.DisposeOutRec=function(t){var e=this.m_PolyOuts[t];e.Pts!==null&&this.DisposeOutPts(e.Pts),e=null,this.m_PolyOuts[t]=null};d.Clipper.prototype.DisposeOutPts=function(t){if(t!==null){var e=null;for(t.Prev.Next=null;t!==null;)e=t,t=t.Next,e=null}};d.Clipper.prototype.AddJoin=function(t,e,r){var i=new d.Join;i.OutPt1=t,i.OutPt2=e,i.OffPt.X=r.X,i.OffPt.Y=r.Y,this.m_Joins.push(i)};d.Clipper.prototype.AddGhostJoin=function(t,e){var r=new d.Join;r.OutPt1=t,r.OffPt.X=e.X,r.OffPt.Y=e.Y,this.m_GhostJoins.push(r)};Vi&&(d.Clipper.prototype.SetZ=function(t,e){t.Z=0,this.ZFillFunction!==null&&(e.OutIdx<0?this.ZFillFunction(e.Bot,e.Top,t):this.ZFillFunction(e.Top,e.Bot,t))});d.Clipper.prototype.InsertLocalMinimaIntoAEL=function(t){for(;this.m_CurrentLM!==null&&this.m_CurrentLM.Y==t;){var e=this.m_CurrentLM.LeftBound,r=this.m_CurrentLM.RightBound;this.PopLocalMinima();var i=null;if(e===null?(this.InsertEdgeIntoAEL(r,null),this.SetWindingCount(r),this.IsContributing(r)&&(i=this.AddOutPt(r,r.Bot))):r==null?(this.InsertEdgeIntoAEL(e,null),this.SetWindingCount(e),this.IsContributing(e)&&(i=this.AddOutPt(e,e.Bot)),this.InsertScanbeam(e.Top.Y)):(this.InsertEdgeIntoAEL(e,null),this.InsertEdgeIntoAEL(r,e),this.SetWindingCount(e),r.WindCnt=e.WindCnt,r.WindCnt2=e.WindCnt2,this.IsContributing(e)&&(i=this.AddLocalMinPoly(e,r,e.Bot)),this.InsertScanbeam(e.Top.Y)),r!=null&&(d.ClipperBase.IsHorizontal(r)?this.AddEdgeToSEL(r):this.InsertScanbeam(r.Top.Y)),!(e==null||r==null)){if(i!==null&&d.ClipperBase.IsHorizontal(r)&&this.m_GhostJoins.length>0&&r.WindDelta!==0)for(var n=0,o=this.m_GhostJoins.length;n<o;n++){var s=this.m_GhostJoins[n];this.HorzSegmentsOverlap(s.OutPt1.Pt,s.OffPt,r.Bot,r.Top)&&this.AddJoin(s.OutPt1,i,s.OffPt)}if(e.OutIdx>=0&&e.PrevInAEL!==null&&e.PrevInAEL.Curr.X==e.Bot.X&&e.PrevInAEL.OutIdx>=0&&d.ClipperBase.SlopesEqual(e.PrevInAEL,e,this.m_UseFullRange)&&e.WindDelta!==0&&e.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(e.PrevInAEL,e.Bot);this.AddJoin(i,l,e.Top)}if(e.NextInAEL!=r){if(r.OutIdx>=0&&r.PrevInAEL.OutIdx>=0&&d.ClipperBase.SlopesEqual(r.PrevInAEL,r,this.m_UseFullRange)&&r.WindDelta!==0&&r.PrevInAEL.WindDelta!==0){var l=this.AddOutPt(r.PrevInAEL,r.Bot);this.AddJoin(i,l,r.Top)}var u=e.NextInAEL;if(u!==null)for(;u!=r;)this.IntersectEdges(r,u,e.Curr,!1),u=u.NextInAEL}}}};d.Clipper.prototype.InsertEdgeIntoAEL=function(t,e){if(this.m_ActiveEdges===null)t.PrevInAEL=null,t.NextInAEL=null,this.m_ActiveEdges=t;else if(e===null&&this.E2InsertsBeforeE1(this.m_ActiveEdges,t))t.PrevInAEL=null,t.NextInAEL=this.m_ActiveEdges,this.m_ActiveEdges.PrevInAEL=t,this.m_ActiveEdges=t;else{for(e===null&&(e=this.m_ActiveEdges);e.NextInAEL!==null&&!this.E2InsertsBeforeE1(e.NextInAEL,t);)e=e.NextInAEL;t.NextInAEL=e.NextInAEL,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=t),t.PrevInAEL=e,e.NextInAEL=t}};d.Clipper.prototype.E2InsertsBeforeE1=function(t,e){return e.Curr.X==t.Curr.X?e.Top.Y>t.Top.Y?e.Top.X<d.Clipper.TopX(t,e.Top.Y):t.Top.X>d.Clipper.TopX(e,t.Top.Y):e.Curr.X<t.Curr.X};d.Clipper.prototype.IsEvenOddFillType=function(t){return t.PolyTyp==d.PolyType.ptSubject?this.m_SubjFillType==d.PolyFillType.pftEvenOdd:this.m_ClipFillType==d.PolyFillType.pftEvenOdd};d.Clipper.prototype.IsEvenOddAltFillType=function(t){return t.PolyTyp==d.PolyType.ptSubject?this.m_ClipFillType==d.PolyFillType.pftEvenOdd:this.m_SubjFillType==d.PolyFillType.pftEvenOdd};d.Clipper.prototype.IsContributing=function(t){var e,r;switch(t.PolyTyp==d.PolyType.ptSubject?(e=this.m_SubjFillType,r=this.m_ClipFillType):(e=this.m_ClipFillType,r=this.m_SubjFillType),e){case d.PolyFillType.pftEvenOdd:if(t.WindDelta===0&&t.WindCnt!=1)return!1;break;case d.PolyFillType.pftNonZero:if(Math.abs(t.WindCnt)!=1)return!1;break;case d.PolyFillType.pftPositive:if(t.WindCnt!=1)return!1;break;default:if(t.WindCnt!=-1)return!1;break}switch(this.m_ClipType){case d.ClipType.ctIntersection:switch(r){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return t.WindCnt2!==0;case d.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case d.ClipType.ctUnion:switch(r){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return t.WindCnt2===0;case d.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}case d.ClipType.ctDifference:if(t.PolyTyp==d.PolyType.ptSubject)switch(r){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return t.WindCnt2===0;case d.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else switch(r){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return t.WindCnt2!==0;case d.PolyFillType.pftPositive:return t.WindCnt2>0;default:return t.WindCnt2<0}case d.ClipType.ctXor:if(t.WindDelta===0)switch(r){case d.PolyFillType.pftEvenOdd:case d.PolyFillType.pftNonZero:return t.WindCnt2===0;case d.PolyFillType.pftPositive:return t.WindCnt2<=0;default:return t.WindCnt2>=0}else return!0}return!0};d.Clipper.prototype.SetWindingCount=function(t){for(var e=t.PrevInAEL;e!==null&&(e.PolyTyp!=t.PolyTyp||e.WindDelta===0);)e=e.PrevInAEL;if(e===null)t.WindCnt=t.WindDelta===0?1:t.WindDelta,t.WindCnt2=0,e=this.m_ActiveEdges;else if(t.WindDelta===0&&this.m_ClipType!=d.ClipType.ctUnion)t.WindCnt=1,t.WindCnt2=e.WindCnt2,e=e.NextInAEL;else if(this.IsEvenOddFillType(t)){if(t.WindDelta===0){for(var r=!0,i=e.PrevInAEL;i!==null;)i.PolyTyp==e.PolyTyp&&i.WindDelta!==0&&(r=!r),i=i.PrevInAEL;t.WindCnt=r?0:1}else t.WindCnt=t.WindDelta;t.WindCnt2=e.WindCnt2,e=e.NextInAEL}else e.WindCnt*e.WindDelta<0?Math.abs(e.WindCnt)>1?e.WindDelta*t.WindDelta<0?t.WindCnt=e.WindCnt:t.WindCnt=e.WindCnt+t.WindDelta:t.WindCnt=t.WindDelta===0?1:t.WindDelta:t.WindDelta===0?t.WindCnt=e.WindCnt<0?e.WindCnt-1:e.WindCnt+1:e.WindDelta*t.WindDelta<0?t.WindCnt=e.WindCnt:t.WindCnt=e.WindCnt+t.WindDelta,t.WindCnt2=e.WindCnt2,e=e.NextInAEL;if(this.IsEvenOddAltFillType(t))for(;e!=t;)e.WindDelta!==0&&(t.WindCnt2=t.WindCnt2===0?1:0),e=e.NextInAEL;else for(;e!=t;)t.WindCnt2+=e.WindDelta,e=e.NextInAEL};d.Clipper.prototype.AddEdgeToSEL=function(t){this.m_SortedEdges===null?(this.m_SortedEdges=t,t.PrevInSEL=null,t.NextInSEL=null):(t.NextInSEL=this.m_SortedEdges,t.PrevInSEL=null,this.m_SortedEdges.PrevInSEL=t,this.m_SortedEdges=t)};d.Clipper.prototype.CopyAELToSEL=function(){var t=this.m_ActiveEdges;for(this.m_SortedEdges=t;t!==null;)t.PrevInSEL=t.PrevInAEL,t.NextInSEL=t.NextInAEL,t=t.NextInAEL};d.Clipper.prototype.SwapPositionsInAEL=function(t,e){if(!(t.NextInAEL==t.PrevInAEL||e.NextInAEL==e.PrevInAEL)){if(t.NextInAEL==e){var r=e.NextInAEL;r!==null&&(r.PrevInAEL=t);var i=t.PrevInAEL;i!==null&&(i.NextInAEL=e),e.PrevInAEL=i,e.NextInAEL=t,t.PrevInAEL=e,t.NextInAEL=r}else if(e.NextInAEL==t){var r=t.NextInAEL;r!==null&&(r.PrevInAEL=e);var i=e.PrevInAEL;i!==null&&(i.NextInAEL=t),t.PrevInAEL=i,t.NextInAEL=e,e.PrevInAEL=t,e.NextInAEL=r}else{var r=t.NextInAEL,i=t.PrevInAEL;t.NextInAEL=e.NextInAEL,t.NextInAEL!==null&&(t.NextInAEL.PrevInAEL=t),t.PrevInAEL=e.PrevInAEL,t.PrevInAEL!==null&&(t.PrevInAEL.NextInAEL=t),e.NextInAEL=r,e.NextInAEL!==null&&(e.NextInAEL.PrevInAEL=e),e.PrevInAEL=i,e.PrevInAEL!==null&&(e.PrevInAEL.NextInAEL=e)}t.PrevInAEL===null?this.m_ActiveEdges=t:e.PrevInAEL===null&&(this.m_ActiveEdges=e)}};d.Clipper.prototype.SwapPositionsInSEL=function(t,e){if(!(t.NextInSEL===null&&t.PrevInSEL===null)&&!(e.NextInSEL===null&&e.PrevInSEL===null)){if(t.NextInSEL==e){var r=e.NextInSEL;r!==null&&(r.PrevInSEL=t);var i=t.PrevInSEL;i!==null&&(i.NextInSEL=e),e.PrevInSEL=i,e.NextInSEL=t,t.PrevInSEL=e,t.NextInSEL=r}else if(e.NextInSEL==t){var r=t.NextInSEL;r!==null&&(r.PrevInSEL=e);var i=e.PrevInSEL;i!==null&&(i.NextInSEL=t),t.PrevInSEL=i,t.NextInSEL=e,e.PrevInSEL=t,e.NextInSEL=r}else{var r=t.NextInSEL,i=t.PrevInSEL;t.NextInSEL=e.NextInSEL,t.NextInSEL!==null&&(t.NextInSEL.PrevInSEL=t),t.PrevInSEL=e.PrevInSEL,t.PrevInSEL!==null&&(t.PrevInSEL.NextInSEL=t),e.NextInSEL=r,e.NextInSEL!==null&&(e.NextInSEL.PrevInSEL=e),e.PrevInSEL=i,e.PrevInSEL!==null&&(e.PrevInSEL.NextInSEL=e)}t.PrevInSEL===null?this.m_SortedEdges=t:e.PrevInSEL===null&&(this.m_SortedEdges=e)}};d.Clipper.prototype.AddLocalMaxPoly=function(t,e,r){this.AddOutPt(t,r),e.WindDelta==0&&this.AddOutPt(e,r),t.OutIdx==e.OutIdx?(t.OutIdx=-1,e.OutIdx=-1):t.OutIdx<e.OutIdx?this.AppendPolygon(t,e):this.AppendPolygon(e,t)};d.Clipper.prototype.AddLocalMinPoly=function(t,e,r){var i,n,o;if(d.ClipperBase.IsHorizontal(e)||t.Dx>e.Dx?(i=this.AddOutPt(t,r),e.OutIdx=t.OutIdx,t.Side=d.EdgeSide.esLeft,e.Side=d.EdgeSide.esRight,n=t,n.PrevInAEL==e?o=e.PrevInAEL:o=n.PrevInAEL):(i=this.AddOutPt(e,r),t.OutIdx=e.OutIdx,t.Side=d.EdgeSide.esRight,e.Side=d.EdgeSide.esLeft,n=e,n.PrevInAEL==t?o=t.PrevInAEL:o=n.PrevInAEL),o!==null&&o.OutIdx>=0&&d.Clipper.TopX(o,r.Y)==d.Clipper.TopX(n,r.Y)&&d.ClipperBase.SlopesEqual(n,o,this.m_UseFullRange)&&n.WindDelta!==0&&o.WindDelta!==0){var s=this.AddOutPt(o,r);this.AddJoin(i,s,n.Top)}return i};d.Clipper.prototype.CreateOutRec=function(){var t=new d.OutRec;return t.Idx=-1,t.IsHole=!1,t.IsOpen=!1,t.FirstLeft=null,t.Pts=null,t.BottomPt=null,t.PolyNode=null,this.m_PolyOuts.push(t),t.Idx=this.m_PolyOuts.length-1,t};d.Clipper.prototype.AddOutPt=function(t,e){var r=t.Side==d.EdgeSide.esLeft;if(t.OutIdx<0){var i=this.CreateOutRec();i.IsOpen=t.WindDelta===0;var n=new d.OutPt;return i.Pts=n,n.Idx=i.Idx,n.Pt.X=e.X,n.Pt.Y=e.Y,n.Next=n,n.Prev=n,i.IsOpen||this.SetHoleState(t,i),Vi&&(d.IntPoint.op_Equality(e,t.Bot)?(n.Pt.X=t.Bot.X,n.Pt.Y=t.Bot.Y,n.Pt.Z=t.Bot.Z):d.IntPoint.op_Equality(e,t.Top)?(n.Pt.X=t.Top.X,n.Pt.Y=t.Top.Y,n.Pt.Z=t.Top.Z):this.SetZ(n.Pt,t)),t.OutIdx=i.Idx,n}else{var i=this.m_PolyOuts[t.OutIdx],o=i.Pts;if(r&&d.IntPoint.op_Equality(e,o.Pt))return o;if(!r&&d.IntPoint.op_Equality(e,o.Prev.Pt))return o.Prev;var n=new d.OutPt;return n.Idx=i.Idx,n.Pt.X=e.X,n.Pt.Y=e.Y,n.Next=o,n.Prev=o.Prev,n.Prev.Next=n,o.Prev=n,r&&(i.Pts=n),Vi&&(d.IntPoint.op_Equality(e,t.Bot)?(n.Pt.X=t.Bot.X,n.Pt.Y=t.Bot.Y,n.Pt.Z=t.Bot.Z):d.IntPoint.op_Equality(e,t.Top)?(n.Pt.X=t.Top.X,n.Pt.Y=t.Top.Y,n.Pt.Z=t.Top.Z):this.SetZ(n.Pt,t)),n}};d.Clipper.prototype.SwapPoints=function(t,e){var r=new d.IntPoint(t.Value);t.Value.X=e.Value.X,t.Value.Y=e.Value.Y,e.Value.X=r.X,e.Value.Y=r.Y};d.Clipper.prototype.HorzSegmentsOverlap=function(t,e,r,i){return t.X>r.X==t.X<i.X||e.X>r.X==e.X<i.X||r.X>t.X==r.X<e.X||i.X>t.X==i.X<e.X||t.X==r.X&&e.X==i.X?!0:t.X==i.X&&e.X==r.X};d.Clipper.prototype.InsertPolyPtBetween=function(t,e,r){var i=new d.OutPt;return i.Pt.X=r.X,i.Pt.Y=r.Y,e==t.Next?(t.Next=i,e.Prev=i,i.Next=e,i.Prev=t):(e.Next=i,t.Prev=i,i.Next=t,i.Prev=e),i};d.Clipper.prototype.SetHoleState=function(t,e){for(var r=!1,i=t.PrevInAEL;i!==null;)i.OutIdx>=0&&i.WindDelta!=0&&(r=!r,e.FirstLeft===null&&(e.FirstLeft=this.m_PolyOuts[i.OutIdx])),i=i.PrevInAEL;r&&(e.IsHole=!0)};d.Clipper.prototype.GetDx=function(t,e){return t.Y==e.Y?d.ClipperBase.horizontal:(e.X-t.X)/(e.Y-t.Y)};d.Clipper.prototype.FirstIsBottomPt=function(t,e){for(var r=t.Prev;d.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Prev;var i=Math.abs(this.GetDx(t.Pt,r.Pt));for(r=t.Next;d.IntPoint.op_Equality(r.Pt,t.Pt)&&r!=t;)r=r.Next;var n=Math.abs(this.GetDx(t.Pt,r.Pt));for(r=e.Prev;d.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Prev;var o=Math.abs(this.GetDx(e.Pt,r.Pt));for(r=e.Next;d.IntPoint.op_Equality(r.Pt,e.Pt)&&r!=e;)r=r.Next;var s=Math.abs(this.GetDx(e.Pt,r.Pt));return i>=o&&i>=s||n>=o&&n>=s};d.Clipper.prototype.GetBottomPt=function(t){for(var e=null,r=t.Next;r!=t;)r.Pt.Y>t.Pt.Y?(t=r,e=null):r.Pt.Y==t.Pt.Y&&r.Pt.X<=t.Pt.X&&(r.Pt.X<t.Pt.X?(e=null,t=r):r.Next!=t&&r.Prev!=t&&(e=r)),r=r.Next;if(e!==null)for(;e!=r;)for(this.FirstIsBottomPt(r,e)||(t=e),e=e.Next;d.IntPoint.op_Inequality(e.Pt,t.Pt);)e=e.Next;return t};d.Clipper.prototype.GetLowermostRec=function(t,e){t.BottomPt===null&&(t.BottomPt=this.GetBottomPt(t.Pts)),e.BottomPt===null&&(e.BottomPt=this.GetBottomPt(e.Pts));var r=t.BottomPt,i=e.BottomPt;return r.Pt.Y>i.Pt.Y?t:r.Pt.Y<i.Pt.Y?e:r.Pt.X<i.Pt.X?t:r.Pt.X>i.Pt.X||r.Next==r?e:i.Next==i||this.FirstIsBottomPt(r,i)?t:e};d.Clipper.prototype.Param1RightOfParam2=function(t,e){do if(t=t.FirstLeft,t==e)return!0;while(t!==null);return!1};d.Clipper.prototype.GetOutRec=function(t){for(var e=this.m_PolyOuts[t];e!=this.m_PolyOuts[e.Idx];)e=this.m_PolyOuts[e.Idx];return e};d.Clipper.prototype.AppendPolygon=function(t,e){var r=this.m_PolyOuts[t.OutIdx],i=this.m_PolyOuts[e.OutIdx],n;this.Param1RightOfParam2(r,i)?n=i:this.Param1RightOfParam2(i,r)?n=r:n=this.GetLowermostRec(r,i);var o=r.Pts,s=o.Prev,l=i.Pts,u=l.Prev,h;t.Side==d.EdgeSide.esLeft?(e.Side==d.EdgeSide.esLeft?(this.ReversePolyPtLinks(l),l.Next=o,o.Prev=l,s.Next=u,u.Prev=s,r.Pts=u):(u.Next=o,o.Prev=u,l.Prev=s,s.Next=l,r.Pts=l),h=d.EdgeSide.esLeft):(e.Side==d.EdgeSide.esRight?(this.ReversePolyPtLinks(l),s.Next=u,u.Prev=s,l.Next=o,o.Prev=l):(s.Next=l,l.Prev=s,o.Prev=u,u.Next=o),h=d.EdgeSide.esRight),r.BottomPt=null,n==i&&(i.FirstLeft!=r&&(r.FirstLeft=i.FirstLeft),r.IsHole=i.IsHole),i.Pts=null,i.BottomPt=null,i.FirstLeft=r;var m=t.OutIdx,f=e.OutIdx;t.OutIdx=-1,e.OutIdx=-1;for(var b=this.m_ActiveEdges;b!==null;){if(b.OutIdx==f){b.OutIdx=m,b.Side=h;break}b=b.NextInAEL}i.Idx=r.Idx};d.Clipper.prototype.ReversePolyPtLinks=function(t){if(t!==null){var e,r;e=t;do r=e.Next,e.Next=e.Prev,e.Prev=r,e=r;while(e!=t)}};d.Clipper.SwapSides=function(t,e){var r=t.Side;t.Side=e.Side,e.Side=r};d.Clipper.SwapPolyIndexes=function(t,e){var r=t.OutIdx;t.OutIdx=e.OutIdx,e.OutIdx=r};d.Clipper.prototype.IntersectEdges=function(t,e,r,i){var n=!i&&t.NextInLML===null&&t.Top.X==r.X&&t.Top.Y==r.Y,o=!i&&e.NextInLML===null&&e.Top.X==r.X&&e.Top.Y==r.Y,s=t.OutIdx>=0,l=e.OutIdx>=0;if(uy&&(t.WindDelta===0||e.WindDelta===0)){t.WindDelta===0&&e.WindDelta===0?(n||o)&&s&&l&&this.AddLocalMaxPoly(t,e,r):t.PolyTyp==e.PolyTyp&&t.WindDelta!=e.WindDelta&&this.m_ClipType==d.ClipType.ctUnion?t.WindDelta===0?l&&(this.AddOutPt(t,r),s&&(t.OutIdx=-1)):s&&(this.AddOutPt(e,r),l&&(e.OutIdx=-1)):t.PolyTyp!=e.PolyTyp&&(t.WindDelta===0&&Math.abs(e.WindCnt)==1&&(this.m_ClipType!=d.ClipType.ctUnion||e.WindCnt2===0)?(this.AddOutPt(t,r),s&&(t.OutIdx=-1)):e.WindDelta===0&&Math.abs(t.WindCnt)==1&&(this.m_ClipType!=d.ClipType.ctUnion||t.WindCnt2===0)&&(this.AddOutPt(e,r),l&&(e.OutIdx=-1))),n&&(t.OutIdx<0?this.DeleteFromAEL(t):d.Error("Error intersecting polylines")),o&&(e.OutIdx<0?this.DeleteFromAEL(e):d.Error("Error intersecting polylines"));return}if(t.PolyTyp==e.PolyTyp)if(this.IsEvenOddFillType(t)){var u=t.WindCnt;t.WindCnt=e.WindCnt,e.WindCnt=u}else t.WindCnt+e.WindDelta===0?t.WindCnt=-t.WindCnt:t.WindCnt+=e.WindDelta,e.WindCnt-t.WindDelta===0?e.WindCnt=-e.WindCnt:e.WindCnt-=t.WindDelta;else this.IsEvenOddFillType(e)?t.WindCnt2=t.WindCnt2===0?1:0:t.WindCnt2+=e.WindDelta,this.IsEvenOddFillType(t)?e.WindCnt2=e.WindCnt2===0?1:0:e.WindCnt2-=t.WindDelta;var h,m,f,b;t.PolyTyp==d.PolyType.ptSubject?(h=this.m_SubjFillType,f=this.m_ClipFillType):(h=this.m_ClipFillType,f=this.m_SubjFillType),e.PolyTyp==d.PolyType.ptSubject?(m=this.m_SubjFillType,b=this.m_ClipFillType):(m=this.m_ClipFillType,b=this.m_SubjFillType);var y,_;switch(h){case d.PolyFillType.pftPositive:y=t.WindCnt;break;case d.PolyFillType.pftNegative:y=-t.WindCnt;break;default:y=Math.abs(t.WindCnt);break}switch(m){case d.PolyFillType.pftPositive:_=e.WindCnt;break;case d.PolyFillType.pftNegative:_=-e.WindCnt;break;default:_=Math.abs(e.WindCnt);break}if(s&&l)n||o||y!==0&&y!=1||_!==0&&_!=1||t.PolyTyp!=e.PolyTyp&&this.m_ClipType!=d.ClipType.ctXor?this.AddLocalMaxPoly(t,e,r):(this.AddOutPt(t,r),this.AddOutPt(e,r),d.Clipper.SwapSides(t,e),d.Clipper.SwapPolyIndexes(t,e));else if(s)(_===0||_==1)&&(this.AddOutPt(t,r),d.Clipper.SwapSides(t,e),d.Clipper.SwapPolyIndexes(t,e));else if(l)(y===0||y==1)&&(this.AddOutPt(e,r),d.Clipper.SwapSides(t,e),d.Clipper.SwapPolyIndexes(t,e));else if((y===0||y==1)&&(_===0||_==1)&&!n&&!o){var T,g;switch(f){case d.PolyFillType.pftPositive:T=t.WindCnt2;break;case d.PolyFillType.pftNegative:T=-t.WindCnt2;break;default:T=Math.abs(t.WindCnt2);break}switch(b){case d.PolyFillType.pftPositive:g=e.WindCnt2;break;case d.PolyFillType.pftNegative:g=-e.WindCnt2;break;default:g=Math.abs(e.WindCnt2);break}if(t.PolyTyp!=e.PolyTyp)this.AddLocalMinPoly(t,e,r);else if(y==1&&_==1)switch(this.m_ClipType){case d.ClipType.ctIntersection:T>0&&g>0&&this.AddLocalMinPoly(t,e,r);break;case d.ClipType.ctUnion:T<=0&&g<=0&&this.AddLocalMinPoly(t,e,r);break;case d.ClipType.ctDifference:(t.PolyTyp==d.PolyType.ptClip&&T>0&&g>0||t.PolyTyp==d.PolyType.ptSubject&&T<=0&&g<=0)&&this.AddLocalMinPoly(t,e,r);break;case d.ClipType.ctXor:this.AddLocalMinPoly(t,e,r);break}else d.Clipper.SwapSides(t,e)}n!=o&&(n&&t.OutIdx>=0||o&&e.OutIdx>=0)&&(d.Clipper.SwapSides(t,e),d.Clipper.SwapPolyIndexes(t,e)),n&&this.DeleteFromAEL(t),o&&this.DeleteFromAEL(e)};d.Clipper.prototype.DeleteFromAEL=function(t){var e=t.PrevInAEL,r=t.NextInAEL;e===null&&r===null&&t!=this.m_ActiveEdges||(e!==null?e.NextInAEL=r:this.m_ActiveEdges=r,r!==null&&(r.PrevInAEL=e),t.NextInAEL=null,t.PrevInAEL=null)};d.Clipper.prototype.DeleteFromSEL=function(t){var e=t.PrevInSEL,r=t.NextInSEL;e===null&&r===null&&t!=this.m_SortedEdges||(e!==null?e.NextInSEL=r:this.m_SortedEdges=r,r!==null&&(r.PrevInSEL=e),t.NextInSEL=null,t.PrevInSEL=null)};d.Clipper.prototype.UpdateEdgeIntoAEL=function(t){t.NextInLML===null&&d.Error("UpdateEdgeIntoAEL: invalid call");var e=t.PrevInAEL,r=t.NextInAEL;return t.NextInLML.OutIdx=t.OutIdx,e!==null?e.NextInAEL=t.NextInLML:this.m_ActiveEdges=t.NextInLML,r!==null&&(r.PrevInAEL=t.NextInLML),t.NextInLML.Side=t.Side,t.NextInLML.WindDelta=t.WindDelta,t.NextInLML.WindCnt=t.WindCnt,t.NextInLML.WindCnt2=t.WindCnt2,t=t.NextInLML,t.Curr.X=t.Bot.X,t.Curr.Y=t.Bot.Y,t.PrevInAEL=e,t.NextInAEL=r,d.ClipperBase.IsHorizontal(t)||this.InsertScanbeam(t.Top.Y),t};d.Clipper.prototype.ProcessHorizontals=function(t){for(var e=this.m_SortedEdges;e!==null;)this.DeleteFromSEL(e),this.ProcessHorizontal(e,t),e=this.m_SortedEdges};d.Clipper.prototype.GetHorzDirection=function(t,e){t.Bot.X<t.Top.X?(e.Left=t.Bot.X,e.Right=t.Top.X,e.Dir=d.Direction.dLeftToRight):(e.Left=t.Top.X,e.Right=t.Bot.X,e.Dir=d.Direction.dRightToLeft)};d.Clipper.prototype.PrepareHorzJoins=function(t,e){var r=this.m_PolyOuts[t.OutIdx].Pts;t.Side!=d.EdgeSide.esLeft&&(r=r.Prev),e&&(d.IntPoint.op_Equality(r.Pt,t.Top)?this.AddGhostJoin(r,t.Bot):this.AddGhostJoin(r,t.Top))};d.Clipper.prototype.ProcessHorizontal=function(t,e){var r={Dir:null,Left:null,Right:null};this.GetHorzDirection(t,r);for(var i=r.Dir,n=r.Left,o=r.Right,s=t,l=null;s.NextInLML!==null&&d.ClipperBase.IsHorizontal(s.NextInLML);)s=s.NextInLML;for(s.NextInLML===null&&(l=this.GetMaximaPair(s));;){for(var u=t==s,h=this.GetNextInAEL(t,i);h!==null&&!(h.Curr.X==t.Top.X&&t.NextInLML!==null&&h.Dx<t.NextInLML.Dx);){var m=this.GetNextInAEL(h,i);if(i==d.Direction.dLeftToRight&&h.Curr.X<=o||i==d.Direction.dRightToLeft&&h.Curr.X>=n){if(t.OutIdx>=0&&t.WindDelta!=0&&this.PrepareHorzJoins(t,e),h==l&&u){i==d.Direction.dLeftToRight?this.IntersectEdges(t,h,h.Top,!1):this.IntersectEdges(h,t,h.Top,!1),l.OutIdx>=0&&d.Error("ProcessHorizontal error");return}else if(i==d.Direction.dLeftToRight){var f=new d.IntPoint(h.Curr.X,t.Curr.Y);this.IntersectEdges(t,h,f,!0)}else{var f=new d.IntPoint(h.Curr.X,t.Curr.Y);this.IntersectEdges(h,t,f,!0)}this.SwapPositionsInAEL(t,h)}else if(i==d.Direction.dLeftToRight&&h.Curr.X>=o||i==d.Direction.dRightToLeft&&h.Curr.X<=n)break;h=m}if(t.OutIdx>=0&&t.WindDelta!==0&&this.PrepareHorzJoins(t,e),t.NextInLML!==null&&d.ClipperBase.IsHorizontal(t.NextInLML)){t=this.UpdateEdgeIntoAEL(t),t.OutIdx>=0&&this.AddOutPt(t,t.Bot);var r={Dir:i,Left:n,Right:o};this.GetHorzDirection(t,r),i=r.Dir,n=r.Left,o=r.Right}else break}if(t.NextInLML!==null)if(t.OutIdx>=0){var b=this.AddOutPt(t,t.Top);if(t=this.UpdateEdgeIntoAEL(t),t.WindDelta===0)return;var y=t.PrevInAEL,m=t.NextInAEL;if(y!==null&&y.Curr.X==t.Bot.X&&y.Curr.Y==t.Bot.Y&&y.WindDelta!==0&&y.OutIdx>=0&&y.Curr.Y>y.Top.Y&&d.ClipperBase.SlopesEqual(t,y,this.m_UseFullRange)){var _=this.AddOutPt(y,t.Bot);this.AddJoin(b,_,t.Top)}else if(m!==null&&m.Curr.X==t.Bot.X&&m.Curr.Y==t.Bot.Y&&m.WindDelta!==0&&m.OutIdx>=0&&m.Curr.Y>m.Top.Y&&d.ClipperBase.SlopesEqual(t,m,this.m_UseFullRange)){var _=this.AddOutPt(m,t.Bot);this.AddJoin(b,_,t.Top)}}else t=this.UpdateEdgeIntoAEL(t);else l!==null?l.OutIdx>=0?(i==d.Direction.dLeftToRight?this.IntersectEdges(t,l,t.Top,!1):this.IntersectEdges(l,t,t.Top,!1),l.OutIdx>=0&&d.Error("ProcessHorizontal error")):(this.DeleteFromAEL(t),this.DeleteFromAEL(l)):(t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t))};d.Clipper.prototype.GetNextInAEL=function(t,e){return e==d.Direction.dLeftToRight?t.NextInAEL:t.PrevInAEL};d.Clipper.prototype.IsMinima=function(t){return t!==null&&t.Prev.NextInLML!=t&&t.Next.NextInLML!=t};d.Clipper.prototype.IsMaxima=function(t,e){return t!==null&&t.Top.Y==e&&t.NextInLML===null};d.Clipper.prototype.IsIntermediate=function(t,e){return t.Top.Y==e&&t.NextInLML!==null};d.Clipper.prototype.GetMaximaPair=function(t){var e=null;return d.IntPoint.op_Equality(t.Next.Top,t.Top)&&t.Next.NextInLML===null?e=t.Next:d.IntPoint.op_Equality(t.Prev.Top,t.Top)&&t.Prev.NextInLML===null&&(e=t.Prev),e!==null&&(e.OutIdx==-2||e.NextInAEL==e.PrevInAEL&&!d.ClipperBase.IsHorizontal(e))?null:e};d.Clipper.prototype.ProcessIntersections=function(t,e){if(this.m_ActiveEdges==null)return!0;try{if(this.BuildIntersectList(t,e),this.m_IntersectList.length==0)return!0;if(this.m_IntersectList.length==1||this.FixupIntersectionOrder())this.ProcessIntersectList();else return!1}catch(r){this.m_SortedEdges=null,this.m_IntersectList.length=0,d.Error("ProcessIntersections error")}return this.m_SortedEdges=null,!0};d.Clipper.prototype.BuildIntersectList=function(t,e){if(this.m_ActiveEdges!==null){var r=this.m_ActiveEdges;for(this.m_SortedEdges=r;r!==null;)r.PrevInSEL=r.PrevInAEL,r.NextInSEL=r.NextInAEL,r.Curr.X=d.Clipper.TopX(r,e),r=r.NextInAEL;for(var i=!0;i&&this.m_SortedEdges!==null;){for(i=!1,r=this.m_SortedEdges;r.NextInSEL!==null;){var n=r.NextInSEL,o=new d.IntPoint;if(r.Curr.X>n.Curr.X){!this.IntersectPoint(r,n,o)&&r.Curr.X>n.Curr.X+1&&d.Error("Intersection error"),o.Y>t&&(o.Y=t,Math.abs(r.Dx)>Math.abs(n.Dx)?o.X=d.Clipper.TopX(n,t):o.X=d.Clipper.TopX(r,t));var s=new d.IntersectNode;s.Edge1=r,s.Edge2=n,s.Pt.X=o.X,s.Pt.Y=o.Y,this.m_IntersectList.push(s),this.SwapPositionsInSEL(r,n),i=!0}else r=n}if(r.PrevInSEL!==null)r.PrevInSEL.NextInSEL=null;else break}this.m_SortedEdges=null}};d.Clipper.prototype.EdgesAdjacent=function(t){return t.Edge1.NextInSEL==t.Edge2||t.Edge1.PrevInSEL==t.Edge2};d.Clipper.IntersectNodeSort=function(t,e){return e.Pt.Y-t.Pt.Y};d.Clipper.prototype.FixupIntersectionOrder=function(){this.m_IntersectList.sort(this.m_IntersectNodeComparer),this.CopyAELToSEL();for(var t=this.m_IntersectList.length,e=0;e<t;e++){if(!this.EdgesAdjacent(this.m_IntersectList[e])){for(var r=e+1;r<t&&!this.EdgesAdjacent(this.m_IntersectList[r]);)r++;if(r==t)return!1;var i=this.m_IntersectList[e];this.m_IntersectList[e]=this.m_IntersectList[r],this.m_IntersectList[r]=i}this.SwapPositionsInSEL(this.m_IntersectList[e].Edge1,this.m_IntersectList[e].Edge2)}return!0};d.Clipper.prototype.ProcessIntersectList=function(){for(var t=0,e=this.m_IntersectList.length;t<e;t++){var r=this.m_IntersectList[t];this.IntersectEdges(r.Edge1,r.Edge2,r.Pt,!0),this.SwapPositionsInAEL(r.Edge1,r.Edge2)}this.m_IntersectList.length=0};var JP=a(function(t){return t<0?Math.ceil(t-.5):Math.round(t)},"R1"),KP=a(function(t){return t<0?Math.ceil(t-.5):Math.floor(t+.5)},"R2"),QP=a(function(t){return t<0?-Math.round(Math.abs(t)):Math.round(t)},"R3"),eT=a(function(t){return t<0?(t-=.5,t<-2147483648?Math.ceil(t):t|0):(t+=.5,t>2147483647?Math.floor(t):t|0)},"R4");de.msie?d.Clipper.Round=JP:de.chromium?d.Clipper.Round=QP:de.safari?d.Clipper.Round=eT:d.Clipper.Round=KP;d.Clipper.TopX=function(t,e){return e==t.Top.Y?t.Top.X:t.Bot.X+d.Clipper.Round(t.Dx*(e-t.Bot.Y))};d.Clipper.prototype.IntersectPoint=function(t,e,r){r.X=0,r.Y=0;var i,n;if(d.ClipperBase.SlopesEqual(t,e,this.m_UseFullRange)||t.Dx==e.Dx)return e.Bot.Y>t.Bot.Y?(r.X=e.Bot.X,r.Y=e.Bot.Y):(r.X=t.Bot.X,r.Y=t.Bot.Y),!1;if(t.Delta.X===0)r.X=t.Bot.X,d.ClipperBase.IsHorizontal(e)?r.Y=e.Bot.Y:(n=e.Bot.Y-e.Bot.X/e.Dx,r.Y=d.Clipper.Round(r.X/e.Dx+n));else if(e.Delta.X===0)r.X=e.Bot.X,d.ClipperBase.IsHorizontal(t)?r.Y=t.Bot.Y:(i=t.Bot.Y-t.Bot.X/t.Dx,r.Y=d.Clipper.Round(r.X/t.Dx+i));else{i=t.Bot.X-t.Bot.Y*t.Dx,n=e.Bot.X-e.Bot.Y*e.Dx;var o=(n-i)/(t.Dx-e.Dx);r.Y=d.Clipper.Round(o),Math.abs(t.Dx)<Math.abs(e.Dx)?r.X=d.Clipper.Round(t.Dx*o+i):r.X=d.Clipper.Round(e.Dx*o+n)}if(r.Y<t.Top.Y||r.Y<e.Top.Y){if(t.Top.Y>e.Top.Y)return r.Y=t.Top.Y,r.X=d.Clipper.TopX(e,t.Top.Y),r.X<t.Top.X;r.Y=e.Top.Y,Math.abs(t.Dx)<Math.abs(e.Dx)?r.X=d.Clipper.TopX(t,r.Y):r.X=d.Clipper.TopX(e,r.Y)}return!0};d.Clipper.prototype.ProcessEdgesAtTopOfScanbeam=function(t){for(var e=this.m_ActiveEdges;e!==null;){var r=this.IsMaxima(e,t);if(r){var i=this.GetMaximaPair(e);r=i===null||!d.ClipperBase.IsHorizontal(i)}if(r){var n=e.PrevInAEL;this.DoMaxima(e),n===null?e=this.m_ActiveEdges:e=n.NextInAEL}else{if(this.IsIntermediate(e,t)&&d.ClipperBase.IsHorizontal(e.NextInLML)?(e=this.UpdateEdgeIntoAEL(e),e.OutIdx>=0&&this.AddOutPt(e,e.Bot),this.AddEdgeToSEL(e)):(e.Curr.X=d.Clipper.TopX(e,t),e.Curr.Y=t),this.StrictlySimple){var n=e.PrevInAEL;if(e.OutIdx>=0&&e.WindDelta!==0&&n!==null&&n.OutIdx>=0&&n.Curr.X==e.Curr.X&&n.WindDelta!==0){var o=this.AddOutPt(n,e.Curr),s=this.AddOutPt(e,e.Curr);this.AddJoin(o,s,e.Curr)}}e=e.NextInAEL}}for(this.ProcessHorizontals(!0),e=this.m_ActiveEdges;e!==null;){if(this.IsIntermediate(e,t)){var o=null;e.OutIdx>=0&&(o=this.AddOutPt(e,e.Top)),e=this.UpdateEdgeIntoAEL(e);var n=e.PrevInAEL,l=e.NextInAEL;if(n!==null&&n.Curr.X==e.Bot.X&&n.Curr.Y==e.Bot.Y&&o!==null&&n.OutIdx>=0&&n.Curr.Y>n.Top.Y&&d.ClipperBase.SlopesEqual(e,n,this.m_UseFullRange)&&e.WindDelta!==0&&n.WindDelta!==0){var s=this.AddOutPt(n,e.Bot);this.AddJoin(o,s,e.Top)}else if(l!==null&&l.Curr.X==e.Bot.X&&l.Curr.Y==e.Bot.Y&&o!==null&&l.OutIdx>=0&&l.Curr.Y>l.Top.Y&&d.ClipperBase.SlopesEqual(e,l,this.m_UseFullRange)&&e.WindDelta!==0&&l.WindDelta!==0){var s=this.AddOutPt(l,e.Bot);this.AddJoin(o,s,e.Top)}}e=e.NextInAEL}};d.Clipper.prototype.DoMaxima=function(t){var e=this.GetMaximaPair(t);if(e===null){t.OutIdx>=0&&this.AddOutPt(t,t.Top),this.DeleteFromAEL(t);return}for(var r=t.NextInAEL,i=!0;r!==null&&r!=e;)this.IntersectEdges(t,r,t.Top,!0),this.SwapPositionsInAEL(t,r),r=t.NextInAEL;t.OutIdx==-1&&e.OutIdx==-1?(this.DeleteFromAEL(t),this.DeleteFromAEL(e)):t.OutIdx>=0&&e.OutIdx>=0?this.IntersectEdges(t,e,t.Top,!1):i&&t.WindDelta===0?(t.OutIdx>=0&&(this.AddOutPt(t,t.Top),t.OutIdx=-1),this.DeleteFromAEL(t),e.OutIdx>=0&&(this.AddOutPt(e,t.Top),e.OutIdx=-1),this.DeleteFromAEL(e)):d.Error("DoMaxima error")};d.Clipper.ReversePaths=function(t){for(var e=0,r=t.length;e<r;e++)t[e].reverse()};d.Clipper.Orientation=function(t){return d.Clipper.Area(t)>=0};d.Clipper.prototype.PointCount=function(t){if(t===null)return 0;var e=0,r=t;do e++,r=r.Next;while(r!=t);return e};d.Clipper.prototype.BuildResult=function(t){d.Clear(t);for(var e=0,r=this.m_PolyOuts.length;e<r;e++){var i=this.m_PolyOuts[e];if(i.Pts!==null){var n=i.Pts.Prev,o=this.PointCount(n);if(!(o<2)){for(var s=new Array(o),l=0;l<o;l++)s[l]=n.Pt,n=n.Prev;t.push(s)}}}};d.Clipper.prototype.BuildResult2=function(t){t.Clear();for(var e=0,r=this.m_PolyOuts.length;e<r;e++){var i=this.m_PolyOuts[e],n=this.PointCount(i.Pts);if(!(i.IsOpen&&n<2||!i.IsOpen&&n<3)){this.FixHoleLinkage(i);var o=new d.PolyNode;t.m_AllPolys.push(o),i.PolyNode=o,o.m_polygon.length=n;for(var s=i.Pts.Prev,l=0;l<n;l++)o.m_polygon[l]=s.Pt,s=s.Prev}}for(var e=0,r=this.m_PolyOuts.length;e<r;e++){var i=this.m_PolyOuts[e];i.PolyNode!==null&&(i.IsOpen?(i.PolyNode.IsOpen=!0,t.AddChild(i.PolyNode)):i.FirstLeft!==null&&i.FirstLeft.PolyNode!=null?i.FirstLeft.PolyNode.AddChild(i.PolyNode):t.AddChild(i.PolyNode))}};d.Clipper.prototype.FixupOutPolygon=function(t){var e=null;t.BottomPt=null;for(var r=t.Pts;;){if(r.Prev==r||r.Prev==r.Next){this.DisposeOutPts(r),t.Pts=null;return}if(d.IntPoint.op_Equality(r.Pt,r.Next.Pt)||d.IntPoint.op_Equality(r.Pt,r.Prev.Pt)||d.ClipperBase.SlopesEqual(r.Prev.Pt,r.Pt,r.Next.Pt,this.m_UseFullRange)&&(!this.PreserveCollinear||!this.Pt2IsBetweenPt1AndPt3(r.Prev.Pt,r.Pt,r.Next.Pt))){e=null;var i=r;r.Prev.Next=r.Next,r.Next.Prev=r.Prev,r=r.Prev,i=null}else{if(r==e)break;e===null&&(e=r),r=r.Next}}t.Pts=r};d.Clipper.prototype.DupOutPt=function(t,e){var r=new d.OutPt;return r.Pt.X=t.Pt.X,r.Pt.Y=t.Pt.Y,r.Idx=t.Idx,e?(r.Next=t.Next,r.Prev=t,t.Next.Prev=r,t.Next=r):(r.Prev=t.Prev,r.Next=t,t.Prev.Next=r,t.Prev=r),r};d.Clipper.prototype.GetOverlap=function(t,e,r,i,n){return t<e?r<i?(n.Left=Math.max(t,r),n.Right=Math.min(e,i)):(n.Left=Math.max(t,i),n.Right=Math.min(e,r)):r<i?(n.Left=Math.max(e,r),n.Right=Math.min(t,i)):(n.Left=Math.max(e,i),n.Right=Math.min(t,r)),n.Left<n.Right};d.Clipper.prototype.JoinHorz=function(t,e,r,i,n,o){var s=t.Pt.X>e.Pt.X?d.Direction.dRightToLeft:d.Direction.dLeftToRight,l=r.Pt.X>i.Pt.X?d.Direction.dRightToLeft:d.Direction.dLeftToRight;if(s==l)return!1;if(s==d.Direction.dLeftToRight){for(;t.Next.Pt.X<=n.X&&t.Next.Pt.X>=t.Pt.X&&t.Next.Pt.Y==n.Y;)t=t.Next;o&&t.Pt.X!=n.X&&(t=t.Next),e=this.DupOutPt(t,!o),d.IntPoint.op_Inequality(e.Pt,n)&&(t=e,t.Pt.X=n.X,t.Pt.Y=n.Y,e=this.DupOutPt(t,!o))}else{for(;t.Next.Pt.X>=n.X&&t.Next.Pt.X<=t.Pt.X&&t.Next.Pt.Y==n.Y;)t=t.Next;!o&&t.Pt.X!=n.X&&(t=t.Next),e=this.DupOutPt(t,o),d.IntPoint.op_Inequality(e.Pt,n)&&(t=e,t.Pt.X=n.X,t.Pt.Y=n.Y,e=this.DupOutPt(t,o))}if(l==d.Direction.dLeftToRight){for(;r.Next.Pt.X<=n.X&&r.Next.Pt.X>=r.Pt.X&&r.Next.Pt.Y==n.Y;)r=r.Next;o&&r.Pt.X!=n.X&&(r=r.Next),i=this.DupOutPt(r,!o),d.IntPoint.op_Inequality(i.Pt,n)&&(r=i,r.Pt.X=n.X,r.Pt.Y=n.Y,i=this.DupOutPt(r,!o))}else{for(;r.Next.Pt.X>=n.X&&r.Next.Pt.X<=r.Pt.X&&r.Next.Pt.Y==n.Y;)r=r.Next;!o&&r.Pt.X!=n.X&&(r=r.Next),i=this.DupOutPt(r,o),d.IntPoint.op_Inequality(i.Pt,n)&&(r=i,r.Pt.X=n.X,r.Pt.Y=n.Y,i=this.DupOutPt(r,o))}return s==d.Direction.dLeftToRight==o?(t.Prev=r,r.Next=t,e.Next=i,i.Prev=e):(t.Next=r,r.Prev=t,e.Prev=i,i.Next=e),!0};d.Clipper.prototype.JoinPoints=function(t,e,r){var i=t.OutPt1,n=new d.OutPt,o=t.OutPt2,s=new d.OutPt,l=t.OutPt1.Pt.Y==t.OffPt.Y;if(l&&d.IntPoint.op_Equality(t.OffPt,t.OutPt1.Pt)&&d.IntPoint.op_Equality(t.OffPt,t.OutPt2.Pt)){for(n=t.OutPt1.Next;n!=i&&d.IntPoint.op_Equality(n.Pt,t.OffPt);)n=n.Next;var u=n.Pt.Y>t.OffPt.Y;for(s=t.OutPt2.Next;s!=o&&d.IntPoint.op_Equality(s.Pt,t.OffPt);)s=s.Next;var h=s.Pt.Y>t.OffPt.Y;return u==h?!1:u?(n=this.DupOutPt(i,!1),s=this.DupOutPt(o,!0),i.Prev=o,o.Next=i,n.Next=s,s.Prev=n,t.OutPt1=i,t.OutPt2=n,!0):(n=this.DupOutPt(i,!0),s=this.DupOutPt(o,!1),i.Next=o,o.Prev=i,n.Prev=s,s.Next=n,t.OutPt1=i,t.OutPt2=n,!0)}else if(l){for(n=i;i.Prev.Pt.Y==i.Pt.Y&&i.Prev!=n&&i.Prev!=o;)i=i.Prev;for(;n.Next.Pt.Y==n.Pt.Y&&n.Next!=i&&n.Next!=o;)n=n.Next;if(n.Next==i||n.Next==o)return!1;for(s=o;o.Prev.Pt.Y==o.Pt.Y&&o.Prev!=s&&o.Prev!=n;)o=o.Prev;for(;s.Next.Pt.Y==s.Pt.Y&&s.Next!=o&&s.Next!=i;)s=s.Next;if(s.Next==o||s.Next==i)return!1;var m={Left:null,Right:null};if(!this.GetOverlap(i.Pt.X,n.Pt.X,o.Pt.X,s.Pt.X,m))return!1;var f=m.Left,b=m.Right,y=new d.IntPoint,_;return i.Pt.X>=f&&i.Pt.X<=b?(y.X=i.Pt.X,y.Y=i.Pt.Y,_=i.Pt.X>n.Pt.X):o.Pt.X>=f&&o.Pt.X<=b?(y.X=o.Pt.X,y.Y=o.Pt.Y,_=o.Pt.X>s.Pt.X):n.Pt.X>=f&&n.Pt.X<=b?(y.X=n.Pt.X,y.Y=n.Pt.Y,_=n.Pt.X>i.Pt.X):(y.X=s.Pt.X,y.Y=s.Pt.Y,_=s.Pt.X>o.Pt.X),t.OutPt1=i,t.OutPt2=o,this.JoinHorz(i,n,o,s,y,_)}else{for(n=i.Next;d.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Next;var T=n.Pt.Y>i.Pt.Y||!d.ClipperBase.SlopesEqual(i.Pt,n.Pt,t.OffPt,this.m_UseFullRange);if(T){for(n=i.Prev;d.IntPoint.op_Equality(n.Pt,i.Pt)&&n!=i;)n=n.Prev;if(n.Pt.Y>i.Pt.Y||!d.ClipperBase.SlopesEqual(i.Pt,n.Pt,t.OffPt,this.m_UseFullRange))return!1}for(s=o.Next;d.IntPoint.op_Equality(s.Pt,o.Pt)&&s!=o;)s=s.Next;var g=s.Pt.Y>o.Pt.Y||!d.ClipperBase.SlopesEqual(o.Pt,s.Pt,t.OffPt,this.m_UseFullRange);if(g){for(s=o.Prev;d.IntPoint.op_Equality(s.Pt,o.Pt)&&s!=o;)s=s.Prev;if(s.Pt.Y>o.Pt.Y||!d.ClipperBase.SlopesEqual(o.Pt,s.Pt,t.OffPt,this.m_UseFullRange))return!1}return n==i||s==o||n==s||e==r&&T==g?!1:T?(n=this.DupOutPt(i,!1),s=this.DupOutPt(o,!0),i.Prev=o,o.Next=i,n.Next=s,s.Prev=n,t.OutPt1=i,t.OutPt2=n,!0):(n=this.DupOutPt(i,!0),s=this.DupOutPt(o,!1),i.Next=o,o.Prev=i,n.Prev=s,s.Next=n,t.OutPt1=i,t.OutPt2=n,!0)}};d.Clipper.GetBounds=function(t){for(var e=0,r=t.length;e<r&&t[e].length==0;)e++;if(e==r)return new d.IntRect(0,0,0,0);var i=new d.IntRect;for(i.left=t[e][0].X,i.right=i.left,i.top=t[e][0].Y,i.bottom=i.top;e<r;e++)for(var n=0,o=t[e].length;n<o;n++)t[e][n].X<i.left?i.left=t[e][n].X:t[e][n].X>i.right&&(i.right=t[e][n].X),t[e][n].Y<i.top?i.top=t[e][n].Y:t[e][n].Y>i.bottom&&(i.bottom=t[e][n].Y);return i};d.Clipper.prototype.GetBounds2=function(t){var e=t,r=new d.IntRect;for(r.left=t.Pt.X,r.right=t.Pt.X,r.top=t.Pt.Y,r.bottom=t.Pt.Y,t=t.Next;t!=e;)t.Pt.X<r.left&&(r.left=t.Pt.X),t.Pt.X>r.right&&(r.right=t.Pt.X),t.Pt.Y<r.top&&(r.top=t.Pt.Y),t.Pt.Y>r.bottom&&(r.bottom=t.Pt.Y),t=t.Next;return r};d.Clipper.PointInPolygon=function(t,e){var r=0,i=e.length;if(i<3)return 0;for(var n=e[0],o=1;o<=i;++o){var s=o==i?e[0]:e[o];if(s.Y==t.Y&&(s.X==t.X||n.Y==t.Y&&s.X>t.X==n.X<t.X))return-1;if(n.Y<t.Y!=s.Y<t.Y){if(n.X>=t.X)if(s.X>t.X)r=1-r;else{var l=(n.X-t.X)*(s.Y-t.Y)-(s.X-t.X)*(n.Y-t.Y);if(l==0)return-1;l>0==s.Y>n.Y&&(r=1-r)}else if(s.X>t.X){var l=(n.X-t.X)*(s.Y-t.Y)-(s.X-t.X)*(n.Y-t.Y);if(l==0)return-1;l>0==s.Y>n.Y&&(r=1-r)}}n=s}return r};d.Clipper.prototype.PointInPolygon=function(t,e){for(var r=0,i=e;;){var n=e.Pt.X,o=e.Pt.Y,s=e.Next.Pt.X,l=e.Next.Pt.Y;if(l==t.Y&&(s==t.X||o==t.Y&&s>t.X==n<t.X))return-1;if(o<t.Y!=l<t.Y){if(n>=t.X)if(s>t.X)r=1-r;else{var u=(n-t.X)*(l-t.Y)-(s-t.X)*(o-t.Y);if(u==0)return-1;u>0==l>o&&(r=1-r)}else if(s>t.X){var u=(n-t.X)*(l-t.Y)-(s-t.X)*(o-t.Y);if(u==0)return-1;u>0==l>o&&(r=1-r)}}if(e=e.Next,i==e)break}return r};d.Clipper.prototype.Poly2ContainsPoly1=function(t,e){var r=t;do{var i=this.PointInPolygon(r.Pt,e);if(i>=0)return i!=0;r=r.Next}while(r!=t);return!0};d.Clipper.prototype.FixupFirstLefts1=function(t,e){for(var r=0,i=this.m_PolyOuts.length;r<i;r++){var n=this.m_PolyOuts[r];n.Pts!==null&&n.FirstLeft==t&&this.Poly2ContainsPoly1(n.Pts,e.Pts)&&(n.FirstLeft=e)}};d.Clipper.prototype.FixupFirstLefts2=function(t,e){for(var r=0,i=this.m_PolyOuts,n=i.length,o=i[r];r<n;r++,o=i[r])o.FirstLeft==t&&(o.FirstLeft=e)};d.Clipper.ParseFirstLeft=function(t){for(;t!=null&&t.Pts==null;)t=t.FirstLeft;return t};d.Clipper.prototype.JoinCommonEdges=function(){for(var t=0,e=this.m_Joins.length;t<e;t++){var r=this.m_Joins[t],i=this.GetOutRec(r.OutPt1.Idx),n=this.GetOutRec(r.OutPt2.Idx);if(!(i.Pts==null||n.Pts==null)){var o;if(i==n?o=i:this.Param1RightOfParam2(i,n)?o=n:this.Param1RightOfParam2(n,i)?o=i:o=this.GetLowermostRec(i,n),!!this.JoinPoints(r,i,n))if(i==n){if(i.Pts=r.OutPt1,i.BottomPt=null,n=this.CreateOutRec(),n.Pts=r.OutPt2,this.UpdateOutPtIdxs(n),this.m_UsingPolyTree)for(var s=0,l=this.m_PolyOuts.length;s<l-1;s++){var u=this.m_PolyOuts[s];u.Pts==null||d.Clipper.ParseFirstLeft(u.FirstLeft)!=i||u.IsHole==i.IsHole||this.Poly2ContainsPoly1(u.Pts,r.OutPt2)&&(u.FirstLeft=n)}this.Poly2ContainsPoly1(n.Pts,i.Pts)?(n.IsHole=!i.IsHole,n.FirstLeft=i,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,i),(n.IsHole^this.ReverseSolution)==this.Area(n)>0&&this.ReversePolyPtLinks(n.Pts)):this.Poly2ContainsPoly1(i.Pts,n.Pts)?(n.IsHole=i.IsHole,i.IsHole=!n.IsHole,n.FirstLeft=i.FirstLeft,i.FirstLeft=n,this.m_UsingPolyTree&&this.FixupFirstLefts2(i,n),(i.IsHole^this.ReverseSolution)==this.Area(i)>0&&this.ReversePolyPtLinks(i.Pts)):(n.IsHole=i.IsHole,n.FirstLeft=i.FirstLeft,this.m_UsingPolyTree&&this.FixupFirstLefts1(i,n))}else n.Pts=null,n.BottomPt=null,n.Idx=i.Idx,i.IsHole=o.IsHole,o==n&&(i.FirstLeft=n.FirstLeft),n.FirstLeft=i,this.m_UsingPolyTree&&this.FixupFirstLefts2(n,i)}}};d.Clipper.prototype.UpdateOutPtIdxs=function(t){var e=t.Pts;do e.Idx=t.Idx,e=e.Prev;while(e!=t.Pts)};d.Clipper.prototype.DoSimplePolygons=function(){for(var t=0;t<this.m_PolyOuts.length;){var e=this.m_PolyOuts[t++],r=e.Pts;if(r!==null)do{for(var i=r.Next;i!=e.Pts;){if(d.IntPoint.op_Equality(r.Pt,i.Pt)&&i.Next!=r&&i.Prev!=r){var n=r.Prev,o=i.Prev;r.Prev=o,o.Next=r,i.Prev=n,n.Next=i,e.Pts=r;var s=this.CreateOutRec();s.Pts=i,this.UpdateOutPtIdxs(s),this.Poly2ContainsPoly1(s.Pts,e.Pts)?(s.IsHole=!e.IsHole,s.FirstLeft=e):this.Poly2ContainsPoly1(e.Pts,s.Pts)?(s.IsHole=e.IsHole,e.IsHole=!s.IsHole,s.FirstLeft=e.FirstLeft,e.FirstLeft=s):(s.IsHole=e.IsHole,s.FirstLeft=e.FirstLeft),i=r}i=i.Next}r=r.Next}while(r!=e.Pts)}};d.Clipper.Area=function(t){var e=t.length;if(e<3)return 0;for(var r=0,i=0,n=e-1;i<e;++i)r+=(t[n].X+t[i].X)*(t[n].Y-t[i].Y),n=i;return-r*.5};d.Clipper.prototype.Area=function(t){var e=t.Pts;if(e==null)return 0;var r=0;do r=r+(e.Prev.Pt.X+e.Pt.X)*(e.Prev.Pt.Y-e.Pt.Y),e=e.Next;while(e!=t.Pts);return r*.5};hy&&(d.Clipper.OffsetPaths=function(t,e,r,i,n){var o=new d.Paths,s=new d.ClipperOffset(n,n);return s.AddPaths(t,r,i),s.Execute(o,e),o});d.Clipper.SimplifyPolygon=function(t,e){var r=new Array,i=new d.Clipper(0);return i.StrictlySimple=!0,i.AddPath(t,d.PolyType.ptSubject,!0),i.Execute(d.ClipType.ctUnion,r,e,e),r};d.Clipper.SimplifyPolygons=function(t,e){typeof e>"u"&&(e=d.PolyFillType.pftEvenOdd);var r=new Array,i=new d.Clipper(0);return i.StrictlySimple=!0,i.AddPaths(t,d.PolyType.ptSubject,!0),i.Execute(d.ClipType.ctUnion,r,e,e),r};d.Clipper.DistanceSqrd=function(t,e){var r=t.X-e.X,i=t.Y-e.Y;return r*r+i*i};d.Clipper.DistanceFromLineSqrd=function(t,e,r){var i=e.Y-r.Y,n=r.X-e.X,o=i*e.X+n*e.Y;return o=i*t.X+n*t.Y-o,o*o/(i*i+n*n)};d.Clipper.SlopesNearCollinear=function(t,e,r,i){return d.Clipper.DistanceFromLineSqrd(e,t,r)<i};d.Clipper.PointsAreClose=function(t,e,r){var i=t.X-e.X,n=t.Y-e.Y;return i*i+n*n<=r};d.Clipper.ExcludeOp=function(t){var e=t.Prev;return e.Next=t.Next,t.Next.Prev=e,e.Idx=0,e};d.Clipper.CleanPolygon=function(t,e){typeof e>"u"&&(e=1.415);var r=t.length;if(r==0)return new Array;for(var i=new Array(r),n=0;n<r;++n)i[n]=new d.OutPt;for(var n=0;n<r;++n)i[n].Pt=t[n],i[n].Next=i[(n+1)%r],i[n].Next.Prev=i[n],i[n].Idx=0;for(var o=e*e,s=i[0];s.Idx==0&&s.Next!=s.Prev;)d.Clipper.PointsAreClose(s.Pt,s.Prev.Pt,o)?(s=d.Clipper.ExcludeOp(s),r--):d.Clipper.PointsAreClose(s.Prev.Pt,s.Next.Pt,o)?(d.Clipper.ExcludeOp(s.Next),s=d.Clipper.ExcludeOp(s),r-=2):d.Clipper.SlopesNearCollinear(s.Prev.Pt,s.Pt,s.Next.Pt,o)?(s=d.Clipper.ExcludeOp(s),r--):(s.Idx=1,s=s.Next);r<3&&(r=0);for(var l=new Array(r),n=0;n<r;++n)l[n]=new d.IntPoint(s.Pt),s=s.Next;return i=null,l};d.Clipper.CleanPolygons=function(t,e){for(var r=new Array(t.length),i=0,n=t.length;i<n;i++)r[i]=d.Clipper.CleanPolygon(t[i],e);return r};d.Clipper.Minkowski=function(t,e,r,i){var n=i?1:0,o=t.length,s=e.length,l=new Array;if(r)for(var u=0;u<s;u++){for(var h=new Array(o),m=0,f=t.length,b=t[m];m<f;m++,b=t[m])h[m]=new d.IntPoint(e[u].X+b.X,e[u].Y+b.Y);l.push(h)}else for(var u=0;u<s;u++){for(var h=new Array(o),m=0,f=t.length,b=t[m];m<f;m++,b=t[m])h[m]=new d.IntPoint(e[u].X-b.X,e[u].Y-b.Y);l.push(h)}for(var y=new Array,u=0;u<s-1+n;u++)for(var m=0;m<o;m++){var _=new Array;_.push(l[u%s][m%o]),_.push(l[(u+1)%s][m%o]),_.push(l[(u+1)%s][(m+1)%o]),_.push(l[u%s][(m+1)%o]),d.Clipper.Orientation(_)||_.reverse(),y.push(_)}var T=new d.Clipper(0);return T.AddPaths(y,d.PolyType.ptSubject,!0),T.Execute(d.ClipType.ctUnion,l,d.PolyFillType.pftNonZero,d.PolyFillType.pftNonZero),l};d.Clipper.MinkowskiSum=function(){var t=arguments,e=t.length;if(e==3){var r=t[0],i=t[1],n=t[2];return d.Clipper.Minkowski(r,i,!0,n)}else if(e==4){for(var r=t[0],o=t[1],s=t[2],n=t[3],l=new d.Clipper,u,h=0,m=o.length;h<m;++h){var u=d.Clipper.Minkowski(r,o[h],!0,n);l.AddPaths(u,d.PolyType.ptSubject,!0)}n&&l.AddPaths(o,d.PolyType.ptClip,!0);var f=new d.Paths;return l.Execute(d.ClipType.ctUnion,f,s,s),f}};d.Clipper.MinkowskiDiff=function(t,e,r){return d.Clipper.Minkowski(t,e,!1,r)};d.Clipper.PolyTreeToPaths=function(t){var e=new Array;return d.Clipper.AddPolyNodeToPaths(t,d.Clipper.NodeType.ntAny,e),e};d.Clipper.AddPolyNodeToPaths=function(t,e,r){var i=!0;switch(e){case d.Clipper.NodeType.ntOpen:return;case d.Clipper.NodeType.ntClosed:i=!t.IsOpen;break;default:break}t.m_polygon.length>0&&i&&r.push(t.m_polygon);for(var n=0,o=t.Childs(),s=o.length,l=o[n];n<s;n++,l=o[n])d.Clipper.AddPolyNodeToPaths(l,e,r)};d.Clipper.OpenPathsFromPolyTree=function(t){for(var e=new d.Paths,r=0,i=t.ChildCount();r<i;r++)t.Childs()[r].IsOpen&&e.push(t.Childs()[r].m_polygon);return e};d.Clipper.ClosedPathsFromPolyTree=function(t){var e=new d.Paths;return d.Clipper.AddPolyNodeToPaths(t,d.Clipper.NodeType.ntClosed,e),e};cl(d.Clipper,d.ClipperBase);d.Clipper.NodeType={ntAny:0,ntOpen:1,ntClosed:2};d.ClipperOffset=function(t,e){typeof t>"u"&&(t=2),typeof e>"u"&&(e=d.ClipperOffset.def_arc_tolerance),this.m_destPolys=new d.Paths,this.m_srcPoly=new d.Path,this.m_destPoly=new d.Path,this.m_normals=new Array,this.m_delta=0,this.m_sinA=0,this.m_sin=0,this.m_cos=0,this.m_miterLim=0,this.m_StepsPerRad=0,this.m_lowest=new d.IntPoint,this.m_polyNodes=new d.PolyNode,this.MiterLimit=t,this.ArcTolerance=e,this.m_lowest.X=-1};d.ClipperOffset.two_pi=6.28318530717959;d.ClipperOffset.def_arc_tolerance=.25;d.ClipperOffset.prototype.Clear=function(){d.Clear(this.m_polyNodes.Childs()),this.m_lowest.X=-1};d.ClipperOffset.Round=d.Clipper.Round;d.ClipperOffset.prototype.AddPath=function(t,e,r){var i=t.length-1;if(!(i<0)){var n=new d.PolyNode;if(n.m_jointype=e,n.m_endtype=r,r==d.EndType.etClosedLine||r==d.EndType.etClosedPolygon)for(;i>0&&d.IntPoint.op_Equality(t[0],t[i]);)i--;n.m_polygon.push(t[0]);for(var o=0,s=0,l=1;l<=i;l++)d.IntPoint.op_Inequality(n.m_polygon[o],t[l])&&(o++,n.m_polygon.push(t[l]),(t[l].Y>n.m_polygon[s].Y||t[l].Y==n.m_polygon[s].Y&&t[l].X<n.m_polygon[s].X)&&(s=o));if(!(r==d.EndType.etClosedPolygon&&o<2||r!=d.EndType.etClosedPolygon&&o<0)&&(this.m_polyNodes.AddChild(n),r==d.EndType.etClosedPolygon))if(this.m_lowest.X<0)this.m_lowest=new d.IntPoint(0,s);else{var u=this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon[this.m_lowest.Y];(n.m_polygon[s].Y>u.Y||n.m_polygon[s].Y==u.Y&&n.m_polygon[s].X<u.X)&&(this.m_lowest=new d.IntPoint(this.m_polyNodes.ChildCount()-1,s))}}};d.ClipperOffset.prototype.AddPaths=function(t,e,r){for(var i=0,n=t.length;i<n;i++)this.AddPath(t[i],e,r)};d.ClipperOffset.prototype.FixOrientations=function(){if(this.m_lowest.X>=0&&!d.Clipper.Orientation(this.m_polyNodes.Childs()[this.m_lowest.X].m_polygon))for(var t=0;t<this.m_polyNodes.ChildCount();t++){var e=this.m_polyNodes.Childs()[t];(e.m_endtype==d.EndType.etClosedPolygon||e.m_endtype==d.EndType.etClosedLine&&d.Clipper.Orientation(e.m_polygon))&&e.m_polygon.reverse()}else for(var t=0;t<this.m_polyNodes.ChildCount();t++){var e=this.m_polyNodes.Childs()[t];e.m_endtype==d.EndType.etClosedLine&&!d.Clipper.Orientation(e.m_polygon)&&e.m_polygon.reverse()}};d.ClipperOffset.GetUnitNormal=function(t,e){var r=e.X-t.X,i=e.Y-t.Y;if(r==0&&i==0)return new d.DoublePoint(0,0);var n=1/Math.sqrt(r*r+i*i);return r*=n,i*=n,new d.DoublePoint(i,-r)};d.ClipperOffset.prototype.DoOffset=function(t){if(this.m_destPolys=new Array,this.m_delta=t,d.ClipperBase.near_zero(t)){for(var e=0;e<this.m_polyNodes.ChildCount();e++){var r=this.m_polyNodes.Childs()[e];r.m_endtype==d.EndType.etClosedPolygon&&this.m_destPolys.push(r.m_polygon)}return}this.MiterLimit>2?this.m_miterLim=2/(this.MiterLimit*this.MiterLimit):this.m_miterLim=.5;var i;this.ArcTolerance<=0?i=d.ClipperOffset.def_arc_tolerance:this.ArcTolerance>Math.abs(t)*d.ClipperOffset.def_arc_tolerance?i=Math.abs(t)*d.ClipperOffset.def_arc_tolerance:i=this.ArcTolerance;var n=3.14159265358979/Math.acos(1-i/Math.abs(t));this.m_sin=Math.sin(d.ClipperOffset.two_pi/n),this.m_cos=Math.cos(d.ClipperOffset.two_pi/n),this.m_StepsPerRad=n/d.ClipperOffset.two_pi,t<0&&(this.m_sin=-this.m_sin);for(var e=0;e<this.m_polyNodes.ChildCount();e++){var r=this.m_polyNodes.Childs()[e];this.m_srcPoly=r.m_polygon;var o=this.m_srcPoly.length;if(!(o==0||t<=0&&(o<3||r.m_endtype!=d.EndType.etClosedPolygon))){if(this.m_destPoly=new Array,o==1){if(r.m_jointype==d.JoinType.jtRound)for(var s=1,l=0,u=1;u<=n;u++){this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[0].X+s*t),d.ClipperOffset.Round(this.m_srcPoly[0].Y+l*t)));var h=s;s=s*this.m_cos-this.m_sin*l,l=h*this.m_sin+l*this.m_cos}else for(var s=-1,l=-1,u=0;u<4;++u)this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[0].X+s*t),d.ClipperOffset.Round(this.m_srcPoly[0].Y+l*t))),s<0?s=1:l<0?l=1:s=-1;this.m_destPolys.push(this.m_destPoly);continue}this.m_normals.length=0;for(var u=0;u<o-1;u++)this.m_normals.push(d.ClipperOffset.GetUnitNormal(this.m_srcPoly[u],this.m_srcPoly[u+1]));if(r.m_endtype==d.EndType.etClosedLine||r.m_endtype==d.EndType.etClosedPolygon?this.m_normals.push(d.ClipperOffset.GetUnitNormal(this.m_srcPoly[o-1],this.m_srcPoly[0])):this.m_normals.push(new d.DoublePoint(this.m_normals[o-2])),r.m_endtype==d.EndType.etClosedPolygon){for(var m=o-1,u=0;u<o;u++)m=this.OffsetPoint(u,m,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else if(r.m_endtype==d.EndType.etClosedLine){for(var m=o-1,u=0;u<o;u++)m=this.OffsetPoint(u,m,r.m_jointype);this.m_destPolys.push(this.m_destPoly),this.m_destPoly=new Array;for(var f=this.m_normals[o-1],u=o-1;u>0;u--)this.m_normals[u]=new d.DoublePoint(-this.m_normals[u-1].X,-this.m_normals[u-1].Y);this.m_normals[0]=new d.DoublePoint(-f.X,-f.Y),m=0;for(var u=o-1;u>=0;u--)m=this.OffsetPoint(u,m,r.m_jointype);this.m_destPolys.push(this.m_destPoly)}else{for(var m=0,u=1;u<o-1;++u)m=this.OffsetPoint(u,m,r.m_jointype);var b;if(r.m_endtype==d.EndType.etOpenButt){var u=o-1;b=new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[u].X+this.m_normals[u].X*t),d.ClipperOffset.Round(this.m_srcPoly[u].Y+this.m_normals[u].Y*t)),this.m_destPoly.push(b),b=new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[u].X-this.m_normals[u].X*t),d.ClipperOffset.Round(this.m_srcPoly[u].Y-this.m_normals[u].Y*t)),this.m_destPoly.push(b)}else{var u=o-1;m=o-2,this.m_sinA=0,this.m_normals[u]=new d.DoublePoint(-this.m_normals[u].X,-this.m_normals[u].Y),r.m_endtype==d.EndType.etOpenSquare?this.DoSquare(u,m):this.DoRound(u,m)}for(var u=o-1;u>0;u--)this.m_normals[u]=new d.DoublePoint(-this.m_normals[u-1].X,-this.m_normals[u-1].Y);this.m_normals[0]=new d.DoublePoint(-this.m_normals[1].X,-this.m_normals[1].Y),m=o-1;for(var u=m-1;u>0;--u)m=this.OffsetPoint(u,m,r.m_jointype);r.m_endtype==d.EndType.etOpenButt?(b=new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[0].X-this.m_normals[0].X*t),d.ClipperOffset.Round(this.m_srcPoly[0].Y-this.m_normals[0].Y*t)),this.m_destPoly.push(b),b=new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[0].X+this.m_normals[0].X*t),d.ClipperOffset.Round(this.m_srcPoly[0].Y+this.m_normals[0].Y*t)),this.m_destPoly.push(b)):(m=1,this.m_sinA=0,r.m_endtype==d.EndType.etOpenSquare?this.DoSquare(0,1):this.DoRound(0,1)),this.m_destPolys.push(this.m_destPoly)}}}};d.ClipperOffset.prototype.Execute=function(){var t=arguments,e=t[0]instanceof d.PolyTree;if(e){var r=t[0],i=t[1];r.Clear(),this.FixOrientations(),this.DoOffset(i);var n=new d.Clipper(0);if(n.AddPaths(this.m_destPolys,d.PolyType.ptSubject,!0),i>0)n.Execute(d.ClipType.ctUnion,r,d.PolyFillType.pftPositive,d.PolyFillType.pftPositive);else{var o=d.Clipper.GetBounds(this.m_destPolys),s=new d.Path;if(s.push(new d.IntPoint(o.left-10,o.bottom+10)),s.push(new d.IntPoint(o.right+10,o.bottom+10)),s.push(new d.IntPoint(o.right+10,o.top-10)),s.push(new d.IntPoint(o.left-10,o.top-10)),n.AddPath(s,d.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(d.ClipType.ctUnion,r,d.PolyFillType.pftNegative,d.PolyFillType.pftNegative),r.ChildCount()==1&&r.Childs()[0].ChildCount()>0){var l=r.Childs()[0];r.Childs()[0]=l.Childs()[0];for(var u=1;u<l.ChildCount();u++)r.AddChild(l.Childs()[u])}else r.Clear()}}else{var r=t[0],i=t[1];d.Clear(r),this.FixOrientations(),this.DoOffset(i);var n=new d.Clipper(0);if(n.AddPaths(this.m_destPolys,d.PolyType.ptSubject,!0),i>0)n.Execute(d.ClipType.ctUnion,r,d.PolyFillType.pftPositive,d.PolyFillType.pftPositive);else{var o=d.Clipper.GetBounds(this.m_destPolys),s=new d.Path;s.push(new d.IntPoint(o.left-10,o.bottom+10)),s.push(new d.IntPoint(o.right+10,o.bottom+10)),s.push(new d.IntPoint(o.right+10,o.top-10)),s.push(new d.IntPoint(o.left-10,o.top-10)),n.AddPath(s,d.PolyType.ptSubject,!0),n.ReverseSolution=!0,n.Execute(d.ClipType.ctUnion,r,d.PolyFillType.pftNegative,d.PolyFillType.pftNegative),r.length>0&&r.splice(0,1)}}};d.ClipperOffset.prototype.OffsetPoint=function(t,e,r){if(this.m_sinA=this.m_normals[e].X*this.m_normals[t].Y-this.m_normals[t].X*this.m_normals[e].Y,this.m_sinA<5e-5&&this.m_sinA>-5e-5)return e;if(this.m_sinA>1?this.m_sinA=1:this.m_sinA<-1&&(this.m_sinA=-1),this.m_sinA*this.m_delta<0)this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[e].X*this.m_delta),d.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[e].Y*this.m_delta))),this.m_destPoly.push(new d.IntPoint(this.m_srcPoly[t])),this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta),d.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta)));else switch(r){case d.JoinType.jtMiter:{var i=1+(this.m_normals[t].X*this.m_normals[e].X+this.m_normals[t].Y*this.m_normals[e].Y);i>=this.m_miterLim?this.DoMiter(t,e,i):this.DoSquare(t,e);break}case d.JoinType.jtSquare:this.DoSquare(t,e);break;case d.JoinType.jtRound:this.DoRound(t,e);break}return e=t,e};d.ClipperOffset.prototype.DoSquare=function(t,e){var r=Math.tan(Math.atan2(this.m_sinA,this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y)/4);this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[e].X-this.m_normals[e].Y*r)),d.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[e].Y+this.m_normals[e].X*r)))),this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_delta*(this.m_normals[t].X+this.m_normals[t].Y*r)),d.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_delta*(this.m_normals[t].Y-this.m_normals[t].X*r))))};d.ClipperOffset.prototype.DoMiter=function(t,e,r){var i=this.m_delta/r;this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+(this.m_normals[e].X+this.m_normals[t].X)*i),d.ClipperOffset.Round(this.m_srcPoly[t].Y+(this.m_normals[e].Y+this.m_normals[t].Y)*i)))};d.ClipperOffset.prototype.DoRound=function(t,e){for(var r=Math.atan2(this.m_sinA,this.m_normals[e].X*this.m_normals[t].X+this.m_normals[e].Y*this.m_normals[t].Y),i=d.Cast_Int32(d.ClipperOffset.Round(this.m_StepsPerRad*Math.abs(r))),n=this.m_normals[e].X,o=this.m_normals[e].Y,s,l=0;l<i;++l)this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+n*this.m_delta),d.ClipperOffset.Round(this.m_srcPoly[t].Y+o*this.m_delta))),s=n,n=n*this.m_cos-this.m_sin*o,o=s*this.m_sin+o*this.m_cos;this.m_destPoly.push(new d.IntPoint(d.ClipperOffset.Round(this.m_srcPoly[t].X+this.m_normals[t].X*this.m_delta),d.ClipperOffset.Round(this.m_srcPoly[t].Y+this.m_normals[t].Y*this.m_delta)))};d.Error=function(t){try{throw new Error(t)}catch(e){alert(e.message)}};d.JS={};d.JS.AreaOfPolygon=function(t,e){return e||(e=1),d.Clipper.Area(t)/(e*e)};d.JS.AreaOfPolygons=function(t,e){e||(e=1);for(var r=0,i=0;i<t.length;i++)r+=d.Clipper.Area(t[i]);return r/(e*e)};d.JS.BoundsOfPath=function(t,e){return d.JS.BoundsOfPaths([t],e)};d.JS.BoundsOfPaths=function(t,e){e||(e=1);var r=d.Clipper.GetBounds(t);return r.left/=e,r.bottom/=e,r.right/=e,r.top/=e,r};d.JS.Clean=function(i,e){if(!(i instanceof Array))return[];var r=i[0]instanceof Array,i=d.JS.Clone(i);if(typeof e!="number"||e===null)return d.Error("Delta is not a number in Clean()."),i;if(i.length===0||i.length==1&&i[0].length===0||e<0)return i;r||(i=[i]);for(var n=i.length,o,s,l,u,h,m,f,b=[],y=0;y<n;y++)if(s=i[y],o=s.length,o!==0){if(o<3){l=s,b.push(l);continue}for(l=s,u=e*e,h=s[0],m=1,f=1;f<o;f++)(s[f].X-h.X)*(s[f].X-h.X)+(s[f].Y-h.Y)*(s[f].Y-h.Y)<=u||(l[m]=s[f],h=s[f],m++);h=s[m-1],(s[0].X-h.X)*(s[0].X-h.X)+(s[0].Y-h.Y)*(s[0].Y-h.Y)<=u&&m--,m<o&&l.splice(m,o-m),l.length&&b.push(l)}return!r&&b.length?b=b[0]:!r&&b.length===0?b=[]:r&&b.length===0&&(b=[[]]),b};d.JS.Clone=function(t){if(!(t instanceof Array))return[];if(t.length===0)return[];if(t.length==1&&t[0].length===0)return[[]];var e=t[0]instanceof Array;e||(t=[t]);var r=t.length,i,n,o,s,l=new Array(r);for(n=0;n<r;n++){for(i=t[n].length,s=new Array(i),o=0;o<i;o++)s[o]={X:t[n][o].X,Y:t[n][o].Y};l[n]=s}return e||(l=l[0]),l};d.JS.Lighten=function(t,e){if(!(t instanceof Array))return[];if(typeof e!="number"||e===null)return d.Error("Tolerance is not a number in Lighten()."),d.JS.Clone(t);if(t.length===0||t.length==1&&t[0].length===0||e<0)return d.JS.Clone(t);t[0]instanceof Array||(t=[t]);var r,i,n,o,s,l,u,h,m,f,b,y,_,T,g,x,P,S=t.length,C=e*e,w=[];for(r=0;r<S;r++)if(n=t[r],l=n.length,l!=0){for(o=0;o<1e6;o++){for(s=[],l=n.length,n[l-1].X!=n[0].X||n[l-1].Y!=n[0].Y?(y=1,n.push({X:n[0].X,Y:n[0].Y}),l=n.length):y=0,b=[],i=0;i<l-2;i++)u=n[i],m=n[i+1],h=n[i+2],x=u.X,P=u.Y,_=h.X-x,T=h.Y-P,(_!==0||T!==0)&&(g=((m.X-x)*_+(m.Y-P)*T)/(_*_+T*T),g>1?(x=h.X,P=h.Y):g>0&&(x+=_*g,P+=T*g)),_=m.X-x,T=m.Y-P,f=_*_+T*T,f<=C&&(b[i+1]=1,i++);for(s.push({X:n[0].X,Y:n[0].Y}),i=1;i<l-1;i++)b[i]||s.push({X:n[i].X,Y:n[i].Y});if(s.push({X:n[l-1].X,Y:n[l-1].Y}),y&&n.pop(),b.length)n=s;else break}l=s.length,s[l-1].X==s[0].X&&s[l-1].Y==s[0].Y&&s.pop(),s.length>2&&w.push(s)}return!t[0]instanceof Array&&(w=w[0]),typeof w>"u"&&(w=[[]]),w};d.JS.PerimeterOfPath=function(t,e,r){if(typeof t>"u")return 0;var i=Math.sqrt,n=0,o,s,l=0,u=0,h=0,m=0,f=t.length;if(f<2)return 0;for(e&&(t[f]=t[0],f++);--f;)o=t[f],l=o.X,u=o.Y,s=t[f-1],h=s.X,m=s.Y,n+=i((l-h)*(l-h)+(u-m)*(u-m));return e&&t.pop(),n/r};d.JS.PerimeterOfPaths=function(t,e,r){r||(r=1);for(var i=0,n=0;n<t.length;n++)i+=d.JS.PerimeterOfPath(t[n],e,r);return i};d.JS.ScaleDownPath=function(t,e){var r,i;for(e||(e=1),r=t.length;r--;)i=t[r],i.X=i.X/e,i.Y=i.Y/e};d.JS.ScaleDownPaths=function(t,e){var r,i,n,o=Math.round;for(e||(e=1),r=t.length;r--;)for(i=t[r].length;i--;)n=t[r][i],n.X=n.X/e,n.Y=n.Y/e};d.JS.ScaleUpPath=function(t,e){var r,i,n=Math.round;for(e||(e=1),r=t.length;r--;)i=t[r],i.X=n(i.X*e),i.Y=n(i.Y*e)};d.JS.ScaleUpPaths=function(t,e){var r,i,n,o=Math.round;for(e||(e=1),r=t.length;r--;)for(i=t[r].length;i--;)n=t[r][i],n.X=o(n.X*e),n.Y=o(n.Y*e)};d.ExPolygons=function(){return[]};d.ExPolygon=function(){this.outer=null,this.holes=null};d.JS.AddOuterPolyNodeToExPolygons=function(t,e){var r=new d.ExPolygon;r.outer=t.Contour();var i=t.Childs(),n=i.length;r.holes=new Array(n);var o,s,l,u,h,m;for(l=0;l<n;l++)for(o=i[l],r.holes[l]=o.Contour(),u=0,h=o.Childs(),m=h.length;u<m;u++)s=h[u],d.JS.AddOuterPolyNodeToExPolygons(s,e);e.push(r)};d.JS.ExPolygonsToPaths=function(t){var e,r,i,n,o=new d.Paths;for(e=0,i=t.length;e<i;e++)for(o.push(t[e].outer),r=0,n=t[e].holes.length;r<n;r++)o.push(t[e].holes[r]);return o};d.JS.PolyTreeToExPolygons=function(t){var e=new d.ExPolygons,r,i,n,o;for(i=0,n=t.Childs(),o=n.length;i<o;i++)r=n[i],d.JS.AddOuterPolyNodeToExPolygons(r,e);return e};Qo.exports=d});var Wy=Ar((jh,Hh)=>{v();(function(t,e){typeof jh=="object"&&typeof Hh<"u"?Hh.exports=e():typeof define=="function"&&define.amd?define(e):(t=t||self).RBush=e()})(jh,function(){"use strict";function t(g,x,P,S,C){a(function w(k,A,N,Y,z){for(;Y>N;){if(Y-N>600){var X=Y-N+1,q=A-N+1,F=Math.log(X),J=.5*Math.exp(2*F/3),pe=.5*Math.sqrt(F*J*(X-J)/X)*(q-X/2<0?-1:1),se=Math.max(N,Math.floor(A-q*J/X+pe)),De=Math.min(Y,Math.floor(A+(X-q)*J/X+pe));w(k,A,se,De,z)}var ve=k[A],ge=N,xe=Y;for(e(k,N,A),z(k[Y],ve)>0&&e(k,N,Y);ge<xe;){for(e(k,ge,xe),ge++,xe--;z(k[ge],ve)<0;)ge++;for(;z(k[xe],ve)>0;)xe--}z(k[N],ve)===0?e(k,N,xe):e(k,++xe,Y),xe<=A&&(N=xe+1),A<=xe&&(Y=xe-1)}},"t")(g,x,P||0,S||g.length-1,C||r)}a(t,"t");function e(g,x,P){var S=g[x];g[x]=g[P],g[P]=S}a(e,"i");function r(g,x){return g<x?-1:g>x?1:0}a(r,"n");var i=a(function(g){g===void 0&&(g=9),this._maxEntries=Math.max(4,g),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()},"r");function n(g,x,P){if(!P)return x.indexOf(g);for(var S=0;S<x.length;S++)if(P(g,x[S]))return S;return-1}a(n,"e");function o(g,x){s(g,0,g.children.length,x,g)}a(o,"a");function s(g,x,P,S,C){C||(C=_(null)),C.minX=1/0,C.minY=1/0,C.maxX=-1/0,C.maxY=-1/0;for(var w=x;w<P;w++){var k=g.children[w];l(C,g.leaf?S(k):k)}return C}a(s,"h");function l(g,x){return g.minX=Math.min(g.minX,x.minX),g.minY=Math.min(g.minY,x.minY),g.maxX=Math.max(g.maxX,x.maxX),g.maxY=Math.max(g.maxY,x.maxY),g}a(l,"o");function u(g,x){return g.minX-x.minX}a(u,"s");function h(g,x){return g.minY-x.minY}a(h,"l");function m(g){return(g.maxX-g.minX)*(g.maxY-g.minY)}a(m,"f");function f(g){return g.maxX-g.minX+(g.maxY-g.minY)}a(f,"u");function b(g,x){return g.minX<=x.minX&&g.minY<=x.minY&&x.maxX<=g.maxX&&x.maxY<=g.maxY}a(b,"m");function y(g,x){return x.minX<=g.maxX&&x.minY<=g.maxY&&x.maxX>=g.minX&&x.maxY>=g.minY}a(y,"c");function _(g){return{children:g,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}a(_,"p");function T(g,x,P,S,C){for(var w=[x,P];w.length;)if(!((P=w.pop())-(x=w.pop())<=S)){var k=x+Math.ceil((P-x)/S/2)*S;t(g,k,x,P,C),w.push(x,k,k,P)}}return a(T,"d"),i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(g){var x=this.data,P=[];if(!y(g,x))return P;for(var S=this.toBBox,C=[];x;){for(var w=0;w<x.children.length;w++){var k=x.children[w],A=x.leaf?S(k):k;y(g,A)&&(x.leaf?P.push(k):b(g,A)?this._all(k,P):C.push(k))}x=C.pop()}return P},i.prototype.collides=function(g){var x=this.data;if(!y(g,x))return!1;for(var P=[];x;){for(var S=0;S<x.children.length;S++){var C=x.children[S],w=x.leaf?this.toBBox(C):C;if(y(g,w)){if(x.leaf||b(g,w))return!0;P.push(C)}}x=P.pop()}return!1},i.prototype.load=function(g){if(!g||!g.length)return this;if(g.length<this._minEntries){for(var x=0;x<g.length;x++)this.insert(g[x]);return this}var P=this._build(g.slice(),0,g.length-1,0);if(this.data.children.length)if(this.data.height===P.height)this._splitRoot(this.data,P);else{if(this.data.height<P.height){var S=this.data;this.data=P,P=S}this._insert(P,this.data.height-P.height-1,!0)}else this.data=P;return this},i.prototype.insert=function(g){return g&&this._insert(g,this.data.height-1),this},i.prototype.clear=function(){return this.data=_([]),this},i.prototype.remove=function(g,x){if(!g)return this;for(var P,S,C,w=this.data,k=this.toBBox(g),A=[],N=[];w||A.length;){if(w||(w=A.pop(),S=A[A.length-1],P=N.pop(),C=!0),w.leaf){var Y=n(g,w.children,x);if(Y!==-1)return w.children.splice(Y,1),A.push(w),this._condense(A),this}C||w.leaf||!b(w,k)?S?(P++,w=S.children[P],C=!1):w=null:(A.push(w),N.push(P),P=0,S=w,w=w.children[0])}return this},i.prototype.toBBox=function(g){return g},i.prototype.compareMinX=function(g,x){return g.minX-x.minX},i.prototype.compareMinY=function(g,x){return g.minY-x.minY},i.prototype.toJSON=function(){return this.data},i.prototype.fromJSON=function(g){return this.data=g,this},i.prototype._all=function(g,x){for(var P=[];g;)g.leaf?x.push.apply(x,g.children):P.push.apply(P,g.children),g=P.pop();return x},i.prototype._build=function(g,x,P,S){var C,w=P-x+1,k=this._maxEntries;if(w<=k)return o(C=_(g.slice(x,P+1)),this.toBBox),C;S||(S=Math.ceil(Math.log(w)/Math.log(k)),k=Math.ceil(w/Math.pow(k,S-1))),(C=_([])).leaf=!1,C.height=S;var A=Math.ceil(w/k),N=A*Math.ceil(Math.sqrt(k));T(g,x,P,N,this.compareMinX);for(var Y=x;Y<=P;Y+=N){var z=Math.min(Y+N-1,P);T(g,Y,z,A,this.compareMinY);for(var X=Y;X<=z;X+=A){var q=Math.min(X+A-1,z);C.children.push(this._build(g,X,q,S-1))}}return o(C,this.toBBox),C},i.prototype._chooseSubtree=function(g,x,P,S){for(;S.push(x),!x.leaf&&S.length-1!==P;){for(var C=1/0,w=1/0,k=void 0,A=0;A<x.children.length;A++){var N=x.children[A],Y=m(N),z=(X=g,q=N,(Math.max(q.maxX,X.maxX)-Math.min(q.minX,X.minX))*(Math.max(q.maxY,X.maxY)-Math.min(q.minY,X.minY))-Y);z<w?(w=z,C=Y<C?Y:C,k=N):z===w&&Y<C&&(C=Y,k=N)}x=k||x.children[0]}var X,q;return x},i.prototype._insert=function(g,x,P){var S=P?g:this.toBBox(g),C=[],w=this._chooseSubtree(S,this.data,x,C);for(w.children.push(g),l(w,S);x>=0&&C[x].children.length>this._maxEntries;)this._split(C,x),x--;this._adjustParentBBoxes(S,C,x)},i.prototype._split=function(g,x){var P=g[x],S=P.children.length,C=this._minEntries;this._chooseSplitAxis(P,C,S);var w=this._chooseSplitIndex(P,C,S),k=_(P.children.splice(w,P.children.length-w));k.height=P.height,k.leaf=P.leaf,o(P,this.toBBox),o(k,this.toBBox),x?g[x-1].children.push(k):this._splitRoot(P,k)},i.prototype._splitRoot=function(g,x){this.data=_([g,x]),this.data.height=g.height+1,this.data.leaf=!1,o(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(g,x,P){for(var S,C,w,k,A,N,Y,z=1/0,X=1/0,q=x;q<=P-x;q++){var F=s(g,0,q,this.toBBox),J=s(g,q,P,this.toBBox),pe=(C=F,w=J,k=void 0,A=void 0,N=void 0,Y=void 0,k=Math.max(C.minX,w.minX),A=Math.max(C.minY,w.minY),N=Math.min(C.maxX,w.maxX),Y=Math.min(C.maxY,w.maxY),Math.max(0,N-k)*Math.max(0,Y-A)),se=m(F)+m(J);pe<z?(z=pe,S=q,X=se<X?se:X):pe===z&&se<X&&(X=se,S=q)}return S||P-x},i.prototype._chooseSplitAxis=function(g,x,P){var S=g.leaf?this.compareMinX:u,C=g.leaf?this.compareMinY:h;this._allDistMargin(g,x,P,S)<this._allDistMargin(g,x,P,C)&&g.children.sort(S)},i.prototype._allDistMargin=function(g,x,P,S){g.children.sort(S);for(var C=this.toBBox,w=s(g,0,x,C),k=s(g,P-x,P,C),A=f(w)+f(k),N=x;N<P-x;N++){var Y=g.children[N];l(w,g.leaf?C(Y):Y),A+=f(w)}for(var z=P-x-1;z>=x;z--){var X=g.children[z];l(k,g.leaf?C(X):X),A+=f(k)}return A},i.prototype._adjustParentBBoxes=function(g,x,P){for(var S=P;S>=0;S--)l(x[S],g)},i.prototype._condense=function(g){for(var x=g.length-1,P=void 0;x>=0;x--)g[x].children.length===0?x>0?(P=g[x-1].children).splice(P.indexOf(g[x]),1):this.clear():o(g[x],this.toBBox)},i})});var Jh=Ar(ee=>{"use strict";v();Object.defineProperty(ee,"__esModule",{value:!0});ee.earthRadius=63710088e-1;ee.factors={centimeters:ee.earthRadius*100,centimetres:ee.earthRadius*100,degrees:ee.earthRadius/111325,feet:ee.earthRadius*3.28084,inches:ee.earthRadius*39.37,kilometers:ee.earthRadius/1e3,kilometres:ee.earthRadius/1e3,meters:ee.earthRadius,metres:ee.earthRadius,miles:ee.earthRadius/1609.344,millimeters:ee.earthRadius*1e3,millimetres:ee.earthRadius*1e3,nauticalmiles:ee.earthRadius/1852,radians:1,yards:ee.earthRadius*1.0936};ee.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/ee.earthRadius,yards:1.0936133};ee.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 ni(t,e,r){r===void 0&&(r={});var i={type:"Feature"};return(r.id===0||r.id)&&(i.id=r.id),r.bbox&&(i.bbox=r.bbox),i.properties=e||{},i.geometry=t,i}a(ni,"feature");ee.feature=ni;function QT(t,e,r){switch(r===void 0&&(r={}),t){case"Point":return Wh(e).geometry;case"LineString":return qh(e).geometry;case"Polygon":return Vh(e).geometry;case"MultiPoint":return qy(e).geometry;case"MultiLineString":return Vy(e).geometry;case"MultiPolygon":return $y(e).geometry;default:throw new Error(t+" is invalid")}}a(QT,"geometry");ee.geometry=QT;function Wh(t,e,r){if(r===void 0&&(r={}),!t)throw new Error("coordinates is required");if(!Array.isArray(t))throw new Error("coordinates must be an Array");if(t.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Fl(t[0])||!Fl(t[1]))throw new Error("coordinates must contain numbers");var i={type:"Point",coordinates:t};return ni(i,e,r)}a(Wh,"point");ee.point=Wh;function e1(t,e,r){return r===void 0&&(r={}),Gl(t.map(function(i){return Wh(i,e)}),r)}a(e1,"points");ee.points=e1;function Vh(t,e,r){r===void 0&&(r={});for(var i=0,n=t;i<n.length;i++){var o=n[i];if(o.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<o[o.length-1].length;s++)if(o[o.length-1][s]!==o[0][s])throw new Error("First and last Position are not equivalent.")}var l={type:"Polygon",coordinates:t};return ni(l,e,r)}a(Vh,"polygon");ee.polygon=Vh;function t1(t,e,r){return r===void 0&&(r={}),Gl(t.map(function(i){return Vh(i,e)}),r)}a(t1,"polygons");ee.polygons=t1;function qh(t,e,r){if(r===void 0&&(r={}),t.length<2)throw new Error("coordinates must be an array of two or more positions");var i={type:"LineString",coordinates:t};return ni(i,e,r)}a(qh,"lineString");ee.lineString=qh;function r1(t,e,r){return r===void 0&&(r={}),Gl(t.map(function(i){return qh(i,e)}),r)}a(r1,"lineStrings");ee.lineStrings=r1;function Gl(t,e){e===void 0&&(e={});var r={type:"FeatureCollection"};return e.id&&(r.id=e.id),e.bbox&&(r.bbox=e.bbox),r.features=t,r}a(Gl,"featureCollection");ee.featureCollection=Gl;function Vy(t,e,r){r===void 0&&(r={});var i={type:"MultiLineString",coordinates:t};return ni(i,e,r)}a(Vy,"multiLineString");ee.multiLineString=Vy;function qy(t,e,r){r===void 0&&(r={});var i={type:"MultiPoint",coordinates:t};return ni(i,e,r)}a(qy,"multiPoint");ee.multiPoint=qy;function $y(t,e,r){r===void 0&&(r={});var i={type:"MultiPolygon",coordinates:t};return ni(i,e,r)}a($y,"multiPolygon");ee.multiPolygon=$y;function i1(t,e,r){r===void 0&&(r={});var i={type:"GeometryCollection",geometries:t};return ni(i,e,r)}a(i1,"geometryCollection");ee.geometryCollection=i1;function n1(t,e){if(e===void 0&&(e=0),e&&!(e>=0))throw new Error("precision must be a positive number");var r=Math.pow(10,e||0);return Math.round(t*r)/r}a(n1,"round");ee.round=n1;function Jy(t,e){e===void 0&&(e="kilometers");var r=ee.factors[e];if(!r)throw new Error(e+" units is invalid");return t*r}a(Jy,"radiansToLength");ee.radiansToLength=Jy;function $h(t,e){e===void 0&&(e="kilometers");var r=ee.factors[e];if(!r)throw new Error(e+" units is invalid");return t/r}a($h,"lengthToRadians");ee.lengthToRadians=$h;function o1(t,e){return Ky($h(t,e))}a(o1,"lengthToDegrees");ee.lengthToDegrees=o1;function s1(t){var e=t%360;return e<0&&(e+=360),e}a(s1,"bearingToAzimuth");ee.bearingToAzimuth=s1;function Ky(t){var e=t%(2*Math.PI);return e*180/Math.PI}a(Ky,"radiansToDegrees");ee.radiansToDegrees=Ky;function a1(t){var e=t%360;return e*Math.PI/180}a(a1,"degreesToRadians");ee.degreesToRadians=a1;function l1(t,e,r){if(e===void 0&&(e="kilometers"),r===void 0&&(r="kilometers"),!(t>=0))throw new Error("length must be a positive number");return Jy($h(t,e),r)}a(l1,"convertLength");ee.convertLength=l1;function c1(t,e,r){if(e===void 0&&(e="meters"),r===void 0&&(r="kilometers"),!(t>=0))throw new Error("area must be a positive number");var i=ee.areaFactors[e];if(!i)throw new Error("invalid original units");var n=ee.areaFactors[r];if(!n)throw new Error("invalid final units");return t/i*n}a(c1,"convertArea");ee.convertArea=c1;function Fl(t){return!isNaN(t)&&t!==null&&!Array.isArray(t)}a(Fl,"isNumber");ee.isNumber=Fl;function u1(t){return!!t&&t.constructor===Object}a(u1,"isObject");ee.isObject=u1;function h1(t){if(!t)throw new Error("bbox is required");if(!Array.isArray(t))throw new Error("bbox must be an Array");if(t.length!==4&&t.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");t.forEach(function(e){if(!Fl(e))throw new Error("bbox must only contain numbers")})}a(h1,"validateBBox");ee.validateBBox=h1;function d1(t){if(!t)throw new Error("id is required");if(["string","number"].indexOf(typeof t)===-1)throw new Error("id must be a number or a string")}a(d1,"validateId");ee.validateId=d1});var Qh=Ar($e=>{"use strict";v();Object.defineProperty($e,"__esModule",{value:!0});var lt=Jh();function hs(t,e,r){if(t!==null)for(var i,n,o,s,l,u,h,m=0,f=0,b,y=t.type,_=y==="FeatureCollection",T=y==="Feature",g=_?t.features.length:1,x=0;x<g;x++){h=_?t.features[x].geometry:T?t.geometry:t,b=h?h.type==="GeometryCollection":!1,l=b?h.geometries.length:1;for(var P=0;P<l;P++){var S=0,C=0;if(s=b?h.geometries[P]:h,s!==null){u=s.coordinates;var w=s.type;switch(m=r&&(w==="Polygon"||w==="MultiPolygon")?1:0,w){case null:break;case"Point":if(e(u,f,x,S,C)===!1)return!1;f++,S++;break;case"LineString":case"MultiPoint":for(i=0;i<u.length;i++){if(e(u[i],f,x,S,C)===!1)return!1;f++,w==="MultiPoint"&&S++}w==="LineString"&&S++;break;case"Polygon":case"MultiLineString":for(i=0;i<u.length;i++){for(n=0;n<u[i].length-m;n++){if(e(u[i][n],f,x,S,C)===!1)return!1;f++}w==="MultiLineString"&&S++,w==="Polygon"&&C++}w==="Polygon"&&S++;break;case"MultiPolygon":for(i=0;i<u.length;i++){for(C=0,n=0;n<u[i].length;n++){for(o=0;o<u[i][n].length-m;o++){if(e(u[i][n][o],f,x,S,C)===!1)return!1;f++}C++}S++}break;case"GeometryCollection":for(i=0;i<s.geometries.length;i++)if(hs(s.geometries[i],e,r)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}a(hs,"coordEach");function p1(t,e,r,i){var n=r;return hs(t,function(o,s,l,u,h){s===0&&r===void 0?n=o:n=e(n,o,s,l,u,h)},i),n}a(p1,"coordReduce");function Qy(t,e){var r;switch(t.type){case"FeatureCollection":for(r=0;r<t.features.length&&e(t.features[r].properties,r)!==!1;r++);break;case"Feature":e(t.properties,0);break}}a(Qy,"propEach");function m1(t,e,r){var i=r;return Qy(t,function(n,o){o===0&&r===void 0?i=n:i=e(i,n,o)}),i}a(m1,"propReduce");function eg(t,e){if(t.type==="Feature")e(t,0);else if(t.type==="FeatureCollection")for(var r=0;r<t.features.length&&e(t.features[r],r)!==!1;r++);}a(eg,"featureEach");function f1(t,e,r){var i=r;return eg(t,function(n,o){o===0&&r===void 0?i=n:i=e(i,n,o)}),i}a(f1,"featureReduce");function y1(t){var e=[];return hs(t,function(r){e.push(r)}),e}a(y1,"coordAll");function Kh(t,e){var r,i,n,o,s,l,u,h,m,f,b=0,y=t.type==="FeatureCollection",_=t.type==="Feature",T=y?t.features.length:1;for(r=0;r<T;r++){for(l=y?t.features[r].geometry:_?t.geometry:t,h=y?t.features[r].properties:_?t.properties:{},m=y?t.features[r].bbox:_?t.bbox:void 0,f=y?t.features[r].id:_?t.id:void 0,u=l?l.type==="GeometryCollection":!1,s=u?l.geometries.length:1,n=0;n<s;n++){if(o=u?l.geometries[n]:l,o===null){if(e(null,b,h,m,f)===!1)return!1;continue}switch(o.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(e(o,b,h,m,f)===!1)return!1;break}case"GeometryCollection":{for(i=0;i<o.geometries.length;i++)if(e(o.geometries[i],b,h,m,f)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}b++}}a(Kh,"geomEach");function g1(t,e,r){var i=r;return Kh(t,function(n,o,s,l,u){o===0&&r===void 0?i=n:i=e(i,n,o,s,l,u)}),i}a(g1,"geomReduce");function Xl(t,e){Kh(t,function(r,i,n,o,s){var l=r===null?null:r.type;switch(l){case null:case"Point":case"LineString":case"Polygon":return e(lt.feature(r,n,{bbox:o,id:s}),i,0)===!1?!1:void 0}var u;switch(l){case"MultiPoint":u="Point";break;case"MultiLineString":u="LineString";break;case"MultiPolygon":u="Polygon";break}for(var h=0;h<r.coordinates.length;h++){var m=r.coordinates[h],f={type:u,coordinates:m};if(e(lt.feature(f,n),i,h)===!1)return!1}})}a(Xl,"flattenEach");function v1(t,e,r){var i=r;return Xl(t,function(n,o,s){o===0&&s===0&&r===void 0?i=n:i=e(i,n,o,s)}),i}a(v1,"flattenReduce");function tg(t,e){Xl(t,function(r,i,n){var o=0;if(r.geometry){var s=r.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var l,u=0,h=0,m=0;if(hs(r,function(f,b,y,_,T){if(l===void 0||i>u||_>h||T>m){l=f,u=i,h=_,m=T,o=0;return}var g=lt.lineString([l,f],r.properties);if(e(g,i,n,T,o)===!1)return!1;o++,l=f})===!1)return!1}}})}a(tg,"segmentEach");function b1(t,e,r){var i=r,n=!1;return tg(t,function(o,s,l,u,h){n===!1&&r===void 0?i=o:i=e(i,o,s,l,u,h),n=!0}),i}a(b1,"segmentReduce");function rg(t,e){if(!t)throw new Error("geojson is required");Xl(t,function(r,i,n){if(r.geometry!==null){var o=r.geometry.type,s=r.geometry.coordinates;switch(o){case"LineString":if(e(r,i,n,0,0)===!1)return!1;break;case"Polygon":for(var l=0;l<s.length;l++)if(e(lt.lineString(s[l],r.properties),i,n,l)===!1)return!1;break}}})}a(rg,"lineEach");function x1(t,e,r){var i=r;return rg(t,function(n,o,s,l){o===0&&r===void 0?i=n:i=e(i,n,o,s,l)}),i}a(x1,"lineReduce");function S1(t,e){if(e=e||{},!lt.isObject(e))throw new Error("options is invalid");var r=e.featureIndex||0,i=e.multiFeatureIndex||0,n=e.geometryIndex||0,o=e.segmentIndex||0,s=e.properties,l;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),s=s||t.features[r].properties,l=t.features[r].geometry;break;case"Feature":s=s||t.properties,l=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=t;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var u=l.coordinates;switch(l.type){case"Point":case"MultiPoint":return null;case"LineString":return o<0&&(o=u.length+o-1),lt.lineString([u[o],u[o+1]],s,e);case"Polygon":return n<0&&(n=u.length+n),o<0&&(o=u[n].length+o-1),lt.lineString([u[n][o],u[n][o+1]],s,e);case"MultiLineString":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o-1),lt.lineString([u[i][o],u[i][o+1]],s,e);case"MultiPolygon":return i<0&&(i=u.length+i),n<0&&(n=u[i].length+n),o<0&&(o=u[i][n].length-o-1),lt.lineString([u[i][n][o],u[i][n][o+1]],s,e)}throw new Error("geojson is invalid")}a(S1,"findSegment");function C1(t,e){if(e=e||{},!lt.isObject(e))throw new Error("options is invalid");var r=e.featureIndex||0,i=e.multiFeatureIndex||0,n=e.geometryIndex||0,o=e.coordIndex||0,s=e.properties,l;switch(t.type){case"FeatureCollection":r<0&&(r=t.features.length+r),s=s||t.features[r].properties,l=t.features[r].geometry;break;case"Feature":s=s||t.properties,l=t.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":l=t;break;default:throw new Error("geojson is invalid")}if(l===null)return null;var u=l.coordinates;switch(l.type){case"Point":return lt.point(u,s,e);case"MultiPoint":return i<0&&(i=u.length+i),lt.point(u[i],s,e);case"LineString":return o<0&&(o=u.length+o),lt.point(u[o],s,e);case"Polygon":return n<0&&(n=u.length+n),o<0&&(o=u[n].length+o),lt.point(u[n][o],s,e);case"MultiLineString":return i<0&&(i=u.length+i),o<0&&(o=u[i].length+o),lt.point(u[i][o],s,e);case"MultiPolygon":return i<0&&(i=u.length+i),n<0&&(n=u[i].length+n),o<0&&(o=u[i][n].length-o),lt.point(u[i][n][o],s,e)}throw new Error("geojson is invalid")}a(C1,"findPoint");$e.coordAll=y1;$e.coordEach=hs;$e.coordReduce=p1;$e.featureEach=eg;$e.featureReduce=f1;$e.findPoint=C1;$e.findSegment=S1;$e.flattenEach=Xl;$e.flattenReduce=v1;$e.geomEach=Kh;$e.geomReduce=g1;$e.lineEach=rg;$e.lineReduce=x1;$e.propEach=Qy;$e.propReduce=m1;$e.segmentEach=tg;$e.segmentReduce=b1});var ig=Ar(td=>{"use strict";v();Object.defineProperty(td,"__esModule",{value:!0});var _1=Qh();function ed(t){var e=[1/0,1/0,-1/0,-1/0];return _1.coordEach(t,function(r){e[0]>r[0]&&(e[0]=r[0]),e[1]>r[1]&&(e[1]=r[1]),e[2]<r[0]&&(e[2]=r[0]),e[3]<r[1]&&(e[3]=r[1])}),e}a(ed,"bbox");ed.default=ed;td.default=ed});var lg=Ar((o4,rd)=>{v();var ur=Wy(),og=Jh(),sg=Qh(),Qn=ig().default,P1=sg.featureEach,i4=sg.coordEach,n4=og.polygon,ng=og.featureCollection;function ag(t){var e=new ur(t);return e.insert=function(r){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:Qn(r),ur.prototype.insert.call(this,r)},e.load=function(r){var i=[];return Array.isArray(r)?r.forEach(function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Qn(n),i.push(n)}):P1(r,function(n){if(n.type!=="Feature")throw new Error("invalid features");n.bbox=n.bbox?n.bbox:Qn(n),i.push(n)}),ur.prototype.load.call(this,i)},e.remove=function(r,i){if(r.type!=="Feature")throw new Error("invalid feature");return r.bbox=r.bbox?r.bbox:Qn(r),ur.prototype.remove.call(this,r,i)},e.clear=function(){return ur.prototype.clear.call(this)},e.search=function(r){var i=ur.prototype.search.call(this,this.toBBox(r));return ng(i)},e.collides=function(r){return ur.prototype.collides.call(this,this.toBBox(r))},e.all=function(){var r=ur.prototype.all.call(this);return ng(r)},e.toJSON=function(){return ur.prototype.toJSON.call(this)},e.fromJSON=function(r){return ur.prototype.fromJSON.call(this,r)},e.toBBox=function(r){var i;if(r.bbox)i=r.bbox;else if(Array.isArray(r)&&r.length===4)i=r;else if(Array.isArray(r)&&r.length===6)i=[r[0],r[1],r[3],r[4]];else if(r.type==="Feature")i=Qn(r);else if(r.type==="FeatureCollection")i=Qn(r);else throw new Error("invalid geojson");return{minX:i[0],minY:i[1],maxX:i[2],maxY:i[3]}},e}a(ag,"geojsonRbush");rd.exports=ag;rd.exports.default=ag});v();import{MapView as $1}from"@mappedin/mappedin-js";v();v();v();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:a(function(){return this},"get"),configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var bp="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBwgHBgkICAgKCgkLDhcPDg0NDhwUFREXIh4jIyEeICAlKjUtJScyKCAgLj8vMjc5PDw8JC1CRkE6RjU7PDn/2wBDAQoKCg4MDhsPDxs5JiAmOTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTn/wgARCAIABAADAREAAhEBAxEB/8QAGwABAAMBAQEBAAAAAAAAAAAAAAECAwQFBgf/xAAWAQEBAQAAAAAAAAAAAAAAAAAAAQL/2gAMAwEAAhADEAAAAP3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAIAAAJAFAAAAAAAAAAAAAAAAAAAAAAAAABAgAAEgCgAAAAAAAAAAAAAAAAAAAABERLSM1zM4zXMzjMoUIqCCSSS8XNC9mpoaVomharWTQAAAAAAAAAAAAAAAAEREtIoZrnGZkucUKFStQQSTFixdNDStF0TWrmiWqbJoAAAAAAAAAAAAAIgiWkZy4HNLzHLXKcxzpzmFYmRkUKFSCCSSxcuampsbR0HSdK9R1R1HTZvWll0mlAAAAAAAAAAAIiKLnLjHNLynLXKcycxzmNYmJmUKFSCAWLFy5qamxvHQvSdJ0nVHUdFm1aparWKAjNWSKAAAAARBEtYzlyXnjmOSuM4U4q4jjOM5a5k5zAyMjOqFCCCCSSS5c0jU1NzoOk6pew7TtjuO1e0646jezWr2WSaUAAAAAECIqtZco55eY464zhTirhOI5Dks5jAwMTIzqhUqQASWLFzSNTY3Og6V646zsO2O47V7DrjqNzWy9nlZ1c0LlrLEk0EQQVipRczIyMU5q5F4U8+vOPOrgThOOuU5jAxMjMzKpUggigJiSSxY0XQ1Njc6TqjtO49CX0D0T0Y7l7E6JdzU1NEvViSalBAWIqVKLSMjIxOauM4U86vPPOrz04TjrkOYwMTIzKJQqQQCKmBJJYutzQ1Njc6TrOyO475fRPRPQjuXsToXWPn6kkkEkhCkEAgggqVMjlrzzzDy7PMPPrhOQ5jBMqoVIIIAAIAJAAJJJLFzWN16TsO49CPTPUl9Q9A6o1LFiSSSSQpCwQQCCCpVMjlrzzyzy7PMPPrhOM5kwM6zKlQQAAQASAASCxY0NI3XpOw7j0I9M9SX0z0DqjU+UqpQqVIBFgEyixJYuWLFDkrzE8o8yvOONOasipBAAAAAAAAAAABJJY2OiO1fQPUj1T0pewuVKlCCqQsBIUSSSSWLlyTM5K808pPLrzziTnrEqQQAAAAAAAAAAASSWNjojtX0D1I9VfSOuND4uzMzqhQqVIALEli5c1jUuQc1vnp5pwJzVmQQAAAAAAAAAAAAAASSaHTHevpHoHTFjMyM6zKlSpABJJcsaGkamhU5q88804E5qzIIAAAAAAAAAAAAAAJJNDpjvX0j0Dqix8dVDMolSpAqCYElixc0XU0IMjlTlrIqAAAAAAAAAAAAAAAAAWNTqjqXYGZkZpUoQQRSFIsSXLroaGhBkcqctZFQAAAAAAAAAAAAAAAACxqdUdS7EngWQCAAQASACSSSwKlSCAAAAAAAAAAAAAAAAAACSSxYFSCCAACCQACSSSwKlSCAAAAAAAAAAAAAAAAAACSSxYGIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAJAJAJBAAIAIABAAAAAAAAAAAAAAAAAAAABIAJAJAJBAAIAIABAAAAJABAAAAAAAAAJBILEli5Y0LlzQ0Lly5csWLAkgFSChUoUMyhmUMyhQqVKkEEAEAAAAAAAAAkEgsSWLljQuXNDQuXLlyxYsCSAVIKFShQzKGZQzKFCpUqQe+ZmZkUKFCpUEEAAkksWLFzQ0NTU2NzY3Og3NzoNzc2NjU1NS5csSAQVKmZmZGRiYmBgYHOYGBgYGBiZGRkUMypUqQCAASSWLFi5oaGpqbG5sbnQbm50G5ubGxqampcuWJAIIKGZmZGRiYmBgYHOYGBgYGR+jmBzmBzmJiZGZQoQQSSWLmhqbGxudB0nSdJ1HSdR1HSdJ0G5qamhcsWJJJBIIIBUqVKFDIyMDA5jmOU5TlOY5TmOc5znMTEyMyhQggFixc0NTY2NzoOk6TpOo6TqOo6TpOg3NTU0LlixJJIJBAIKkFChQyMjAwOY5jlOU5jnP00yMTnOc5zAwMjMoVIJJLmhqbmx0HQdBubmxqXLkkgAAAAAAAAAAAAAEEFTMzMTEwOc5znMDAyMyhUgkkuaGpsbnQdB0G5ubGpcuSSAAAAAAAAAAAAAAQQVKGZ1gAEEEEFSCACSSxJJJIAAAAAAAAAAAAAAAAAAAAAAABBBBBUggAkkksSSSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQCCpBUqQVIKggAkFiSSxYksSSSSAAAAAAAAAAAAAAAAAAQCCpBUqQVIKggAkFiSSxYksSWBIAAKFiQAAAAAAAAACCpUoUMzIyMzMzMyhQoVKkEEAgkEkklixYuXNDQ0NTQ1NC5cuWJAAAAAAAAAAIKlShQzMjIzMzMzKFChUqQQQCCQSSSWLFyxoXNDQ1NDU0LljUkkAAAAAAAAAAggggEEAgAAAAAAAAAAAAAEkgkkkkkAAAAAAAAAAgggggEAgAAAAAEgEAAAAAAEkgkkuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADyyCCCCCCCCAQASCSQWJJJJLEkkkkkgkkEgkAEgAAEAAgEAggEEEEEEEFSCCCCCCAQASCSQWJJJJLEkkkkkgkkEgEgEgAAEAAgEAggEEEEEH5AQQQQVBBAIAAJBIJJJLEkkkkliSSSSSQSSCQSAAAQAQQCCCCCCCCCpBBBBBUEEEAgAAkEgkkksSSSSSWJJJJJJBJIJBIAABABBAIIIIIIIIKg/LCAQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQAQQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQfPgAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/xAApEAAABQUBAQACAwACAwAAAAABAgQFFQMGERQWEhNAUAAgMGCAkKCw/9oACAEBAAECAP8AwTZznOf3mc5/YZE41xVivFyM6i7C8C8C8zMzMzMyDyDyDyDwV4K7ldSuZV5VgVwqZ/SCca4qxXmcjOouwvAvEzMzMzMzMyDyDyDwV4K7ldSuRVwKgrgf88TDWMrO4VHOo61Hao7ndzvB3k7yZ5M8i8i8zMzMzMyDyDyDyV5K8keSPJHmm8U3em70nam603Mi8qotUDfk5GqZUdfUc6jrUdqjvUeDvB3kzyZ5M8i8i8zMzMzMzMg8g8leSvJHkjyR5pvFN4pu9N2pOtNzIvKqLWA39PX+/saplJlh1tRfVcKrlVdKrrVdqrvVdzu53Y7sZ2M6mdRdRdBdJSUk5SUB0B0B1K6kdSOxHam7Unek70nei7UXWi6UXKk40l9NaRWWuB8/75E41zKjraq+q41nOq6VXas7VXeq71Hc7ud2O7GdRdRdZQXSUlJSUlAdCugOpXUjqR2I7U3em70nek70nai60XSk5UnGkvItIrKoCsC0FwLgXAuBbube3ubm7uiuFcZcZaZYdZUWVl1dwruVdzrulZ0qulVzqOR3EzgZeZcZcK0Vm3t7W1tbW1tgrBYC0q0q4q8jgRxpuVJzoulB0oOlBzoOVBworqa0iwi0i0q4FwLQWAr2trZ2trb3RWiuFcZaZadbUW1l1ZwruVd0rulZ0qulVzqOR3E7gZeZeK4VorNzb29ra2tsFe2CwFpVxVxV5HAjjTcqTnRdKDpQdKDnQcqDhRXU1pFhVm/ISUnKSkrLSsrKyspJyUhvitOtrLq69Q4qHGu41nGqvqLjrDKhUDW+nv1nP+Oc+vYVArFUEVEWUl1FfQcU7imckzinX0VxFoLgXyMlJykrLS0tLS0rKSclI74rjraq6uvUuKhxruNdxqr6i46wysVA1vp79Zz/AI5z6A4VArFUEVkWUl1FfQcU7imcUzinX0VxFoLZKTlJWVlpaXl5eWlpWUB0BzBxkDr669SvUr666stqqz1xqes/j5AxahFFJXRWp1yZemX0F5HCQkpOUlZaWlpeXl5aWB2lQdAcwcZE7hWcFLgpXqF1ZbVVnUDU9Z/HyBi1CV6SuitTrky9MvoLyL5AXEXEXIXIXKSkpKSkpIHIHIHIrkVxK4yJnCsvrra6uqpPVE354GJVpKaCtOtoryuEiZxM5C5C5C5SUnJSclJSQOQORXIrkVxBxM4VV9dbXV1VJ6om/PAxKtFTQVp1tFeRwkRWitFYKvb2tra2draBUCsFgLCrSrQWitOsqqT1RN+jAxKtJTTWFWitMtMtFYKzb29ra2tnaBUCsFZVhVpVoLRWnWVFJ6om/RgYlWkpprAW73v36zn++c+gOFQKv1GoJv04GCp9Rq/T36zn++c+gOFT7fUagm/TgYKn1+3/AKEeMefHjx8/n8vl8vn8/Hjx5xj9bjHnx48fP5/L5fL5/Px48ecY/wAvOPxceQIFIKIJgSAiBAVuK2FaitINAM4MwMwMsJCQkJCQkJCwosws4tAtItQtgtot4oRSCm+Hy8ecfi48gQKQUQTAkBECArcVsK1FaQaAZwZgZgZYSEhISEhISFhRZhZxaBaRahbBbRbxQikFN8BpfMWgWozWLaLcKAUWpq62vr/DX19YEoJARAhBvK2laytRGgjORlIyEYiMJLfJbxLdJbhLbJbRLaJbJbZLbAWxzHMcxzHMcxzHMDbBrYNbJraNbRrbPbh7dPbx7fOwHYjsZ2UzMZoM0maxbRbhQCi1NXW19fX19fW1QSAiBCDeVtK1laiNBGYjKRkIxEYSW+S3iW6S3CW2S2iW0S2S2yW2AtgLY5jmOY5jmOY5gbYNbJrZNbRraPbZ7cPbp7ePb52A7EdjOymZjW4e3D26e3j2+ZgMwmYhYxY4SEhISEBjKxlYiMJGAjAS3iW9TtynblO26dtUrap2zTtmnbNO2SW2S3isRWYGkG0EAItTW1/h8Phr6+rp6AtwtQs5mI9vntw9tHtk9s1LZqWzUto9tnts9uHt09vHt8zAZhMxCxixwkJCQkIDGVjKxEYSMBGAlvEt6nblO3Kdt0rap21TtmnbNO2SWyS2yW8ViKzA1A2ggBFqa2v8Ph8NfW1dPRFuFqMzGYjW+e3D20e2T2zUtk9tHto1tCzHYj2+e3T24e3D24a3DW4Nuc5znOc4FuBbhbcLbhLcJblO3CW4S3iMRGcrYVECcKYB+cJBoCjM2maDsZ7fPbp7cPbh7cNbhrcG3Oc5znOcC3C24W3C24S3CW5TtwluEt4jERnK2FRAnCmAfnCQaAoxb/7ePl8NbU09PT1NYKHy8Y/ZePl8NbU09PT1NYKHy8Y/4Z6+g1tjb3d+Rk5SVlZWVlZSTkd8Fu3s/b6es/pvX0Gtsbe7vyMnKSkrKysrKSciC8Fu3s/YKnrP9gqAb8X0NQawqBVCrMrMqMoGuNUTiYf4ICT5/L4/H4fD4fH4hSCmBAAP4AgctUtYqgqoqsqsqoFIVwqAb8X0NQawqBVCrMrMqMoGuNUTiYf4ICT5/L4/H4fD4fH4hSCmBAAP4AgctUtYqgqkqsqsqsFIV/Hn8XHj5/H4a+traurq6mpqampqampqampqampqampqampqamrq62tr/D4/Lx5/Fx4+fx+Gvra2rq6upqampqampqamrq6upqampqampqamrq6utra/w+Py/wCgEzNTc5OTs7PT09PT8/Pz09PT07Ozk3Ng9TMxLy0rKSclJSMhIb+9vbu9u7u7u7u7u729vb2/vyEjJSUnKSstLzEzNTc5OTs7Oz09PT8/Pz09PT07Ozk5NzUzMS8tKyknJSUjISG/v727vbu7u7u7u7u9u729v78hIyUlJykrLS8x0nR9H0fR9H0XRdF0XRdD0PQ9F0XRdF0XRdF0fR9H0nSdJ0vS9L0vTdN03TdP0/T9P0/T9P0/T9P0/T9R0/T9P0/T9P0/TdN03S9L0vS9J0nSdJ0fR9H0XRdF0PRdD0PQ9D0PRdF0XRdF0XR9H0fSdJ0nS9L0vS9N03TdN0/T9P0/T9P0/T9P0/T9P1HT9P0/T9P0/T9N03TdL0vS9L0vSS8tLy0tLS0rKysrKysrKysrKystLS0vLS8vLy8vMTExMTExMzMzMTMzMzM1NTUzMzMzMzMzMzExMTExMS8vLy8vLy8tKy0tKysrKysrKysrKysrLS0tLy0vLy8vLzExMTExMTMzMzEzMzMzNTU1MzMzMzMzMzMxMTExMTEvLy8vnOc5znOc5znOc5znOc5znOc59ZznPr169evXr169evXr169evXr16znOfWc5znOc5znOc5znOc5znOc5znOc59ZznPr169evXr169evXr169evXr16znOfWc5z/9YD//xAArEAEAAgIDAQABBAICAQUAAAAAAVICYgNRYQRBEEBQUzFCIDARYICQoLD/2gAIAQEAAz8A/wDgmhCEI/nYQj+RhjH5ccflxw44YMe0dtmzZs2bNmzZs2bIsjtiwlxy45/Ljn8se0fwuPbjj8uOPy44YQxR2izZs2bNmzZs2bNkWR2xYS45cc/lhP5Y9/wEQwj8sIRD1s2bNmzZs2bNmzZs2bNmzZs2bNmzZs2bNmyLMZYZMZ/KJ/dRDCPywhjCI/LZs2bNmzZs2bNmzZs2bNmzZs2bNmzZs2bNkWYywlhP5RP/ABj9hDGGMIh69bNmzZs2bNmzZsmybJsmybJsmybJsmybJsmybJs2bNmzZs2bNmzZ7+mMsZYyj9hDGGMIj9NmzZs2bNmzZs2bJsmybJsmybJs2TZNk2TZNk2bJs2bNmzZs2bNmzZ6iWMsXr16hiwYMGDBgwYo/T169/T162bNmzZs2TZNk2T2ntPae09pSlKUpSlPae09p7T2mybJsmzZs2bNmz17+nr16hiwYOPtx9uPtx9sO2DBih69evXr1s2bNmzZsmybJsmye09p7T2lKUpSlKU9p7T2ntNk2TZNmzZs2bNmz17+vr1s2bNmzZs2bNmzZs2evXr169bNmye09p7SlKUp/wC6UpSlKe09p7etmzZs9evWzZs2bNmzZs2bNmzZs2bPXr1s9bNmye09p7SlKUp/7pSlKUp7T29bPWz169evWzZs2bNmzZs2bNmzZs2bNmzZs2evU9plM/vJhMJ7T29bNnrZ62bNmzZs2bNmzZs2bNmzZs2bNnr39J7TKZ/eTCYT3+nr162bNnrZs2bJsntNk2TZPabNmzZs2etnr39JlM/wUwmP09etmzZs2bNk2TZNk2TZNk2bNmzZs2bNnv6TKZ/gphMfp69etk9p7T2ntKUpSlKUp7T2nt69e/pMpn+GmH/j9PXr1Pae09pSySlklKU9p7T29evf0mUz/DTCY/T16lP/AHSlKU/xUpSlP/dKUpT/ABUpT/8AQllKWTJl0y6ZdMumXTLpl0y6ZJSn+QlKWTJl0y6ZdMumXTLpl0y6ZJSn/sn9xKWXTLpn0z6Z9M+mXTLplVlVlVlVlVlVlVlVlVlVlRlVlVlRlVlVlVlVlVlVlVl0z6Z9M4/DPpn0z6ZdMkp/byll0y6Z9M+mfTPpn0y6ZVZVZVZVZVZVZVZVZUZVZUZVZVZVZVZVZVZVZVZVZVZdM+mfTOPwz6Z9M+mTJlVlVlVl0yZ9M2fTPpn0z6Z9M+mbPpn0z6Z9M2fTPpl0yqyqyqyqyqyomiaJomiaJomiaJomjRo0aNGjRo0aNGjRNE0TRNE0TRNE0TRNE0ZVZVZVZVZVZVZM+mbPpn0z6Z9M+mfTNn0z6Z9M+mfTPpl0y6ZVZVZVTVlVlRNE0TRlRNE0TRNE0TRo0aNGjRo0aNGjRomiaJomiaJomiaJomqaJqyq0TRNE0TRNE0TVNE1TVNU1TRNE1TVNU0TRNE0TRNGjRo0aNGjRhWHFHTgh88Pmj8Pnj/V89HBRwf1w4f64cNMXFSHFTFxUxcVIcP9cOGkOCkPno+ej55/D55cEuKemHUIo0aNGjRo0TRNE0TRNE0TVNE0TVNE1TVNE1TRNU0TRNE0TRNGjRo0aNGjRhWHFHThh88Pnj8Pnq+ejgo4P64cP9cOKkOKkOKmLipi4aYuH+uHBSHBSHz0fPR88/h88uCXFNWHUIo0aNGjRo4ZcU9MOoRRFGjRo0aNGjRo0aNGjRo0RRhVxR04IcGP4cGP+jij/GEMI/xjCP3+M/5xhxT/AJwhwT/o4Mv9XBk4p6YdQiiKNGjRo0aNGjRo0aNGjRoijGsOKOnBi4Mfw4I/0cUf4whhH+MYR+/xn/OMOKf84Q4J/wBHBP8Ar/zxrDCsOKkOKjhq4auGrhq4auGjipDjpDGsI/k8awwrDipDio4aOGrhq4auGrho4qQ46QxrCP8A0bHcMLQ47w4rw4buCzgs4O3A4HA4XA4HA4HA4O3BZwWcN3Fdx3hhaGNoR/Dx3DC0OO8OK8OG7gs4LODtwOBwOFwOBwOBwODtwWcFnDdxXcd4YWhjaEf88UftoQh4y6ZuRyuVzOZzeudz+uf1z+uf1z+uf1z+uf1zuf1z+uf1z+uf1z+udzR25nM5o7c3rlcrlZsniOkSj9tCEPGXTNyuVy+uZzOb1z+uf1z+uf1z+uf1z+uf1z+udz+uf1z+uf1z+uf1z+ueO3O5nM5vXK5XKzZPEdMUftoYsemHTDpx9OPpxVcVXDVw1cNXDVw0cNHDRw0cNHDRw0cNHDRw0cNHDRw0cNHDRw0cNHDVw1cNXFVxVcVXFVx9OPph0w6Yo/bQxY9MOnH04+nH04quKrhq4auGrhq4aOGjho4aOGjho4aOGkOGkOGkOGjho4aOGjho4aOGjhq4auGriq4quKriq4+nH0w6Ydf+wHgcLhcLicTjYdww7hh3DDuGPcMe4Y9ww7hh3DDuGHcONxuJxOFwuBwOB8753z2fPZ89nz3fNd893zXfPd893z3fP/Y+e757uC75/wCyHz/2Q+f+yHBd893z3fPd893z3fPd893zXfNd893z2fPZ8/b5+3zvncDgcLhcLicTjYdww7hh3DDuGHcMe4Ydww7hh3DDuGHcONxuJxOFwuBwPnfO+d89nz2fPZ893zXfPd813z3fPd893z/2Pnu+e7gu+f8Ash8/9kPn/shwXcF3z3fPd893z3fPd893zXfNd893z2fPZ8/b5+3zvncDdu3bt03bt26bpum6bpum6bt27du3bt26bt26bpum6bpum6bpum6bt03TdN26bpum6bpum7dN03TdN03TdN03TdN03Tdum7dum7dN27dum6bpum6bpum6bpum7du3bt03bpu3bpum6bpum6bpum6bpu3TdN03bpum6bpum6bt03TdN03TdN03TdN03TdN03TduysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysmzKzKzKybMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrJT+2lKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpSn9tKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpT/wDrA//EAB0RAAMBAAMBAQEAAAAAAAAAAAABERIwQFAgkMD/2gAIAQIBAT8A/COlKioqKioqKi+zSoqKioqL59Ro0aKyvpVlZWaNFXiVGkaNFZWV9CsrNGjRpFXepo0V8c69Zo0u1pGilfVnJWaNF+NFXNUaNFfmU0aReamkaNPzNM19VlZWaKysrK/XrKzTNGjRWaKyv+u0/8QAHREBAQACAQUAAAAAAAAAAAAAEQBAUCAQITCQwP/aAAgBAwEBPwD1NkRER07eYiIiNMRERGARERGgIiNAREZRERoCIjiYBERqiIwiI1REcCIiIiIjbkREREREfXZ//9k=";v();v();var Ug=!1;function xp(){return Ug}a(xp,"isTestMode");var bc=class bc{constructor(e){p(this,"backgroundAlpha",1);p(this,"backgroundColor",new Ee);p(this,"width",0);p(this,"height",0);p(this,"options",{});p(this,"renderer");p(this,"enabledLayers",new Set([0,1]));p(this,"handleWebGLContextCreationError",a(e=>{var r,i;(i=(r=this.options).onWebGLContextCreationError)==null||i.call(r,e)},"handleWebGLContextCreationError"));p(this,"handleWebGLContextLost",a(e=>{var r,i;(i=(r=this.options).onWebGLContextLost)==null||i.call(r,e)},"handleWebGLContextLost"));p(this,"handleWebGLContextRestored",a(e=>{var r,i;(i=(r=this.options).onWebGLContextRestored)==null||i.call(r,e)},"handleWebGLContextRestored"));var r,i,n,o,s;try{this.options=e,xp()?(this.renderer={setSize:a(()=>{},"setSize"),state:{reset:a(()=>{},"reset")},properties:{get:a(()=>{},"get")},getSize:a(()=>({width:window.innerWidth,height:innerHeight}),"getSize"),getDrawingBufferSize:a(()=>({width:window.innerWidth,height:innerHeight}),"getDrawingBufferSize"),getClearAlpha:a(()=>1,"getClearAlpha"),getClearColor:a(()=>new Ee,"getClearColor"),autoUpdate:!0,shadowMap:{autoUpdate:!0},getContext:a(()=>({getContextAttributes(){return{alpha:!0,antialias:!1,depth:!0,stencil:!1}}}),"getContext"),readRenderTargetPixelsAsync:a(()=>Promise.resolve([]),"readRenderTargetPixelsAsync"),setRenderTarget:a(()=>{},"setRenderTarget"),setClearColor:a(()=>{},"setClearColor"),clear:a(()=>{},"clear"),render:a(()=>{},"render"),clearStencil:a(()=>{},"clearStencil"),clearDepth:a(()=>{},"clearDepth"),domElement:document.createElement("canvas"),capabilities:{isWebGL2:!0}},this.renderer.domElement.style.width="1920px",Object.defineProperty(this.renderer.domElement,"clientWidth",{value:1920}),this.renderer.domElement.style.height="1080px",Object.defineProperty(this.renderer.domElement,"clientHeight",{value:1080})):this.renderer=new jd({canvas:e.canvas,alpha:e.alpha||!1,stencil:!0,antialias:typeof e.antialias=="boolean"?e.antialias:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.backgroundColor=new Ee((r=e.backgroundColor)!=null?r:"#ffffff"),this.backgroundAlpha=(i=e.backgroundAlpha)!=null?i:1}catch(l){te.error(l),e.onWebGLRendererError&&e.onWebGLRendererError(l)}(n=this.domElement())==null||n.addEventListener("webglcontextlost",this.handleWebGLContextLost),(o=this.domElement())==null||o.addEventListener("webglcontextrestored",this.handleWebGLContextRestored),(s=this.domElement())==null||s.addEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}destroy(){var e,r,i,n,o;this.renderer&&((r=(e=this.renderer).dispose)==null||r.call(e)),(i=this.domElement())==null||i.removeEventListener("webglcontextlost",this.handleWebGLContextLost),(n=this.domElement())==null||n.removeEventListener("webglcontextrestored",this.handleWebGLContextRestored),(o=this.domElement())==null||o.removeEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}render(e,r){if(this.renderer){this.renderer.state.reset(),r.layers.disableAll();for(let i of this.enabledLayers.values())r.layers.enable(i);this.renderer.clearStencil(),this.renderer.autoClear=!1,this.renderer.setRenderTarget(null),this.renderer.render(e,r),this.renderer.clearDepth(),r.layers.disableAll(),r.layers.enable(Ks.ALWAYS_ON_TOP),this.renderer.render(e,r),this.renderer.state.reset()}}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(e,r){E.env.NODE_ENV==="test"||!this.renderer||(this.width=e,this.height=r,this.renderer.setSize(e,r,!1))}setBackgroundColor(e,r){this.backgroundColor=e,this.backgroundAlpha=r}domElement(){var e;return(e=this.renderer)==null?void 0:e.domElement}};a(bc,"Renderer");var na=bc;v();v();var Sp='"use strict";(()=>{var He=Object.defineProperty,bt=Object.defineProperties;var kt=Object.getOwnPropertyDescriptors;var Ge=Object.getOwnPropertySymbols;var wt=Object.prototype.hasOwnProperty,Tt=Object.prototype.propertyIsEnumerable;var Fe=(r,e,t)=>e in r?He(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,c=(r,e)=>{for(var t in e||(e={}))wt.call(e,t)&&Fe(r,t,e[t]);if(Ge)for(var t of Ge(e))Tt.call(e,t)&&Fe(r,t,e[t]);return r},y=(r,e)=>bt(r,kt(e));var Rt=(r,e)=>{for(var t in e)He(r,t,{get:e[t],enumerable:!0})};var C=(r,e,t)=>Fe(r,typeof e!="symbol"?e+"":e,t);function et(r,e){return e.x+e.w<r.x+r.w&&e.x>r.x&&e.y>r.y&&e.y+e.h<r.y+r.h}function tt(r,e){let[t,s]=e;return t>=r.x&&t<=r.x+r.w&&s>=r.y&&s<=r.y+r.h}function rt(r,e){let t=e.x,s=e.y,n=e.x+e.w,a=e.y+e.h,o=r.x,i=r.y,u=r.x+r.w,l=r.y+r.h;return t<u&&o<n&&s<l&&i<a}function V(r,e){for(let t=0;t<e.length;t++)r.push(e[t])}var w=class{constructor(e,t,s,n,a){C(this,"x");C(this,"y");C(this,"w");C(this,"h");C(this,"userData");this.userData=typeof a>"u"?null:a,this.x=e,this.y=t,this.w=s,this.h=n}contains(e){return e===this?!1:et(this,e)}intersects(e){return rt(this,e)}intersectsPoint(e){return tt(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};var Ae=class r{constructor(e,t){C(this,"topLeft");C(this,"topRight");C(this,"bottomLeft");C(this,"bottomRight");C(this,"divided",!1);C(this,"boundary");C(this,"capacity",16);C(this,"objects",[]);C(this,"parent");this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:s,h:n}=this.boundary;this.topLeft=new r(new w(e,t,s/2,n/2),this),this.topRight=new r(new w(e+s/2,t,s/2,n/2),this),this.bottomLeft=new r(new w(e,t+n/2,s/2,n/2),this),this.bottomRight=new r(new w(e+s/2,t+n/2,s/2,n/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&(V(t,this.topLeft.queryRect(e)),V(t,this.topRight.queryRect(e)),V(t,this.bottomLeft.queryRect(e)),V(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&(V(t,this.topLeft.queryPoint(e)),V(t,this.topRight.queryPoint(e)),V(t,this.bottomLeft.queryPoint(e)),V(t,this.bottomRight.queryPoint(e))),t}insert(e){return(this.parent?!this.boundary.contains(e):!this.boundary.intersects(e))?!1:this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0)}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var we={};Rt(we,{BRAND:()=>Kt,DIRTY:()=>K,EMPTY_PATH:()=>Ot,INVALID:()=>m,NEVER:()=>Pr,OK:()=>S,ParseStatus:()=>R,Schema:()=>x,ZodAny:()=>q,ZodArray:()=>F,ZodBigInt:()=>H,ZodBoolean:()=>ee,ZodBranded:()=>Ie,ZodCatch:()=>le,ZodDate:()=>te,ZodDefault:()=>ue,ZodDiscriminatedUnion:()=>Pe,ZodEffects:()=>M,ZodEnum:()=>ce,ZodError:()=>A,ZodFirstPartyTypeKind:()=>g,ZodFunction:()=>$e,ZodIntersection:()=>ae,ZodIssueCode:()=>d,ZodLazy:()=>ie,ZodLiteral:()=>oe,ZodMap:()=>xe,ZodNaN:()=>ke,ZodNativeEnum:()=>de,ZodNever:()=>P,ZodNull:()=>se,ZodNullable:()=>L,ZodNumber:()=>G,ZodObject:()=>O,ZodOptional:()=>j,ZodParsedType:()=>h,ZodPipeline:()=>Ne,ZodPromise:()=>Y,ZodReadonly:()=>fe,ZodRecord:()=>Ze,ZodSchema:()=>x,ZodSet:()=>be,ZodString:()=>W,ZodSymbol:()=>_e,ZodTransformer:()=>M,ZodTuple:()=>$,ZodType:()=>x,ZodUndefined:()=>re,ZodUnion:()=>ne,ZodUnknown:()=>B,ZodVoid:()=>ve,addIssueToContext:()=>f,any:()=>ir,array:()=>ur,bigint:()=>tr,boolean:()=>ht,coerce:()=>Mr,custom:()=>ut,date:()=>rr,datetimeRegex:()=>ct,defaultErrorMap:()=>D,discriminatedUnion:()=>pr,effect:()=>Cr,enum:()=>wr,function:()=>xr,getErrorMap:()=>me,getParsedType:()=>Z,instanceof:()=>Ht,intersection:()=>mr,isAborted:()=>Ee,isAsync:()=>ye,isDirty:()=>Me,isValid:()=>U,late:()=>Gt,lazy:()=>br,literal:()=>kr,makeIssue:()=>Oe,map:()=>_r,nan:()=>er,nativeEnum:()=>Tr,never:()=>cr,null:()=>ar,nullable:()=>Ar,number:()=>ft,object:()=>lr,objectUtil:()=>Ue,oboolean:()=>Er,onumber:()=>jr,optional:()=>Sr,ostring:()=>Nr,pipeline:()=>Ir,preprocess:()=>Or,promise:()=>Rr,quotelessJson:()=>Ct,record:()=>gr,set:()=>vr,setErrorMap:()=>At,strictObject:()=>fr,string:()=>lt,symbol:()=>sr,transformer:()=>Cr,tuple:()=>yr,undefined:()=>nr,union:()=>hr,unknown:()=>or,util:()=>b,void:()=>dr});var b;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let o of n)a[o]=o;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),o={};for(let i of a)o[i]=n[i];return r.objectValues(o)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&a.push(o);return a},r.find=(n,a)=>{for(let o of n)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(o=>typeof o=="string"?"\'".concat(o,"\'"):o).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(b||(b={}));var Ue;(function(r){r.mergeShapes=(e,t)=>c(c({},e),t)})(Ue||(Ue={}));var h=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Z=r=>{switch(typeof r){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN(r)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(r)?h.array:r===null?h.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?h.promise:typeof Map<"u"&&r instanceof Map?h.map:typeof Set<"u"&&r instanceof Set?h.set:typeof Date<"u"&&r instanceof Date?h.date:h.object;default:return h.unknown}};var d=b.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ct=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),A=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let i=s,u=0;for(;u<o.path.length;){let l=o.path[u];u===o.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(t(o))):i[l]=i[l]||{_errors:[]},i=i[l],u++}}};return n(this),s}static assert(e){if(!(e instanceof r))throw new Error("Not a ZodError: ".concat(e))}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};A.create=r=>new A(r);var St=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===h.undefined?t="Required":t="Expected ".concat(r.expected,", received ").concat(r.received);break;case d.invalid_literal:t="Invalid literal value, expected ".concat(JSON.stringify(r.expected,b.jsonStringifyReplacer));break;case d.unrecognized_keys:t="Unrecognized key(s) in object: ".concat(b.joinValues(r.keys,", "));break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t="Invalid discriminator value. Expected ".concat(b.joinValues(r.options));break;case d.invalid_enum_value:t="Invalid enum value. Expected ".concat(b.joinValues(r.options),", received \'").concat(r.received,"\'");break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=\'Invalid input: must include "\'.concat(r.validation.includes,\'"\'),typeof r.validation.position=="number"&&(t="".concat(t," at one or more positions greater than or equal to ").concat(r.validation.position))):"startsWith"in r.validation?t=\'Invalid input: must start with "\'.concat(r.validation.startsWith,\'"\'):"endsWith"in r.validation?t=\'Invalid input: must end with "\'.concat(r.validation.endsWith,\'"\'):b.assertNever(r.validation):r.validation!=="regex"?t="Invalid ".concat(r.validation):t="Invalid";break;case d.too_small:r.type==="array"?t="Array must contain ".concat(r.exact?"exactly":r.inclusive?"at least":"more than"," ").concat(r.minimum," element(s)"):r.type==="string"?t="String must contain ".concat(r.exact?"exactly":r.inclusive?"at least":"over"," ").concat(r.minimum," character(s)"):r.type==="number"?t="Number must be ".concat(r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than ").concat(r.minimum):r.type==="date"?t="Date must be ".concat(r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than ").concat(new Date(Number(r.minimum))):t="Invalid input";break;case d.too_big:r.type==="array"?t="Array must contain ".concat(r.exact?"exactly":r.inclusive?"at most":"less than"," ").concat(r.maximum," element(s)"):r.type==="string"?t="String must contain ".concat(r.exact?"exactly":r.inclusive?"at most":"under"," ").concat(r.maximum," character(s)"):r.type==="number"?t="Number must be ".concat(r.exact?"exactly":r.inclusive?"less than or equal to":"less than"," ").concat(r.maximum):r.type==="bigint"?t="BigInt must be ".concat(r.exact?"exactly":r.inclusive?"less than or equal to":"less than"," ").concat(r.maximum):r.type==="date"?t="Date must be ".concat(r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"," ").concat(new Date(Number(r.maximum))):t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t="Number must be a multiple of ".concat(r.multipleOf);break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(r)}return{message:t}},D=St;var st=D;function At(r){st=r}function me(){return st}var Oe=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],o=y(c({},n),{path:a});if(n.message!==void 0)return y(c({},n),{path:a,message:n.message});let i="",u=s.filter(l=>!!l).slice().reverse();for(let l of u)i=l(o,{data:e,defaultError:i}).message;return y(c({},n),{path:a,message:i})},Ot=[];function f(r,e){let t=me(),s=Oe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===D?void 0:D].filter(n=>!!n)});r.common.issues.push(s)}var R=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,o=await n.value;s.push({key:a,value:o})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:o}=n;if(a.status==="aborted"||o.status==="aborted")return m;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[a.value]=o.value)}return{status:e.value,value:s}}},m=Object.freeze({status:"aborted"}),K=r=>({status:"dirty",value:r}),S=r=>({status:"valid",value:r}),Ee=r=>r.status==="aborted",Me=r=>r.status==="dirty",U=r=>r.status==="valid",ye=r=>typeof Promise<"u"&&r instanceof Promise;var p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));var E=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},nt=(r,e)=>{if(U(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new A(r.common.issues);return this._error=t,this._error}}};function v(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(\'Can\\\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.\');return e?{errorMap:e,description:n}:{errorMap:(o,i)=>{var l,_;let{message:u}=r;return o.code==="invalid_enum_value"?{message:u!=null?u:i.defaultError}:typeof i.data>"u"?{message:(l=u!=null?u:s)!=null?l:i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:(_=u!=null?u:t)!=null?_:i.defaultError}},description:n}}var x=class{get description(){return this._def.description}_getType(e){return Z(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:Z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ye(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var a;let s={common:{issues:[],async:(a=t==null?void 0:t.async)!=null?a:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)},n=this._parseSync({data:e,path:s.path,parent:s});return nt(s,n)}"~validate"(e){var s,n;let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:t});return U(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(n=(s=a==null?void 0:a.message)==null?void 0:s.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>U(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(ye(n)?n:Promise.resolve(n));return nt(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let o=e(n),i=()=>a.addIssue(c({code:d.custom},s(n)));return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new M({schema:this,typeName:g.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return j.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return F.create(this)}promise(){return Y.create(this,this._def)}or(e){return ne.create([this,e],this._def)}and(e){return ae.create(this,e,this._def)}transform(e){return new M(y(c({},v(this._def)),{schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){let t=typeof e=="function"?e:()=>e;return new ue(y(c({},v(this._def)),{innerType:this,defaultValue:t,typeName:g.ZodDefault}))}brand(){return new Ie(c({typeName:g.ZodBranded,type:this},v(this._def)))}catch(e){let t=typeof e=="function"?e:()=>e;return new le(y(c({},v(this._def)),{innerType:this,catchValue:t,typeName:g.ZodCatch}))}describe(e){let t=this.constructor;return new t(y(c({},this._def),{description:e}))}pipe(e){return Ne.create(this,e)}readonly(){return fe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},It=/^c[^\\s-]{8,}$/i,Nt=/^[0-9a-z]+$/,jt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Et=/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i,Mt=/^[a-z0-9_-]{21}$/i,Pt=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,Zt=/^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/,$t=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,Lt="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$",We,Vt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Dt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,zt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Bt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Ft=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Ut=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,it="((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))",Wt=new RegExp("^".concat(it,"$"));function ot(r){let e="[0-5]\\\\d";r.precision?e="".concat(e,"\\\\.\\\\d{").concat(r.precision,"}"):r.precision==null&&(e="".concat(e,"(\\\\.\\\\d+)?"));let t=r.precision?"+":"?";return"([01]\\\\d|2[0-3]):[0-5]\\\\d(:".concat(e,")").concat(t)}function qt(r){return new RegExp("^".concat(ot(r),"$"))}function ct(r){let e="".concat(it,"T").concat(ot(r)),t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\\\d{2}:?\\\\d{2})"),e="".concat(e,"(").concat(t.join("|"),")"),new RegExp("^".concat(e,"$"))}function Yt(r,e){return!!((e==="v4"||!e)&&Vt.test(r)||(e==="v6"||!e)&&zt.test(r))}function Xt(r,e){if(!Pt.test(r))return!1;try{let[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch(t){return!1}}function Jt(r,e){return!!((e==="v4"||!e)&&Dt.test(r)||(e==="v6"||!e)&&Bt.test(r))}var W=class r extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:h.string,received:a.parsedType}),m}let s=new R,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(n=this._getOrReturnCtx(e,n),o?f(n,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&f(n,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")$t.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"email",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")We||(We=new RegExp(Lt,"u")),We.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"emoji",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Et.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"uuid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")Mt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"nanoid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")It.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cuid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Nt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cuid2",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")jt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"ulid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch(o){n=this._getOrReturnCtx(e,n),f(n,{validation:"url",code:d.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"regex",code:d.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?ct(a).test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Wt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?qt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Zt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"duration",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Yt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"ip",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Xt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"jwt",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Jt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cidr",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?Ft.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"base64",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Ut.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"base64url",code:d.invalid_string,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),c({validation:t,code:d.invalid_string},p.errToObj(s)))}_addCheck(e){return new r(y(c({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(c({kind:"email"},p.errToObj(e)))}url(e){return this._addCheck(c({kind:"url"},p.errToObj(e)))}emoji(e){return this._addCheck(c({kind:"emoji"},p.errToObj(e)))}uuid(e){return this._addCheck(c({kind:"uuid"},p.errToObj(e)))}nanoid(e){return this._addCheck(c({kind:"nanoid"},p.errToObj(e)))}cuid(e){return this._addCheck(c({kind:"cuid"},p.errToObj(e)))}cuid2(e){return this._addCheck(c({kind:"cuid2"},p.errToObj(e)))}ulid(e){return this._addCheck(c({kind:"ulid"},p.errToObj(e)))}base64(e){return this._addCheck(c({kind:"base64"},p.errToObj(e)))}base64url(e){return this._addCheck(c({kind:"base64url"},p.errToObj(e)))}jwt(e){return this._addCheck(c({kind:"jwt"},p.errToObj(e)))}ip(e){return this._addCheck(c({kind:"ip"},p.errToObj(e)))}cidr(e){return this._addCheck(c({kind:"cidr"},p.errToObj(e)))}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(c({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!=null?t:!1,local:(s=e==null?void 0:e.local)!=null?s:!1},p.errToObj(e==null?void 0:e.message)))}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck(c({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision},p.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(c({kind:"duration"},p.errToObj(e)))}regex(e,t){return this._addCheck(c({kind:"regex",regex:e},p.errToObj(t)))}includes(e,t){return this._addCheck(c({kind:"includes",value:e,position:t==null?void 0:t.position},p.errToObj(t==null?void 0:t.message)))}startsWith(e,t){return this._addCheck(c({kind:"startsWith",value:e},p.errToObj(t)))}endsWith(e,t){return this._addCheck(c({kind:"endsWith",value:e},p.errToObj(t)))}min(e,t){return this._addCheck(c({kind:"min",value:e},p.errToObj(t)))}max(e,t){return this._addCheck(c({kind:"max",value:e},p.errToObj(t)))}length(e,t){return this._addCheck(c({kind:"length",value:e},p.errToObj(t)))}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};W.create=r=>{var e;return new W(c({checks:[],typeName:g.ZodString,coerce:(e=r==null?void 0:r.coerce)!=null?e:!1},v(r)))};function Qt(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return a%o/10**n}var G=class r extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.number){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:h.number,received:a.parsedType}),m}let s,n=new R;for(let a of this._def.checks)a.kind==="int"?b.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Qt(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.not_finite,message:a.message}),n.dirty()):b.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]}))}_addCheck(e){return new r(y(c({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};G.create=r=>new G(c({checks:[],typeName:g.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1},v(r)));var H=class r extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(a){return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let s,n=new R;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):b.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:h.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]}))}_addCheck(e){return new r(y(c({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};H.create=r=>{var e;return new H(c({checks:[],typeName:g.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!=null?e:!1},v(r)))};var ee=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.boolean,received:s.parsedType}),m}return S(e.data)}};ee.create=r=>new ee(c({typeName:g.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1},v(r)));var te=class r extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:h.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_date}),m}let s=new R,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):b.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r(y(c({},this._def),{checks:[...this._def.checks,e]}))}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};te.create=r=>new te(c({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:g.ZodDate},v(r)));var _e=class extends x{_parse(e){if(this._getType(e)!==h.symbol){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.symbol,received:s.parsedType}),m}return S(e.data)}};_e.create=r=>new _e(c({typeName:g.ZodSymbol},v(r)));var re=class extends x{_parse(e){if(this._getType(e)!==h.undefined){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.undefined,received:s.parsedType}),m}return S(e.data)}};re.create=r=>new re(c({typeName:g.ZodUndefined},v(r)));var se=class extends x{_parse(e){if(this._getType(e)!==h.null){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.null,received:s.parsedType}),m}return S(e.data)}};se.create=r=>new se(c({typeName:g.ZodNull},v(r)));var q=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return S(e.data)}};q.create=r=>new q(c({typeName:g.ZodAny},v(r)));var B=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return S(e.data)}};B.create=r=>new B(c({typeName:g.ZodUnknown},v(r)));var P=class extends x{_parse(e){let t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:h.never,received:t.parsedType}),m}};P.create=r=>new P(c({typeName:g.ZodNever},v(r)));var ve=class extends x{_parse(e){if(this._getType(e)!==h.undefined){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.void,received:s.parsedType}),m}return S(e.data)}};ve.create=r=>new ve(c({typeName:g.ZodVoid},v(r)));var F=class r extends x{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==h.array)return f(t,{code:d.invalid_type,expected:h.array,received:t.parsedType}),m;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(o||i)&&(f(t,{code:o?d.too_big:d.too_small,minimum:i?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(f(t,{code:d.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(f(t,{code:d.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,i)=>n.type._parseAsync(new E(t,o,t.path,i)))).then(o=>R.mergeArray(s,o));let a=[...t.data].map((o,i)=>n.type._parseSync(new E(t,o,t.path,i)));return R.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r(y(c({},this._def),{minLength:{value:e,message:p.toString(t)}}))}max(e,t){return new r(y(c({},this._def),{maxLength:{value:e,message:p.toString(t)}}))}length(e,t){return new r(y(c({},this._def),{exactLength:{value:e,message:p.toString(t)}}))}nonempty(e){return this.min(1,e)}};F.create=(r,e)=>new F(c({type:r,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray},v(e)));function ge(r){if(r instanceof O){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=j.create(ge(s))}return new O(y(c({},r._def),{shape:()=>e}))}else return r instanceof F?new F(y(c({},r._def),{type:ge(r.element)})):r instanceof j?j.create(ge(r.unwrap())):r instanceof L?L.create(ge(r.unwrap())):r instanceof $?$.create(r.items.map(e=>ge(e))):r}var O=class r extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==h.object){let l=this._getOrReturnCtx(e);return f(l,{code:d.invalid_type,expected:h.object,received:l.parsedType}),m}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof P&&this._def.unknownKeys==="strip"))for(let l in n.data)o.includes(l)||i.push(l);let u=[];for(let l of o){let _=a[l],T=n.data[l];u.push({key:{status:"valid",value:l},value:_._parse(new E(n,T,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof P){let l=this._def.unknownKeys;if(l==="passthrough")for(let _ of i)u.push({key:{status:"valid",value:_},value:{status:"valid",value:n.data[_]}});else if(l==="strict")i.length>0&&(f(n,{code:d.unrecognized_keys,keys:i}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let _ of i){let T=n.data[_];u.push({key:{status:"valid",value:_},value:l._parse(new E(n,T,n.path,_)),alwaysSet:_ in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let _ of u){let T=await _.key,he=await _.value;l.push({key:T,value:he,alwaysSet:_.alwaysSet})}return l}).then(l=>R.mergeObjectSync(s,l)):R.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new r(c(y(c({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(t,s)=>{var a,o,i,u;let n=(i=(o=(a=this._def).errorMap)==null?void 0:o.call(a,t,s).message)!=null?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(u=p.errToObj(e).message)!=null?u:n}:{message:n}}}:{}))}strip(){return new r(y(c({},this._def),{unknownKeys:"strip"}))}passthrough(){return new r(y(c({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new r(y(c({},this._def),{shape:()=>c(c({},this._def.shape()),e)}))}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>c(c({},this._def.shape()),e._def.shape()),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r(y(c({},this._def),{catchall:e}))}pick(e){let t={};for(let s of b.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r(y(c({},this._def),{shape:()=>t}))}omit(e){let t={};for(let s of b.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r(y(c({},this._def),{shape:()=>t}))}deepPartial(){return ge(this)}partial(e){let t={};for(let s of b.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new r(y(c({},this._def),{shape:()=>t}))}required(e){let t={};for(let s of b.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof j;)a=a._def.innerType;t[s]=a}return new r(y(c({},this._def),{shape:()=>t}))}keyof(){return dt(b.objectKeys(this.shape))}};O.create=(r,e)=>new O(c({shape:()=>r,unknownKeys:"strip",catchall:P.create(),typeName:g.ZodObject},v(e)));O.strictCreate=(r,e)=>new O(c({shape:()=>r,unknownKeys:"strict",catchall:P.create(),typeName:g.ZodObject},v(e)));O.lazycreate=(r,e)=>new O(c({shape:r,unknownKeys:"strip",catchall:P.create(),typeName:g.ZodObject},v(e)));var ne=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(let i of a)if(i.result.status==="valid")return i.result;for(let i of a)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(i=>new A(i.ctx.common.issues));return f(t,{code:d.invalid_union,unionErrors:o}),m}if(t.common.async)return Promise.all(s.map(async a=>{let o=y(c({},t),{common:y(c({},t.common),{issues:[]}),parent:null});return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let a,o=[];for(let u of s){let l=y(c({},t),{common:y(c({},t.common),{issues:[]}),parent:null}),_=u._parseSync({data:t.data,path:t.path,parent:l});if(_.status==="valid")return _;_.status==="dirty"&&!a&&(a={result:_,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(u=>new A(u));return f(t,{code:d.invalid_union,unionErrors:i}),m}}get options(){return this._def.options}};ne.create=(r,e)=>new ne(c({options:r,typeName:g.ZodUnion},v(e)));var z=r=>r instanceof ie?z(r.schema):r instanceof M?z(r.innerType()):r instanceof oe?[r.value]:r instanceof ce?r.options:r instanceof de?b.objectValues(r.enum):r instanceof ue?z(r._def.innerType):r instanceof re?[void 0]:r instanceof se?[null]:r instanceof j?[void 0,...z(r.unwrap())]:r instanceof L?[null,...z(r.unwrap())]:r instanceof Ie||r instanceof fe?z(r.unwrap()):r instanceof le?z(r._def.innerType):[],Pe=class r extends x{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return f(t,{code:d.invalid_type,expected:h.object,received:t.parsedType}),m;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(f(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let o=z(a.shape[e]);if(!o.length)throw new Error("A discriminator value for key `".concat(e,"` could not be extracted from all schema options"));for(let i of o){if(n.has(i))throw new Error("Discriminator property ".concat(String(e)," has duplicate value ").concat(String(i)));n.set(i,a)}}return new r(c({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n},v(s)))}};function qe(r,e){let t=Z(r),s=Z(e);if(r===e)return{valid:!0,data:r};if(t===h.object&&s===h.object){let n=b.objectKeys(e),a=b.objectKeys(r).filter(i=>n.indexOf(i)!==-1),o=c(c({},r),e);for(let i of a){let u=qe(r[i],e[i]);if(!u.valid)return{valid:!1};o[i]=u.data}return{valid:!0,data:o}}else if(t===h.array&&s===h.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let o=r[a],i=e[a],u=qe(o,i);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return t===h.date&&s===h.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var ae=class extends x{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,o)=>{if(Ee(a)||Ee(o))return m;let i=qe(a.value,o.value);return i.valid?((Me(a)||Me(o))&&t.dirty(),{status:t.value,value:i.data}):(f(s,{code:d.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,o])=>n(a,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};ae.create=(r,e,t)=>new ae(c({left:r,right:e,typeName:g.ZodIntersection},v(t)));var $=class r extends x{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.array)return f(s,{code:d.invalid_type,expected:h.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return f(s,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(f(s,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((o,i)=>{let u=this._def.items[i]||this._def.rest;return u?u._parse(new E(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(a).then(o=>R.mergeArray(t,o)):R.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r(y(c({},this._def),{rest:e}))}};$.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $(c({items:r,typeName:g.ZodTuple,rest:null},v(e)))};var Ze=class r extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.object)return f(s,{code:d.invalid_type,expected:h.object,received:s.parsedType}),m;let n=[],a=this._def.keyType,o=this._def.valueType;for(let i in s.data)n.push({key:a._parse(new E(s,i,s.path,i)),value:o._parse(new E(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?R.mergeObjectAsync(t,n):R.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof x?new r(c({keyType:e,valueType:t,typeName:g.ZodRecord},v(s))):new r(c({keyType:W.create(),valueType:e,typeName:g.ZodRecord},v(t)))}},xe=class extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.map)return f(s,{code:d.invalid_type,expected:h.map,received:s.parsedType}),m;let n=this._def.keyType,a=this._def.valueType,o=[...s.data.entries()].map(([i,u],l)=>({key:n._parse(new E(s,i,s.path,[l,"key"])),value:a._parse(new E(s,u,s.path,[l,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let u of o){let l=await u.key,_=await u.value;if(l.status==="aborted"||_.status==="aborted")return m;(l.status==="dirty"||_.status==="dirty")&&t.dirty(),i.set(l.value,_.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let u of o){let l=u.key,_=u.value;if(l.status==="aborted"||_.status==="aborted")return m;(l.status==="dirty"||_.status==="dirty")&&t.dirty(),i.set(l.value,_.value)}return{status:t.value,value:i}}}};xe.create=(r,e,t)=>new xe(c({valueType:e,keyType:r,typeName:g.ZodMap},v(t)));var be=class r extends x{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.set)return f(s,{code:d.invalid_type,expected:h.set,received:s.parsedType}),m;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(f(s,{code:d.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(f(s,{code:d.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function o(u){let l=new Set;for(let _ of u){if(_.status==="aborted")return m;_.status==="dirty"&&t.dirty(),l.add(_.value)}return{status:t.value,value:l}}let i=[...s.data.values()].map((u,l)=>a._parse(new E(s,u,s.path,l)));return s.common.async?Promise.all(i).then(u=>o(u)):o(i)}min(e,t){return new r(y(c({},this._def),{minSize:{value:e,message:p.toString(t)}}))}max(e,t){return new r(y(c({},this._def),{maxSize:{value:e,message:p.toString(t)}}))}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};be.create=(r,e)=>new be(c({valueType:r,minSize:null,maxSize:null,typeName:g.ZodSet},v(e)));var $e=class r extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return f(t,{code:d.invalid_type,expected:h.function,received:t.parsedType}),m;function s(i,u){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,me(),D].filter(l=>!!l),issueData:{code:d.invalid_arguments,argumentsError:u}})}function n(i,u){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,me(),D].filter(l=>!!l),issueData:{code:d.invalid_return_type,returnTypeError:u}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof Y){let i=this;return S(async function(...u){let l=new A([]),_=await i._def.args.parseAsync(u,a).catch(Te=>{throw l.addIssue(s(u,Te)),l}),T=await Reflect.apply(o,this,_);return await i._def.returns._def.type.parseAsync(T,a).catch(Te=>{throw l.addIssue(n(T,Te)),l})})}else{let i=this;return S(function(...u){let l=i._def.args.safeParse(u,a);if(!l.success)throw new A([s(u,l.error)]);let _=Reflect.apply(o,this,l.data),T=i._def.returns.safeParse(_,a);if(!T.success)throw new A([n(_,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r(y(c({},this._def),{args:$.create(e).rest(B.create())}))}returns(e){return new r(y(c({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r(c({args:e||$.create([]).rest(B.create()),returns:t||B.create(),typeName:g.ZodFunction},v(s)))}},ie=class extends x{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ie.create=(r,e)=>new ie(c({getter:r,typeName:g.ZodLazy},v(e)));var oe=class extends x{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};oe.create=(r,e)=>new oe(c({value:r,typeName:g.ZodLiteral},v(e)));function dt(r,e){return new ce(c({values:r,typeName:g.ZodEnum},v(e)))}var ce=class r extends x{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{expected:b.joinValues(s),received:t.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{received:t.data,code:d.invalid_enum_value,options:s}),m}return S(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,c(c({},this._def),t))}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),c(c({},this._def),t))}};ce.create=dt;var de=class extends x{_parse(e){let t=b.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==h.string&&s.parsedType!==h.number){let n=b.objectValues(t);return f(s,{expected:b.joinValues(n),received:s.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=b.objectValues(t);return f(s,{received:s.data,code:d.invalid_enum_value,options:n}),m}return S(e.data)}get enum(){return this._def.values}};de.create=(r,e)=>new de(c({values:r,typeName:g.ZodNativeEnum},v(e)));var Y=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return f(t,{code:d.invalid_type,expected:h.promise,received:t.parsedType}),m;let s=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return S(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};Y.create=(r,e)=>new Y(c({type:r,typeName:g.ZodPromise},v(e)));var M=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:o=>{f(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let o=n.transform(s.data,a);if(s.common.async)return Promise.resolve(o).then(async i=>{if(t.value==="aborted")return m;let u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?m:u.status==="dirty"?K(u.value):t.value==="dirty"?K(u.value):u});{if(t.value==="aborted")return m;let i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?m:i.status==="dirty"?K(i.value):t.value==="dirty"?K(i.value):i}}if(n.type==="refinement"){let o=i=>{let u=n.refinement(i,a);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?m:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?m:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(n.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!U(o))return m;let i=n.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>U(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:t.value,value:i})):m);b.assertNever(n)}};M.create=(r,e,t)=>new M(c({schema:r,typeName:g.ZodEffects,effect:e},v(t)));M.createWithPreprocess=(r,e,t)=>new M(c({schema:e,effect:{type:"preprocess",transform:r},typeName:g.ZodEffects},v(t)));var j=class extends x{_parse(e){return this._getType(e)===h.undefined?S(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};j.create=(r,e)=>new j(c({innerType:r,typeName:g.ZodOptional},v(e)));var L=class extends x{_parse(e){return this._getType(e)===h.null?S(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};L.create=(r,e)=>new L(c({innerType:r,typeName:g.ZodNullable},v(e)));var ue=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===h.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};ue.create=(r,e)=>new ue(c({innerType:r,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},v(e)));var le=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),s=y(c({},t),{common:y(c({},t.common),{issues:[]})}),n=this._def.innerType._parse({data:s.data,path:s.path,parent:c({},s)});return ye(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new A(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new A(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};le.create=(r,e)=>new le(c({innerType:r,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},v(e)));var ke=class extends x{_parse(e){if(this._getType(e)!==h.nan){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}};ke.create=r=>new ke(c({typeName:g.ZodNaN},v(r)));var Kt=Symbol("zod_brand"),Ie=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Ne=class r extends x{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),K(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:g.ZodPipeline})}},fe=class extends x{_parse(e){let t=this._def.innerType._parse(e),s=n=>(U(n)&&(n.value=Object.freeze(n.value)),n);return ye(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};fe.create=(r,e)=>new fe(c({innerType:r,typeName:g.ZodReadonly},v(e)));function at(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function ut(r,e={},t){return r?q.create().superRefine((s,n)=>{var o,i;let a=r(s);if(a instanceof Promise)return a.then(u=>{var l,_;if(!u){let T=at(e,s),he=(_=(l=T.fatal)!=null?l:t)!=null?_:!0;n.addIssue(y(c({code:"custom"},T),{fatal:he}))}});if(!a){let u=at(e,s),l=(i=(o=u.fatal)!=null?o:t)!=null?i:!0;n.addIssue(y(c({code:"custom"},u),{fatal:l}))}}):q.create()}var Gt={object:O.lazycreate},g;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(g||(g={}));var Ht=(r,e={message:"Input not instance of ".concat(r.name)})=>ut(t=>t instanceof r,e),lt=W.create,ft=G.create,er=ke.create,tr=H.create,ht=ee.create,rr=te.create,sr=_e.create,nr=re.create,ar=se.create,ir=q.create,or=B.create,cr=P.create,dr=ve.create,ur=F.create,lr=O.create,fr=O.strictCreate,hr=ne.create,pr=Pe.create,mr=ae.create,yr=$.create,gr=Ze.create,_r=xe.create,vr=be.create,xr=$e.create,br=ie.create,kr=oe.create,wr=ce.create,Tr=de.create,Rr=Y.create,Cr=M.create,Sr=j.create,Ar=L.create,Or=M.createWithPreprocess,Ir=Ne.create,Nr=()=>lt().optional(),jr=()=>ft().optional(),Er=()=>ht().optional(),Mr={string:r=>W.create(y(c({},r),{coerce:!0})),number:r=>G.create(y(c({},r),{coerce:!0})),boolean:r=>ee.create(y(c({},r),{coerce:!0})),bigint:r=>H.create(y(c({},r),{coerce:!0})),date:r=>te.create(y(c({},r),{coerce:!0}))};var Pr=m;var Vs=we.union([we.enum(["low","medium","high","always-visible"]),we.number()]);var Le=5;var X=200,Ve=10;function pt(r,e,t,s,n,a,o="-1"){let i=1/0,u=1/0,l=-1/0,_=-1/0,T=new w(-Ve,0,5,t),he=new w(-Ve,0,e,5),Te=new w(e-5,0,e+Ve,t),yt=new w(0,t-5,e,t+Ve),gt=Zr(e,t,s,n,a),_t=[T,he,Te,yt],Ye=new w(-X,-X,e+X*2,t+X*2);for(let k of r){let Ce,Se;for(let I=0;I<k.bboxes.length;I++){if(k.bboxes[I]==null||(Ce=k.bboxes[I].boundingBox,Se=k.bboxes[I].index,k.lockedToStrategyIndex!==-1&&Se!==k.lockedToStrategyIndex))continue;let[je,N,J,Xe]=Ce,[Q,vt,Je,xt]=[k.y-je,k.y+N,k.x-J,k.x+Xe],ze=Je,Be=Q,Qe=xt-Je,Ke=vt-Q;i=Math.min(i,ze)-X,u=Math.min(u,Be)-X,l=Math.max(l,ze+Qe)+X,_=Math.max(_,Be+Ke)+X,k.bboxes[I].boundingRect=new w(ze,Be,Qe,Ke)}}let pe={msgId:o,colliders:new Array(r.length),debug:[]},De=new Ae(new w(i,u,l-i,_-u)),Re;for(let k=0;k<r.length;k++)if(Re=r[k],pe.colliders[k]=[-1,0],Re.enabledAndVisible){let[Ce,Se,I]=[1/0,-1,void 0];for(let{index:je,boundingRect:N}of Re.bboxes){if(N==null)continue;let J=[];if(J=De.queryRect(N).filter(Q=>N.intersects(Q)),Re.shouldCollideWithScreenEdges&&_t.forEach(Q=>{N.intersects(Q)&&J.push(Q)}),N.intersects(gt)){pe.colliders[k]=[-1,0,N];break}if(J.length<=Ce&&(I=N,Se=je,Ce=J.length),J.length===0){De.insert(N),pe.colliders[k]=[je,Ye.contains(N)?0:1,N];break}}Re.rank===Le&&I!=null&&(De.insert(I),pe.colliders[k]=[Se,Ye.contains(I)?0:1,I])}else pe.colliders[k]=[-1,0];return pe}function Zr(r,e,t,s,n){switch(n){case"top-right":return new w(r-t,0,t,s);case"bottom-left":return new w(0,e-s,t,s);case"bottom-right":return new w(r-t,e-s,t,s);case"top-left":return new w(0,0,t,s)}}function mt(r){let e=r[0].map(t=>{let s=t[0].map(n=>({index:n[4],boundingBox:[n[0],n[1],n[2],n[3]]}));return{enabledAndVisible:t[1]===1,rank:t[2]===1?Le:0,x:t[3],y:t[4],shouldCollideWithScreenEdges:t[5]===1,bboxes:s,lockedToStrategyIndex:t[6]}});return{msgId:"-1",totalWidth:r[3],totalHeight:r[2],watermarkWidth:r[4],watermarkHeight:r[5],watermarkPosition:r[6],colliders:e,devicePixelRatio:r[1]}}self.onmessage=r=>{let e=mt(r.data);self.postMessage(pt(e.colliders,e.totalWidth,e.totalHeight,e.watermarkWidth,e.watermarkHeight,e.watermarkPosition,e.msgId))};})();\n';v();v();v();v();v();function Cp(t,e){return e.x+e.w<t.x+t.w&&e.x>t.x&&e.y>t.y&&e.y+e.h<t.y+t.h}a(Cp,"contains");v();function _p(t,e){let[r,i]=e;return r>=t.x&&r<=t.x+t.w&&i>=t.y&&i<=t.y+t.h}a(_p,"intersectPoint");v();function Pp(t,e){let r=e.x,i=e.y,n=e.x+e.w,o=e.y+e.h,s=t.x,l=t.y,u=t.x+t.w,h=t.y+t.h;return r<u&&s<n&&i<h&&l<o}a(Pp,"intersects");v();function yr(t,e){for(let r=0;r<e.length;r++)t.push(e[r])}a(yr,"appendItems");v();var xc=class xc{constructor(e,r,i,n,o){p(this,"x");p(this,"y");p(this,"w");p(this,"h");p(this,"userData");this.userData=typeof o>"u"?null:o,this.x=e,this.y=r,this.w=i,this.h=n}contains(e){return e===this?!1:Cp(this,e)}intersects(e){return Pp(this,e)}intersectsPoint(e){return _p(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};a(xc,"Rectangle");var Se=xc;var vi=class vi{constructor(e,r){p(this,"topLeft");p(this,"topRight");p(this,"bottomLeft");p(this,"bottomRight");p(this,"divided",!1);p(this,"boundary");p(this,"capacity",16);p(this,"objects",[]);p(this,"parent");this.parent=r,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:r,w:i,h:n}=this.boundary;this.topLeft=new vi(new Se(e,r,i/2,n/2),this),this.topRight=new vi(new Se(e+i/2,r,i/2,n/2),this),this.bottomLeft=new vi(new Se(e,r+n/2,i/2,n/2),this),this.bottomRight=new vi(new Se(e+i/2,r+n/2,i/2,n/2),this),this.divided=!0}queryRect(e){let r=[];if(this.boundary.intersects(e))r.push(...this.objects);else return[];return this.divided&&(yr(r,this.topLeft.queryRect(e)),yr(r,this.topRight.queryRect(e)),yr(r,this.bottomLeft.queryRect(e)),yr(r,this.bottomRight.queryRect(e))),r}queryPoint(e){let r=[];if(this.boundary.intersectsPoint(e))r.push(...this.objects);else return[];return this.divided&&(yr(r,this.topLeft.queryPoint(e)),yr(r,this.topRight.queryPoint(e)),yr(r,this.bottomLeft.queryPoint(e)),yr(r,this.bottomRight.queryPoint(e))),r}insert(e){return(this.parent?!this.boundary.contains(e):!this.boundary.intersects(e))?!1:this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0)}drawObjects(e){this.objects.forEach(r=>r.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};a(vi,"QuadTree");var Tt=vi;v();v();v();v();var I={};Pd(I,{BRAND:()=>yv,DIRTY:()=>bi,EMPTY_PATH:()=>Vg,INVALID:()=>Q,NEVER:()=>eb,OK:()=>at,ParseStatus:()=>nt,Schema:()=>le,ZodAny:()=>Ur,ZodArray:()=>xr,ZodBigInt:()=>Ci,ZodBoolean:()=>_i,ZodBranded:()=>So,ZodCatch:()=>ki,ZodDate:()=>Pi,ZodDefault:()=>Ai,ZodDiscriminatedUnion:()=>ca,ZodEffects:()=>It,ZodEnum:()=>Oi,ZodError:()=>gt,ZodFirstPartyTypeKind:()=>re,ZodFunction:()=>ha,ZodIntersection:()=>Ii,ZodIssueCode:()=>G,ZodLazy:()=>Ei,ZodLiteral:()=>Di,ZodMap:()=>Mn,ZodNaN:()=>En,ZodNativeEnum:()=>Li,ZodNever:()=>Ft,ZodNull:()=>wi,ZodNullable:()=>tr,ZodNumber:()=>Si,ZodObject:()=>vt,ZodOptional:()=>wt,ZodParsedType:()=>U,ZodPipeline:()=>Co,ZodPromise:()=>jr,ZodReadonly:()=>Ri,ZodRecord:()=>ua,ZodSchema:()=>le,ZodSet:()=>In,ZodString:()=>Zr,ZodSymbol:()=>Tn,ZodTransformer:()=>It,ZodTuple:()=>er,ZodType:()=>le,ZodUndefined:()=>Ti,ZodUnion:()=>Mi,ZodUnknown:()=>br,ZodVoid:()=>wn,addIssueToContext:()=>Z,any:()=>Tv,array:()=>Ev,bigint:()=>xv,boolean:()=>Rp,coerce:()=>Qv,custom:()=>Lp,date:()=>Sv,datetimeRegex:()=>Dp,defaultErrorMap:()=>gr,discriminatedUnion:()=>Av,effect:()=>jv,enum:()=>Yv,function:()=>Gv,getErrorMap:()=>xn,getParsedType:()=>Qt,instanceof:()=>vv,intersection:()=>kv,isAborted:()=>aa,isAsync:()=>Sn,isDirty:()=>la,isValid:()=>Yr,late:()=>gv,lazy:()=>Xv,literal:()=>zv,makeIssue:()=>fo,map:()=>Bv,nan:()=>bv,nativeEnum:()=>Zv,never:()=>Mv,null:()=>Pv,nullable:()=>Wv,number:()=>kp,object:()=>Dv,objectUtil:()=>Sc,oboolean:()=>Kv,onumber:()=>Jv,optional:()=>Hv,ostring:()=>$v,pipeline:()=>qv,preprocess:()=>Vv,promise:()=>Uv,quotelessJson:()=>jg,record:()=>Nv,set:()=>Fv,setErrorMap:()=>Wg,strictObject:()=>Ov,string:()=>Ap,symbol:()=>Cv,transformer:()=>jv,tuple:()=>Rv,undefined:()=>_v,union:()=>Lv,unknown:()=>wv,util:()=>he,void:()=>Iv});v();v();v();v();v();var he;(function(t){t.assertEqual=n=>{};function e(n){}a(e,"assertIs"),t.assertIs=e;function r(n){throw new Error}a(r,"assertNever"),t.assertNever=r,t.arrayToEnum=n=>{let o={};for(let s of n)o[s]=s;return o},t.getValidEnumValues=n=>{let o=t.objectKeys(n).filter(l=>typeof n[n[l]]!="number"),s={};for(let l of o)s[l]=n[l];return t.objectValues(s)},t.objectValues=n=>t.objectKeys(n).map(function(o){return n[o]}),t.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let o=[];for(let s in n)Object.prototype.hasOwnProperty.call(n,s)&&o.push(s);return o},t.find=(n,o)=>{for(let s of n)if(o(s))return s},t.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function i(n,o=" | "){return n.map(s=>typeof s=="string"?"'".concat(s,"'"):s).join(o)}a(i,"joinValues"),t.joinValues=i,t.jsonStringifyReplacer=(n,o)=>typeof o=="bigint"?o.toString():o})(he||(he={}));var Sc;(function(t){t.mergeShapes=(e,r)=>O(O({},e),r)})(Sc||(Sc={}));var U=he.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Qt=a(t=>{switch(typeof t){case"undefined":return U.undefined;case"string":return U.string;case"number":return Number.isNaN(t)?U.nan:U.number;case"boolean":return U.boolean;case"function":return U.function;case"bigint":return U.bigint;case"symbol":return U.symbol;case"object":return Array.isArray(t)?U.array:t===null?U.null:t.then&&typeof t.then=="function"&&t.catch&&typeof t.catch=="function"?U.promise:typeof Map<"u"&&t instanceof Map?U.map:typeof Set<"u"&&t instanceof Set?U.set:typeof Date<"u"&&t instanceof Date?U.date:U.object;default:return U.unknown}},"getParsedType");var G=he.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),jg=a(t=>JSON.stringify(t,null,2).replace(/"([^"]+)":/g,"$1:"),"quotelessJson"),oa=class oa extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=i=>{this.issues=[...this.issues,i]},this.addIssues=(i=[])=>{this.issues=[...this.issues,...i]};let r=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,r):this.__proto__=r,this.name="ZodError",this.issues=e}format(e){let r=e||function(o){return o.message},i={_errors:[]},n=a(o=>{for(let s of o.issues)if(s.code==="invalid_union")s.unionErrors.map(n);else if(s.code==="invalid_return_type")n(s.returnTypeError);else if(s.code==="invalid_arguments")n(s.argumentsError);else if(s.path.length===0)i._errors.push(r(s));else{let l=i,u=0;for(;u<s.path.length;){let h=s.path[u];u===s.path.length-1?(l[h]=l[h]||{_errors:[]},l[h]._errors.push(r(s))):l[h]=l[h]||{_errors:[]},l=l[h],u++}}},"processError");return n(this),i}static assert(e){if(!(e instanceof oa))throw new Error("Not a ZodError: ".concat(e))}toString(){return this.message}get message(){return JSON.stringify(this.issues,he.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=r=>r.message){let r={},i=[];for(let n of this.issues)n.path.length>0?(r[n.path[0]]=r[n.path[0]]||[],r[n.path[0]].push(e(n))):i.push(e(n));return{formErrors:i,fieldErrors:r}}get formErrors(){return this.flatten()}};a(oa,"ZodError");var gt=oa;gt.create=t=>new gt(t);var Hg=a((t,e)=>{let r;switch(t.code){case G.invalid_type:t.received===U.undefined?r="Required":r="Expected ".concat(t.expected,", received ").concat(t.received);break;case G.invalid_literal:r="Invalid literal value, expected ".concat(JSON.stringify(t.expected,he.jsonStringifyReplacer));break;case G.unrecognized_keys:r="Unrecognized key(s) in object: ".concat(he.joinValues(t.keys,", "));break;case G.invalid_union:r="Invalid input";break;case G.invalid_union_discriminator:r="Invalid discriminator value. Expected ".concat(he.joinValues(t.options));break;case G.invalid_enum_value:r="Invalid enum value. Expected ".concat(he.joinValues(t.options),", received '").concat(t.received,"'");break;case G.invalid_arguments:r="Invalid function arguments";break;case G.invalid_return_type:r="Invalid function return type";break;case G.invalid_date:r="Invalid date";break;case G.invalid_string:typeof t.validation=="object"?"includes"in t.validation?(r='Invalid input: must include "'.concat(t.validation.includes,'"'),typeof t.validation.position=="number"&&(r="".concat(r," at one or more positions greater than or equal to ").concat(t.validation.position))):"startsWith"in t.validation?r='Invalid input: must start with "'.concat(t.validation.startsWith,'"'):"endsWith"in t.validation?r='Invalid input: must end with "'.concat(t.validation.endsWith,'"'):he.assertNever(t.validation):t.validation!=="regex"?r="Invalid ".concat(t.validation):r="Invalid";break;case G.too_small:t.type==="array"?r="Array must contain ".concat(t.exact?"exactly":t.inclusive?"at least":"more than"," ").concat(t.minimum," element(s)"):t.type==="string"?r="String must contain ".concat(t.exact?"exactly":t.inclusive?"at least":"over"," ").concat(t.minimum," character(s)"):t.type==="number"?r="Number must be ".concat(t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than ").concat(t.minimum):t.type==="date"?r="Date must be ".concat(t.exact?"exactly equal to ":t.inclusive?"greater than or equal to ":"greater than ").concat(new Date(Number(t.minimum))):r="Invalid input";break;case G.too_big:t.type==="array"?r="Array must contain ".concat(t.exact?"exactly":t.inclusive?"at most":"less than"," ").concat(t.maximum," element(s)"):t.type==="string"?r="String must contain ".concat(t.exact?"exactly":t.inclusive?"at most":"under"," ").concat(t.maximum," character(s)"):t.type==="number"?r="Number must be ".concat(t.exact?"exactly":t.inclusive?"less than or equal to":"less than"," ").concat(t.maximum):t.type==="bigint"?r="BigInt must be ".concat(t.exact?"exactly":t.inclusive?"less than or equal to":"less than"," ").concat(t.maximum):t.type==="date"?r="Date must be ".concat(t.exact?"exactly":t.inclusive?"smaller than or equal to":"smaller than"," ").concat(new Date(Number(t.maximum))):r="Invalid input";break;case G.custom:r="Invalid input";break;case G.invalid_intersection_types:r="Intersection results could not be merged";break;case G.not_multiple_of:r="Number must be a multiple of ".concat(t.multipleOf);break;case G.not_finite:r="Number must be finite";break;default:r=e.defaultError,he.assertNever(t)}return{message:r}},"errorMap"),gr=Hg;var Tp=gr;function Wg(t){Tp=t}a(Wg,"setErrorMap");function xn(){return Tp}a(xn,"getErrorMap");v();var fo=a(t=>{let{data:e,path:r,errorMaps:i,issueData:n}=t,o=[...r,...n.path||[]],s=j(O({},n),{path:o});if(n.message!==void 0)return j(O({},n),{path:o,message:n.message});let l="",u=i.filter(h=>!!h).slice().reverse();for(let h of u)l=h(s,{data:e,defaultError:l}).message;return j(O({},n),{path:o,message:l})},"makeIssue"),Vg=[];function Z(t,e){let r=xn(),i=fo({issueData:e,data:t.data,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,r,r===gr?void 0:gr].filter(n=>!!n)});t.common.issues.push(i)}a(Z,"addIssueToContext");var sa=class sa{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,r){let i=[];for(let n of r){if(n.status==="aborted")return Q;n.status==="dirty"&&e.dirty(),i.push(n.value)}return{status:e.value,value:i}}static async mergeObjectAsync(e,r){let i=[];for(let n of r){let o=await n.key,s=await n.value;i.push({key:o,value:s})}return sa.mergeObjectSync(e,i)}static mergeObjectSync(e,r){let i={};for(let n of r){let{key:o,value:s}=n;if(o.status==="aborted"||s.status==="aborted")return Q;o.status==="dirty"&&e.dirty(),s.status==="dirty"&&e.dirty(),o.value!=="__proto__"&&(typeof s.value<"u"||n.alwaysSet)&&(i[o.value]=s.value)}return{status:e.value,value:i}}};a(sa,"ParseStatus");var nt=sa,Q=Object.freeze({status:"aborted"}),bi=a(t=>({status:"dirty",value:t}),"DIRTY"),at=a(t=>({status:"valid",value:t}),"OK"),aa=a(t=>t.status==="aborted","isAborted"),la=a(t=>t.status==="dirty","isDirty"),Yr=a(t=>t.status==="valid","isValid"),Sn=a(t=>typeof Promise<"u"&&t instanceof Promise,"isAsync");v();v();v();var V;(function(t){t.errToObj=e=>typeof e=="string"?{message:e}:e||{},t.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(V||(V={}));var Pc=class Pc{constructor(e,r,i,n){this._cachedPath=[],this.parent=e,this.data=r,this._path=i,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}};a(Pc,"ParseInputLazyPath");var Mt=Pc,wp=a((t,e)=>{if(Yr(e))return{success:!0,data:e.value};if(!t.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let r=new gt(t.common.issues);return this._error=r,this._error}}},"handleResult");function oe(t){if(!t)return{};let{errorMap:e,invalid_type_error:r,required_error:i,description:n}=t;if(e&&(r||i))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return e?{errorMap:e,description:n}:{errorMap:a((s,l)=>{var h,m;let{message:u}=t;return s.code==="invalid_enum_value"?{message:u!=null?u:l.defaultError}:typeof l.data>"u"?{message:(h=u!=null?u:i)!=null?h:l.defaultError}:s.code!=="invalid_type"?{message:l.defaultError}:{message:(m=u!=null?u:r)!=null?m:l.defaultError}},"customMap"),description:n}}a(oe,"processCreateParams");var Tc=class Tc{get description(){return this._def.description}_getType(e){return Qt(e.data)}_getOrReturnCtx(e,r){return r||{common:e.parent.common,data:e.data,parsedType:Qt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new nt,ctx:{common:e.parent.common,data:e.data,parsedType:Qt(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let r=this._parse(e);if(Sn(r))throw new Error("Synchronous parse encountered promise.");return r}_parseAsync(e){let r=this._parse(e);return Promise.resolve(r)}parse(e,r){let i=this.safeParse(e,r);if(i.success)return i.data;throw i.error}safeParse(e,r){var o;let i={common:{issues:[],async:(o=r==null?void 0:r.async)!=null?o:!1,contextualErrorMap:r==null?void 0:r.errorMap},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qt(e)},n=this._parseSync({data:e,path:i.path,parent:i});return wp(i,n)}"~validate"(e){var i,n;let r={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qt(e)};if(!this["~standard"].async)try{let o=this._parseSync({data:e,path:[],parent:r});return Yr(o)?{value:o.value}:{issues:r.common.issues}}catch(o){(n=(i=o==null?void 0:o.message)==null?void 0:i.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),r.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:r}).then(o=>Yr(o)?{value:o.value}:{issues:r.common.issues})}async parseAsync(e,r){let i=await this.safeParseAsync(e,r);if(i.success)return i.data;throw i.error}async safeParseAsync(e,r){let i={common:{issues:[],contextualErrorMap:r==null?void 0:r.errorMap,async:!0},path:(r==null?void 0:r.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Qt(e)},n=this._parse({data:e,path:i.path,parent:i}),o=await(Sn(n)?n:Promise.resolve(n));return wp(i,o)}refine(e,r){let i=a(n=>typeof r=="string"||typeof r>"u"?{message:r}:typeof r=="function"?r(n):r,"getIssueProperties");return this._refinement((n,o)=>{let s=e(n),l=a(()=>o.addIssue(O({code:G.custom},i(n))),"setError");return typeof Promise<"u"&&s instanceof Promise?s.then(u=>u?!0:(l(),!1)):s?!0:(l(),!1)})}refinement(e,r){return this._refinement((i,n)=>e(i)?!0:(n.addIssue(typeof r=="function"?r(i,n):r),!1))}_refinement(e){return new It({schema:this,typeName:re.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:a(r=>this["~validate"](r),"validate")}}optional(){return wt.create(this,this._def)}nullable(){return tr.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return xr.create(this)}promise(){return jr.create(this,this._def)}or(e){return Mi.create([this,e],this._def)}and(e){return Ii.create(this,e,this._def)}transform(e){return new It(j(O({},oe(this._def)),{schema:this,typeName:re.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){let r=typeof e=="function"?e:()=>e;return new Ai(j(O({},oe(this._def)),{innerType:this,defaultValue:r,typeName:re.ZodDefault}))}brand(){return new So(O({typeName:re.ZodBranded,type:this},oe(this._def)))}catch(e){let r=typeof e=="function"?e:()=>e;return new ki(j(O({},oe(this._def)),{innerType:this,catchValue:r,typeName:re.ZodCatch}))}describe(e){let r=this.constructor;return new r(j(O({},this._def),{description:e}))}pipe(e){return Co.create(this,e)}readonly(){return Ri.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}};a(Tc,"ZodType");var le=Tc,qg=/^c[^\s-]{8,}$/i,$g=/^[0-9a-z]+$/,Jg=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Kg=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,Qg=/^[a-z0-9_-]{21}$/i,ev=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,tv=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,rv=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,iv="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$",Cc,nv=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,ov=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,sv=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,av=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,lv=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,cv=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ip="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",uv=new RegExp("^".concat(Ip,"$"));function Ep(t){let e="[0-5]\\d";t.precision?e="".concat(e,"\\.\\d{").concat(t.precision,"}"):t.precision==null&&(e="".concat(e,"(\\.\\d+)?"));let r=t.precision?"+":"?";return"([01]\\d|2[0-3]):[0-5]\\d(:".concat(e,")").concat(r)}a(Ep,"timeRegexSource");function hv(t){return new RegExp("^".concat(Ep(t),"$"))}a(hv,"timeRegex");function Dp(t){let e="".concat(Ip,"T").concat(Ep(t)),r=[];return r.push(t.local?"Z?":"Z"),t.offset&&r.push("([+-]\\d{2}:?\\d{2})"),e="".concat(e,"(").concat(r.join("|"),")"),new RegExp("^".concat(e,"$"))}a(Dp,"datetimeRegex");function dv(t,e){return!!((e==="v4"||!e)&&nv.test(t)||(e==="v6"||!e)&&sv.test(t))}a(dv,"isValidIP");function pv(t,e){if(!ev.test(t))return!1;try{let[r]=t.split("."),i=r.replace(/-/g,"+").replace(/_/g,"/").padEnd(r.length+(4-r.length%4)%4,"="),n=JSON.parse(atob(i));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch(r){return!1}}a(pv,"isValidJWT");function mv(t,e){return!!((e==="v4"||!e)&&ov.test(t)||(e==="v6"||!e)&&av.test(t))}a(mv,"isValidCidr");var xi=class xi extends le{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==U.string){let o=this._getOrReturnCtx(e);return Z(o,{code:G.invalid_type,expected:U.string,received:o.parsedType}),Q}let i=new nt,n;for(let o of this._def.checks)if(o.kind==="min")e.data.length<o.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:G.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="max")e.data.length>o.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:G.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),i.dirty());else if(o.kind==="length"){let s=e.data.length>o.value,l=e.data.length<o.value;(s||l)&&(n=this._getOrReturnCtx(e,n),s?Z(n,{code:G.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):l&&Z(n,{code:G.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),i.dirty())}else if(o.kind==="email")rv.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"email",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="emoji")Cc||(Cc=new RegExp(iv,"u")),Cc.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"emoji",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="uuid")Kg.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"uuid",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="nanoid")Qg.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"nanoid",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid")qg.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"cuid",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="cuid2")$g.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"cuid2",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="ulid")Jg.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"ulid",code:G.invalid_string,message:o.message}),i.dirty());else if(o.kind==="url")try{new URL(e.data)}catch(s){n=this._getOrReturnCtx(e,n),Z(n,{validation:"url",code:G.invalid_string,message:o.message}),i.dirty()}else o.kind==="regex"?(o.regex.lastIndex=0,o.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"regex",code:G.invalid_string,message:o.message}),i.dirty())):o.kind==="trim"?e.data=e.data.trim():o.kind==="includes"?e.data.includes(o.value,o.position)||(n=this._getOrReturnCtx(e,n),Z(n,{code:G.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),i.dirty()):o.kind==="toLowerCase"?e.data=e.data.toLowerCase():o.kind==="toUpperCase"?e.data=e.data.toUpperCase():o.kind==="startsWith"?e.data.startsWith(o.value)||(n=this._getOrReturnCtx(e,n),Z(n,{code:G.invalid_string,validation:{startsWith:o.value},message:o.message}),i.dirty()):o.kind==="endsWith"?e.data.endsWith(o.value)||(n=this._getOrReturnCtx(e,n),Z(n,{code:G.invalid_string,validation:{endsWith:o.value},message:o.message}),i.dirty()):o.kind==="datetime"?Dp(o).test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:G.invalid_string,validation:"datetime",message:o.message}),i.dirty()):o.kind==="date"?uv.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:G.invalid_string,validation:"date",message:o.message}),i.dirty()):o.kind==="time"?hv(o).test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{code:G.invalid_string,validation:"time",message:o.message}),i.dirty()):o.kind==="duration"?tv.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"duration",code:G.invalid_string,message:o.message}),i.dirty()):o.kind==="ip"?dv(e.data,o.version)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"ip",code:G.invalid_string,message:o.message}),i.dirty()):o.kind==="jwt"?pv(e.data,o.alg)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"jwt",code:G.invalid_string,message:o.message}),i.dirty()):o.kind==="cidr"?mv(e.data,o.version)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"cidr",code:G.invalid_string,message:o.message}),i.dirty()):o.kind==="base64"?lv.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"base64",code:G.invalid_string,message:o.message}),i.dirty()):o.kind==="base64url"?cv.test(e.data)||(n=this._getOrReturnCtx(e,n),Z(n,{validation:"base64url",code:G.invalid_string,message:o.message}),i.dirty()):he.assertNever(o);return{status:i.value,value:e.data}}_regex(e,r,i){return this.refinement(n=>e.test(n),O({validation:r,code:G.invalid_string},V.errToObj(i)))}_addCheck(e){return new xi(j(O({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(O({kind:"email"},V.errToObj(e)))}url(e){return this._addCheck(O({kind:"url"},V.errToObj(e)))}emoji(e){return this._addCheck(O({kind:"emoji"},V.errToObj(e)))}uuid(e){return this._addCheck(O({kind:"uuid"},V.errToObj(e)))}nanoid(e){return this._addCheck(O({kind:"nanoid"},V.errToObj(e)))}cuid(e){return this._addCheck(O({kind:"cuid"},V.errToObj(e)))}cuid2(e){return this._addCheck(O({kind:"cuid2"},V.errToObj(e)))}ulid(e){return this._addCheck(O({kind:"ulid"},V.errToObj(e)))}base64(e){return this._addCheck(O({kind:"base64"},V.errToObj(e)))}base64url(e){return this._addCheck(O({kind:"base64url"},V.errToObj(e)))}jwt(e){return this._addCheck(O({kind:"jwt"},V.errToObj(e)))}ip(e){return this._addCheck(O({kind:"ip"},V.errToObj(e)))}cidr(e){return this._addCheck(O({kind:"cidr"},V.errToObj(e)))}datetime(e){var r,i;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(O({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(r=e==null?void 0:e.offset)!=null?r:!1,local:(i=e==null?void 0:e.local)!=null?i:!1},V.errToObj(e==null?void 0:e.message)))}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck(O({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision},V.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(O({kind:"duration"},V.errToObj(e)))}regex(e,r){return this._addCheck(O({kind:"regex",regex:e},V.errToObj(r)))}includes(e,r){return this._addCheck(O({kind:"includes",value:e,position:r==null?void 0:r.position},V.errToObj(r==null?void 0:r.message)))}startsWith(e,r){return this._addCheck(O({kind:"startsWith",value:e},V.errToObj(r)))}endsWith(e,r){return this._addCheck(O({kind:"endsWith",value:e},V.errToObj(r)))}min(e,r){return this._addCheck(O({kind:"min",value:e},V.errToObj(r)))}max(e,r){return this._addCheck(O({kind:"max",value:e},V.errToObj(r)))}length(e,r){return this._addCheck(O({kind:"length",value:e},V.errToObj(r)))}nonempty(e){return this.min(1,V.errToObj(e))}trim(){return new xi(j(O({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new xi(j(O({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new xi(j(O({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxLength(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};a(xi,"ZodString");var Zr=xi;Zr.create=t=>{var e;return new Zr(O({checks:[],typeName:re.ZodString,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1},oe(t)))};function fv(t,e){let r=(t.toString().split(".")[1]||"").length,i=(e.toString().split(".")[1]||"").length,n=r>i?r:i,o=Number.parseInt(t.toFixed(n).replace(".","")),s=Number.parseInt(e.toFixed(n).replace(".",""));return o%s/10**n}a(fv,"floatSafeRemainder");var yo=class yo extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==U.number){let o=this._getOrReturnCtx(e);return Z(o,{code:G.invalid_type,expected:U.number,received:o.parsedType}),Q}let i,n=new nt;for(let o of this._def.checks)o.kind==="int"?he.isInteger(e.data)||(i=this._getOrReturnCtx(e,i),Z(i,{code:G.invalid_type,expected:"integer",received:"float",message:o.message}),n.dirty()):o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),Z(i,{code:G.too_small,minimum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),Z(i,{code:G.too_big,maximum:o.value,type:"number",inclusive:o.inclusive,exact:!1,message:o.message}),n.dirty()):o.kind==="multipleOf"?fv(e.data,o.value)!==0&&(i=this._getOrReturnCtx(e,i),Z(i,{code:G.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):o.kind==="finite"?Number.isFinite(e.data)||(i=this._getOrReturnCtx(e,i),Z(i,{code:G.not_finite,message:o.message}),n.dirty()):he.assertNever(o);return{status:n.value,value:e.data}}gte(e,r){return this.setLimit("min",e,!0,V.toString(r))}gt(e,r){return this.setLimit("min",e,!1,V.toString(r))}lte(e,r){return this.setLimit("max",e,!0,V.toString(r))}lt(e,r){return this.setLimit("max",e,!1,V.toString(r))}setLimit(e,r,i,n){return new yo(j(O({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:V.toString(n)}]}))}_addCheck(e){return new yo(j(O({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:V.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:V.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(r)})}finite(e){return this._addCheck({kind:"finite",message:V.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:V.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:V.toString(e)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&he.isInteger(e.value))}get isFinite(){let e=null,r=null;for(let i of this._def.checks){if(i.kind==="finite"||i.kind==="int"||i.kind==="multipleOf")return!0;i.kind==="min"?(r===null||i.value>r)&&(r=i.value):i.kind==="max"&&(e===null||i.value<e)&&(e=i.value)}return Number.isFinite(r)&&Number.isFinite(e)}};a(yo,"ZodNumber");var Si=yo;Si.create=t=>new Si(O({checks:[],typeName:re.ZodNumber,coerce:(t==null?void 0:t.coerce)||!1},oe(t)));var go=class go extends le{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(o){return this._getInvalidInput(e)}if(this._getType(e)!==U.bigint)return this._getInvalidInput(e);let i,n=new nt;for(let o of this._def.checks)o.kind==="min"?(o.inclusive?e.data<o.value:e.data<=o.value)&&(i=this._getOrReturnCtx(e,i),Z(i,{code:G.too_small,type:"bigint",minimum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="max"?(o.inclusive?e.data>o.value:e.data>=o.value)&&(i=this._getOrReturnCtx(e,i),Z(i,{code:G.too_big,type:"bigint",maximum:o.value,inclusive:o.inclusive,message:o.message}),n.dirty()):o.kind==="multipleOf"?e.data%o.value!==BigInt(0)&&(i=this._getOrReturnCtx(e,i),Z(i,{code:G.not_multiple_of,multipleOf:o.value,message:o.message}),n.dirty()):he.assertNever(o);return{status:n.value,value:e.data}}_getInvalidInput(e){let r=this._getOrReturnCtx(e);return Z(r,{code:G.invalid_type,expected:U.bigint,received:r.parsedType}),Q}gte(e,r){return this.setLimit("min",e,!0,V.toString(r))}gt(e,r){return this.setLimit("min",e,!1,V.toString(r))}lte(e,r){return this.setLimit("max",e,!0,V.toString(r))}lt(e,r){return this.setLimit("max",e,!1,V.toString(r))}setLimit(e,r,i,n){return new go(j(O({},this._def),{checks:[...this._def.checks,{kind:e,value:r,inclusive:i,message:V.toString(n)}]}))}_addCheck(e){return new go(j(O({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:V.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:V.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:V.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:V.toString(e)})}multipleOf(e,r){return this._addCheck({kind:"multipleOf",value:e,message:V.toString(r)})}get minValue(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e}get maxValue(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e}};a(go,"ZodBigInt");var Ci=go;Ci.create=t=>{var e;return new Ci(O({checks:[],typeName:re.ZodBigInt,coerce:(e=t==null?void 0:t.coerce)!=null?e:!1},oe(t)))};var wc=class wc extends le{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==U.boolean){let i=this._getOrReturnCtx(e);return Z(i,{code:G.invalid_type,expected:U.boolean,received:i.parsedType}),Q}return at(e.data)}};a(wc,"ZodBoolean");var _i=wc;_i.create=t=>new _i(O({typeName:re.ZodBoolean,coerce:(t==null?void 0:t.coerce)||!1},oe(t)));var da=class da extends le{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==U.date){let o=this._getOrReturnCtx(e);return Z(o,{code:G.invalid_type,expected:U.date,received:o.parsedType}),Q}if(Number.isNaN(e.data.getTime())){let o=this._getOrReturnCtx(e);return Z(o,{code:G.invalid_date}),Q}let i=new nt,n;for(let o of this._def.checks)o.kind==="min"?e.data.getTime()<o.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:G.too_small,message:o.message,inclusive:!0,exact:!1,minimum:o.value,type:"date"}),i.dirty()):o.kind==="max"?e.data.getTime()>o.value&&(n=this._getOrReturnCtx(e,n),Z(n,{code:G.too_big,message:o.message,inclusive:!0,exact:!1,maximum:o.value,type:"date"}),i.dirty()):he.assertNever(o);return{status:i.value,value:new Date(e.data.getTime())}}_addCheck(e){return new da(j(O({},this._def),{checks:[...this._def.checks,e]}))}min(e,r){return this._addCheck({kind:"min",value:e.getTime(),message:V.toString(r)})}max(e,r){return this._addCheck({kind:"max",value:e.getTime(),message:V.toString(r)})}get minDate(){let e=null;for(let r of this._def.checks)r.kind==="min"&&(e===null||r.value>e)&&(e=r.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let r of this._def.checks)r.kind==="max"&&(e===null||r.value<e)&&(e=r.value);return e!=null?new Date(e):null}};a(da,"ZodDate");var Pi=da;Pi.create=t=>new Pi(O({checks:[],coerce:(t==null?void 0:t.coerce)||!1,typeName:re.ZodDate},oe(t)));var Mc=class Mc extends le{_parse(e){if(this._getType(e)!==U.symbol){let i=this._getOrReturnCtx(e);return Z(i,{code:G.invalid_type,expected:U.symbol,received:i.parsedType}),Q}return at(e.data)}};a(Mc,"ZodSymbol");var Tn=Mc;Tn.create=t=>new Tn(O({typeName:re.ZodSymbol},oe(t)));var Ic=class Ic extends le{_parse(e){if(this._getType(e)!==U.undefined){let i=this._getOrReturnCtx(e);return Z(i,{code:G.invalid_type,expected:U.undefined,received:i.parsedType}),Q}return at(e.data)}};a(Ic,"ZodUndefined");var Ti=Ic;Ti.create=t=>new Ti(O({typeName:re.ZodUndefined},oe(t)));var Ec=class Ec extends le{_parse(e){if(this._getType(e)!==U.null){let i=this._getOrReturnCtx(e);return Z(i,{code:G.invalid_type,expected:U.null,received:i.parsedType}),Q}return at(e.data)}};a(Ec,"ZodNull");var wi=Ec;wi.create=t=>new wi(O({typeName:re.ZodNull},oe(t)));var Dc=class Dc extends le{constructor(){super(...arguments),this._any=!0}_parse(e){return at(e.data)}};a(Dc,"ZodAny");var Ur=Dc;Ur.create=t=>new Ur(O({typeName:re.ZodAny},oe(t)));var Oc=class Oc extends le{constructor(){super(...arguments),this._unknown=!0}_parse(e){return at(e.data)}};a(Oc,"ZodUnknown");var br=Oc;br.create=t=>new br(O({typeName:re.ZodUnknown},oe(t)));var Lc=class Lc extends le{_parse(e){let r=this._getOrReturnCtx(e);return Z(r,{code:G.invalid_type,expected:U.never,received:r.parsedType}),Q}};a(Lc,"ZodNever");var Ft=Lc;Ft.create=t=>new Ft(O({typeName:re.ZodNever},oe(t)));var Ac=class Ac extends le{_parse(e){if(this._getType(e)!==U.undefined){let i=this._getOrReturnCtx(e);return Z(i,{code:G.invalid_type,expected:U.void,received:i.parsedType}),Q}return at(e.data)}};a(Ac,"ZodVoid");var wn=Ac;wn.create=t=>new wn(O({typeName:re.ZodVoid},oe(t)));var _n=class _n extends le{_parse(e){let{ctx:r,status:i}=this._processInputParams(e),n=this._def;if(r.parsedType!==U.array)return Z(r,{code:G.invalid_type,expected:U.array,received:r.parsedType}),Q;if(n.exactLength!==null){let s=r.data.length>n.exactLength.value,l=r.data.length<n.exactLength.value;(s||l)&&(Z(r,{code:s?G.too_big:G.too_small,minimum:l?n.exactLength.value:void 0,maximum:s?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),i.dirty())}if(n.minLength!==null&&r.data.length<n.minLength.value&&(Z(r,{code:G.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),i.dirty()),n.maxLength!==null&&r.data.length>n.maxLength.value&&(Z(r,{code:G.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),i.dirty()),r.common.async)return Promise.all([...r.data].map((s,l)=>n.type._parseAsync(new Mt(r,s,r.path,l)))).then(s=>nt.mergeArray(i,s));let o=[...r.data].map((s,l)=>n.type._parseSync(new Mt(r,s,r.path,l)));return nt.mergeArray(i,o)}get element(){return this._def.type}min(e,r){return new _n(j(O({},this._def),{minLength:{value:e,message:V.toString(r)}}))}max(e,r){return new _n(j(O({},this._def),{maxLength:{value:e,message:V.toString(r)}}))}length(e,r){return new _n(j(O({},this._def),{exactLength:{value:e,message:V.toString(r)}}))}nonempty(e){return this.min(1,e)}};a(_n,"ZodArray");var xr=_n;xr.create=(t,e)=>new xr(O({type:t,minLength:null,maxLength:null,exactLength:null,typeName:re.ZodArray},oe(e)));function Cn(t){if(t instanceof vt){let e={};for(let r in t.shape){let i=t.shape[r];e[r]=wt.create(Cn(i))}return new vt(j(O({},t._def),{shape:a(()=>e,"shape")}))}else return t instanceof xr?new xr(j(O({},t._def),{type:Cn(t.element)})):t instanceof wt?wt.create(Cn(t.unwrap())):t instanceof tr?tr.create(Cn(t.unwrap())):t instanceof er?er.create(t.items.map(e=>Cn(e))):t}a(Cn,"deepPartialify");var St=class St extends le{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),r=he.objectKeys(e);return this._cached={shape:e,keys:r},this._cached}_parse(e){if(this._getType(e)!==U.object){let h=this._getOrReturnCtx(e);return Z(h,{code:G.invalid_type,expected:U.object,received:h.parsedType}),Q}let{status:i,ctx:n}=this._processInputParams(e),{shape:o,keys:s}=this._getCached(),l=[];if(!(this._def.catchall instanceof Ft&&this._def.unknownKeys==="strip"))for(let h in n.data)s.includes(h)||l.push(h);let u=[];for(let h of s){let m=o[h],f=n.data[h];u.push({key:{status:"valid",value:h},value:m._parse(new Mt(n,f,n.path,h)),alwaysSet:h in n.data})}if(this._def.catchall instanceof Ft){let h=this._def.unknownKeys;if(h==="passthrough")for(let m of l)u.push({key:{status:"valid",value:m},value:{status:"valid",value:n.data[m]}});else if(h==="strict")l.length>0&&(Z(n,{code:G.unrecognized_keys,keys:l}),i.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let h=this._def.catchall;for(let m of l){let f=n.data[m];u.push({key:{status:"valid",value:m},value:h._parse(new Mt(n,f,n.path,m)),alwaysSet:m in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let h=[];for(let m of u){let f=await m.key,b=await m.value;h.push({key:f,value:b,alwaysSet:m.alwaysSet})}return h}).then(h=>nt.mergeObjectSync(i,h)):nt.mergeObjectSync(i,u)}get shape(){return this._def.shape()}strict(e){return V.errToObj,new St(O(j(O({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:a((r,i)=>{var o,s,l,u;let n=(l=(s=(o=this._def).errorMap)==null?void 0:s.call(o,r,i).message)!=null?l:i.defaultError;return r.code==="unrecognized_keys"?{message:(u=V.errToObj(e).message)!=null?u:n}:{message:n}},"errorMap")}:{}))}strip(){return new St(j(O({},this._def),{unknownKeys:"strip"}))}passthrough(){return new St(j(O({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new St(j(O({},this._def),{shape:a(()=>O(O({},this._def.shape()),e),"shape")}))}merge(e){return new St({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:a(()=>O(O({},this._def.shape()),e._def.shape()),"shape"),typeName:re.ZodObject})}setKey(e,r){return this.augment({[e]:r})}catchall(e){return new St(j(O({},this._def),{catchall:e}))}pick(e){let r={};for(let i of he.objectKeys(e))e[i]&&this.shape[i]&&(r[i]=this.shape[i]);return new St(j(O({},this._def),{shape:a(()=>r,"shape")}))}omit(e){let r={};for(let i of he.objectKeys(this.shape))e[i]||(r[i]=this.shape[i]);return new St(j(O({},this._def),{shape:a(()=>r,"shape")}))}deepPartial(){return Cn(this)}partial(e){let r={};for(let i of he.objectKeys(this.shape)){let n=this.shape[i];e&&!e[i]?r[i]=n:r[i]=n.optional()}return new St(j(O({},this._def),{shape:a(()=>r,"shape")}))}required(e){let r={};for(let i of he.objectKeys(this.shape))if(e&&!e[i])r[i]=this.shape[i];else{let o=this.shape[i];for(;o instanceof wt;)o=o._def.innerType;r[i]=o}return new St(j(O({},this._def),{shape:a(()=>r,"shape")}))}keyof(){return Op(he.objectKeys(this.shape))}};a(St,"ZodObject");var vt=St;vt.create=(t,e)=>new vt(O({shape:a(()=>t,"shape"),unknownKeys:"strip",catchall:Ft.create(),typeName:re.ZodObject},oe(e)));vt.strictCreate=(t,e)=>new vt(O({shape:a(()=>t,"shape"),unknownKeys:"strict",catchall:Ft.create(),typeName:re.ZodObject},oe(e)));vt.lazycreate=(t,e)=>new vt(O({shape:t,unknownKeys:"strip",catchall:Ft.create(),typeName:re.ZodObject},oe(e)));var kc=class kc extends le{_parse(e){let{ctx:r}=this._processInputParams(e),i=this._def.options;function n(o){for(let l of o)if(l.result.status==="valid")return l.result;for(let l of o)if(l.result.status==="dirty")return r.common.issues.push(...l.ctx.common.issues),l.result;let s=o.map(l=>new gt(l.ctx.common.issues));return Z(r,{code:G.invalid_union,unionErrors:s}),Q}if(a(n,"handleResults"),r.common.async)return Promise.all(i.map(async o=>{let s=j(O({},r),{common:j(O({},r.common),{issues:[]}),parent:null});return{result:await o._parseAsync({data:r.data,path:r.path,parent:s}),ctx:s}})).then(n);{let o,s=[];for(let u of i){let h=j(O({},r),{common:j(O({},r.common),{issues:[]}),parent:null}),m=u._parseSync({data:r.data,path:r.path,parent:h});if(m.status==="valid")return m;m.status==="dirty"&&!o&&(o={result:m,ctx:h}),h.common.issues.length&&s.push(h.common.issues)}if(o)return r.common.issues.push(...o.ctx.common.issues),o.result;let l=s.map(u=>new gt(u));return Z(r,{code:G.invalid_union,unionErrors:l}),Q}}get options(){return this._def.options}};a(kc,"ZodUnion");var Mi=kc;Mi.create=(t,e)=>new Mi(O({options:t,typeName:re.ZodUnion},oe(e)));var vr=a(t=>t instanceof Ei?vr(t.schema):t instanceof It?vr(t.innerType()):t instanceof Di?[t.value]:t instanceof Oi?t.options:t instanceof Li?he.objectValues(t.enum):t instanceof Ai?vr(t._def.innerType):t instanceof Ti?[void 0]:t instanceof wi?[null]:t instanceof wt?[void 0,...vr(t.unwrap())]:t instanceof tr?[null,...vr(t.unwrap())]:t instanceof So||t instanceof Ri?vr(t.unwrap()):t instanceof ki?vr(t._def.innerType):[],"getDiscriminator"),pa=class pa extends le{_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==U.object)return Z(r,{code:G.invalid_type,expected:U.object,received:r.parsedType}),Q;let i=this.discriminator,n=r.data[i],o=this.optionsMap.get(n);return o?r.common.async?o._parseAsync({data:r.data,path:r.path,parent:r}):o._parseSync({data:r.data,path:r.path,parent:r}):(Z(r,{code:G.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[i]}),Q)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,r,i){let n=new Map;for(let o of r){let s=vr(o.shape[e]);if(!s.length)throw new Error("A discriminator value for key `".concat(e,"` could not be extracted from all schema options"));for(let l of s){if(n.has(l))throw new Error("Discriminator property ".concat(String(e)," has duplicate value ").concat(String(l)));n.set(l,o)}}return new pa(O({typeName:re.ZodDiscriminatedUnion,discriminator:e,options:r,optionsMap:n},oe(i)))}};a(pa,"ZodDiscriminatedUnion");var ca=pa;function _c(t,e){let r=Qt(t),i=Qt(e);if(t===e)return{valid:!0,data:t};if(r===U.object&&i===U.object){let n=he.objectKeys(e),o=he.objectKeys(t).filter(l=>n.indexOf(l)!==-1),s=O(O({},t),e);for(let l of o){let u=_c(t[l],e[l]);if(!u.valid)return{valid:!1};s[l]=u.data}return{valid:!0,data:s}}else if(r===U.array&&i===U.array){if(t.length!==e.length)return{valid:!1};let n=[];for(let o=0;o<t.length;o++){let s=t[o],l=e[o],u=_c(s,l);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return r===U.date&&i===U.date&&+t==+e?{valid:!0,data:t}:{valid:!1}}a(_c,"mergeValues");var Rc=class Rc extends le{_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=a((o,s)=>{if(aa(o)||aa(s))return Q;let l=_c(o.value,s.value);return l.valid?((la(o)||la(s))&&r.dirty(),{status:r.value,value:l.data}):(Z(i,{code:G.invalid_intersection_types}),Q)},"handleParsed");return i.common.async?Promise.all([this._def.left._parseAsync({data:i.data,path:i.path,parent:i}),this._def.right._parseAsync({data:i.data,path:i.path,parent:i})]).then(([o,s])=>n(o,s)):n(this._def.left._parseSync({data:i.data,path:i.path,parent:i}),this._def.right._parseSync({data:i.data,path:i.path,parent:i}))}};a(Rc,"ZodIntersection");var Ii=Rc;Ii.create=(t,e,r)=>new Ii(O({left:t,right:e,typeName:re.ZodIntersection},oe(r)));var ma=class ma extends le{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==U.array)return Z(i,{code:G.invalid_type,expected:U.array,received:i.parsedType}),Q;if(i.data.length<this._def.items.length)return Z(i,{code:G.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),Q;!this._def.rest&&i.data.length>this._def.items.length&&(Z(i,{code:G.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),r.dirty());let o=[...i.data].map((s,l)=>{let u=this._def.items[l]||this._def.rest;return u?u._parse(new Mt(i,s,i.path,l)):null}).filter(s=>!!s);return i.common.async?Promise.all(o).then(s=>nt.mergeArray(r,s)):nt.mergeArray(r,o)}get items(){return this._def.items}rest(e){return new ma(j(O({},this._def),{rest:e}))}};a(ma,"ZodTuple");var er=ma;er.create=(t,e)=>{if(!Array.isArray(t))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new er(O({items:t,typeName:re.ZodTuple,rest:null},oe(e)))};var vo=class vo extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==U.object)return Z(i,{code:G.invalid_type,expected:U.object,received:i.parsedType}),Q;let n=[],o=this._def.keyType,s=this._def.valueType;for(let l in i.data)n.push({key:o._parse(new Mt(i,l,i.path,l)),value:s._parse(new Mt(i,i.data[l],i.path,l)),alwaysSet:l in i.data});return i.common.async?nt.mergeObjectAsync(r,n):nt.mergeObjectSync(r,n)}get element(){return this._def.valueType}static create(e,r,i){return r instanceof le?new vo(O({keyType:e,valueType:r,typeName:re.ZodRecord},oe(i))):new vo(O({keyType:Zr.create(),valueType:e,typeName:re.ZodRecord},oe(r)))}};a(vo,"ZodRecord");var ua=vo,Nc=class Nc extends le{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==U.map)return Z(i,{code:G.invalid_type,expected:U.map,received:i.parsedType}),Q;let n=this._def.keyType,o=this._def.valueType,s=[...i.data.entries()].map(([l,u],h)=>({key:n._parse(new Mt(i,l,i.path,[h,"key"])),value:o._parse(new Mt(i,u,i.path,[h,"value"]))}));if(i.common.async){let l=new Map;return Promise.resolve().then(async()=>{for(let u of s){let h=await u.key,m=await u.value;if(h.status==="aborted"||m.status==="aborted")return Q;(h.status==="dirty"||m.status==="dirty")&&r.dirty(),l.set(h.value,m.value)}return{status:r.value,value:l}})}else{let l=new Map;for(let u of s){let h=u.key,m=u.value;if(h.status==="aborted"||m.status==="aborted")return Q;(h.status==="dirty"||m.status==="dirty")&&r.dirty(),l.set(h.value,m.value)}return{status:r.value,value:l}}}};a(Nc,"ZodMap");var Mn=Nc;Mn.create=(t,e,r)=>new Mn(O({valueType:e,keyType:t,typeName:re.ZodMap},oe(r)));var bo=class bo extends le{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.parsedType!==U.set)return Z(i,{code:G.invalid_type,expected:U.set,received:i.parsedType}),Q;let n=this._def;n.minSize!==null&&i.data.size<n.minSize.value&&(Z(i,{code:G.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),r.dirty()),n.maxSize!==null&&i.data.size>n.maxSize.value&&(Z(i,{code:G.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),r.dirty());let o=this._def.valueType;function s(u){let h=new Set;for(let m of u){if(m.status==="aborted")return Q;m.status==="dirty"&&r.dirty(),h.add(m.value)}return{status:r.value,value:h}}a(s,"finalizeSet");let l=[...i.data.values()].map((u,h)=>o._parse(new Mt(i,u,i.path,h)));return i.common.async?Promise.all(l).then(u=>s(u)):s(l)}min(e,r){return new bo(j(O({},this._def),{minSize:{value:e,message:V.toString(r)}}))}max(e,r){return new bo(j(O({},this._def),{maxSize:{value:e,message:V.toString(r)}}))}size(e,r){return this.min(e,r).max(e,r)}nonempty(e){return this.min(1,e)}};a(bo,"ZodSet");var In=bo;In.create=(t,e)=>new In(O({valueType:t,minSize:null,maxSize:null,typeName:re.ZodSet},oe(e)));var Pn=class Pn extends le{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==U.function)return Z(r,{code:G.invalid_type,expected:U.function,received:r.parsedType}),Q;function i(l,u){return fo({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xn(),gr].filter(h=>!!h),issueData:{code:G.invalid_arguments,argumentsError:u}})}a(i,"makeArgsIssue");function n(l,u){return fo({data:l,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,xn(),gr].filter(h=>!!h),issueData:{code:G.invalid_return_type,returnTypeError:u}})}a(n,"makeReturnsIssue");let o={errorMap:r.common.contextualErrorMap},s=r.data;if(this._def.returns instanceof jr){let l=this;return at(async function(...u){let h=new gt([]),m=await l._def.args.parseAsync(u,o).catch(y=>{throw h.addIssue(i(u,y)),h}),f=await Reflect.apply(s,this,m);return await l._def.returns._def.type.parseAsync(f,o).catch(y=>{throw h.addIssue(n(f,y)),h})})}else{let l=this;return at(function(...u){let h=l._def.args.safeParse(u,o);if(!h.success)throw new gt([i(u,h.error)]);let m=Reflect.apply(s,this,h.data),f=l._def.returns.safeParse(m,o);if(!f.success)throw new gt([n(m,f.error)]);return f.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Pn(j(O({},this._def),{args:er.create(e).rest(br.create())}))}returns(e){return new Pn(j(O({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,r,i){return new Pn(O({args:e||er.create([]).rest(br.create()),returns:r||br.create(),typeName:re.ZodFunction},oe(i)))}};a(Pn,"ZodFunction");var ha=Pn,Bc=class Bc extends le{get schema(){return this._def.getter()}_parse(e){let{ctx:r}=this._processInputParams(e);return this._def.getter()._parse({data:r.data,path:r.path,parent:r})}};a(Bc,"ZodLazy");var Ei=Bc;Ei.create=(t,e)=>new Ei(O({getter:t,typeName:re.ZodLazy},oe(e)));var Fc=class Fc extends le{_parse(e){if(e.data!==this._def.value){let r=this._getOrReturnCtx(e);return Z(r,{received:r.data,code:G.invalid_literal,expected:this._def.value}),Q}return{status:"valid",value:e.data}}get value(){return this._def.value}};a(Fc,"ZodLiteral");var Di=Fc;Di.create=(t,e)=>new Di(O({value:t,typeName:re.ZodLiteral},oe(e)));function Op(t,e){return new Oi(O({values:t,typeName:re.ZodEnum},oe(e)))}a(Op,"createZodEnum");var xo=class xo extends le{_parse(e){if(typeof e.data!="string"){let r=this._getOrReturnCtx(e),i=this._def.values;return Z(r,{expected:he.joinValues(i),received:r.parsedType,code:G.invalid_type}),Q}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let r=this._getOrReturnCtx(e),i=this._def.values;return Z(r,{received:r.data,code:G.invalid_enum_value,options:i}),Q}return at(e.data)}get options(){return this._def.values}get enum(){let e={};for(let r of this._def.values)e[r]=r;return e}get Values(){let e={};for(let r of this._def.values)e[r]=r;return e}get Enum(){let e={};for(let r of this._def.values)e[r]=r;return e}extract(e,r=this._def){return xo.create(e,O(O({},this._def),r))}exclude(e,r=this._def){return xo.create(this.options.filter(i=>!e.includes(i)),O(O({},this._def),r))}};a(xo,"ZodEnum");var Oi=xo;Oi.create=Op;var Gc=class Gc extends le{_parse(e){let r=he.getValidEnumValues(this._def.values),i=this._getOrReturnCtx(e);if(i.parsedType!==U.string&&i.parsedType!==U.number){let n=he.objectValues(r);return Z(i,{expected:he.joinValues(n),received:i.parsedType,code:G.invalid_type}),Q}if(this._cache||(this._cache=new Set(he.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=he.objectValues(r);return Z(i,{received:i.data,code:G.invalid_enum_value,options:n}),Q}return at(e.data)}get enum(){return this._def.values}};a(Gc,"ZodNativeEnum");var Li=Gc;Li.create=(t,e)=>new Li(O({values:t,typeName:re.ZodNativeEnum},oe(e)));var Xc=class Xc extends le{unwrap(){return this._def.type}_parse(e){let{ctx:r}=this._processInputParams(e);if(r.parsedType!==U.promise&&r.common.async===!1)return Z(r,{code:G.invalid_type,expected:U.promise,received:r.parsedType}),Q;let i=r.parsedType===U.promise?r.data:Promise.resolve(r.data);return at(i.then(n=>this._def.type.parseAsync(n,{path:r.path,errorMap:r.common.contextualErrorMap})))}};a(Xc,"ZodPromise");var jr=Xc;jr.create=(t,e)=>new jr(O({type:t,typeName:re.ZodPromise},oe(e)));var zc=class zc extends le{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===re.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:r,ctx:i}=this._processInputParams(e),n=this._def.effect||null,o={addIssue:a(s=>{Z(i,s),s.fatal?r.abort():r.dirty()},"addIssue"),get path(){return i.path}};if(o.addIssue=o.addIssue.bind(o),n.type==="preprocess"){let s=n.transform(i.data,o);if(i.common.async)return Promise.resolve(s).then(async l=>{if(r.value==="aborted")return Q;let u=await this._def.schema._parseAsync({data:l,path:i.path,parent:i});return u.status==="aborted"?Q:u.status==="dirty"?bi(u.value):r.value==="dirty"?bi(u.value):u});{if(r.value==="aborted")return Q;let l=this._def.schema._parseSync({data:s,path:i.path,parent:i});return l.status==="aborted"?Q:l.status==="dirty"?bi(l.value):r.value==="dirty"?bi(l.value):l}}if(n.type==="refinement"){let s=a(l=>{let u=n.refinement(l,o);if(i.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return l},"executeRefinement");if(i.common.async===!1){let l=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});return l.status==="aborted"?Q:(l.status==="dirty"&&r.dirty(),s(l.value),{status:r.value,value:l.value})}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(l=>l.status==="aborted"?Q:(l.status==="dirty"&&r.dirty(),s(l.value).then(()=>({status:r.value,value:l.value}))))}if(n.type==="transform")if(i.common.async===!1){let s=this._def.schema._parseSync({data:i.data,path:i.path,parent:i});if(!Yr(s))return Q;let l=n.transform(s.value,o);if(l instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:r.value,value:l}}else return this._def.schema._parseAsync({data:i.data,path:i.path,parent:i}).then(s=>Yr(s)?Promise.resolve(n.transform(s.value,o)).then(l=>({status:r.value,value:l})):Q);he.assertNever(n)}};a(zc,"ZodEffects");var It=zc;It.create=(t,e,r)=>new It(O({schema:t,typeName:re.ZodEffects,effect:e},oe(r)));It.createWithPreprocess=(t,e,r)=>new It(O({schema:e,effect:{type:"preprocess",transform:t},typeName:re.ZodEffects},oe(r)));var Yc=class Yc extends le{_parse(e){return this._getType(e)===U.undefined?at(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};a(Yc,"ZodOptional");var wt=Yc;wt.create=(t,e)=>new wt(O({innerType:t,typeName:re.ZodOptional},oe(e)));var Zc=class Zc extends le{_parse(e){return this._getType(e)===U.null?at(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};a(Zc,"ZodNullable");var tr=Zc;tr.create=(t,e)=>new tr(O({innerType:t,typeName:re.ZodNullable},oe(e)));var Uc=class Uc extends le{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return r.parsedType===U.undefined&&(i=this._def.defaultValue()),this._def.innerType._parse({data:i,path:r.path,parent:r})}removeDefault(){return this._def.innerType}};a(Uc,"ZodDefault");var Ai=Uc;Ai.create=(t,e)=>new Ai(O({innerType:t,typeName:re.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},oe(e)));var jc=class jc extends le{_parse(e){let{ctx:r}=this._processInputParams(e),i=j(O({},r),{common:j(O({},r.common),{issues:[]})}),n=this._def.innerType._parse({data:i.data,path:i.path,parent:O({},i)});return Sn(n)?n.then(o=>({status:"valid",value:o.status==="valid"?o.value:this._def.catchValue({get error(){return new gt(i.common.issues)},input:i.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new gt(i.common.issues)},input:i.data})}}removeCatch(){return this._def.innerType}};a(jc,"ZodCatch");var ki=jc;ki.create=(t,e)=>new ki(O({innerType:t,typeName:re.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},oe(e)));var Hc=class Hc extends le{_parse(e){if(this._getType(e)!==U.nan){let i=this._getOrReturnCtx(e);return Z(i,{code:G.invalid_type,expected:U.nan,received:i.parsedType}),Q}return{status:"valid",value:e.data}}};a(Hc,"ZodNaN");var En=Hc;En.create=t=>new En(O({typeName:re.ZodNaN},oe(t)));var yv=Symbol("zod_brand"),Wc=class Wc extends le{_parse(e){let{ctx:r}=this._processInputParams(e),i=r.data;return this._def.type._parse({data:i,path:r.path,parent:r})}unwrap(){return this._def.type}};a(Wc,"ZodBranded");var So=Wc,fa=class fa extends le{_parse(e){let{status:r,ctx:i}=this._processInputParams(e);if(i.common.async)return a(async()=>{let o=await this._def.in._parseAsync({data:i.data,path:i.path,parent:i});return o.status==="aborted"?Q:o.status==="dirty"?(r.dirty(),bi(o.value)):this._def.out._parseAsync({data:o.value,path:i.path,parent:i})},"handleAsync")();{let n=this._def.in._parseSync({data:i.data,path:i.path,parent:i});return n.status==="aborted"?Q:n.status==="dirty"?(r.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:i.path,parent:i})}}static create(e,r){return new fa({in:e,out:r,typeName:re.ZodPipeline})}};a(fa,"ZodPipeline");var Co=fa,Vc=class Vc extends le{_parse(e){let r=this._def.innerType._parse(e),i=a(n=>(Yr(n)&&(n.value=Object.freeze(n.value)),n),"freeze");return Sn(r)?r.then(n=>i(n)):i(r)}unwrap(){return this._def.innerType}};a(Vc,"ZodReadonly");var Ri=Vc;Ri.create=(t,e)=>new Ri(O({innerType:t,typeName:re.ZodReadonly},oe(e)));function Mp(t,e){let r=typeof t=="function"?t(e):typeof t=="string"?{message:t}:t;return typeof r=="string"?{message:r}:r}a(Mp,"cleanParams");function Lp(t,e={},r){return t?Ur.create().superRefine((i,n)=>{var s,l;let o=t(i);if(o instanceof Promise)return o.then(u=>{var h,m;if(!u){let f=Mp(e,i),b=(m=(h=f.fatal)!=null?h:r)!=null?m:!0;n.addIssue(j(O({code:"custom"},f),{fatal:b}))}});if(!o){let u=Mp(e,i),h=(l=(s=u.fatal)!=null?s:r)!=null?l:!0;n.addIssue(j(O({code:"custom"},u),{fatal:h}))}}):Ur.create()}a(Lp,"custom");var gv={object:vt.lazycreate},re;(function(t){t.ZodString="ZodString",t.ZodNumber="ZodNumber",t.ZodNaN="ZodNaN",t.ZodBigInt="ZodBigInt",t.ZodBoolean="ZodBoolean",t.ZodDate="ZodDate",t.ZodSymbol="ZodSymbol",t.ZodUndefined="ZodUndefined",t.ZodNull="ZodNull",t.ZodAny="ZodAny",t.ZodUnknown="ZodUnknown",t.ZodNever="ZodNever",t.ZodVoid="ZodVoid",t.ZodArray="ZodArray",t.ZodObject="ZodObject",t.ZodUnion="ZodUnion",t.ZodDiscriminatedUnion="ZodDiscriminatedUnion",t.ZodIntersection="ZodIntersection",t.ZodTuple="ZodTuple",t.ZodRecord="ZodRecord",t.ZodMap="ZodMap",t.ZodSet="ZodSet",t.ZodFunction="ZodFunction",t.ZodLazy="ZodLazy",t.ZodLiteral="ZodLiteral",t.ZodEnum="ZodEnum",t.ZodEffects="ZodEffects",t.ZodNativeEnum="ZodNativeEnum",t.ZodOptional="ZodOptional",t.ZodNullable="ZodNullable",t.ZodDefault="ZodDefault",t.ZodCatch="ZodCatch",t.ZodPromise="ZodPromise",t.ZodBranded="ZodBranded",t.ZodPipeline="ZodPipeline",t.ZodReadonly="ZodReadonly"})(re||(re={}));var vv=a((t,e={message:"Input not instance of ".concat(t.name)})=>Lp(r=>r instanceof t,e),"instanceOfType"),Ap=Zr.create,kp=Si.create,bv=En.create,xv=Ci.create,Rp=_i.create,Sv=Pi.create,Cv=Tn.create,_v=Ti.create,Pv=wi.create,Tv=Ur.create,wv=br.create,Mv=Ft.create,Iv=wn.create,Ev=xr.create,Dv=vt.create,Ov=vt.strictCreate,Lv=Mi.create,Av=ca.create,kv=Ii.create,Rv=er.create,Nv=ua.create,Bv=Mn.create,Fv=In.create,Gv=ha.create,Xv=Ei.create,zv=Di.create,Yv=Oi.create,Zv=Li.create,Uv=jr.create,jv=It.create,Hv=wt.create,Wv=tr.create,Vv=It.createWithPreprocess,qv=Co.create,$v=a(()=>Ap().optional(),"ostring"),Jv=a(()=>kp().optional(),"onumber"),Kv=a(()=>Rp().optional(),"oboolean"),Qv={string:a(t=>Zr.create(j(O({},t),{coerce:!0})),"string"),number:a(t=>Si.create(j(O({},t),{coerce:!0})),"number"),boolean:a(t=>_i.create(j(O({},t),{coerce:!0})),"boolean"),bigint:a(t=>Ci.create(j(O({},t),{coerce:!0})),"bigint"),date:a(t=>Pi.create(j(O({},t),{coerce:!0})),"date")};var eb=Q;var Np=I;var Hr=Np;var Bp=I.union([I.enum(["low","medium","high","always-visible"]),I.number()]),Fp=["","","low","medium","high","always-visible"],tb=2,rb=3;var Ni=5;function Gp(t){return Math.min(Ni,Math.max(tb,t))}a(Gp,"clampTierNumber");function Dn(t){if(typeof t=="number")return Gp(t);let e=Fp.indexOf(t);return e===-1?rb:e}a(Dn,"convertCollisionRankingTierToNumber");function _o(t){let e=Gp(t);return Fp[e]}a(_o,"convertNumberToCollisionRankingTier");function Xp(t,e,r){let i,n,o,s=null,l=0;r||(r={});let u=a(function(){l=r.leading===!1?0:Date.now(),s=null,o=t.apply(i,n),s||(i=n=null)},"later");return function(){let h=Date.now();!l&&r.leading===!1&&(l=h);let m=e-(h-l);return i=globalThis,n=arguments,m<=0||m>e?(s&&(clearTimeout(s),s=null),l=h,o=t.apply(i,n),s||(i=n=null)):!s&&r.trailing!==!1&&(s=setTimeout(u,m)),o}}a(Xp,"throttle");function zp(t){let e=t[0].map(r=>{let i=r[0].map(n=>({index:n[4],boundingBox:[n[0],n[1],n[2],n[3]]}));return{enabledAndVisible:r[1]===1,rank:r[2]===1?Ni:0,x:r[3],y:r[4],shouldCollideWithScreenEdges:r[5]===1,bboxes:i,lockedToStrategyIndex:r[6]}});return{msgId:"-1",totalWidth:t[3],totalHeight:t[2],watermarkWidth:t[4],watermarkHeight:t[5],watermarkPosition:t[6],colliders:e,devicePixelRatio:t[1]}}a(zp,"unpackMessage");v();v();var Wr=200,ya=10;function Yp(t,e,r,i,n,o,s="-1"){let l=1/0,u=1/0,h=-1/0,m=-1/0,f=new Se(-ya,0,5,r),b=new Se(-ya,0,e,5),y=new Se(e-5,0,e+ya,r),_=new Se(0,r-5,e,r+ya),T=ib(e,r,i,n,o),g=[f,b,y,_],x=new Se(-Wr,-Wr,e+Wr*2,r+Wr*2);for(let w of t){let k,A;for(let N=0;N<w.bboxes.length;N++){if(w.bboxes[N]==null||(k=w.bboxes[N].boundingBox,A=w.bboxes[N].index,w.lockedToStrategyIndex!==-1&&A!==w.lockedToStrategyIndex))continue;let[Y,z,X,q]=k,[F,J,pe,se]=[w.y-Y,w.y+z,w.x-X,w.x+q],De=pe,ve=F,ge=se-pe,xe=J-F;l=Math.min(l,De)-Wr,u=Math.min(u,ve)-Wr,h=Math.max(h,De+ge)+Wr,m=Math.max(m,ve+xe)+Wr,w.bboxes[N].boundingRect=new Se(De,ve,ge,xe)}}let P={msgId:s,colliders:new Array(t.length),debug:[]},S=new Tt(new Se(l,u,h-l,m-u)),C;for(let w=0;w<t.length;w++)if(C=t[w],P.colliders[w]=[-1,0],C.enabledAndVisible){let[k,A,N]=[1/0,-1,void 0];for(let{index:Y,boundingRect:z}of C.bboxes){if(z==null)continue;let X=[];if(X=S.queryRect(z).filter(F=>z.intersects(F)),C.shouldCollideWithScreenEdges&&g.forEach(F=>{z.intersects(F)&&X.push(F)}),z.intersects(T)){P.colliders[w]=[-1,0,z];break}if(X.length<=k&&(N=z,A=Y,k=X.length),X.length===0){S.insert(z),P.colliders[w]=[Y,x.contains(z)?0:1,z];break}}C.rank===Ni&&N!=null&&(S.insert(N),P.colliders[w]=[A,x.contains(N)?0:1,N])}else P.colliders[w]=[-1,0];return P}a(Yp,"processColliders");function ib(t,e,r,i,n){switch(n){case"top-right":return new Se(t-r,0,r,i);case"bottom-left":return new Se(0,e-i,r,i);case"bottom-right":return new Se(t-r,e-i,r,i);case"top-left":return new Se(0,0,r,i)}}a(ib,"getWatermarkBoundary");var qc=class qc{constructor(){p(this,"onerror",a(()=>{},"onerror"));p(this,"onmessage",a(()=>{},"onmessage"));p(this,"postMessage",a(e=>{let r=zp(e);this.onmessage({data:Yp(r.colliders,r.totalWidth,r.totalHeight,r.watermarkWidth,r.watermarkHeight,r.watermarkPosition,r.msgId)})},"postMessage"));p(this,"terminate",a(()=>{},"terminate"))}};a(qc,"SyncWorker");var Po=qc;v();v();v();function ga(t){"@babel/helpers - typeof";return ga=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ga(t)}a(ga,"_typeof");var nb=/^\s+/,ob=/\s+$/;function W(t,e){if(t=t||"",e=e||{},t instanceof W)return t;if(!(this instanceof W))return new W(t,e);var r=sb(t);this._originalInput=t,this._r=r.r,this._g=r.g,this._b=r.b,this._a=r.a,this._roundA=Math.round(100*this._a)/100,this._format=e.format||r.format,this._gradientType=e.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=r.ok}a(W,"tinycolor");W.prototype={isDark:a(function(){return this.getBrightness()<128},"isDark"),isLight:a(function(){return!this.isDark()},"isLight"),isValid:a(function(){return this._ok},"isValid"),getOriginalInput:a(function(){return this._originalInput},"getOriginalInput"),getFormat:a(function(){return this._format},"getFormat"),getAlpha:a(function(){return this._a},"getAlpha"),getBrightness:a(function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},"getBrightness"),getLuminance:a(function(){var e=this.toRgb(),r,i,n,o,s,l;return r=e.r/255,i=e.g/255,n=e.b/255,r<=.03928?o=r/12.92:o=Math.pow((r+.055)/1.055,2.4),i<=.03928?s=i/12.92:s=Math.pow((i+.055)/1.055,2.4),n<=.03928?l=n/12.92:l=Math.pow((n+.055)/1.055,2.4),.2126*o+.7152*s+.0722*l},"getLuminance"),setAlpha:a(function(e){return this._a=qp(e),this._roundA=Math.round(100*this._a)/100,this},"setAlpha"),toHsv:a(function(){var e=Up(this._r,this._g,this._b);return{h:e.h*360,s:e.s,v:e.v,a:this._a}},"toHsv"),toHsvString:a(function(){var e=Up(this._r,this._g,this._b),r=Math.round(e.h*360),i=Math.round(e.s*100),n=Math.round(e.v*100);return this._a==1?"hsv("+r+", "+i+"%, "+n+"%)":"hsva("+r+", "+i+"%, "+n+"%, "+this._roundA+")"},"toHsvString"),toHsl:a(function(){var e=Zp(this._r,this._g,this._b);return{h:e.h*360,s:e.s,l:e.l,a:this._a}},"toHsl"),toHslString:a(function(){var e=Zp(this._r,this._g,this._b),r=Math.round(e.h*360),i=Math.round(e.s*100),n=Math.round(e.l*100);return this._a==1?"hsl("+r+", "+i+"%, "+n+"%)":"hsla("+r+", "+i+"%, "+n+"%, "+this._roundA+")"},"toHslString"),toHex:a(function(e){return jp(this._r,this._g,this._b,e)},"toHex"),toHexString:a(function(e){return"#"+this.toHex(e)},"toHexString"),toHex8:a(function(e){return ub(this._r,this._g,this._b,this._a,e)},"toHex8"),toHex8String:a(function(e){return"#"+this.toHex8(e)},"toHex8String"),toRgb:a(function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},"toRgb"),toRgbString:a(function(){return this._a==1?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},"toRgbString"),toPercentageRgb:a(function(){return{r:Math.round(Ae(this._r,255)*100)+"%",g:Math.round(Ae(this._g,255)*100)+"%",b:Math.round(Ae(this._b,255)*100)+"%",a:this._a}},"toPercentageRgb"),toPercentageRgbString:a(function(){return this._a==1?"rgb("+Math.round(Ae(this._r,255)*100)+"%, "+Math.round(Ae(this._g,255)*100)+"%, "+Math.round(Ae(this._b,255)*100)+"%)":"rgba("+Math.round(Ae(this._r,255)*100)+"%, "+Math.round(Ae(this._g,255)*100)+"%, "+Math.round(Ae(this._b,255)*100)+"%, "+this._roundA+")"},"toPercentageRgbString"),toName:a(function(){return this._a===0?"transparent":this._a<1?!1:Cb[jp(this._r,this._g,this._b,!0)]||!1},"toName"),toFilter:a(function(e){var r="#"+Hp(this._r,this._g,this._b,this._a),i=r,n=this._gradientType?"GradientType = 1, ":"";if(e){var o=W(e);i="#"+Hp(o._r,o._g,o._b,o._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+r+",endColorstr="+i+")"},"toFilter"),toString:a(function(e){var r=!!e;e=e||this._format;var i=!1,n=this._a<1&&this._a>=0,o=!r&&n&&(e==="hex"||e==="hex6"||e==="hex3"||e==="hex4"||e==="hex8"||e==="name");return o?e==="name"&&this._a===0?this.toName():this.toRgbString():(e==="rgb"&&(i=this.toRgbString()),e==="prgb"&&(i=this.toPercentageRgbString()),(e==="hex"||e==="hex6")&&(i=this.toHexString()),e==="hex3"&&(i=this.toHexString(!0)),e==="hex4"&&(i=this.toHex8String(!0)),e==="hex8"&&(i=this.toHex8String()),e==="name"&&(i=this.toName()),e==="hsl"&&(i=this.toHslString()),e==="hsv"&&(i=this.toHsvString()),i||this.toHexString())},"toString"),clone:a(function(){return W(this.toString())},"clone"),_applyModification:a(function(e,r){var i=e.apply(null,[this].concat([].slice.call(r)));return this._r=i._r,this._g=i._g,this._b=i._b,this.setAlpha(i._a),this},"_applyModification"),lighten:a(function(){return this._applyModification(mb,arguments)},"lighten"),brighten:a(function(){return this._applyModification(fb,arguments)},"brighten"),darken:a(function(){return this._applyModification(yb,arguments)},"darken"),desaturate:a(function(){return this._applyModification(hb,arguments)},"desaturate"),saturate:a(function(){return this._applyModification(db,arguments)},"saturate"),greyscale:a(function(){return this._applyModification(pb,arguments)},"greyscale"),spin:a(function(){return this._applyModification(gb,arguments)},"spin"),_applyCombination:a(function(e,r){return e.apply(null,[this].concat([].slice.call(r)))},"_applyCombination"),analogous:a(function(){return this._applyCombination(xb,arguments)},"analogous"),complement:a(function(){return this._applyCombination(vb,arguments)},"complement"),monochromatic:a(function(){return this._applyCombination(Sb,arguments)},"monochromatic"),splitcomplement:a(function(){return this._applyCombination(bb,arguments)},"splitcomplement"),triad:a(function(){return this._applyCombination(Wp,[3])},"triad"),tetrad:a(function(){return this._applyCombination(Wp,[4])},"tetrad")};W.fromRatio=function(t,e){if(ga(t)=="object"){var r={};for(var i in t)t.hasOwnProperty(i)&&(i==="a"?r[i]=t[i]:r[i]=To(t[i]));t=r}return W(t,e)};function sb(t){var e={r:0,g:0,b:0},r=1,i=null,n=null,o=null,s=!1,l=!1;return typeof t=="string"&&(t=wb(t)),ga(t)=="object"&&(Sr(t.r)&&Sr(t.g)&&Sr(t.b)?(e=ab(t.r,t.g,t.b),s=!0,l=String(t.r).substr(-1)==="%"?"prgb":"rgb"):Sr(t.h)&&Sr(t.s)&&Sr(t.v)?(i=To(t.s),n=To(t.v),e=cb(t.h,i,n),s=!0,l="hsv"):Sr(t.h)&&Sr(t.s)&&Sr(t.l)&&(i=To(t.s),o=To(t.l),e=lb(t.h,i,o),s=!0,l="hsl"),t.hasOwnProperty("a")&&(r=t.a)),r=qp(r),{ok:s,format:t.format||l,r:Math.min(255,Math.max(e.r,0)),g:Math.min(255,Math.max(e.g,0)),b:Math.min(255,Math.max(e.b,0)),a:r}}a(sb,"inputToRGB");function ab(t,e,r){return{r:Ae(t,255)*255,g:Ae(e,255)*255,b:Ae(r,255)*255}}a(ab,"rgbToRgb");function Zp(t,e,r){t=Ae(t,255),e=Ae(e,255),r=Ae(r,255);var i=Math.max(t,e,r),n=Math.min(t,e,r),o,s,l=(i+n)/2;if(i==n)o=s=0;else{var u=i-n;switch(s=l>.5?u/(2-i-n):u/(i+n),i){case t:o=(e-r)/u+(e<r?6:0);break;case e:o=(r-t)/u+2;break;case r:o=(t-e)/u+4;break}o/=6}return{h:o,s,l}}a(Zp,"rgbToHsl");function lb(t,e,r){var i,n,o;t=Ae(t,360),e=Ae(e,100),r=Ae(r,100);function s(h,m,f){return f<0&&(f+=1),f>1&&(f-=1),f<1/6?h+(m-h)*6*f:f<1/2?m:f<2/3?h+(m-h)*(2/3-f)*6:h}if(a(s,"hue2rgb"),e===0)i=n=o=r;else{var l=r<.5?r*(1+e):r+e-r*e,u=2*r-l;i=s(u,l,t+1/3),n=s(u,l,t),o=s(u,l,t-1/3)}return{r:i*255,g:n*255,b:o*255}}a(lb,"hslToRgb");function Up(t,e,r){t=Ae(t,255),e=Ae(e,255),r=Ae(r,255);var i=Math.max(t,e,r),n=Math.min(t,e,r),o,s,l=i,u=i-n;if(s=i===0?0:u/i,i==n)o=0;else{switch(i){case t:o=(e-r)/u+(e<r?6:0);break;case e:o=(r-t)/u+2;break;case r:o=(t-e)/u+4;break}o/=6}return{h:o,s,v:l}}a(Up,"rgbToHsv");function cb(t,e,r){t=Ae(t,360)*6,e=Ae(e,100),r=Ae(r,100);var i=Math.floor(t),n=t-i,o=r*(1-e),s=r*(1-n*e),l=r*(1-(1-n)*e),u=i%6,h=[r,s,o,o,l,r][u],m=[l,r,r,s,o,o][u],f=[o,o,l,r,r,s][u];return{r:h*255,g:m*255,b:f*255}}a(cb,"hsvToRgb");function jp(t,e,r,i){var n=[Xt(Math.round(t).toString(16)),Xt(Math.round(e).toString(16)),Xt(Math.round(r).toString(16))];return i&&n[0].charAt(0)==n[0].charAt(1)&&n[1].charAt(0)==n[1].charAt(1)&&n[2].charAt(0)==n[2].charAt(1)?n[0].charAt(0)+n[1].charAt(0)+n[2].charAt(0):n.join("")}a(jp,"rgbToHex");function ub(t,e,r,i,n){var o=[Xt(Math.round(t).toString(16)),Xt(Math.round(e).toString(16)),Xt(Math.round(r).toString(16)),Xt($p(i))];return n&&o[0].charAt(0)==o[0].charAt(1)&&o[1].charAt(0)==o[1].charAt(1)&&o[2].charAt(0)==o[2].charAt(1)&&o[3].charAt(0)==o[3].charAt(1)?o[0].charAt(0)+o[1].charAt(0)+o[2].charAt(0)+o[3].charAt(0):o.join("")}a(ub,"rgbaToHex");function Hp(t,e,r,i){var n=[Xt($p(i)),Xt(Math.round(t).toString(16)),Xt(Math.round(e).toString(16)),Xt(Math.round(r).toString(16))];return n.join("")}a(Hp,"rgbaToArgbHex");W.equals=function(t,e){return!t||!e?!1:W(t).toRgbString()==W(e).toRgbString()};W.random=function(){return W.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})};function hb(t,e){e=e===0?0:e||10;var r=W(t).toHsl();return r.s-=e/100,r.s=va(r.s),W(r)}a(hb,"_desaturate");function db(t,e){e=e===0?0:e||10;var r=W(t).toHsl();return r.s+=e/100,r.s=va(r.s),W(r)}a(db,"_saturate");function pb(t){return W(t).desaturate(100)}a(pb,"_greyscale");function mb(t,e){e=e===0?0:e||10;var r=W(t).toHsl();return r.l+=e/100,r.l=va(r.l),W(r)}a(mb,"_lighten");function fb(t,e){e=e===0?0:e||10;var r=W(t).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(255*-(e/100)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(255*-(e/100)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(255*-(e/100)))),W(r)}a(fb,"_brighten");function yb(t,e){e=e===0?0:e||10;var r=W(t).toHsl();return r.l-=e/100,r.l=va(r.l),W(r)}a(yb,"_darken");function gb(t,e){var r=W(t).toHsl(),i=(r.h+e)%360;return r.h=i<0?360+i:i,W(r)}a(gb,"_spin");function vb(t){var e=W(t).toHsl();return e.h=(e.h+180)%360,W(e)}a(vb,"_complement");function Wp(t,e){if(isNaN(e)||e<=0)throw new Error("Argument to polyad must be a positive number");for(var r=W(t).toHsl(),i=[W(t)],n=360/e,o=1;o<e;o++)i.push(W({h:(r.h+o*n)%360,s:r.s,l:r.l}));return i}a(Wp,"polyad");function bb(t){var e=W(t).toHsl(),r=e.h;return[W(t),W({h:(r+72)%360,s:e.s,l:e.l}),W({h:(r+216)%360,s:e.s,l:e.l})]}a(bb,"_splitcomplement");function xb(t,e,r){e=e||6,r=r||30;var i=W(t).toHsl(),n=360/r,o=[W(t)];for(i.h=(i.h-(n*e>>1)+720)%360;--e;)i.h=(i.h+n)%360,o.push(W(i));return o}a(xb,"_analogous");function Sb(t,e){e=e||6;for(var r=W(t).toHsv(),i=r.h,n=r.s,o=r.v,s=[],l=1/e;e--;)s.push(W({h:i,s:n,v:o})),o=(o+l)%1;return s}a(Sb,"_monochromatic");W.mix=function(t,e,r){r=r===0?0:r||50;var i=W(t).toRgb(),n=W(e).toRgb(),o=r/100,s={r:(n.r-i.r)*o+i.r,g:(n.g-i.g)*o+i.g,b:(n.b-i.b)*o+i.b,a:(n.a-i.a)*o+i.a};return W(s)};W.readability=function(t,e){var r=W(t),i=W(e);return(Math.max(r.getLuminance(),i.getLuminance())+.05)/(Math.min(r.getLuminance(),i.getLuminance())+.05)};W.isReadable=function(t,e,r){var i=W.readability(t,e),n,o;switch(o=!1,n=Mb(r),n.level+n.size){case"AAsmall":case"AAAlarge":o=i>=4.5;break;case"AAlarge":o=i>=3;break;case"AAAsmall":o=i>=7;break}return o};W.mostReadable=function(t,e,r){var i=null,n=0,o,s,l,u;r=r||{},s=r.includeFallbackColors,l=r.level,u=r.size;for(var h=0;h<e.length;h++)o=W.readability(t,e[h]),o>n&&(n=o,i=W(e[h]));return W.isReadable(t,i,{level:l,size:u})||!s?i:(r.includeFallbackColors=!1,W.mostReadable(t,["#fff","#000"],r))};var $c=W.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee90",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},Cb=W.hexNames=_b($c);function _b(t){var e={};for(var r in t)t.hasOwnProperty(r)&&(e[t[r]]=r);return e}a(_b,"flip");function qp(t){return t=parseFloat(t),(isNaN(t)||t<0||t>1)&&(t=1),t}a(qp,"boundAlpha");function Ae(t,e){Pb(t)&&(t="100%");var r=Tb(t);return t=Math.min(e,Math.max(0,parseFloat(t))),r&&(t=parseInt(t*e,10)/100),Math.abs(t-e)<1e-6?1:t%e/parseFloat(e)}a(Ae,"bound01");function va(t){return Math.min(1,Math.max(0,t))}a(va,"clamp01");function Ct(t){return parseInt(t,16)}a(Ct,"parseIntFromHex");function Pb(t){return typeof t=="string"&&t.indexOf(".")!=-1&&parseFloat(t)===1}a(Pb,"isOnePointZero");function Tb(t){return typeof t=="string"&&t.indexOf("%")!=-1}a(Tb,"isPercentage");function Xt(t){return t.length==1?"0"+t:""+t}a(Xt,"pad2");function To(t){return t<=1&&(t=t*100+"%"),t}a(To,"convertToPercentage");function $p(t){return Math.round(parseFloat(t)*255).toString(16)}a($p,"convertDecimalToHex");function Vp(t){return Ct(t)/255}a(Vp,"convertHexToDecimal");var Gt=function(){var t="[-\\+]?\\d+%?",e="[-\\+]?\\d*\\.\\d+%?",r="(?:"+e+")|(?:"+t+")",i="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?",n="[\\s|\\(]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")[,|\\s]+("+r+")\\s*\\)?";return{CSS_UNIT:new RegExp(r),rgb:new RegExp("rgb"+i),rgba:new RegExp("rgba"+n),hsl:new RegExp("hsl"+i),hsla:new RegExp("hsla"+n),hsv:new RegExp("hsv"+i),hsva:new RegExp("hsva"+n),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/}}();function Sr(t){return!!Gt.CSS_UNIT.exec(t)}a(Sr,"isValidCSSUnit");function wb(t){t=t.replace(nb,"").replace(ob,"").toLowerCase();var e=!1;if($c[t])t=$c[t],e=!0;else if(t=="transparent")return{r:0,g:0,b:0,a:0,format:"name"};var r;return(r=Gt.rgb.exec(t))?{r:r[1],g:r[2],b:r[3]}:(r=Gt.rgba.exec(t))?{r:r[1],g:r[2],b:r[3],a:r[4]}:(r=Gt.hsl.exec(t))?{h:r[1],s:r[2],l:r[3]}:(r=Gt.hsla.exec(t))?{h:r[1],s:r[2],l:r[3],a:r[4]}:(r=Gt.hsv.exec(t))?{h:r[1],s:r[2],v:r[3]}:(r=Gt.hsva.exec(t))?{h:r[1],s:r[2],v:r[3],a:r[4]}:(r=Gt.hex8.exec(t))?{r:Ct(r[1]),g:Ct(r[2]),b:Ct(r[3]),a:Vp(r[4]),format:e?"name":"hex8"}:(r=Gt.hex6.exec(t))?{r:Ct(r[1]),g:Ct(r[2]),b:Ct(r[3]),format:e?"name":"hex"}:(r=Gt.hex4.exec(t))?{r:Ct(r[1]+""+r[1]),g:Ct(r[2]+""+r[2]),b:Ct(r[3]+""+r[3]),a:Vp(r[4]+""+r[4]),format:e?"name":"hex8"}:(r=Gt.hex3.exec(t))?{r:Ct(r[1]+""+r[1]),g:Ct(r[2]+""+r[2]),b:Ct(r[3]+""+r[3]),format:e?"name":"hex"}:!1}a(wb,"stringInputToObject");function Mb(t){var e,r;return t=t||{level:"AA",size:"small"},e=(t.level||"AA").toUpperCase(),r=(t.size||"small").toLowerCase(),e!=="AA"&&e!=="AAA"&&(e="AA"),r!=="small"&&r!=="large"&&(r="small"),{level:e,size:r}}a(Mb,"validateWCAG2Parms");v();v();var Jc=class Jc{constructor(){p(this,"hover",!1);p(this,"dirty",!1)}};a(Jc,"InteractionComponent");var On=Jc;v();var Fm=Ns(Mm());v();v();v();var bx=Hr.enum(ep),xx=a(t=>{let e=t[0];for(let r=1;r<t.length;r++){let i=t[r];if(i<=e)return!1;e=i}return!0},"isStrictlyIncreasing"),Sx=a(t=>{let e=t[0];for(let r=1;r<t.length;r++){let i=t[r];if(i>=e)return!1;e=i}return!0},"isStrictlyDecreasing"),Cx=a(t=>xx(t)||Sx(t),"isStrictlyIncreasingOrDecreasing"),Im=Hr.object({on:Hr.literal("zoom-level"),input:Hr.array(Hr.number()).nonempty().refine(Cx,{message:"input array must be strictly increasing or decreasing"}),output:Hr.array(Hr.number()).nonempty(),easing:bx.default("linear")}).refine(t=>t.input.length===t.output.length,{message:"input and output must have the same length"});var Em=I.object({margin:I.number().min(6).default(6),maxLines:I.number().min(1).default(2),textSize:I.number().min(0).default(11.5),maxWidth:I.number().min(0).default(150),lineHeight:I.number().min(0).default(1.2),color:I.string().default("#333"),outlineColor:I.string().default("white"),textColor:I.string().optional(),textOutlineColor:I.string().optional(),pinColor:I.string().optional(),pinOutlineColor:I.string().optional(),pinColorInactive:I.string().optional(),pinOutlineColorInactive:I.string().optional(),icon:I.string().optional(),iconSize:I.number().min(0).default(20),iconScale:I.union([I.number(),Im]).default(1),iconPadding:I.number().min(0).default(2),iconFit:I.enum(["fill","contain","cover"]).default("cover"),iconOverflow:I.enum(["visible","hidden"]).default("hidden"),iconVisibleAtZoomLevel:I.number().default(-1/0)}),Dm=Em.transform(t=>{var e,r,i,n,o,s,l,u;return j(O({},t),{textColor:(e=t.textColor)!=null?e:t.color,textOutlineColor:(r=t.textOutlineColor)!=null?r:t.outlineColor,pinColor:(i=t.pinColor)!=null?i:t.color,pinOutlineColor:(n=t.pinOutlineColor)!=null?n:t.outlineColor,pinColorInactive:(s=t.pinColorInactive)!=null?s:W((o=t.pinColor)!=null?o:t.color).setAlpha(.5).toRgbString(),pinOutlineColorInactive:(u=t.pinOutlineColorInactive)!=null?u:W((l=t.pinOutlineColor)!=null?l:t.outlineColor).setAlpha(.5).toRgbString()})}),AI=Em.strict(),Om=a(t=>Dm.parse(t),"parseLabelAppearance"),_x=I.object({rank:Bp.optional(),appearance:Dm.optional(),interactive:I.boolean().default(!1)}),cu=a(t=>{_x.parse(t!=null?t:{})},"validateLabelOptions"),Lm=a((t,e,r)=>{I.array(I.number()).min(2).max(3).parse(t),I.string().parse(e),cu(r)},"validateLabel"),Am=["color","outlineColor","margin"],Px=[...Am,"maxLines","lineHeight","textSize","maxWidth","textColor","textOutlineColor"],Tx=[...Am,"icon","pinColor","pinOutlineColor","pinColorInactive","pinOutlineColorInactive"],km=a((t,e)=>Px.some(r=>e[r]!=null&&t[r]!==e[r]),"isOneOfTextDirtyOptions"),Rm=a((t,e)=>Tx.some(r=>e[r]!=null&&t[r]!==e[r]),"isOneOfPinDirtyOptions");var Ix="LOW_PRIORITY",Nm=4,Ex=6,Bm=6.5,Dx={heightAbovePolygon:0},Gi=class Gi{constructor(e,r,i){p(this,"lines",0);p(this,"id");p(this,"rank");p(this,"type","label");p(this,"initialRank");p(this,"contextConfigured",!1);p(this,"fillText");p(this,"newStyle",{});p(this,"opacity",0);p(this,"visibilityNeedsUpdate",!1);p(this,"text");p(this,"style",{top:0,left:0,textLabelVisible:!0,pinVisibility:1,textAlign:"left"});p(this,"projection",new ae);p(this,"labelCacheId");p(this,"_cache",{});p(this,"appearance");p(this,"options");p(this,"visible",!0);p(this,"enabled",!0);p(this,"isOccluded",!1);p(this,"offscreen",!1);p(this,"canShow",!1);p(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});p(this,"dimensions",{width:0,height:0});p(this,"currentStrategyIndex",-1);p(this,"totalMarkerSize",0);p(this,"iconScale",1);p(this,"iconPadding");p(this,"dirty",!0);p(this,"textDirty",!0);p(this,"markerDirty",!0);p(this,"attachedDirty",!0);p(this,"collisionDirty",!0);p(this,"lastTextAlign");p(this,"imageHash");p(this,"markerSize",0);p(this,"iconVisible",!1);p(this,"dp");p(this,"animate",!0);p(this,"onStrategySelected",a(e=>{if(this.currentStrategyIndex===e)return;this.currentStrategyIndex=e;let r=this.strategies[this.currentStrategyIndex];if(r){r.onStrategySelected();let i=this.style;this.style=this.newStyle,this.newStyle=i}},"onStrategySelected"));p(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],shouldCollideWithScreenEdges:!1,lockedToStrategyIndex:-1});var o,s;if(this.id=(o=r.id)!=null?o:Jt(),this.options=(0,Fm.default)({},r,Dx),this.text=e,this.dp=(l=1)=>l*i.pixelRatio,typeof r.rank=="string")this.rank=Dn(r.rank),this.initialRank=this.rank;else if(r.rank!=null&&r.rank>0)this.rank=r.rank,this.initialRank=r.rank;else{let l=Math.trunc(E.env.NODE_ENV==="test"?Gi.testId:Gi.testId*10)/10;Gi.testId+=.001,this.rank=l,this.initialRank=l}let n=Om((s=r.appearance)!=null?s:{});this.appearance=n,this.iconPadding=n.iconPadding}get scaledMarkerSize(){return this.totalMarkerSize*this.iconScale}get scaledIconPadding(){return this.appearance.iconPadding*this.iconScale}setEntity(){}calculateMarkerSize(){let e=this.dp();this.iconVisible&&typeof this.appearance.iconSize<"u"&&this.imageHash?this.markerSize=this.dp(this.appearance.iconSize):this.markerSize=this.dp(Bm),this.totalMarkerSize=Math.ceil((this.markerSize+2.5)/e)}get lowPriorityStrategyIndex(){return this.text===""?-1:3}get strategies(){let{width:e,height:r}=this.dimensions,{margin:i}=this.appearance,n=Math.max(Ex,i),o=this.iconVisible?n/2:0,s=this.iconVisible?this.scaledMarkerSize:Bm/2,l=[{name:"RIGHT",getBoundingBox:a(()=>{let u=Math.max(this.scaledMarkerSize,r);return[u/2+n,u/2+n,this.scaledMarkerSize/2+n,this.scaledMarkerSize/2+e+n]},"getBoundingBox"),onStrategySelected:a(()=>{this.newStyle.textAlign="left",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=this.scaledMarkerSize/2+Nm,this.newStyle.textLabelVisible=!0},"onStrategySelected")},{name:"LEFT",getBoundingBox:a(()=>{let u=Math.max(this.scaledMarkerSize,r);return[u/2+n,u/2+n,this.scaledMarkerSize/2+e+n,this.scaledMarkerSize/2+n]},"getBoundingBox"),onStrategySelected:a(()=>{this.newStyle.textAlign="right",this.newStyle.pinVisibility=1,this.newStyle.top=-r/2,this.newStyle.left=-e-this.scaledMarkerSize/2-Nm,this.newStyle.textLabelVisible=!0},"onStrategySelected")},{name:"TOP",getBoundingBox:a(()=>{let u=this.dp();return[r+this.scaledMarkerSize/2/u+n,this.scaledMarkerSize/2+n,e/2+n,e/2+n]},"getBoundingBox"),onStrategySelected:a(()=>{this.newStyle.pinVisibility=1,this.newStyle.textAlign="center",this.newStyle.textLabelVisible=!0,this.newStyle.top=-r-this.scaledMarkerSize/2,this.newStyle.left=-e/2},"onStrategySelected")},{name:Ix,getBoundingBox:a(()=>[s+o,s+o,s+o,s+o],"getBoundingBox"),onStrategySelected:a(()=>{this.newStyle.pinVisibility=.5,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0},"onStrategySelected")}];return this.text===""?[{name:"ICON_ONLY",getBoundingBox:a(()=>[this.scaledMarkerSize/2+n,this.scaledMarkerSize/2+n,this.scaledMarkerSize/2+n,this.scaledMarkerSize/2+n],"getBoundingBox"),onStrategySelected:a(()=>{this.newStyle.pinVisibility=1,this.newStyle.textLabelVisible=!1,this.newStyle.top=0,this.newStyle.left=0},"onStrategySelected")}]:l}recomputeCurrentStrategy(e=this.iconScale){if(this.iconScale!==e||this.dirty){let r=this.strategies[this.currentStrategyIndex];if(this.iconScale=e,this.collisionDirty=!0,r){r.onStrategySelected(e);let i=this.style;this.style=this.newStyle,this.newStyle=i}this.dirty=!1}}updatePosition(){}disable(){this.visible=!1}toPackedMessage(e=!1){var r;if(this.visible&&e&&this.collisionDirty===!1&&this.currentStrategyIndex!=null&&this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityStrategyIndex?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityStrategyIndex&&this.currentStrategyIndex!==((r=this.packedMessage.bboxes[0])==null?void 0:r[4])){let i=this.packedMessage.bboxes.findIndex(n=>n[4]===this.currentStrategyIndex);if(i!==-1){let n=this.packedMessage.bboxes.splice(i,1)[0];this.packedMessage.bboxes.unshift(n)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let i=0;i<this.strategies.length;i++){let n=this.strategies[i];i===this.currentStrategyIndex&&this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityStrategyIndex?this.packedMessage.bboxes.unshift([...n.getBoundingBox(),i]):this.packedMessage.bboxes.push([...n.getBoundingBox(),i])}return this.packedMessage.shouldCollideWithScreenEdges=!1,this.collisionDirty=!1,this.packedMessage}destroy(){}};a(Gi,"LabelComponent"),p(Gi,"testId",0);var uu=Gi,rr=uu;v();var yf=Ns(mf());var No=4,_C=8,PC="0.6",ff="low-priority-pin",Cu=I.object({rank:I.union([I.enum(["low","medium","high","always-visible"]),I.number()]).optional(),interactive:I.union([I.boolean(),I.literal("pointer-events-auto")]).optional(),id:I.string().optional(),placement:I.union([I.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]),I.array(I.enum(["top","bottom","left","right","center","top-left","top-right","bottom-left","bottom-right"]))]).optional(),dynamicResize:I.boolean().optional(),zIndex:I.number().optional(),lowPriorityPin:I.object({enabled:I.boolean().optional(),size:I.number().positive().optional(),color:I.string().optional()}).optional()});function gf(t,e,r){I.array(I.number()).min(2).max(3).parse(t),I.string().parse(e),Cu.parse(r)}a(gf,"validateMarker");var TC=Object.freeze({enabled:!0,size:_C,color:"#666"}),Zi=class Zi{constructor(e,r={}){p(this,"id");p(this,"type","marker");p(this,"rank",0);p(this,"initialRank",0);p(this,"activePlacement","center");p(this,"pointerEvents","none");p(this,"options",{rank:"low",interactive:!1,id:"",placement:"center",dynamicResize:!1,occluderId:0,zIndex:void 0,verticalOffset:0,lowPriorityPin:O({},TC)});p(this,"projection",new ae);p(this,"enabled",!0);p(this,"canShow",!1);p(this,"visible",!0);p(this,"isOccluded",!1);p(this,"offscreen",!1);p(this,"strategyIndex",-1);p(this,"activeBoundingBox",{x:0,y:0,w:0,h:0});p(this,"dimensions",{width:0,height:0});p(this,"markerContainer");p(this,"containerEl");p(this,"contentEl",null);p(this,"contentHtml","");p(this,"style",{top:"0px",left:"0px"});p(this,"dirty",!1);p(this,"attachedDirty",!0);p(this,"collisionDirty",!0);p(this,"visibilityNeedsUpdate","show");p(this,"animation",null);p(this,"currentStrategyIndex",-1);p(this,"onStrategySelected",a((e,r=!1)=>{var n,o;if(this.currentStrategyIndex===e&&!r)return;if(this.currentStrategyIndex=e,e===this.lowPriorityPinStrategyIndex){this.activePlacement="center",this.markerContainer.setAttribute("data-placement",ff);let s=this.options.lowPriorityPin,l=s.size,u=s.color;this.markerContainer.style.setProperty("--mappedin-pin-size","".concat(l,"px")),this.markerContainer.style.setProperty("--pin-color",u),this.markerContainer.style.opacity=PC,this.style.top=-l/2+"px",this.style.left=-l/2+"px"}else{this.activePlacement=(o=(n=this.strategies[e])==null?void 0:n.name)!=null?o:"center",this.markerContainer.setAttribute("data-placement",this.activePlacement),this.markerContainer.style.removeProperty("--mappedin-pin-size"),this.markerContainer.style.removeProperty("--pin-color"),this.markerContainer.style.opacity="1";let{width:s,height:l}=this.dimensions,u=-l/2+"px",h=-s/2+"px";switch(this.style.top=u,this.style.left=h,this.activePlacement){case"top":{this.style.top=-l+"px";break}case"bottom":{this.style.top="0px";break}case"left":{this.style.left=-s+"px";break}case"right":{this.style.left="0px";break}case"top-left":{this.style.top=-l+"px",this.style.left=-s+"px";break}case"top-right":{this.style.top=-l+"px",this.style.left="0px";break}case"bottom-left":{this.style.top="0px",this.style.left=-s+"px";break}case"bottom-right":{this.style.top="0px",this.style.left="0px";break}default:this.style.top=u,this.style.left=h}}this.markerContainer.style.top=this.style.top,this.markerContainer.style.left=this.style.left},"onStrategySelected"));p(this,"packedMessage",{x:0,y:0,enabled:!1,rank:0,bboxes:[],lockedToStrategyIndex:-1,shouldCollideWithScreenEdges:!1});var i,n,o;if(this.id=(r==null?void 0:r.id)||Jt(),this.options=(0,yf.default)(this.options,r),typeof r.rank=="string")this.rank=Dn(r.rank);else if(r.rank!=null&&r.rank>0)this.rank=r.rank;else{let s=Math.trunc(E.env.NODE_ENV==="test"?Zi.testId:Zi.testId*10)/10;Zi.testId+=.001,this.rank=s}typeof r.interactive=="string"&&(this.pointerEvents=r.interactive==="pointer-events-auto"?"auto":"none"),this.contentHtml=e,this.initialRank=this.rank,this.markerContainer=document.createElement("div"),this.markerContainer.className="mappedin-marker",this.markerContainer.style.opacity="0",this.markerContainer.innerHTML='<div class="mappedin-marker-content">'.concat(this.contentHtml,"</div>"),this.markerContainer.setAttribute("data-marker-id",this.id.toString()),this.containerEl=(i=this.markerContainer.firstElementChild)!=null?i:null,this.contentEl=(o=(n=this.markerContainer.firstElementChild)==null?void 0:n.firstElementChild)!=null?o:null}updateDimensions(e,r){if(e!=null&&r!=null)this.dimensions={width:e,height:r};else{let{width:i,height:n}=this.markerContainer.getBoundingClientRect();this.dimensions={width:i,height:n}}Object.assign(this.markerContainer,{width:this.dimensions.width+"px",height:this.dimensions.height+"px"}),this.currentStrategyIndex=-1}get strategies(){var o;let{width:e,height:r}=this.dimensions;if(e===0||r===0)return[];let n=(Array.isArray(this.options.placement)?this.options.placement:[this.options.placement]).map(s=>({name:s,getBoundingBox:a(()=>{let l=r/2,u=r/2,h=e/2,m=e/2;switch(s){case"top":{l=r,u=0;break}case"bottom":{l=0,u=r;break}case"left":{h=e,m=0;break}case"right":{h=0,m=e;break}case"top-left":{l=r,h=e,u=0,m=0;break}case"top-right":{l=r,m=e,u=0,h=0;break}case"bottom-left":{u=r,h=e,l=0,m=0;break}case"bottom-right":{u=r,m=e,l=0,h=0;break}}return[l+No,u+No,h+No,m+No]},"getBoundingBox")}));if((o=this.options.lowPriorityPin)!=null&&o.enabled&&this.options.rank!=="always-visible"){let s={name:ff,getBoundingBox:a(()=>{let l=Math.max(2,No/2);return[this.options.lowPriorityPin.size/2+l,this.options.lowPriorityPin.size/2+l,this.options.lowPriorityPin.size/2+l,this.options.lowPriorityPin.size/2+l]},"getBoundingBox")};n.push(s)}return n}toPackedMessage(e=!1){var i;this.packedMessage.x=this.projection.x,this.packedMessage.y=this.projection.y,this.packedMessage.enabled=this.enabled,this.packedMessage.rank=this.rank,this.packedMessage.shouldCollideWithScreenEdges=!0;let r=this.currentStrategyIndex!==-1&&this.currentStrategyIndex!==this.lowPriorityPinStrategyIndex;if(this.visible&&e&&r&&this.collisionDirty===!1?this.packedMessage.lockedToStrategyIndex=this.currentStrategyIndex:this.packedMessage.lockedToStrategyIndex=-1,r&&this.currentStrategyIndex!==((i=this.packedMessage.bboxes[0])==null?void 0:i[4])){let n=this.packedMessage.bboxes.findIndex(o=>o[4]===this.currentStrategyIndex);if(n!==-1){let o=this.packedMessage.bboxes.splice(n,1)[0];this.packedMessage.bboxes.unshift(o)}}if(!this.collisionDirty)return this.packedMessage;this.packedMessage.bboxes=[];for(let n=0;n<this.strategies.length;n++){let o=this.strategies[n];n===this.currentStrategyIndex&&r?this.packedMessage.bboxes.unshift([...o.getBoundingBox(),n]):this.packedMessage.bboxes.push([...o.getBoundingBox(),n])}return this.collisionDirty=!1,this.packedMessage}get lowPriorityPinStrategyIndex(){var e;return!((e=this.options.lowPriorityPin)!=null&&e.enabled)||this.options.rank==="always-visible"?-1:Array.isArray(this.options.placement)?this.options.placement.length:1}destroy(){}};a(Zi,"MarkerComponent"),p(Zi,"testId",0);var nr=Zi;v();v();v();var wu=class wu extends me{constructor(r,i,n=!0){super();p(this,"rendererState");p(this,"convertTo3DMapPosition");p(this,"textSet",new Set);p(this,"batchedTextMap",new Map);p(this,"useWorker",!0);p(this,"debugTextAreaMesh",new Map);n===!1&&(this.useWorker=!1,bf(!1)),this.rendererState=r,this.convertTo3DMapPosition=i}remove(r){this.textSet.delete(r)}update(r){var l,u,h;let i,n,o,s=[];for(let m of this.rendererState.geometry3DIdsInScene)if(i=this.rendererState.geometry3DMap.get(m),(i==null?void 0:i.type)==="text3d"){n=i.components[0],o=i.components[1];let f=(l=n.mesh)==null?void 0:l.parent;if(!f||!(f instanceof Ie)||!(n instanceof Vr))continue;if("textArea"in n.feature.properties&&n.mesh!=null&&n.polygonEntityId!=null&&n.textMesh==null&&n.mesh.parent!=null&&((h=(u=n.feature.properties)==null?void 0:u.textArea)==null?void 0:h.position)!=null){if(this.textSet.has(n.polygonEntityId))continue;this.textSet.add(n.polygonEntityId),this.batchedTextMap.has(f)||this.batchedTextMap.set(f,Fo().then(({BatchedText:_})=>{let T=new _;return T.type="batchedtext",f.add(T),T}));let y=this.batchedTextMap.get(f);if(!y)throw new Error("batched text required");s.push(vf({entityId:m,textComponent:n,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:y,rendererState:this.rendererState,type:"text-area"}).then(()=>{this.publish("render")}))}else if(n.mesh!=null&&n.textMesh==null&&n.mesh.parent!=null){if(this.textSet.has(m.toString()))continue;this.textSet.add(m.toString()),this.batchedTextMap.has(f)||this.batchedTextMap.set(f,Fo().then(({BatchedText:_})=>{let T=new _;return T.type="batchedtext",f.add(T),T}));let y=this.batchedTextMap.get(f);if(!y)throw new Error("batched text required");s.push(vf({entityId:m,textComponent:n,styleComponent:o,convertTo3DMapPosition:this.convertTo3DMapPosition,batchedMeshPromise:y,rendererState:this.rendererState,type:"point"}).then(()=>{this.publish("render")}))}let b=this.batchedTextMap.get(f);n.textMesh&&b&&n.polygonEntityId!=null&&Promise.all([b,Promise.resolve({meshComponent:n,styleComponent:o})]).then(([y,{meshComponent:_,styleComponent:T}])=>{let{textMesh:g}=_;if(y&&g){let x=Tu(y,g);_.visible&&!x?y.add(g):!_.visible&&x&&y.remove(g)}T.flipToFaceCamera&&this.flipIfNeeded(_,r)})}return Promise.all(s)}flipIfNeeded(r,i){let n=r.textMesh;if(!n)return!1;let o=n.rotation.z,s=fc(o+i);s>Math.PI/2&&s<3*Math.PI/2&&(n.rotation.z=fc(o+Math.PI))}showTextAreaMesh(){let r,i;for(let n of this.rendererState.geometry3DIdsInScene)if(r=this.rendererState.geometry3DMap.get(n),(r==null?void 0:r.type)==="text3d"&&(i=r.components[0],"textArea"in i.feature.properties)){let o=i.feature.properties.textArea;if(!o)continue;let s=new Nt(o.maxWidth,o.maxHeight),l=new be(s,new st({color:"pink"})),{textMesh:u}=i;if(!u)continue;let h=this.convertTo3DMapPosition(o.position,Bo);l.position.copy(h),l.position.z=u.position.z-.1,l.rotation.z=u.rotation.z,_u.identity(),_u.makeRotationAxis(new H(0,0,1),u.userData.rotationZ),Bo.set(o.maxWidth/2,0,0),Bo.applyMatrix4(_u),l.position.x-=Bo.x,l.position.y-=Bo.y,this.rendererState.entityScene.add(l),this.debugTextAreaMesh.set(n,l)}this.publish("render")}hideTextAreaMesh(){this.debugTextAreaMesh.forEach(r=>{this.rendererState.entityScene.remove(r)}),this.debugTextAreaMesh.clear(),this.publish("render")}};a(wu,"Text3DSystem");var Ra=wu;function bf(t){Fo().then(({configureTroikaTextBuilder:e})=>{e({useWorker:t})})}a(bf,"configureWorker");var _u=new bt,Bo=new H,Pu;function Fo(){return Pu||(Pu=import("./text3d-242FO3DA.js").then(t=>t)),Pu}a(Fo,"getText3DService");async function vf({entityId:t,textComponent:e,styleComponent:r,convertTo3DMapPosition:i,batchedMeshPromise:n,rendererState:o,type:s="text-area"}){return Promise.all([Fo(),Promise.resolve({entityId:t,meshComponent:e,styleComponent:r})]).then(([{createTroikaTextPoint:l,createTroikaTextArea:u},h])=>s==="text-area"?u(h.entityId,h.meshComponent,h.styleComponent,i):l(h.entityId,h.meshComponent,h.styleComponent,i)).catch(l=>{te.warn("Trouble creating text: ",l)}).then(l=>{if(!(l!=null&&l.text))return;let u=[Promise.resolve(l.text),n,Promise.resolve()];if(e.polygonEntityId){let h=o.geometry3DMap.get(e.polygonEntityId);if((h==null?void 0:h.type)==="geometry"){let m=h.components[0],f=h.components[1];m.textMesh=l.text,l.text.position.z=f.altitude+f.height+wC}}else u[2]=Fo().then(({syncText:h})=>h(l.text));return Promise.all(u)}).then(l=>{if(!l)return;let[u,h]=l;h.add(u),e.batchedText||(e.batchedText=h)})}a(vf,"createText");function Tu(t,e){return t._members.has(e)}a(Tu,"doesBatchedTextContainsText");var wC=.5;var MC=I.object({visible:I.boolean(),color:I.string(),flipToFaceCamera:I.boolean(),font:I.string().optional(),fontSize:I.number(),margin:I.union([I.number(),I.tuple([I.number(),I.number(),I.number(),I.number()])]),outlineColor:I.string(),outlineOpacity:I.number(),outlineBlur:I.union([I.number(),I.string()]),outlineWidth:I.number(),outlineOffsetX:I.number(),outlineOffsetY:I.number(),strokeWidth:I.number(),maxWidth:I.number().optional(),maxHeight:I.number().optional(),strokeOpacity:I.number(),strokeColor:I.string(),fillOpacity:I.number(),hoverColor:I.string().optional(),id:I.union([I.string(),I.number()]),type:I.literal("text3d"),position:I.tuple([I.number(),I.number(),I.number()]),content:I.string()}),xf=MC.partial().omit({id:!0,type:!0}).strict(),Sf=xf.omit({margin:!0,position:!0,maxWidth:!0,maxHeight:!0,content:!0}).strict(),Cf=I.object({appearance:xf.optional(),parentId:I.string().optional()}).strict(),Mu=class Mu{constructor(e){p(this,"mesh",new Bt);p(this,"textMesh");p(this,"type","text3d");p(this,"feature");p(this,"parent");p(this,"batchedText");p(this,"polygonEntityId");this.feature=e}get visible(){return this.batchedText&&this.textMesh?Tu(this.batchedText,this.textMesh):this.textMesh?this.textMesh.visible:!1}set visible(e){this.batchedText&&this.textMesh?e?this.batchedText.addText(this.textMesh):this.batchedText.removeText(this.textMesh):this.textMesh&&(this.textMesh.visible=e),this.mesh.visible=e}};a(Mu,"Text3DComponent");var Vr=Mu;v();var Fn,Iu=class Iu{constructor(e){p(this,"color");p(this,"dirty",!0);p(this,"enabled",!0);L(this,Fn,!1);p(this,"edgeColors");p(this,"edgeVisibility");p(this,"geometry");p(this,"ranges");p(this,"topFaceVerticesIndices");this.color=e}get currentOpacity(){return this.edgeColors&&this.ranges?this.edgeColors.array[this.ranges.start*4+3]:0}set visible(e){if(!this.edgeVisibility||!this.ranges||c(this,Fn)===e)return;R(this,Fn,e);let r=this.edgeVisibility.array,i=e?1:0;for(let n=0;n<this.ranges.count;n++){let o=this.ranges.start+n;r[o]=i}this.edgeVisibility.needsUpdate=!0}get visible(){return c(this,Fn)}get currentColor(){return this.edgeColors&&this.ranges?[this.edgeColors.array[this.ranges.start*4],this.edgeColors.array[this.ranges.start*4+1],this.edgeColors.array[this.ranges.start*4+2]]:[0,0,0]}};Fn=new WeakMap,a(Iu,"OutlineComponent");var Gn=Iu;v();v();v();var Eu=class Eu extends Bd{constructor(r){let i=r,n=3,o=n*4;super(new Uint8Array(r*o),n,r,Gs,Fs);p(this,"_width");p(this,"_height");p(this,"_propertiesLength");this._width=o,this._height=i,this._propertiesLength=n}setColor(r,i,n){let o=this.image.data,s=r*this._width;o[s]=Math.round(i.r*255),o[s+1]=Math.round(i.g*255),o[s+2]=Math.round(i.b*255),o[s+3]=0,o[s+4]=Math.round(n.r*255),o[s+5]=Math.round(n.g*255),o[s+6]=Math.round(n.b*255),o[s+7]=0,this.needsUpdate=!0}getColor(r){let i=this.image.data,n=r*this._width,o=new Ee(i[n]/255,i[n+1]/255,i[n+2]/255),s=new Ee(i[n+4]/255,i[n+5]/255,i[n+6]/255);return{color:o,topColor:s}}setTexture(r,i,n){let o=this.image.data,s=r*this._width;o[s+8]=i?255:0,o[s+9]=n?255:0,o[s+10]=0,o[s+11]=0,this.needsUpdate=!0}getTexture(r){let i=this.image.data,n=r*this._width,o=i[n+8]===255,s=i[n+9]===255;return{texture:o,topTexture:s}}};a(Eu,"BatchedPropertiesTexture");var Na=Eu;v();var _f="#define LAMBERT\nvarying vec3 vViewPosition;\nvarying vec4 vPosition;\nvarying vec2 vUv;\nvarying vec4 finalPosition;\nvarying float vVerticalOffset;\nvarying vec3 worldNormal;\nvarying float vBatchId;\n\n#include <common>\n#include <batching_pars_vertex>\n#include <uv_pars_vertex>\n#include <displacementmap_pars_vertex>\n#include <envmap_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <normal_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <skinning_pars_vertex>\n#include <shadowmap_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <batching_vertex>\n\n #include <beginnormal_vertex>\n #include <morphnormal_vertex>\n #include <skinbase_vertex>\n #include <skinnormal_vertex>\n #include <defaultnormal_vertex>\n #include <normal_vertex>\n\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <displacementmap_vertex>\n #include <project_vertex>\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n\n vViewPosition = - mvPosition.xyz;\n\n #include <worldpos_vertex>\n #include <envmap_vertex>\n #include <shadowmap_vertex>\n #include <fog_vertex>\n \n // To mitigate visual defects on machines such as windows and iOS\n vBatchId = getIndirectIndex(gl_DrawID) + 0.5;\n vViewPosition = - mvPosition.xyz;\n worldNormal = normal;\n vUv = uv;\n vVerticalOffset = position.z;\n}\n";v();var Pf="#define LAMBERT\nuniform vec3 diffuse;\nuniform vec3 emissive;\nuniform float opacity;\nuniform float uGradientEnd;\nuniform float uGradientIntensity;\nuniform float uMinSideAlpha;\nuniform float uMaxSideAlpha;\nuniform float uGradientStart;\nuniform highp sampler2D uPropertiesTexture;\nuniform highp sampler2D uTopTexture;\nuniform highp sampler2D uTexture;\nuniform float uRepeatYFactor;\nuniform bool uBlendTexture;\nvarying float vBatchId;\n\nvarying vec2 vUv;\nvarying float vVerticalOffset;\nvarying vec3 worldNormal;\n\n#include <common>\n#include <packing>\n#include <dithering_pars_fragment>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <alphamap_pars_fragment>\n#include <alphatest_pars_fragment>\n#include <alphahash_pars_fragment>\n#include <aomap_pars_fragment>\n#include <lightmap_pars_fragment>\n#include <emissivemap_pars_fragment>\n#include <envmap_common_pars_fragment>\n#include <envmap_pars_fragment>\n#include <fog_pars_fragment>\n#include <bsdfs>\n#include <lights_pars_begin>\n#include <normal_pars_fragment>\n#include <lights_lambert_pars_fragment>\n#include <shadowmap_pars_fragment>\n#include <bumpmap_pars_fragment>\n#include <normalmap_pars_fragment>\n#include <specularmap_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvec3 blendTextureColor(vec3 diffuseColor, vec4 texColor) {\n vec3 texturedColor = diffuseColor * texColor.rgb;\n return mix(diffuseColor, texturedColor, texColor.a);\n}\n\nvoid main() {\n #include <clipping_planes_fragment>\n\n // get the normalized world normal of vertex fragment\n vec3 surfaceNormal = normalize(worldNormal);\n\n // get angle relative to Z up\n float angle = degrees(acos(abs(dot(surfaceNormal, vec3(0.0, 0.0, 1.0)))));\n\n int idx = int(vBatchId) * 1;\n vec3 diffuse = vec3(texelFetch(uPropertiesTexture, ivec2(0, idx), 0).rgb);\n bool shouldShowTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).r > 0.99;\n\n if(shouldShowTexture) {\n vec4 tex2d = texture2D(uTexture, vec2(vUv.x, vUv.y * uRepeatYFactor));\n diffuse = uBlendTexture ? blendTextureColor(diffuse, tex2d) : tex2d.rgb;\n }\n\n // if this is a fragment facing upwards, use topColor. Avoid any sort of '==' comparison, due to floating point precision issue\n if(angle < 0.02) {\n bool shouldShowTopTexture = texelFetch(uPropertiesTexture, ivec2(2, idx), 0).g > 0.99;\n\n if(shouldShowTopTexture) {\n vec4 topTex2d = texture2D(uTopTexture, vUv);\n diffuse = uBlendTexture ? blendTextureColor(diffuse, topTex2d) : topTex2d.rgb;\n } else {\n diffuse = vec3(texelFetch(uPropertiesTexture, ivec2(1, idx), 0).rgb);\n }\n }\n\n vec4 diffuseColor = vec4(diffuse, opacity);\n\n // only for vertical surfaces\n if(angle > 89.0 && angle < 91.0) {\n\n // get the percentage of the z position from the ground, up\n float percentFromZeroZ = max((abs(vVerticalOffset) - uGradientStart) / uGradientEnd, 0.0);\n\n // gradient based on percentage\n float alpha = smoothstep(uMinSideAlpha, uMaxSideAlpha, percentFromZeroZ);\n\n // mix the shadow color with the diffuse color based on the alpha and opacity\n diffuseColor = vec4(mix(diffuseColor.rgb, diffuseColor.rgb * (1.0 - uGradientIntensity), 1.0 - alpha), opacity);\n }\n\n ReflectedLight reflectedLight = ReflectedLight(vec3(0.0), vec3(0.0), vec3(0.0), vec3(0.0));\n vec3 totalEmissiveRadiance = emissive;\n\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n #include <alphamap_fragment>\n #include <alphatest_fragment>\n #include <alphahash_fragment>\n #include <specularmap_fragment>\n #include <normal_fragment_begin>\n #include <normal_fragment_maps>\n #include <emissivemap_fragment>\n\n // accumulation\n #include <lights_lambert_fragment>\n #include <lights_fragment_begin>\n #include <lights_fragment_maps>\n #include <lights_fragment_end>\n\n // modulation\n #include <aomap_fragment>\n\n vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;\n\n #include <envmap_fragment>\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n #include <dithering_fragment>\n\n}\n";var IC=-.05,EC=1,Du=class Du extends mi{constructor(r,i,n=1){super(r);p(this,"propertiesTexture");p(this,"uniforms",{uGradientIntensity:{value:0},uGradientEnd:{value:0},uGradientStart:{value:0},uTopTexture:{value:null},uTexture:{value:null},uRepeatYFactor:{value:1},uBlendTexture:{value:!1}});p(this,"colorSpace",di);p(this,"showTextures",a(r=>{let i=!!this.uniforms.uTexture.value,n=!!this.uniforms.uTopTexture.value;(i||n)&&(this.propertiesTexture.setTexture(r,i,n),this.needsUpdate=!0)},"showTextures"));this.alphaTest=.01,this.propertiesTexture=new Na(i),this.uniforms.uRepeatYFactor.value=n,this.onBeforeCompile=o=>{let s=this.uniforms.uGradientIntensity,l=this.uniforms.uGradientEnd,u=this.uniforms.uGradientStart,h=this.uniforms.uTopTexture,m=this.uniforms.uTexture,f=this.uniforms.uRepeatYFactor,b=this.uniforms.uBlendTexture;this.uniforms=o.uniforms,o.vertexShader=_f,o.fragmentShader=Pf,Object.assign(this.uniforms,{uGradientIntensity:s,uGradientEnd:l,uGradientStart:u,uMinSideAlpha:{value:IC},uMaxSideAlpha:{value:EC},uPropertiesTexture:{value:this.propertiesTexture},uTopTexture:h,uTexture:m,uRepeatYFactor:f,uBlendTexture:b})}}get repeatYFactor(){return this.uniforms.uRepeatYFactor.value}set repeatYFactor(r){r!==this.uniforms.uRepeatYFactor.value&&(this.uniforms.uRepeatYFactor.value=r,this.needsUpdate=!0)}get texture(){return this.uniforms.uTexture.value}set texture(r){r.wrapS=Vt,r.wrapT=Vt,r.colorSpace=this.colorSpace,this.uniforms.uTexture.value=r}get topTexture(){return this.uniforms.uTopTexture.value}set topTexture(r){r.wrapS=Vt,r.wrapT=Vt,r.colorSpace=this.colorSpace,this.uniforms.uTopTexture.value=r}get blendTexture(){return this.uniforms.uBlendTexture.value}set blendTexture(r){r!==this.uniforms.uBlendTexture.value&&(this.uniforms.uBlendTexture.value=r,this.colorSpace=r?Id:di,this.texture&&(this.texture.colorSpace=this.colorSpace),this.topTexture&&(this.topTexture.colorSpace=this.colorSpace),this.needsUpdate=!0)}setGradientShading(r,i,n){this.uniforms.uGradientStart.value=r,this.uniforms.uGradientEnd.value=i,this.uniforms.uGradientIntensity.value=n}getGradientShading(){return{start:this.uniforms.uGradientStart.value,end:this.uniforms.uGradientEnd.value,intensity:this.uniforms.uGradientIntensity.value}}setColor(r,i,n){this.propertiesTexture.setColor(r,i,n)}getColor(r){return this.propertiesTexture.getColor(r)}hideTextures(r){let i=!!this.uniforms.uTexture.value,n=!!this.uniforms.uTopTexture.value;(i||n)&&(this.propertiesTexture.setTexture(r,!1,!1),this.needsUpdate=!0)}removeSideTexture(r){if(this.texture){this.texture.dispose(),this.uniforms.uTexture.value=null;let i=!!this.uniforms.uTopTexture.value;this.propertiesTexture.setTexture(r,!1,i),this.needsUpdate=!0}}removeTopTexture(r){if(this.topTexture){this.topTexture.dispose(),this.uniforms.uTopTexture.value=null;let i=!!this.uniforms.uTexture.value;this.propertiesTexture.setTexture(r,i,!1),this.needsUpdate=!0}}dispose(){super.dispose(),this.propertiesTexture.dispose()}};a(Du,"BatchedStandardMaterial");var Ui=Du;v();function Tf(t,e){var h,m,f;let r=0;for(let b of t)r+=((m=(h=b.components[0])==null?void 0:h.geometry)==null?void 0:m.attributes.position.count)||0;let i=new Ee(e.color),n;n=new Ui({color:i,side:e.side==="back"?co:e.side==="front"?hi:Rt,opacity:(f=e.opacity)!=null?f:1,transparent:e.opacity!==void 0?e.opacity<1:!1,polygonOffset:!0,polygonOffsetFactor:1,polygonOffsetUnits:1},t.length);let o=new $s(t.length,r,0,n);o.renderOrder=0;let s,l,u;for(let b of t)s=b.components[0],!(!(s instanceof Ne)||!s.geometry)&&(s.mesh=o,s.material=n,s.instanceIndex=o.addGeometry(s.geometry),o.addInstance(s.instanceIndex),o.userData.entities[s.instanceIndex]=b.id,n instanceof Ui&&n.setColor(s.instanceIndex,i,e.topColor?new Ee(e.topColor):i),l=o.getGeometryIdAt(s.instanceIndex),s.batchedProps&&(u=o.getGeometryRangeAt(l),u&&(s.batchedProps.range=u),s.batchedProps.geometryId=l));return o.perObjectFrustumCulled=!0,o.matrixAutoUpdate=!1,o}a(Tf,"batchGeometries");function Go(t){return W(t).darken(30).toRgbString()}a(Go,"darkenColorForOutline");function wf(t,e,r,i){if(e.length<1)return;t.boundingBox||t.computeBoundingBox();let n=t.boundingBox,o=t.getAttribute("position"),s=t.getAttribute("normal"),l=t.getAttribute("uv"),u,h;t.index?(u=t.index.count/3,h=a(function(S,C){return t.index.getX(S*3+C)},"meshIndex")):(u=o.count/3,h=a(function(S,C){return S*3+C},"meshIndex"));let m=new bt;m.makeRotationFromQuaternion(new pi().setFromEuler(new mr(0,0,r/180*Math.PI)));let f=e.find(S=>S.face==="top"),b;f&&(b={min:i(f.bounds[1],f.bounds[0],0),max:i(f.bounds[3],f.bounds[2],n.max.z)});let y=e.find(S=>S.face==="side"),_;if(y&&(_={min:i(y.bounds[1],y.bounds[0],0),max:i(y.bounds[3],y.bounds[2],n.max.z)}),!(!_&&!b))for(let S=0;S<u;++S){let C=s.getX(h(S,0))+s.getX(h(S,1))+s.getX(h(S,2)),w=s.getY(h(S,0))+s.getY(h(S,1))+s.getY(h(S,2)),k=s.getZ(h(S,0))+s.getZ(h(S,1))+s.getZ(h(S,2)),A=Math.abs(C),N=Math.abs(w),Y=Math.abs(k);var T,g;A<=N&&A<=Y?(T="x",N<=Y?g="y":g="z"):N<=A&&N<=Y?(T="y",A<=Y?g="x":g="z"):(T="z",A<=N?g="x":g="y"),T==="z"&&(T=g,g="z");let z,X,q,F,J,pe;if(g==="z"||T==="z"){if(!y||!_)continue;z=y.repeat.u,X=y.repeat.v,q=y.offset.u,F=y.offset.v,J=y.rotation,pe=_}else{if(!f||!b)continue;z=f.repeat.u,X=f.repeat.v,q=f.offset.u,F=f.offset.v,J=(360-r+f.rotation)%360,pe=b}let{min:se,max:De}=pe,ve=new fr;ve.position.set(se.x,se.y,0),ve.updateMatrix(),ve.updateMatrixWorld();let ge=se.clone().applyMatrix4(m),xe=De.clone().applyMatrix4(m),rt=Math.abs(xe.x-ge.x),Ge=Math.abs(xe.y-ge.y),Ue=new H(rt,Ge,De.z).applyMatrix4(ve.matrixWorld),je=Math.abs(Ue[T]-se[T]),Me=Math.abs(Ue[g]-se[g]),Xe=J*Math.PI/180||0,Ke=Math.cos(Xe),_t=Math.sin(Xe),Lr=ve.matrixWorld.clone().invert(),yt=new pi().setFromEuler(new mr(0,0,r/180*Math.PI));for(let Qe=0;Qe<3;Qe++){let K=new H(o.getX(h(S,Qe)),o.getY(h(S,Qe)),o.getZ(h(S,Qe))).applyMatrix4(Lr);K.applyQuaternion(yt);let Pe=K.applyMatrix4(ve.matrixWorld),Ye=Pe.x,Wt=Pe.y,ui=Pe.z;var x,P;T==="x"?x=z*(Ye-se[T])/je+q:T==="y"?x=z*(Wt-se[T])/je+q:x=z*(ui-se[T])/je+q,g==="x"?P=X*(Ye-se[g])/Me+F:g==="y"?P=X*(Wt-se[g])/Me+F:P=X*(ui-se[g])/Me+F,x-=.5,P-=.5;let pr=x*Ke-P*_t+.5,lo=x*_t+P*Ke+.5;l.setX(h(S,Qe),pr),l.setY(h(S,Qe),lo)}}}a(wf,"updateUVsLegacy");v();var Ou=class Ou{constructor(){p(this,"focusMesh");p(this,"dirty",!0)}};a(Ou,"FocusableComponent");var Mr=Ou;function et(t,e,r){if(e!==void 0){if(t.type==="model"||t.type==="path"||t.type==="marker"||t.type==="label"||t.type==="geometry"||t.type==="group-container"||t.type==="custom-geometry")return e===!0?(t instanceof gi&&t.components[1]===void 0?(t.components[1]=new On,t.components[1].dirty=!0):t instanceof fe&&t.components[2]===void 0?(t.components[2]=new On,t.components[2].dirty=!0):t instanceof Ie&&t.components[0]===void 0&&(t.components[0]=new On,t.components[0].dirty=!0),!0):(t instanceof gi?t.components[1]=void 0:t instanceof fe?t.components[2]=void 0:t instanceof Ie&&(t.components[0]=void 0),!0);if(t.type==="geometry-group"){let i;for(let n of t.userData.entities3D.values())i=r.geometry3DMap.get(n),et(i,e,r);return!0}}return!1}a(et,"updateInteractivity");function Mf(t,e,r){if(!(!(r!=null&&r.color)&&!("topColor"in r))){if(r!==void 0&&t.type==="geometry-group"){let i;for(let n of t.userData.entities3D.values())i=e.geometry3DMap.get(n),i&&Fa(i,r);return!0}return!1}}a(Mf,"updateGroupColor");function AC(t,e){e!==void 0&&t.type==="geometry"&&(t.components[1].shading=e,t.components[1].dirty=!0)}a(AC,"updateShading");function If(t,e,r){if(r!==void 0&&t.type==="geometry-group"){for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i);n&&AC(n,r)}return!0}return!1}a(If,"updateGroupShading");function Ef(t,e){e!==void 0&&t.type==="geometry"&&(e.showImage!==void 0&&(t.components[1].showImage=e.showImage),e.flipImageToFaceCamera!==void 0&&(t.components[1].flipImageToFaceCamera=e.flipImageToFaceCamera))}a(Ef,"updateImageProps");function Ba(t,e,r){if(r!==void 0){if(t.type==="geometry"){let i=t.components[1];if(i.height!==r)return i.height=r,i.dirty=!0,t.components[3]&&(t.components[3].dirty=!0),!0}else if(t.type==="geometry-group"){for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&Ba(n,e,r)}return!0}}return!1}a(Ba,"updateHeight");function Fa(t,e){if(e!==void 0){let r=!1;(t.type==="path"||t.type==="geometry")&&(e.initialColor!==void 0&&e.initialColor!==t.components[1].initialColor&&(t.components[1].initialColor=e.initialColor,r=!0),e.color!==void 0&&e.color!==t.components[1].color&&(t.components[1].color=e.color,r=!0,t.components[3]&&(t.components[3].color=Go(e.color),t.components[3].dirty=!0)),"topColor"in e&&(t.components[1].topColor=e.topColor,r=!0),r&&(t.components[1].dirty=!0))}}a(Fa,"updateColor");function Au(t,e,r){e!==void 0&&(t.type==="label"||t.type==="marker"?t.updatePosition(r(e[1],e[0],e[2]||0)):t.type==="custom-geometry"&&t.components[0].position.copy(r(e[1],e[0],e[2]||0)))}a(Au,"updatePosition");function ku(t,e){var r;return e!==void 0&&(t.type==="marker"||t.type==="label"||t.type==="custom-geometry")&&t.parentObject3D!==e&&t.parentObject3D instanceof Ie?((r=t.parentObject3D)==null||r.removeEntity(t),e.addEntity(t),!0):!1}a(ku,"updateParent");function Df(t,e){e!==void 0&&(t.type==="marker"||t.type==="label")&&t.components[0].enabled!==e&&(t.components[0].enabled=e)}a(Df,"updateEnabled");function Of(t,e,r){if(e!==void 0&&t.type==="marker"){let i=t.components[0];if(e.contentHTML!==void 0)return i.containerEl.innerHTML=e.contentHTML,i.contentHtml=e.contentHTML,!0;if(e.placement!==void 0&&(i.options.placement=e.placement,i.collisionDirty=!0),e.dynamicResize!==void 0)return i.options.dynamicResize=e.dynamicResize,!0;if(e.options!=null){try{Cu.parse(e.options||{})}catch(n){return te.error(n),!1}return e.options.interactive!=null&&(e.options.interactive==="pointer-events-auto"?(i.pointerEvents="auto",et(t,!1,r)):(i.pointerEvents="none",et(t,e.options.interactive,r))),Lf(t,e.options.rank),!0}}return!1}a(Of,"updateMarker");function Lf(t,e){return e!==void 0&&(t.type==="marker"||t.type==="label")?(t.components[0].rank=Dn(e),!0):!1}a(Lf,"updateRank");function Af(t,e,r){var i,n,o,s,l,u;if(e!==void 0&&t.type==="label"){let h=t.components[0];e.text!==void 0&&e.text!==h.text&&(h.text=e.text,h.textDirty=!0);try{cu((i=e.options)!=null?i:{})}catch(m){te.error(m);return}km(h.appearance,((n=e.options)==null?void 0:n.appearance)||{})&&(h.textDirty=!0),Rm(h.appearance,((o=e.options)==null?void 0:o.appearance)||{})&&(h.markerDirty=!0),pp(h.appearance,((s=e.options)==null?void 0:s.appearance)||{}),et(t,(l=e.options)==null?void 0:l.interactive,r),Lf(t,(u=e.options)==null?void 0:u.rank)}}a(Af,"updateLabel");function kf(t,e){e!==void 0&&t.type==="geometry"&&(t.components[1].hoverColor=e,t.components[1].dirty=!0)}a(kf,"updateHoverColor");function Rf(t,e){if(e!==void 0){let r=t.components[2];if(t.type==="geometry"&&r!=null)return r.hover=e,r.dirty=!0,!0}return!1}a(Rf,"updateHovered");function Ru(t,e){e!==void 0&&t.type==="image"&&(t.components[1].flipImageToFaceCamera=e)}a(Ru,"updateFlipImageToFaceCamera");function sr(t,e,r){if(r!==void 0)if(t.type==="model"||t.type==="path"||t.type==="geometry"||t.type==="custom-geometry"||t.type==="image"||t.type==="text3d"){r!==t.components[1].visible&&(t.components[1].visible=r,t.components[1].dirty=!0);let i=t.components[3];return i&&(i.dirty=!0),!0}else{if(t.type==="geometry-group")return t.setVisible(r),!0;if(t.type==="group-container"){if(t.visible!==r)return t.setVisible(r),r===!1&&t.traverse(i=>{if(i instanceof sp){let n=e.geometry2DMap.get(i.userData.entityId);if(n){let o=n.components[0];o instanceof rr&&(o.canShow=r)}}}),!0}else if(t.type==="label")return t.components[0].visible=r,!0}return!1}a(sr,"updateVisibility");function Xo(t,e,r){if(r!==void 0)if(t.type==="geometry-group"){for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i);((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&Xo(n,e,r)}return!0}else if(t.type==="group-container"){if(t.opacity!==r){t.setOpacity(r);let i=1;return t.parent instanceof Ie&&(i=t.parent.opacity),Nf(t,e,i),!0}}else t instanceof fe&&t.components[1].opacity!==r&&(t.components[1].opacity=r,t.components[1].dirty=!0);return!1}a(Xo,"updateOpacity");function Nf(t,e,r=1){if(t.type==="group-container"&&"children"in t&&t.children.length>0){let i=r*t.opacity;t.userData.computedOpacity=i;for(let n of t.children)(n instanceof xt&&n.type==="geometry-group"||n instanceof Ie&&n.type==="group-container")&&Nf(n,e,i)}else if(t.type==="geometry-group")for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i),o;((n==null?void 0:n.type)==="geometry"||(n==null?void 0:n.type)==="model")&&(o=n.components[1],o.dirty=!0)}}a(Nf,"cascadeOpacity");function Bf(t,e,r){if(r!==void 0&&t.type==="geometry-group")for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i);n&&Nu(n,r)}}a(Bf,"updateGroupTexture");function Nu(t,e){if(t.type==="geometry"){let r=!1,i=t.components[1];if((e==null?void 0:e.texture)!=null&&i.texture!==(e==null?void 0:e.texture)&&(i.texture=e.texture,r=!0),(e==null?void 0:e.topTexture)!=null&&i.topTexture!==(e==null?void 0:e.topTexture)&&(i.topTexture=e.topTexture,r=!0),r&&t.components[0]instanceof Ne){let n=t.components[0];return n.detached===!1&&(n.detached=!0,n.dirty=!0),t.components[1].dirty=!0,!0}}return!1}a(Nu,"updateIndividualGeometryTexture");function Ff(t,e){if(e!==void 0&&t.type==="geometry"){let r=t.components[1];if(r.opacity!==e){r.opacity=e;let i=t.components[0],n=t.components[3];n&&(n.dirty=!0),i.detached===!1&&(i.detached=!0,i.dirty=!0),r.dirty=!0;let o=t.parentObject3D;return(o==null?void 0:o.type)==="geometry-group"&&(o.userData.shadingDirty=!0),!0}}return!1}a(Ff,"updateIndividualGeometryOpacity");function Xn(t,e){if(e!==void 0)if(t.type==="geometry"||t.type==="path"||t.type==="custom-geometry"){let r=t.components[1];if(r.altitude!==e)return r.altitude=e,r.dirty=!0,t.components[3]&&(t.components[3].dirty=!0),!0}else{if(t.type==="group-container"&&t.altitude!==e)return t.setAltitude(e),!0;if(t.type==="geometry-group"&&t.altitude!==e)return t.setAltitude(e),!0}return!1}a(Xn,"updateAltitude");function Ga(t,e,r){if(r!==void 0){if(t.type==="geometry-group")for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i);n instanceof fe&&Ga(n,e,r)}else if(t.type==="geometry"){let i=t.components[3],n=t.components[1];!i&&r===!0?t.components[3]=new Gn(Go(n.color)):i&&(i.enabled=r,i.dirty=!0)}return!0}return!1}a(Ga,"updateOutline");function Xa(t,e){if(e!==void 0){let r,i=4;if(t.type==="geometry"?(r=t.components[4],i=4):t.type==="group-container"&&(r=t.components[1],i=1),e===!0&&r==null)return t.components[i]=new Mr,!0;if(e===!1&&r!=null)return t.components[i]=void 0,!0}return!1}a(Xa,"updateFocusable");function Gf(t,e){if(e!==void 0&&t.type==="geometry"){let r=t.components[1];if(r.renderOrder!==e){r.renderOrder=e;let i=t.components[0];return i.detached===!1&&(i.detached=!0,i.dirty=!0),i.imageMesh&&(i.imageMesh.renderOrder=e+1),r.dirty=!0,!0}}return!1}a(Gf,"updateIndividualGeometryRenderOrder");function za(t,e,r){if(r!=null){if(t.type==="geometry"){let i=t.components[1];i.side!==r&&(i.side=r,i.dirty=!0)}else if(t.type==="geometry-group")for(let i of t.userData.entities3D.values()){let n=e.geometry3DMap.get(i);n instanceof fe&&za(n,e,r)}}}a(za,"updateSide");function Xf(t,e,r){let{visible:i,color:n}=r;if(t.type!=="path")return;let o=t.components[0];i!=null&&sr(t,e,i),n!=null&&Fa(t,{color:n}),Object.assign(o,Bu(r)),up(r)||(o.materialDirty=!0,r.width!=null&&(o.dirty=!0))}a(Xf,"handlePathUpdate");function Bu(t){return Qs(t,kC)}a(Bu,"pickPathOptions");var kC=["animateArrowsOnPath","displayArrowsOnPath","width","accentColor","completeFraction","dashed","visibleThroughGeometry"];function zf(t){if(!(t instanceof fe&&t.type==="text3d"))throw new Error("expect target is TextGeometry3D")}a(zf,"assetGeometryIsText3D");var Yf=["visible","color","strokeWidth","outlineOffsetX","outlineOffsetY","outlineWidth","outlineBlur","outlineOpacity","outlineColor","strokeWidth","strokeColor","strokeOpacity","maxWidth","maxHeight","font","hoverColor","fillOpacity","fontSize","flipToFaceCamera"];function Zf(t,e,r){sr(t,e,r.visible);let i=t.components[1],n=Qs(r,Yf);"margin"in r&&te.warn("update to margin is not supported atm"),"content"in r&&te.warn("content update is not supported atm");try{Sf.parse(n)}catch(o){te.error(o);return}Object.keys(n).length>0&&(Object.assign(i,n),i.dirty=!0)}a(Zf,"handleText3DUpdate");var RC=["color","material","opacity","verticalOffset","rotation","position","scale"];function Uf(t,e){let r=Qs(e,RC),i=t.components[1],n=t.components[0];Object.keys(r).length>0&&(r.material&&(i.material=r.material),r.opacity!=null&&(i.opacity=r.opacity),r.visible!=null&&(i.visible=r.visible),r.verticalOffset!=null&&(i.verticalOffset=r.verticalOffset),r.color!=null&&(i.color=r.color),r.position!=null&&(n.feature.geometry.coordinates=r.position,n.positionDirty=!0),r.rotation!=null&&(i.rotation=r.rotation),r.scale!=null&&(i.scale=r.scale),i.dirty=!0)}a(Uf,"handleModelStyleUpdate");v();v();v();v();v();v();v();v();v();v();function Fu(t){if(!t)throw new Error("coord is required");if(!Array.isArray(t)){if(t.type==="Feature"&&t.geometry!==null&&t.geometry.type==="Point")return t.geometry.coordinates;if(t.type==="Point")return t.coordinates}if(Array.isArray(t)&&t.length>=2&&!Array.isArray(t[0])&&!Array.isArray(t[1]))return t;throw new Error("coord must be GeoJSON Point or an Array of numbers")}a(Fu,"getCoord");function ji(t){if(Array.isArray(t))return t;if(t.type==="Feature"){if(t.geometry!==null)return t.geometry.coordinates}else if(t.coordinates)return t.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}a(ji,"getCoords");function zn(t){return t.type==="Feature"?t.geometry:t}a(zn,"getGeom");function qr(t,e,r){if(r===void 0&&(r={}),!t)throw new Error("point is required");if(!e)throw new Error("polygon is required");var i=Fu(t),n=zn(e),o=n.type,s=e.bbox,l=n.coordinates;if(s&&NC(i,s)===!1)return!1;o==="Polygon"&&(l=[l]);for(var u=!1,h=0;h<l.length&&!u;h++)if(jf(i,l[h][0],r.ignoreBoundary)){for(var m=!1,f=1;f<l[h].length&&!m;)jf(i,l[h][f],!r.ignoreBoundary)&&(m=!0),f++;m||(u=!0)}return u}a(qr,"booleanPointInPolygon");function jf(t,e,r){var i=!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 n=0,o=e.length-1;n<e.length;o=n++){var s=e[n][0],l=e[n][1],u=e[o][0],h=e[o][1],m=t[1]*(s-u)+l*(u-t[0])+h*(t[0]-s)===0&&(s-t[0])*(u-t[0])<=0&&(l-t[1])*(h-t[1])<=0;if(m)return!r;var f=l>t[1]!=h>t[1]&&t[0]<(u-s)*(t[1]-l)/(h-l)+s;f&&(i=!i)}return i}a(jf,"inRing");function NC(t,e){return e[0]<=t[0]&&e[1]<=t[1]&&e[2]>=t[0]&&e[3]>=t[1]}a(NC,"inBBox");v();v();v();v();v();v();v();v();v();var Gu="\xA9 Mappedin",zC="https://info.mappedin.com/feedback",zu=["top-left","top-right","bottom-left","bottom-right"],YC=640,ZC=a(()=>"<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill-rule='evenodd' viewBox='0 0 20 20'>\n <circle cx='10' cy='10' r='5.9' style='fill:rgba(255,255,255,1);'/>\n <path style='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'/>\n </svg>","getAttributionButtonIcon"),Xu={custom:[],position:"bottom-right",feedback:!0},Yn,Yu=class Yu{constructor(e,r={}){p(this,"controlContainerEl");p(this,"controlPositions");p(this,"compact");L(this,Yn);p(this,"attribContainerEl");p(this,"attribInnerEl");p(this,"attribButtonEl");p(this,"feedbackLinkEl");p(this,"attribHTML",Gu);p(this,"customAttributions",[]);p(this,"toggleAttribution",a(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",""))))},"toggleAttribution"));R(this,Yn,!!r.outdoorEnabled),this.controlContainerEl=document.createElement("div"),this.controlContainerEl.classList.add("mappedin-control-container"),e.appendChild(this.controlContainerEl),this.controlPositions=zu.reduce((i,n)=>{let o=document.createElement("div");return o.classList.add("mappedin-ctrl-".concat(n)),this.controlContainerEl.appendChild(o),i[n]=o,i},{})}addAttributionControl(e=Xu){var n;let r=e.position&&zu.includes(e.position)?e.position:Xu.position;this.attribContainerEl=document.createElement("details"),this.attribContainerEl.classList.add("mappedin-ctrl-attrib","mappedin-ctrl-attrib-".concat(r)),this.attribContainerEl.open=!0,this.attribContainerEl.ariaLabel="Attribution",this.controlPositions[r].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=ZC(),this.attribContainerEl.appendChild(this.attribButtonEl),this.attribInnerEl=document.createElement("div"),this.attribInnerEl.classList.add("mappedin-ctrl-attrib-inner"),this.attribHTML=c(this,Yn)?Gu:"",this.attribInnerEl.innerHTML=this.attribHTML,this.attribContainerEl.appendChild(this.attribInnerEl),((n=e.feedback)!=null?n:Xu.feedback)&&(this.feedbackLinkEl=document.createElement("a"),this.feedbackLinkEl.href=zC,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()}updateAttribution(e){if(!e.style||!this.attribInnerEl||!this.attribContainerEl)return;let r=c(this,Yn)?[Gu]:[],i=e.style.sourceCaches;for(let n in i){let o=i[n];if(o.used||o.usedForTerrain){let s=o.getSource();s.attribution&&r.indexOf(s.attribution)<0&&r.push(s.attribution)}}r=r.filter(n=>String(n).trim()),r=r.filter((n,o)=>{for(let s=o+1;s<r.length;s++)if(r[s].indexOf(n)>=0)return!1;return!0}),this.attribHTML=r.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<=YC||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}};Yn=new WeakMap,a(Yu,"HTMLControlsSystem");var Ya=Yu;v();v();var Et=Object.freeze({Linear:Object.freeze({None:a(function(t){return t},"None"),In:a(function(t){return t},"In"),Out:a(function(t){return t},"Out"),InOut:a(function(t){return t},"InOut")}),Quadratic:Object.freeze({In:a(function(t){return t*t},"In"),Out:a(function(t){return t*(2-t)},"Out"),InOut:a(function(t){return(t*=2)<1?.5*t*t:-.5*(--t*(t-2)-1)},"InOut")}),Cubic:Object.freeze({In:a(function(t){return t*t*t},"In"),Out:a(function(t){return--t*t*t+1},"Out"),InOut:a(function(t){return(t*=2)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},"InOut")}),Quartic:Object.freeze({In:a(function(t){return t*t*t*t},"In"),Out:a(function(t){return 1- --t*t*t*t},"Out"),InOut:a(function(t){return(t*=2)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},"InOut")}),Quintic:Object.freeze({In:a(function(t){return t*t*t*t*t},"In"),Out:a(function(t){return--t*t*t*t*t+1},"Out"),InOut:a(function(t){return(t*=2)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},"InOut")}),Sinusoidal:Object.freeze({In:a(function(t){return 1-Math.sin((1-t)*Math.PI/2)},"In"),Out:a(function(t){return Math.sin(t*Math.PI/2)},"Out"),InOut:a(function(t){return .5*(1-Math.sin(Math.PI*(.5-t)))},"InOut")}),Exponential:Object.freeze({In:a(function(t){return t===0?0:Math.pow(1024,t-1)},"In"),Out:a(function(t){return t===1?1:1-Math.pow(2,-10*t)},"Out"),InOut:a(function(t){return t===0?0:t===1?1:(t*=2)<1?.5*Math.pow(1024,t-1):.5*(-Math.pow(2,-10*(t-1))+2)},"InOut")}),Circular:Object.freeze({In:a(function(t){return 1-Math.sqrt(1-t*t)},"In"),Out:a(function(t){return Math.sqrt(1- --t*t)},"Out"),InOut:a(function(t){return(t*=2)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},"InOut")}),Elastic:Object.freeze({In:a(function(t){return t===0?0:t===1?1:-Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI)},"In"),Out:a(function(t){return t===0?0:t===1?1:Math.pow(2,-10*t)*Math.sin((t-.1)*5*Math.PI)+1},"Out"),InOut:a(function(t){return t===0?0:t===1?1:(t*=2,t<1?-.5*Math.pow(2,10*(t-1))*Math.sin((t-1.1)*5*Math.PI):.5*Math.pow(2,-10*(t-1))*Math.sin((t-1.1)*5*Math.PI)+1)},"InOut")}),Back:Object.freeze({In:a(function(t){var e=1.70158;return t===1?1:t*t*((e+1)*t-e)},"In"),Out:a(function(t){var e=1.70158;return t===0?0:--t*t*((e+1)*t+e)+1},"Out"),InOut:a(function(t){var e=2.5949095;return(t*=2)<1?.5*(t*t*((e+1)*t-e)):.5*((t-=2)*t*((e+1)*t+e)+2)},"InOut")}),Bounce:Object.freeze({In:a(function(t){return 1-Et.Bounce.Out(1-t)},"In"),Out:a(function(t){return t<.36363636363636365?7.5625*t*t:t<.7272727272727273?7.5625*(t-=.5454545454545454)*t+.75:t<.9090909090909091?7.5625*(t-=.8181818181818182)*t+.9375:7.5625*(t-=.9545454545454546)*t+.984375},"Out"),InOut:a(function(t){return t<.5?Et.Bounce.In(t*2)*.5:Et.Bounce.Out(t*2-1)*.5+.5},"InOut")}),generatePow:a(function(t){return t===void 0&&(t=4),t=t<Number.EPSILON?Number.EPSILON:t,t=t>1e4?1e4:t,{In:a(function(e){return Math.pow(e,t)},"In"),Out:a(function(e){return 1-Math.pow(1-e,t)},"Out"),InOut:a(function(e){return e<.5?Math.pow(e*2,t)/2:(1-Math.pow(2-e*2,t))/2+.5},"InOut")}},"generatePow")}),zo=a(function(){return performance.now()},"now"),Za=function(){function t(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,e)}return a(t,"Group"),t.prototype.getAll=function(){var e=this;return Object.keys(this._tweens).map(function(r){return e._tweens[r]})},t.prototype.removeAll=function(){this._tweens={}},t.prototype.add=function(){for(var e,r=[],i=0;i<arguments.length;i++)r[i]=arguments[i];for(var n=0,o=r;n<o.length;n++){var s=o[n];(e=s._group)===null||e===void 0||e.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},t.prototype.remove=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];for(var i=0,n=e;i<n.length;i++){var o=n[i];o._group=void 0,delete this._tweens[o.getId()],delete this._tweensAddedDuringUpdate[o.getId()]}},t.prototype.allStopped=function(){return this.getAll().every(function(e){return!e.isPlaying()})},t.prototype.update=function(e,r){e===void 0&&(e=zo()),r===void 0&&(r=!0);var i=Object.keys(this._tweens);if(i.length!==0)for(;i.length>0;){this._tweensAddedDuringUpdate={};for(var n=0;n<i.length;n++){var o=this._tweens[i[n]],s=!r;o&&o.update(e,s)===!1&&!r&&this.remove(o)}i=Object.keys(this._tweensAddedDuringUpdate)}},t}(),Zn={Linear:a(function(t,e){var r=t.length-1,i=r*e,n=Math.floor(i),o=Zn.Utils.Linear;return e<0?o(t[0],t[1],i):e>1?o(t[r],t[r-1],r-i):o(t[n],t[n+1>r?r:n+1],i-n)},"Linear"),Bezier:a(function(t,e){for(var r=0,i=t.length-1,n=Math.pow,o=Zn.Utils.Bernstein,s=0;s<=i;s++)r+=n(1-e,i-s)*n(e,s)*t[s]*o(i,s);return r},"Bezier"),CatmullRom:a(function(t,e){var r=t.length-1,i=r*e,n=Math.floor(i),o=Zn.Utils.CatmullRom;return t[0]===t[r]?(e<0&&(n=Math.floor(i=r*(1+e))),o(t[(n-1+r)%r],t[n],t[(n+1)%r],t[(n+2)%r],i-n)):e<0?t[0]-(o(t[0],t[0],t[1],t[1],-i)-t[0]):e>1?t[r]-(o(t[r],t[r],t[r-1],t[r-1],i-r)-t[r]):o(t[n?n-1:0],t[n],t[r<n+1?r:n+1],t[r<n+2?r:n+2],i-n)},"CatmullRom"),Utils:{Linear:a(function(t,e,r){return(e-t)*r+t},"Linear"),Bernstein:a(function(t,e){var r=Zn.Utils.Factorial;return r(t)/r(e)/r(t-e)},"Bernstein"),Factorial:function(){var t=[1];return function(e){var r=1;if(t[e])return t[e];for(var i=e;i>1;i--)r*=i;return t[e]=r,r}}(),CatmullRom:a(function(t,e,r,i,n){var o=(r-t)*.5,s=(i-e)*.5,l=n*n,u=n*l;return(2*e-2*r+o+s)*u+(-3*e+3*r-2*o-s)*l+o*n+e},"CatmullRom")}},Wf=function(){function t(){}return a(t,"Sequence"),t.nextId=function(){return t._nextId++},t._nextId=0,t}(),Zu=new Za,Vf=function(){function t(e,r){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Et.Linear.None,this._interpolationFunction=Zn.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Wf.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=e,typeof r=="object"?(this._group=r,r.add(this)):r===!0&&(this._group=Zu,Zu.add(this))}return a(t,"Tween"),t.prototype.getId=function(){return this._id},t.prototype.isPlaying=function(){return this._isPlaying},t.prototype.isPaused=function(){return this._isPaused},t.prototype.getDuration=function(){return this._duration},t.prototype.to=function(e,r){if(r===void 0&&(r=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=e,this._propertiesAreSetUp=!1,this._duration=r<0?0:r,this},t.prototype.duration=function(e){return e===void 0&&(e=1e3),this._duration=e<0?0:e,this},t.prototype.dynamic=function(e){return e===void 0&&(e=!1),this._isDynamic=e,this},t.prototype.start=function(e,r){if(e===void 0&&(e=zo()),r===void 0&&(r=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var i in this._valuesStartRepeat)this._swapEndStartRepeatValues(i),this._valuesStart[i]=this._valuesStartRepeat[i]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=e,this._startTime+=this._delayTime,!this._propertiesAreSetUp||r){if(this._propertiesAreSetUp=!0,!this._isDynamic){var n={};for(var o in this._valuesEnd)n[o]=this._valuesEnd[o];this._valuesEnd=n}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,r)}return this},t.prototype.startFromCurrentValues=function(e){return this.start(e,!0)},t.prototype._setupProperties=function(e,r,i,n,o){for(var s in i){var l=e[s],u=Array.isArray(l),h=u?"array":typeof l,m=!u&&Array.isArray(i[s]);if(!(h==="undefined"||h==="function")){if(m){var f=i[s];if(f.length===0)continue;for(var b=[l],y=0,_=f.length;y<_;y+=1){var T=this._handleRelativeValue(l,f[y]);if(isNaN(T)){m=!1,console.warn("Found invalid interpolation list. Skipping.");break}b.push(T)}m&&(i[s]=b)}if((h==="object"||u)&&l&&!m){r[s]=u?[]:{};var g=l;for(var x in g)r[s][x]=g[x];n[s]=u?[]:{};var f=i[s];if(!this._isDynamic){var P={};for(var x in f)P[x]=f[x];i[s]=f=P}this._setupProperties(g,r[s],f,n[s],o)}else(typeof r[s]>"u"||o)&&(r[s]=l),u||(r[s]*=1),m?n[s]=i[s].slice().reverse():n[s]=r[s]||0}}},t.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},t.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},t.prototype.pause=function(e){return e===void 0&&(e=zo()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=e,this)},t.prototype.resume=function(e){return e===void 0&&(e=zo()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=e-this._pauseStart,this._pauseStart=0,this)},t.prototype.stopChainedTweens=function(){for(var e=0,r=this._chainedTweens.length;e<r;e++)this._chainedTweens[e].stop();return this},t.prototype.group=function(e){return e?(e.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},t.prototype.remove=function(){var e;return(e=this._group)===null||e===void 0||e.remove(this),this},t.prototype.delay=function(e){return e===void 0&&(e=0),this._delayTime=e,this},t.prototype.repeat=function(e){return e===void 0&&(e=0),this._initialRepeat=e,this._repeat=e,this},t.prototype.repeatDelay=function(e){return this._repeatDelayTime=e,this},t.prototype.yoyo=function(e){return e===void 0&&(e=!1),this._yoyo=e,this},t.prototype.easing=function(e){return e===void 0&&(e=Et.Linear.None),this._easingFunction=e,this},t.prototype.interpolation=function(e){return e===void 0&&(e=Zn.Linear),this._interpolationFunction=e,this},t.prototype.chain=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this._chainedTweens=e,this},t.prototype.onStart=function(e){return this._onStartCallback=e,this},t.prototype.onEveryStart=function(e){return this._onEveryStartCallback=e,this},t.prototype.onUpdate=function(e){return this._onUpdateCallback=e,this},t.prototype.onRepeat=function(e){return this._onRepeatCallback=e,this},t.prototype.onComplete=function(e){return this._onCompleteCallback=e,this},t.prototype.onStop=function(e){return this._onStopCallback=e,this},t.prototype.update=function(e,r){var i=this,n;if(e===void 0&&(e=zo()),r===void 0&&(r=t.autoStartOnUpdate),this._isPaused)return!0;var o;if(!this._goToEnd&&!this._isPlaying)if(r)this.start(e,!0);else return!1;if(this._goToEnd=!1,e<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var s=e-this._startTime,l=this._duration+((n=this._repeatDelayTime)!==null&&n!==void 0?n:this._delayTime),u=this._duration+this._repeat*l,h=a(function(){if(i._duration===0||s>u)return 1;var T=Math.trunc(s/l),g=s-T*l,x=Math.min(g/i._duration,1);return x===0&&s===i._duration?1:x},"calculateElapsedPortion"),m=h(),f=this._easingFunction(m);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,f),this._onUpdateCallback&&this._onUpdateCallback(this._object,m),this._duration===0||s>=this._duration)if(this._repeat>0){var b=Math.min(Math.trunc((s-this._duration)/l)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=b);for(o in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[o]=="string"&&(this._valuesStartRepeat[o]=this._valuesStartRepeat[o]+parseFloat(this._valuesEnd[o])),this._yoyo&&this._swapEndStartRepeatValues(o),this._valuesStart[o]=this._valuesStartRepeat[o];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=l*b,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var y=0,_=this._chainedTweens.length;y<_;y++)this._chainedTweens[y].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},t.prototype._updateProperties=function(e,r,i,n){for(var o in i)if(r[o]!==void 0){var s=r[o]||0,l=i[o],u=Array.isArray(e[o]),h=Array.isArray(l),m=!u&&h;m?e[o]=this._interpolationFunction(l,n):typeof l=="object"&&l?this._updateProperties(e[o],s,l,n):(l=this._handleRelativeValue(s,l),typeof l=="number"&&(e[o]=s+(l-s)*n))}},t.prototype._handleRelativeValue=function(e,r){return typeof r!="string"?r:r.charAt(0)==="+"||r.charAt(0)==="-"?e+parseFloat(r):parseFloat(r)},t.prototype._swapEndStartRepeatValues=function(e){var r=this._valuesStartRepeat[e],i=this._valuesEnd[e];typeof i=="string"?this._valuesStartRepeat[e]=this._valuesStartRepeat[e]+parseFloat(i):this._valuesStartRepeat[e]=this._valuesEnd[e],this._valuesEnd[e]=r},t.autoStartOnUpdate=!1,t}();var r3=Wf.nextId,ar=Zu,i3=ar.getAll.bind(ar),n3=ar.removeAll.bind(ar),o3=ar.add.bind(ar),s3=ar.remove.bind(ar),a3=ar.update.bind(ar);v();v();v();v();v();var qf=a((t,e)=>(e-t+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,"differenceBetweenAngles"),$f=a((t,e)=>new ae(t.clientX-e.offsetLeft,t.clientY-e.offsetTop),"getTouchPos"),Uu=a((t,e)=>Math.atan2(e.y-t.y,e.x-t.x),"angle"),Yo=a((t,e)=>Math.sqrt((e.y-t.y)**2+(e.x-t.x)**2),"distance"),ju=a((t,e)=>new ae((t.x+e.x)/2,(t.y+e.y)/2),"average"),Hu=a(t=>{let e=0,{wheelDelta:r,detail:i}=t;return r!==void 0?e=r:i!==void 0&&(e=-i),e},"getScrollDelta");var Wu=class Wu{constructor(e,r){p(this,"input1");p(this,"input2");p(this,"lastAngle");p(this,"lastDistance");p(this,"totalDistance");p(this,"first");p(this,"second");this.input1=e,this.input2=r,this.lastAngle=Uu(e,r),this.lastDistance=Yo(e,r),this.totalDistance=0,this.first=e,this.second=r}update(e,r){let i=Yo(e,r);this.input1=e,this.input2=r;let n=Uu(e,r);this.lastAngle=n,this.lastDistance=i,this.totalDistance+=(Yo(this.first,e)+Yo(this.second,r))/2,this.first=ju(this.first,e),this.second=ju(this.second,r)}};a(Wu,"InputSet");var Ua=Wu;v();var Vu=class Vu{constructor(e,r,i){p(this,"touch");p(this,"camera");p(this,"cameraPlane");p(this,"viewCoordinate");p(this,"snapHolderMatrix");p(this,"snapCamera");p(this,"cameraPosition");p(this,"raycaster");p(this,"worldCoordinate");p(this,"snapshotted",!1);this.touch=e,this.camera=r,this.cameraPlane=i,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 ae(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new qt,this.raycaster.setFromCamera(e,this.snapCamera);let r=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=r&&r.length>0?r[0].point:null,this.snapshotted=!0}updateAnchorState(e,r){this.camera=e,this.snapCamera=e.clone(),this.snapHolderMatrix=e.matrixWorld.clone(),this.updateViewCoordinate(r),this.snapshotCameraState()}updateViewCoordinate(e){this.viewCoordinate={x:e.x,y:e.y}}reUnproject(){var i,n;let e=new ae(this.viewCoordinate.x,this.viewCoordinate.y);(i=this.raycaster)==null||i.setFromCamera(e,this.snapCamera);let r=(n=this.raycaster)==null?void 0:n.intersectObject(this.cameraPlane,!0)[0];return r?r.point:void 0}};a(Vu,"TouchAnchor");var Zo=Vu;var Dt={};Pd(Dt,{BLOCK_MERCATOR_ZOOM_LEVEL:()=>jC,CLIPPING_RADIUS:()=>Uo,CONTROL_OPTIONS:()=>UC,DEFAULT_ANIMATION_DURATION:()=>Qu,DEFAULT_BEARING:()=>$C,DEFAULT_MAX_ZOOM_LEVEL:()=>VC,DEFAULT_MIN_ZOOM_LEVEL:()=>eh,DEFAULT_PITCH:()=>qC,DEFAULT_ZOOM_LEVEL:()=>WC,EVENTS:()=>Va,MAPLIBRE_TILE_SIZE:()=>ja,MAX_LAT:()=>$u,MAX_MERCATOR_ZOOM_LEVEL:()=>Wa,MIN_LAT:()=>qu,MIN_MERCATOR_ZOOM_LEVEL:()=>Ha,ROOM_MERCATOR_ZOOM_LEVEL:()=>HC,TWO_PI:()=>Ju,WHEEL_ZOOM_MULTIPLIER:()=>Ku,ZRANGE:()=>Un});v();var ja=512,qu=-85.051129,$u=85.051129,Uo=1e4,UC={chain:"chain",cancel:"cancel"},Ju=Math.PI*2,Un=100,Ku=1e4,Ha=0,Wa=24,jC=17,HC=20,Qu=200,Va=["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"],WC=18,eh=12,VC=22,qC=0,$C=0;v();function Jf(t){t&&(t.map&&(t.map.dispose(),t.map=void 0),t.dispose())}a(Jf,"scrubMaterial");function ze(t){for(let e=t.children.length-1;e>=0;e--)ze(t.children[e]);"geometry"in t&&t.geometry&&t.geometry.dispose(),t.parent&&t.parent.remove(t),"material"in t&&Array.isArray(t.material)?t.material.forEach(function(e){Jf(e)}):"material"in t&&typeof t.material<"u"&&Jf(t.material)}a(ze,"destroyObject3D");var qa=!1,JC=!1;var $a,Ja=class Ja extends me{constructor(r,i,n,o,s){super();p(this,"dirty",!1);p(this,"zoomDirty",!1);p(this,"rotationDirty",!1);p(this,"panDirty",!1);p(this,"stateDirty",!1);L(this,$a,eh);p(this,"zoomSpeed",5);p(this,"rotateSpeed",100);p(this,"enabled",!0);p(this,"enableZoom",!0);p(this,"enablePan",!0);p(this,"enablePedestal",!1);p(this,"maxPedestal",1/0);p(this,"minPedestal",0);p(this,"enableRotate",!0);p(this,"minZoomAltitude",0);p(this,"maxZoomAltitude",1/0);p(this,"ignoreZoomLimits",!1);p(this,"zoomFactor",1);p(this,"panBounds",{min:new H(1/0,1/0),max:new H(-1/0,-1/0),center:new H(0,0,0),radius:1/0});p(this,"minTilt",0);p(this,"maxTilt",1.2);p(this,"MOUSE_BUTTONS",{ORBIT:Bs.RIGHT,ZOOM:Bs.MIDDLE,PAN:Bs.LEFT});p(this,"camera");p(this,"scene");p(this,"renderer");p(this,"elevation");p(this,"orbit");p(this,"cameraPlane");p(this,"raycaster",new qt);p(this,"rendererState");p(this,"options");p(this,"state",-1);p(this,"intersection");p(this,"viewState",null);p(this,"tweens",new Map);p(this,"clock",new Zd(!0));p(this,"coords",{mouse:new ae,rotateStart:new ae,rotateEnd:new ae,rotateDelta:new ae,panStart:new H,panCameraStart:new H,panEnd:new H,panDelta:new H,initialShiftPos:new ae,initialPedestal:0,floorAnchor:new H});p(this,"touch",{origin:{offsetLeft:0,offsetTop:0},touches:[],anchor1:null,anchor2:null,inputs:null});p(this,"scrollTimer",null);p(this,"lastWheelTime",0);p(this,"resetZoom",!1);p(this,"zoomStart");p(this,"pedestalScaleFactor",1);p(this,"isUserZooming",!1);p(this,"stayInsideBounds",!0);p(this,"userInteracting",!1);p(this,"cameraMoving",!1);p(this,"lastCameraMoveTime",Date.now());p(this,"raycastToFloor",a(r=>{this.raycaster.setFromCamera(r,this.camera);let i=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return i?i.point:new H},"raycastToFloor"));p(this,"isUserInteracting",a(()=>this.userInteracting,"isUserInteracting"));p(this,"getPosition",a(()=>new H(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z),"getPosition"));p(this,"getPedestal",a(()=>this.orbit.position.z,"getPedestal"));p(this,"pan",a((r,i)=>{isNaN(r)||isNaN(i)||(this.setPosition(this.orbit.position.x+r,this.orbit.position.y+i),this.publish("position-updated"))},"pan"));p(this,"postRender",a(()=>{(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"))},"postRender"));p(this,"isCameraMoving",a(()=>this.cameraMoving,"isCameraMoving"));p(this,"lastCameraStoppedMovingTime",a(()=>this.lastCameraMoveTime,"lastCameraStoppedMovingTime"));p(this,"setPosition",a((r,i)=>{r===void 0||i===void 0||isNaN(r)||isNaN(i)||(this.state===-1&&this.publish("pan-start"),this.updateCameraPosition(r,i),this.publish("position-updated"),this.publish("change"),this.state===-1&&this.publish("pan-end"),this.dirty=!0,this.stateDirty=!0)},"setPosition"));p(this,"updateCameraPosition",a((r,i)=>{let n=r-this.panBounds.center.x,o=i-this.panBounds.center.y,s=Math.sqrt(n*n+o*o);if(this.stayInsideBounds&&s>this.panBounds.radius){let l=Math.atan2(o,n),u={x:Math.cos(l)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(l)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=u.x,this.orbit.position.y=u.y}else this.orbit.position.x=r,this.orbit.position.y=i},"updateCameraPosition"));p(this,"tilt",a(r=>{if(isNaN(r))return;this.state===-1&&this.publish("rotate-start");let i=this.stayInsideBounds?Math.max(Math.min(r+this.getTilt(),this.maxTilt),this.minTilt):r+this.getTilt();i!==this.elevation.rotation.x&&(this.elevation.rotation.x=i,this.publish("tilt-updated")),this.publish("change"),this.state===-1&&this.publish("rotate-end"),this.stateDirty=!0},"tilt"));p(this,"zoomIn",a((r,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o/1.5},r,i,n)},"zoomIn"));p(this,"zoomOut",a((r,i,n)=>{let o=this.getZoomAltitude();this.animateCamera({zoom:o*1.5},r,i,n)},"zoomOut"));p(this,"getRotation",a(()=>(-this.orbit.rotation.z+Math.PI*2)%(Math.PI*2),"getRotation"));p(this,"cancelAnimation",a(()=>{let r=Array.from(this.tweens.keys()),i=r[r.length-1];i.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(i)},"cancelAnimation"));p(this,"animateCamera",a((r,i,n,o,s,l)=>{let u=O({interruptible:!0},l),h={},m={},f=this.getPosition();if(r.position!=null&&(r.position.x!==void 0&&(h.x=f.x,m.x=r.position.x),r.position.y!==void 0&&(h.y=f.y,m.y=r.position.y),r.position.z!==void 0&&(h.z=f.z,m.z=r.position.z)),r.zoom!==void 0&&(h.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?m.zoom=r.zoom:m.zoom=Math.min(Math.max(r.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),r.rotation!==void 0){let{start:S,end:C}=Kd(this.getRotation(),r.rotation);h.rotation=S,m.rotation=C}r.tilt!==void 0&&(h.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?m.tilt=r.tilt:m.tilt=Math.max(Math.min(r.tilt,this.maxTilt),this.minTilt));let b=h.zoom!==m.zoom,y=h.rotation!==m.rotation,_=h.tilt!==m.tilt,T=new Vf(h).to(m,E.env.TESTING?0:i).onUpdate(S=>{this.setMulti({x:S.x,y:S.y,z:S.z},S.zoom,S.rotation,S.tilt)}).onComplete(()=>{this.completeTween(T),this.publish("multi-end",{zooming:b,rotating:y,tilting:_}),o&&o()}).onStart(()=>{this.state!==7&&(this.state=7,T.state=7,this.publish("multi-start",{zooming:b,rotating:y,tilting:_})),this.publish("change")});this.rendererState.internalTweenGroup.add(T);let g=Array.from(this.tweens.entries()),x=g[g.length-1],P=!1;return x!=null&&(x[1].interruptible?(typeof x[1].cancelledCallback=="function"&&x[1].cancelledCallback(),this.completeTween(x[0])):(P=!0,x[0].chain(T))),this.tweens.set(T,{cancelledCallback:s,interruptible:u.interruptible}),n?T.easing(n):T.easing(Et.Quadratic.In),!r.doNotAutoStart&&!P&&(T.start(),this.publish("change")),T.cameraAnimation=!0,T},"animateCamera"));p(this,"setMulti",a((r,i,n,o,s=!0)=>{this.state===-1&&this.publish("multi-start");let l=!1;r!=null&&(r.x!==void 0&&!isNaN(r.x)&&r.y!==void 0&&!isNaN(r.y)&&(this.updateCameraPosition(r.x,r.y),l=!0),r.z!==void 0&&!isNaN(r.z)&&(this.setPedestal(r.z,!0,!1),l=!0)),l&&this.publish("position-updated");let u={zooming:!1,tilting:!!i,rotating:!1};if(i!==void 0&&!isNaN(i)){let h=this.stayInsideBounds?Math.min(Math.max(i,this.getZoomScaledMin()),this.getZoomScaledMax()):i;h!==this.camera.position.z&&(u.zooming=!0,this.camera.position.z=h,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?i>Uo&&(this.camera.near=i-Uo,this.camera.far=i+Uo):(this.camera.near=i/Un,this.camera.far=i*Un),this.camera.updateProjectionMatrix())}if(n!==void 0&&!isNaN(n)&&n!==this.getRotation()&&(u.rotating=!0,this.orbit.rotation.z=-n,this.publish("rotation-updated")),o!==void 0&&!isNaN(o)){let h=this.stayInsideBounds?Math.max(Math.min(o,this.maxTilt),this.minTilt):o;h!==this.elevation.rotation.x&&(u.tilting=!0,this.elevation.rotation.x=h,this.publish("tilt-updated"))}s&&this.publish("change"),this.state===-1&&this.publish("multi-end",u),this.stateDirty=!0},"setMulti"));p(this,"getZoomScaledMin",a(()=>this.minZoomAltitude*this.zoomFactor,"getZoomScaledMin"));p(this,"getZoomScaledMax",a(()=>{let r=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,r)},"getZoomScaledMax"));p(this,"setRotation",a((r,i)=>{if(isNaN(r))return;this.state===-1&&!i&&this.publish("rotate-start");let n=-(r%Ju);n!==this.orbit.rotation.z&&(this.orbit.rotation.z=n,i||this.publish("rotation-updated")),i||this.publish("change"),this.state===-1&&!i&&this.publish("rotate-end"),this.dirty=!0,this.rotationDirty=!0,i||(this.stateDirty=!0)},"setRotation"));p(this,"setZoomAltitude",a(r=>{if(isNaN(r))return;this.state===-1&&this.publish("zoom-start");let i=this.stayInsideBounds?Math.min(Math.max(r,this.getZoomScaledMin()),this.getZoomScaledMax()):r;i!==this.camera.position.z&&(this.camera.position.z=i,this.publish("zoom-updated"),this.zoomDirty=!0),this.camera.near=i/Un,this.camera.far=i*Un,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0,this.stateDirty=!0},"setZoomAltitude"));p(this,"setZoomLevel",a(r=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(r))},"setZoomLevel"));p(this,"getZoomAltitude",a(()=>this.camera.position.z,"getZoomAltitude"));p(this,"getZoomLevel",a(()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude()),"getZoomLevel"));p(this,"setTilt",a((r,i)=>{if(isNaN(r))return;this.state===-1&&!i&&this.publish("rotate-start");let n=this.stayInsideBounds?Math.max(Math.min(r,this.maxTilt),this.minTilt):r;n!==this.elevation.rotation.x&&(this.elevation.rotation.x=n,i||this.publish("tilt-updated")),i||this.publish("change"),this.state===-1&&!i&&this.publish("rotate-end"),this.dirty=!0,i||(this.stateDirty=!0)},"setTilt"));p(this,"getTilt",a(()=>this.elevation.rotation.x,"getTilt"));p(this,"setCameraPlaneElevation",a(r=>{this.cameraPlane.position.z=r},"setCameraPlaneElevation"));p(this,"zoom",a(r=>{if(isNaN(r))return;this.state===-1&&this.publish("zoom-start");let i=this.getZoomAltitude()-r;this.camera.position.z=this.stayInsideBounds?Math.min(Math.max(i,this.minZoomAltitude*this.zoomFactor),this.maxZoomAltitude*this.zoomFactor):i,this.publish("zoom-updated"),this.zoomDirty=!0,this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.stateDirty=!0},"zoom"));p(this,"getProjectionScaleFactor",a((r,i,n)=>gc(r,i,n),"getProjectionScaleFactor"));p(this,"update",a(()=>{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())},"update"));p(this,"setPedestal",a((r,i=!1,n=!0)=>{typeof r=="number"&&!isNaN(r)&&(this.orbit.position.z=r,i&&(this.publishPedestalChangeEvent(r),this.publish("pedestal-change",{pedestal:r})),this.publish("change"),this.dirty=!0,n&&(this.stateDirty=!0))},"setPedestal"));p(this,"dispose",a(()=>{for(let r of Va)r.endsWith("start")?(this.off(r,this.setCameraMoving),r.startsWith("user")&&this.off(r,this.setUserInteracting)):(r.endsWith("end")||r.endsWith("cancel"))&&(this.off(r,this.unsetCameraMoving),r.startsWith("user")&&this.off(r,this.unsetUserInteracting));this.removeEventListeners(),this.scene.remove(this.cameraPlane),this.destroy()},"dispose"));p(this,"createCameraPlane",a(()=>{let r=qa?2e3:1e10,i=qa?100:1,n=new Nt(r,r,i,i),o=new st({color:0,wireframe:qa,visible:qa}),s=new be(n,o);return this.scene.add(s),s},"createCameraPlane"));p(this,"addEventListeners",a(()=>{let{domElement:r}=this.renderer;for(let i of Va)i.endsWith("start")?(this.on(i,this.setCameraMoving),i.startsWith("user")&&this.on(i,this.setUserInteracting)):(i.endsWith("end")||i.endsWith("cancel"))&&(this.on(i,this.unsetCameraMoving),i.startsWith("user")&&this.on(i,this.unsetUserInteracting));r.addEventListener("contextmenu",this.onContextMenu,!1),r.addEventListener("mousedown",this.onMouseDown,!1),r.addEventListener("wheel",this.onMouseWheel,{passive:!1}),r.addEventListener("touchstart",this.onTouchStart,!1),r.addEventListener("touchend",this.onTouchEnd,!1),r.addEventListener("touchmove",this.onTouchMove,!1)},"addEventListeners"));p(this,"addMouseEventListeners",a(()=>{this.addMouseMoveEventListeners(),window.addEventListener("mouseup",this.onMouseUp,!1),window.addEventListener("mouseout",this.onMouseUp,!1)},"addMouseEventListeners"));p(this,"addMouseMoveEventListeners",a(()=>{this.renderer.domElement.addEventListener("mousemove",this.onMouseMove,!1)},"addMouseMoveEventListeners"));p(this,"removeMouseMoveEventListeners",a(()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1)},"removeMouseMoveEventListeners"));p(this,"removeEventListeners",a(()=>{let{domElement:r}=this.renderer;r.removeEventListener("contextmenu",this.onContextMenu,!1),r.removeEventListener("mousedown",this.onMouseDown,!1),r.removeEventListener("wheel",this.onMouseWheel,!1),r.removeEventListener("touchstart",this.onTouchStart,!1),r.removeEventListener("touchend",this.onTouchEnd,!1),r.removeEventListener("touchmove",this.onTouchMove,!1),r.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)},"removeEventListeners"));p(this,"removeMouseUpEventListeners",a(()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)},"removeMouseUpEventListeners"));p(this,"onContextMenu",a(r=>{r.preventDefault()},"onContextMenu"));p(this,"onMouseUp",a(()=>{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}},"onMouseUp"));p(this,"onMouseMove",a(r=>{if(this.enabled!==!1)if(r.preventDefault(),this.mouseToScene(r),this.state===0){if(this.enableRotate===!1)return;this.handleMouseMoveRotate(r)}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(r)},"onMouseMove"));p(this,"onTouchStart",a(r=>{if(this.enabled!==!1){switch(this.updateTouchOrigin(),this.touchToScene(r),r.touches.length){case 1:this.enablePedestal?(this.handleTouchStartPedestal(r),this.state=9):this.enablePan&&(this.handleTouchStartPan(r),this.state=6);break;case 2:this.touch.inputs=new Ua(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}},"onTouchStart"));p(this,"onTouchMove",a(r=>{if(this.enabled!==!1)switch(this.touchToScene(r),r.touches.length){case 2:r.preventDefault(),r.stopPropagation();let i=O({},this.touch.inputs.first),n=O({},this.touch.inputs.second),o=new ae(this.touch.touches[0].x,this.touch.touches[0].y),s=new ae(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(r);else if(this.state===5)this.handleTouchMoveDolly();else if(this.state!==5&&this.touch.inputs.totalDistance>.05){let l=i.y<o.y&&n.y<s.y,u=i.y>o.y&&n.y>s.y;this.enableRotate&&this.state!==4&&(u||l)?(this.handleTouchStartTilt(r),this.state=4):(this.handleTouchStartDolly(),this.state=5)}break;case 1:(this.enablePedestal||this.enablePan)&&(r.preventDefault(),r.stopPropagation()),this.enablePedestal&&this.state===9?this.handleTouchMovePedestal(r):this.enablePan&&this.state===6&&this.handleTouchMovePan(r);break;default:this.state=-1}},"onTouchMove"));p(this,"onTouchEnd",a(r=>{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}r.touches.length?this.onTouchStart(r):this.state=-1}},"onTouchEnd"));p(this,"handleTouchMovePan",a(r=>{let i=Object.hasOwn(r,"x")?new ae(r.x,r.y):this.touch.touches[0],n=this.raycastToFloor(i);this.coords.panEnd.set(n.x,n.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},"handleTouchMovePan"));p(this,"handleTouchStartDolly",a(()=>{let r=this.touch.touches[0].x-this.touch.touches[1].x,i=this.touch.touches[0].y-this.touch.touches[1].y;this.zoomStart=this.getZoomAltitude();let n=new ae(this.touch.touches[0].x-r/2,this.touch.touches[0].y-i/2);this.coords.floorAnchor=this.raycastToFloor(n),this.orbit.updateMatrixWorld(),this.touch.anchor1=new Zo(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new Zo(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")},"handleTouchStartDolly"));p(this,"handleMouseMovePan",a(()=>{let r=this.raycastToFloor(this.coords.mouse);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},"handleMouseMovePan"));p(this,"handleTouchStartTilt",a(r=>{this.coords.rotateStart.set(r.touches[1].clientX,r.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")},"handleTouchStartTilt"));p(this,"handleTouchMovePedestal",a(r=>{this.handleMouseMovePedestal(r.touches[0])},"handleTouchMovePedestal"));p(this,"handleTouchMoveTilt",a(r=>{this.coords.rotateEnd.set(r.touches[1].clientX,r.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)},"handleTouchMoveTilt"));p(this,"handleTouchMoveDolly",a(()=>{let r=this.touch.inputs.first,i=this.touch.inputs.second;this.touch.anchor1.viewCoordinate={x:r.x,y:r.y},this.touch.anchor2.viewCoordinate={x:i.x,y:i.y};let n=this.makeTransformFromTouchAnchors(this.touch.anchor1,this.touch.anchor2);n&&this.setCameraFromTransformMatrix(n),this.orbit.updateMatrixWorld(),this.touch.anchor1.updateAnchorState(this.camera,r),this.touch.anchor2.updateAnchorState(this.camera,i)},"handleTouchMoveDolly"));p(this,"handleTouchEnd",a(()=>{this.state===4||this.state===5?this.publish("multi-end"):this.state===6&&this.publish("pan-end"),this.panDirty=!1},"handleTouchEnd"));p(this,"handleTouchStartPan",a(r=>{let i=Object.hasOwn(r,"x")?new ae(r.x,r.y):this.touch.touches[0],n=this.raycastToFloor(i);this.coords.panStart.set(n.x,n.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("user-pan-start"),this.publish("pan-start")},"handleTouchStartPan"));p(this,"handleTouchStartPedestal",a(r=>{this.handleMouseDownPedestal(r.touches[0])},"handleTouchStartPedestal"));p(this,"onMouseDown",a(r=>{if(this.enabled!==!1){if(this.mouseToScene(r),r.preventDefault(),this.state===3&&this.publish("zoom-end"),r.button===this.MOUSE_BUTTONS.ORBIT){if(this.enableRotate===!1)return;this.handleMouseDownRotate(r),this.state=0}else r.button===this.MOUSE_BUTTONS.PAN&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(r),this.state=8));this.state!==-1&&this.addMouseEventListeners()}},"onMouseDown"));p(this,"onMouseWheel",a(r=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3||(r.preventDefault(),r.stopPropagation(),this.mouseToScene(r),this.canScrollZoom(r)&&(this.lastWheelTime=this.clock.getElapsedTime(),this.publishUserZoomEvent()),this.state!==3&&this.canScrollZoom(r)&&(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(r))},"onMouseWheel"));p(this,"handleMouseWheel",a(r=>{if(this.publish("zoom-start"),!this.canScrollZoom(r)){this.lastWheelTime>0&&this.publish("zoom-end"),this.lastWheelTime=0,this.state=-1;return}let i=this.getZoomAltitude(),n=i-Hu(r)*i/Ku*this.zoomSpeed;if(this.setZoomAltitude(n),this.enablePan){let o=n/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")},"handleMouseWheel"));p(this,"setCameraFromTransformMatrix",a(r=>{this.orbit.updateMatrixWorld();let i=new mr;i.setFromRotationMatrix(r,"ZYX");let n=(r.elements[14]-this.cameraPlane.position.z)/Math.cos(i.x),o=i.z,s=new H(0,0,1);s.applyEuler(i),s.setLength(n);let l=new H;l.setFromMatrixPosition(r),l.sub(s),this.enablePan&&this.setPosition(l.x,l.y),this.enableZoom&&this.setZoomAltitude(n),this.enableRotate&&this.setRotation(-o)},"setCameraFromTransformMatrix"));p(this,"makeTransformFromTouchAnchors",a((r,i)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let n=this.camera.projectionMatrix.clone(),o=r.worldCoordinate,s=i.worldCoordinate,l=r.reUnproject(),u=i.reUnproject();if(!l||!u||!o||!s)return null;let h=r.viewCoordinate,m=i.viewCoordinate,f=s.x-o.x,b=s.y-o.y,y=Math.atan2(b,f),_=u.x-l.x,T=u.y-l.y,g=Math.atan2(T,_),x=qf(y,g),P=new bt;P.makeRotationZ(-x);let S=P.clone();S.multiply(r.snapHolderMatrix);let C=a((Xg,zg,Yg)=>Xg.elements[(zg-1)*4+Yg-1],"m"),w=C(n,1,1)*C(S,1,1)-h.x*C(n,3,4)*C(S,3,1),k=C(n,1,1)*C(S,1,2)-h.x*C(n,3,4)*C(S,3,2),A=C(n,1,1)*C(S,1,3)-h.x*C(n,3,4)*C(S,3,3),N=o.x*w+o.y*k+o.z*A,Y=C(n,2,2)*C(S,2,1)-h.y*C(n,3,4)*C(S,3,1),z=C(n,2,2)*C(S,2,2)-h.y*C(n,3,4)*C(S,3,2),X=C(n,2,2)*C(S,2,3)-h.y*C(n,3,4)*C(S,3,3),q=o.x*Y+o.y*z+o.z*X,F=C(n,1,1)*C(S,1,1)-m.x*C(n,3,4)*C(S,3,1),J=C(n,1,1)*C(S,1,2)-m.x*C(n,3,4)*C(S,3,2),pe=C(n,1,1)*C(S,1,3)-m.x*C(n,3,4)*C(S,3,3),se=s.x*F+s.y*J+s.z*pe,De=C(n,2,2)*C(S,2,1)-m.y*C(n,3,4)*C(S,3,1),ve=C(n,2,2)*C(S,2,2)-m.y*C(n,3,4)*C(S,3,2),ge=C(n,2,2)*C(S,2,3)-m.y*C(n,3,4)*C(S,3,3),xe=s.x*De+s.y*ve+s.z*ge,rt=Math.abs(F-w),Ge=Math.abs(J-k),Ue=Math.abs(pe-A),je=Math.abs(F-Y),Me=Math.abs(J-z),Xe=Math.abs(pe-X),Ke=Math.abs(De-w),_t=Math.abs(ve-k),Lr=Math.abs(ge-A),yt=Math.abs(De-Y),Qe=Math.abs(ve-z),ne=Math.abs(ge-X),K=Math.min(rt+Ge+Ue,je+Me+Xe),Pe=Math.min(Ke+_t+Lr,yt+Qe+ne);K<Pe&&(F=De,J=ve,pe=ge,se=xe);let Ye=Y*A-w*X,Wt=z*A-k*X,ui=q*A-N*X,pr=F*X-Y*pe,lo=J*X-z*pe,bd=se*X-q*pe,Rg=(bd*Wt-ui*lo)/(pr*Wt-Ye*lo),Ng=(bd*Ye-ui*pr)/(lo*Ye-Wt*pr),xd=z*w-k*Y,Bg=X*w-A*Y,Fg=q*w-N*Y,Sd=J*Y-z*F,Gg=pe*Y-X*F,Cd=((se*Y-q*F)*xd-Fg*Sd)/(Gg*xd-Bg*Sd),Rs=S.clone();return Rs.elements[12]=Rg,Rs.elements[13]=Ng,Rs.elements[14]=Cd,Cd>0?Rs:null},"makeTransformFromTouchAnchors"));p(this,"updateTouchOrigin",a(()=>{let r=this.renderer.domElement;this.touch.origin.offsetLeft=r.getBoundingClientRect().left,this.touch.origin.offsetTop=r.getBoundingClientRect().top},"updateTouchOrigin"));p(this,"touchToScene",a(r=>{this.touch.touches=[];for(let i=0,n=r.touches.length;i<n;i++){let o=r.touches[i],s=$f(o,this.touch.origin);this.touch.touches.push(new ae(s.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,-(s.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1))}this.coords.mouse=this.touch.touches[0]},"touchToScene"));p(this,"canScrollZoom",a(r=>{let i=Hu(r),n=this.getZoomAltitude();return!(i<0&&n===this.getZoomScaledMax()||i>0&&n===this.getZoomScaledMin())},"canScrollZoom"));p(this,"mouseToScene",a(r=>{let i=this.getMousePos(r);return this.coords.mouse.x=i.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,this.coords.mouse.y=-(i.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1,this.coords.mouse},"mouseToScene"));p(this,"getMousePos",a(r=>({x:r.offsetX,y:r.offsetY}),"getMousePos"));p(this,"handleMouseDownRotate",a(r=>{this.coords.rotateStart.set(r.clientX,r.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")},"handleMouseDownRotate"));p(this,"handleMouseDownPan",a(()=>{let r=this.raycastToFloor(this.coords.mouse);this.coords.panStart.set(r.x,r.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("pan-start"),this.publish("user-pan-start")},"handleMouseDownPan"));p(this,"handleMouseDownPedestal",a(r=>{let i=new ae(r.clientX,r.clientY);this.coords.initialShiftPos=i,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=gc(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")},"handleMouseDownPedestal"));p(this,"handleMouseMovePedestal",a(r=>{let i={x:r.clientX,y:r.clientY},n=this.coords.initialPedestal+this.pedestalScaleFactor*(i.y-this.coords.initialShiftPos.y);this.stayInsideBounds&&(n<this.minPedestal?n=Math.max(n,this.minPedestal):n>this.maxPedestal&&(n=Math.min(n,this.maxPedestal))),n!==this.getPedestal()&&this.setPedestal(n,!0)},"handleMouseMovePedestal"));p(this,"handleMouseMoveRotate",a(r=>{this.coords.rotateEnd.set(r.clientX,r.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")},"handleMouseMoveRotate"));p(this,"publishUserZoomDebounced",po(()=>{this.isUserZooming=!1,this.publish("user-zoom-end")},250));p(this,"publishUserZoomEvent",a(()=>{this.isUserZooming?this.publishUserZoomDebounced():(this.publish("user-zoom-start"),this.isUserZooming=!0,this.publishUserZoomDebounced())},"publishUserZoomEvent"));p(this,"setCameraMoving",a(()=>{this.cameraMoving=!0},"setCameraMoving"));p(this,"unsetCameraMoving",a(()=>{this.cameraMoving=!1,this.lastCameraMoveTime=Date.now()},"unsetCameraMoving"));p(this,"setUserInteracting",a(()=>{this.userInteracting=!0},"setUserInteracting"));p(this,"unsetUserInteracting",a(()=>{this.userInteracting=!1},"unsetUserInteracting"));p(this,"publishPedestalChangeEvent",a(r=>{this.publish("pedestal-change",{pedestal:r,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})},"publishPedestalChangeEvent"));p(this,"convertAltitudeToZoomLevel",a(r=>{let[,i]=this.center,o=r*2*Math.tan(ue.degToRad(this.camera.fov)/2)/this.options.canvasHeight,s=Math.cos(ue.degToRad(i))*2*Math.PI*dc/o;return ue.clamp(Math.log2(s/512),Ha,Wa)},"convertAltitudeToZoomLevel"));p(this,"convertZoomLevelToAltitude",a(r=>{let[,i]=this.center,n=ue.clamp(r,Ha,Wa),o=Math.pow(2,n),s=ue.clamp(i,qu,$u),l=o*512;return Math.cos(ue.degToRad(s))*Math.PI*2*dc/l*this.options.canvasHeight/2/Math.tan(ue.degToRad(this.camera.fov)/2)},"convertZoomLevelToAltitude"));p(this,"completeTween",a(r=>{r.isPlaying()&&r.stop(),this.rendererState.internalTweenGroup.remove(r),this.tweens.delete(r)},"completeTween"));p(this,"debugContainer",new fr);this.camera=r,this.renderer=n,this.rendererState=o,this.scene=i,this.options=s,this.elevation=r.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=r.position.z,s.mode!=="outdoors-overlay"&&this.addEventListeners()}get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(r){this.minZoomAltitude=this.convertZoomLevelToAltitude(r),this.stateDirty=!0}get defaultMinZoomLevel(){return c(this,$a)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(r){this.maxZoomAltitude=this.convertZoomLevelToAltitude(r),this.stateDirty=!0}get scrollPercent(){let r=this.minPedestal,i=this.maxPedestal,n=this.getPedestal();return n=Math.min(n,i),n=Math.max(n,r),(n-r)/(i-r)*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(){var o,s,l,u;let r=this.getPosition(),{lat:i,lon:n}=ea((s=(o=this.rendererState.center)==null?void 0:o[1])!=null?s:0,(u=(l=this.rendererState.center)==null?void 0:l[0])!=null?u:0,r.x,r.y);return[n,i]}setCenter(r,i){var s,l,u,h;let{x:n,y:o}=ta((l=(s=this.rendererState.center)==null?void 0:s[1])!=null?l:0,(h=(u=this.rendererState.center)==null?void 0:u[0])!=null?h:0,i,r);this.setPosition(n,o)}get isAnimating(){return this.rendererState.internalTweenGroup.getAll().some(r=>r.cameraAnimation)}getCameraFrameForCoordinates(r,i){let n=i.minZoom!==void 0?i.minZoom:this.minZoomAltitude,o=i.maxZoom!==void 0?i.maxZoom:this.maxZoomAltitude,s=this.options.canvasWidth,l=this.options.canvasHeight,u=this.getRotation(),h=this.getTilt(),m=this.getPosition();this.setRotation(i.rotation||u,!0),this.setTilt(i.tilt||h,!0);let f=Kf(r,{canvasWidth:s,canvasHeight:l,paddingOption:i.padding,verticalPadding:i.verticalPadding,minZoom:n,maxZoom:o,position:m,camera:this.camera,orbit:this.orbit});return this.setRotation(u,!0),this.setTilt(h,!0),{center:f.position,zoomLevel:this.convertAltitudeToZoomLevel(f.zoom)}}focusOn(r,i){if(JC){this.debugContainer&&ze(this.debugContainer);let g=new kr(4,4,4),x=new st({color:65280,depthTest:!1}),P=new Br(g,x,r.length),S=new bt;r.forEach((C,w)=>{S.setPosition(C),P.setMatrixAt(w,S)}),P.instanceMatrix.needsUpdate=!0,this.debugContainer.add(P),this.scene.add(this.debugContainer)}let n=i.curve,o=i.callback,s=i.cancelledCallback,l=i.minZoom!==void 0?i.minZoom:this.minZoomAltitude,u=i.maxZoom!==void 0?i.maxZoom:this.maxZoomAltitude,h=this.options.canvasWidth,m=this.options.canvasHeight,f;i.duration!==void 0?f=i.duration:E.env.TESTING==="true"?f=0:f=Qu;let b=i.padding,y=this.getRotation(),_=this.getTilt();i.rotation!=null&&this.setRotation(i.rotation),i.tilt!=null&&this.setTilt(i.tilt);let T=Kf(r,{canvasHeight:m,paddingOption:b,canvasWidth:h,minZoom:l,maxZoom:u,camera:this.camera,orbit:this.orbit,position:this.getPosition(),verticalPadding:i.verticalPadding});this.setRotation(y),this.setTilt(_),this.animateCamera({position:T.position,tilt:i.tilt,rotation:i.rotation,zoom:T.zoom},f,n,o,s,i)}resize(r,i){this.options.canvasWidth=r,this.options.canvasHeight=i}};$a=new WeakMap,a(Ja,"CameraSystem"),p(Ja,"CAMERA_FRAME_PADDING_SIDES",["top","bottom","left","right"]);var jn=Ja;function Kf(t,{canvasWidth:e,orbit:r,paddingOption:i,verticalPadding:n=0,canvasHeight:o,minZoom:s,maxZoom:l,camera:u,position:h}){let m={zoom:s,position:h};if(t.length===0)return m;for(let Ye of jn.CAMERA_FRAME_PADDING_SIDES)typeof i[Ye]!="number"&&(i[Ye]=0);let f=i.type==="portion"?{top:i.top*o,bottom:i.bottom*o,left:i.left*e,right:i.right*e,type:"pixel"}:i;if(f.left+f.right>=e||f.top+f.bottom>=o)return m;r.updateMatrixWorld();let b=u.matrixWorldInverse,y=u.fov*(Math.PI/180)/2,_=y,g=Math.atan(Math.tan(y)*(e/o)),x=new H(1/0,1/0,1/0),P=new H(-1/0,-1/0,-1/0),S=new it,C=new H;for(let Ye=0,Wt=t.length;Ye<Wt;Ye++)C.copy(t[Ye]),S.expandByPoint(C),C.applyMatrix4(b),x.min(C),P.max(C),C.copy(t[Ye]),C.z-=n,C.applyMatrix4(b),x.min(C),P.max(C),C.copy(t[Ye]),C.z+=n,C.applyMatrix4(b),x.min(C),P.max(C);let w=P.x-x.x,k=P.y-x.y,A=e-f.left-f.right,N=o-f.top-f.bottom,Y=(P.x+x.x)/2,z=(P.y+x.y)/2,X=w/A,q=k/N,F=s,J=l,pe=F*Math.tan(g)*2,se=J*Math.tan(g)*2,De=pe/e,ve=se/e,ge=Math.max(X,q);ge=ue.clamp(ge,De,ve);let xe=A*ge,rt=N*ge,Ge={min:{x:Y-xe/2-f.left*ge,y:z-rt/2-f.bottom*ge},max:{x:Y+xe/2+f.right*ge,y:z+rt/2+f.top*ge}},Ue=(Ge.min.x+Ge.max.x)/2,je=(Ge.min.y+Ge.max.y)/2,Me=S.getCenter(new H),Xe=Math.abs(Ue-Ge.min.x),Ke=Math.abs(je-Ge.min.y),_t=Xe/Math.tan(g),Lr=Ke/Math.tan(_),yt=new H;yt.set(Ue,je,P.z+Math.max(_t,Lr)),yt.applyMatrix4(u.matrixWorld);let Qe=new H;Qe.set(Ue,je,P.z),Qe.applyMatrix4(u.matrixWorld);let ne=new H().subVectors(Qe,yt),K=(Me.z-yt.z)/ne.z,Pe=new H().copy(yt).add(ne.clone().multiplyScalar(K));return Qe.set(Pe.x,Pe.y,Pe.z),yt.sub(Qe),{position:Pe,zoom:yt.length()}}a(Kf,"getCameraFrameForPoints");var KC=0,QC=90,e_=(E.env.NODE_ENV==="test",!1),Ka={linear:Et.Linear.None,"ease-in":Et.Quadratic.In,"ease-out":Et.Quadratic.Out,"ease-in-out":Et.Quadratic.InOut},t_=-50,$,ie,Ir,jo,Ho,rh,ih=class ih{constructor(e,r,i){L(this,Ho);L(this,$);L(this,ie);L(this,Ir);L(this,jo);R(this,$,e),R(this,ie,r),R(this,Ir,i),c(this,$).map&&c(this,$).map.transform.setMinElevationForCurrentTile(t_),c(this,ie).cameraSystem.on("pedestal-change",({pedestal:n})=>{c(this,ie).cameraSystem.setCameraPlaneElevation(n)})}get center(){var e,r;return c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(r=(e=c(this,$).map).getCenter)==null?void 0:r.call(e).toArray():c(this,ie).cameraSystem.center}setCenter(e){var r;if(c(this,$).mode==="outdoors-overlay"&&c(this,$).map){(r=c(this,$).map)==null||r.setCenter(e),c(this,ie).interactionSystem.handleHover();return}c(this,ie).cameraSystem.setCenter(e[0],e[1]),c(this,ie).interactionSystem.handleHover()}get zoomLevel(){var e;return c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(e=c(this,$).map)==null?void 0:e.getZoom():c(this,ie).cameraSystem.getZoomLevel()}setZoomLevel(e){var r;c(this,$).mode==="outdoors-overlay"&&c(this,$).map&&((r=c(this,$).map)==null||r.setZoom(e)),c(this,ie).cameraSystem.setZoomLevel($t(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 c(this,ie).cameraSystem.isAnimating}cancelAnimation(){c(this,ie).cameraSystem.cancelAnimation()}get maxZoomLevel(){return c(this,ie).cameraSystem.maxZoomLevel}get minZoomLevel(){return c(this,ie).cameraSystem.minZoomLevel}setAutoMinZoomLevel(e){c(this,ie).panBoundsSystem.autoMinZoomLevel=e,e&&(c(this,ie).panBoundsSystem.dirty=!0,c(this,ie).panBoundsSystem.update())}get autoMinZoomLevel(){return c(this,ie).panBoundsSystem.autoMinZoomLevel}setMinZoomLevel(e,r=!1){var n;r&&this.setAutoMinZoomLevel(!1);let i=$t(e,Dt.MIN_MERCATOR_ZOOM_LEVEL,this.maxZoomLevel,"setMinZoomLevel was clamped. minZoomLevel must be between ".concat(Dt.MIN_MERCATOR_ZOOM_LEVEL," and maxZoomLevel."));c(this,ie).cameraSystem.setMinZoomLevel(i),this.zoomLevel<i&&this.setZoomLevel(i),(n=c(this,$).map)==null||n.setMinZoom(i)}setMaxZoomLevel(e){var i;let r=$t(e,this.minZoomLevel,Dt.MAX_MERCATOR_ZOOM_LEVEL,"setMaxZoomLevel was clamped. maxZoomLevel must be between minZoomLevel and ".concat(Dt.MAX_MERCATOR_ZOOM_LEVEL,"."));c(this,ie).cameraSystem.setMaxZoomLevel(r),this.zoomLevel>r&&this.setZoomLevel(r),(i=c(this,$).map)==null||i.setMaxZoom(r)}get maxPitch(){var e,r;return c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(r=(e=c(this,$).map)==null?void 0:e.getMaxPitch)==null?void 0:r.call(e):ue.radToDeg(c(this,ie).cameraSystem.maxTilt)}get minPitch(){var e,r;return c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(r=(e=c(this,$).map)==null?void 0:e.getMinPitch)==null?void 0:r.call(e):ue.radToDeg(c(this,ie).cameraSystem.minTilt)}setMinPitch(e){var i;let r=Math.max(KC,e);(i=c(this,$).map)==null||i.setMinPitch(r),c(this,ie).cameraSystem.minTilt=ue.degToRad(r)}setMaxPitch(e){var i;let r=Math.min(QC,e);(i=c(this,$).map)==null||i.setMaxPitch(r),c(this,ie).cameraSystem.maxTilt=ue.degToRad(r)}get bearing(){var e;return c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(e=c(this,$).map)==null?void 0:e.getBearing():ue.radToDeg(c(this,ie).cameraSystem.getRotation())}setBearing(e){var r;if(c(this,$).mode==="outdoors-overlay"&&c(this,$).map){(r=c(this,$).map)==null||r.setBearing(e);return}c(this,ie).cameraSystem.setRotation(ue.degToRad(e))}get pitch(){var e;return c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(e=c(this,$).map)==null?void 0:e.getPitch():ue.radToDeg(c(this,ie).cameraSystem.getTilt())}setPitch(e){var r;if(c(this,$).mode==="outdoors-overlay"&&c(this,$).map){(r=c(this,$).map)==null||r.setPitch(e);return}c(this,ie).cameraSystem.setTilt(ue.degToRad($t(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 c(this,ie).cameraSystem.getPedestal()}setElevation(e){c(this,ie).cameraSystem.setPedestal(e,!0)}animateElevation(e,r){return c(this,jo)&&c(this,jo).stop(),new Promise(i=>{var n;c(this,ie).cameraSystem.animateCamera({position:{z:e}},(r==null?void 0:r.duration)||300,Ka[(r==null?void 0:r.easing)||"ease-in-out"],i,i,{interruptible:(n=r==null?void 0:r.interruptible)!=null?n:!0})})}get insetsPadding(){return c(this,Ir).insetsPadding}get panMode(){return c(this,ie).cameraSystem.enablePan===!1&&c(this,ie).cameraSystem.enablePedestal===!0?"elevation":"default"}setPanMode(e){if(e!=="default"&&e!=="elevation")throw new Error("Invalid pan mode");e!==this.panMode&&(e==="default"?(c(this,ie).cameraSystem.enablePan=!0,c(this,ie).cameraSystem.enablePedestal=!1):(c(this,ie).cameraSystem.enablePan=!1,c(this,ie).cameraSystem.enablePedestal=!0))}setInsetPadding(e){c(this,Ir).insetsPadding=Object.assign({},c(this,Ir).insetsPadding,e)}animateTo(e){var s,l,u,h,m,f;if(c(this,$).mode==="outdoors-overlay"&&c(this,$).map)return(f=c(this,$).map)==null||f.flyTo({center:(s=e.center)!=null?s:this.center,zoom:(l=e.zoomLevel)!=null?l:this.zoomLevel,bearing:(u=e.bearing)!=null?u:this.bearing,pitch:(h=e.pitch)!=null?h:this.pitch,duration:(m=e.duration)!=null?m:600}),Promise.resolve();let r=e.center?c(this,$).convertTo3DMapPosition(e.center[1],e.center[0],e.center[2]||this.elevation):void 0,i=e.zoomLevel!==void 0?c(this,ie).cameraSystem.convertZoomLevelToAltitude($t(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,n=e.bearing!==void 0?ue.degToRad(e.bearing):void 0,o=e.pitch!==void 0?ue.degToRad($t(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(b=>{var y;c(this,ie).cameraSystem.animateCamera({position:r,zoom:i,rotation:n,tilt:o},e.duration||0,Ka[e.easing||"ease-in-out"],()=>{c(this,ie).interactionSystem.handleHover(),b()},b,{interruptible:(y=e==null?void 0:e.interruptible)!=null?y:!0})})}getCameraFrameForCoordinates(e,r){let i=_e(this,Ho,rh).call(this,r||{},()=>Promise.resolve()),{pointCloud:n}=Qf(e,c(this,$),c(this,Ir).geometry3DMap);if(n.length===0)return te.error("No valid coordinates found in targets:",e),{center:this.center,zoomLevel:this.zoomLevel};let{center:o,zoomLevel:s}=c(this,ie).cameraSystem.getCameraFrameForCoordinates(n,i);return{center:c(this,$).convert3DMapPositionToCoordinate(o),zoomLevel:s}}focusOn(e,r){var s,l,u,h;let{pointCloud:i,geoBounds:n,firstPosition:o}=Qf(e,c(this,$),c(this,Ir).geometry3DMap);return i.length===0?(te.error("No valid coordinates found in targets:",e),Promise.resolve()):c(this,$).mode==="outdoors-overlay"&&c(this,$).map?(i.length===1&&o?(s=c(this,$).map)==null||s.flyTo({center:[o[0],o[1]],duration:(r==null?void 0:r.duration)||c(this,$).map.getBearing(),animate:!0,bearing:(r==null?void 0:r.bearing)===void 0?c(this,$).map.getBearing():r==null?void 0:r.bearing,pitch:(r==null?void 0:r.pitch)===void 0?c(this,$).map.getPitch():r==null?void 0:r.pitch,zoom:(r==null?void 0:r.maxZoomLevel)||c(this,$).map.getMaxZoom()}):(e_&&r_(c(this,$),n),(h=c(this,$).map)==null||h.fitBounds(n,{duration:(l=r==null?void 0:r.duration)!=null?l:Dt.DEFAULT_ANIMATION_DURATION,bearing:(r==null?void 0:r.bearing)===void 0?c(this,$).map.getBearing():r==null?void 0:r.bearing,pitch:(r==null?void 0:r.pitch)===void 0?c(this,$).map.getPitch():r==null?void 0:r.pitch,maxZoom:(u=r==null?void 0:r.maxZoomLevel)!=null?u:c(this,$).map.getMaxZoom()})),c(this,ie).interactionSystem.handleHover(),Promise.resolve()):new Promise(m=>{c(this,ie).cameraSystem.focusOn(i,_e(this,Ho,rh).call(this,r||{},m))})}};$=new WeakMap,ie=new WeakMap,Ir=new WeakMap,jo=new WeakMap,Ho=new WeakSet,rh=a(function(e,r){var i;return{minZoom:(e==null?void 0:e.maxZoomLevel)===void 0?void 0:c(this,ie).cameraSystem.convertZoomLevelToAltitude($t(e.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMaxZoomLevel() to adjust limits.")),maxZoom:(e==null?void 0:e.minZoomLevel)===void 0?void 0:c(this,ie).cameraSystem.convertZoomLevelToAltitude($t(e.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() to adjust limits.")),padding:e!=null&&e.padding?Object.assign({},Js,e==null?void 0:e.padding):this.insetsPadding,curve:Ka[(e==null?void 0:e.easing)||"ease-in-out"],rotation:(e==null?void 0:e.bearing)===void 0?void 0:ue.degToRad(e.bearing),tilt:(e==null?void 0:e.pitch)!==void 0?ue.degToRad($t(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==null?void 0:e.duration,callback:a(()=>{c(this,ie).interactionSystem.handleHover(),r()},"callback"),cancelledCallback:r,interruptible:(i=e==null?void 0:e.interruptible)!=null?i:!0,verticalPadding:e==null?void 0:e.verticalPadding}},"#convertToLegacy"),a(ih,"Camera");var Qa=ih;function th(t,e){t[0]=Math.min(t[0],e[0]),t[1]=Math.min(t[1],e[1]),t[2]=Math.max(t[2],e[0]),t[3]=Math.max(t[3],e[1])}a(th,"updateBounds");function Qf(t,e,r){var l;let i=[],n=[1/0,1/0,-1/0,-1/0],o=null;if(!t||!Array.isArray(t)||t.length===0)return{pointCloud:i,geoBounds:n,firstPosition:o};let s=e.getSystems().renderSystem;(s.threeDdirty||s.twoDdirty)&&e.renderSync();for(let u of t)if(typeof u=="string"){let h=r.get(u);if(!h){te.error("Entity not found with id:",u);continue}let m=new it;lp(e,"userData"in h&&(l=h.userData.entityId)!=null?l:h.id,i,m,h instanceof Ie?h.position.z:void 0);let f=e.convert3DMapPositionToCoordinate(m.min),b=e.convert3DMapPositionToCoordinate(m.max);th(n,f),th(n,b),o||(o=e.convert3DMapPositionToCoordinate(m.getCenter(new H)))}else i.push(e.convertTo3DMapPosition(u[1],u[0],u[2]||0)),th(n,u),o||(o=u);return{pointCloud:i,geoBounds:n,firstPosition:o}}a(Qf,"processTargets");function r_(t,e){var i,n,o,s;let r=[[e[0],e[1]],[e[0],e[3]],[e[2],e[3]],[e[2],e[1]],[e[0],e[1]]];(i=t.map)!=null&&i.getLayer("bounds-outline")&&t.map.removeLayer("bounds-outline"),(n=t.map)!=null&&n.getSource("bounds-source")&&t.map.removeSource("bounds-source"),(o=t.map)==null||o.addSource("bounds-source",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:r}}}),(s=t.map)==null||s.addLayer({id:"bounds-outline",type:"line",source:"bounds-source",layout:{},paint:{"line-color":"#FF0000","line-width":2,"line-opacity":.8}})}a(r_,"drawBounds");var nh="";var Hi=!1,i_=150,sh=class sh extends me{constructor(r,i,n=!0){super();p(this,"worker");p(this,"debugContext");p(this,"debugCanvas");p(this,"collidersDirty",!0);p(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]);p(this,"visibleCollidersQTree",new Tt(new Se(0,0,0,0)));p(this,"interactiveCollidersQTree",new Tt(new Se(0,0,0,0)));p(this,"coreState");p(this,"postMessage");p(this,"showCollisionBoxes",a(()=>{Hi=!0,this.debugCanvas.style.display="block"},"showCollisionBoxes"));p(this,"hideCollisionBoxes",a(()=>{Hi=!1,this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugCanvas.style.display="none"},"hideCollisionBoxes"));p(this,"currentMsgId","");p(this,"working",!1);p(this,"_postMessage",a(()=>{this.worker.postMessage(this.packedMessage)},"_postMessage"));p(this,"componentArray",[]);p(this,"update",a((r,i,n="bottom-left",o=!1)=>{let s=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];let l;for(let u of this.coreState.geometry2DIdsInScene){let h=this.coreState.geometry2DMap.get(u);h&&(l=h.components[0],this.componentArray.push(l))}this.resize(r,i,n),this.collidersDirty=!1,s=!0}else s=this.componentArray.some(l=>l.collisionDirty===!0);s&&this.componentArray.sort((l,u)=>u.rank-l.rank);for(let l=0;l<this.componentArray.length;l++)if(this.packedMessage){let u=this.componentArray[l].toPackedMessage(o&&!s);this.packedMessage[0][l]==null&&(this.packedMessage[0][l]=[]),this.packedMessage[0][l][0]==null&&(this.packedMessage[0][l][0]=[]),this.packedMessage[0][l][0]=u.bboxes,this.packedMessage[0][l][1]=u.enabled&&this.componentArray[l].visible&&!this.componentArray[l].isOccluded?1:0,this.packedMessage[0][l][2]=u.rank===Ni?1:0,this.packedMessage[0][l][3]=u.x,this.packedMessage[0][l][4]=u.y,this.packedMessage[0][l][5]=u.shouldCollideWithScreenEdges?1:0,this.packedMessage[0][l][6]=u.lockedToStrategyIndex}this.working||this.postMessage()},"update"));p(this,"resolve",a(r=>{if(this.working=!1,this.collidersDirty||!r.data)return;let i=r.data.colliders,n=-1,o,s,l;Hi&&(this.visibleCollidersQTree=new Tt(new Se(0,0,this.debugCanvas.width,this.debugCanvas.height))),this.interactiveCollidersQTree=new Tt(new Se(0,0,this.debugCanvas.width,this.debugCanvas.height));for(let u=0;u<this.componentArray.length;u++){let h=this.componentArray[u];i[u]!=null&&(n=i[u][0],o=i[u][2],h.offscreen=i[u][1]===1,n!==-1&&o!=null?(l=new Se(o.x,o.y,o.w,o.h,{entityId:h.id}),Hi&&this.visibleCollidersQTree.insert(l),s=this.coreState.geometry2DMap.get(h.id),(s==null?void 0:s.components[1])!=null&&this.interactiveCollidersQTree.insert(new Se(o.x,o.y,o.w,o.h,{entityId:h.id})),(h.canShow===!1||h.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in h&&(h.visibilityNeedsUpdate="show"),n!==-1&&n!==h.currentStrategyIndex&&(h.activeBoundingBox=l,h.onStrategySelected(n))):((h.canShow===!0||h.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in h&&(h.visibilityNeedsUpdate="hide"),n!==-1&&n!==h.currentStrategyIndex&&h.onStrategySelected(n)))}Hi&&this.drawDebug(),this.publish("visibility-changed")},"resolve"));p(this,"drawDebug",a(()=>{Hi&&this.visibleCollidersQTree&&(this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugContext.beginPath(),this.visibleCollidersQTree.drawObjects(this.debugContext))},"drawDebug"));p(this,"destroy",a(()=>{this.worker.terminate()},"destroy"));this.worker=n===!1?new Po:nh!==""?new Worker(nh):new Worker(URL.createObjectURL(new Blob([Sp],{type:"text/javascript"}))),this.worker.onerror=()=>{this.worker=new Po,this.worker.onmessage=o=>this.resolve(o)},this.coreState=i,this.debugCanvas=r,this.debugContext=r.getContext("2d"),this.worker.onmessage=o=>this.resolve(o),this.postMessage=Xp(this._postMessage,i_,!1),Hi?this.showCollisionBoxes():this.hideCollisionBoxes()}resize(r,i,n){this.packedMessage[6]=n,this.packedMessage[5]=i,this.packedMessage[4]=r,this.packedMessage[3]=this.debugCanvas.width,this.packedMessage[2]=this.debugCanvas.height}};a(sh,"CollisionSystem");var el=sh;v();v();v();v();var lh=class lh{constructor(e){p(this,"type");p(this,"event");this.type=0,this.event=e}get timestamp(){return this.event.timeStamp}};a(lh,"Tap");var tl=lh,ch=class ch{constructor(){p(this,"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(){var e;return this.isSingleTap&&((e=this.lastPointerDown)==null?void 0:e.type)===1}get isSingleTapWithOneFinger(){var e;return this.isSingleTap&&((e=this.lastPointerDown)==null?void 0:e.type)===0}get isDoubleTapWithOneFinger(){var e,r;return this.isDoubleTap&&((e=this.taps[0])==null?void 0:e.type)===0&&((r=this.taps[1])==null?void 0:r.type)===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(e){this.taps=this.taps.filter(r=>e-r.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};a(ch,"TapsController");var rl=ch;v();function uh(t){let e=new Set;for(let r of t){let i=r.object;for(;i.visible&&i.parent&&i.parent.visible===!0&&!e.has(i.parent);)i=i.parent,i instanceof Ie&&i.type==="group-container"&&i.visible&&i.components[0]&&e.add(i)}return Array.from(e)}a(uh,"getUniqueIntersectedGroupContainers");var Hn,hh=class hh extends me{constructor(r,i,n,o,s){super();p(this,"raycaster",new qt);p(this,"state",{hovered3DEntity:void 0,hovered2DEntity:void 0,hovered3DContainers:void 0,lastHover:void 0,interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}});p(this,"coreState");p(this,"camera");p(this,"worldPlane");p(this,"_quadtree",new Tt(new Se(0,0,0,0)));p(this,"_container");p(this,"lastPointerEvent");p(this,"cursor","grab");p(this,"touchesCount",0);p(this,"isUserInteracting");p(this,"hasTouched",!1);L(this,Hn);p(this,"onPointerMoveRaf",a(r=>{this.lastPointerEvent=r,c(this,Hn)&&cancelAnimationFrame(c(this,Hn)),R(this,Hn,requestAnimationFrame(()=>{this.onPointerMove(r)}))},"onPointerMoveRaf"));p(this,"onPointerMove",a(r=>{r.preventDefault(),this.updateInteractionStateIfPanning(r),(r.pointerType!=="touch"||r.pointerType===void 0&&this.hasTouched)&&this.handleHover(r),this.handleCursor()},"onPointerMove"));p(this,"tapsControl",new rl);p(this,"onPointerDown",a(r=>{r.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,!1),this._container.addEventListener("pointercancel",this.onPointerUp,!1),this.state.interaction.mouseDownStart={time:Date.now(),timestamp:r.timeStamp,offsetX:r.offsetX,offsetY:r.offsetY},this.lastPointerEvent=r,this.state.interaction.distanceFromMouseDown=0,this.handleCursor(),r.pointerType==="touch"&&(this.tapsControl.add(new tl(r)),this.touchesCount=Math.max(0,this.touchesCount+1)))},"onPointerDown"));p(this,"clickTimeout");p(this,"onPointerUp",a(r=>{this.tapsControl.discardOutsideOfWaitWindow(r.timeStamp),this.lastPointerEvent=r,this.touchesCount=Math.max(0,this.touchesCount-1),this.touchesCount===0&&(this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)),this.updateInteractionStateIfPanning(r);let{mouseDownStart:i}=this.state.interaction;!i||this.state.interaction.distanceFromMouseDown==null||(Date.now()<i.time+300&&(this.tapsControl.isSingleTapWithTwoFingers||this.state.interaction.distanceFromMouseDown<=15)&&(r.pointerType==="touch"?this.tapsControl.isSingleTapWithTwoFingers?(this.publish("singletap-with-twofinger",r),this.flush()):this.tapsControl.isSingleTapWithOneFinger&&this.touchesCount===0?(this.clickTimeout&&clearTimeout(this.clickTimeout),this.clickTimeout=window.setTimeout(()=>{this.handleClick(r),this.flush()},300)):this.tapsControl.isDoubleTapWithOneFinger&&(this.publish("doubletap-with-onefinger",r),this.flush()):this.handleClick(r)),this.state.interaction.mouseDownStart=void 0,this.state.interaction.distanceFromMouseDown=void 0,this.state.interaction.isPanning=!1,this.handleCursor())},"onPointerUp"));p(this,"dirty3D",!0);p(this,"cachedHitBoxes",{entities:[]});p(this,"ndcPoint",new ae);p(this,"debugPanel");this.isUserInteracting=s,this.raycaster.layers.enableAll(),this.raycaster.layers.disable(1),this.camera=n,this._container=r,this.coreState=i,this.worldPlane=o,this._container.addEventListener("pointerdown",this.onPointerDown,!1),this._container.addEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.classList.add("mappedin-interactive")}updateQuadtree(r){this._quadtree=r}setHovered3DEntityInteractionComponentDirty(){if(this.state.hovered3DEntity){let r=this.state.hovered3DEntity.components[2];r&&(r.dirty=!0)}}getThreeDIntersectsFromXY(r){this.raycaster.setFromCamera(r,this.camera),this.raycaster.layers.enable(0);let i=this.raycaster.intersectObjects(this._hitBoxes.entities,!0).filter(o=>{var s,l;return((s=o.object)==null?void 0:s.name)==="worldPlane"||((l=o.object)==null?void 0:l.visible)}),n=i.findIndex(o=>{var s;return((s=o.object)==null?void 0:s.name)==="worldPlane"});return n!==-1&&i.push(i.splice(n,1)[0]),i}getGroupContainerIntersectsFromXY(r){let i=this.getThreeDIntersectsFromXY(r),n;return i!=null&&i.length>0&&(n=uh(i)),n}flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(r){let i=r||this.lastPointerEvent;if(this.state.interaction.mouseDownStart||!i||this.isUserInteracting())return;let{entity3D:n,entity2D:o,position:s,groupContainers:l}=this.intersect(i);(this.detect3DEntityHover(n)||this.detect2DEntityHover(o)||this.detect3DContainerHover(l))&&(this.state.hovered3DEntity=n,this.state.lastHover=n,this.state.hovered2DEntity=o,this.state.hovered3DContainers=l,this.publish("hover",{entity2D:this.state.hovered2DEntity,entity3D:this.state.hovered3DEntity,position:s,groupContainers:l})),this.handleCursor()}handleCursor(){var s;let r=!!(this.state.hovered3DEntity&&((s=this.state.hovered3DEntity)!=null&&s.components[2])||this.state.hovered2DEntity),i=!!this.state.interaction.mouseDownStart,n=this.state.interaction.isPanning,o=s_(r,n,i);this.cursor!==o&&(this.cursor=o,o==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}detect2DEntityHover(r){return this.state.hovered2DEntity!==r}handleClick(r){let i=this.intersect(r);this.publish("click",{entity2D:i.entity2D,entity3D:i.entity3D,position:i.position,groupContainers:i.groupContainers,pointerEvent:{button:r.button}})}get _hitBoxes(){if(this.dirty3D){this.cachedHitBoxes.entities=[];let r;for(let i of this.coreState.geometry3DIdsInScene)r=this.coreState.geometry3DMap.get(i),((r==null?void 0:r.type)==="geometry"||(r==null?void 0:r.type)==="model"||(r==null?void 0:r.type)==="path"||(r==null?void 0:r.type)==="custom-geometry")&&r.components[0].mesh&&!this.cachedHitBoxes.entities.includes(r.components[0].mesh)&&this.cachedHitBoxes.entities.push(r.components[0].mesh);return this.dirty3D=!1,this.cachedHitBoxes.entities.push(this.worldPlane),this.cachedHitBoxes}return this.cachedHitBoxes}intersect(r){var x,P,S,C,w;let{offsetX:i,offsetY:n}=r,o=[i,n],s=this._quadtree.queryPoint(o),[l]=s.filter(k=>k.intersectsPoint(o));this.ndcPoint.x=i/this._container.clientWidth*2-1,this.ndcPoint.y=-(n/this._container.clientHeight)*2+1;let u=this.getThreeDIntersectsFromXY(this.ndcPoint),h=(x=u[0])==null?void 0:x.point,m=[],f=[],b=u.filter(k=>k.object.name!=="worldPlane");for(let k of b)k.object instanceof be&&k.object.material.depthTest===!1?m.push(k):f.push(k);let y=(S=(P=m[0])!=null?P:f[0])!=null?S:void 0,_,T;if(y!=null){if(_=l_(y.object,this.coreState.geometry3DMap),!_){let k=(C=y==null?void 0:y.instanceId)!=null?C:y==null?void 0:y.batchId;_=k!=null&&(y!=null&&y.object.userData.entities)?this.coreState.geometry3DMap.get(y==null?void 0:y.object.userData.entities[k]):this.coreState.geometry3DMap.get(y==null?void 0:y.object.userData.entityId)}_!=null&&_.components[2]&&(T=_)}let g=uh(b);return{entity2D:((w=l==null?void 0:l.userData)==null?void 0:w.entityId)==="watermark"?{id:"watermark"}:this.coreState.geometry2DMap.get(l==null?void 0:l.userData.entityId),entity3D:T,position:h,groupContainers:g.length>0?g:void 0}}detect3DEntityHover(r){return this.state.lastHover!==r&&(this.state.lastHover&&ny(this.state.lastHover,!1,this.coreState),r&&ny(r,!0,this.coreState)),this.state.hovered3DEntity!==r}detect3DContainerHover(r){return!qd(this.state.hovered3DContainers,r)}updateInteractionStateIfPanning(r){this.state.interaction.mouseDownStart&&(this.state.interaction.distanceFromMouseDown=Math.sqrt(Math.pow(r.offsetX-this.state.interaction.mouseDownStart.offsetX,2)+Math.pow(r.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,!1),this._container.removeEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)}enableDebug(){let r=document.createElement("div");r.style.position="absolute",r.style.top="0",r.style.right="0",r.style.backgroundColor="white",r.style.padding="10px",document.body.append(r),r.id="interaction-debug-panel",this.debugPanel=r,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",i=>{var n,o,s;this.queueDebugMessage("CLICK \n3D: ".concat((n=i.entity3D)==null?void 0:n.id," \n2D: ").concat((o=i.entity2D)==null?void 0:o.id," \nPos: ").concat((s=i.position)==null?void 0:s.toArray().join(", ")),"#fdffb6")}),this.on("hover",i=>{var n,o,s;this.queueDebugMessage("HOVER \n3D: ".concat((n=i.entity3D)==null?void 0:n.id," \n2D: ").concat((o=i.entity2D)==null?void 0:o.id," \nPos: ").concat((s=i.position)==null?void 0:s.toArray().join(", ")),"#caffbf")})}get _state(){return this.state}queueDebugMessage(r,i){var o;let n=document.createElement("pre");n.style.maxWidth="300px",n.style.transition="opacity 500ms cubic-bezier(0.4, 0, 0.2, 1)",n.style.backgroundColor=i,n.textContent=r,(o=this.debugPanel)==null||o.prepend(n),setTimeout(()=>{n.style.opacity="0",setTimeout(()=>{n.remove()},500)},2500)}getCursor(){return this.cursor}};Hn=new WeakMap,a(hh,"InteractionSystem");var Wo=hh;function ny(t,e,r){var s;let i=t.components[2];i&&i.hover!==!0&&(i.hover=e?"user-interaction":!1,i.dirty=!0);let n=(s=t.components[0].textMesh)==null?void 0:s.userData.entityId;if(!n)return;let o=r.geometry3DMap.get(n);(o==null?void 0:o.type)==="text3d"&&(o.components[1].hoverByPolygon=e,o.components[1].dirty=!0)}a(ny,"updateHover");function s_(t,e,r){return e?"grabbing":t?"pointer":r?"grabbing":"grab"}a(s_,"processCursor");function a_(t){let e=t;for(;e!=null&&e.parent;){if(e instanceof Nr)return;if(e.userData.isSingleModel)return e;e=e.parent}}a(a_,"findModelParent");function l_(t,e){let r=a_(t);return r?e.get(r.userData.entityId):void 0}a(l_,"findModelParentEntity");v();v();var Wi,lr,il,$r,oy,qo,nl,sy,ay,$o,ol,Jo,Ko,sl,dh=class dh{constructor(e){L(this,$r);L(this,Wi,null);L(this,lr);p(this,"getCurrentSceneGLTF",a(async e=>{let r=O({onlyVisible:!0,binary:!0,light:!0,scale:1},e),i=await _e(this,$r,oy).call(this),n=c(this,il).call(this,r),o=await i.parseAsync(n,{trs:!1,maxTextureSize:1/0,onlyVisible:r.onlyVisible,binary:r.binary,scale:r.scale}),s;if(o instanceof ArrayBuffer)s=new Blob([o],{type:"application/octet-stream"});else{let l=JSON.stringify(o,null,2);s=new Blob([l],{type:"text/plain"})}return s},"getCurrentSceneGLTF"));L(this,il,a(e=>{let{scale:r,light:i,onlyVisible:n}=e,o=new Nr,s=new it().setFromObject(c(this,lr).entityScene);if(c(this,qo).call(this,c(this,lr).entityScene,o,n),i){let l=new Hs(16777215,.3*Math.PI);l.position.set(0,Math.max(s.max.x,s.max.y)*r*.5,s.max.y*r*4),l.lookAt(0,0,-1),l.target.position.set(0,0,-1),l.add(l.target),o.add(l)}return o},"#getExportedScene"));L(this,qo,a((e,r,i)=>{e.material&&(e instanceof Zs?_e(this,$r,sy).call(this,e).forEach(n=>r.add(n)):e instanceof pn&&r.add(_e(this,$r,ay).call(this,e))),e.children.forEach(n=>{(!i||n.visible)&&c(this,qo).call(this,n,r,i)})},"#processObject3D"));L(this,nl,a((e,r,i)=>{let n=new zd({color:new Ee(e),metalness:0});return n.opacity=r,n.transparent=i,n},"#createStandardMaterial"));L(this,$o,a(e=>{let{geometry:r,material:i,position:n,rotation:o,quaternion:s,scale:l}=e;if(!(r!=null&&r.isBufferGeometry))return e;let u=r.attributes.position,h=r.attributes.normal,m=r.attributes.uv;return c(this,ol).call(this,u,h),c(this,Ko).call(this,n,l,o,s),m&&c(this,sl).call(this,m),i!=null&&i.map&&r.type==="PlaneGeometry"&&(e.side=Rt),e},"#convertGeometry"));L(this,ol,a((e,r)=>{let i=new H,n=new H;for(let o=0;o<e.count;o++)i.fromBufferAttribute(e,o),c(this,Jo).call(this,i),e.setXYZ(o,i.x,i.y,i.z),r&&(n.fromBufferAttribute(r,o),c(this,Jo).call(this,n),r.setXYZ(o,n.x,n.y,n.z))},"#convertAttributes"));L(this,Jo,a(e=>{let r=e.y;e.y=e.z,e.z=-r},"#convertVector"));L(this,Ko,a((e,r,i,n)=>{let o=e.y;e.y=e.z,e.z=-o;let s=r.y;if(r.y=r.z,r.z=s,i instanceof mr)i.order="YXZ",i.set(i.x,i.y,i.z,i.order);else{let l=n.y;n.set(n.x,n.z,-l,n.w)}},"#convertObjectProperties"));L(this,sl,a(e=>{for(let r=0;r<e.count;r++){let i=e.getX(r),n=e.getY(r);e.setXY(r,i,n)}},"#convertUVs"));R(this,lr,e),c(this,lr).entityScene=e.entityScene,c(this,lr).geometry3DMap=e.geometry3DMap}destroy(){R(this,Wi,null)}};Wi=new WeakMap,lr=new WeakMap,il=new WeakMap,$r=new WeakSet,oy=a(async function(){if(!c(this,Wi)){let{GLTFExporter:e}=await import("./GLTFExporter-R6F7IFS2.js");R(this,Wi,new e)}return c(this,Wi)},"#getGLTFExporter"),qo=new WeakMap,nl=new WeakMap,sy=a(function(e){var s,l;let r=[],n=((s=e.userData)!=null&&s.entities?Object.values((l=e.userData)==null?void 0:l.entities):[]).map(u=>c(this,lr).geometry3DMap.get(u)),o=new Map;return n.forEach(u=>{var y;if(!u||!(u instanceof fe))return;let h=u.components[1],m=u.components[2];if(!h.visible||h instanceof Kt&&h.opacity===0||h instanceof mo||h instanceof ia)return;let f=m!=null&&m.hover?h.hoverColor||c(this,lr).hoverColor:h.color,b="".concat(f,"-").concat(h.opacity,"-").concat(Number(h.visible));o.has(b)||o.set(b,[]),(y=o.get(b))==null||y.push(u)}),o.forEach((u,h)=>{let[m,f,b]=h.split("-"),y=u.reduce((x,P)=>{if(P.type==="custom-geometry")return x;let S=P.components[0];return"geometry"in S&&S.geometry instanceof Ys&&x.push(S.geometry),x},[]),_=c(this,nl).call(this,m,Number(f),e.material.transparent),T=Pt(y,!0),g=new be(T,_);g.position.copy(e.position),g.rotation.copy(e.rotation),g.scale.copy(e.scale),g.visible=!!b,c(this,Ko).call(this,g.position,g.scale,g.rotation,g.quaternion),r.push(c(this,$o).call(this,g))}),r},"#processBatchedMesh"),ay=a(function(e){let r=e.geometry.clone(),i=e.material,n=new st({color:i.color,side:Rt});n.opacity=i.opacity,n.transparent=i.transparent;let o=new pn(r,n);return o.position.copy(e.position),o.rotation.copy(e.rotation),o.scale.copy(e.scale),o.visible=e.visible,c(this,$o).call(this,o)},"#processLineSegments"),$o=new WeakMap,ol=new WeakMap,Jo=new WeakMap,Ko=new WeakMap,sl=new WeakMap,a(dh,"ExporterSystem");var Vo=dh;v();v();v();var fh=Ns(gy());function vy(t){this.name="JSClipperError",this.message=t,this.stack=new Error().stack}a(vy,"JSClipperError");vy.prototype=Error.prototype;fh.default.Error=function(t){throw new vy(t)};var Ve=fh.default;var tT="gray",rT=.1,ts=100,yh=new Ve.ClipperOffset;function iT(t,e){yh.Clear(),e/=2;let r=t.map(n=>({X:n.x*ts,Y:n.y*ts}));yh.AddPath(r,Ve.JoinType.jtMiter,Ve.EndType.etClosedPolygon);let i=new Ve.Paths;return yh.Execute(i,e*ts),i.length?i.map(o=>o.map(s=>({x:s.X/ts,y:s.Y/ts}))):[t]}a(iT,"offset");function dl(t,e,r){var y,_,T,g,x;let{color:i=tT,opacity:n=1,altitude:o=0,height:s=rT}=r||{};Array.isArray(n)&&(n=1);let l={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:s+o},center:{x:0,y:0,z:(s+o)/2}},h=t.geometry.coordinates[0].map(P=>{let S=e(P[1],P[0]);return l.min.x=Math.min(l.min.x,S.x),l.min.y=Math.min(l.min.y,S.y),l.max.x=Math.max(l.max.x,S.x),l.max.y=Math.max(l.max.y,S.y),S});((_=(y=t.properties)==null?void 0:y.style)==null?void 0:_.edgeOffset)!=null&&t.properties.style.edgeOffset!==0||((T=t.properties)==null?void 0:T.image)!=null?h=iT(h,((x=(g=t.properties)==null?void 0:g.style)==null?void 0:x.edgeOffset)||0):h=[h];let m=[];for(let P of h){let S=new Gr;S.moveTo(P[0].x,P[0].y),P.slice(1).forEach(A=>S.lineTo(A.x,A.y)),S.lineTo(P[0].x,P[0].y);let C=t.geometry.coordinates.slice(1);S.holes=C.map(A=>{let N=A.map(z=>e(z[1],z[0])),Y=new Fr;return Y.moveTo(N[0].x,N[0].y),N.slice(1).forEach(z=>Y.lineTo(z.x,z.y)),Y.lineTo(N[0].x,N[0].y),Y});let w=uo(r==null?void 0:r.bevel,s),k=new Xr(S,w);k.userData={style:{color:i,opacity:n},usedBevelSettings:w},m.push(k)}if(m.length===1)return m[0];let f=Pt(m);m.forEach(P=>P.dispose());let b=uo(r==null?void 0:r.bevel,s);return f.userData={style:{color:i,opacity:n},usedBevelSettings:b,_split:!0},f}a(dl,"renderPolygonGeometry");v();var nT="gray",oT=.1;function pl(t,e,r){let{color:i=nT,opacity:n=1,altitude:o=0,height:s=oT}=r||{};Array.isArray(n)&&(n=1);let l={min:{x:1/0,y:1/0,z:o},max:{x:-1/0,y:-1/0,z:s+o}},u=uo(r==null?void 0:r.bevel,s),h=[];t.geometry.coordinates.forEach(f=>{let b=new Gr,y=f[0].map(g=>{let x=e(g[1],g[0]);return l.min.x=Math.min(l.min.x,x.x),l.min.y=Math.min(l.min.y,x.y),l.max.x=Math.max(l.max.x,x.x),l.max.y=Math.max(l.max.y,x.y),x});b.moveTo(y[0].x,y[0].y),y.slice(1).forEach(g=>b.lineTo(g.x,g.y)),b.lineTo(y[0].x,y[0].y);let _=f.slice(1);b.holes=_.map(g=>{let x=g.map(S=>e(S[1],S[0])),P=new Fr;return P.moveTo(x[0].x,x[0].y),x.slice(1).forEach(S=>P.lineTo(S.x,S.y)),P.lineTo(x[0].x,x[0].y),P});let T=new Xr(b,u);h.push(T)});let m=Pt(h);return h.forEach(f=>f.dispose()),m.translate(0,0,o||0),m.userData={style:{color:i,opacity:n},usedBevelSettings:u},m}a(pl,"renderMultiPolygonGeometry");v();var sT="gray",gh=new Ve.ClipperOffset,ht=100;function by(t,e,r){let{color:i=sT,opacity:n=1,width:o=1,join:s="round",cap:l="round",height:u=.01,altitude:h=0}=r||{};Array.isArray(n)&&(n=0);let m=[];for(let T=0;T<t.geometry.coordinates.length-1;T++){let g=e(t.geometry.coordinates[T][1],t.geometry.coordinates[T][0]),x=e(t.geometry.coordinates[T+1][1],t.geometry.coordinates[T+1][0]);m.push([g,x])}gh.AddPaths(m.map(T=>T.map(g=>({X:g.x*ht,Y:g.y*ht}))),s==="round"?Ve.JoinType.jsRound:s==="miter"?Ve.JoinType.jsMiter:Ve.JoinType.jsSquare,l==="round"?Ve.EndType.etOpenRound:l==="butt"?Ve.EndType.etOpenButt:Ve.EndType.etOpenSquare);let f=new Ve.PolyTree;gh.Execute(f,o/2*ht);let b=[],y={bevelEnabled:!1,depth:u};for(let T of f.m_AllPolys){let g=new Gr;if(T.IsHole())continue;let x=T.m_polygon;g.moveTo(x[0].X/ht,x[0].Y/ht),x.slice(1).forEach(P=>g.lineTo(P.X/ht,P.Y/ht)),g.lineTo(x[0].X/ht,x[0].Y/ht),g.holes=T.m_Childs.map(P=>{let S=new Fr,C=P.m_polygon;return S.moveTo(C[0].X/ht,C[0].Y/ht),C.slice(1).forEach(w=>S.lineTo(w.X/ht,w.Y/ht)),S.lineTo(C[0].X/ht,C[0].Y/ht),S}),b.push(new Xr(g,y))}let _=Pt(b);return _.translate(0,0,h||0),_.userData={style:{color:i,opacity:n}},gh.Clear(),_}a(by,"renderLineStringGeometry");v();var dt=100,aT=.22,lT=.01;function xy(t,e,r={}){let{width:i=aT,height:n=lT,color:o="gray",opacity:s=1,altitude:l=0}=r,u={min:{x:1/0,y:1/0,z:l},max:{x:-1/0,y:-1/0,z:l+n}},h={bevelEnabled:!1,depth:n},m=new Ve.ClipperOffset,f=t.geometry.coordinates.map(T=>T.map(g=>e(g[1],g[0])));m.AddPaths(f.map(T=>T.map(g=>({X:g.x*dt,Y:g.y*dt}))),Ve.JoinType.jsMiter,Ve.EndType.etOpenRound);let b=new Ve.PolyTree;m.Execute(b,i/2*dt);let y=[];for(let T of b.m_AllPolys){let g=new Gr;if(T.IsHole())continue;u.min.x=Math.min(u.min.x,T.m_polygon[0].X),u.min.y=Math.min(u.min.y,T.m_polygon[0].Y),u.max.x=Math.max(u.max.x,T.m_polygon[0].X),u.max.y=Math.max(u.max.y,T.m_polygon[0].Y);let x=T.m_polygon;g.moveTo(x[0].X/dt,x[0].Y/dt),x.slice(1).forEach(P=>g.lineTo(P.X/dt,P.Y/dt)),g.lineTo(x[0].X/dt,x[0].Y/dt),g.holes=T.m_Childs.map(P=>{let S=new Fr,C=P.m_polygon;return S.moveTo(C[0].X/dt,C[0].Y/dt),C.slice(1).forEach(w=>S.lineTo(w.X/dt,w.Y/dt)),S.lineTo(C[0].X/dt,C[0].Y/dt),S}),y.push(new Xr(g,h))}let _=Pt(y);return _.translate(0,0,l||0),_.userData={style:{color:o,opacity:s}},m.Clear(),_}a(xy,"renderMultiLineStringGeometry");v();v();var qn=I.object({type:I.enum(["Point"]),coordinates:I.array(I.number()).min(2).max(3)});var cT=I.object({rotation:I.array(I.number()).length(3).optional(),altitude:I.number().optional(),scale:I.array(I.number()).length(3).optional(),interactive:I.boolean().optional(),verticalOffset:I.number().optional(),id:I.union([I.number(),I.string()]).optional()}),uT=I.object({type:I.enum(["Feature"]),geometry:qn,properties:cT}),hT=I.object({type:I.enum(["FeatureCollection"]),features:I.array(uT)}),dT=I.object({color:I.string()}),pT=I.object({url:I.string(),color:I.string().optional(),opacity:I.number().optional(),material:I.record(I.string(),dT).optional()});function Cy(t,e,r){I.union([I.number(),I.string()]).parse(t),hT.parse(e),pT.parse(r)}a(Cy,"validateModelGroup");var rs,is,vh=class vh{constructor(e){p(this,"mesh");p(this,"type","model");p(this,"positionDirty",!0);p(this,"outline");p(this,"geometry");p(this,"material");p(this,"feature");p(this,"instanceIndex",-1);p(this,"visible",!0);p(this,"color",new Ee);p(this,"position",new H);L(this,rs,0);L(this,is,1);this.feature=e}setOpacity(){}setColor(){}get altitude(){return c(this,rs)}set altitude(e){this.mesh&&(this.mesh.position.z=e,R(this,rs,e))}getRotation(){return this.mesh?[this.mesh.rotation.x,this.mesh.rotation.y,this.mesh.rotation.z]:void 0}setRotation(e){this.mesh&&this.mesh.rotation.set(ue.degToRad(e[0]),ue.degToRad(e[1]),ue.degToRad(e[2]))}getScale(){return this.mesh?[this.mesh.scale.x,this.mesh.scale.y,this.mesh.scale.z]:void 0}setScale(e){this.mesh&&this.mesh.scale.set(e[0],e[1],e[2])}get opacity(){return c(this,is)}set opacity(e){var r,i,n;if(this.mesh){if(this.mesh.children[0]instanceof Br){for(let o of this.mesh.children)if(o instanceof Br){((r=o.userData)==null?void 0:r.originalOpacity)===void 0&&(o.userData.originalOpacity=o.material.opacity);let s=yi(e,0,(i=o.userData)==null?void 0:i.originalOpacity,0,1);o.material.opacity=s,o.material.transparent=s<1,o.material.needsUpdate=!0}}else(n=this.mesh)==null||n.traverse(o=>{o instanceof be&&o.material&&(Array.isArray(o.material)?o.material.forEach(s=>{Sy(s,e)}):Sy(o.material,e))});R(this,is,e)}}};rs=new WeakMap,is=new WeakMap,a(vh,"ModelComponent");var Qr=vh;function Sy(t,e){t.opacity!==e&&(e===1?(t.opacity=1,t.transparent=!1):(t.opacity=e,t.transparent=!0),t.needsUpdate=!0)}a(Sy,"updateMaterialOpacity");v();function ml(t){var l,u;let e=t.components[0],r=t.components[1];r.opacity!=null&&r.opacity!==e.opacity&&(e.opacity=r.opacity);let i=r.material,n=r.color;if(i||n){let h=mT(n,i);(l=e.mesh)==null||l.traverse(m=>{m instanceof be&&m.material&&(Array.isArray(m.material)?m.material.forEach(f=>{h[f.name]?f.color.set(h[f.name].color):f.color.set(n)}):h[m.material.name]?m.material.color.set(h[m.material.name].color):m.material.color.set(n))})}let o=(u=e.feature.geometry.coordinates[2])!=null?u:0,s=r.verticalOffset+o;e.altitude!==s&&(e.altitude=s),r.visible!==e.visible&&(e.visible=r.visible),r.rotation&&e.setRotation(r.rotation),r.scale&&e.setScale(r.scale)}a(ml,"applyModelGeometryStyle");function mT(t,e){let r={};if(t&&Object.assign(r,{Default:{color:t},Fabric:{color:t},Mpdn_Logo:{color:t},CouchLogo:{color:t}}),e)for(let i in e)e[i].color&&(r[i]?r[i].color=e[i].color:r[i]={color:e[i].color});return r}a(mT,"consolidateColorAndMaterial");function _y(t,e){var s,l;let r=t.components[0],n=(s=t.components[1].verticalOffset)!=null?s:0,o=r.feature.geometry.coordinates.slice();o[2]=((l=o[2])!=null?l:0)+n,r.mesh?r.mesh.position.copy(e(o)):r.position.copy(e(o))}a(_y,"applyModelPosition");function Py(t){return t instanceof Ne?t.material:null}a(Py,"getMaterial");function Ty(t){return t.side===co?"back":t.side===hi?"front":"double"}a(Ty,"getMaterialSide");function wy(t,e){t.side=e==="back"?co:e==="front"?hi:Rt}a(wy,"setMaterialSide");function fT(t){let{color:e,opacity:r,topColor:i,texture:n,topTexture:o}=t;return"".concat(e).concat(r).concat(i||"").concat(n||"").concat(o||"")}a(fT,"generateIndex");var bh=class bh extends me{constructor(r,i){super();p(this,"state");p(this,"convertTo3DMapPosition");p(this,"loader");p(this,"optimizePromise",[]);this.state=r,this.convertTo3DMapPosition=i}async getGLTFLoader(){if(this.loader)return this.loader;let{GLTFLoader:r}=await import("./GLTFLoader-NEDVOJZ7.js");return this.loader=new r,this.loader}createEntityFromFeature(r,i,n){var m,f,b;let o=new Ne(i),s=(m=i==null?void 0:i.properties)==null?void 0:m.bevel,l=n&&"bevel"in n?n.bevel:void 0,u;l?u=O(O({},s),l):s&&(u=s);let h=new fe(o,new Kt(j(O({},n),{url:(b=(f=i.properties)==null?void 0:f.image)==null?void 0:b.path,bevel:u})));return n!=null&&n.outline&&(h.components[3]=new Gn(Go(n.color))),n!=null&&n.focusable&&(h.components[4]=new Mr),h.id=r,h}createModelFromFeature(r,i,n){let o=new Qr(i),s=O({},n);i.properties.verticalOffset!=null&&(s.verticalOffset=i.properties.verticalOffset),i.properties.rotation!=null&&(s.rotation=i.properties.rotation),i.properties.scale!=null&&(s.scale=i.properties.scale);let l=new ia(s),u=new fe(o,l);return u.id=r,u}populateEntityMesh(r,i){let n=r.components[0];n.geometry=i,n.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:i.attributes.position.count},n.currentHeight=r.components[1].height,n.dirty=!1}async populateModelGroup(r,i,n){let o=new bt,s=new mr,l=new pi,u=new H,h=new Bt,m=await this.getGLTFLoader(),f=new Promise(b=>{m.load(i,y=>{"entities3D"in n.userData&&(n.userData.entities3D.size>1?y.scene.traverse(_=>{let T=_;if("isMesh"in T&&T.isMesh===!0){let g=new Br(T.geometry,T.material,r.size);g.userData={entities:{}},h.add(g),n.add(h)}}):(y.scene.traverse(_=>{"isMesh"in _&&_.isMesh===!0&&(_.position.set(0,0,0),_.rotation.set(0,0,0),_.scale.set(1,1,1),_.updateMatrix())}),h.add(y.scene),n.add(h),h.userData.isSingleModel=!0,h.userData.entityId=r.values().next().value,h.userData.type="model")),b()})});return this.optimizePromise.push(f.then(()=>{var _,T,g,x,P,S,C,w,k,A,N,Y;let b=0,y;for(let z of r.values()){if(y=this.state.geometry3DMap.get(z),!y||(y==null?void 0:y.type)!=="model")continue;let X=y.components[0],q=y.components[1],F=y.components[0].feature;X.mesh=h,X.instanceIndex=b,ml(y),y.components[1].dirty=!1;let{x:J,y:pe}=this.convertTo3DMapPosition(F.geometry.coordinates[1],F.geometry.coordinates[0],0);X.position.set(J,pe,X.altitude),s.set(ue.degToRad((T=(_=q.rotation)==null?void 0:_[0])!=null?T:bn[0]),ue.degToRad((x=(g=q.rotation)==null?void 0:g[1])!=null?x:bn[1]),ue.degToRad((S=(P=q.rotation)==null?void 0:P[2])!=null?S:bn[2])),u.set((w=(C=q.scale)==null?void 0:C[0])!=null?w:vn[0],(A=(k=q.scale)==null?void 0:k[1])!=null?A:vn[1],(Y=(N=q.scale)==null?void 0:N[2])!=null?Y:vn[2]),l.setFromEuler(s),o.compose(X.position,l,u),h.children.forEach(se=>{!y||(y==null?void 0:y.type)!=="model"||!(se instanceof Br)||(se.setMatrixAt(b,o),se.userData.entities[b]=y.id)}),X.mesh.userData.isSingleModel&&(X.mesh.matrix.copy(o),X.mesh.matrix.decompose(X.mesh.position,X.mesh.quaternion,X.mesh.scale)),b++}this.publish("model-loaded")})),h}populateEntityGroup(r){var l;let i,n,o,s;for(let u of r.values())s=this.state.geometry3DMap.get(u),s.components[0]instanceof Ne&&(n=s.components[0].feature,o=s.components[1],n.geometry.type==="Polygon"?(i=dl(n,this.convertTo3DMapPosition,o),(l=n.properties)!=null&&l.textures&&n.properties.textures.length>0&&wf(i,n.properties.textures,this.state.naturalBearing,this.convertTo3DMapPosition),this.populateEntityMesh(s,i)):n.geometry.type==="MultiPolygon"?(i=pl(n,this.convertTo3DMapPosition,o),this.populateEntityMesh(s,i)):n.geometry.type==="LineString"?(i=by(n,this.convertTo3DMapPosition,o),this.populateEntityMesh(s,i)):n.geometry.type==="MultiLineString"&&(i=xy(n,this.convertTo3DMapPosition,o),this.populateEntityMesh(s,i)));return r}update(){var r;for(let i of this.state.geometryGroupIdsToLoad.values()){let n=this.state.geometry3DMap.get(i);if(n instanceof xt&&n.userData.dirty){if(n.userData.modelURL)n.userData.modelURL&&(this.populateModelGroup(n.userData.entities3D,n.userData.modelURL,n),n.userData.dirty=!1);else try{this.populateEntityGroup(n.userData.entities3D)}catch(l){te.warn(l)}let o,s={};for(let l of n.userData.entities3D.values()){o=this.state.geometry3DMap.get(l);let u=o==null?void 0:o.components[0];if((o==null?void 0:o.type)==="geometry"){let h=o.components[1],m=fT(h);s[m]===void 0&&(s[m]={style:h,entities:[]}),s[m].entities.push(o)}else u&&"mesh"in u&&u.mesh&&((r=u.mesh)==null?void 0:r.parent)!==n&&n.add(u.mesh)}for(let l in s){let u=Tf(s[l].entities,s[l].style);n.add(u)}for(let l of n.userData.entities3D.values())if(o=this.state.geometry3DMap.get(l),o!=null&&o.entities2D.size>0)for(let u of o.entities2D.values())u&&(o.attach(u),this.publish("geometry-2d-added"));this.publish("geometry-group-added"),n.userData.dirty=!1}}return Promise.resolve()}};a(bh,"MeshCreationAndOptimizationSystem");var fl=bh;v();var xh=class xh{constructor(e,r){p(this,"state");p(this,"dirty",!0);p(this,"domTree");this.state=e,this.domTree=r}update(){if(this.dirty){let e;for(let r of Array.from(this.domTree.children))if(e=this.state.geometry2DMap.get(r.userData.entityId),e){let i=e.components[0];(!i.enabled||!i.visible||!this.state.geometry2DIdsInScene.has(r.userData.entityId))&&this.domTree.removeChild(r)}else this.domTree.removeChild(r);for(let r of this.state.geometry2DIdsInScene)if(e=this.state.geometry2DMap.get(r),e){let i=e.components[0];i instanceof nr&&i.enabled&&i.markerContainer&&!this.domTree.contains(i.markerContainer)&&(i.markerContainer.userData={entityId:e.id},this.domTree.appendChild(i.markerContainer),i.updateDimensions())}this.dirty=!1}}};a(xh,"DOMVisibilitySystem");var yl=xh;v();var Sh=class Sh{constructor(e,r){p(this,"state");p(this,"project");this.state=e,this.project=r}update(){let e,r=0,i,n;for(let o of this.state.geometry2DIdsInScene)if(e=this.state.geometry2DMap.get(o),e){n=e.components[0];let s=e.attachedTo?this.state.geometry3DMap.get(e.attachedTo):void 0;if(s instanceof fe)if(this.state.geometry3DIdsInScene.has(s.id)){i=s.components[1],n=e.components[0],(i.dirty||e.components[0].attachedDirty)&&(r=i.height,e.setAltitude(r));let l=i.visible;n.visible!==l&&(n.visible=l)}else n.visible===!0&&(n.visible=!1);this.project(e.components[0].projection,e.position),e.components[0].attachedDirty=!1}}};a(Sh,"TwoDProjectionSystem");var gl=Sh;v();v();var yT=a(function(){let e,r;return i=>{if((!r||!r)&&(e=document.createElement("canvas"),e.width=500*i,e.height=500*i,e.style.width="500px",e.style.height="500px",r=e.getContext("2d")),!r)throw new Error("Could not get 2D context");return{measureCanvas:e,measureCanvasContext:r}}},"createMeasureCanvasContext")(),My=a(({text:t,size:e,maxWidth:r,pixelRatio:i,maxLines:n=2,lineHeight:o=1.2,options:s={strokeText:!0}})=>{let l="bold ".concat(e*i,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),{measureCanvasContext:u}=yT(i);u.font=l;let h=[],m=t.split(" "),f=0,b=0,y=0;for(;b<m.length;){let x=m[b];if(f===n&&f>0){h[f-1]+="...";break}if(h[f]==null&&(h[f]=x,b++),m.length===1){h[f]=x;break}if(m[b]==null)break;let{width:P}=u.measureText(h[f]+" "+m[b]);P<=r*i?(h[f]+=" "+m[b],b++):f++}h.forEach(x=>{let{width:P}=u.measureText(x);y=Math.max(P,y)});let _=e*i*o,T=h.length*_;return{maxWidth:y,maxHeight:T,lines:h.length,draw:a((x,P,S)=>{h.length===1?(s.strokeText&&x.strokeText(h[0],P,S),x.fillText(h[0],P,S)):(s.strokeText&&(x.strokeText(h[0],P,S-_/2),x.strokeText(h[1],P,S+_/2)),x.fillText(h[0],P,S-_/2),x.fillText(h[1],P,S+_/2))},"draw")}},"shaveText");v();function Iy(t){let e=new Image;return t&&(/<svg[\s\S]*>/i.test(t)?e.src="data:image/svg+xml;base64,".concat(btoa(t)):e.src=t),e}a(Iy,"createImage");var _h=class _h extends me{constructor(r,i,n){super();p(this,"dirty",!1);p(this,"state");p(this,"colliderContext");p(this,"colliderCanvas");p(this,"transformRequestFunc");p(this,"transformRequest",a(async r=>this.transformRequestFunc?await this.transformRequestFunc(r):{url:r},"transformRequest"));p(this,"pinCache",{});p(this,"imageCache",{});p(this,"imagePromiseCache",{});p(this,"imageDimensionsCache",{});p(this,"textCache",{});p(this,"update",a(r=>{let i=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let n,o,s,l,u,h,m;for(let f of this.state.geometry2DIdsInScene)if(m=this.state.geometry2DMap.get(f),m!=null&&(h=m.components[0],h instanceof rr&&!m.disposed)){if(u=h.appearance.iconVisibleAtZoomLevel,h.appearance.icon!=null&&u&&r>=u!==h.iconVisible&&(h.iconVisible=r>=u,h.dirty=!0),(h.dirty||this.dirty)&&h.calculateMarkerSize(),o={active:h.appearance.pinColor,inactive:h.appearance.pinColorInactive},s={active:h.appearance.pinOutlineColor,inactive:h.appearance.pinOutlineColorInactive},l=mn(h.markerSize,2),n="".concat(o.active,"-").concat(o.inactive,"-").concat(s.active,"-").concat(s.inactive,"-").concat(l,"-").concat(h.iconVisible),h.labelCacheId=n,(!this.pinCache[n]||this.dirty)&&(this.prepare(h,n,this.colliderContext),h.dirty=!0),(h.appearance.icon&&(!h.imageHash||h.markerDirty)||this.dirty)&&this.cacheImage(h),this.textCache[h.id]==null||h.textDirty||this.dirty){h.dirty=!0,this.textCache[h.id]={};let{textDrawFn:y,width:_,height:T}=this.processText(h.text,h.appearance.textSize,h.appearance.maxWidth,h.appearance.maxLines,h.appearance.lineHeight);["left","center","right"].forEach(g=>{this.textCache[h.id][g]=this.textToCanvas(y,h.appearance.textSize,g,_,T,h.appearance.textColor,h.appearance.textOutlineColor)}),h.dimensions={width:Math.ceil(_/i),height:Math.ceil(T/i)}}let b=1;if(h.appearance.iconScale)if(typeof h.appearance.iconScale=="number")b=h.appearance.iconScale;else{let{on:y,input:_,output:T,easing:g}=h.appearance.iconScale;y==="zoom-level"?b=np(r,_,T,g!=null?g:"linear"):te.warn("Unsupported interpolation property: ".concat(y))}h.recomputeCurrentStrategy(h.iconVisible?b:1),h.canShow&&h.visible&&(h.enabled||h.visibilityNeedsUpdate!==!1)&&this.draw(h,n,this.colliderContext),h.textDirty=!1,h.markerDirty=!1}this.dirty=!1},"update"));p(this,"processText",a((r,i,n,o,s)=>{let l=this.state.pixelRatio,{draw:u,maxWidth:h,maxHeight:m}=My({text:r,size:i,pixelRatio:l,maxWidth:n,maxLines:o,lineHeight:s});return{textDrawFn:u,width:h+2.5*l*2,height:m+2.5*l*2}},"processText"));p(this,"textToCanvas",a((r,i,n,o,s,l,u)=>{let h=this.state.pixelRatio,m,f=o,b=s;window.OffscreenCanvas!=null&&!cp()?m=new OffscreenCanvas(f,b):(m=document.createElement("canvas"),m.width=f,m.height=b,m.style.width=f+"px",m.style.height=b+"px");let y=m.getContext("2d",{willReadFrequently:!0});if(!y)return;let _=2.5*h;y.textAlign=n,y.font="bold ".concat(i*h,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),y.textBaseline="middle",y.lineJoin="miter",y.miterLimit=2,y.strokeStyle="white",y.lineWidth=_,y.fillStyle=l,y.strokeStyle=u;let T=n==="left"?_/2:n==="center"?f/2:f-_/2;return r(y,T,(b+_/2)/2),m},"textToCanvas"));p(this,"cacheImage",a(r=>{if(!r.appearance.icon)return;let i=mp(r.appearance.icon);this.imagePromiseCache[i]||(this.imagePromiseCache[i]=new Promise(n=>{this.transformRequest(r.appearance.icon).then(o=>{let s=Iy(o.url);s.onload=()=>{this.imageCache[i]=s,this.publish("img:loaded"),n(s)}})})),r.imageHash!==i&&(r.imageHash=i,this.imagePromiseCache[i].then(()=>{r.dirty=!0}))},"cacheImage"));p(this,"createPinCanvas",a((r,i,n,o,s=1)=>{let l,u=this.state.pixelRatio,h=r.totalMarkerSize*2*u*s;window.OffscreenCanvas!=null?l=new OffscreenCanvas(h,h):(l=document.createElement("canvas"),l.width=h,l.height=h,l.style.width=h/u+"px",l.style.height=h/u+"px");let m=l.getContext("2d");return m.shadowColor="rgba(0,0,0,0.3)",m.shadowOffsetY=2*u,m.shadowBlur=5*u,m.beginPath(),m.arc(h/2,h/2,(i/2+2.5*u/2)*s,0,2*Math.PI),m.fillStyle=n,m.fill(),m.beginPath(),m.arc(h/2,h/2,i/2*s,0,2*Math.PI),m.shadowColor="transparent",m.fillStyle=o,m.fill(),l},"createPinCanvas"));p(this,"prepare",a((r,i,n)=>{let o=this.state.pixelRatio;n.lineWidth=4*o;let s=typeof r.appearance.iconScale=="number"?[r.appearance.iconScale]:r.appearance.iconScale==null?[]:r.appearance.iconScale.output,l=s.length>0?Math.max(...s):void 0,u=this.createPinCanvas(r,r.markerSize,r.appearance.pinOutlineColor,r.appearance.pinColor,l),h=this.createPinCanvas(r,r.iconVisible?r.markerSize:3.5*o,r.appearance.pinOutlineColorInactive,r.appearance.pinColorInactive,l);this.pinCache[i]=[u,h]},"prepare"));this.state=r,this.colliderCanvas=i,this.colliderContext=i.getContext("2d"),this.transformRequestFunc=n}draw(r,i,n){var h;if(!r.canShow||!r.visible)return;n.save(),n.globalAlpha=r.opacity;let o=this.state.pixelRatio,s=r.projection.x*o,l=r.projection.y*o,u=r.style.pinVisibility===1?this.pinCache[i][0]:this.pinCache[i][1];if(n.drawImage(u,s-r.scaledMarkerSize*o,l-r.scaledMarkerSize*o,r.scaledMarkerSize*2*o,r.scaledMarkerSize*2*o),r.appearance.icon&&r.iconVisible&&r.imageHash&&r.appearance.iconSize&&this.imageCache[r.imageHash]){let m=this.imageCache[r.imageHash],f=(r.scaledMarkerSize-r.scaledIconPadding)*o,b=r.appearance.iconFit,y=f,_=f,T="".concat(r.imageHash,"_").concat(b);if(this.imageDimensionsCache[T])y=this.imageDimensionsCache[T].width,_=this.imageDimensionsCache[T].height;else{let g=m.width*o,x=m.height*o;if(b==="contain"){let P=Math.sqrt(g**2+x**2),S=f/P;y=g*S,_=x*S}if(b==="cover"){let P=f/g,S=f/x,C=Math.max(P,S);y=g*C,_=x*C}}n.save(),n.beginPath(),n.arc(s,l,f/2,0,2*Math.PI),n.closePath(),((h=r==null?void 0:r.appearance)==null?void 0:h.iconOverflow)!=="visible"&&n.clip(),n.drawImage(m,s-y/2,l-_/2,y,_),n.restore()}r.style.textLabelVisible&&r.style.textAlign!=null&&r.style.left!=null&&r.style.top!=null&&n.drawImage(this.textCache[r.id][r.style.textAlign],s+r.style.left*o,l+r.style.top*o),n.restore()}};a(_h,"TwoDDrawSystem");var vl=_h;v();v();var ei=class ei{constructor(){p(this,"loader");this.loader=new js}static getInstance(){return ei.instance||(ei.instance=new ei),ei.instance}getLoader(){return this.loader}load(e){return new Promise((r,i)=>{this.loader.load(e,r,void 0,i)})}};a(ei,"TextureLoaderSingleton"),p(ei,"instance");var Ph=ei,ti=Ph.getInstance();function xT(t,e){let r=t.components[2],i=t.components[1];return r!=null&&r.hover?[i.hoverColor||e,i.hoverColor||e]:[i.color,i.topColor||i.color]}a(xT,"processColor");var Ji,ns,Th=class Th extends me{constructor(r,i){super();L(this,Ji);p(this,"state");p(this,"convertTo3DMapPosition");p(this,"textureLoadingCache",new Map);this.convertTo3DMapPosition=i,this.state=r}processTextures(r,i,n){var o;if(i.texture!==r.texture&&i.texture!==""&&_e(this,Ji,ns).call(this,i.texture,r,"texture"),i.topTexture!==r.topTexture&&i.topTexture!==""&&_e(this,Ji,ns).call(this,i.topTexture,r,"topTexture"),(r.texture==null||r.topTexture==null)&&Array.isArray((o=r.feature.properties)==null?void 0:o.textures)&&r.feature.properties.textures.length>0)for(let s of r.feature.properties.textures)s.face==="top"&&r.topTexture!==s.path?_e(this,Ji,ns).call(this,s.path,r,"topTexture"):s.face==="side"&&r.texture!==s.path&&_e(this,Ji,ns).call(this,s.path,r,"texture"),r.blendTexture=!0;(r.texture!=null||r.topTexture!=null)&&(n!=null&&n.hover&&r.texturesVisible?r.hideTextures():r.texturesVisible||r.showTextures(),i.texture===""&&r.removeSideTexture(),i.topTexture===""&&r.removeTopTexture())}update(){var o,s,l,u,h,m,f,b,y,_,T,g,x,P,S,C,w;let r,i,n;for(let k of this.state.geometry3DIdsInScene)if(n=this.state.geometry3DMap.get(k),n&&(n.type==="geometry"||n.type==="custom-geometry")&&((o=n.components[1])!=null&&o.dirty||(s=n.components[2])!=null&&s.dirty)){let A=n.components[0],N=n.components[1];i=n.components[2];let Y=xT(n,this.state.hoverColor);A.setColor(Y[0],Y[1]);let z=Py(A);if(N.visible!==A.visible&&(A.visible=N.visible,A instanceof Ne&&A.textMesh)){let q=this.state.geometry3DMap.get(A.textMesh.userData.entityId);(q==null?void 0:q.type)==="text3d"&&q.components[0].polygonEntityId!=null&&(q.components[0].visible=N.visible)}N.altitude!==A.altitude&&(A.altitude=N.altitude);let X=N.opacity*yn(n);X!==A.opacity&&(A.opacity=X),N.renderOrder!==A.renderOrder&&(A.renderOrder=N.renderOrder),z&&N.side!==Ty(z)&&wy(z,N.side),A instanceof Ne&&N.shading!=null&&(((l=N.shading)==null?void 0:l.start)!==(z==null?void 0:z.getGradientShading().start)||((u=N.shading)==null?void 0:u.end)!==(z==null?void 0:z.getGradientShading().end)||((h=N.shading)==null?void 0:h.intensity)!==(z==null?void 0:z.getGradientShading().intensity))&&(z==null||z.setGradientShading((f=(m=N.shading)==null?void 0:m.start)!=null?f:0,(y=(b=N.shading)==null?void 0:b.end)!=null?y:0,(T=(_=N.shading)==null?void 0:_.intensity)!=null?T:0)),N.dirty=!1,A instanceof Ne&&this.processTextures(A,N,i),n.components[2]&&(n.components[2].dirty=!1)}else if((n==null?void 0:n.type)==="model")n.components[1].dirty&&(ml(n),n.components[1].dirty=!1),n.components[0].positionDirty&&(_y(n,this.convertTo3DMapPosition),n.components[0].positionDirty=!1);else if((n==null?void 0:n.type)==="image"&&((g=n.components[1])!=null&&g.dirty)){r=n.components[0];let A=n.components[1];A.visible!==r.visible&&(r.visible=A.visible),A.dirty=!1}else if((n==null?void 0:n.type)==="text3d"&&((x=n.components[1])!=null&&x.dirty)&&n.components[0].polygonEntityId!=null){r=n.components[0];let A=n.components[1];A.visible!=null&&A.visible!==r.visible&&(r.visible=A.visible);let{textMesh:N}=r;if(N){Object.assign(N,A.getState());let Y=(P=A.hoverColor)!=null?P:this.state.text3dHoverColor;N.color=A.hoverByPolygon?Y:(S=A.color)!=null?S:gn.color,N.outlineColor=A.hoverByPolygon?Y:(C=A.outlineColor)!=null?C:gn.outlineColor,N.strokeColor=A.hoverByPolygon?Y:(w=A.strokeColor)!=null?w:gn.strokeColor}A.dirty=!1}}destroy(){this.textureLoadingCache.forEach(async r=>{(await r).dispose()}),this.textureLoadingCache.clear()}};Ji=new WeakSet,ns=a(async function(r,i,n){if(!(!r||!i.showTextures))if(this.textureLoadingCache.has(r)){n==="topTexture"?i.topTexture=await this.textureLoadingCache.get(r):i.texture=await this.textureLoadingCache.get(r),i.showTextures();return}else{let o=new Promise((s,l)=>{ti.getLoader().load(r,u=>{n==="topTexture"?i.topTexture=u:i.texture=u,i.showTextures(),this.publish("texture-loaded"),s(u)},void 0,()=>{te.error("Failed to load texture: ".concat(r)),l("Failed to load texture: ".concat(r))})});this.textureLoadingCache.set(r,o)}},"#loadTexture"),a(Th,"DrawSystem");var bl=Th;v();var wh=class wh extends me{constructor(r){super();p(this,"state");p(this,"animating",new Map);p(this,"isAnimating",!1);p(this,"startTime",-1);p(this,"showDuration",300);p(this,"hideDuration",250);p(this,"update",a(()=>{this.animating.clear();let r,i;for(let n of this.state.geometry2DIdsInScene)r=this.state.geometry2DMap.get(n),r&&(i=r.components[0],i instanceof rr&&(i.visibilityNeedsUpdate==="show"?(i.canShow=!0,this.animating.set(i,[i.opacity,1])):i.visibilityNeedsUpdate==="hide"&&this.animating.set(i,[i.opacity,0])));this.startTime=performance.now(),this.publish("animate:2d")},"update"));p(this,"playAnimations");this.state=r,this.playAnimations=this._playAnimations}_playAnimations(){let r=performance.now();for(let[i,[n,o]]of this.animating.entries()){let s=o===1?this.showDuration:this.hideDuration,l=(r-this.startTime)/s;i.opacity=yi(l,0,1,n,o,o===0?tp:rp),r-this.startTime>=s&&(o===1?i.canShow=!0:o===0&&(i.canShow=!1),i.visibilityNeedsUpdate=!1,this.animating.delete(i))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};a(wh,"TwoDVisibilitySystem");var xl=wh;v();var Mh=class Mh extends me{constructor(r,i,n,o,s,l,u){super();p(this,"state");p(this,"renderer");p(this,"mode");p(this,"scene");p(this,"cameraObject");p(this,"viewCamera");p(this,"systems");p(this,"needs2DRecompute",!1);p(this,"twoDdirty",!0);p(this,"threeDdirty",!0);p(this,"frameId",null);p(this,"twoDFrameId",null);p(this,"animationFrameId",null);p(this,"nextFrame",null);p(this,"update",a((r=!1)=>{var i;if(((i=this.renderer)==null?void 0:i.renderer)==null)return Promise.resolve();if(r){let n=this.commitRenderState();return this.paint(),n}else return this.frameId?Promise.resolve():new Promise((n,o)=>{this.frameId=requestAnimationFrame(()=>{var s,l;return((s=this.renderer)==null?void 0:s.renderer)==null?n():this.mode==="standalone"?(l=this.commitRenderState())==null?void 0:l.then(()=>{this.paint(),n()}).catch(u=>{o(u)}):n()})})},"update"));p(this,"animate2D",a(()=>{this.animationFrameId=requestAnimationFrame(()=>{this.animationFrameId=null,this.systems.twoDVisiblitySystem.playAnimations()})},"animate2D"));p(this,"drawEntities2D",a(()=>{this.twoDFrameId||(this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel())}))},"drawEntities2D"));p(this,"updateEntities2D",a(()=>{this.twoDFrameId&&(cancelAnimationFrame(this.twoDFrameId),this.twoDFrameId=null),this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.watermarkSystem.insertIntoQuadTree(this.systems.collisionSystem.interactiveCollidersQTree),this.systems.interactionSystem.updateQuadtree(this.systems.collisionSystem.interactiveCollidersQTree),this.systems.twoDVisiblitySystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting())})},"updateEntities2D"));p(this,"commitRenderState",a(()=>{try{let r=[];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(),dp(this.state.entityScene,this.state.geometry2DIdsInScene),this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.collidersDirty=!0,this.systems.domMutationSystem.dirty=!0,this.systems.panBoundsSystem.dirty=!0,this.twoDdirty=!1),this.threeDdirty&&(this.state.geometry3DIdsInScene.clear(),this.state.geometryGroupIdsToLoad.clear(),hp(this.state.entityScene,this.state.geometry3DIdsInScene,this.state.geometryGroupIdsToLoad),this.threeDdirty=!1,this.systems.interactionSystem.dirty3D=!0,this.systems.panBoundsSystem.dirty=!0,this.systems.outlineInterpolationSystem.geometries3DDirty=!0,this.systems.geometryInFocusSystem.focusablesDirty=!0);let i=this.systems.meshOptimizationSystem.update();i&&r.push(i),this.systems.meshModificationSystem.update(),this.systems.meshDetachmentSystem.update(),this.systems.imageSystem.update(this.systems.cameraSystem.getRotation()),r.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.getRotation()),this.systems.cameraSystem.postRender(),this.systems.domVisiblitySystem.update(),this.systems.domMutationSystem.update(),this.systems.twoDProjectionSystem.update(),this.systems.occlusion2DSystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting()),this.systems.watermarkSystem.update();let n=this.needs2DRecompute;return this.nextFrame=requestAnimationFrame(()=>{this.systems.collisionSystem.update(this.systems.watermarkSystem.width,this.systems.watermarkSystem.height,this.systems.watermarkSystem.options.position,!n)}),this.systems.drawSystem.update(),this.systems.geometryDisposalSystem.update(),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1,this.systems.cameraSystem.rotationDirty=!1,this.systems.cameraSystem.stateDirty&&(this.publish("camera-state-change"),this.systems.cameraSystem.stateDirty=!1),this.publish("post-render"),Promise.all(r)}catch(r){return Promise.reject(r)}},"commitRenderState"));this.renderer=r,this.state=i,this.mode=n,this.scene=o,this.cameraObject=s,this.viewCamera=l,this.systems=u,this.systems.collisionSystem.on("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.on("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.on("animate:2d",this.animate2D),this.systems.cameraSystem.on("pan-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("zoom-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("zoom-end",()=>this.needs2DRecompute=!0),this.systems.cameraSystem.on("rotate-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("rotate-end",()=>this.needs2DRecompute=!0)}paint(){var r;(r=this.renderer)!=null&&r.renderer&&(this.mode==="standalone"&&this.renderer.clear(),this.renderer.render(this.scene,this.state.useStandaloneCamera||this.mode==="standalone"?this.cameraObject:this.viewCamera))}destroy(){this.frameId&&cancelAnimationFrame(this.frameId),this.twoDFrameId&&cancelAnimationFrame(this.twoDFrameId),this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.nextFrame&&cancelAnimationFrame(this.nextFrame),this.state.geometry2DIdsInScene.clear(),this.state.geometry3DIdsInScene.clear(),this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.collidersDirty=!0,this.update(),this.systems.collisionSystem.off("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.off("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.off("animate:2d",this.animate2D)}};a(Mh,"RenderSystem");var Sl=Mh;v();var ST=I.object({interactive:I.boolean().optional(),id:I.string().optional(),width:I.union([I.number(),I.object({on:I.literal("zoom-level").optional(),input:I.array(I.number()).nonempty(),output:I.array(I.number()).nonempty(),easing:I.string().optional()})]).optional(),accentColor:I.string().optional(),displayArrowsOnPath:I.boolean().optional(),animateArrowsOnPath:I.boolean().optional(),visibleThroughGeometry:I.boolean().optional(),dashed:I.boolean().optional()}),CT=I.object({type:I.enum(["Feature"]),geometry:qn,properties:I.object({parentId:I.any().optional()})});function Ey(t,e){I.object({features:I.array(CT)}).parse(t),ST.parse(e)}a(Ey,"validatePath");var os,Ih=class Ih{constructor(e,r){p(this,"type","path");p(this,"mesh",new Bt);p(this,"material");p(this,"geometry");p(this,"outline");p(this,"feature");p(this,"options");p(this,"width",{on:"zoom-level",input:[17,22],output:[.8,.4]});p(this,"breakpoint",0);p(this,"altitudeBreakpoints");p(this,"accentColor","blue");p(this,"completeFraction",1);p(this,"altitudeAdjustment",1);p(this,"displayArrowsOnPath",!1);p(this,"animateArrowsOnPath",!1);p(this,"visibleThroughGeometry",!1);p(this,"dashed",!1);p(this,"isVertical",!1);p(this,"dirty",!0);p(this,"materialDirty",!0);p(this,"position",new H);L(this,os,0);var i,n,o,s,l,u;this.feature=e,this.options=r||{},this.width=(i=r==null?void 0:r.width)!=null?i:this.width,this.accentColor=(n=r==null?void 0:r.accentColor)!=null?n:this.accentColor,this.displayArrowsOnPath=(o=r==null?void 0:r.displayArrowsOnPath)!=null?o:this.displayArrowsOnPath,this.animateArrowsOnPath=(s=r==null?void 0:r.animateArrowsOnPath)!=null?s:this.animateArrowsOnPath,this.visibleThroughGeometry=(l=r==null?void 0:r.visibleThroughGeometry)!=null?l:this.visibleThroughGeometry,this.dashed=(u=r==null?void 0:r.dashed)!=null?u:this.dashed}setColor(){}setOpacity(){}set visible(e){this.mesh&&(this.mesh.visible=e)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return c(this,os)}set altitude(e){this.mesh&&(this.mesh.position.z=e,R(this,os,e))}set complete(e){this.material&&(this.material.uniforms.complete.value=e,this.material.needsUpdate=!0)}};os=new WeakMap,a(Ih,"PathComponent");var ri=Ih;v();var _T=300,ss,as,Eh=class Eh{constructor(e){p(this,"state");L(this,ss,new H);L(this,as,new H);this.state=e}update(e){var n;let r,i;this.state.cameraObject.getWorldPosition(c(this,as));for(let o of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(o),r&&(i=r.components[0],i&&"containerEl"in i&&i.markerContainer!=null)){if(i.visibilityNeedsUpdate!==!1&&(i.visibilityNeedsUpdate==="show"?i.canShow=!0:i.canShow=!1),(i.canShow&&i.visible===!0||((n=i.animation)==null?void 0:n.pending)===!0)&&!i.offscreen)if(i.options.zIndex!=null)i.markerContainer.style.transform="translate3D(".concat(i.projection.x,"px, ").concat(i.projection.y,"px, ").concat(i.options.zIndex,"px)");else{r.object3d.getWorldPosition(c(this,ss));let s=c(this,as).distanceTo(c(this,ss));i.markerContainer.style.transform="translate3D(".concat(i.projection.x,"px, ").concat(i.projection.y,"px, ").concat(-s,"px)")}if(i.canShow===!0&&i.visible===!0?i.markerContainer.style.pointerEvents=e?"none":i.pointerEvents:i.markerContainer.style.pointerEvents="none",i.currentStrategyIndex===-1&&i.visible&&i.visibilityNeedsUpdate==="show")continue;i.visibilityNeedsUpdate!==!1&&!i.offscreen&&(i.visibilityNeedsUpdate==="show"&&(i.markerContainer.style.opacity="0"),i.animation&&i.animation.cancel(),i.animation=i.markerContainer.animate([{opacity:i.canShow&&i.visible?"1":"0"}],{duration:_T,easing:"ease-in-out",fill:"forwards"}),i.visibilityNeedsUpdate=!1)}}};ss=new WeakMap,as=new WeakMap,a(Eh,"DOMDrawSystem");var Cl=Eh;v();var Dh=class Dh extends me{constructor(r,i){super();p(this,"state");p(this,"dirty",!0);p(this,"domTree");p(this,"observers",new Map);p(this,"updateDimensions",a(r=>{r.forEach(i=>{var s;let o=(s=i.target.parentElement)==null?void 0:s.getAttribute("data-marker-id");if(o){let l=this.state.geometry2DMap.get(o),u=l==null?void 0:l.components[0];l&&u instanceof nr&&(u.updateDimensions(i.contentRect.width,i.contentRect.height),u.collisionDirty=!0)}}),this.publish("dimensions-update")},"updateDimensions"));this.state=r,this.domTree=i}setupObserver(){var n;if(this.observers){for(let o of this.observers.values())o.disconnect();this.observers.clear()}let r,i;for(let o of this.domTree.children){let s=o.getAttribute("data-marker-id");if(s!=null&&(r=this.state.geometry2DMap.get(s),i=r.components[0],(n=i.options)!=null&&n.dynamicResize)){let l=new ResizeObserver(this.updateDimensions);l.observe(i.containerEl),this.observers.set(o.userData.entityId,l)}}}update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let r of this.observers.values())r.disconnect();this.observers.clear()}};a(Dh,"DOMResizeSystem");var _l=Dh;v();v();var Dy="uniform vec4 uSize;\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n // Scale the position by the size of the quad\n // and shift to top left corner for 0,0\n vec2 transformed = position.xy * uSize.xy - vec2(1.0, -1.0);\n // Apply width .x and height .y of image\n transformed += vec2(uSize.x, -uSize.y);\n // Apply left .w and top .z offset\n transformed += vec2(uSize.w, -uSize.z) * 2.0;\n gl_Position = vec4(transformed, 1.0, 1.0);\n}";v();var Oy="varying vec2 vUv;\nuniform sampler2D uTexture;\nuniform float uOpacity;\nvoid main() {\n #ifndef debug\n vec4 texture = texture2D(uTexture, vUv);\n gl_FragColor = vec4(texture.rgb, texture.a * uOpacity);\n #else\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n #endif\n}";v();var Ly=4.291666666666667,Ay=15,ky=25,Ry=43/60;v();var Ny=["horizontal","icon"],PT=new Map([[Ny[0],'<svg viewBox="0 0 206 48">\n <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"/>\n <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"/>\n <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"/>\n <path d="M204 40C205.115 40 206 39.0857 206 38V37.9886C206 36.9029 205.126 36 204 36C202.885 36 202 36.9143 202 38V38.0114C202 39.0971 202.874 40 204 40ZM204 39.7829C202.989 39.7829 202.23 38.9829 202.23 38.0114V38C202.23 37.0286 203 36.2171 204 36.2171C205.011 36.2171 205.77 37.0171 205.77 37.9886V38C205.77 38.9714 205 39.7829 204 39.7829ZM203.218 38.9714H203.609V38.2743H204.034L204.517 38.9714H204.989L204.448 38.2057C204.724 38.1257 204.92 37.92 204.92 37.5886C204.92 37.1657 204.586 36.9486 204.138 36.9486H203.218V38.9714ZM203.609 37.9543V37.2914H204.103C204.368 37.2914 204.517 37.4057 204.517 37.6229C204.517 37.8171 204.368 37.9543 204.103 37.9543H203.609Z"/>\n </svg>'],[Ny[1],'<svg viewBox="0 0 43 60">\n <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"/>\n <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"/>\n <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"/>\n </svg>']]),TT=/<svg([^>]*)>/g;function By(t,e,r,i){let n=PT.get(t);return n?n.replace(TT,'<svg$1 width="'.concat(r,'" height="').concat(i,'" xmlns="http://www.w3.org/2000/svg" style="fill: ').concat(e,';">')):""}a(By,"getLogoIcon");var Fy=!1,Te,Er,$n,qe,pt,Ki,zt,cr,Oh=class Oh extends me{constructor(r,i,n){super();L(this,Te,{padding:16,scale:1,iconOnly:!1,position:"bottom-left",color:"dark",onClick:a(()=>{window!=null&&window.open("https://www.mappedin.com")},"onClick"),interactive:!0,visible:!0});L(this,Er);L(this,$n);L(this,qe);L(this,pt);L(this,Ki);L(this,zt,0);L(this,cr,0);p(this,"dirty",!0);p(this,"getPositionAlignedCanvasCoordinates",a((r,i)=>({"top-left":{x:0,y:0},"top-right":{x:r,y:0},"bottom-left":{x:0,y:i},"bottom-right":{x:r,y:i},center:{x:r/2,y:i/2},top:{x:r/2,y:0},bottom:{x:r/2,y:i},left:{x:0,y:i/2},right:{x:r,y:i/2}})[c(this,Te).position],"getPositionAlignedCanvasCoordinates"));p(this,"getPositionAlignedPadding",a(()=>{var n,o,s,l;let r=c(this,Te).padding;if(typeof r=="number")return{"top-left":{x:r,y:r},"top-right":{x:-r,y:r},"bottom-left":{x:r,y:-r},"bottom-right":{x:-r,y:-r},center:{x:0,y:0},top:{x:0,y:r},bottom:{x:0,y:-r},left:{x:r,y:0},right:{x:-r,y:0}}[c(this,Te).position];let i={top:(n=r.top)!=null?n:0,right:(o=r.right)!=null?o:0,bottom:(s=r.bottom)!=null?s:0,left:(l=r.left)!=null?l:0};return{x:i.left-i.right,y:i.top-i.bottom}},"getPositionAlignedPadding"));n&&Object.entries(n).forEach(([o,s])=>{s!==void 0&&(c(this,Te)[o]=s)}),R(this,$n,r),R(this,Er,i)}get color(){return c(this,Te).color==="light"?"white":"#293136"}get iconName(){return c(this,Te).iconOnly?"icon":"horizontal"}get minWidth(){return c(this,Te).iconOnly?Ay:75}get defaultWidth(){return c(this,Te).iconOnly?ky:150}get aspectRatio(){return c(this,Te).iconOnly?Ry:Ly}get options(){return O({},c(this,Te))}set options(r){var i,n;R(this,Te,{padding:r.padding||c(this,Te).padding,position:r.position||c(this,Te).position,iconOnly:r.iconOnly||c(this,Te).iconOnly,color:r.color||c(this,Te).color,scale:r.scale||c(this,Te).scale,onClick:c(this,Te).onClick,interactive:(i=r.interactive)!=null?i:c(this,Te).interactive,visible:(n=r.visible)!=null?n:c(this,Te).visible})}get icon(){return By(this.iconName,this.color,c(this,zt)*c(this,Er).pixelRatio,c(this,cr)*c(this,Er).pixelRatio)}setSize(r,i){c(this,pt)&&(c(this,pt).uniforms.uSize.value.x=r,c(this,pt).uniforms.uSize.value.y=i)}setXY(r,i){c(this,pt)&&(c(this,pt).uniforms.uSize.value.w=r,c(this,pt).uniforms.uSize.value.z=i)}get width(){return c(this,zt)}get height(){return c(this,cr)}getPositionAlignedOffset(r,i){return{"top-left":{x:0,y:0},"top-right":{x:-r,y:0},"bottom-left":{x:0,y:-i},"bottom-right":{x:-r,y:-i},center:{x:-(r/2),y:-(i/2)},top:{x:-(r/2),y:0},bottom:{x:-(r/2),y:-i},left:{x:0,y:-(i/2)},right:{x:-r,y:-(i/2)}}[c(this,Te).position]}insertIntoQuadTree(r){c(this,Ki)!=null&&typeof c(this,Te).onClick=="function"&&c(this,Te).interactive&&r.insert(c(this,Ki))}resize(r,i){if(c(this,Te).visible!==!0)return;let n=this.getPositionAlignedCanvasCoordinates(r,i),o=this.getPositionAlignedPadding(),s=this.getPositionAlignedOffset(c(this,zt),c(this,cr)),l=Math.min(r-c(this,zt),Math.max(0,n.x+o.x+s.x)),u=Math.min(i-c(this,cr),Math.max(0,n.y+o.y+s.y));this.setSize(c(this,zt)/r,c(this,cr)/i),this.setXY(l/r,u/i),R(this,Ki,new Se(l,u,c(this,zt),c(this,cr),{entityId:"watermark"}))}update(){this.dirty&&(c(this,Te).visible===!0?(R(this,zt,Math.min(c(this,Er).canvasWidth,Math.max(this.minWidth,this.defaultWidth*c(this,Te).scale))),R(this,cr,c(this,zt)/this.aspectRatio),ti.getLoader().load("data:image/svg+xml;base64,".concat(btoa(this.icon)),r=>{if(R(this,pt,new Rr({uniforms:{uTexture:{value:r},uSize:{value:new Ad(0,0,0,0)},uOpacity:{value:.7}},vertexShader:Dy,fragmentShader:Oy,depthWrite:!1,depthTest:!1,defines:{debug:Fy},wireframe:Fy,transparent:!0,visible:!0})),c(this,qe))c(this,qe).visible=!0,c(this,qe).material=c(this,pt),c(this,qe).material.needsUpdate=!0;else{let i=new Nt(2,2,1,1);R(this,qe,new be(i,c(this,pt))),c(this,qe).position.set(0,0,-1),c(this,qe).frustumCulled=!1,c(this,qe).renderOrder=999;let n=new kr(1,1,1),o=new be(n,new st({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}));o.frustumCulled=!1,o.layers.set(1),c(this,qe).add(o),c(this,$n).add(c(this,qe))}this.resize(c(this,Er).canvasWidth,c(this,Er).canvasHeight),this.publish("texture-loaded")})):c(this,qe)&&(c(this,qe).visible=!1),this.dirty=!1)}destroy(){c(this,qe)&&(c(this,$n).remove(c(this,qe)),ze(c(this,qe))),R(this,qe,void 0),c(this,pt)&&c(this,pt).dispose(),R(this,pt,void 0),R(this,Ki,void 0)}};Te=new WeakMap,Er=new WeakMap,$n=new WeakMap,qe=new WeakMap,pt=new WeakMap,Ki=new WeakMap,zt=new WeakMap,cr=new WeakMap,a(Oh,"WatermarkSystem");var Pl=Oh;v();var Tl=100,IT=!1,Lh=class Lh extends me{constructor(r,i){super();p(this,"currentTotalBoundingBox");p(this,"state");p(this,"cameraSystem");p(this,"debugMesh",null);p(this,"dirty",!0);p(this,"autoMinZoomLevel",!0);this.state=r,this.cameraSystem=i}update(){if(this.dirty){this.currentTotalBoundingBox==null&&(this.currentTotalBoundingBox=new it,this.state.entityScene.children.length===0?this.currentTotalBoundingBox.setFromCenterAndSize(new H(0,0,0),new H(Tl*2,Tl*2,0)):(this.currentTotalBoundingBox.setFromObject(this.state.entityScene),this.currentTotalBoundingBox.expandByScalar(Tl)));let r=new it().setFromObject(this.state.entityScene);this.currentTotalBoundingBox.union(r);let i=r.getSize(new H),n=Math.max(i.x,i.y,i.z);for(let s of this.state.geometry2DMap.values())s.positionDirty===!0&&(this.currentTotalBoundingBox.expandByPoint(s.position),s.positionDirty=!1);let o=wl.copy(this.currentTotalBoundingBox).expandByScalar(Math.max(n,Tl)).getBoundingSphere(ET).radius;if(this.cameraSystem.panBounds={center:this.currentTotalBoundingBox.getCenter(new H),min:wl.min,max:wl.max,radius:o},this.publish("update"),this.cameraSystem.dirty=!0,this.dirty=!1,IT&&this.state.entityScene.parent instanceof Nr){this.debugMesh&&(this.state.entityScene.parent.remove(this.debugMesh),this.debugMesh=null),this.debugMesh=new fr,this.debugMesh.add(new be(new Us(this.cameraSystem.panBounds.radius),new st({color:16711680,transparent:!0,opacity:.2}))),this.debugMesh.position.copy(this.cameraSystem.panBounds.center),this.state.entityScene.parent.add(this.debugMesh);let s=new H;wl.getSize(s);let l=new kr(s.x,s.y,s.z),u=new st({color:65280,wireframe:!0,transparent:!0,opacity:.5}),h=new be(l,u);h.position.copy(this.currentTotalBoundingBox.getCenter(new H)),this.debugMesh.add(h)}}}};a(Lh,"PanBoundsSystem");var Ml=Lh,wl=new it,ET=new Rd;v();var ls,cs,Ah=class Ah{constructor(e,r){p(this,"mesh");p(this,"type","custom-geometry");p(this,"dirty",!0);p(this,"feature");p(this,"builder");p(this,"outline");L(this,ls,1);p(this,"color",new Ee);L(this,cs,0);this.mesh=new Bt,this.feature=e,this.builder=r}get visible(){return this.mesh.visible}set visible(e){this.mesh.visible=e}set opacity(e){R(this,ls,e)}get opacity(){return c(this,ls)}setColor(e){this.color.set(e)}get position(){var e;return(e=this.mesh)==null?void 0:e.position}get altitude(){return c(this,cs)}set altitude(e){this.mesh&&(this.mesh.position.z=e,R(this,cs,e))}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(e){this.mesh&&(this.mesh.renderOrder=e)}};ls=new WeakMap,cs=new WeakMap,a(Ah,"CustomGeometryComponent");var Jn=Ah;v();var kh=class kh{constructor(e,r){p(this,"state");p(this,"convertTo3DMapPosition");this.state=e,this.convertTo3DMapPosition=r}update(){let e,r;for(let i of this.state.geometry3DIdsInScene){let n=this.state.geometry3DMap.get(i);(n==null?void 0:n.type)==="custom-geometry"&&(e=n.components[0],r=n.components[1],e.dirty&&r.visible!==!1&&(e.position.copy(this.convertTo3DMapPosition(e.feature.geometry.coordinates[1],e.feature.geometry.coordinates[0],r.altitude)),e.builder.setup(e.mesh),e.mesh.traverse(o=>{o.userData=j(O({},o.userData),{entityId:i,type:"custom-geometry"})}),e.dirty=!1),r.visible!==!1&&e.builder.update(e.mesh))}}};a(kh,"CustomGeometrySystem");var Il=kh;v();v();function Gy(t){return t.children.some(e=>e.userData.isOutline)}a(Gy,"hasOutline");function Xy(t,e){var i;let r=t.userData.entities3D.values().next().value;return r?((i=e.geometry3DMap.get(r))==null?void 0:i.components[3])!==void 0:!1}a(Xy,"needsOutline");function El(t,e,r,i){let o=t.getAttribute("position").array,s=-1/0;for(let l=0;l<e.count;l++){let h=(e.start+l)*3,m=o[h+2];s=Math.max(s,m)}for(let l=0;l<e.count;l++){let h=(e.start+l)*3,m=o[h+2];Math.abs(m-s)<1e-4?o[h+2]=Math.max(r+i,2e-4+i):o[h+2]=i}t.attributes.position.needsUpdate=!0}a(El,"updateBufferGeometryHeight");v();function Rh(t){var h,m;let e=new Ys,r=(h=t.mesh)==null?void 0:h.geometry;if(!r||!((m=t.batchedProps)!=null&&m.range))return;let i=t.batchedProps.range,n=i.start,o=i.count,s=r.getAttribute("position");if(s){let f=new Float32Array(o*3);for(let b=0;b<o;b++){let y=n+b;f[b*3]=s.array[y*3],f[b*3+1]=s.array[y*3+1],f[b*3+2]=s.array[y*3+2]}e.setAttribute("position",new ct(f,3))}let l=r.getAttribute("normal");if(l){let f=new Float32Array(o*3);for(let b=0;b<o;b++){let y=n+b;f[b*3]=l.array[y*3],f[b*3+1]=l.array[y*3+1],f[b*3+2]=l.array[y*3+2]}e.setAttribute("normal",new ct(f,3))}let u=r.getAttribute("uv");if(u){let f=new Float32Array(o*2);for(let b=0;b<o;b++){let y=n+b;f[b*2]=u.array[y*2],f[b*2+1]=u.array[y*2+1]}e.setAttribute("uv",new ct(f,2))}if(r.index){let f=r.index,b=new Uint32Array(o);for(let y=0;y<o;y++)b[y]=f.array[n+y];e.setIndex(new ct(b,1))}return e}a(Rh,"extractBufferGeometryFromBatchedGeometry");function zy(t,e){let r=Rh(t);if(!r||!t.mesh)return;t.mesh.deleteInstance(t.instanceIndex),t.mesh.optimize();let i=e.addGeometry(r);e.addInstance(i);let n=e.getGeometryIdAt(i),o=e.getGeometryRangeAt(n);return o&&t.batchedProps&&(t.batchedProps.range=o),r.dispose(),i}a(zy,"transferGeometryToNewBatchedMesh");v();v();var Yy="// Modified from https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderLib/linedashed.glsl.js\nuniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\nattribute float visibility;\nvarying vec4 v_color;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n vLineDistance = scale * lineDistance;\n v_color = color;\n\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n if (visibility < 0.5) {\n gl_Position = vec4(-2.0, -2.0, -2.0, 1.0);\n }\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n\n}";v();var Zy="// Modified from https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderLib/linedashed.glsl.js\nuniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nvarying float vLineDistance;\nvarying vec4 v_color;\n\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n discard;\n\n }\n\n vec3 outgoingLight = vec3( 0.0 );\n\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n\n outgoingLight = diffuseColor.rgb; // simple shader\n\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n\n // Discard alpha lower than 0.01 to avoid opacity fighting\n if (v_color.a <= 0.01) { \n discard;\n }\n}\n";var Nh=class Nh extends ac{constructor(e){super(e),this.onBeforeCompile=r=>{r.vertexShader=Yy,r.fragmentShader=Zy}}};a(Nh,"OutlineLineMaterial");var Dl=Nh;var LT=80,Qi,Kn,Ll,Al,Bh=class Bh{constructor(e){p(this,"rendererState");p(this,"outlineOpacitiesDirty",!0);L(this,Qi,!0);L(this,Kn,-1/0);L(this,Ll,new Map);L(this,Al,new Dl({vertexColors:!0,linewidth:1,transparent:!0,opacity:1,side:hi}));this.rendererState=e}get geometries3DDirty(){return c(this,Qi)}set geometries3DDirty(e){R(this,Qi,e)}update(e,r=!0){var o,s,l;let i;if(this.geometries3DDirty){for(let u of this.rendererState.geometry3DIdsInScene){let h=this.rendererState.geometry3DMap.get(u);if(h instanceof xt&&Xy(h,this.rendererState)&&!Gy(h)&&h.userData.entities3D.size>0){let m=[];for(let S of h.userData.entities3D.values()){let C=this.rendererState.geometry3DMap.get(S);if(C instanceof fe&&C.type==="geometry"&&C.components[3]&&C.components[3].dirty===!0&&C.components[0].material!=null){let w=C.components[0].geometry,k=!1;w||(w=Rh(C.components[0]),k=!0);let A=C.components[1];m.push([C.components[3],new lc(w,(o=A.bevel)!=null&&o.enabled?1:LT)]),k&&(w==null||w.dispose(),w=void 0)}}if(m.length===0)continue;let f=Pt(m.map(S=>S[1]),!1);if(f==null)continue;let b=f.getAttribute("position"),y=new Float32Array(b.count*4),_=new ct(y,4);f.setAttribute("color",_);let T=new Uint8Array(b.count);T.fill(0);let g=new ct(T,1,!1);f.setAttribute("visibility",g);let x=0;for(let S=0;S<m.length;S++){let[C,w]=m[S],k=w.getAttribute("position").count;C.edgeColors=_,C.edgeVisibility=g,C.geometry=f,C.ranges={count:k,start:x},x+=k,w.dispose()}let P=new pn(f,c(this,Al));P.userData.isOutline=!0,h.add(P)}}R(this,Qi,!1),this.outlineOpacitiesDirty=!0}for(let u of this.rendererState.geometry3DIdsInScene){let h=this.rendererState.geometry3DMap.get(u);if(h instanceof fe&&h.type==="geometry"&&h.components[3]&&h.components[3].dirty===!0&&h.components[0].material!=null&&h.parentObject3D instanceof xt){let m=h.components[3].geometry;if(!m)continue;let f=h.components[3];if(!f)continue;let b=f.enabled&&h.components[1].visible;if(f.visible!==b&&(f.visible=b),!f.visible)continue;let y=f.edgeColors;if(!y||!f.ranges)continue;let _=new Ee(f.color);for(let P=0;P<f.ranges.count;P++){let S=f.ranges.start+P;y.setXYZ(S,_.r,_.g,_.b)}let T=h.components[1].height,g=h.components[1].altitude;((l=(s=h.components[1])==null?void 0:s.bevel)==null?void 0:l.enabled)||El(m,f.ranges,T,g),m.attributes.color.needsUpdate=!0,m.computeBoundingSphere(),f.dirty=!1}}let n=r?yi(e,16,19,0,1):c(this,Kn);if((n!==c(this,Kn)||this.outlineOpacitiesDirty)&&this.rendererState.geometry3DIdsInScene.size>0){for(let u of this.rendererState.geometry3DIdsInScene)if(i=this.rendererState.geometry3DMap.get(u),(i==null?void 0:i.type)==="geometry"&&i.components[0]instanceof Ne){let h=i.components[3];if(h&&h.edgeColors&&h.geometry&&h.visible){let m=Math.min(n,i.components[1].opacity*yn(i));if(h.currentOpacity!==m){for(let f=0;f<h.ranges.count;f++){let b=h.ranges.start+f;h.edgeColors.setW(b,m)}h.geometry.attributes.color.needsUpdate=!0}}}}R(this,Kn,n),R(this,Qi,!1),this.outlineOpacitiesDirty=!1}destroy(){c(this,Ll).clear()}};Qi=new WeakMap,Kn=new WeakMap,Ll=new WeakMap,Al=new WeakMap,a(Bh,"OutlineInterpolationSystem");var Ol=Bh;v();v();var Fh=class Fh extends be{constructor(){super(...arguments);p(this,"userData",{entityId:""})}};a(Fh,"EntityMesh");var kl=Fh,AT=I.object({flipImageToFaceCamera:I.boolean().optional(),url:I.string()}),kT=I.object({type:I.enum(["Feature"]),properties:I.object({width:I.number(),height:I.number(),rotation:I.number().min(0).max(360).optional(),verticalOffset:I.number().optional()}),geometry:qn});function Uy(t,e,r){I.union([I.number(),I.string()]).parse(t),kT.parse(e),AT.parse(r)}a(Uy,"validateImage");var Gh=class Gh{constructor(e){p(this,"mesh",new Bt);p(this,"imageMesh");p(this,"outline");p(this,"type","image");p(this,"instanceIndex",-1);p(this,"geometry");p(this,"material");p(this,"feature");p(this,"position",new H);this.feature=e}get visible(){var e,r;return(r=(e=this.mesh)==null?void 0:e.visible)!=null?r:!1}set visible(e){this.mesh&&(this.mesh.visible=e)}};a(Gh,"ImageComponent");var Rl=Gh;v();function Xh(t,e){return{x:t.x*Math.cos(e)-t.y*Math.sin(e),y:t.x*Math.sin(e)+t.y*Math.cos(e)}}a(Xh,"rotatePoint");function RT(t,e){return t.map(r=>Xh(r,e))}a(RT,"rotatePoints");function NT(t){let e=1/0,r=1/0,i=-1/0,n=-1/0;for(let o of t)e=Math.min(e,o.x),r=Math.min(r,o.y),i=Math.max(i,o.x),n=Math.max(n,o.y);return{minX:e,minY:r,maxX:i,maxY:n}}a(NT,"getBounds");function BT(t,e){let r=!1;for(let i=0,n=e.length-1;i<e.length;n=i++){let o=e[i].x,s=e[i].y,l=e[n].x,u=e[n].y;s>t.y!=u>t.y&&t.x<(l-o)*(t.y-s)/(u-s)+o&&(r=!r)}return r}a(BT,"pointInPolygon");function jy(t,e,r,i,n){for(let o=0;o<n;o++)for(let s=0;s<i;s++)if(t[r+o][e+s]!==1)return!1;return!0}a(jy,"isValidRectangle");function FT(t,e,r){let i=t.maxX-t.minX,n=t.maxY-t.minY,o,s,l=O({},t);return i/n>e?(s=n/r,o=s*e,l.minX+=(i-o*r)/2):(o=i/r,s=o/e,l.minY+=(n-s*r)/2),{dx:o,dy:s,gridBounds:l}}a(FT,"calculateGridDimensions");function GT(t,e,r,i,n){let o=Array(r).fill(0).map(()=>Array(r).fill(0));for(let s=0;s<r;s++)for(let l=0;l<r;l++){let u={x:e.minX+l*i,y:e.minY+s*n};BT(u,t)&&(o[s][l]=1)}return o}a(GT,"createAndFillGrid");function XT(t,e){let r=Array(e).fill(0).map(()=>Array(e).fill(0));for(let i=0;i<e;i++)for(let n=0;n<e;n++)if(t[i][n]===1){let o=0;for(let s=1;s<=Math.min(e-n,e-i)&&jy(t,n,i,s,s);s++)o=s;r[i][n]=o}return r}a(XT,"calculateRectSizes");function zT(t,e,r,i,n,o){let s=0,l=0,u=0;for(let h=0;h<i;h++)for(let m=0;m<i;m++)if(t[h][m]===1){let f=Math.pow(e[h][m],2),b=r.minX+m*n,y=r.minY+h*o;s+=f,l+=b*f,u+=y*f}return{x:l/s,y:u/s}}a(zT,"calculatePolygonCenter");function YT(t,e,r,i,n,o,s){let l=-1/0,u=null,h=t.length,m=Math.sqrt(Math.pow(e.maxX-e.minX,2)+Math.pow(e.maxY-e.minY,2));for(let f=0;f<h;f++)for(let b=0;b<h;b++)if(t[f][b]===1)for(let y=1;y<=h-b;y++){let _=y;if(!(_>h-f)&&jy(t,b,f,y,_)){let T=y*_,g=e.minX+(b+y/2)*r,x=e.minY+(f+_/2)*i,P={x:g,y:x},C=Math.sqrt(Math.pow(P.x-n.x,2)+Math.pow(P.y-n.y,2))/m,w=T*(1-o)-C*o*T;w>l&&(l=w,u={center:P,width:y*r*s,height:y*i*s})}}return u}a(YT,"findBestRectangle");function zh(t,e,r,i={}){let{scaleFactor:n=.9,centerPriority:o=.5,resolution:s=100,minimumSizeRatio:l=.5}=i,u=$d(r),h=t.width/t.height,m=RT(e,u),f=NT(m),{dx:b,dy:y,gridBounds:_}=FT(f,h,s),T=GT(m,_,s,b,y),g=XT(T,s),x=zT(T,g,_,s,b,y),P=YT(T,_,b,y,x,o,n);return!P||P.width<t.width*l||P.height<t.height*l?t:j(O({},P),{center:Xh(P.center,-u),rotation:r,polygonCenter:Xh(x,-u)})}a(zh,"findLargestInteriorRectangle");var us=Math.PI*2,ZT=Math.PI/2,UT=Math.PI*1.5,jT=mn(ZT,2),HT=mn(UT,2),WT=.01,Hy=!1,Yh=class Yh extends me{constructor(r,i,n=0,o=0,s={}){super();p(this,"rendererState");p(this,"convertTo3DMapPosition");p(this,"initialBearing",0);p(this,"naturalBearing",0);p(this,"imagePlacementOptions");p(this,"imageLoadingCache",new Map);this.rendererState=r,this.convertTo3DMapPosition=i,this.initialBearing=n,this.naturalBearing=o,this.imagePlacementOptions=s}createImageMesh(r,i,n,o=0,s,l){var _,T,g;let u={width:n.width,height:n.height,center:this.convertTo3DMapPosition(s),rotation:(_=n.rotation)!=null?_:0},h=(T=this.imagePlacementOptions.mode)!=null?T:"default",m=(()=>{switch(h){case"fit-nearest-90":let x=(this.initialBearing-this.naturalBearing+360)%180;return x>=45&&x<=135?zh(u,l,u.rotation+90,this.imagePlacementOptions):u;case"fit-initial-bearing":return zh(u,l,this.initialBearing,this.imagePlacementOptions);case"default":case"none":default:return u}})();if(Hy&&m.polygonCenter){let x=new be(new Us(1),new mi({color:65280}));x.position.set(m.polygonCenter.x,m.polygonCenter.y,o),this.rendererState.entityScene.add(x)}let f=new mi({transparent:!0,depthWrite:!1,side:Rt}),b=new Nt(m.width,m.height),y=new kl(b);if(y.visible=!1,y.renderOrder=1,(g=this.getOrDownloadImage(i))==null||g.then(x=>{f.map=x,f.needsUpdate=!0,f.map.colorSpace=di,y.visible=!0,this.publish("image-loaded")}),y.userData.entityId=r,y.material=f,Hy){let x=new be(new Nt(n.width,n.height),new mi({color:"gray"}));y.add(x);let P=new Ud;y.add(P),P.scale.set(10,10,10)}return y.position.set(m.center.x,m.center.y,o+WT),y.rotation.z=(-ue.degToRad(m.rotation)+us)%us,y}getOrDownloadImage(r){var i;if(this.imageLoadingCache.has(r))return(i=this.imageLoadingCache.get(r))==null?void 0:i.promise;{let n=new Promise(o=>{ti.getLoader().load(r,s=>{let l=this.imageLoadingCache.get(r);l&&!l.loaded&&(l.loaded=!0),o(s)})});return this.imageLoadingCache.set(r,{loaded:!1,promise:n}),n}}flipIfNeeded(r,i){if(r.imageMesh==null)return;let n=-i,o=r.imageMesh.rotation.z,s=mn((o-n+us)%us,2);s>jT&&s<HT&&(r.imageMesh.rotation.z=(o+Math.PI)%us)}update(r){var s,l,u,h,m;let i,n,o;for(let f of this.rendererState.geometry3DIdsInScene)if(i=this.rendererState.geometry3DMap.get(f),(i==null?void 0:i.type)==="image"){if(n=i.components[0],o=i.components[1],o.url&&n.imageMesh==null){let b=this.convertTo3DMapPosition(n.feature.geometry.coordinates),y={x:b.x,y:b.y};n.imageMesh=this.createImageMesh(i.id,o.url,n.feature.properties,n.feature.properties.verticalOffset,n.feature.geometry.coordinates,[y]),n.mesh.add(n.imageMesh),n.position.copy(n.imageMesh.position)}n.imageMesh&&(o.flipImageToFaceCamera&&this.flipIfNeeded(n,r),n.imageMesh.material instanceof mi&&o.dirty&&(n.imageMesh.material.opacity=o.opacity))}else if((i==null?void 0:i.type)==="geometry"){if(n=i.components[0],o=i.components[1],o.showImage&&((s=n.feature.properties)!=null&&s.image)&&n.imageMesh==null&&n.visible&&n.mesh!=null&&n.mesh.parent!=null&&((l=n.feature.properties)==null?void 0:l.image.position)!=null&&n.feature.geometry.coordinates!=null&&n.feature.geometry.coordinates.length>0){let b=n.feature.geometry.coordinates[0].map(_=>{let T=this.convertTo3DMapPosition(_);return{x:T.x,y:T.y}}),y=this.createImageMesh(f,(u=n.feature.properties)==null?void 0:u.image.path,(h=n.feature.properties)==null?void 0:h.image,o.height,(m=n.feature.properties)==null?void 0:m.image.position,b);n.mesh.parent.add(y),n.imageMesh=y}if(n.imageMesh){if(!n.visible)n.imageMesh.visible=!1;else if(o.showImage&&!n.imageMesh.visible)if(o.url){let b=this.imageLoadingCache.get(o.url);b&&b.loaded&&(n.imageMesh.visible=!0)}else n.imageMesh.visible=!0;else!o.showImage&&n.imageMesh.visible&&(n.imageMesh.visible=!1);o.flipImageToFaceCamera&&this.flipIfNeeded(n,r)}}}};a(Yh,"ImageSystem");var Nl=Yh;v();var VT=250,ii,Zh=class Zh extends me{constructor(r,i){super();p(this,"cameraDirty",!0);p(this,"focusablesDirty",!0);p(this,"state");p(this,"camera");p(this,"debugEl",null);p(this,"raycasters",[]);p(this,"collisions",new Map);p(this,"focusableEntities",new Set);p(this,"debugRaycasters",!1);L(this,ii);p(this,"update",a((r=!1,i=Date.now())=>{this.focusablesDirty&&this.updateFocusableEntities(),!r&&(Date.now()-i>VT||(c(this,ii)&&cancelAnimationFrame(c(this,ii)),R(this,ii,requestAnimationFrame(()=>{this.updateRaf()}))))},"update"));this.state=r,this.camera=i,this.buildRaycasters()}resize(){this.buildRaycasters()}buildRaycasters(){this.debugEl&&this.debugEl.remove();let r=new ae(this.state.canvasWidth/2,this.state.canvasHeight/2),i=new ae(r.x/1.2,r.y/1.2),n=new ae(r.x+(r.x-i.x),i.y),o=new ae(i.x,r.y+(r.y-i.y)),s=new ae(n.x,o.y),l=new ae(r.x,r.y/1.5),u=new ae(r.x,r.y+(r.y-l.y));this.debugEl=document.createElement("div"),Object.assign(this.debugEl.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none"}),document.body.append(this.debugEl),this.raycasters=[r,l,u,i,n,o,s].map((h,m)=>{if(this.debugRaycasters){let T=document.createElement("div");T.style.position="absolute",T.style.top=h.y+"px",T.style.left=h.x+"px",T.style.width="10px",T.style.height="10px",T.style.backgroundColor="red",this.debugEl.append(T)}let f=h.x/this.state.canvasWidth*2-1,b=-(h.y/this.state.canvasHeight)*2+1,y=new ae(f,b),_=new qt;return _.setFromCamera(y,this.camera),[_,y,m===0?10:m<7?2:1]})}updateFocusableEntities(){this.focusableEntities.clear();let r,i,n;for(let o of this.state.geometry3DIdsInScene)if(n=this.state.geometry3DMap.get(o),n!=null){if(n.type==="group-container"&&n.components[1]!==void 0&&n.components[1]instanceof Mr){if(i=n.components[1],i.dirty===!0||i.focusMesh==null){i.focusMesh&&ze(i.focusMesh);let s=new it;s.setFromObject(n);let l=s.max.x-s.min.x,u=s.max.y-s.min.y,h=s.max.z-s.min.z;if(!isFinite(l)||!isFinite(u)||!isFinite(h)||isNaN(l)||isNaN(u)||isNaN(h)||l<=0||u<=0||h<=0)continue;let m=new kr(l,u,h),f={transparent:!0,opacity:this.debugRaycasters?1:0,visible:this.debugRaycasters};if(this.debugRaycasters){let _=["red","green","blue","yellow","purple","orange","pink","brown","gray","black"];f.color=_[Math.floor(Math.random()*_.length)]}let b=new st(f),y=new be(m,b);y.position.set((s.min.x+s.max.x)/2,(s.min.y+s.max.y)/2,0),y.userData={entityId:n.userData.entityId},i.focusMesh=y,n.add(y),n.components[1].dirty=!1}this.focusableEntities.add(i.focusMesh)}else if(n.type==="geometry"&&n.components[4]&&n.components[4]instanceof Mr&&(r=n.components[0],i=n.components[4],r instanceof Ne&&r.geometry!=null&&(i.dirty===!0||i.focusMesh==null))){if(i.focusMesh==null){let s=new be(r.geometry);s.userData={entityId:n.id},i.focusMesh=s}this.focusableEntities.add(i.focusMesh)}}this.focusablesDirty=!1}updateRaf(){if(this.focusableEntities.size===0){this.publish("geometry-in-focus",[]);return}this.cameraDirty&&this.raycast()}raycast(){this.collisions.clear();for(let[i,n]of this.raycasters)i.setFromCamera(n,this.camera);for(let[i,n,o]of this.raycasters)i.intersectObjects(Array.from(this.focusableEntities.values())).forEach(l=>{var u;if((l==null?void 0:l.object)!=null&&"isMesh"in l.object&&(l!=null&&l.object.isMesh)){let h=l.object.userData.entityId,m=(u=this.collisions.get(h))!=null?u:0;this.collisions.set(h,m+o)}});let r=Array.from(this.collisions,([i,n])=>({entityId:i,weight:n})).sort((i,n)=>n.weight-i.weight).map(({entityId:i})=>i);this.publish("geometry-in-focus",r),this.cameraDirty=!1}showRaycasters(){this.debugRaycasters=!0,this.buildRaycasters()}hideRaycasters(){this.debugRaycasters=!1,this.buildRaycasters()}destroy(){c(this,ii)&&cancelAnimationFrame(c(this,ii)),this.debugEl&&this.debugEl.remove(),this.collisions.clear(),this.focusableEntities.clear(),this.raycasters=[]}};ii=new WeakMap,a(Zh,"GeometryInFocusSystem");var Bl=Zh;v();v();v();v();v();function qT(t){if(!t)throw new Error("geojson is required");var e=[];return zr(t,function(r){$T(r,e)}),fi(e)}a(qT,"lineSegment");function $T(t,e){var r=[],i=t.geometry;if(i!==null){switch(i.type){case"Polygon":r=ji(i);break;case"LineString":r=[ji(i)]}r.forEach(function(n){var o=JT(n,t.properties);o.forEach(function(s){s.id=e.length,e.push(s)})})}}a($T,"lineSegmentFeature");function JT(t,e){var r=[];return t.reduce(function(i,n){var o=Vs([i,n],e);return o.bbox=KT(i,n),r.push(o),n}),r}a(JT,"createSegments");function KT(t,e){var r=t[0],i=t[1],n=e[0],o=e[1],s=r<n?r:n,l=i<o?i:o,u=r>n?r:n,h=i>o?i:o;return[s,l,u,h]}a(KT,"bbox");var Uh=qT;var ug=Ns(lg(),1);function T1(t,e){var r={},i=[];if(t.type==="LineString"&&(t=cc(t)),e.type==="LineString"&&(e=cc(e)),t.type==="Feature"&&e.type==="Feature"&&t.geometry!==null&&e.geometry!==null&&t.geometry.type==="LineString"&&e.geometry.type==="LineString"&&t.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var n=cg(t,e);return n&&i.push(n),fi(i)}var o=(0,ug.default)();return o.load(Uh(e)),hc(Uh(t),function(s){hc(o.search(s),function(l){var u=cg(s,l);if(u){var h=ji(u).join(",");r[h]||(r[h]=!0,i.push(u))}})}),fi(i)}a(T1,"lineIntersect");function cg(t,e){var r=ji(t),i=ji(e);if(r.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(i.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var n=r[0][0],o=r[0][1],s=r[1][0],l=r[1][1],u=i[0][0],h=i[0][1],m=i[1][0],f=i[1][1],b=(f-h)*(s-n)-(m-u)*(l-o),y=(m-u)*(o-h)-(f-h)*(n-u),_=(s-n)*(o-h)-(l-o)*(n-u);if(b===0)return null;var T=y/b,g=_/b;if(T>=0&&T<=1&&g>=0&&g<=1){var x=n+T*(s-n),P=o+T*(l-o);return uc([x,P])}return null}a(cg,"intersects");var zl=T1;v();function ds(t,e){e===void 0&&(e={});var r=zn(t);switch(!e.properties&&t.type==="Feature"&&(e.properties=t.properties),r.type){case"Polygon":return w1(r,e);case"MultiPolygon":return M1(r,e);default:throw new Error("invalid poly")}}a(ds,"default");function w1(t,e){e===void 0&&(e={});var r=zn(t),i=r.coordinates,n=e.properties?e.properties:t.type==="Feature"?t.properties:{};return hg(i,n)}a(w1,"polygonToLine");function M1(t,e){e===void 0&&(e={});var r=zn(t),i=r.coordinates,n=e.properties?e.properties:t.type==="Feature"?t.properties:{},o=[];return i.forEach(function(s){o.push(hg(s,n))}),fi(o)}a(M1,"multiPolygonToLine");function hg(t,e){return t.length>1?Hd(t,e):Vs(t[0],e)}a(hg,"coordsToLine");function I1(t,e){var r=!0;return zr(t,function(i){zr(e,function(n){if(r===!1)return!1;r=E1(i.geometry,n.geometry)})}),r}a(I1,"booleanDisjoint");function E1(t,e){switch(t.type){case"Point":switch(e.type){case"Point":return!A1(t.coordinates,e.coordinates);case"LineString":return!dg(e,t);case"Polygon":return!qr(t,e)}break;case"LineString":switch(e.type){case"Point":return!dg(t,e);case"LineString":return!D1(t,e);case"Polygon":return!pg(e,t)}break;case"Polygon":switch(e.type){case"Point":return!qr(e,t);case"LineString":return!pg(t,e);case"Polygon":return!O1(e,t)}}return!1}a(E1,"disjoint");function dg(t,e){for(var r=0;r<t.coordinates.length-1;r++)if(L1(t.coordinates[r],t.coordinates[r+1],e.coordinates))return!0;return!1}a(dg,"isPointOnLine");function D1(t,e){var r=zl(t,e);return r.features.length>0}a(D1,"isLineOnLine");function pg(t,e){for(var r=0,i=e.coordinates;r<i.length;r++){var n=i[r];if(qr(n,t))return!0}var o=zl(e,ds(t));return o.features.length>0}a(pg,"isLineInPoly");function O1(t,e){for(var r=0,i=t.coordinates[0];r<i.length;r++){var n=i[r];if(qr(n,e))return!0}for(var o=0,s=e.coordinates[0];o<s.length;o++){var l=s[o];if(qr(l,t))return!0}var u=zl(ds(t),ds(e));return u.features.length>0}a(O1,"isPolyInPoly");function L1(t,e,r){var i=r[0]-t[0],n=r[1]-t[1],o=e[0]-t[0],s=e[1]-t[1],l=i*s-n*o;return l!==0?!1:Math.abs(o)>=Math.abs(s)?o>0?t[0]<=r[0]&&r[0]<=e[0]:e[0]<=r[0]&&r[0]<=t[0]:s>0?t[1]<=r[1]&&r[1]<=e[1]:e[1]<=r[1]&&r[1]<=t[1]}a(L1,"isPointOnLineSegment");function A1(t,e){return t[0]===e[0]&&t[1]===e[1]}a(A1,"compareCoords");var mg=I1;function id(t,e){var r=!1;return zr(t,function(i){zr(e,function(n){if(r===!0)return!0;r=!mg(i.geometry,n.geometry)})}),r}a(id,"booleanIntersects");var fg=20,k1=5e3,nd="outdoor-system-debug-container",yg=!1,Yt,ke,ps,en,Zt,eo,oi,tn,Lt,to,ms,fs,ys,hr,Yl,rn,Ut,si,ai,nn,Ul,gs,vs,gg,vg,od=class od{constructor(e){L(this,hr);L(this,Yt,!0);L(this,ke);L(this,ps,"");L(this,en,new Set);L(this,Zt,new Set);L(this,eo);L(this,oi);L(this,tn);L(this,Lt,null);L(this,to,!1);L(this,ms,a(e=>{if(!c(this,ke))throw new Error("Map not initialized");let i=[[e[0],e[1]],[e[2],e[1]],[e[2],e[3]],[e[0],e[3]]].map(u=>c(this,ke).project(u)),n=Math.max(...i.map(u=>u.x)),o=Math.min(...i.map(u=>u.x)),s=Math.max(...i.map(u=>u.y)),l=Math.min(...i.map(u=>u.y));return[new oc.default(o,l),new oc.default(n,s)]},"#getScreenPoints"));L(this,fs,a(()=>{c(this,Lt)&&(clearTimeout(c(this,Lt)),R(this,Lt,null),R(this,Yt,!1))},"#stopTrying"));L(this,ys,a(()=>{c(this,Lt)&&(clearTimeout(c(this,Lt)),R(this,Lt,null)),R(this,Lt,setTimeout(()=>{c(this,fs).call(this)},k1))},"#startTrying"));L(this,rn,a(async()=>{if(yg&&c(this,oi)){let e=c(this,ms).call(this,c(this,oi));_e(this,hr,vg).call(this,e)}if(!(!c(this,ke)||!c(this,to))&&c(this,Yt)&&!(!c(this,Zt)||c(this,Zt).size===0)){if(c(this,si)&&(c(this,Ul).call(this),R(this,si,!1)),c(this,eo)){let e=c(this,ke).project(c(this,eo)),r=c(this,ke).queryRenderedFeatures(e,{layers:Array.from(c(this,Zt))});if(r.length>0){for(let i of r)c(this,Ut).push(["!=",["id"],i.id]);c(this,Ut).length>0&&c(this,Zt).forEach(i=>{var n;(n=c(this,ke))==null||n.setFilter(i,["all",...c(this,Ut)])}),R(this,Ut,[]),R(this,si,!1),R(this,Yt,!1)}}else if(c(this,oi)&&c(this,tn)){let e=c(this,ms).call(this,c(this,oi)),r=c(this,ke).queryRenderedFeatures(e,{layers:Array.from(c(this,Zt))});if(r.length>0){R(this,si,!0),c(this,ai).push(()=>{c(this,Ut).length>0&&(c(this,Zt).forEach(i=>{var n;(n=c(this,ke))==null||n.setFilter(i,["all",...c(this,Ut)])}),R(this,Yt,!1)),R(this,Ut,[])});for(let i=0;i<r.length;i+=fg){let n=r.slice(i,i+fg);c(this,ai).push(()=>{for(let o of n)if(o.geometry!=null&&"coordinates"in o.geometry){if(c(this,tn)==null)return;let s;if(o.geometry.type==="Polygon"?s=Ws(o.geometry.coordinates):o.geometry.type==="MultiPolygon"&&(s=Wd(o.geometry.coordinates)),!s)continue;for(let l of c(this,tn))if(id(l,s)){c(this,Ut).push(["!=",["id"],o.id]);continue}}})}c(this,gs).call(this)}}}},"#handleRender"));L(this,Ut,[]);L(this,si,!1);L(this,ai,[]);L(this,nn,null);L(this,Ul,a(()=>{c(this,nn)&&(globalThis.cancelAnimationFrame(c(this,nn)),R(this,nn,null)),R(this,ai,[])},"#cancelJobs"));L(this,gs,a(()=>{let e=c(this,ai).pop();typeof e=="function"&&(e(),c(this,ai).length>0&&R(this,nn,globalThis.requestAnimationFrame(c(this,gs)))),R(this,si,!1),c(this,fs).call(this)},"#runJobs"));L(this,vs,a(e=>{var r,i;if(c(this,ke)&&e&&e.dataType==="style"&&e.type==="styledata"&&c(this,en).size>0){let n=(i=(r=e==null?void 0:e.style)==null?void 0:r.stylesheet)==null?void 0:i.id;(!n||n!==c(this,ps))&&(R(this,ps,n),_e(this,hr,Yl).call(this),R(this,Yt,!0))}},"#handleStyleChange"));e&&(R(this,ke,e),c(this,ke).on("styledata",c(this,vs)),c(this,ke).on("render",c(this,rn)),R(this,to,c(this,ke).loaded()),c(this,ke).on("load",()=>{R(this,to,!0)})),yg&&_e(this,hr,gg).call(this)}hideLayersUnderPoint(e,r){c(this,ys).call(this),R(this,eo,e);for(let i of r)c(this,en).add(i);R(this,Yt,!0),_e(this,hr,Yl).call(this),c(this,rn).call(this)}hideLayersIntersectingPolygons(e,r,i){c(this,Lt)&&clearTimeout(c(this,Lt)),c(this,ys).call(this),R(this,oi,e),R(this,tn,r.reduce((n,o)=>{if(o.geometry.type==="Polygon"){let s=Ws(o.geometry.coordinates);n.push(s)}else o.geometry.type==="MultiPolygon"&&n.push(...o.geometry.coordinates.map(s=>Ws(s)));return n},[]));for(let n of i)c(this,en).add(n);R(this,Yt,!0),_e(this,hr,Yl).call(this),c(this,rn).call(this)}destroy(){c(this,ke)&&(c(this,ke).off("styledata",c(this,vs)),c(this,ke).off("render",c(this,rn)))}};Yt=new WeakMap,ke=new WeakMap,ps=new WeakMap,en=new WeakMap,Zt=new WeakMap,eo=new WeakMap,oi=new WeakMap,tn=new WeakMap,Lt=new WeakMap,to=new WeakMap,ms=new WeakMap,fs=new WeakMap,ys=new WeakMap,hr=new WeakSet,Yl=a(function(){if(R(this,Zt,new Set),c(this,ke))for(let e of c(this,en))c(this,ke).getLayer(e)&&c(this,Zt).add(e)},"#filterStylesInMap"),rn=new WeakMap,Ut=new WeakMap,si=new WeakMap,ai=new WeakMap,nn=new WeakMap,Ul=new WeakMap,gs=new WeakMap,vs=new WeakMap,gg=a(function(){if(!document.getElementById(nd)&&c(this,ke)){let e=document.createElement("div");e.id=nd,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",c(this,ke).getContainer().appendChild(e)}},"#addDebugContainer"),vg=a(function(e){let r=document.getElementById(nd);if(!r)return;let i=document.getElementById("bbox");i==null&&(i=document.createElement("div"),i.id="bbox",i.style.position="absolute",r.appendChild(i));let n=[Math.min(e[0].x,e[1].x),Math.min(e[0].y,e[1].y)],o=[Math.max(e[0].x,e[1].x),Math.max(e[0].y,e[1].y)];i.style.top=n[1]+"px",i.style.left=n[0]+"px",i.style.width=o[0]-n[0]+"px",i.style.height=o[1]-n[1]+"px",i.style.border="2px solid ".concat(c(this,Yt)?"red":"blue")},"#updateDebugBBox"),a(od,"OutdoorLayers");var Zl=od;v();v();v();v();var jl="attribute float pathDistance;\nattribute vec3 pathNormal;\nattribute vec3 pathTangent;\n\nuniform vec2 uvScale;\nuniform float vertexes;\nuniform float complete;\nuniform float nearRadius;\nuniform float farRadius;\nuniform float nearZoom;\nuniform float farZoom;\nuniform float pulse;\nuniform float pulseLength;\nuniform bool pathIsVertical;\nuniform bool displayArrowsOnPath;\nuniform vec2 cameraParameters;\nuniform float flattenFactor;\n\nvarying float zoomLevel;\nvarying float radius;\nvarying vec2 fragTexcoord;\nvarying float fragTopTextureU;\nvarying float fragPathDistance;\n\n// Map the x value from the range [xMin, xMax] to the range [yMin, yMax] using\n// linear interpolation/extrapolation.\n//\n// This performs a pure linear mapping y = mx + b where\n// 'm = (yMax - yMin) / (xMax - xMin)',\n// 'b = -xMin * (yMax - yMin) / (xMax - xMin) + yMin'.\nfloat remap(float x, float xMin, float xMax, float yMin, float yMax) {\n return (x - xMin) / (xMax - xMin) * (yMax - yMin) + yMin;\n}\n\n// Map the x value from [xMin, xMax] to the range [yMin, yMax] using linear\n// interpolation, clamping result values outside [yMin, yMax].\nfloat clampRemap(float x, float xMin, float xMax, float yMin, float yMax) {\n return clamp(remap(x, xMin, xMax, yMin, yMax), yMin, yMax);\n}\n\nvoid main() {\n fragPathDistance = pathDistance;\n\n // We can get an origin point for the cross-section of the path by\n // subtracting the surface normal times the radius, since the surface normal\n // points strictly away from the centre.\n vec3 origin = position - nearRadius * normal;\n\n // Inflate the path along its surface normal to increase its radius from\n // 'nearRadius' to 'farRadius' when the camera is at 'farZoom'.\n vec3 adjustedPosition = position;\n zoomLevel = clampRemap(cameraParameters.x, nearZoom, farZoom, 0.0, 1.0);\n adjustedPosition += normal * (farRadius - nearRadius) * zoomLevel;\n\n // Determine how far the path extends \"up\" or \"down\" in the direction of the\n // path normal.\n float height = dot(adjustedPosition - origin, pathNormal);\n\n // Flatten the bottom half of the path entirely so that it's flat\n // against the floor. This makes the path look nicer when it's\n // semitransparent behind opaque geometry, so you don't see it\n // peeking through.\n float desiredHeight = max(height, 0.0);\n\n desiredHeight = desiredHeight * flattenFactor;\n\n float flattenMagnitude = height - desiredHeight;\n adjustedPosition = adjustedPosition - pathNormal * flattenMagnitude;\n\n // Transform the vertices into NDC.\n vec4 mvPosition = modelViewMatrix * vec4(adjustedPosition, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n\n fragTexcoord = uv;\n\n // Compute a texture coordinate for mapping the arrow texture to the path.\n // We don't want to use the u-value that Three.js provides, because the\n // path may end up twisting arbitrarily -- but we want the arrow texture to\n // always be on the top of the path.\n vec3 bitangent = cross(normal, pathTangent);\n fragTopTextureU = -dot(bitangent, pathNormal) * 0.5 + 0.5;\n\n radius = mix(nearRadius, farRadius, zoomLevel);\n}\n";v();var sd="#define ARROW_FADING_POINT 0.15\n\nuniform float complete;\nuniform float nearRadius;\nuniform float farRadius;\nuniform vec2 resolution;\nuniform vec2 cameraParameters;\nuniform vec3 color;\nuniform float pathLength;\nuniform bool showPulse;\nuniform vec3 pulseColor;\nuniform float pulse;\nuniform float pulseLength;\nuniform bool pathIsVertical;\nuniform bool displayArrowsOnPath;\nuniform float arrowAnimationTimer;\nuniform float opacityMultiplier;\nuniform bool dashed;\nuniform sampler2D arrowTexture;\n\nvarying float zoomLevel;\nvarying float radius;\nvarying vec2 fragTexcoord;\nvarying float fragTopTextureU;\nvarying float fragPathDistance;\n\n// How long the arrow should be, as a factor of pathRadius. Since we've\n// mostly flattened the top of the path, values near 2.0 (the diameter)\n// will probably look best.\nconst float arrowLength = 2.0;\n\n// How much of a relative margin the arrow texture should have inside the\n// area laid out for it. Useful to pull the arrow away from the edges of the\n// path, which slope down.\nconst float arrowMargin = 0.1;\n\n// How many arrow-lengths of space should be between arrows on a short path.\nconst float arrowSpacingOnShortPath = 6.0;\n\n// How many arrow-lengths of space should be between arrows on a long path.\nconst float arrowSpacingOnLongPath = 7.5;\n\n// How long a path must be to be considered \"long\", as a factor of\n// the path radius.\nconst float longPathLength = 200.;\n\n// How long a path must be to be considered \"short\", as a factor of the\n// path radius.\nconst float shortPathLength = 75.;\n\n// How much of the path's length the fade-in should comprise when going from\n// zero opacity to full opacity.\nconst float completeLength = 0.1;\n\n// Map the x value from the range [xMin, xMax] to the range [yMin, yMax] using\n// linear interpolation/extrapolation.\n//\n// This performs a pure linear mapping 'y = mx + b' where\n// 'm = (yMax - yMin) / (xMax - xMin)',\n// 'b = -xMin * (yMax - yMin) / (xMax - xMin) + yMin'.\nfloat remap(float x, float xMin, float xMax, float yMin, float yMax) {\n return (x - xMin) / (xMax - xMin) * (yMax - yMin) + yMin;\n}\n\n// Map the x value from [xMin, xMax] to the range [yMin, yMax] using linear\n// interpolation, clamping result values outside [yMin, yMax].\nfloat clampRemap(float x, float xMin, float xMax, float yMin, float yMax) {\n return clamp(remap(x, xMin, xMax, yMin, yMax), yMin, yMax);\n}\n\nvoid main(void) {\n // Compute the opacity of the path based on the distance from the current\n // fragment to the 'complete' value as it varies from 0.0 to 1.0.\n // Fragments that are at the 'complete' value or past it will be fully\n // transparent, while fragments that are at 'complete - completeLength'\n // or before it will be fully opaque. However, we adjust the 'complete'\n // value here so that it overshoots by one full 'completeLength', so that\n // the entire path will be opaque when the 'complete' value is at 1.0.\n float completeLocation = complete * (1.0 + completeLength);\n float completeAmount = clampRemap(\n fragPathDistance,\n completeLocation - completeLength,\n completeLocation,\n 0.0,\n 1.0\n );\n float opacity = 1.0 - smoothstep(0.0, 1.0, completeAmount);\n\n // 2020/01/09 Terence Dickson\n // When we render the background and overlay for the mapbox outdoor context\n // behind everything else in single-buffer rendering, the fact that the path\n // writes to the depth buffer means that the background and overlay will not\n // be drawn behind the path even when the path is still fading in. The effect\n // is subtle and is only visible in single-buffer rendering so this quick fix\n // prevents writes to the depth buffer for zero opacity fragments, which gets\n // rid of the most visually-offensive ghosting.\n if (opacity <= 0.0) {\n discard;\n }\n\n // Push in the texture coordinates so that they ramp up\n // at 'arrowMargin' instead of at zero; this remapping looks somewhat\n // like this:\n // 1 ^ ___\n // | /\n // | /\n // | /\n // | /\n // |___/\n // 0 +---------->\n // 0 ^ 1\n // arrowMargin\n // Making the arrows narrower on the path.\n float u = fragTopTextureU;\n u = clamp(\n u * (1. / (1. - arrowMargin * 2.)) - (1. / (1. - arrowMargin * 2.) - 1.) / 2.,\n 0.0,\n 1.0\n );\n\n float arrowSpacing = clampRemap(\n pathLength,\n shortPathLength * radius,\n longPathLength * radius,\n arrowSpacingOnShortPath,\n arrowSpacingOnLongPath\n );\n\n // Reduce the spacing between arrows when the camera zooms out, as increasing\n // the path radius will increase the arrow size and thus be able to fit\n // fewer arrows on in total, and this secondary movement of the arrows\n // \"zooming off\" the end of the path is unpleasant\n float expandAmount = mix(1.0, farRadius / nearRadius, zoomLevel);\n float effectiveArrowSpacing =\n arrowSpacing * 1.0 / expandAmount +\n arrowMargin * 2.0;\n\n float effectiveArrowLength = arrowLength * radius * (1. - arrowMargin * 2.0);\n\n // Adjust the slope of the vertical texture coordinate so that it goes\n // from 0 to 1 along the length of the arrow plus the spacing between\n // arrows, and adjust its x-intercept so that one arrow moves to the\n // exact position of the next arrow as 'arrowAnimationTimer' goes\n // from 0 to 1\n float v = (\n fragTexcoord.x * (pathLength / effectiveArrowLength)\n - arrowAnimationTimer * (1. + effectiveArrowSpacing)\n );\n\n // Compute a \"looping sawtooth\" wave for determining the vertical texture\n // coordinates of the arrow texture, roughly as follows:\n // 3 ^ /\n // | ___/\n // 2 | /\n // | ___/\n // 1 | /\n // |___/\n // 0 +--------------->\n // 0 ^ ^\n // ^ |_|\n // | effectiveArrowLength\n // |___|\n // effectiveArrowSpacing\n //\n // This is effectively equivalent to this sort of sawtooth wave:\n // ^\n // 1 | / / /\n // |___/ ___/ ___/\n // 0 +--------------->\n //\n // Causing the image of the arrow to repeat, with dead space (the bottom\n // edge of the texture stretched out) between the arrows at the provided\n // spacing. The reason why the \"looping\" design is preferred is because\n // it takes advantage of WebGL's 'GL_REPEAT' texture wrapping behaviour\n // to avoid the discontinuity that can end up causing visual artifacts.\n if (mod(v, (1. + effectiveArrowSpacing)) < 1.) {\n v = v - effectiveArrowSpacing * floor(v / (1. + effectiveArrowSpacing));\n } else {\n v = ceil(v / (1. + effectiveArrowSpacing));\n }\n\n // Use the r-component of the texture to determine whether the arrow covers\n // this fragment or not\n vec2 sampleTexcoord = vec2(u, v);\n float arrowAmount = 0.0;\n vec3 secondColor = pulseColor;\n\n if (displayArrowsOnPath) {\n arrowAmount = texture2D(arrowTexture, sampleTexcoord).r;\n float delta = 1.0 - abs(fragPathDistance * 2.0 - 1.0);\n secondColor = mix(color, pulseColor, 1.0 - smoothstep(ARROW_FADING_POINT, 0.0, delta));\n }\n\n if (dashed) {\n float dashLength = 0.1; // Adjust this value to change the dash length\n float gapLength = 0.1; // Adjust this value to change the gap length\n float totalLength = dashLength + gapLength;\n float numSegments = ceil(1.0 / totalLength);\n float adjustedTotalLength = 1.0 / numSegments;\n float adjustedDashLength = adjustedTotalLength * (dashLength / (dashLength + gapLength));\n float pattern = mod(fragPathDistance, adjustedTotalLength);\n opacity = pattern < adjustedDashLength ? 1.0 : 0.0;\n }\n\n\n if (showPulse) {\n // Add the pulse color to the path by determining how far the current fragment\n // is from 'pulse'\n float pulseLocation = remap(\n pulse,\n 0.0,\n 1.0,\n -pulseLength,\n 1.0 + pulseLength\n );\n float pulseDistance = smoothstep(\n 0.0,\n pulseLength,\n abs(fragPathDistance - pulseLocation)\n );\n\n // Blend the pulse color to the path based on how close this fragment is to\n // the 'pulse' value and whether it's covered by an arrow -- but if it's\n // covered by *both*, then we go back to using the regular path color\n // (making arrows look like \"holes\" when they're overlapping the pulse.)\n float pulseLevel = abs(1.0 - pulseDistance - arrowAmount);\n\n gl_FragColor = vec4(mix(color, secondColor, pulseLevel), opacity * opacityMultiplier);\n } else if (displayArrowsOnPath) {\n gl_FragColor = vec4(mix(color, pulseColor, arrowAmount), opacity * opacityMultiplier);\n } else {\n gl_FragColor = vec4(color, opacity * opacityMultiplier);\n }\n #include <colorspace_fragment>\n}\n";v();var bg="uniform float complete;\nuniform float nearRadius;\nuniform float farRadius;\nvarying float fragPathDistance;\nconst float completeLength = 0.1;\n\n// Map the x value from the range [xMin, xMax] to the range [yMin, yMax] using\n// linear interpolation/extrapolation.\n//\n// This performs a pure linear mapping 'y = mx + b' where\n// 'm = (yMax - yMin) / (xMax - xMin)',\n// 'b = -xMin * (yMax - yMin) / (xMax - xMin) + yMin'.\nfloat remap(float x, float xMin, float xMax, float yMin, float yMax) {\n return (x - xMin) / (xMax - xMin) * (yMax - yMin) + yMin;\n}\n\n// Map the x value from [xMin, xMax] to the range [yMin, yMax] using linear\n// interpolation, clamping result values outside [yMin, yMax].\nfloat clampRemap(float x, float xMin, float xMax, float yMin, float yMax) {\n return clamp(remap(x, xMin, xMax, yMin, yMax), yMin, yMax);\n}\n\nvoid main(void) {\n // this ensures that the stencil mask moves along with the path above it, to avoid the progress bar effect\n float completeLocation = complete * (1.0 + completeLength);\n float completeAmount = clampRemap(\n fragPathDistance,\n completeLocation - completeLength,\n completeLocation,\n 0.0,\n 1.0\n );\n float opacity = 1.0 - smoothstep(0.0, 1.0, completeAmount);\n\n // 2020/01/09 Terence Dickson\n // When we render the background and overlay for the mapbox outdoor context\n // behind everything else in single-buffer rendering, the fact that the path\n // writes to the depth buffer means that the background and overlay will not\n // be drawn behind the path even when the path is still fading in. The effect\n // is subtle and is only visible in single-buffer rendering so this quick fix\n // prevents writes to the depth buffer for zero opacity fragments, which gets\n // rid of the most visually-offensive ghosting.\n if (opacity <= 0.0) {\n discard;\n }\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, opacity);\n}";var xg="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==";var N1=new js;function Sg(t,e,r){var yt,Qe;let{breakpoint:i,width:n,accentColor:o,completeFraction:s,isVertical:l,visibleThroughGeometry:u,dashed:h}=e,{color:m}=r,f=!0,b=0,y=1/0,_=e.displayArrowsOnPath,T=!0,g=_,x=typeof n=="object"?Number(n.output[i])/2:n/2,P=typeof n=="object"?Number((yt=n.output[i+1])!=null?yt:n.output[i])/2:n/2,S=((Qe=r.altitude)!=null?Qe:0)+B1,C=0;t[0].z+=S;for(let ne=1;ne<t.length;++ne){t[ne].z+=S;let K=t[ne].x-t[ne-1].x,Pe=t[ne].z-t[ne-1].z;if(l)C+=Math.sqrt(K*K+Pe*Pe);else{let Ye=t[ne].y-t[ne-1].y;C+=Math.sqrt(K*K+Ye*Ye+Pe*Pe)}}if(!l){let ne=t[0],K=t[t.length-1];t.push(K.clone().setZ(K.z-.01)),t.unshift(ne.clone().setZ(ne.z-.01))}let w=new Ld;g&&(w=N1.load(xg),w.colorSpace=di);let k=new Ee(m),A=new Ee(o),N={vertexes:{type:"f",value:1},resolution:{type:"v2",value:new ae(1,1)},cameraParameters:{type:"v2",value:new ae(b,0)},complete:{type:"f",value:f?0:1},color:{type:"c",value:k},pathLength:{type:"f",value:C},nearRadius:{type:"f",value:x},farRadius:{type:"f",value:P},nearZoom:{type:"f",value:b},farZoom:{type:"f",value:y},pulseColor:{type:"c",value:A},pulse:{type:"f",value:0},pulseLength:{type:"f",value:.075},pathIsVertical:{type:"b",value:l},arrowAnimationTimer:{type:"f",value:0},arrowTexture:{type:"t",value:w},displayArrowsOnPath:{type:"b",value:_},showPulse:{type:"b",value:T},opacityMultiplier:{type:"f",value:1},dashed:{type:"b",value:h}},Y=new Gd(t);Y.curveType="catmullrom",Y.tension=0;let z=30,X=8,q=z*t.length,F=new Xd(Y,q,x,X,!1),J=new Float32Array(F.attributes.position.count);for(let ne=t.length;ne<J.length;ne++)J[ne]=ne;F.setAttribute("vertexIndex",new ct(J,1));let pe=new Float32Array(F.attributes.position.count),se=new ct(pe,1);for(let ne=0;ne<=q;ne++)for(let K=0;K<=X;++K)se.setX(ne*(X+1)+K,ne/q);F.setAttribute("pathDistance",se);let De=new Float32Array(F.attributes.normal.count*3),ve=new ct(De,3);for(let ne=0;ne<q;ne++){let K=F.tangents[ne];for(let Pe=0;Pe<=X;++Pe)ve.setXYZ(ne*(X+1)+Pe,K.x,K.y,K.z)}F.setAttribute("pathTangent",ve);let ge=new Float32Array(F.attributes.normal.count*3),xe=new ct(ge,3);for(let ne=0;ne<q;ne++){let K=F.tangents[ne];var rt,Ge,Ue;l?(rt=K.x*K.y,Ge=-1+K.y*K.y,Ue=K.z*K.y):(rt=-K.x*K.z,Ge=-K.y*K.z,Ue=1-K.z*K.z);let Pe=Math.sqrt(rt*rt+Ge*Ge+Ue*Ue);Pe===0&&(Pe=1);let Ye=rt/Pe,Wt=Ge/Pe,ui=Ue/Pe;for(let pr=0;pr<=X;++pr)xe.setXYZ(ne*(X+1)+pr,Ye,Wt,ui)}F.setAttribute("pathNormal",xe);let je=new Rr({uniforms:N,vertexShader:jl,fragmentShader:sd});je.transparent=!0,je.alphaTest=.5,N.resolution.value.x=1,N.resolution.value.y=1,N.vertexes.value=J.length,N.arrowTexture.value.wrapS=Vt,N.arrowTexture.value.wrapT=Vt,N.arrowTexture.value.anisotropy=16;let Me=new be(F,je),Xe=Me.clone(),Ke=j(O({},N),{opacityMultiplier:{type:"f",value:.25}});Ke.complete.value=1,Xe.material=new Rr({uniforms:Ke,vertexShader:jl,fragmentShader:sd}),Xe.material.transparent=!0,Xe.material.alphaTest=.5,Xe.material.depthWrite=!1,Xe.material.depthTest=!1,Ke.resolution.value.x=1,Ke.resolution.value.y=1,Ke.vertexes.value=J.length,Ke.arrowTexture.value.wrapS=Vt,Ke.arrowTexture.value.wrapT=Vt,Ke.arrowTexture.value.anisotropy=16,Ke.complete.value=s,Me.userData=Xe.userData=e.mesh.userData;let _t=e.mesh;if(!u){let ne=new Rr({uniforms:N,vertexShader:jl,fragmentShader:bg}),K=new be(F,ne);K.name="stencil",K.material.colorWrite=!1,K.material.stencilWrite=!0,K.material.stencilRef=1,K.material.stencilFunc=Dd,K.material.stencilZPass=zs,K.material.stencilZFail=zs,K.material.stencilFail=zs,K.material.depthWrite=!1,K.material.depthTest=!1,K.userData=e.mesh.userData,_t.add(K),_t.add(Xe),Xe.renderOrder=0,Me.renderOrder=1}if(_t.add(Me),l){let ne=new it().setFromObject(Me),K=new H;ne.getCenter(K),_t.children.forEach(Pe=>{Pe.geometry.center(),Pe.position.copy(K)})}u&&(Me.material.stencilWrite=!0,Me.material.stencilRef=1,Me.material.stencilFunc=Ed,Me.material.stencilZPass=Xs,Me.material.stencilZFail=Xs,Me.material.stencilFail=Xs,Me.material.needsUpdate=!0,Me.layers.disableAll(),Me.layers.enable(Ks.ALWAYS_ON_TOP)),F.computeBoundingBox();let Lr=new H;return F.boundingBox.getCenter(Lr),{mesh:_t,material:je,center:Lr}}a(Sg,"buildPath");var B1=.15;var F1=.5,ad=class ad extends me{constructor(r,i,n,o){super();p(this,"rendererState");p(this,"verticalDistanceDirty",!0);p(this,"convertTo3DMapPosition");p(this,"getParentContainer");p(this,"convertZoomLevelToAltitude");this.rendererState=r,this.convertTo3DMapPosition=i,this.getParentContainer=n,this.convertZoomLevelToAltitude=o}update(r,i,n,o=0){let s,l=!1;for(let u of this.rendererState.geometry3DIdsInScene)if(s=this.rendererState.geometry3DMap.get(u),s&&s.type==="path"&&s.components[0].type==="path"){let h=s.components[0],m=s.components[1],f=h.isVertical&&this.verticalDistanceDirty;if(!(h instanceof ri))continue;let b=[];if(h.dirty||m.dirty||f){if(h.mesh.parent!=null)for(let y=h.mesh.children.length-1;y>=0;y--)ze(h.mesh.children[0]);if(h.feature.features.length===2&&h.feature.features[0].properties.parentId&&h.feature.features[1].properties.parentId){let y=h.feature.features[0],_=h.feature.features[h.feature.features.length-1],T,g,x=y.geometry.coordinates[2]||0,P=_.geometry.coordinates[2]||0;y.properties.parentId&&(T=this.getParentContainer(y.properties.parentId,!0),T!=null&&T.altitude!=null&&(x+=T.altitude,h.isVertical=!0)),_.properties.parentId&&(g=this.getParentContainer(_.properties.parentId,!0),g!=null&&g.altitude!=null&&(P+=g.altitude,h.isVertical=!0));let S=this.convertTo3DMapPosition(y.geometry.coordinates[1],y.geometry.coordinates[0],x),C=this.convertTo3DMapPosition(_.geometry.coordinates[1],_.geometry.coordinates[0],P);Math.abs(S.z-C.z)>F1&&T!=null&&T.visible&&g!=null&&g.visible&&(b=[S,C])}else{let y=h.feature.features;for(let _=0;_<y.length;_++)if(_===0||!gp(y[_].geometry.coordinates,y[_-1].geometry.coordinates)){let T=this.convertTo3DMapPosition(y[_].geometry.coordinates[1],y[_].geometry.coordinates[0],y[_].geometry.coordinates[2]||0);b.push(T)}}if(b.length>1){let{mesh:y,material:_,center:T}=Sg(b,h,{color:m.color,altitude:m.altitude});h.mesh=y,h.material=_,h.position=T}h.dirty&&typeof h.width=="object"&&h.width.on==="zoom-level"&&(h.altitudeBreakpoints=h.width.input.map(y=>this.convertZoomLevelToAltitude(y))),h.dirty=!1}m.dirty&&(h.mesh.children.forEach(y=>{y.name!=="stencil"&&(y.material.uniforms.color.value.set(m.color),y.material.visible=m.visible,y.material.needsUpdate=!0)}),h.mesh.position.z=m.altitude,m.dirty=!1),h.isVertical&&h.mesh.children.forEach(y=>{y.rotation.z=-o}),h.material&&(h.mesh.children.forEach(y=>{var T,g,x,P,S,C,w;let _=y.material.uniforms;if(y.name==="stencil"){h.materialDirty&&(_.complete.value=h.completeFraction);return}if(typeof h.width=="object"&&h.width.on==="zoom-level"){h.altitudeBreakpoints&&h.altitudeBreakpoints.length>2&&te.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 k=ip(n,(g=(T=h.altitudeBreakpoints)==null?void 0:T.slice(0,2))!=null?g:[r,i]);h.breakpoint=k,_.nearZoom.value=(P=(x=h.altitudeBreakpoints)==null?void 0:x[k])!=null?P:r,_.farZoom.value=(C=(S=h.altitudeBreakpoints)==null?void 0:S[k+1])!=null?C:i,_.nearRadius.value=Number(h.width.output[k])/2,_.farRadius.value=Number((w=h.width.output[k+1])!=null?w:h.width.output[k])/2}_.cameraParameters.value.x=n,h.materialDirty&&(_.displayArrowsOnPath.value=h.displayArrowsOnPath,_.pulseColor.value.set(h.accentColor),_.complete.value=h.completeFraction,typeof h.width=="number"&&(_.nearZoom.value=r,_.farZoom.value=i,_.nearRadius.value=Number(h.width)/2,_.farRadius.value=Number(h.width)/2))}),h.displayArrowsOnPath&&h.animateArrowsOnPath&&(h.mesh.children.forEach(y=>{y.name!=="stencil"&&(y.material.uniforms.arrowAnimationTimer.value=performance.now()/3e3,y.material.needsUpdate=!0)}),l=!0),h.materialDirty=!1)}this.verticalDistanceDirty=!1,l&&this.publish("animate:path")}};a(ad,"PathSystem");var bs=ad;v();var Ze,ro,Dr,ld=class ld{constructor(e){p(this,"rendererState");p(this,"dirty",!1);L(this,Ze);L(this,ro);L(this,Dr);this.rendererState=e}updateOne(e){if(e instanceof fe&&e.components[0]instanceof Ne&&e.components[1]instanceof Kt&&e.parentObject3D instanceof xt&&(R(this,Ze,e.components[0]),R(this,Dr,e.components[1]),c(this,Ze).detached&&c(this,Ze).dirty&&c(this,Ze).mesh!=null&&c(this,Ze).material!=null&&c(this,Ze).batchedProps!=null)){R(this,ro,e.parentObject3D),c(this,Ze).visible=!1;let r=new Ee(c(this,Dr).color),i=c(this,Dr).opacity*yn(e),n=new Ui({color:r,side:Rt,opacity:i!=null?i:1,transparent:i!==void 0?i<1:!1},1,c(this,Ze).material.repeatYFactor),o=new $s(1,c(this,Ze).batchedProps.positionCount,0,n),s=zy(c(this,Ze),o);if(s==null)return;o.userData={entities:{0:e.id},detached:!0},c(this,Ze).instanceIndex=s,c(this,Ze).material.setColor(c(this,Ze).instanceIndex,r,c(this,Dr).topColor?new Ee(c(this,Dr).topColor):r),c(this,Ze).mesh=o,c(this,Ze).material=n,c(this,ro).add(o),c(this,Ze).dirty=!1}}update(){if(!this.dirty)return;let e;for(let r of this.rendererState.geometry3DIdsInScene)e=this.rendererState.geometry3DMap.get(r),this.updateOne(e);this.dirty=!1,this.cleanup()}cleanup(){R(this,Ze,void 0),R(this,ro,void 0),R(this,Dr,void 0)}};Ze=new WeakMap,ro=new WeakMap,Dr=new WeakMap,a(ld,"MeshDetachmentSystem");var Hl=ld;v();v();function Cg(t,e,r){var i;if((i=t.batchedProps)!=null&&i.range&&t.mesh){let n=e||1e-4,o=n/Math.max(r,1e-4);return El(t.mesh.geometry,t.batchedProps.range,n,0),t.material&&(t.material.repeatYFactor=o),t.currentHeight=n,!0}return!1}a(Cg,"updateHeight");function _g(t,e,r,i,n,o){return t.mesh&&t.instanceIndex!==-1?(t.mesh.getMatrixAt(t.instanceIndex,r),r.decompose(i,n,o),i.z=e,r.compose(i,n,o),t.mesh.setMatrixAt(t.instanceIndex,r),t.altitude=e,!0):!1}a(_g,"updateAltitude");var jt,dr,Vl,ql,$l,Jl,cd=class cd{constructor(e){p(this,"rendererState");p(this,"dirty",!1);L(this,jt);L(this,dr);L(this,Vl,new bt);L(this,ql,new H);L(this,$l,new pi);L(this,Jl,new H);this.rendererState=e}updateOne(e){var r;if(e instanceof fe&&e.type==="geometry"&&((r=e.components[1])!=null&&r.dirty)&&(R(this,jt,e.components[0]),R(this,dr,e.components[1]),e.type==="geometry")){let i=!1;c(this,dr).height!==c(this,jt).currentHeight&&(i=Cg(c(this,jt),c(this,dr).height,c(this,dr).initialHeight)),c(this,dr).altitude!==c(this,jt).altitude&&(i=_g(c(this,jt),c(this,dr).altitude,c(this,Vl),c(this,ql),c(this,$l),c(this,Jl))),i&&c(this,jt).mesh!=null&&c(this,jt).mesh.computeBoundingSphere()}}update(){let e;for(let r of this.rendererState.geometry3DIdsInScene)e=this.rendererState.geometry3DMap.get(r),this.updateOne(e);this.cleanup()}cleanup(){R(this,jt,void 0),R(this,dr,void 0)}};jt=new WeakMap,dr=new WeakMap,Vl=new WeakMap,ql=new WeakMap,$l=new WeakMap,Jl=new WeakMap,a(cd,"MeshModificationSystem");var Wl=cd;v();var G1={showPolygonLabelTextAreaMesh:!1,showEnvMap:!1,showCollisionBoxes:!1},ud=class ud{constructor(e){p(this,"state",G1);p(this,"core");this.core=e}update(e){let r={};for(let[i,n]of Object.entries(e))i in this.state&&this.state[i]!==e[i]&&(this.state[i]=n,r[i]=n);this.handleUpdate(r)}handleUpdate(e){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.getSystems().collisionSystem.showCollisionBoxes(),this.core.render()):this.core.getSystems().collisionSystem.hideCollisionBoxes())}};a(ud,"Debug");var Kl=ud;v();var xs=9,X1=!1,Pg=.1;function z1(t,e,r){for(let i=0;i<e;i++){let n=(r&16711680)>>16,o=(r&65280)>>8,s=r&255;t[i*3]=n/255,t[i*3+1]=o/255,t[i*3+2]=s/255}}a(z1,"fillArrayWithColor");var hd=class hd{constructor(e,r,i){p(this,"state");p(this,"renderer");p(this,"renderService");p(this,"pickingTexture");p(this,"pickingMaterial");p(this,"pixelBuffer");p(this,"width",0);p(this,"height",0);p(this,"scale",1/2);p(this,"color",1);p(this,"convertTo3DMapPosition");p(this,"destroyed",!1);p(this,"enabled",!1);p(this,"backgroundId",16777215);p(this,"resize",a(()=>{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 kd(this.width,this.height,{format:Gs,type:Fs,internalFormat:"RGBA"})},"resize"));p(this,"shouldShowByXY",a((e,r,i)=>{if(this.pixelBuffer==null)return!1;let n=e+(this.height-r-1)*this.width,o=this.pixelBuffer[n*4],s=this.pixelBuffer[n*4+1],l=this.pixelBuffer[n*4+2],u=o<<16|s<<8|l;return u===i||u===this.backgroundId},"shouldShowByXY"));p(this,"activeOccluders",new Set);p(this,"update",a(()=>{if(!this.enabled||this.destroyed||(this.activeOccluders.clear(),this.activeOccluders.add(this.backgroundId),!this.pickingTexture||!this.pixelBuffer))return;let e,r;for(let n of this.state.geometry3DIdsInScene){let o=this.state.geometry3DMap.get(n);if(o&&o instanceof Ie&&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"){let s=dl(e,this.convertTo3DMapPosition,{color:"white",height:Pg});r=this.createOccluderMesh(s,o.userData.occluderId),o.add(r)}else if(e.geometry.type==="MultiPolygon"){let s=pl(e,this.convertTo3DMapPosition,{color:"white",height:Pg});r=this.createOccluderMesh(s,o.userData.occluderId),o==null||o.add(r)}o.userData.occluderDirty=!1}}this.renderer.setRenderTarget(this.pickingTexture);let i=new Ee(this.backgroundId);this.renderer.setClearColor(i),this.renderer.clear(),this.state.cameraObject.layers.disableAll(),this.state.cameraObject.layers.enable(xs),this.renderer.render(this.state.entityScene.parent,this.state.cameraObject),this.renderer.setRenderTarget(null),this.state.cameraObject.layers.disable(xs),X1?this.renderService.enabledLayers.add(xs):this.renderService.enabledLayers.delete(xs),this.renderer.readRenderTargetPixelsAsync(this.pickingTexture,0,0,this.width,this.height,this.pixelBuffer).then(()=>{if(!this.destroyed)for(let n of this.state.geometry2DIdsInScene){let o=this.state.geometry2DMap.get(n);if(o&&(o==null?void 0:o.occluderId)!=null&&this.activeOccluders.has(o==null?void 0:o.occluderId)){let s=o.components[0].projection,l=Math.floor(s.x*this.scale),u=Math.floor(s.y*this.scale),h=this.shouldShowByXY(l,u,o.occluderId);o.components[0].isOccluded=!h}}}).catch(n=>{this.destroyed||te.error(n)})},"update"));if(this.state=e,this.convertTo3DMapPosition=r,(i==null?void 0:i.renderer)==null)throw new Error("No Renderer");this.renderService=i,this.renderer=i.renderer,this.resize(),this.pickingMaterial=new Rr({glslVersion:Od,vertexShader:"\n attribute vec3 color;\n varying vec3 vColor;\n void main() {\n vColor = color;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n varying vec3 vColor;\n out vec4 fragColor;\n\n void main() {\n fragColor = vec4(vColor, 1.0);\n }\n "})}applyId(e,r){let i=e.attributes.position,n=new Float32Array(i.count*3);z1(n,i.count,r),e.setAttribute("color",new ct(n,3))}createOccluderMesh(e,r){let i=new be(e,this.pickingMaterial);return i.layers.set(xs),this.applyId(i.geometry,r),i.userData.occluderId=r,i}reserveOccluderId(){return this.color++,this.color}enable(){this.enabled=!0}disable(){this.enabled=!1}destroy(){var e;this.destroyed=!0,(e=this.pickingTexture)==null||e.dispose(),this.pickingMaterial.dispose(),this.pickingTexture=void 0,this.pixelBuffer=void 0}};a(hd,"Occlusion2DSystem");var Ql=hd;v();var dd=class dd{constructor(e){this.state=e;p(this,"dirty",!0)}update(){var e;if(this.dirty){for(let r of this.state.geometry3DIdsInScene){let i=this.state.geometry3DMap.get(r);if(i instanceof fe&&i.type==="geometry"&&((e=i.components[0])==null?void 0:e.geometry)!=null){let n=i.components[0];n.geometry&&(n.geometry.dispose(),n.geometry=void 0)}}this.dirty=!1}}};a(dd,"GeometryDisposalSystem");var ec=dd;var Tg=new qt;var{DEFAULT_PITCH:ey,DEFAULT_BEARING:ty,DEFAULT_ZOOM_LEVEL:ry,DEFAULT_MIN_ZOOM_LEVEL:Y1,DEFAULT_MAX_ZOOM_LEVEL:Z1}=Dt,U1=ue.radToDeg(.6435011087932844),Be,Re,on,Ss,io,li,sn,no,ot,md,D,At,an,Ce,Ht,Fe,kt,tt,M,Cs,Je,we,wg,Mg,Ig,Or,_s,Ps,Ts,ws,oo,tc,Ms,Is,Es,ln,fd,cn,Ds,Os,mt,ft,yd,rc,ic,so,Ls,gd=class gd extends me{constructor(r,i={}){var _,T,g,x,P,S,C,w,k,A,N,Y,z,X,q;super();L(this,ot);p(this,"options");p(this,"container");p(this,"Debug");L(this,Be);L(this,Re);L(this,on);L(this,Ss);L(this,io);L(this,li);L(this,sn);L(this,no);p(this,"rendererDomElement");L(this,D,{geometry3DMap:new Map,geometry2DMap:new Map,geometry2DIdsInScene:new Set,geometry3DIdsInScene:new Set,geometryGroupIdsToLoad:new Set,entityScene:new Ie("__scene"),hoverColor:"#f6efff",text3dHoverColor:"white",insetsPadding:Js,shouldMeasureCanvas:!0,pixelRatio:this.resolutionScale,canvasWidth:0,canvasHeight:0,internalTweenGroup:new Za,externalTweenGroup:new Za,cameraObject:new sc,naturalBearing:0,containerOffset:[0,0],useStandaloneCamera:!1});L(this,At,{});L(this,an,new AbortController);p(this,"camera");L(this,Ce);L(this,Ht);L(this,Fe);L(this,kt);L(this,tt);L(this,M,{});L(this,Cs,window.matchMedia("screen and (min-resolution: 2dppx)"));p(this,"map");L(this,Je,a(()=>{var r;this.aborted||!((r=c(this,M))!=null&&r.renderSystem)||(c(this,M).renderSystem.twoDdirty=!0)},"#invalidate2DEntities"));L(this,we,a(()=>{var r;this.aborted||!((r=c(this,M))!=null&&r.renderSystem)||(c(this,M).renderSystem.threeDdirty=!0)},"#invalidate3DEntities"));L(this,Or,"standalone");L(this,_s,a(()=>{c(this,M).geometryDisposalSystem.dirty=!0,this.render()},"#setGeometryDisposalDirty"));L(this,Ps,a(r=>Math.trunc(r*10)/10,"#round10"));L(this,Ts,a(()=>{_e(this,ot,md).call(this,ho()),c(this,M).twoDDrawSystem.dirty=!0,c(this,oo).call(this,void 0,void 0,!0)},"#handlePixelRatioChange"));L(this,ws,a(()=>{c(this,oo).call(this)},"#handleWindowResizeWithEvent"));L(this,oo,a((r,i,n=!1)=>{let o=r!=null?r:this.rendererDomElement.clientWidth,s=i!=null?i:this.rendererDomElement.clientHeight;if((o===0||s===0)&&!n)return;c(this,D).canvasWidth=o,c(this,D).canvasHeight=s,_e(this,ot,md).call(this,ho()),c(this,ln).call(this),_e(this,ot,Ig).call(this),c(this,M).cameraSystem.resize(this.canvasWidth,this.canvasHeight),c(this,M).cameraSystem.dirty=!0,c(this,M).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),c(this,M).htmlControlsSystem.resize(this.canvasWidth),c(this,M).geometryInFocusSystem.resize(),c(this,M).occlusion2DSystem.resize();let{top:l,left:u}=this.container.getBoundingClientRect();c(this,D).containerOffset=[l,u],this.publish("resize"),this.render()},"#handleWindowResize"));L(this,tc,a(()=>{this.renderSync()},"#renderFull"));L(this,Ms,new H);L(this,Is,a((r,i)=>{let n=this.mode==="standalone"?c(this,Re):this.viewCamera;if(c(this,Re).position.z+this.camera.elevation>i.z){c(this,Ms).copy(i);let o=c(this,Ms).project(n),s=(o.x+1)/2*this.canvasWidth-0/2,l=(-o.y+1)/2*this.canvasHeight-0/2,u=c(this,Ps).call(this,s),h=c(this,Ps).call(this,l);r.x=u,r.y=h}else r.x=-1e3,r.y=-1e3},"#project"));L(this,Es,a((r,i)=>{c(this,tt).setBufferSize(r,i),c(this,Re).aspect=r/i,c(this,Re).updateProjectionMatrix(),c(this,Re).updateMatrixWorld(!0),c(this,io).x=r,c(this,io).y=i},"#setBufferSize"));L(this,ln,a(()=>{var s;let r=c(this,D).canvasWidth=this.rendererDomElement.clientWidth,i=c(this,D).canvasHeight=this.rendererDomElement.clientHeight,n=Math.floor(r*this.resolutionScale),o=Math.floor(i*this.resolutionScale);c(this,Es).call(this,n,o),(s=this.map)==null||s.resize(),c(this,D).shouldMeasureCanvas=!1},"#measureCanvas"));p(this,"getParentContainer",a((r,i=!0)=>{if(!r)return i?c(this,D).entityScene:void 0;if(typeof r=="string"||typeof r=="number"){let n=c(this,D).geometry3DMap.get(r);return n instanceof Ie?n:(te.warn("Parent (".concat(typeof r=="object"?r.id:r,") is not a valid container, adding to scene")),i?c(this,D).entityScene:void 0)}else if(r.type==="group-container"){let n=c(this,D).geometry3DMap.get(r.id);if(n instanceof Ie)return n}return i?c(this,D).entityScene:void 0},"getParentContainer"));p(this,"showCollisionBoxes",a(()=>{c(this,M).collisionSystem.showCollisionBoxes(),this.render()},"showCollisionBoxes"));p(this,"hideCollisionBoxes",a(()=>{c(this,M).collisionSystem.hideCollisionBoxes(),this.render()},"hideCollisionBoxes"));p(this,"projectScreenXYToCoordinate",a((r,i,n=!1)=>{var f,b;let o=this.container.getBoundingClientRect(),s=(r-o.left)/c(this,D).canvasWidth*2-1,l=-((i-o.top)/c(this,D).canvasHeight)*2+1,u=new ae(s,l),h,m;if(n)Tg.setFromCamera(u,c(this,Re)),h=(f=Tg.intersectObject(c(this,li),!1)[0])==null?void 0:f.point;else{let y=c(this,M).interactionSystem.getThreeDIntersectsFromXY(u);h=(b=y==null?void 0:y[0])==null?void 0:b.point,m=c(this,M).interactionSystem.getGroupContainerIntersectsFromXY(u)}if(h)return{coordinate:this.convert3DMapPositionToCoordinate(h),groupContainers:m}},"projectScreenXYToCoordinate"));p(this,"projectCoordinateToScreenXY",a(r=>{let i=this.convertTo3DMapPosition(r[1],r[0],r[2]||0),n=new ae;return c(this,Is).call(this,n,i),{x:n.x,y:n.y}},"projectCoordinateToScreenXY"));p(this,"convert3DMapPositionToCoordinate",a(r=>{var o,s,l,u;let{lat:i,lon:n}=ea((s=(o=c(this,D).center)==null?void 0:o[1])!=null?s:0,(u=(l=c(this,D).center)==null?void 0:l[0])!=null?u:0,r.x,r.y);return[n,i,r.z]},"convert3DMapPositionToCoordinate"));p(this,"setBackgroundColor",a((r,i)=>{c(this,tt).setBackgroundColor(r,i)},"setBackgroundColor"));p(this,"getMetresPerPixel",a(()=>{let r=this.container.clientWidth,i=this.container.clientHeight/2,n=this.projectScreenXYToCoordinate(0,i,!0),o=this.projectScreenXYToCoordinate(r,i,!0);return n==null||o==null?void 0:Jd(n.coordinate,o.coordinate)/r},"getMetresPerPixel"));p(this,"hideOutdoorLayersUnderPoint",a((r,i)=>{!this.map||(i==null?void 0:i.length)===0||(c(this,M).outdoorLayersSystem.hideLayersUnderPoint(r,i),this.render())},"hideOutdoorLayersUnderPoint"));p(this,"hideOutdoorLayersIntersectingPolygons",a((r,i,n)=>{c(this,M).outdoorLayersSystem.hideLayersIntersectingPolygons(r,i,n),this.render()},"hideOutdoorLayersIntersectingPolygons"));L(this,cn,new Fd);L(this,Ds,new bt);L(this,Os,a(r=>{var i;te.error("Render failed: ",r,(i=r.stack)!=null?i:"No stack trace available"),this.publish("render-error",{error:r})},"#onRenderError"));p(this,"render",a(()=>{var r;if(!(((r=c(this,M))==null?void 0:r.renderSystem)==null||this.aborted))if(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay"))this.map.triggerRepaint();else return c(this,M).renderSystem.update().catch(c(this,Os))},"render"));p(this,"renderSync",a(()=>this.aborted?Promise.resolve():c(this,M).renderSystem.update(!0).catch(c(this,Os)),"renderSync"));L(this,mt,po(()=>{this.publish("user-interaction-start",void 0)},0,!0));L(this,ft,po(()=>{this.publish("user-interaction-end",void 0),this.render()},0,!0));p(this,"on",a((r,i)=>{this.aborted||(super.on(r,i),["outdoor-view-loaded","outdoor-style-loaded"].includes(r)&&this.mode==="standalone"&&E.env.NODE_ENV!=="test"&&(te.warn('"'.concat(r,'" was subscribed to but outdoor view is disabled. The event has been triggered immediately. Enable outdoor view or remove the listener.')),this.publish(r)))},"on"));p(this,"off",a((r,i)=>{super.off(r,i)},"off"));p(this,"getCursor",a(()=>c(this,M).interactionSystem.getCursor(),"getCursor"));L(this,rc,a(()=>{if(c(this,D).entityScene.removeEventListener("childadded",c(this,we)),c(this,D).entityScene.removeEventListener("childadded",c(this,Je)),c(this,D).entityScene.removeEventListener("childremoved",c(this,we)),c(this,D).entityScene.removeEventListener("childremoved",c(this,Je)),window.removeEventListener("resize",c(this,ws),!1),c(this,Cs).removeEventListener("change",c(this,Ts)),this.map){for(let r in c(this,At))for(let i of c(this,At)[r])this.map.off(r,i);R(this,At,{})}this._subscribers={}},"#cleanupEventListeners"));L(this,ic,a(()=>{try{c(this,Or)!=="outdoors-overlay"&&(this.map&&this.map.remove(),this.container&&this.rendererDomElement&&this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement)),this.container&&(c(this,kt)&&this.container.contains(c(this,kt))&&this.container.removeChild(c(this,kt)),c(this,Ce)&&this.container.contains(c(this,Ce))&&this.container.removeChild(c(this,Ce)))}catch(r){te.warn("Error during DOM cleanup, some elements may not have been removed:",r)}},"#cleanupDOMElements"));p(this,"destroy",a(()=>{var r;c(this,M)&&(this.aborted||c(this,an).abort(),c(this,rc).call(this),this.remove("__scene"),c(this,M).renderSystem.destroy(),c(this,M).cameraSystem.dispose(),c(this,M).exporterSystem.destroy(),c(this,M).outdoorLayersSystem.destroy(),c(this,M).drawSystem.destroy(),c(this,sn)&&c(this,sn).disconnect(),c(this,tt).destroy(),(r=c(this,Be))==null||r.traverse(i=>{ze(i),"dispose"in i&&typeof i.dispose=="function"&&i.dispose()}),R(this,Be,void 0),c(this,M).htmlControlsSystem.destroy(),c(this,M).collisionSystem.destroy(),c(this,M).interactionSystem.destroy(),c(this,M).domMutationSystem.destroy(),c(this,M).geometryInFocusSystem.destroy(),c(this,M).occlusion2DSystem.destroy(),R(this,M,void 0),c(this,ic).call(this),R(this,tt,void 0))},"destroy"));L(this,so,new H);L(this,Ls,new H);if(R(this,an,new AbortController),c(this,D).useStandaloneCamera=(_=i.useStandaloneCamera)!=null?_:!1,c(this,D).naturalBearing=(T=i.naturalBearing)!=null?T:0,this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),!r.clientWidth||!r.clientHeight)throw new Error("[MappedinJS] Container width and height must be greater than 0");this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),(i.mode==="outdoors-interleaved"||i.mode==="outdoors-overlay")&&i.map&&(R(this,Or,i.mode),this.map=i.map),c(this,D).entityScene.addEventListener("childadded",()=>{c(this,we).call(this),c(this,Je).call(this)}),c(this,D).entityScene.addEventListener("childremoved",()=>{c(this,we).call(this),c(this,Je).call(this)}),c(this,D).geometry3DMap.set(c(this,D).entityScene.userData.entityId,c(this,D).entityScene),i.center&&(c(this,D).center=i.center?[...i.center]:[0,0]),this.options=i,this.container=r,_e(this,ot,wg).call(this),_e(this,ot,Mg).call(this),c(this,M).htmlControlsSystem=new Ya(this.container,{outdoorEnabled:!!this.map}),c(this,Or)!=="outdoors-overlay"&&c(this,M).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),E.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),R(this,tt,new na({antialias:typeof i.antialias=="boolean"?i.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?(g=i.gl)==null?void 0:g.canvas:void 0,onWebGLContextCreationError:i.onWebGLContextCreationError,onWebGLContextLost:i.onWebGLContextLost,onWebGLContextRestored:a(F=>{var J;(J=i.onWebGLContextRestored)==null||J.call(i,F),c(this,Je).call(this),c(this,we).call(this),this.render()},"onWebGLContextRestored"),onWebGLRendererError:i.onWebGLRendererError,backgroundColor:i.backgroundColor||"#ffffff",backgroundAlpha:(x=i.backgroundAlpha)!=null?x:1})),R(this,Be,new Nr),c(this,Or)!=="standalone"&&c(this,Be).add(vp()),c(this,Be).add(c(this,D).entityScene);let n=window.__THREE_DEVTOOLS__;E.env.NODE_ENV==="dev"&&typeof n<"u"&&(n.dispatchEvent(new CustomEvent("observe",{detail:c(this,Be)})),n.dispatchEvent(new CustomEvent("observe",{detail:c(this,tt)}))),R(this,Re,new sc(U1,this.aspect,50,1e5)),c(this,D).cameraObject=c(this,Re),R(this,Ss,new Nd),c(this,Re).renderOrder=999;let o=new fr;o.add(c(this,Re)),R(this,no,new fr),c(this,no).add(o),c(this,Be).add(c(this,no)),c(this,Re).updateProjectionMatrix(),c(this,Re).updateMatrixWorld(!0),this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:a(()=>0,"getNorth"),georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=c(this,tt).domElement(),R(this,io,new ae);let s=new Nt(1e6,1e6),l=new st({color:0,visible:!1});R(this,li,new be(s,l)),c(this,li).name="worldPlane",c(this,Be).add(c(this,li)),(P=i.gl)!=null&&P.canvas||r.appendChild(this.rendererDomElement),window.addEventListener("resize",c(this,ws),!1),c(this,Cs).addEventListener("change",c(this,Ts)),typeof ResizeObserver=="function"&&((S=E.env)==null?void 0:S.NODE_ENV)!=="test"&&(R(this,sn,new ResizeObserver(wd(F=>{c(this,oo).call(this,F[0].contentRect.width,F[0].contentRect.height)},50))),(C=c(this,sn))==null||C.observe(r)),r.classList.add("mappedin-map"),this.rendererDomElement.style.width=(w=globalThis.MappedinDebug)!=null&&w.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=(k=globalThis.MappedinDebug)!=null&&k.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"),c(this,D).canvasWidth=this.rendererDomElement.clientWidth,c(this,D).canvasHeight=this.rendererDomElement.clientHeight,this.rendererDomElement.style.touchAction="manipulation";let u=this.canvasWidth,h=this.canvasHeight;c(this,M).watermarkSystem=new Pl(c(this,Re),c(this,D),i==null?void 0:i.watermark),c(this,M).watermarkSystem.on("texture-loaded",this.render),c(this,D).shouldMeasureCanvas=!0,c(this,D).pixelRatio=this.resolutionScale,c(this,Es).call(this,Math.floor(u*this.resolutionScale),Math.floor(h*this.resolutionScale));let m=new Hs(16777215,.3*Math.PI);m.position.set(-150,-150,350),c(this,Be).add(m);let f=new Yd(16777215,.741*Math.PI);c(this,Be).add(f),c(this,M).cameraSystem=new jn(c(this,Re),c(this,Be),c(this,tt).renderer,c(this,D),{mode:this.mode,canvasHeight:h,canvasWidth:u}),c(this,M).cameraSystem.on("user-dolly-start",c(this,mt)),c(this,M).cameraSystem.on("user-pan-start",c(this,mt)),c(this,M).cameraSystem.on("user-rotate-start",c(this,mt)),c(this,M).cameraSystem.on("user-zoom-start",c(this,mt)),c(this,M).cameraSystem.on("user-tilt-start",c(this,mt)),c(this,M).cameraSystem.on("user-pedestal-start",c(this,mt)),c(this,M).cameraSystem.on("user-dolly-end",c(this,ft)),c(this,M).cameraSystem.on("user-pan-end",c(this,ft)),c(this,M).cameraSystem.on("user-rotate-end",c(this,ft)),c(this,M).cameraSystem.on("user-zoom-end",c(this,ft)),c(this,M).cameraSystem.on("user-tilt-end",c(this,ft)),c(this,M).cameraSystem.on("user-pedestal-end",c(this,ft)),c(this,M).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),c(this,M).geometryInFocusSystem&&(c(this,M).geometryInFocusSystem.cameraDirty=!0),this.render()}),this.onAbort(()=>{c(this,M).cameraSystem.off("user-dolly-start",c(this,mt)),c(this,M).cameraSystem.off("user-pan-start",c(this,mt)),c(this,M).cameraSystem.off("user-rotate-start",c(this,mt)),c(this,M).cameraSystem.off("user-zoom-start",c(this,mt)),c(this,M).cameraSystem.off("user-tilt-start",c(this,mt)),c(this,M).cameraSystem.off("user-pedestal-start",c(this,mt)),c(this,M).cameraSystem.off("user-dolly-end",c(this,ft)),c(this,M).cameraSystem.off("user-pan-end",c(this,ft)),c(this,M).cameraSystem.off("user-rotate-end",c(this,ft)),c(this,M).cameraSystem.off("user-zoom-end",c(this,ft)),c(this,M).cameraSystem.off("user-tilt-end",c(this,ft)),c(this,M).cameraSystem.off("user-pedestal-end",c(this,ft)),c(this,M).renderSystem.off("measure-canvas",c(this,ln)),c(this,M).cameraSystem.off("change",this.render)}),c(this,M).pathSystem=new bs(c(this,D),this.convertTo3DMapPosition,this.getParentContainer,c(this,M).cameraSystem.convertZoomLevelToAltitude),c(this,M).pathSystem.on("animate:path",this.render),this.onAbort(()=>{c(this,M).pathSystem.off("animate:path",this.render)}),c(this,M).panBoundsSystem=new Ml(c(this,D),c(this,M).cameraSystem);let b=a(()=>{let{panBounds:F,fov:J,convertAltitudeToZoomLevel:pe}=c(this,M).cameraSystem;if(c(this,M).panBoundsSystem.autoMinZoomLevel){if(F.radius<=0)return;let se=Math.min(c(this,D).canvasWidth/c(this,D).canvasHeight,1),De=J*Math.PI/180*se,ve=Math.tan(De/2),{radius:ge,center:xe}=c(this,M).cameraSystem.panBounds,rt=ge/ve,Ge=this.getThreeCamera().getWorldPosition(new H),Ue=xe.distanceTo(Ge),je=Math.abs(Ge.z-xe.z),Me=rt*je/Ue,Xe=pe(Me);yp(Xe,this.camera.minZoomLevel)&&this.camera.setMinZoomLevel(Xe)}this.publish("pan-bounds-change",c(this,M).cameraSystem.panBounds)},"handlePanBoundsUpdate");c(this,M).panBoundsSystem.on("update",b),this.onAbort(()=>{c(this,M).panBoundsSystem.off("update",b)}),this.camera=new Qa(this,c(this,M),c(this,D)),this.camera.setZoomLevel((A=i.zoomLevel)!=null?A:ry),this.camera.setBearing((N=i.bearing)!=null?N:ty),this.camera.setPitch((Y=i.pitch)!=null?Y:ey),this.camera.setMaxZoomLevel(Z1),this.camera.setMinZoomLevel(Y1),c(this,M).domVisiblitySystem=new yl(c(this,D),c(this,kt)),c(this,M).domMutationSystem=new _l(c(this,D),c(this,kt)),c(this,M).domMutationSystem.on("dimensions-update",()=>{c(this,M).collisionSystem.collidersDirty=!0,this.render()}),c(this,M).domDrawSystem=new Cl(c(this,D)),c(this,M).collisionSystem=new el(c(this,Ht),c(this,D),((z=i.useCollisionWorker)!=null?z:!0)&&((X=i.useWorkers)!=null?X:!0)),c(this,M).twoDDrawSystem=new vl(c(this,D),c(this,Fe),i.transformImageRequest),c(this,M).twoDDrawSystem.on("img:loaded",this.render),c(this,M).interactionSystem=new Wo(this.rendererDomElement,c(this,D),c(this,Re),c(this,li),c(this,M).cameraSystem.isUserInteracting),c(this,M).interactionSystem.on("doubletap-with-onefinger",F=>{var J;c(this,M).cameraSystem.enableZoom&&this.camera.animateTo({center:(J=this.projectScreenXYToCoordinate(F.clientX,F.clientY))==null?void 0:J.coordinate,zoomLevel:this.camera.zoomLevel+1,duration:mc,easing:"ease-out"})}),c(this,M).interactionSystem.on("singletap-with-twofinger",()=>{c(this,M).cameraSystem.enableZoom&&this.camera.animateTo({zoomLevel:this.camera.zoomLevel-1,duration:mc,easing:"ease-out"})}),c(this,M).interactionSystem.on("hover",this.render),c(this,M).interactionSystem.on("click",F=>{var pe,se,De,ve,ge,xe,rt,Ge,Ue,je,Me,Xe;if(((pe=F.entity2D)==null?void 0:pe.id)==="watermark"&&typeof c(this,M).watermarkSystem.options.onClick=="function"&&c(this,M).watermarkSystem.options.interactive){c(this,M).watermarkSystem.options.onClick();return}let J=F.entity3D?[(se=F.entity3D)==null?void 0:se.id]:[];(ge=(ve=(De=F.entity3D)==null?void 0:De.parentObject3D)==null?void 0:ve.userData)!=null&&ge.entityId&&J.push((Ge=(rt=(xe=F.entity3D)==null?void 0:xe.parentObject3D)==null?void 0:rt.userData)==null?void 0:Ge.entityId),this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(F.position),geometry:J,paths:((Ue=F.entity3D)==null?void 0:Ue.components[0])instanceof ri?[F.entity3D.id]:[],markers:((je=F.entity2D)==null?void 0:je.components[0])instanceof nr?[F.entity2D.id]:[],models:((Me=F.entity3D)==null?void 0:Me.components[0])instanceof Qr?[F.entity3D.id]:[],labels:((Xe=F.entity2D)==null?void 0:Xe.components[0])instanceof rr?[F.entity2D.id]:[],containers:Array.isArray(F.groupContainers)?F.groupContainers.map(Ke=>Ke.userData.entityId):[],pointerEvent:F.pointerEvent})}),c(this,M).interactionSystem.on("hover",F=>{var J,pe,se,De,ve;F.position&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(F.position),geometry:F.entity3D?[(J=F.entity3D)==null?void 0:J.id]:[],paths:((pe=F.entity3D)==null?void 0:pe.components[0])instanceof ri?[F.entity3D.id]:[],markers:((se=F.entity2D)==null?void 0:se.components[0])instanceof nr?[F.entity2D.id]:[],models:((De=F.entity3D)==null?void 0:De.components[0])instanceof Qr?[F.entity3D.id]:[],labels:((ve=F.entity2D)==null?void 0:ve.components[0])instanceof rr?[F.entity2D.id]:[],containers:Array.isArray(F.groupContainers)?F.groupContainers.map(ge=>ge.userData.entityId):[]})}),c(this,M).geometryInFocusSystem=new Bl(c(this,D),c(this,Re));let y=a(F=>{this.publish("geometry-in-focus",F)},"handleGeometryInFocus");c(this,M).geometryInFocusSystem.on("geometry-in-focus",y),this.onAbort(()=>{c(this,M).geometryInFocusSystem.off("geometry-in-focus",y)}),c(this,M).twoDVisiblitySystem=new xl(c(this,D)),c(this,M).drawSystem=new bl(c(this,D),this.convertTo3DMapPosition),c(this,M).drawSystem.on("texture-loaded",this.render),c(this,M).twoDProjectionSystem=new gl(c(this,D),c(this,Is)),c(this,M).exporterSystem=new Vo(c(this,D)),c(this,M).meshOptimizationSystem=new fl(c(this,D),this.convertTo3DMapPosition),c(this,M).meshOptimizationSystem.on("model-loaded",this.render),c(this,M).meshOptimizationSystem.on("geometry-2d-added",this.render),c(this,M).meshOptimizationSystem.on("geometry-group-added",c(this,_s)),this.onAbort(()=>{c(this,M).meshOptimizationSystem.off("model-loaded",this.render),c(this,M).meshOptimizationSystem.off("geometry-2d-added",this.render),c(this,M).meshOptimizationSystem.off("geometry-group-added",c(this,_s))}),c(this,M).meshDetachmentSystem=new Hl(c(this,D)),c(this,M).meshModificationSystem=new Wl(c(this,D)),c(this,M).geometryDisposalSystem=new ec(c(this,D)),c(this,M).customGeometrySystem=new Il(c(this,D),this.convertTo3DMapPosition),c(this,M).outlineInterpolationSystem=new Ol(c(this,D)),c(this,M).renderSystem=new Sl(c(this,tt),c(this,D),this.mode,c(this,Be),c(this,Re),this.viewCamera,c(this,M)),c(this,M).imageSystem=new Nl(c(this,D),this.convertTo3DMapPosition,i.bearing,i.naturalBearing,i.imagePlacementOptions),c(this,M).text3DSystem=new Ra(c(this,D),this.convertTo3DMapPosition,(q=i.useWorkers)!=null?q:!0),c(this,M).text3DSystem.on("render",this.render),c(this,M).imageSystem.on("image-loaded",this.render),c(this,M).renderSystem.on("pre-render",()=>this.publish("pre-render")),c(this,M).renderSystem.on("post-render",()=>this.publish("post-render")),c(this,M).renderSystem.on("measure-canvas",c(this,ln)),this.onAbort(()=>{c(this,M).renderSystem.off("pre-render",()=>this.publish("pre-render")),c(this,M).renderSystem.off("post-render",()=>this.publish("post-render")),c(this,M).renderSystem.off("measure-canvas",c(this,ln))}),c(this,M).outdoorLayersSystem=new Zl(this.map),c(this,M).occlusion2DSystem=new Ql(c(this,D),this.convertTo3DMapPosition,c(this,tt)),i.occlusionEnabled&&c(this,M).occlusion2DSystem.enable(),this.Debug=new Kl(this),i.environment!==!1&&R(this,on,_e(this,ot,yd).call(this)),c(this,tc).call(this)}get viewCamera(){return c(this,Ss)}get canvasWidth(){return c(this,D).canvasWidth}get canvasHeight(){return c(this,D).canvasHeight}get resolutionScale(){var r,i;return(i=(r=this.map)==null?void 0:r._getClampedPixelRatio(this.canvasWidth,this.canvasHeight))!=null?i:ho()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return c(this,Or)}addGroupContainer(r,i,n){if(!c(this,D).geometry3DMap.has(r)&&!c(this,D).geometry2DMap.has(r)){let o=new Ie(r);o.addEventListener("childadded",()=>{c(this,we).call(this),c(this,Je).call(this)}),o.addEventListener("childremoved",()=>{c(this,we).call(this),c(this,Je).call(this)}),(i==null?void 0:i.visible)!==void 0&&(o.visible=i.visible),(i==null?void 0:i.altitude)!==void 0&&o.setAltitude(i.altitude),(i==null?void 0:i.interactive)!==void 0&&et(o,i.interactive,c(this,D)),(i==null?void 0:i.focusable)!==void 0&&Xa(o,i.focusable),(i==null?void 0:i.preloadGeometry)!==void 0&&(o.userData.preloadGeometry=i.preloadGeometry),c(this,D).geometry3DMap.set(r,o);let s=this.getParentContainer(n);s instanceof Ie&&s.addEntity(o),c(this,we).call(this),this.render()}else te.error("Group container with ID '".concat(r,"' already exists. The group container cannot be added."));return{id:r,type:"group-container"}}addCustomGeometry(r,i,n,o,s){if(c(this,D).geometry3DMap.has(r))te.error("Custom geometry with ID '".concat(r,"' already exists. The custom geometry cannot be added."));else{let l=new Jn(i,n),u=new fe(l,new Kt(o));(o==null?void 0:o.interactive)!==void 0&&et(u,o.interactive,c(this,D)),u.id=r,l.mesh.userData={entityId:r,type:"custom-geometry"},c(this,D).geometry3DMap.set(u.id,u);let h=this.getParentContainer(s);s&&h instanceof Ie?h.addEntity(u):c(this,D).entityScene.addEntity(u),c(this,we).call(this),this.render()}return{id:r,type:"custom-geometry"}}addGeometryGroup(r,i,n,o){var s,u;if(!c(this,D).geometry3DMap.has(r)&&!c(this,D).geometry2DMap.has(r)){let h=new xt(r);h.addEventListener("childadded",()=>{c(this,we).call(this),c(this,Je).call(this)}),h.addEventListener("childremoved",()=>{c(this,we).call(this),c(this,Je).call(this)}),h.userData.dirty=!0,c(this,D).geometry3DMap.set(r,h);for(let f of i.features){if(f.geometry==null||!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(f.geometry.type))continue;let b=(f==null?void 0:f.id)||((s=f==null?void 0:f.properties)==null?void 0:s.id)||Jt(),l=n||{color:op},{visible:y,altitude:_}=l,T=_d(l,["visible","altitude"]),g=c(this,M).meshOptimizationSystem.createEntityFromFeature(b,f,O({outline:!0},T));c(this,D).geometry3DMap.set(b,g),h.userData.entities3D.add(b)}h.setVisible((u=n==null?void 0:n.visible)!=null?u:!0),(n==null?void 0:n.altitude)!=null&&h.setAltitude(n.altitude);let m=this.getParentContainer(o);m instanceof Ie&&m.addEntity(h),c(this,we).call(this),this.render()}else te.error("Geometry group with ID '".concat(r,"' already exists. The geometry group cannot be added."));return c(this,M).outlineInterpolationSystem.geometries3DDirty=!0,{id:r,type:"geometry-group"}}addOccluder(r,i){let n=this.getParentContainer(i),o=c(this,M).occlusion2DSystem.reserveOccluderId();return n==null||n.addOccluderFeature(r,o),o}addImage(r,i,n,o){try{Uy(r,i,n)}catch(s){te.error(s);return}if(!c(this,D).geometry3DMap.has(r)&&!c(this,D).geometry2DMap.has(r)){let s=new Rl(i),l=new fe(s,new Kt(n));l.id=r||Jt(),s.mesh.userData={entityId:l.id,type:"path"},c(this,D).geometry3DMap.set(l.id,l);let u=this.getParentContainer(o);u instanceof Ie&&u.addEntity(l),c(this,we).call(this),this.render()}else te.error("Image with ID '".concat(r,"' already exists. The image cannot be added."));return{id:r,type:"image"}}addModelGroup(r,i,n,{parent:o,onComplete:s}={}){var l,u;try{Cy(r,i,n)}catch(h){te.error(h);return}if(!c(this,D).geometry3DMap.has(r)&&!c(this,D).geometry2DMap.has(r)){let h=new xt(r);h.addEventListener("childadded",()=>{c(this,we).call(this),c(this,Je).call(this)}),h.addEventListener("childremoved",()=>{c(this,we).call(this),c(this,Je).call(this)}),c(this,D).geometry3DMap.set(r,h),h.userData.dirty=!0,h.userData.modelURL=n.url;for(let f of i.features){let b=f.id||f.properties.id||Jt(),y=c(this,M).meshOptimizationSystem.createModelFromFeature(b,f,O({},n));(f.properties.interactive!==void 0||n.interactive!=null)&&et(y,(l=f.properties.interactive)!=null?l:n.interactive,c(this,D)),y.parentId=h.userData.entityId,c(this,D).geometry3DMap.set(b,y),h.userData.entities3D.add(b)}let m=this.getParentContainer(o);m instanceof Ie&&m.addEntity(h),c(this,we).call(this),(u=this.render())==null||u.then(s)}else te.error("Model group with ID '".concat(r,"' already exists. The model group cannot be added."));return{id:r,type:"geometry-group"}}addMarker2D(r,i,n,o){var l;let s=n==null?void 0:n.id;try{gf(r,i,n||{})}catch(u){te.error(u);return}if(s===void 0||!c(this,D).geometry2DMap.has(s)&&!c(this,D).geometry3DMap.has(s)){let u=_e(this,ot,fd).call(this,r,new nr(i,n),n==null?void 0:n.occluderId,n==null?void 0:n.verticalOffset);u.id=s||String(u.id),s=u.id,(n==null?void 0:n.interactive)!=null&&n.interactive!=="pointer-events-auto"&&et(u,n==null?void 0:n.interactive,c(this,D));let h=typeof(n==null?void 0:n.attachTo)=="string"||typeof(n==null?void 0:n.attachTo)=="number"?c(this,D).geometry3DMap.get(n.attachTo):void 0;h instanceof fe&&h.attach(u),(l=this.getParentContainer(o))==null||l.addEntity(u),this.render()}else te.error("Marker2D with ID '".concat(s,"' already exists. The marker cannot be added."));return{id:s,type:"marker"}}addText3D(r,i,n,o){if(!c(this,D).geometry3DMap.has(r)&&!c(this,D).geometry2DMap.has(r)){let s=new Vr(j(O({},i),{properties:j(O({},i.properties),{id:r,content:i.properties.text})})),l=new fe(s,new mo(n==null?void 0:n.appearance));l.id=r,s.mesh.userData.entityId=r.toString(),s.mesh.userData.type="text3d",c(this,D).geometry3DMap.set(r,l);let u=this.getParentContainer(o);u instanceof Ie&&u.addEntity(l),c(this,we).call(this),this.render()}else te.error("Text3D with ID '".concat(r,"' already exists. The text3d cannot be added."));return{id:r,type:"text3d"}}labelText3D(r,i,n={}){var h,m;try{if(!i||!r)throw new Error("content and meshGeometryId are required");Cf.parse(n)}catch(f){te.error(f);return}let o=c(this,D).geometry3DMap.get(r);if((o==null?void 0:o.type)!=="geometry"){te.error(".labelText3D failed: target incorrect");return}let s=o==null?void 0:o.components[0];if(!s.feature.properties.textArea)return;if(s.textEntityId){let f=c(this,D).geometry3DMap.get(s.textEntityId);if((f==null?void 0:f.type)!=="text3d"){te.error(".labelText3D failed: existing text3d not found");return}return{id:f.id,type:f.type}}let l=new Vr({type:"Feature",geometry:{coordinates:(h=s.feature.properties.textArea)==null?void 0:h.position,type:"Point"},properties:{textArea:s.feature.properties.textArea,content:i,id:Jt()}});l.polygonEntityId=r;let u=new fe(l,new mo(n==null?void 0:n.appearance));return s.textEntityId=u.id.toString(),l.mesh.userData.entityId=u.id.toString(),l.mesh.userData.type="text3d",c(this,D).geometry3DMap.set(u.id.toString(),u),n.parentId&&((m=this.getParentContainer(n.parentId))==null||m.addEntity(u)),this.render(),{id:u.id,type:"text3d"}}addLabel2D(r,i,n,o){var l;let s=n==null?void 0:n.id;try{Lm(r,i,n||{})}catch(u){te.error(u);return}if(s===void 0||!c(this,D).geometry2DMap.has(s)&&!c(this,D).geometry3DMap.has(s)){let u=_e(this,ot,fd).call(this,r,new rr(i,n||{},c(this,D)),n==null?void 0:n.occluderId,n==null?void 0:n.verticalOffset);u.id=s||String(u.id),s=u.id,(n==null?void 0:n.interactive)!=null&&et(u,n==null?void 0:n.interactive,c(this,D));let h=typeof(n==null?void 0:n.attachTo)=="string"||typeof(n==null?void 0:n.attachTo)=="number"?c(this,D).geometry3DMap.get(n.attachTo):void 0;h instanceof fe&&h.attach(u),(l=this.getParentContainer(o))==null||l.addEntity(u),c(this,Je).call(this),this.render()}else te.error("Label2D with ID '".concat(s,"' already exists. The label cannot be added."));return{id:s,type:"label"}}addPath(r,i={},n){var u,h;try{Ey(r,i||{})}catch(m){te.error(m);return}let o=new ri(r,Bu(i)),s=new fe(o,new Kt({color:(u=i==null?void 0:i.color)!=null?u:"#ff834c",altitude:(h=i==null?void 0:i.verticalOffset)!=null?h:.1}));s.id=(i==null?void 0:i.id)||Jt(),o.mesh.userData={entityId:s.id,type:"path"},c(this,D).geometry3DMap.set(s.id,s),(i==null?void 0:i.interactive)!=null&&et(s,i==null?void 0:i.interactive,c(this,D));let l=this.getParentContainer(n);return l instanceof Ie&&l.addEntity(s),c(this,we).call(this),this.render(),{id:s.id,type:"path"}}updateWatermark(r){c(this,M).watermarkSystem.options=r,c(this,M).watermarkSystem.dirty=!0,c(this,M).collisionSystem.collidersDirty=!0,this.render()}remove(r){var n,o;let i;if(typeof r=="string"||typeof r=="number"?(i=c(this,D).geometry2DMap.get(r),i==null&&(i=c(this,D).geometry3DMap.get(r))):typeof r.id=="string"||typeof r.id=="number"?(i=c(this,D).geometry2DMap.get(r.id),i==null&&(i=c(this,D).geometry3DMap.get(r.id))):i=r,i!=null){if(i.type==="custom-geometry")c(this,D).geometry3DMap.delete(i.id),i.object3d&&ze(i.object3d);else if(i.type==="group-container"){c(this,D).geometry3DMap.delete(i.userData.entityId);for(let l of i.childrenIds.values())this.remove(l),i.userData.entities2D.delete(l);let s=i.components[1];s&&s.focusMesh&&ze(s.focusMesh),ze(i)}else if(i.type==="geometry-group"){c(this,D).geometry3DMap.delete(i.userData.entityId);for(let s of i.userData.entities3D.values())this.remove(s),i.userData.entities3D.delete(s);ze(i)}else if(i.type==="geometry"||i.type==="model"||i.type==="path"){let s=i.components[0],l=i.components[4];if(i.entities2D.size>0){for(let h of i.entities2D.values())this.remove(h);i.removeAllEntities()}let u=(o=(n=i.parentObject3D)==null?void 0:n.userData.entityId)!=null?o:i.parentId;if(u){let h=c(this,D).geometry3DMap.get(u);h instanceof xt&&h.userData.entities3D.delete(i.id)}if(i.object3d&&ze(i.object3d),i.type==="geometry"){let h=i.components[3];h&&(h.enabled=!1,h.dirty=!0)}l&&"focusMesh"in l&&l.focusMesh!=null&&ze(l.focusMesh),"textMesh"in s&&s.textMesh!=null&&this.remove(s.textMesh.userData.entityId),c(this,D).geometry3DMap.delete(i.id)}else if(i.type==="marker"||i.type==="label"){let s=i.attachedTo;if(s){let l=c(this,D).geometry3DMap.get(s);l instanceof fe&&l.detach(i)}i.object3d&&ze(i.object3d),i.type==="label"&&delete c(this,M).twoDDrawSystem.textCache[i.id],c(this,D).geometry2DMap.delete(i.id)}else if(i.type==="image")i.object3d&&ze(i.object3d),c(this,D).geometry3DMap.delete(i.id);else if(i.type==="text3d"){ze(i.object3d);let{batchedText:s,textMesh:l,polygonEntityId:u}=i.components[0];if(l&&(s&&s.removeText(l),ze(l)),u){c(this,M).text3DSystem.remove(u);let h=c(this,D).geometry3DMap.get(u);(h==null?void 0:h.type)==="geometry"&&(h.components[0].textMesh=void 0,h.components[0].textEntityId=void 0)}c(this,D).geometry3DMap.delete(i.id)}c(this,we).call(this),c(this,Je).call(this),this.render()}}getScene(){return this.getState("__scene")}getThreeScene(){return c(this,Be)}getThreeCamera(){return c(this,Re)}async setEnvironment(r){if(c(this,Be))if(r==="basic"){c(this,on)||R(this,on,_e(this,ot,yd).call(this));let i=await c(this,on);c(this,Be).environment=i}else c(this,Be).environment=null}getEnvironment(){var r;return(r=c(this,Be))!=null&&r.environment?"basic":!1}getCurrentSceneGLTF(r){return c(this,M).exporterSystem.getCurrentSceneGLTF(r)}getBoundingArea(r){(c(this,M).renderSystem.threeDdirty||c(this,M).renderSystem.twoDdirty)&&this.renderSync();let i=new it;if(r==null)i.setFromObject(c(this,D).entityScene);else{let n=fn(c(this,D),r);if((n==null?void 0:n.type)==="geometry"&&(n==null?void 0:n.object3d)!=null){let o=n.components[0],s=o instanceof Ne?o.geometry:void 0;o.mesh instanceof Zs&&s?(s.computeBoundingBox(),s.boundingBox&&i.union(s.boundingBox)):i.setFromObject(n.object3d)}else((n==null?void 0:n.type)==="geometry-group"||(n==null?void 0:n.type)==="group-container")&&(n==null?void 0:n.userData.entityId)!=null&&i.setFromObject(n)}if(qs(i))return ap(i).map(this.convert3DMapPositionToCoordinate)}hasState(r){return fn(c(this,D),r)!=null}getState(r){var n,o,s,l,u,h,m,f,b,y,_,T,g,x,P;if(r==null)return{type:"map-view",hoverColor:c(this,D).hoverColor,text3dHoverColor:c(this,D).text3dHoverColor};let i=fn(c(this,D),r);if((i==null?void 0:i.type)==="custom-geometry"){let S=i.components[0],C=i.components[1];return{id:i.id,type:"custom-geometry",visible:C.visible,altitude:C.altitude,parent:(n=i.parentObject3D)==null?void 0:n.userData.entityId,position:this.convert3DMapPositionToCoordinate(S.position)}}else if((i==null?void 0:i.type)==="geometry-group"){let S=Array.from(i.userData.entities3D.values()),C=S==null?void 0:S[0],w=C?this.getState(C):{};return{id:i.userData.entityId,type:"geometry-group",visible:i.visible,altitude:i.altitude,color:w==null?void 0:w.color,initialColor:w==null?void 0:w.initialColor,side:(o=w==null?void 0:w.side)!=null?o:"double",opacity:w==null?void 0:w.opacity,height:w==null?void 0:w.height,texture:w==null?void 0:w.texture,topColor:w==null?void 0:w.topColor,topTexture:w==null?void 0:w.topTexture,interactive:w==null?void 0:w.interactive,children:S,bevel:w==null?void 0:w.bevel}}else{if((i==null?void 0:i.type)==="group-container")return{id:i.userData.entityId,type:"group-container",visible:i.visible,altitude:(s=i.getWorldPosition(j1).z)!=null?s:0,opacity:i.opacity,interactive:!!i.components[0],children:Array.from(i.childrenIds.values()).map(S=>this.getState(S)).filter(Boolean)};if((i==null?void 0:i.type)==="label"){let S=i.components[0],C=i.object3d.parent,w=C==null?void 0:C.userData.entityId;return{id:i.id,type:"label",text:S.text||"",parent:{id:w,type:C==null?void 0:C.type},position:this.convert3DMapPositionToCoordinate(i.position),enabled:S.enabled,visible:S.visible,initialRank:_o(S.initialRank),options:{rank:_o(S.rank),appearance:S.appearance,interactive:i.components[1]!=null,verticalOffset:i.verticalOffset,attachTo:i.attachedTo}}}else if((i==null?void 0:i.type)==="marker"){let S=i.components[0],C=i.object3d.parent,w=C==null?void 0:C.userData.entityId;return{id:i.id,type:"marker",enabled:S.enabled,visible:S.visible,placement:S.options.placement,dynamicResize:S.options.dynamicResize,parent:{id:w,type:C==null?void 0:C.type},position:this.convert3DMapPositionToCoordinate(i.position),element:S.containerEl,initialRank:_o(S.initialRank),contentHTML:S.contentHtml,options:{rank:_o(S.rank),interactive:i.components[1]!=null||!1,verticalOffset:i.verticalOffset,attachTo:i.attachedTo,lowPriorityPin:S.options.lowPriorityPin}}}else if((i==null?void 0:i.type)==="geometry"){let{color:S,hoverColor:C,initialColor:w,initialTopColor:k,topColor:A,altitude:N}=i.components[1],Y=i.components[0],z=i.components[1],X=i.components[1],q=i.components[2],F=i.components[3],J=i.parentObject3D;return{id:i.id,type:"geometry",opacity:X.opacity,initialColor:w,color:S,focusable:z!=null&&z.focusMesh!=null,initialTopColor:k,topColor:A,side:X.side,hoverColor:C,hovered:!!(q!=null&&q.hover),height:X.height,visible:X.visible,outline:F==null?void 0:F.enabled,showImage:X.showImage,texture:X.texture,topTexture:X.topTexture,flipImageToFaceCamera:X.flipImageToFaceCamera,parent:{id:J==null?void 0:J.userData.entityId,type:J==null?void 0:J.type},altitude:N,bevel:X.bevel,position:this.convert3DMapPositionToCoordinate(Y.position),interactive:i.components[2]!=null}}else if((i==null?void 0:i.type)==="model"){let S=i.components[0],C=i.components[1],w=i.components[2];return{id:i.id,type:"model",position:S.mesh?this.convert3DMapPositionToCoordinate((l=S.mesh)==null?void 0:l.getWorldPosition(new H)):this.convert3DMapPositionToCoordinate(S.position),interactive:w!=null,material:C.material,parent:(u=i.parentObject3D)!=null&&u.parent?{id:i.parentObject3D.parent.userData.entityId,type:i.parentObject3D.parent.type}:void 0,visible:C.visible,verticalOffset:C.verticalOffset,color:C.color,opacity:C.opacity,rotation:(h=C.rotation)!=null?h:bn,scale:(m=C.scale)!=null?m:vn}}else if((i==null?void 0:i.type)==="path"){let S=i.components[0],C=i.components[2],w=i.components[1];return{id:i.id,type:"path",position:this.convert3DMapPositionToCoordinate(S.position),visible:w.visible,interactive:C!=null,completeFraction:S.completeFraction,color:w.color,accentColor:S.accentColor,width:S.width,animateArrowsOnPath:S.animateArrowsOnPath,displayArrowsOnPath:S.displayArrowsOnPath,verticalOffset:w.altitude}}else if((i==null?void 0:i.type)==="image"){let S=i.components[0];return{id:i.id,type:"image",position:this.convert3DMapPositionToCoordinate(S.position),visible:i.components[1].visible,verticalOffset:(f=S.feature.properties.verticalOffset)!=null?f:0,opacity:i.components[1].opacity,flipImageToFaceCamera:i.components[1].flipImageToFaceCamera,width:(b=S.feature.properties.width)!=null?b:0,height:(y=S.feature.properties.height)!=null?y:0,rotation:(_=S.feature.properties.rotation)!=null?_:0}}else if((i==null?void 0:i.type)==="text3d"&&i.components[0]instanceof Vr&&"textArea"in i.components[0].feature.properties){zf(i);let S=i.components[0],C=i.components[1],{textMesh:w}=S,k=(T=S.mesh)==null?void 0:T.parent;k instanceof Ie&&((g=k.children.find(Y=>Y.type==="batchedtext"))==null||g.getWorldPosition(c(this,Ls))),c(this,so).set(0,0,0);let A=w?w.getWorldPosition(c(this,so)):c(this,so);return Object.assign({},gn,C.getState(),{id:i.id,type:"text3d",position:this.convert3DMapPositionToCoordinate(A.add(c(this,Ls))),visible:(x=S.visible)!=null?x:!1,content:(P=S.feature.properties.content)!=null?P:""})}else return}}setState(r,i){var o,s;if(typeof r=="object"&&i==null){"hoverColor"in r&&(Qd(r.hoverColor)?c(this,D).hoverColor=(o=r.hoverColor)!=null?o:c(this,D).hoverColor:te.warn('Failed to update global hover color. Invalid color "'.concat(r.hoverColor,'".'))),"text3dHoverColor"in r&&(c(this,D).text3dHoverColor=(s=r.text3dHoverColor)!=null?s:c(this,D).text3dHoverColor);return}let n=fn(c(this,D),r);if(n!=null){if(n.type==="custom-geometry"){let l=c(this,D).geometry3DMap.get(n.id);if(l instanceof fe&&l.components[0]instanceof Jn){let u=i;sr(n,c(this,D),u.visible),Xn(n,u.altitude),Au(n,u.position,this.convertTo3DMapPosition),ku(n,this.getParentContainer(u.parent,!1)),et(n,u.interactive,c(this,D))&&c(this,we).call(this)}}else if(n.type==="path"){let l=i;et(n,l.interactive,c(this,D))&&c(this,we).call(this),Xn(n,l.verticalOffset),Xf(n,c(this,D),l)}else if(n.type==="model"){let l=i;et(n,l.interactive,c(this,D))&&c(this,we).call(this),sr(n,c(this,D),l.visible),Uf(n,l)}else if(n.type==="group-container"){let l=i;sr(n,c(this,D),l.visible)&&(c(this,M).pathSystem.verticalDistanceDirty=!0,c(this,M).geometryInFocusSystem.focusablesDirty=!0),Xn(n,l.altitude)&&(c(this,M).pathSystem.verticalDistanceDirty=!0),et(n,l.interactive,c(this,D))&&c(this,we).call(this),Xo(n,c(this,D),l.opacity)&&(c(this,M).outlineInterpolationSystem.outlineOpacitiesDirty=!0),l.preloadGeometry&&n.userData.preloadGeometry!==!0&&(n.userData.preloadGeometry=!0,c(this,M).outlineInterpolationSystem.geometries3DDirty=!0),Xa(n,l.focusable)&&(c(this,M).geometryInFocusSystem.focusablesDirty=!0)}else if(n.type==="geometry-group"){let l=i;sr(n,c(this,D),l.visible),Mf(n,c(this,D),l),Ga(n,c(this,D),l.outline),l.height!=null&&Ba(n,c(this,D),l.height),Xn(n,l.altitude),Bf(n,c(this,D),l),If(n,c(this,D),l.shading),Xo(n,c(this,D),l.opacity)&&(c(this,M).outlineInterpolationSystem.outlineOpacitiesDirty=!0),et(n,l.interactive,c(this,D))&&(c(this,we).call(this),c(this,Je).call(this)),za(n,c(this,D),l.side)}else if(n.type==="geometry"){if(n.components[0]instanceof Ne){let l=i;sr(n,c(this,D),l.visible),Ga(n,c(this,D),l.outline),Ef(n,l),Xa(n,l.focusable)&&(c(this,M).geometryInFocusSystem.focusablesDirty=!0),Gf(n,l.renderOrder)&&(c(this,M).meshDetachmentSystem.dirty=!0),Ff(n,l.opacity)&&(c(this,M).meshDetachmentSystem.dirty=!0,c(this,M).interactionSystem.dirty3D=!0,c(this,M).outlineInterpolationSystem.outlineOpacitiesDirty=!0),Ru(n,l.flipImageToFaceCamera),Xn(n,l.altitude),l.height!=null&&Ba(n,c(this,D),l.height),Nu(n,l)&&(c(this,M).meshDetachmentSystem.dirty=!0),Fa(n,l),kf(n,l.hoverColor),et(n,l.interactive,c(this,D)),Rf(n,l.hovered),za(n,c(this,D),l.side)}c(this,we).call(this)}else if(n.type==="label"||n.type==="marker"){let l=i;Af(n,i,c(this,D)),Of(n,i,c(this,D))&&(c(this,Je).call(this),c(this,M).domMutationSystem.dirty=!0),Au(n,l.position,this.convertTo3DMapPosition),ku(n,this.getParentContainer(l.parent,!1))&&(c(this,Je).call(this),c(this,M).panBoundsSystem.dirty=!0),Df(n,l.enabled),sr(n,c(this,D),l.visible)}else if(n.type==="image"){let l=i;sr(n,c(this,D),l.visible),Xo(n,c(this,D),l.opacity),Ru(n,l.flipImageToFaceCamera)}else if(n.type==="text3d"){let l=i;Zf(n,c(this,D),l)}this.render()}}convertTo3DMapPosition(r,i,n=0,o){var u,h,m,f,b;if(Array.isArray(r))return this.convertTo3DMapPosition(r[1],r[0],(u=r[2])!=null?u:n,typeof i=="function"?i:void 0);if(typeof i!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:s,y:l}=ta((m=(h=c(this,D).center)==null?void 0:h[1])!=null?m:0,(b=(f=c(this,D).center)==null?void 0:f[0])!=null?b:0,r,i);return o?(o.set(s,l,n),o):new H(s,l,n)}get backgroundColor(){return typeof c(this,tt).backgroundColor=="string"?c(this,tt).backgroundColor:"#".concat(c(this,tt).backgroundColor.getHexString())}get backgroundAlpha(){return c(this,tt).backgroundAlpha}getThreeRenderer(){return c(this,tt)}getCenter(r){let i=Array.isArray(r)?r:this.getBoundingArea(r);return i?fp(i):void 0}isInView(r){let i=fn(c(this,D),r);if(c(this,Ds).identity().multiply(c(this,Re).projectionMatrix).multiply(c(this,Re).matrixWorldInverse),c(this,cn).setFromProjectionMatrix(c(this,Ds)),i instanceof gi)return c(this,cn).containsPoint(i.position);if(i instanceof fe){let n=i==null?void 0:i.components[0];if(n instanceof Jn||n instanceof Qr)return c(this,cn).containsPoint(this.convertTo3DMapPosition(n.feature.geometry.coordinates));if(n instanceof Ne){let o=new it(this.convertTo3DMapPosition(n.featureBbox[1],n.featureBbox[0],0),this.convertTo3DMapPosition(n.featureBbox[3],n.featureBbox[2],0));return c(this,cn).intersectsBox(o)}}return!1}onMapLibreEvent(r,i){if(!this.map){te.warn('Tried to add event listener "'.concat(r,'" but MapLibre map is not initialized.'));return}this.map.on(r,i),c(this,At)[r]=c(this,At)[r]||[],c(this,At)[r].push(i)}offMapLibreEvent(r,i){!this.map||!Array.isArray(c(this,At)[r])||(this.map.off(r,i),c(this,At)[r]=c(this,At)[r].filter(n=>n!==i))}get aborted(){return c(this,an).signal.aborted}onAbort(r){c(this,an).signal.addEventListener("abort",r,{once:!0})}getSystems(){return c(this,M)}getInternalState(){return c(this,D)}getInternalTweenGroup(){return c(this,D).internalTweenGroup}getExternalTweenGroup(){return c(this,D).externalTweenGroup}computeMinZOffsetBetweenContainers(r,i,n){if(!r||!i)return-1;pc(r,"group-container"),pc(i,"group-container");let o=ra(r,this.getThreeCamera()),s=i.clone(),l=ra(s,this.getThreeCamera());if(!qs(o)||!qs(l))return-1;let u=0,h;n&&this.container.querySelectorAll(".debug-box").forEach(f=>f.remove());do{if(u>1e4)return-1;if(u+=20,s.position.z=u,s.updateMatrixWorld(),l.makeEmpty(),ra(s,c(this,Re),l),h=o.intersectsBox(l),n){let m=vc(o,"blue",this.container),f=vc(l,h?"red":"green",this.container);m.classList.add("debug-box"),f.classList.add("debug-box")}}while(h);return u}};Be=new WeakMap,Re=new WeakMap,on=new WeakMap,Ss=new WeakMap,io=new WeakMap,li=new WeakMap,sn=new WeakMap,no=new WeakMap,ot=new WeakSet,md=a(function(r){var i;c(this,Or)!=="outdoors-overlay"&&((i=this.map)==null||i.setPixelRatio(r)),c(this,D).pixelRatio=this.resolutionScale},"#setResolutionScale"),D=new WeakMap,At=new WeakMap,an=new WeakMap,Ce=new WeakMap,Ht=new WeakMap,Fe=new WeakMap,kt=new WeakMap,tt=new WeakMap,M=new WeakMap,Cs=new WeakMap,Je=new WeakMap,we=new WeakMap,wg=a(function(){R(this,Ce,document.createElement("div")),c(this,Ce).classList.add("mappedin__smart-collision-engine__container"),R(this,Ht,document.createElement("canvas")),c(this,Ht).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(c(this,Ce)),R(this,Fe,document.createElement("canvas")),c(this,Fe).classList.add("mappedin__smart-collision-engine__container"),c(this,Fe).width=c(this,Ce).clientWidth*this.resolutionScale,c(this,Fe).height=c(this,Ce).clientHeight*this.resolutionScale,c(this,Fe).style.width=c(this,Ce).clientWidth+"px",c(this,Fe).style.height=c(this,Ce).clientHeight+"px",c(this,Ce).appendChild(c(this,Ht)),c(this,Ce).appendChild(c(this,Fe)),c(this,Ht).width=c(this,Ce).clientWidth,c(this,Ht).height=c(this,Ce).clientHeight,c(this,Fe).width=c(this,Ce).clientWidth*this.resolutionScale,c(this,Fe).height=c(this,Ce).clientHeight*this.resolutionScale,c(this,Fe).style.width=c(this,Ce).clientWidth+"px",c(this,Fe).style.height=c(this,Ce).clientHeight+"px"},"#renderEntity2DContainer"),Mg=a(function(){R(this,kt,document.createElement("div")),c(this,kt).classList.add("mappedin-2d-entities"),Object.assign(c(this,kt).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","transform-style":"preserve-3d"}),this.container.appendChild(c(this,kt))},"#renderEntityDOMContainer"),Ig=a(function(){c(this,Fe).width=c(this,Ce).clientWidth*this.resolutionScale,c(this,Fe).height=c(this,Ce).clientHeight*this.resolutionScale,c(this,Fe).style.width=c(this,Ce).clientWidth+"px",c(this,Fe).style.height=c(this,Ce).clientHeight+"px",c(this,Ht).width=c(this,Ce).clientWidth,c(this,Ht).height=c(this,Ce).clientHeight,c(this,Fe).width=c(this,Ce).clientWidth*this.resolutionScale,c(this,Fe).height=c(this,Ce).clientHeight*this.resolutionScale,c(this,Fe).style.width=c(this,Ce).clientWidth+"px",c(this,Fe).style.height=c(this,Ce).clientHeight+"px",c(this,M).collisionSystem.collidersDirty=!0},"#resizeCollisionCanvas"),Or=new WeakMap,_s=new WeakMap,Ps=new WeakMap,Ts=new WeakMap,ws=new WeakMap,oo=new WeakMap,tc=new WeakMap,Ms=new WeakMap,Is=new WeakMap,Es=new WeakMap,ln=new WeakMap,fd=a(function(r,i,n,o){let s=new gi(i,this.convertTo3DMapPosition(r[1],r[0],r[2]||0),o);return s.occluderId=n!=null?n:c(this,M).occlusion2DSystem.backgroundId,c(this,D).geometry2DMap.set(s.id,s),s},"#createEntity2D"),cn=new WeakMap,Ds=new WeakMap,Os=new WeakMap,mt=new WeakMap,ft=new WeakMap,yd=a(async function(){return ti.load(bp).then(r=>{var i;return c(this,Be)&&((i=c(this,Be).environment)==null||i.dispose(),r.mapping=Md,c(this,Be).environment=r,this.render()),r})},"#loadEnvMap"),rc=new WeakMap,ic=new WeakMap,so=new WeakMap,Ls=new WeakMap,a(gd,"Core");var pd=gd,j1=new H,oh=pd;var vd=class vd extends me{constructor(r){super();p(this,"gl");p(this,"el",document.createElement("div"));p(this,"core");p(this,"origin");p(this,"map");p(this,"layer");p(this,"handleStyleChange",a(()=>{!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()))},"handleStyleChange"));p(this,"handleMove",a(()=>{if(!this.map)return;let[r,i]=this.map.getCenter().toArray();this.core.getSystems().cameraSystem.setCenter(r,i),this.core.getSystems().cameraSystem.setZoomLevel(this.map.getZoom()),this.core.getSystems().cameraSystem.setRotation(ue.degToRad(this.map.getBearing())),this.core.getSystems().cameraSystem.setTilt(ue.degToRad(this.map.getPitch()))},"handleMove"));p(this,"handleError",a(r=>{te.warn(r)},"handleError"));this.origin=r}onAdd(r){this.origin=this.origin||r.getCenter().toArray(),this.gl=r.painter.context.gl,this.core=new oh(r._container,{center:this.origin,zoomLevel:r.getZoom(),pitch:r.getPitch(),bearing:r.getBearing(),gl:this.gl,map:r,mode:"outdoors-overlay"}),this.map=r,this.core.camera.setMinZoomLevel(r.getMinZoom()),this.core.camera.setMaxZoomLevel(r.getMaxZoom()),this.core.camera.setMinPitch(r.getMinPitch()),this.core.camera.setMaxPitch(r.getMaxPitch()),this.map.on("error",this.handleError);let i=Td.fromLngLat(this.origin,0);return this.layer=yc(i,this.core.viewCamera,()=>{this.core.renderSync()}),this.map.on("styledata",this.handleStyleChange),this.map.on("move",this.handleMove),this.handleStyleChange(),this.el}onRemove(){this.map&&(this.map.off("styledata",this.handleStyleChange),this.map.off("move",this.handleMove),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}};a(vd,"MapLibreOverlay");var nc=vd;v();var Eg=Vd("",{prefix:"[MapLibreOverlay]"});v();var Dg=a((t,{id:e}={})=>{let r=Array.isArray(t)?t:[t];if(!r.every(o=>typeof o=="string"))return;let i=r.join(""),n=null;if(e){let o=document.getElementById(e);o instanceof HTMLStyleElement&&(n=o)}n==null&&(n=document.createElement("style")),e&&e!==""&&(n.id=e),n.textContent=i,document.head.appendChild(n)},"injectCSS");var Og=".mappedin-marker {\n font-family: 'InterUI-Regular', Helvetica, Arial, sans-serif;\n font-weight: normal;\n top: 0;\n position: absolute;\n font-weight: bold;\n color: black;\n display: flex;\n flex-direction: row;\n will-change: transform, opacity;\n transition: opacity 150ms ease-in-out;\n justify-content: center;\n opacity: 0;\n}\n\n/* Low priority pin strategy styles */\n\n/* Hide child elements as well */\n.mappedin-marker[data-placement='low-priority-pin'] > .mappedin-marker-content {\n visibility: hidden;\n}\n\n/* Create the pin using ::before pseudo-element */\n.mappedin-marker::before {\n content: '';\n display: none;\n border-radius: 50%;\n position: relative;\n /* Default values - will be overridden by inline styles */\n width: var(--mappedin-pin-size, 2px);\n height: var(--mappedin-pin-size, 2px);\n background-color: var(--pin-color, #666);\n}\n\n.mappedin-marker[data-placement='low-priority-pin']::before {\n display: block;\n}\n";var Lg=".mappedin__smart-collision-engine__container {\n position: absolute;\n left: 0px;\n top: 0px;\n bottom: 0px;\n right: 0px;\n pointer-events: none;\n /* Enables colliders to use translate3D */\n transform-style: preserve-3d;\n font-family: 'InterUI-Regular', Helvetica, Arial, sans-serif;\n}\n\n.mappedin__smart-collision-engine-debug__container {\n position: absolute;\n left: 0px;\n top: 0px;\n bottom: 0px;\n right: 0px;\n transition: opacity 300ms ease-in-out;\n pointer-events: none;\n will-change: opacity;\n &.interacting {\n opacity: 0.2;\n }\n}\n";var Ag=".mappedin-map {\n .mappedin-interactive {\n cursor: grab;\n\n &:active {\n cursor: grabbing;\n }\n\n &.mappedin-interaction-hover {\n cursor: pointer;\n }\n }\n}\n";var kg=".mappedin-map {\n .mappedin-control-container {\n position: absolute;\n left: 0px;\n top: 0px;\n bottom: 0px;\n right: 0px;\n pointer-events: none;\n font-family: 'InterUI-Regular', Helvetica, Arial, sans-serif;\n\n .mappedin-ctrl-top-left,\n .mappedin-ctrl-top-right,\n .mappedin-ctrl-bottom-left,\n .mappedin-ctrl-bottom-right {\n position: absolute;\n pointer-events: none;\n }\n\n .mappedin-ctrl-top-left {\n top: 0;\n left: 0;\n }\n\n .mappedin-ctrl-top-right {\n top: 0;\n right: 0;\n }\n\n .mappedin-ctrl-bottom-left {\n bottom: 0;\n left: 0;\n }\n\n .mappedin-ctrl-bottom-right {\n bottom: 0;\n right: 0;\n }\n\n .mappedin-ctrl-attrib {\n display: block;\n position: relative;\n pointer-events: auto;\n font: 9px/11px 'InterUI-Regular', Helvetica, Arial, sans-serif;\n padding: 3px 5px 1px 5px;\n background-color: rgba(255, 255, 255, 0.5);\n margin: 0;\n min-width: 11px;\n min-height: 11px;\n user-select: none;\n\n summary.mappedin-ctrl-attrib-button {\n appearance: none;\n list-style: none;\n }\n\n summary.mappedin-ctrl-attrib-button::-webkit-details-marker {\n display: none;\n }\n\n &.mappedin-compact .mappedin-ctrl-attrib-button,\n &.mappedin-compact-show .mappedin-ctrl-attrib-inner {\n display: inline-block;\n }\n\n &.mappedin-compact {\n background-color: transparent;\n }\n\n &.mappedin-compact-show {\n min-width: 15px;\n min-height: 15px;\n box-sizing: border-box;\n background-color: rgba(255, 255, 255, 0.5);\n }\n }\n\n .mappedin-ctrl-attrib-top-left {\n float: left;\n border-bottom-right-radius: 4px;\n }\n\n .mappedin-ctrl-attrib-top-right {\n float: right;\n border-bottom-left-radius: 4px;\n }\n\n .mappedin-ctrl-attrib-bottom-left {\n float: left;\n border-top-right-radius: 4px;\n }\n\n .mappedin-ctrl-attrib-bottom-right {\n float: right;\n border-top-left-radius: 4px;\n }\n .mappedin-ctrl-attrib-top-left,\n .mappedin-ctrl-attrib-bottom-left {\n padding: 3px 5px 1px 20px;\n }\n\n .mappedin-ctrl-attrib-inner {\n display: inline-block;\n margin-right: 12px;\n }\n\n .mappedin-ctrl-attrib-inner,\n .mappedin-ctrl-attrib-inner a {\n color: rgba(0, 0, 0, 0.75);\n text-decoration: none;\n }\n\n .mappedin-ctrl-attrib-inner-bold,\n .mappedin-ctrl-attrib-inner-bold a {\n font-weight: bold;\n }\n\n .mappedin-ctrl-attrib-inner a:hover {\n color: #017ef1;\n text-decoration: underline;\n cursor: pointer;\n }\n\n .mappedin-ctrl-attrib-button {\n display: none;\n cursor: pointer;\n position: absolute;\n width: 15px;\n height: 15px;\n box-sizing: border-box;\n border-radius: 50%;\n top: 0;\n right: 2px;\n border: 1px;\n }\n .mappedin-ctrl-attrib-top-left .mappedin-ctrl-attrib-button,\n .mappedin-ctrl-attrib-bottom-left .mappedin-ctrl-attrib-button {\n left: 2px;\n }\n }\n}\n";var J1=[Og,Lg,Ag,kg],L9=a((t,e)=>{As.instance!=null&&Eg.warn("Only a single map venue is supported at this time.");let r=new As([t.mapCenter.longitude,t.mapCenter.latitude],t,e);return As.instance=r,r},"createMapLibreOverlay"),K1=3,Q1={debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building","building-top"]},imagePlacementOptions:{mode:"default"},flipImagesToFaceCamera:!0,multiFloorView:{enabled:!1,floorGap:K1}},un,hn,ao,ci,dn,ks=class ks{constructor(e,r,i){L(this,un);L(this,hn);L(this,ao);L(this,ci);L(this,dn);p(this,"on",a((e,r)=>{c(this,un).on(e,r)},"on"));p(this,"off",a((e,r)=>{c(this,un).off(e,r)},"off"));R(this,un,new me),R(this,dn,new nc(e)),R(this,hn,r),R(this,ao,i)}onAdd(e){var n,o,s;let r=c(this,dn).onAdd(e),i=j(O(O({},Q1),(n=c(this,ao))!=null?n:{}),{outdoorView:O({token:c(this,hn).outdoorViewToken},(o=c(this,ao))==null?void 0:o.outdoorView)});return R(this,ci,new $1(c(this,dn).core)),((s=i.injectStyles)==null||s)&&Dg(J1,{id:"mappedin__styles"}),c(this,ci).addMap(c(this,hn),i).then(()=>{c(this,un).publish("loaded",{mapView:c(this,ci),mapData:c(this,hn)})}),r}onRemove(){c(this,ci)&&c(this,ci).clear(),ks.instance=null,c(this,dn).onRemove()}};un=new WeakMap,hn=new WeakMap,ao=new WeakMap,ci=new WeakMap,dn=new WeakMap,a(ks,"MappedinMapLibreOverlay"),p(ks,"instance");var As=ks;export{Q1 as DEFAULT_MAP_OPTIONS,K1 as FLOOR_GAP,As as MappedinMapLibreOverlay,L9 as createMapLibreOverlay};
|
|
1
|
+
import{$ as ta,$a as fc,A as _l,Aa as Kl,B as Il,Ba as Ql,C as N,Ca as na,D as Pr,Da as ec,E as oi,Ea as oa,F as Ll,Fa as aa,G as St,Ga as tc,H as Ol,Ha as rc,I as Mt,Ia as ic,J as Qo,Ja as nc,K as At,Ka as oc,L as le,La as sa,M as xn,Ma as ac,N as ai,Na as kt,O as Sn,Oa as En,P as ea,Pa as sc,Q as Al,Qa as lc,R as Er,Ra as cc,S as kl,Sa as Or,T as si,Ta as la,U as li,Ua as Dn,V as Rl,Va as dc,Wa as ca,X as Mn,Xa as hc,Y as Cn,Ya as uc,Z as Fl,Za as mc,_ as Nl,_a as pc,a as Yo,aa as Gl,ab as gc,b as qo,ba as ra,bb as ct,c as yn,ca as Bl,cb as yc,d as bn,da as zl,db as ve,e as Qt,ea as Dr,eb as bc,f as vl,fa as Zl,fb as vc,g as xl,ga as Ul,gb as ht,h as $o,ha as wn,hb as xc,i as Ot,ia,ib as Ce,j as Sl,ja as jl,jb as Qe,k as W,ka as ci,kb as we,l as Jo,la as _r,m as lt,ma as Tn,n as Ml,na as Ir,o as Cl,oa as Lr,p as wr,pa as Vl,q as wl,qa as Hl,r as Tl,ra as Pn,s as vn,sa as Wl,t as Ko,ta as Xl,u as Tr,ua as Yl,v as J,va as ql,w as Pl,wa as $l,x as El,xa as di,y as Dl,ya as Ve,z as er,za as Jl}from"./chunk-IYKJ3SDZ.js";import{X as Ho,k as Js,w as Ks}from"./chunk-Q3N6EADX.js";import{a as dt}from"./chunk-BI3F3KS7.js";import{$ as te,$a as gl,Aa as ul,B as ln,Ba as Mr,C as cn,Ca as Cr,D as rl,Da as xt,E as il,Ea as pn,Fa as ml,G as nl,Ga as pl,H as q,I as Y,Ia as ni,M as ol,N as al,O as sl,P as dn,Q as B,R as Le,S as ll,Sa as fn,T as Ke,U as xr,V as Kt,W as be,Wa as gn,Xa as fl,Y as je,Z as Ne,_ as hn,aa as Dt,b as an,bb as st,c as ti,ca as _t,d as Wo,da as cl,db as yl,e as vt,ea as Xo,f as Qs,fb as bl,g as ri,ga as It,oa as Lt,p as el,pa as un,qa as mn,r as tl,ra as dl,ta as ii,ya as hl,z as sn,za as Sr}from"./chunk-6UGO67X2.js";import{a as b,b as _}from"./chunk-F44NIQPP.js";import{a as ee,b as Fe,c as l,d as $s,f as ei,g as gh,h as yh,i as h,j as n,k as D,l as L,m as oe}from"./chunk-CU2O7JF6.js";var xd=ei((bs,vs)=>{b();(function(o,r){typeof bs=="object"&&typeof vs<"u"?vs.exports=r():typeof define=="function"&&define.amd?define(r):(o=o||self).RBush=r()})(bs,function(){"use strict";function o(f,y,S,v,x){l(function C(O,A,I,F,G){for(;F>I;){if(F-I>600){var R=F-I+1,Z=A-I+1,k=Math.log(R),U=.5*Math.exp(2*k/3),Q=.5*Math.sqrt(k*U*(R-U)/R)*(Z-R/2<0?-1:1),$=Math.max(I,Math.floor(A-Z*U/R+Q)),ye=Math.min(F,Math.floor(A+(R-Z)*U/R+Q));C(O,A,$,ye,G)}var ce=O[A],ie=I,ne=F;for(r(O,I,A),G(O[F],ce)>0&&r(O,I,F);ie<ne;){for(r(O,ie,ne),ie++,ne--;G(O[ie],ce)<0;)ie++;for(;G(O[ne],ce)>0;)ne--}G(O[I],ce)===0?r(O,I,ne):r(O,++ne,F),ne<=A&&(I=ne+1),A<=ne&&(F=ne-1)}},"t")(f,y,S||0,v||f.length-1,x||e)}l(o,"t");function r(f,y,S){var v=f[y];f[y]=f[S],f[S]=v}l(r,"i");function e(f,y){return f<y?-1:f>y?1:0}l(e,"n");var t=l(function(f){f===void 0&&(f=9),this._maxEntries=Math.max(4,f),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()},"r");function i(f,y,S){if(!S)return y.indexOf(f);for(var v=0;v<y.length;v++)if(S(f,y[v]))return v;return-1}l(i,"e");function a(f,y){s(f,0,f.children.length,y,f)}l(a,"a");function s(f,y,S,v,x){x||(x=P(null)),x.minX=1/0,x.minY=1/0,x.maxX=-1/0,x.maxY=-1/0;for(var C=y;C<S;C++){var O=f.children[C];c(x,f.leaf?v(O):O)}return x}l(s,"h");function c(f,y){return f.minX=Math.min(f.minX,y.minX),f.minY=Math.min(f.minY,y.minY),f.maxX=Math.max(f.maxX,y.maxX),f.maxY=Math.max(f.maxY,y.maxY),f}l(c,"o");function u(f,y){return f.minX-y.minX}l(u,"s");function d(f,y){return f.minY-y.minY}l(d,"l");function m(f){return(f.maxX-f.minX)*(f.maxY-f.minY)}l(m,"f");function g(f){return f.maxX-f.minX+(f.maxY-f.minY)}l(g,"u");function M(f,y){return f.minX<=y.minX&&f.minY<=y.minY&&y.maxX<=f.maxX&&y.maxY<=f.maxY}l(M,"m");function p(f,y){return y.minX<=f.maxX&&y.minY<=f.maxY&&y.maxX>=f.minX&&y.maxY>=f.minY}l(p,"c");function P(f){return{children:f,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}l(P,"p");function E(f,y,S,v,x){for(var C=[y,S];C.length;)if(!((S=C.pop())-(y=C.pop())<=v)){var O=y+Math.ceil((S-y)/v/2)*v;o(f,O,y,S,x),C.push(y,O,O,S)}}return l(E,"d"),t.prototype.all=function(){return this._all(this.data,[])},t.prototype.search=function(f){var y=this.data,S=[];if(!p(f,y))return S;for(var v=this.toBBox,x=[];y;){for(var C=0;C<y.children.length;C++){var O=y.children[C],A=y.leaf?v(O):O;p(f,A)&&(y.leaf?S.push(O):M(f,A)?this._all(O,S):x.push(O))}y=x.pop()}return S},t.prototype.collides=function(f){var y=this.data;if(!p(f,y))return!1;for(var S=[];y;){for(var v=0;v<y.children.length;v++){var x=y.children[v],C=y.leaf?this.toBBox(x):x;if(p(f,C)){if(y.leaf||M(f,C))return!0;S.push(x)}}y=S.pop()}return!1},t.prototype.load=function(f){if(!f||!f.length)return this;if(f.length<this._minEntries){for(var y=0;y<f.length;y++)this.insert(f[y]);return this}var S=this._build(f.slice(),0,f.length-1,0);if(this.data.children.length)if(this.data.height===S.height)this._splitRoot(this.data,S);else{if(this.data.height<S.height){var v=this.data;this.data=S,S=v}this._insert(S,this.data.height-S.height-1,!0)}else this.data=S;return this},t.prototype.insert=function(f){return f&&this._insert(f,this.data.height-1),this},t.prototype.clear=function(){return this.data=P([]),this},t.prototype.remove=function(f,y){if(!f)return this;for(var S,v,x,C=this.data,O=this.toBBox(f),A=[],I=[];C||A.length;){if(C||(C=A.pop(),v=A[A.length-1],S=I.pop(),x=!0),C.leaf){var F=i(f,C.children,y);if(F!==-1)return C.children.splice(F,1),A.push(C),this._condense(A),this}x||C.leaf||!M(C,O)?v?(S++,C=v.children[S],x=!1):C=null:(A.push(C),I.push(S),S=0,v=C,C=C.children[0])}return this},t.prototype.toBBox=function(f){return f},t.prototype.compareMinX=function(f,y){return f.minX-y.minX},t.prototype.compareMinY=function(f,y){return f.minY-y.minY},t.prototype.toJSON=function(){return this.data},t.prototype.fromJSON=function(f){return this.data=f,this},t.prototype._all=function(f,y){for(var S=[];f;)f.leaf?y.push.apply(y,f.children):S.push.apply(S,f.children),f=S.pop();return y},t.prototype._build=function(f,y,S,v){var x,C=S-y+1,O=this._maxEntries;if(C<=O)return a(x=P(f.slice(y,S+1)),this.toBBox),x;v||(v=Math.ceil(Math.log(C)/Math.log(O)),O=Math.ceil(C/Math.pow(O,v-1))),(x=P([])).leaf=!1,x.height=v;var A=Math.ceil(C/O),I=A*Math.ceil(Math.sqrt(O));E(f,y,S,I,this.compareMinX);for(var F=y;F<=S;F+=I){var G=Math.min(F+I-1,S);E(f,F,G,A,this.compareMinY);for(var R=F;R<=G;R+=A){var Z=Math.min(R+A-1,G);x.children.push(this._build(f,R,Z,v-1))}}return a(x,this.toBBox),x},t.prototype._chooseSubtree=function(f,y,S,v){for(;v.push(y),!y.leaf&&v.length-1!==S;){for(var x=1/0,C=1/0,O=void 0,A=0;A<y.children.length;A++){var I=y.children[A],F=m(I),G=(R=f,Z=I,(Math.max(Z.maxX,R.maxX)-Math.min(Z.minX,R.minX))*(Math.max(Z.maxY,R.maxY)-Math.min(Z.minY,R.minY))-F);G<C?(C=G,x=F<x?F:x,O=I):G===C&&F<x&&(x=F,O=I)}y=O||y.children[0]}var R,Z;return y},t.prototype._insert=function(f,y,S){var v=S?f:this.toBBox(f),x=[],C=this._chooseSubtree(v,this.data,y,x);for(C.children.push(f),c(C,v);y>=0&&x[y].children.length>this._maxEntries;)this._split(x,y),y--;this._adjustParentBBoxes(v,x,y)},t.prototype._split=function(f,y){var S=f[y],v=S.children.length,x=this._minEntries;this._chooseSplitAxis(S,x,v);var C=this._chooseSplitIndex(S,x,v),O=P(S.children.splice(C,S.children.length-C));O.height=S.height,O.leaf=S.leaf,a(S,this.toBBox),a(O,this.toBBox),y?f[y-1].children.push(O):this._splitRoot(S,O)},t.prototype._splitRoot=function(f,y){this.data=P([f,y]),this.data.height=f.height+1,this.data.leaf=!1,a(this.data,this.toBBox)},t.prototype._chooseSplitIndex=function(f,y,S){for(var v,x,C,O,A,I,F,G=1/0,R=1/0,Z=y;Z<=S-y;Z++){var k=s(f,0,Z,this.toBBox),U=s(f,Z,S,this.toBBox),Q=(x=k,C=U,O=void 0,A=void 0,I=void 0,F=void 0,O=Math.max(x.minX,C.minX),A=Math.max(x.minY,C.minY),I=Math.min(x.maxX,C.maxX),F=Math.min(x.maxY,C.maxY),Math.max(0,I-O)*Math.max(0,F-A)),$=m(k)+m(U);Q<G?(G=Q,v=Z,R=$<R?$:R):Q===G&&$<R&&(R=$,v=Z)}return v||S-y},t.prototype._chooseSplitAxis=function(f,y,S){var v=f.leaf?this.compareMinX:u,x=f.leaf?this.compareMinY:d;this._allDistMargin(f,y,S,v)<this._allDistMargin(f,y,S,x)&&f.children.sort(v)},t.prototype._allDistMargin=function(f,y,S,v){f.children.sort(v);for(var x=this.toBBox,C=s(f,0,y,x),O=s(f,S-y,S,x),A=g(C)+g(O),I=y;I<S-y;I++){var F=f.children[I];c(C,f.leaf?x(F):F),A+=g(C)}for(var G=S-y-1;G>=y;G--){var R=f.children[G];c(O,f.leaf?x(R):R),A+=g(O)}return A},t.prototype._adjustParentBBoxes=function(f,y,S){for(var v=S;v>=0;v--)c(y[v],f)},t.prototype._condense=function(f){for(var y=f.length-1,S=void 0;y>=0;y--)f[y].children.length===0?y>0?(S=f[y-1].children).splice(S.indexOf(f[y]),1):this.clear():a(f[y],this.toBBox)},t})});var ws=ei(j=>{"use strict";b();Object.defineProperty(j,"__esModule",{value:!0});j.earthRadius=63710088e-1;j.factors={centimeters:j.earthRadius*100,centimetres:j.earthRadius*100,degrees:j.earthRadius/111325,feet:j.earthRadius*3.28084,inches:j.earthRadius*39.37,kilometers:j.earthRadius/1e3,kilometres:j.earthRadius/1e3,meters:j.earthRadius,metres:j.earthRadius,miles:j.earthRadius/1609.344,millimeters:j.earthRadius*1e3,millimetres:j.earthRadius*1e3,nauticalmiles:j.earthRadius/1852,radians:1,yards:j.earthRadius*1.0936};j.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/j.earthRadius,yards:1.0936133};j.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 Vt(o,r,e){e===void 0&&(e={});var t={type:"Feature"};return(e.id===0||e.id)&&(t.id=e.id),e.bbox&&(t.bbox=e.bbox),t.properties=r||{},t.geometry=o,t}l(Vt,"feature");j.feature=Vt;function Wu(o,r,e){switch(e===void 0&&(e={}),o){case"Point":return xs(r).geometry;case"LineString":return Ms(r).geometry;case"Polygon":return Ss(r).geometry;case"MultiPoint":return Md(r).geometry;case"MultiLineString":return Sd(r).geometry;case"MultiPolygon":return Cd(r).geometry;default:throw new Error(o+" is invalid")}}l(Wu,"geometry");j.geometry=Wu;function xs(o,r,e){if(e===void 0&&(e={}),!o)throw new Error("coordinates is required");if(!Array.isArray(o))throw new Error("coordinates must be an Array");if(o.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Co(o[0])||!Co(o[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:o};return Vt(t,r,e)}l(xs,"point");j.point=xs;function Xu(o,r,e){return e===void 0&&(e={}),wo(o.map(function(t){return xs(t,r)}),e)}l(Xu,"points");j.points=Xu;function Ss(o,r,e){e===void 0&&(e={});for(var t=0,i=o;t<i.length;t++){var a=i[t];if(a.length<4)throw new Error("Each LinearRing of a Polygon must have 4 or more Positions.");for(var s=0;s<a[a.length-1].length;s++)if(a[a.length-1][s]!==a[0][s])throw new Error("First and last Position are not equivalent.")}var c={type:"Polygon",coordinates:o};return Vt(c,r,e)}l(Ss,"polygon");j.polygon=Ss;function Yu(o,r,e){return e===void 0&&(e={}),wo(o.map(function(t){return Ss(t,r)}),e)}l(Yu,"polygons");j.polygons=Yu;function Ms(o,r,e){if(e===void 0&&(e={}),o.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:o};return Vt(t,r,e)}l(Ms,"lineString");j.lineString=Ms;function qu(o,r,e){return e===void 0&&(e={}),wo(o.map(function(t){return Ms(t,r)}),e)}l(qu,"lineStrings");j.lineStrings=qu;function wo(o,r){r===void 0&&(r={});var e={type:"FeatureCollection"};return r.id&&(e.id=r.id),r.bbox&&(e.bbox=r.bbox),e.features=o,e}l(wo,"featureCollection");j.featureCollection=wo;function Sd(o,r,e){e===void 0&&(e={});var t={type:"MultiLineString",coordinates:o};return Vt(t,r,e)}l(Sd,"multiLineString");j.multiLineString=Sd;function Md(o,r,e){e===void 0&&(e={});var t={type:"MultiPoint",coordinates:o};return Vt(t,r,e)}l(Md,"multiPoint");j.multiPoint=Md;function Cd(o,r,e){e===void 0&&(e={});var t={type:"MultiPolygon",coordinates:o};return Vt(t,r,e)}l(Cd,"multiPolygon");j.multiPolygon=Cd;function $u(o,r,e){e===void 0&&(e={});var t={type:"GeometryCollection",geometries:o};return Vt(t,r,e)}l($u,"geometryCollection");j.geometryCollection=$u;function Ju(o,r){if(r===void 0&&(r=0),r&&!(r>=0))throw new Error("precision must be a positive number");var e=Math.pow(10,r||0);return Math.round(o*e)/e}l(Ju,"round");j.round=Ju;function wd(o,r){r===void 0&&(r="kilometers");var e=j.factors[r];if(!e)throw new Error(r+" units is invalid");return o*e}l(wd,"radiansToLength");j.radiansToLength=wd;function Cs(o,r){r===void 0&&(r="kilometers");var e=j.factors[r];if(!e)throw new Error(r+" units is invalid");return o/e}l(Cs,"lengthToRadians");j.lengthToRadians=Cs;function Ku(o,r){return Td(Cs(o,r))}l(Ku,"lengthToDegrees");j.lengthToDegrees=Ku;function Qu(o){var r=o%360;return r<0&&(r+=360),r}l(Qu,"bearingToAzimuth");j.bearingToAzimuth=Qu;function Td(o){var r=o%(2*Math.PI);return r*180/Math.PI}l(Td,"radiansToDegrees");j.radiansToDegrees=Td;function em(o){var r=o%360;return r*Math.PI/180}l(em,"degreesToRadians");j.degreesToRadians=em;function tm(o,r,e){if(r===void 0&&(r="kilometers"),e===void 0&&(e="kilometers"),!(o>=0))throw new Error("length must be a positive number");return wd(Cs(o,r),e)}l(tm,"convertLength");j.convertLength=tm;function rm(o,r,e){if(r===void 0&&(r="meters"),e===void 0&&(e="kilometers"),!(o>=0))throw new Error("area must be a positive number");var t=j.areaFactors[r];if(!t)throw new Error("invalid original units");var i=j.areaFactors[e];if(!i)throw new Error("invalid final units");return o/t*i}l(rm,"convertArea");j.convertArea=rm;function Co(o){return!isNaN(o)&&o!==null&&!Array.isArray(o)}l(Co,"isNumber");j.isNumber=Co;function im(o){return!!o&&o.constructor===Object}l(im,"isObject");j.isObject=im;function nm(o){if(!o)throw new Error("bbox is required");if(!Array.isArray(o))throw new Error("bbox must be an Array");if(o.length!==4&&o.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");o.forEach(function(r){if(!Co(r))throw new Error("bbox must only contain numbers")})}l(nm,"validateBBox");j.validateBBox=nm;function om(o){if(!o)throw new Error("id is required");if(["string","number"].indexOf(typeof o)===-1)throw new Error("id must be a number or a string")}l(om,"validateId");j.validateId=om});var Ps=ei(Pe=>{"use strict";b();Object.defineProperty(Pe,"__esModule",{value:!0});var Ae=ws();function ki(o,r,e){if(o!==null)for(var t,i,a,s,c,u,d,m=0,g=0,M,p=o.type,P=p==="FeatureCollection",E=p==="Feature",f=P?o.features.length:1,y=0;y<f;y++){d=P?o.features[y].geometry:E?o.geometry:o,M=d?d.type==="GeometryCollection":!1,c=M?d.geometries.length:1;for(var S=0;S<c;S++){var v=0,x=0;if(s=M?d.geometries[S]:d,s!==null){u=s.coordinates;var C=s.type;switch(m=e&&(C==="Polygon"||C==="MultiPolygon")?1:0,C){case null:break;case"Point":if(r(u,g,y,v,x)===!1)return!1;g++,v++;break;case"LineString":case"MultiPoint":for(t=0;t<u.length;t++){if(r(u[t],g,y,v,x)===!1)return!1;g++,C==="MultiPoint"&&v++}C==="LineString"&&v++;break;case"Polygon":case"MultiLineString":for(t=0;t<u.length;t++){for(i=0;i<u[t].length-m;i++){if(r(u[t][i],g,y,v,x)===!1)return!1;g++}C==="MultiLineString"&&v++,C==="Polygon"&&x++}C==="Polygon"&&v++;break;case"MultiPolygon":for(t=0;t<u.length;t++){for(x=0,i=0;i<u[t].length;i++){for(a=0;a<u[t][i].length-m;a++){if(r(u[t][i][a],g,y,v,x)===!1)return!1;g++}x++}v++}break;case"GeometryCollection":for(t=0;t<s.geometries.length;t++)if(ki(s.geometries[t],r,e)===!1)return!1;break;default:throw new Error("Unknown Geometry Type")}}}}}l(ki,"coordEach");function am(o,r,e,t){var i=e;return ki(o,function(a,s,c,u,d){s===0&&e===void 0?i=a:i=r(i,a,s,c,u,d)},t),i}l(am,"coordReduce");function Pd(o,r){var e;switch(o.type){case"FeatureCollection":for(e=0;e<o.features.length&&r(o.features[e].properties,e)!==!1;e++);break;case"Feature":r(o.properties,0);break}}l(Pd,"propEach");function sm(o,r,e){var t=e;return Pd(o,function(i,a){a===0&&e===void 0?t=i:t=r(t,i,a)}),t}l(sm,"propReduce");function Ed(o,r){if(o.type==="Feature")r(o,0);else if(o.type==="FeatureCollection")for(var e=0;e<o.features.length&&r(o.features[e],e)!==!1;e++);}l(Ed,"featureEach");function lm(o,r,e){var t=e;return Ed(o,function(i,a){a===0&&e===void 0?t=i:t=r(t,i,a)}),t}l(lm,"featureReduce");function cm(o){var r=[];return ki(o,function(e){r.push(e)}),r}l(cm,"coordAll");function Ts(o,r){var e,t,i,a,s,c,u,d,m,g,M=0,p=o.type==="FeatureCollection",P=o.type==="Feature",E=p?o.features.length:1;for(e=0;e<E;e++){for(c=p?o.features[e].geometry:P?o.geometry:o,d=p?o.features[e].properties:P?o.properties:{},m=p?o.features[e].bbox:P?o.bbox:void 0,g=p?o.features[e].id:P?o.id:void 0,u=c?c.type==="GeometryCollection":!1,s=u?c.geometries.length:1,i=0;i<s;i++){if(a=u?c.geometries[i]:c,a===null){if(r(null,M,d,m,g)===!1)return!1;continue}switch(a.type){case"Point":case"LineString":case"MultiPoint":case"Polygon":case"MultiLineString":case"MultiPolygon":{if(r(a,M,d,m,g)===!1)return!1;break}case"GeometryCollection":{for(t=0;t<a.geometries.length;t++)if(r(a.geometries[t],M,d,m,g)===!1)return!1;break}default:throw new Error("Unknown Geometry Type")}}M++}}l(Ts,"geomEach");function dm(o,r,e){var t=e;return Ts(o,function(i,a,s,c,u){a===0&&e===void 0?t=i:t=r(t,i,a,s,c,u)}),t}l(dm,"geomReduce");function To(o,r){Ts(o,function(e,t,i,a,s){var c=e===null?null:e.type;switch(c){case null:case"Point":case"LineString":case"Polygon":return r(Ae.feature(e,i,{bbox:a,id:s}),t,0)===!1?!1:void 0}var u;switch(c){case"MultiPoint":u="Point";break;case"MultiLineString":u="LineString";break;case"MultiPolygon":u="Polygon";break}for(var d=0;d<e.coordinates.length;d++){var m=e.coordinates[d],g={type:u,coordinates:m};if(r(Ae.feature(g,i),t,d)===!1)return!1}})}l(To,"flattenEach");function hm(o,r,e){var t=e;return To(o,function(i,a,s){a===0&&s===0&&e===void 0?t=i:t=r(t,i,a,s)}),t}l(hm,"flattenReduce");function Dd(o,r){To(o,function(e,t,i){var a=0;if(e.geometry){var s=e.geometry.type;if(!(s==="Point"||s==="MultiPoint")){var c,u=0,d=0,m=0;if(ki(e,function(g,M,p,P,E){if(c===void 0||t>u||P>d||E>m){c=g,u=t,d=P,m=E,a=0;return}var f=Ae.lineString([c,g],e.properties);if(r(f,t,i,E,a)===!1)return!1;a++,c=g})===!1)return!1}}})}l(Dd,"segmentEach");function um(o,r,e){var t=e,i=!1;return Dd(o,function(a,s,c,u,d){i===!1&&e===void 0?t=a:t=r(t,a,s,c,u,d),i=!0}),t}l(um,"segmentReduce");function _d(o,r){if(!o)throw new Error("geojson is required");To(o,function(e,t,i){if(e.geometry!==null){var a=e.geometry.type,s=e.geometry.coordinates;switch(a){case"LineString":if(r(e,t,i,0,0)===!1)return!1;break;case"Polygon":for(var c=0;c<s.length;c++)if(r(Ae.lineString(s[c],e.properties),t,i,c)===!1)return!1;break}}})}l(_d,"lineEach");function mm(o,r,e){var t=e;return _d(o,function(i,a,s,c){a===0&&e===void 0?t=i:t=r(t,i,a,s,c)}),t}l(mm,"lineReduce");function pm(o,r){if(r=r||{},!Ae.isObject(r))throw new Error("options is invalid");var e=r.featureIndex||0,t=r.multiFeatureIndex||0,i=r.geometryIndex||0,a=r.segmentIndex||0,s=r.properties,c;switch(o.type){case"FeatureCollection":e<0&&(e=o.features.length+e),s=s||o.features[e].properties,c=o.features[e].geometry;break;case"Feature":s=s||o.properties,c=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=o;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var u=c.coordinates;switch(c.type){case"Point":case"MultiPoint":return null;case"LineString":return a<0&&(a=u.length+a-1),Ae.lineString([u[a],u[a+1]],s,r);case"Polygon":return i<0&&(i=u.length+i),a<0&&(a=u[i].length+a-1),Ae.lineString([u[i][a],u[i][a+1]],s,r);case"MultiLineString":return t<0&&(t=u.length+t),a<0&&(a=u[t].length+a-1),Ae.lineString([u[t][a],u[t][a+1]],s,r);case"MultiPolygon":return t<0&&(t=u.length+t),i<0&&(i=u[t].length+i),a<0&&(a=u[t][i].length-a-1),Ae.lineString([u[t][i][a],u[t][i][a+1]],s,r)}throw new Error("geojson is invalid")}l(pm,"findSegment");function fm(o,r){if(r=r||{},!Ae.isObject(r))throw new Error("options is invalid");var e=r.featureIndex||0,t=r.multiFeatureIndex||0,i=r.geometryIndex||0,a=r.coordIndex||0,s=r.properties,c;switch(o.type){case"FeatureCollection":e<0&&(e=o.features.length+e),s=s||o.features[e].properties,c=o.features[e].geometry;break;case"Feature":s=s||o.properties,c=o.geometry;break;case"Point":case"MultiPoint":return null;case"LineString":case"Polygon":case"MultiLineString":case"MultiPolygon":c=o;break;default:throw new Error("geojson is invalid")}if(c===null)return null;var u=c.coordinates;switch(c.type){case"Point":return Ae.point(u,s,r);case"MultiPoint":return t<0&&(t=u.length+t),Ae.point(u[t],s,r);case"LineString":return a<0&&(a=u.length+a),Ae.point(u[a],s,r);case"Polygon":return i<0&&(i=u.length+i),a<0&&(a=u[i].length+a),Ae.point(u[i][a],s,r);case"MultiLineString":return t<0&&(t=u.length+t),a<0&&(a=u[t].length+a),Ae.point(u[t][a],s,r);case"MultiPolygon":return t<0&&(t=u.length+t),i<0&&(i=u[t].length+i),a<0&&(a=u[t][i].length-a),Ae.point(u[t][i][a],s,r)}throw new Error("geojson is invalid")}l(fm,"findPoint");Pe.coordAll=cm;Pe.coordEach=ki;Pe.coordReduce=am;Pe.featureEach=Ed;Pe.featureReduce=lm;Pe.findPoint=fm;Pe.findSegment=pm;Pe.flattenEach=To;Pe.flattenReduce=hm;Pe.geomEach=Ts;Pe.geomReduce=dm;Pe.lineEach=_d;Pe.lineReduce=mm;Pe.propEach=Pd;Pe.propReduce=sm;Pe.segmentEach=Dd;Pe.segmentReduce=um});var Id=ei(Ds=>{"use strict";b();Object.defineProperty(Ds,"__esModule",{value:!0});var gm=Ps();function Es(o){var r=[1/0,1/0,-1/0,-1/0];return gm.coordEach(o,function(e){r[0]>e[0]&&(r[0]=e[0]),r[1]>e[1]&&(r[1]=e[1]),r[2]<e[0]&&(r[2]=e[0]),r[3]<e[1]&&(r[3]=e[1])}),r}l(Es,"bbox");Es.default=Es;Ds.default=Es});var Rd=ei((X1,_s)=>{b();var ft=xd(),Od=ws(),Ad=Ps(),Vr=Id().default,ym=Ad.featureEach,H1=Ad.coordEach,W1=Od.polygon,Ld=Od.featureCollection;function kd(o){var r=new ft(o);return r.insert=function(e){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Vr(e),ft.prototype.insert.call(this,e)},r.load=function(e){var t=[];return Array.isArray(e)?e.forEach(function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Vr(i),t.push(i)}):ym(e,function(i){if(i.type!=="Feature")throw new Error("invalid features");i.bbox=i.bbox?i.bbox:Vr(i),t.push(i)}),ft.prototype.load.call(this,t)},r.remove=function(e,t){if(e.type!=="Feature")throw new Error("invalid feature");return e.bbox=e.bbox?e.bbox:Vr(e),ft.prototype.remove.call(this,e,t)},r.clear=function(){return ft.prototype.clear.call(this)},r.search=function(e){var t=ft.prototype.search.call(this,this.toBBox(e));return Ld(t)},r.collides=function(e){return ft.prototype.collides.call(this,this.toBBox(e))},r.all=function(){var e=ft.prototype.all.call(this);return Ld(e)},r.toJSON=function(){return ft.prototype.toJSON.call(this)},r.fromJSON=function(e){return ft.prototype.fromJSON.call(this,e)},r.toBBox=function(e){var t;if(e.bbox)t=e.bbox;else if(Array.isArray(e)&&e.length===4)t=e;else if(Array.isArray(e)&&e.length===6)t=[e[0],e[1],e[3],e[4]];else if(e.type==="Feature")t=Vr(e);else if(e.type==="FeatureCollection")t=Vr(e);else throw new Error("invalid geojson");return{minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}},r}l(kd,"geojsonRbush");_s.exports=kd;_s.exports.default=kd});b();import{MapView as jm}from"@mappedin/mappedin-js";b();b();b();(function(){typeof globalThis!="object"&&(Object.defineProperty(Object.prototype,"__magic__",{get:l(function(){return this},"get"),configurable:!0}),__magic__.globalThis=__magic__,delete Object.prototype.__magic__)})();var Sc="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAkGBwgHBgkICAgKCgkLDhcPDg0NDhwUFREXIh4jIyEeICAlKjUtJScyKCAgLj8vMjc5PDw8JC1CRkE6RjU7PDn/2wBDAQoKCg4MDhsPDxs5JiAmOTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTk5OTn/wgARCAIABAADAREAAhEBAxEB/8QAGwABAAMBAQEBAAAAAAAAAAAAAAECAwQFBgf/xAAWAQEBAQAAAAAAAAAAAAAAAAAAAQL/2gAMAwEAAhADEAAAAP3EAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACAIAAAJAFAAAAAAAAAAAAAAAAAAAAAAAAABAgAAEgCgAAAAAAAAAAAAAAAAAAAABERLSM1zM4zXMzjMoUIqCCSSS8XNC9mpoaVomharWTQAAAAAAAAAAAAAAAAEREtIoZrnGZkucUKFStQQSTFixdNDStF0TWrmiWqbJoAAAAAAAAAAAAAIgiWkZy4HNLzHLXKcxzpzmFYmRkUKFSCCSSxcuampsbR0HSdK9R1R1HTZvWll0mlAAAAAAAAAAAIiKLnLjHNLynLXKcycxzmNYmJmUKFSCAWLFy5qamxvHQvSdJ0nVHUdFm1aparWKAjNWSKAAAAARBEtYzlyXnjmOSuM4U4q4jjOM5a5k5zAyMjOqFCCCCSSS5c0jU1NzoOk6pew7TtjuO1e0646jezWr2WSaUAAAAAECIqtZco55eY464zhTirhOI5Dks5jAwMTIzqhUqQASWLFzSNTY3Og6V646zsO2O47V7DrjqNzWy9nlZ1c0LlrLEk0EQQVipRczIyMU5q5F4U8+vOPOrgThOOuU5jAxMjMzKpUggigJiSSxY0XQ1Njc6TqjtO49CX0D0T0Y7l7E6JdzU1NEvViSalBAWIqVKLSMjIxOauM4U86vPPOrz04TjrkOYwMTIzKJQqQQCKmBJJYutzQ1Njc6TrOyO475fRPRPQjuXsToXWPn6kkkEkhCkEAgggqVMjlrzzzDy7PMPPrhOQ5jBMqoVIIIAAIAJAAJJJLFzWN16TsO49CPTPUl9Q9A6o1LFiSSSSQpCwQQCCCpVMjlrzzyzy7PMPPrhOM5kwM6zKlQQAAQASAASCxY0NI3XpOw7j0I9M9SX0z0DqjU+UqpQqVIBFgEyixJYuWLFDkrzE8o8yvOONOasipBAAAAAAAAAAABJJY2OiO1fQPUj1T0pewuVKlCCqQsBIUSSSSWLlyTM5K808pPLrzziTnrEqQQAAAAAAAAAAASSWNjojtX0D1I9VfSOuND4uzMzqhQqVIALEli5c1jUuQc1vnp5pwJzVmQQAAAAAAAAAAAAAASSaHTHevpHoHTFjMyM6zKlSpABJJcsaGkamhU5q88804E5qzIIAAAAAAAAAAAAAAJJNDpjvX0j0Dqix8dVDMolSpAqCYElixc0XU0IMjlTlrIqAAAAAAAAAAAAAAAAAWNTqjqXYGZkZpUoQQRSFIsSXLroaGhBkcqctZFQAAAAAAAAAAAAAAAACxqdUdS7EngWQCAAQASACSSSwKlSCAAAAAAAAAAAAAAAAAACSSxYFSCCAACCQACSSSwKlSCAAAAAAAAAAAAAAAAAACSSxYGIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABIAJAJAJBAAIAIABAAAAAAAAAAAAAAAAAAAABIAJAJAJBAAIAIABAAAAJABAAAAAAAAAJBILEli5Y0LlzQ0Lly5csWLAkgFSChUoUMyhmUMyhQqVKkEEAEAAAAAAAAAkEgsSWLljQuXNDQuXLlyxYsCSAVIKFShQzKGZQzKFCpUqQe+ZmZkUKFCpUEEAAkksWLFzQ0NTU2NzY3Og3NzoNzc2NjU1NS5csSAQVKmZmZGRiYmBgYHOYGBgYGBiZGRkUMypUqQCAASSWLFi5oaGpqbG5sbnQbm50G5ubGxqampcuWJAIIKGZmZGRiYmBgYHOYGBgYGR+jmBzmBzmJiZGZQoQQSSWLmhqbGxudB0nSdJ1HSdR1HSdJ0G5qamhcsWJJJBIIIBUqVKFDIyMDA5jmOU5TlOY5TmOc5znMTEyMyhQggFixc0NTY2NzoOk6TpOo6TqOo6TpOg3NTU0LlixJJIJBAIKkFChQyMjAwOY5jlOU5jnP00yMTnOc5zAwMjMoVIJJLmhqbmx0HQdBubmxqXLkkgAAAAAAAAAAAAAEEFTMzMTEwOc5znMDAyMyhUgkkuaGpsbnQdB0G5ubGpcuSSAAAAAAAAAAAAAAQQVKGZ1gAEEEEFSCACSSxJJJIAAAAAAAAAAAAAAAAAAAAAAABBBBBUggAkkksSSSAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAQCCpBUqQVIKggAkFiSSxYksSSSSAAAAAAAAAAAAAAAAAAQCCpBUqQVIKggAkFiSSxYksSWBIAAKFiQAAAAAAAAACCpUoUMzIyMzMzMyhQoVKkEEAgkEkklixYuXNDQ0NTQ1NC5cuWJAAAAAAAAAAIKlShQzMjIzMzMzKFChUqQQQCCQSSSWLFyxoXNDQ1NDU0LljUkkAAAAAAAAAAggggEEAgAAAAAAAAAAAAAEkgkkkkkAAAAAAAAAAgggggEAgAAAAAEgEAAAAAAEkgkkuAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADyyCCCCCCCCAQASCSQWJJJJLEkkkkkgkkEgkAEgAAEAAgEAggEEEEEEEFSCCCCCCAQASCSQWJJJJLEkkkkkgkkEgEgEgAAEAAgEAggEEEEEH5AQQQQVBBAIAAJBIJJJLEkkkkliSSSSSQSSCQSAAAQAQQCCCCCCCCCpBBBBBUEEEAgAAkEgkkksSSSSSWJJJJJJBJIJBIAABABBAIIIIIIIIKg/LCAQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQAQQCACAAAACQCQSCQSASSASCQCQAAAAAAQCAQAQCAQfPgAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAAAAAAAAAAAAAAAAkAAAAAAAAAAAAAAgAAgAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAH/xAApEAAABQUBAQACAwACAwAAAAABAgQFFQMGERQWEhNAUAAgMGCAkKCw/9oACAEBAAECAP8AwTZznOf3mc5/YZE41xVivFyM6i7C8C8C8zMzMzMyDyDyDyDwV4K7ldSuZV5VgVwqZ/SCca4qxXmcjOouwvAvEzMzMzMzMyDyDyDwV4K7ldSuRVwKgrgf88TDWMrO4VHOo61Hao7ndzvB3k7yZ5M8i8i8zMzMzMyDyDyDyV5K8keSPJHmm8U3em70nam603Mi8qotUDfk5GqZUdfUc6jrUdqjvUeDvB3kzyZ5M8i8i8zMzMzMzMg8g8leSvJHkjyR5pvFN4pu9N2pOtNzIvKqLWA39PX+/saplJlh1tRfVcKrlVdKrrVdqrvVdzu53Y7sZ2M6mdRdRdBdJSUk5SUB0B0B1K6kdSOxHam7Unek70nei7UXWi6UXKk40l9NaRWWuB8/75E41zKjraq+q41nOq6VXas7VXeq71Hc7ud2O7GdRdRdZQXSUlJSUlAdCugOpXUjqR2I7U3em70nek70nai60XSk5UnGkvItIrKoCsC0FwLgXAuBbube3ubm7uiuFcZcZaZYdZUWVl1dwruVdzrulZ0qulVzqOR3EzgZeZcZcK0Vm3t7W1tbW1tgrBYC0q0q4q8jgRxpuVJzoulB0oOlBzoOVBworqa0iwi0i0q4FwLQWAr2trZ2trb3RWiuFcZaZadbUW1l1ZwruVd0rulZ0qulVzqOR3E7gZeZeK4VorNzb29ra2tsFe2CwFpVxVxV5HAjjTcqTnRdKDpQdKDnQcqDhRXU1pFhVm/ISUnKSkrLSsrKyspJyUhvitOtrLq69Q4qHGu41nGqvqLjrDKhUDW+nv1nP+Oc+vYVArFUEVEWUl1FfQcU7imckzinX0VxFoLgXyMlJykrLS0tLS0rKSclI74rjraq6uvUuKhxruNdxqr6i46wysVA1vp79Zz/AI5z6A4VArFUEVkWUl1FfQcU7imcUzinX0VxFoLZKTlJWVlpaXl5eWlpWUB0BzBxkDr669SvUr666stqqz1xqes/j5AxahFFJXRWp1yZemX0F5HCQkpOUlZaWlpeXl5aWB2lQdAcwcZE7hWcFLgpXqF1ZbVVnUDU9Z/HyBi1CV6SuitTrky9MvoLyL5AXEXEXIXIXKSkpKSkpIHIHIHIrkVxK4yJnCsvrra6uqpPVE354GJVpKaCtOtoryuEiZxM5C5C5C5SUnJSclJSQOQORXIrkVxBxM4VV9dbXV1VJ6om/PAxKtFTQVp1tFeRwkRWitFYKvb2tra2draBUCsFgLCrSrQWitOsqqT1RN+jAxKtJTTWFWitMtMtFYKzb29ra2tnaBUCsFZVhVpVoLRWnWVFJ6om/RgYlWkpprAW73v36zn++c+gOFQKv1GoJv04GCp9Rq/T36zn++c+gOFT7fUagm/TgYKn1+3/AKEeMefHjx8/n8vl8vn8/Hjx5xj9bjHnx48fP5/L5fL5/Px48ecY/wAvOPxceQIFIKIJgSAiBAVuK2FaitINAM4MwMwMsJCQkJCQkJCwosws4tAtItQtgtot4oRSCm+Hy8ecfi48gQKQUQTAkBECArcVsK1FaQaAZwZgZgZYSEhISEhISFhRZhZxaBaRahbBbRbxQikFN8BpfMWgWozWLaLcKAUWpq62vr/DX19YEoJARAhBvK2laytRGgjORlIyEYiMJLfJbxLdJbhLbJbRLaJbJbZLbAWxzHMcxzHMcxzHMDbBrYNbJraNbRrbPbh7dPbx7fOwHYjsZ2UzMZoM0maxbRbhQCi1NXW19fX19fW1QSAiBCDeVtK1laiNBGYjKRkIxEYSW+S3iW6S3CW2S2iW0S2S2yW2AtgLY5jmOY5jmOY5gbYNbJrZNbRraPbZ7cPbp7ePb52A7EdjOymZjW4e3D26e3j2+ZgMwmYhYxY4SEhISEBjKxlYiMJGAjAS3iW9TtynblO26dtUrap2zTtmnbNO2SW2S3isRWYGkG0EAItTW1/h8Phr6+rp6AtwtQs5mI9vntw9tHtk9s1LZqWzUto9tnts9uHt09vHt8zAZhMxCxixwkJCQkIDGVjKxEYSMBGAlvEt6nblO3Kdt0rap21TtmnbNO2SWyS2yW8ViKzA1A2ggBFqa2v8Ph8NfW1dPRFuFqMzGYjW+e3D20e2T2zUtk9tHto1tCzHYj2+e3T24e3D24a3DW4Nuc5znOc4FuBbhbcLbhLcJblO3CW4S3iMRGcrYVECcKYB+cJBoCjM2maDsZ7fPbp7cPbh7cNbhrcG3Oc5znOcC3C24W3C24S3CW5TtwluEt4jERnK2FRAnCmAfnCQaAoxb/7ePl8NbU09PT1NYKHy8Y/ZePl8NbU09PT1NYKHy8Y/4Z6+g1tjb3d+Rk5SVlZWVlZSTkd8Fu3s/b6es/pvX0Gtsbe7vyMnKSkrKysrKSciC8Fu3s/YKnrP9gqAb8X0NQawqBVCrMrMqMoGuNUTiYf4ICT5/L4/H4fD4fH4hSCmBAAP4AgctUtYqgqoqsqsqoFIVwqAb8X0NQawqBVCrMrMqMoGuNUTiYf4ICT5/L4/H4fD4fH4hSCmBAAP4AgctUtYqgqkqsqsqsFIV/Hn8XHj5/H4a+traurq6mpqampqampqampqampqampqampqamrq62tr/D4/Lx5/Fx4+fx+Gvra2rq6upqampqampqamrq6upqampqampqamrq6utra/w+Py/wCgEzNTc5OTs7PT09PT8/Pz09PT07Ozk3Ng9TMxLy0rKSclJSMhIb+9vbu9u7u7u7u7u729vb2/vyEjJSUnKSstLzEzNTc5OTs7Oz09PT8/Pz09PT07Ozk5NzUzMS8tKyknJSUjISG/v727vbu7u7u7u7u9u729v78hIyUlJykrLS8x0nR9H0fR9H0XRdF0XRdD0PQ9F0XRdF0XRdF0fR9H0nSdJ0vS9L0vTdN03TdP0/T9P0/T9P0/T9P0/T9R0/T9P0/T9P0/TdN03S9L0vS9J0nSdJ0fR9H0XRdF0PRdD0PQ9D0PRdF0XRdF0XR9H0fSdJ0nS9L0vS9N03TdN0/T9P0/T9P0/T9P0/T9P1HT9P0/T9P0/T9N03TdL0vS9L0vSS8tLy0tLS0rKysrKysrKysrKystLS0vLS8vLy8vMTExMTExMzMzMTMzMzM1NTUzMzMzMzMzMzExMTExMS8vLy8vLy8tKy0tKysrKysrKysrKysrLS0tLy0vLy8vLzExMTExMTMzMzEzMzMzNTU1MzMzMzMzMzMxMTExMTEvLy8vnOc5znOc5znOc5znOc5znOc59ZznPr169evXr169evXr169evXr16znOfWc5znOc5znOc5znOc5znOc5znOc59ZznPr169evXr169evXr169evXr16znOfWc5z/9YD//xAArEAEAAgIDAQABBAICAQUAAAAAAVICYgNRYQRBEEBQUzFCIDARYICQoLD/2gAIAQEAAz8A/wDgmhCEI/nYQj+RhjH5ccflxw44YMe0dtmzZs2bNmzZs2bIsjtiwlxy45/Ljn8se0fwuPbjj8uOPy44YQxR2izZs2bNmzZs2bNkWR2xYS45cc/lhP5Y9/wEQwj8sIRD1s2bNmzZs2bNmzZs2bNmzZs2bNmzZs2bNmyLMZYZMZ/KJ/dRDCPywhjCI/LZs2bNmzZs2bNmzZs2bNmzZs2bNmzZs2bNkWYywlhP5RP/ABj9hDGGMIh69bNmzZs2bNmzZsmybJsmybJsmybJsmybJsmybJs2bNmzZs2bNmzZ7+mMsZYyj9hDGGMIj9NmzZs2bNmzZs2bJsmybJsmybJs2TZNk2TZNk2bJs2bNmzZs2bNmzZ6iWMsXr16hiwYMGDBgwYo/T169/T162bNmzZs2TZNk2T2ntPae09pSlKUpSlPae09p7T2mybJsmzZs2bNmz17+nr16hiwYOPtx9uPtx9sO2DBih69evXr1s2bNmzZsmybJsmye09p7T2lKUpSlKU9p7T2ntNk2TZNmzZs2bNmz17+vr1s2bNmzZs2bNmzZs2evXr169bNmye09p7SlKUp/wC6UpSlKe09p7etmzZs9evWzZs2bNmzZs2bNmzZs2bPXr1s9bNmye09p7SlKUp/7pSlKUp7T29bPWz169evWzZs2bNmzZs2bNmzZs2bNmzZs2evU9plM/vJhMJ7T29bNnrZ62bNmzZs2bNmzZs2bNmzZs2bNnr39J7TKZ/eTCYT3+nr162bNnrZs2bJsntNk2TZPabNmzZs2etnr39JlM/wUwmP09etmzZs2bNk2TZNk2TZNk2bNmzZs2bNnv6TKZ/gphMfp69etk9p7T2ntKUpSlKUp7T2nt69e/pMpn+GmH/j9PXr1Pae09pSySlklKU9p7T29evf0mUz/DTCY/T16lP/AHSlKU/xUpSlP/dKUpT/ABUpT/8AQllKWTJl0y6ZdMumXTLpl0y6ZJSn+QlKWTJl0y6ZdMumXTLpl0y6ZJSn/sn9xKWXTLpn0z6Z9M+mXTLplVlVlVlVlVlVlVlVlVlVlRlVlVlRlVlVlVlVlVlVlVl0z6Z9M4/DPpn0z6ZdMkp/byll0y6Z9M+mfTPpn0y6ZVZVZVZVZVZVZVZVZUZVZUZVZVZVZVZVZVZVZVZVZVZdM+mfTOPwz6Z9M+mTJlVlVlVl0yZ9M2fTPpn0z6Z9M+mbPpn0z6Z9M2fTPpl0yqyqyqyqyqyomiaJomiaJomiaJomjRo0aNGjRo0aNGjRNE0TRNE0TRNE0TRNE0ZVZVZVZVZVZVZM+mbPpn0z6Z9M+mfTNn0z6Z9M+mfTPpl0y6ZVZVZVTVlVlRNE0TRlRNE0TRNE0TRo0aNGjRo0aNGjRomiaJomiaJomiaJomqaJqyq0TRNE0TRNE0TVNE1TVNU1TRNE1TVNU0TRNE0TRNGjRo0aNGjRhWHFHTgh88Pmj8Pnj/V89HBRwf1w4f64cNMXFSHFTFxUxcVIcP9cOGkOCkPno+ej55/D55cEuKemHUIo0aNGjRo0TRNE0TRNE0TVNE0TVNE1TVNE1TRNU0TRNE0TRNGjRo0aNGjRhWHFHThh88Pnj8Pnq+ejgo4P64cP9cOKkOKkOKmLipi4aYuH+uHBSHBSHz0fPR88/h88uCXFNWHUIo0aNGjRo4ZcU9MOoRRFGjRo0aNGjRo0aNGjRo0RRhVxR04IcGP4cGP+jij/GEMI/xjCP3+M/5xhxT/AJwhwT/o4Mv9XBk4p6YdQiiKNGjRo0aNGjRo0aNGjRoijGsOKOnBi4Mfw4I/0cUf4whhH+MYR+/xn/OMOKf84Q4J/wBHBP8Ar/zxrDCsOKkOKjhq4auGrhq4auGjipDjpDGsI/k8awwrDipDio4aOGrhq4auGrho4qQ46QxrCP8A0bHcMLQ47w4rw4buCzgs4O3A4HA4XA4HA4HA4O3BZwWcN3Fdx3hhaGNoR/Dx3DC0OO8OK8OG7gs4LODtwOBwOFwOBwOBwODtwWcFnDdxXcd4YWhjaEf88UftoQh4y6ZuRyuVzOZzeudz+uf1z+uf1z+uf1z+uf1zuf1z+uf1z+uf1z+udzR25nM5o7c3rlcrlZsniOkSj9tCEPGXTNyuVy+uZzOb1z+uf1z+uf1z+uf1z+uf1z+udz+uf1z+uf1z+uf1z+ueO3O5nM5vXK5XKzZPEdMUftoYsemHTDpx9OPpxVcVXDVw1cNXDVw0cNHDRw0cNHDRw0cNHDRw0cNHDRw0cNHDRw0cNHDVw1cNXFVxVcVXFVx9OPph0w6Yo/bQxY9MOnH04+nH04quKrhq4auGrhq4aOGjho4aOGjho4aOGkOGkOGkOGjho4aOGjho4aOGjhq4auGriq4quKriq4+nH0w6Ydf+wHgcLhcLicTjYdww7hh3DDuGPcMe4Y9ww7hh3DDuGHcONxuJxOFwuBwOB8753z2fPZ89nz3fNd893zXfPd893z3fP/Y+e757uC75/wCyHz/2Q+f+yHBd893z3fPd893z3fPd893zXfNd893z2fPZ8/b5+3zvncDgcLhcLicTjYdww7hh3DDuGHcMe4Ydww7hh3DDuGHcONxuJxOFwuBwPnfO+d89nz2fPZ893zXfPd813z3fPd893z/2Pnu+e7gu+f8Ash8/9kPn/shwXcF3z3fPd893z3fPd893zXfNd893z2fPZ8/b5+3zvncDdu3bt03bt26bpum6bpum6bt27du3bt26bt26bpum6bpum6bpum6bt03TdN26bpum6bpum7dN03TdN03TdN03TdN03Tdum7dum7dN27dum6bpum6bpum6bpum7du3bt03bpu3bpum6bpum6bpum6bpu3TdN03bpum6bpum6bt03TdN03TdN03TdN03TdN03TduysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysysmzKzKzKybMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrMrJT+2lKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpSn9tKUpSlKUpSlKUpSlKUpSlKUpSlKUpSlKUpT/wDrA//EAB0RAAMBAAMBAQEAAAAAAAAAAAABERIwQFAgkMD/2gAIAQIBAT8A/COlKioqKioqKi+zSoqKioqL59Ro0aKyvpVlZWaNFXiVGkaNFZWV9CsrNGjRpFXepo0V8c69Zo0u1pGilfVnJWaNF+NFXNUaNFfmU0aReamkaNPzNM19VlZWaKysrK/XrKzTNGjRWaKyv+u0/8QAHREBAQACAQUAAAAAAAAAAAAAEQBAUCAQITCQwP/aAAgBAwEBPwD1NkRER07eYiIiNMRERGARERGgIiNAREZRERoCIjiYBERqiIwiI1REcCIiIiIjbkREREREfXZ//9k=";b();b();var vh=!1;function Mc(){return vh}l(Mc,"isTestMode");var da=class da{constructor(r){h(this,"backgroundAlpha",1);h(this,"backgroundColor",new be);h(this,"width",0);h(this,"height",0);h(this,"options",{});h(this,"renderer");h(this,"enabledLayers",new Set([0,1]));h(this,"handleWebGLContextCreationError",l(r=>{var e,t;(t=(e=this.options).onWebGLContextCreationError)==null||t.call(e,r)},"handleWebGLContextCreationError"));h(this,"handleWebGLContextLost",l(r=>{var e,t;(t=(e=this.options).onWebGLContextLost)==null||t.call(e,r)},"handleWebGLContextLost"));h(this,"handleWebGLContextRestored",l(r=>{var e,t;(t=(e=this.options).onWebGLContextRestored)==null||t.call(e,r)},"handleWebGLContextRestored"));var e,t,i,a,s;try{this.options=r,Mc()?(this.renderer={setSize:l(()=>{},"setSize"),state:{reset:l(()=>{},"reset")},properties:{get:l(()=>{},"get")},getSize:l(()=>({width:window.innerWidth,height:innerHeight}),"getSize"),getDrawingBufferSize:l(()=>({width:window.innerWidth,height:innerHeight}),"getDrawingBufferSize"),getClearAlpha:l(()=>1,"getClearAlpha"),getClearColor:l(()=>new be,"getClearColor"),autoUpdate:!0,shadowMap:{autoUpdate:!0},getContext:l(()=>({getContextAttributes(){return{alpha:!0,antialias:!1,depth:!0,stencil:!1}}}),"getContext"),readRenderTargetPixelsAsync:l(()=>Promise.resolve([]),"readRenderTargetPixelsAsync"),setRenderTarget:l(()=>{},"setRenderTarget"),setClearColor:l(()=>{},"setClearColor"),clear:l(()=>{},"clear"),render:l(()=>{},"render"),clearStencil:l(()=>{},"clearStencil"),clearDepth:l(()=>{},"clearDepth"),domElement:document.createElement("canvas"),capabilities:{isWebGL2:!0}},this.renderer.domElement.style.width="1920px",Object.defineProperty(this.renderer.domElement,"clientWidth",{value:1920}),this.renderer.domElement.style.height="1080px",Object.defineProperty(this.renderer.domElement,"clientHeight",{value:1080})):this.renderer=new bl({canvas:r.canvas,alpha:r.alpha||!1,stencil:!0,antialias:typeof r.antialias=="boolean"?r.antialias:!0,powerPreference:"high-performance",preserveDrawingBuffer:!0}),this.backgroundColor=new be((e=r.backgroundColor)!=null?e:"#ffffff"),this.backgroundAlpha=(t=r.backgroundAlpha)!=null?t:1}catch(c){W.error(c),r.onWebGLRendererError&&r.onWebGLRendererError(c)}(i=this.domElement())==null||i.addEventListener("webglcontextlost",this.handleWebGLContextLost),(a=this.domElement())==null||a.addEventListener("webglcontextrestored",this.handleWebGLContextRestored),(s=this.domElement())==null||s.addEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}destroy(){var r,e,t,i,a;this.renderer&&((e=(r=this.renderer).dispose)==null||e.call(r)),(t=this.domElement())==null||t.removeEventListener("webglcontextlost",this.handleWebGLContextLost),(i=this.domElement())==null||i.removeEventListener("webglcontextrestored",this.handleWebGLContextRestored),(a=this.domElement())==null||a.removeEventListener("webglcontextcreationerror",this.handleWebGLContextCreationError)}render(r,e){if(this.renderer){this.renderer.state.reset(),e.layers.disableAll();for(let t of this.enabledLayers.values())e.layers.enable(t);this.renderer.clearStencil(),this.renderer.autoClear=!1,this.renderer.setRenderTarget(null),this.renderer.render(r,e),this.renderer.clearDepth(),e.layers.disableAll(),e.layers.enable(Sn.ALWAYS_ON_TOP),this.renderer.render(r,e),this.renderer.state.reset()}}clear(){this.renderer&&(this.renderer.setClearColor(this.backgroundColor,this.backgroundAlpha),this.renderer.clear())}setBufferSize(r,e){_.env.NODE_ENV==="test"||!this.renderer||(this.width=r,this.height=e,this.renderer.setSize(r,e,!1))}setBackgroundColor(r,e){this.backgroundColor=r,this.backgroundAlpha=e}domElement(){var r;return(r=this.renderer)==null?void 0:r.domElement}};l(da,"Renderer");var _n=da;b();b();var Cc='"use strict";(()=>{var rt=Object.defineProperty,Tt=Object.defineProperties;var Rt=Object.getOwnPropertyDescriptors;var tt=Object.getOwnPropertySymbols;var Ct=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable;var Fe=(r,e,t)=>e in r?rt(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,c=(r,e)=>{for(var t in e||(e={}))Ct.call(e,t)&&Fe(r,t,e[t]);if(tt)for(var t of tt(e))St.call(e,t)&&Fe(r,t,e[t]);return r},y=(r,e)=>Tt(r,Rt(e));var At=(r,e)=>{for(var t in e)rt(r,t,{get:e[t],enumerable:!0})};var C=(r,e,t)=>Fe(r,typeof e!="symbol"?e+"":e,t);function st(r,e){return e.x+e.w<r.x+r.w&&e.x>r.x&&e.y>r.y&&e.y+e.h<r.y+r.h}function nt(r,e){let[t,s]=e;return t>=r.x&&t<=r.x+r.w&&s>=r.y&&s<=r.y+r.h}function at(r,e){let t=e.x,s=e.y,n=e.x+e.w,a=e.y+e.h,o=r.x,i=r.y,u=r.x+r.w,l=r.y+r.h;return t<u&&o<n&&s<l&&i<a}function V(r,e){for(let t=0;t<e.length;t++)r.push(e[t])}var w=class{constructor(e,t,s,n,a){C(this,"x");C(this,"y");C(this,"w");C(this,"h");C(this,"userData");this.userData=typeof a>"u"?null:a,this.x=e,this.y=t,this.w=s,this.h=n}contains(e){return e===this?!1:st(this,e)}intersects(e){return at(this,e)}intersectsPoint(e){return nt(this,e)}draw(e){e.fillStyle="rgba(123,222,26, 0.8)",e.fillRect(this.x,this.y,this.w,this.h)}};var Ae=class r{constructor(e,t){C(this,"topLeft");C(this,"topRight");C(this,"bottomLeft");C(this,"bottomRight");C(this,"divided",!1);C(this,"boundary");C(this,"capacity",16);C(this,"objects",[]);C(this,"parent");this.parent=t,this.boundary=e}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:e,y:t,w:s,h:n}=this.boundary;this.topLeft=new r(new w(e,t,s/2,n/2),this),this.topRight=new r(new w(e+s/2,t,s/2,n/2),this),this.bottomLeft=new r(new w(e,t+n/2,s/2,n/2),this),this.bottomRight=new r(new w(e+s/2,t+n/2,s/2,n/2),this),this.divided=!0}queryRect(e){let t=[];if(this.boundary.intersects(e))t.push(...this.objects);else return[];return this.divided&&(V(t,this.topLeft.queryRect(e)),V(t,this.topRight.queryRect(e)),V(t,this.bottomLeft.queryRect(e)),V(t,this.bottomRight.queryRect(e))),t}queryPoint(e){let t=[];if(this.boundary.intersectsPoint(e))t.push(...this.objects);else return[];return this.divided&&(V(t,this.topLeft.queryPoint(e)),V(t,this.topRight.queryPoint(e)),V(t,this.bottomLeft.queryPoint(e)),V(t,this.bottomRight.queryPoint(e))),t}insert(e){return(this.parent?!this.boundary.contains(e):!this.boundary.intersects(e))?!1:this.objects.length<this.capacity?(this.objects.push(e),!0):(this.divided||this.subdivide(),(this.topLeft.insert(e)||this.topRight.insert(e)||this.bottomLeft.insert(e)||this.bottomRight.insert(e))===!1&&this.objects.push(e),!0)}drawObjects(e){this.objects.forEach(t=>t.draw(e)),this.divided&&(this.topLeft.drawObjects(e),this.topRight.drawObjects(e),this.bottomLeft.drawObjects(e),this.bottomRight.drawObjects(e))}draw(e){e.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(e),this.topRight.draw(e),this.bottomLeft.draw(e),this.bottomRight.draw(e)),e.strokeStyle="black",e.lineWidth=4,e.stroke()}};var Te={};At(Te,{BRAND:()=>er,DIRTY:()=>H,EMPTY_PATH:()=>Et,INVALID:()=>m,NEVER:()=>Lr,OK:()=>S,ParseStatus:()=>R,Schema:()=>x,ZodAny:()=>Y,ZodArray:()=>U,ZodBigInt:()=>te,ZodBoolean:()=>re,ZodBranded:()=>Ie,ZodCatch:()=>he,ZodDate:()=>se,ZodDefault:()=>fe,ZodDiscriminatedUnion:()=>Ze,ZodEffects:()=>M,ZodEnum:()=>ue,ZodError:()=>A,ZodFirstPartyTypeKind:()=>g,ZodFunction:()=>Le,ZodIntersection:()=>oe,ZodIssueCode:()=>d,ZodLazy:()=>ce,ZodLiteral:()=>de,ZodMap:()=>be,ZodNaN:()=>we,ZodNativeEnum:()=>le,ZodNever:()=>P,ZodNull:()=>ae,ZodNullable:()=>L,ZodNumber:()=>ee,ZodObject:()=>O,ZodOptional:()=>E,ZodParsedType:()=>h,ZodPipeline:()=>Ne,ZodPromise:()=>X,ZodReadonly:()=>pe,ZodRecord:()=>$e,ZodSchema:()=>x,ZodSet:()=>ke,ZodString:()=>q,ZodSymbol:()=>ve,ZodTransformer:()=>M,ZodTuple:()=>$,ZodType:()=>x,ZodUndefined:()=>ne,ZodUnion:()=>ie,ZodUnknown:()=>F,ZodVoid:()=>xe,addIssueToContext:()=>f,any:()=>dr,array:()=>hr,bigint:()=>nr,boolean:()=>yt,coerce:()=>$r,custom:()=>ht,date:()=>ar,datetimeRegex:()=>lt,defaultErrorMap:()=>z,discriminatedUnion:()=>gr,effect:()=>Or,enum:()=>Cr,function:()=>wr,getErrorMap:()=>ye,getParsedType:()=>Z,instanceof:()=>rr,intersection:()=>_r,isAborted:()=>Me,isAsync:()=>ge,isDirty:()=>Pe,isValid:()=>W,late:()=>tr,lazy:()=>Tr,literal:()=>Rr,makeIssue:()=>Oe,map:()=>br,nan:()=>sr,nativeEnum:()=>Sr,never:()=>lr,null:()=>cr,nullable:()=>Nr,number:()=>mt,object:()=>pr,objectUtil:()=>Ue,oboolean:()=>Zr,onumber:()=>Pr,optional:()=>Ir,ostring:()=>Mr,pipeline:()=>jr,preprocess:()=>Er,promise:()=>Ar,quotelessJson:()=>Ot,record:()=>xr,set:()=>kr,setErrorMap:()=>Nt,strictObject:()=>mr,string:()=>pt,symbol:()=>ir,transformer:()=>Or,tuple:()=>vr,undefined:()=>or,union:()=>yr,unknown:()=>ur,util:()=>b,void:()=>fr});var b;(function(r){r.assertEqual=n=>{};function e(n){}r.assertIs=e;function t(n){throw new Error}r.assertNever=t,r.arrayToEnum=n=>{let a={};for(let o of n)a[o]=o;return a},r.getValidEnumValues=n=>{let a=r.objectKeys(n).filter(i=>typeof n[n[i]]!="number"),o={};for(let i of a)o[i]=n[i];return r.objectValues(o)},r.objectValues=n=>r.objectKeys(n).map(function(a){return n[a]}),r.objectKeys=typeof Object.keys=="function"?n=>Object.keys(n):n=>{let a=[];for(let o in n)Object.prototype.hasOwnProperty.call(n,o)&&a.push(o);return a},r.find=(n,a)=>{for(let o of n)if(a(o))return o},r.isInteger=typeof Number.isInteger=="function"?n=>Number.isInteger(n):n=>typeof n=="number"&&Number.isFinite(n)&&Math.floor(n)===n;function s(n,a=" | "){return n.map(o=>typeof o=="string"?"\'".concat(o,"\'"):o).join(a)}r.joinValues=s,r.jsonStringifyReplacer=(n,a)=>typeof a=="bigint"?a.toString():a})(b||(b={}));var Ue;(function(r){r.mergeShapes=(e,t)=>c(c({},e),t)})(Ue||(Ue={}));var h=b.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Z=r=>{switch(typeof r){case"undefined":return h.undefined;case"string":return h.string;case"number":return Number.isNaN(r)?h.nan:h.number;case"boolean":return h.boolean;case"function":return h.function;case"bigint":return h.bigint;case"symbol":return h.symbol;case"object":return Array.isArray(r)?h.array:r===null?h.null:r.then&&typeof r.then=="function"&&r.catch&&typeof r.catch=="function"?h.promise:typeof Map<"u"&&r instanceof Map?h.map:typeof Set<"u"&&r instanceof Set?h.set:typeof Date<"u"&&r instanceof Date?h.date:h.object;default:return h.unknown}};var d=b.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]),Ot=r=>JSON.stringify(r,null,2).replace(/"([^"]+)":/g,"$1:"),A=class r extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=s=>{this.issues=[...this.issues,s]},this.addIssues=(s=[])=>{this.issues=[...this.issues,...s]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){let t=e||function(a){return a.message},s={_errors:[]},n=a=>{for(let o of a.issues)if(o.code==="invalid_union")o.unionErrors.map(n);else if(o.code==="invalid_return_type")n(o.returnTypeError);else if(o.code==="invalid_arguments")n(o.argumentsError);else if(o.path.length===0)s._errors.push(t(o));else{let i=s,u=0;for(;u<o.path.length;){let l=o.path[u];u===o.path.length-1?(i[l]=i[l]||{_errors:[]},i[l]._errors.push(t(o))):i[l]=i[l]||{_errors:[]},i=i[l],u++}}};return n(this),s}static assert(e){if(!(e instanceof r))throw new Error("Not a ZodError: ".concat(e))}toString(){return this.message}get message(){return JSON.stringify(this.issues,b.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){let t={},s=[];for(let n of this.issues)n.path.length>0?(t[n.path[0]]=t[n.path[0]]||[],t[n.path[0]].push(e(n))):s.push(e(n));return{formErrors:s,fieldErrors:t}}get formErrors(){return this.flatten()}};A.create=r=>new A(r);var It=(r,e)=>{let t;switch(r.code){case d.invalid_type:r.received===h.undefined?t="Required":t="Expected ".concat(r.expected,", received ").concat(r.received);break;case d.invalid_literal:t="Invalid literal value, expected ".concat(JSON.stringify(r.expected,b.jsonStringifyReplacer));break;case d.unrecognized_keys:t="Unrecognized key(s) in object: ".concat(b.joinValues(r.keys,", "));break;case d.invalid_union:t="Invalid input";break;case d.invalid_union_discriminator:t="Invalid discriminator value. Expected ".concat(b.joinValues(r.options));break;case d.invalid_enum_value:t="Invalid enum value. Expected ".concat(b.joinValues(r.options),", received \'").concat(r.received,"\'");break;case d.invalid_arguments:t="Invalid function arguments";break;case d.invalid_return_type:t="Invalid function return type";break;case d.invalid_date:t="Invalid date";break;case d.invalid_string:typeof r.validation=="object"?"includes"in r.validation?(t=\'Invalid input: must include "\'.concat(r.validation.includes,\'"\'),typeof r.validation.position=="number"&&(t="".concat(t," at one or more positions greater than or equal to ").concat(r.validation.position))):"startsWith"in r.validation?t=\'Invalid input: must start with "\'.concat(r.validation.startsWith,\'"\'):"endsWith"in r.validation?t=\'Invalid input: must end with "\'.concat(r.validation.endsWith,\'"\'):b.assertNever(r.validation):r.validation!=="regex"?t="Invalid ".concat(r.validation):t="Invalid";break;case d.too_small:r.type==="array"?t="Array must contain ".concat(r.exact?"exactly":r.inclusive?"at least":"more than"," ").concat(r.minimum," element(s)"):r.type==="string"?t="String must contain ".concat(r.exact?"exactly":r.inclusive?"at least":"over"," ").concat(r.minimum," character(s)"):r.type==="number"?t="Number must be ".concat(r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than ").concat(r.minimum):r.type==="date"?t="Date must be ".concat(r.exact?"exactly equal to ":r.inclusive?"greater than or equal to ":"greater than ").concat(new Date(Number(r.minimum))):t="Invalid input";break;case d.too_big:r.type==="array"?t="Array must contain ".concat(r.exact?"exactly":r.inclusive?"at most":"less than"," ").concat(r.maximum," element(s)"):r.type==="string"?t="String must contain ".concat(r.exact?"exactly":r.inclusive?"at most":"under"," ").concat(r.maximum," character(s)"):r.type==="number"?t="Number must be ".concat(r.exact?"exactly":r.inclusive?"less than or equal to":"less than"," ").concat(r.maximum):r.type==="bigint"?t="BigInt must be ".concat(r.exact?"exactly":r.inclusive?"less than or equal to":"less than"," ").concat(r.maximum):r.type==="date"?t="Date must be ".concat(r.exact?"exactly":r.inclusive?"smaller than or equal to":"smaller than"," ").concat(new Date(Number(r.maximum))):t="Invalid input";break;case d.custom:t="Invalid input";break;case d.invalid_intersection_types:t="Intersection results could not be merged";break;case d.not_multiple_of:t="Number must be a multiple of ".concat(r.multipleOf);break;case d.not_finite:t="Number must be finite";break;default:t=e.defaultError,b.assertNever(r)}return{message:t}},z=It;var it=z;function Nt(r){it=r}function ye(){return it}var Oe=r=>{let{data:e,path:t,errorMaps:s,issueData:n}=r,a=[...t,...n.path||[]],o=y(c({},n),{path:a});if(n.message!==void 0)return y(c({},n),{path:a,message:n.message});let i="",u=s.filter(l=>!!l).slice().reverse();for(let l of u)i=l(o,{data:e,defaultError:i}).message;return y(c({},n),{path:a,message:i})},Et=[];function f(r,e){let t=ye(),s=Oe({issueData:e,data:r.data,path:r.path,errorMaps:[r.common.contextualErrorMap,r.schemaErrorMap,t,t===z?void 0:z].filter(n=>!!n)});r.common.issues.push(s)}var R=class r{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){let s=[];for(let n of t){if(n.status==="aborted")return m;n.status==="dirty"&&e.dirty(),s.push(n.value)}return{status:e.value,value:s}}static async mergeObjectAsync(e,t){let s=[];for(let n of t){let a=await n.key,o=await n.value;s.push({key:a,value:o})}return r.mergeObjectSync(e,s)}static mergeObjectSync(e,t){let s={};for(let n of t){let{key:a,value:o}=n;if(a.status==="aborted"||o.status==="aborted")return m;a.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),a.value!=="__proto__"&&(typeof o.value<"u"||n.alwaysSet)&&(s[a.value]=o.value)}return{status:e.value,value:s}}},m=Object.freeze({status:"aborted"}),H=r=>({status:"dirty",value:r}),S=r=>({status:"valid",value:r}),Me=r=>r.status==="aborted",Pe=r=>r.status==="dirty",W=r=>r.status==="valid",ge=r=>typeof Promise<"u"&&r instanceof Promise;var p;(function(r){r.errToObj=e=>typeof e=="string"?{message:e}:e||{},r.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(p||(p={}));var j=class{constructor(e,t,s,n){this._cachedPath=[],this.parent=e,this.data=t,this._path=s,this._key=n}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}},ot=(r,e)=>{if(W(e))return{success:!0,data:e.value};if(!r.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new A(r.common.issues);return this._error=t,this._error}}};function v(r){if(!r)return{};let{errorMap:e,invalid_type_error:t,required_error:s,description:n}=r;if(e&&(t||s))throw new Error(\'Can\\\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.\');return e?{errorMap:e,description:n}:{errorMap:(o,i)=>{var l,_;let{message:u}=r;return o.code==="invalid_enum_value"?{message:u!=null?u:i.defaultError}:typeof i.data>"u"?{message:(l=u!=null?u:s)!=null?l:i.defaultError}:o.code!=="invalid_type"?{message:i.defaultError}:{message:(_=u!=null?u:t)!=null?_:i.defaultError}},description:n}}var x=class{get description(){return this._def.description}_getType(e){return Z(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:Z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new R,ctx:{common:e.parent.common,data:e.data,parsedType:Z(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(ge(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){let t=this._parse(e);return Promise.resolve(t)}parse(e,t){let s=this.safeParse(e,t);if(s.success)return s.data;throw s.error}safeParse(e,t){var a;let s={common:{issues:[],async:(a=t==null?void 0:t.async)!=null?a:!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)},n=this._parseSync({data:e,path:s.path,parent:s});return ot(s,n)}"~validate"(e){var s,n;let t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)};if(!this["~standard"].async)try{let a=this._parseSync({data:e,path:[],parent:t});return W(a)?{value:a.value}:{issues:t.common.issues}}catch(a){(n=(s=a==null?void 0:a.message)==null?void 0:s.toLowerCase())!=null&&n.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(a=>W(a)?{value:a.value}:{issues:t.common.issues})}async parseAsync(e,t){let s=await this.safeParseAsync(e,t);if(s.success)return s.data;throw s.error}async safeParseAsync(e,t){let s={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:Z(e)},n=this._parse({data:e,path:s.path,parent:s}),a=await(ge(n)?n:Promise.resolve(n));return ot(s,a)}refine(e,t){let s=n=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(n):t;return this._refinement((n,a)=>{let o=e(n),i=()=>a.addIssue(c({code:d.custom},s(n)));return typeof Promise<"u"&&o instanceof Promise?o.then(u=>u?!0:(i(),!1)):o?!0:(i(),!1)})}refinement(e,t){return this._refinement((s,n)=>e(s)?!0:(n.addIssue(typeof t=="function"?t(s,n):t),!1))}_refinement(e){return new M({schema:this,typeName:g.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return E.create(this,this._def)}nullable(){return L.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return U.create(this)}promise(){return X.create(this,this._def)}or(e){return ie.create([this,e],this._def)}and(e){return oe.create(this,e,this._def)}transform(e){return new M(y(c({},v(this._def)),{schema:this,typeName:g.ZodEffects,effect:{type:"transform",transform:e}}))}default(e){let t=typeof e=="function"?e:()=>e;return new fe(y(c({},v(this._def)),{innerType:this,defaultValue:t,typeName:g.ZodDefault}))}brand(){return new Ie(c({typeName:g.ZodBranded,type:this},v(this._def)))}catch(e){let t=typeof e=="function"?e:()=>e;return new he(y(c({},v(this._def)),{innerType:this,catchValue:t,typeName:g.ZodCatch}))}describe(e){let t=this.constructor;return new t(y(c({},this._def),{description:e}))}pipe(e){return Ne.create(this,e)}readonly(){return pe.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}},jt=/^c[^\\s-]{8,}$/i,Mt=/^[0-9a-z]+$/,Pt=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Zt=/^[0-9a-fA-F]{8}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{4}\\b-[0-9a-fA-F]{12}$/i,$t=/^[a-z0-9_-]{21}$/i,Lt=/^[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]+\\.[A-Za-z0-9-_]*$/,Dt=/^[-+]?P(?!$)(?:(?:[-+]?\\d+Y)|(?:[-+]?\\d+[.,]\\d+Y$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:(?:[-+]?\\d+W)|(?:[-+]?\\d+[.,]\\d+W$))?(?:(?:[-+]?\\d+D)|(?:[-+]?\\d+[.,]\\d+D$))?(?:T(?=[\\d+-])(?:(?:[-+]?\\d+H)|(?:[-+]?\\d+[.,]\\d+H$))?(?:(?:[-+]?\\d+M)|(?:[-+]?\\d+[.,]\\d+M$))?(?:[-+]?\\d+(?:[.,]\\d+)?S)?)??$/,Vt=/^(?!\\.)(?!.*\\.\\.)([A-Z0-9_\'+\\-\\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\\-]*\\.)+[A-Z]{2,}$/i,zt="^(\\\\p{Extended_Pictographic}|\\\\p{Emoji_Component})+$",We,Bt=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Ft=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\\/(3[0-2]|[12]?[0-9])$/,Ut=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Wt=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,qt=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Yt=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,dt="((\\\\d\\\\d[2468][048]|\\\\d\\\\d[13579][26]|\\\\d\\\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\\\d|30)|(02)-(0[1-9]|1\\\\d|2[0-8])))",Xt=new RegExp("^".concat(dt,"$"));function ut(r){let e="[0-5]\\\\d";r.precision?e="".concat(e,"\\\\.\\\\d{").concat(r.precision,"}"):r.precision==null&&(e="".concat(e,"(\\\\.\\\\d+)?"));let t=r.precision?"+":"?";return"([01]\\\\d|2[0-3]):[0-5]\\\\d(:".concat(e,")").concat(t)}function Jt(r){return new RegExp("^".concat(ut(r),"$"))}function lt(r){let e="".concat(dt,"T").concat(ut(r)),t=[];return t.push(r.local?"Z?":"Z"),r.offset&&t.push("([+-]\\\\d{2}:?\\\\d{2})"),e="".concat(e,"(").concat(t.join("|"),")"),new RegExp("^".concat(e,"$"))}function Qt(r,e){return!!((e==="v4"||!e)&&Bt.test(r)||(e==="v6"||!e)&&Ut.test(r))}function Kt(r,e){if(!Lt.test(r))return!1;try{let[t]=r.split("."),s=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),n=JSON.parse(atob(s));return!(typeof n!="object"||n===null||"typ"in n&&(n==null?void 0:n.typ)!=="JWT"||!n.alg||e&&n.alg!==e)}catch(t){return!1}}function Gt(r,e){return!!((e==="v4"||!e)&&Ft.test(r)||(e==="v6"||!e)&&Wt.test(r))}var q=class r extends x{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==h.string){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:h.string,received:a.parsedType}),m}let s=new R,n;for(let a of this._def.checks)if(a.kind==="min")e.data.length<a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="max")e.data.length>a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!1,message:a.message}),s.dirty());else if(a.kind==="length"){let o=e.data.length>a.value,i=e.data.length<a.value;(o||i)&&(n=this._getOrReturnCtx(e,n),o?f(n,{code:d.too_big,maximum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}):i&&f(n,{code:d.too_small,minimum:a.value,type:"string",inclusive:!0,exact:!0,message:a.message}),s.dirty())}else if(a.kind==="email")Vt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"email",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="emoji")We||(We=new RegExp(zt,"u")),We.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"emoji",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="uuid")Zt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"uuid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="nanoid")$t.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"nanoid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid")jt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cuid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="cuid2")Mt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cuid2",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="ulid")Pt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"ulid",code:d.invalid_string,message:a.message}),s.dirty());else if(a.kind==="url")try{new URL(e.data)}catch(o){n=this._getOrReturnCtx(e,n),f(n,{validation:"url",code:d.invalid_string,message:a.message}),s.dirty()}else a.kind==="regex"?(a.regex.lastIndex=0,a.regex.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"regex",code:d.invalid_string,message:a.message}),s.dirty())):a.kind==="trim"?e.data=e.data.trim():a.kind==="includes"?e.data.includes(a.value,a.position)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:{includes:a.value,position:a.position},message:a.message}),s.dirty()):a.kind==="toLowerCase"?e.data=e.data.toLowerCase():a.kind==="toUpperCase"?e.data=e.data.toUpperCase():a.kind==="startsWith"?e.data.startsWith(a.value)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:{startsWith:a.value},message:a.message}),s.dirty()):a.kind==="endsWith"?e.data.endsWith(a.value)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:{endsWith:a.value},message:a.message}),s.dirty()):a.kind==="datetime"?lt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:"datetime",message:a.message}),s.dirty()):a.kind==="date"?Xt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:"date",message:a.message}),s.dirty()):a.kind==="time"?Jt(a).test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:d.invalid_string,validation:"time",message:a.message}),s.dirty()):a.kind==="duration"?Dt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"duration",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="ip"?Qt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"ip",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="jwt"?Kt(e.data,a.alg)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"jwt",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="cidr"?Gt(e.data,a.version)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"cidr",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="base64"?qt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"base64",code:d.invalid_string,message:a.message}),s.dirty()):a.kind==="base64url"?Yt.test(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{validation:"base64url",code:d.invalid_string,message:a.message}),s.dirty()):b.assertNever(a);return{status:s.value,value:e.data}}_regex(e,t,s){return this.refinement(n=>e.test(n),c({validation:t,code:d.invalid_string},p.errToObj(s)))}_addCheck(e){return new r(y(c({},this._def),{checks:[...this._def.checks,e]}))}email(e){return this._addCheck(c({kind:"email"},p.errToObj(e)))}url(e){return this._addCheck(c({kind:"url"},p.errToObj(e)))}emoji(e){return this._addCheck(c({kind:"emoji"},p.errToObj(e)))}uuid(e){return this._addCheck(c({kind:"uuid"},p.errToObj(e)))}nanoid(e){return this._addCheck(c({kind:"nanoid"},p.errToObj(e)))}cuid(e){return this._addCheck(c({kind:"cuid"},p.errToObj(e)))}cuid2(e){return this._addCheck(c({kind:"cuid2"},p.errToObj(e)))}ulid(e){return this._addCheck(c({kind:"ulid"},p.errToObj(e)))}base64(e){return this._addCheck(c({kind:"base64"},p.errToObj(e)))}base64url(e){return this._addCheck(c({kind:"base64url"},p.errToObj(e)))}jwt(e){return this._addCheck(c({kind:"jwt"},p.errToObj(e)))}ip(e){return this._addCheck(c({kind:"ip"},p.errToObj(e)))}cidr(e){return this._addCheck(c({kind:"cidr"},p.errToObj(e)))}datetime(e){var t,s;return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck(c({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(t=e==null?void 0:e.offset)!=null?t:!1,local:(s=e==null?void 0:e.local)!=null?s:!1},p.errToObj(e==null?void 0:e.message)))}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck(c({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision},p.errToObj(e==null?void 0:e.message)))}duration(e){return this._addCheck(c({kind:"duration"},p.errToObj(e)))}regex(e,t){return this._addCheck(c({kind:"regex",regex:e},p.errToObj(t)))}includes(e,t){return this._addCheck(c({kind:"includes",value:e,position:t==null?void 0:t.position},p.errToObj(t==null?void 0:t.message)))}startsWith(e,t){return this._addCheck(c({kind:"startsWith",value:e},p.errToObj(t)))}endsWith(e,t){return this._addCheck(c({kind:"endsWith",value:e},p.errToObj(t)))}min(e,t){return this._addCheck(c({kind:"min",value:e},p.errToObj(t)))}max(e,t){return this._addCheck(c({kind:"max",value:e},p.errToObj(t)))}length(e,t){return this._addCheck(c({kind:"length",value:e},p.errToObj(t)))}nonempty(e){return this.min(1,p.errToObj(e))}trim(){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:"trim"}]}))}toLowerCase(){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:"toLowerCase"}]}))}toUpperCase(){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:"toUpperCase"}]}))}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};q.create=r=>{var e;return new q(c({checks:[],typeName:g.ZodString,coerce:(e=r==null?void 0:r.coerce)!=null?e:!1},v(r)))};function Ht(r,e){let t=(r.toString().split(".")[1]||"").length,s=(e.toString().split(".")[1]||"").length,n=t>s?t:s,a=Number.parseInt(r.toFixed(n).replace(".","")),o=Number.parseInt(e.toFixed(n).replace(".",""));return a%o/10**n}var ee=class r extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==h.number){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:h.number,received:a.parsedType}),m}let s,n=new R;for(let a of this._def.checks)a.kind==="int"?b.isInteger(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.invalid_type,expected:"integer",received:"float",message:a.message}),n.dirty()):a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,minimum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,maximum:a.value,type:"number",inclusive:a.inclusive,exact:!1,message:a.message}),n.dirty()):a.kind==="multipleOf"?Ht(e.data,a.value)!==0&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):a.kind==="finite"?Number.isFinite(e.data)||(s=this._getOrReturnCtx(e,s),f(s,{code:d.not_finite,message:a.message}),n.dirty()):b.assertNever(a);return{status:n.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]}))}_addCheck(e){return new r(y(c({},this._def),{checks:[...this._def.checks,e]}))}int(e){return this._addCheck({kind:"int",message:p.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:p.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:p.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:p.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&b.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let s of this._def.checks){if(s.kind==="finite"||s.kind==="int"||s.kind==="multipleOf")return!0;s.kind==="min"?(t===null||s.value>t)&&(t=s.value):s.kind==="max"&&(e===null||s.value<e)&&(e=s.value)}return Number.isFinite(t)&&Number.isFinite(e)}};ee.create=r=>new ee(c({checks:[],typeName:g.ZodNumber,coerce:(r==null?void 0:r.coerce)||!1},v(r)));var te=class r extends x{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch(a){return this._getInvalidInput(e)}if(this._getType(e)!==h.bigint)return this._getInvalidInput(e);let s,n=new R;for(let a of this._def.checks)a.kind==="min"?(a.inclusive?e.data<a.value:e.data<=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_small,type:"bigint",minimum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="max"?(a.inclusive?e.data>a.value:e.data>=a.value)&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.too_big,type:"bigint",maximum:a.value,inclusive:a.inclusive,message:a.message}),n.dirty()):a.kind==="multipleOf"?e.data%a.value!==BigInt(0)&&(s=this._getOrReturnCtx(e,s),f(s,{code:d.not_multiple_of,multipleOf:a.value,message:a.message}),n.dirty()):b.assertNever(a);return{status:n.value,value:e.data}}_getInvalidInput(e){let t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:h.bigint,received:t.parsedType}),m}gte(e,t){return this.setLimit("min",e,!0,p.toString(t))}gt(e,t){return this.setLimit("min",e,!1,p.toString(t))}lte(e,t){return this.setLimit("max",e,!0,p.toString(t))}lt(e,t){return this.setLimit("max",e,!1,p.toString(t))}setLimit(e,t,s,n){return new r(y(c({},this._def),{checks:[...this._def.checks,{kind:e,value:t,inclusive:s,message:p.toString(n)}]}))}_addCheck(e){return new r(y(c({},this._def),{checks:[...this._def.checks,e]}))}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:p.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:p.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:p.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:p.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:p.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}};te.create=r=>{var e;return new te(c({checks:[],typeName:g.ZodBigInt,coerce:(e=r==null?void 0:r.coerce)!=null?e:!1},v(r)))};var re=class extends x{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==h.boolean){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.boolean,received:s.parsedType}),m}return S(e.data)}};re.create=r=>new re(c({typeName:g.ZodBoolean,coerce:(r==null?void 0:r.coerce)||!1},v(r)));var se=class r extends x{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==h.date){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_type,expected:h.date,received:a.parsedType}),m}if(Number.isNaN(e.data.getTime())){let a=this._getOrReturnCtx(e);return f(a,{code:d.invalid_date}),m}let s=new R,n;for(let a of this._def.checks)a.kind==="min"?e.data.getTime()<a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_small,message:a.message,inclusive:!0,exact:!1,minimum:a.value,type:"date"}),s.dirty()):a.kind==="max"?e.data.getTime()>a.value&&(n=this._getOrReturnCtx(e,n),f(n,{code:d.too_big,message:a.message,inclusive:!0,exact:!1,maximum:a.value,type:"date"}),s.dirty()):b.assertNever(a);return{status:s.value,value:new Date(e.data.getTime())}}_addCheck(e){return new r(y(c({},this._def),{checks:[...this._def.checks,e]}))}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:p.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:p.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}};se.create=r=>new se(c({checks:[],coerce:(r==null?void 0:r.coerce)||!1,typeName:g.ZodDate},v(r)));var ve=class extends x{_parse(e){if(this._getType(e)!==h.symbol){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.symbol,received:s.parsedType}),m}return S(e.data)}};ve.create=r=>new ve(c({typeName:g.ZodSymbol},v(r)));var ne=class extends x{_parse(e){if(this._getType(e)!==h.undefined){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.undefined,received:s.parsedType}),m}return S(e.data)}};ne.create=r=>new ne(c({typeName:g.ZodUndefined},v(r)));var ae=class extends x{_parse(e){if(this._getType(e)!==h.null){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.null,received:s.parsedType}),m}return S(e.data)}};ae.create=r=>new ae(c({typeName:g.ZodNull},v(r)));var Y=class extends x{constructor(){super(...arguments),this._any=!0}_parse(e){return S(e.data)}};Y.create=r=>new Y(c({typeName:g.ZodAny},v(r)));var F=class extends x{constructor(){super(...arguments),this._unknown=!0}_parse(e){return S(e.data)}};F.create=r=>new F(c({typeName:g.ZodUnknown},v(r)));var P=class extends x{_parse(e){let t=this._getOrReturnCtx(e);return f(t,{code:d.invalid_type,expected:h.never,received:t.parsedType}),m}};P.create=r=>new P(c({typeName:g.ZodNever},v(r)));var xe=class extends x{_parse(e){if(this._getType(e)!==h.undefined){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.void,received:s.parsedType}),m}return S(e.data)}};xe.create=r=>new xe(c({typeName:g.ZodVoid},v(r)));var U=class r extends x{_parse(e){let{ctx:t,status:s}=this._processInputParams(e),n=this._def;if(t.parsedType!==h.array)return f(t,{code:d.invalid_type,expected:h.array,received:t.parsedType}),m;if(n.exactLength!==null){let o=t.data.length>n.exactLength.value,i=t.data.length<n.exactLength.value;(o||i)&&(f(t,{code:o?d.too_big:d.too_small,minimum:i?n.exactLength.value:void 0,maximum:o?n.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:n.exactLength.message}),s.dirty())}if(n.minLength!==null&&t.data.length<n.minLength.value&&(f(t,{code:d.too_small,minimum:n.minLength.value,type:"array",inclusive:!0,exact:!1,message:n.minLength.message}),s.dirty()),n.maxLength!==null&&t.data.length>n.maxLength.value&&(f(t,{code:d.too_big,maximum:n.maxLength.value,type:"array",inclusive:!0,exact:!1,message:n.maxLength.message}),s.dirty()),t.common.async)return Promise.all([...t.data].map((o,i)=>n.type._parseAsync(new j(t,o,t.path,i)))).then(o=>R.mergeArray(s,o));let a=[...t.data].map((o,i)=>n.type._parseSync(new j(t,o,t.path,i)));return R.mergeArray(s,a)}get element(){return this._def.type}min(e,t){return new r(y(c({},this._def),{minLength:{value:e,message:p.toString(t)}}))}max(e,t){return new r(y(c({},this._def),{maxLength:{value:e,message:p.toString(t)}}))}length(e,t){return new r(y(c({},this._def),{exactLength:{value:e,message:p.toString(t)}}))}nonempty(e){return this.min(1,e)}};U.create=(r,e)=>new U(c({type:r,minLength:null,maxLength:null,exactLength:null,typeName:g.ZodArray},v(e)));function _e(r){if(r instanceof O){let e={};for(let t in r.shape){let s=r.shape[t];e[t]=E.create(_e(s))}return new O(y(c({},r._def),{shape:()=>e}))}else return r instanceof U?new U(y(c({},r._def),{type:_e(r.element)})):r instanceof E?E.create(_e(r.unwrap())):r instanceof L?L.create(_e(r.unwrap())):r instanceof $?$.create(r.items.map(e=>_e(e))):r}var O=class r extends x{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;let e=this._def.shape(),t=b.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==h.object){let l=this._getOrReturnCtx(e);return f(l,{code:d.invalid_type,expected:h.object,received:l.parsedType}),m}let{status:s,ctx:n}=this._processInputParams(e),{shape:a,keys:o}=this._getCached(),i=[];if(!(this._def.catchall instanceof P&&this._def.unknownKeys==="strip"))for(let l in n.data)o.includes(l)||i.push(l);let u=[];for(let l of o){let _=a[l],T=n.data[l];u.push({key:{status:"valid",value:l},value:_._parse(new j(n,T,n.path,l)),alwaysSet:l in n.data})}if(this._def.catchall instanceof P){let l=this._def.unknownKeys;if(l==="passthrough")for(let _ of i)u.push({key:{status:"valid",value:_},value:{status:"valid",value:n.data[_]}});else if(l==="strict")i.length>0&&(f(n,{code:d.unrecognized_keys,keys:i}),s.dirty());else if(l!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{let l=this._def.catchall;for(let _ of i){let T=n.data[_];u.push({key:{status:"valid",value:_},value:l._parse(new j(n,T,n.path,_)),alwaysSet:_ in n.data})}}return n.common.async?Promise.resolve().then(async()=>{let l=[];for(let _ of u){let T=await _.key,me=await _.value;l.push({key:T,value:me,alwaysSet:_.alwaysSet})}return l}).then(l=>R.mergeObjectSync(s,l)):R.mergeObjectSync(s,u)}get shape(){return this._def.shape()}strict(e){return p.errToObj,new r(c(y(c({},this._def),{unknownKeys:"strict"}),e!==void 0?{errorMap:(t,s)=>{var a,o,i,u;let n=(i=(o=(a=this._def).errorMap)==null?void 0:o.call(a,t,s).message)!=null?i:s.defaultError;return t.code==="unrecognized_keys"?{message:(u=p.errToObj(e).message)!=null?u:n}:{message:n}}}:{}))}strip(){return new r(y(c({},this._def),{unknownKeys:"strip"}))}passthrough(){return new r(y(c({},this._def),{unknownKeys:"passthrough"}))}extend(e){return new r(y(c({},this._def),{shape:()=>c(c({},this._def.shape()),e)}))}merge(e){return new r({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>c(c({},this._def.shape()),e._def.shape()),typeName:g.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new r(y(c({},this._def),{catchall:e}))}pick(e){let t={};for(let s of b.objectKeys(e))e[s]&&this.shape[s]&&(t[s]=this.shape[s]);return new r(y(c({},this._def),{shape:()=>t}))}omit(e){let t={};for(let s of b.objectKeys(this.shape))e[s]||(t[s]=this.shape[s]);return new r(y(c({},this._def),{shape:()=>t}))}deepPartial(){return _e(this)}partial(e){let t={};for(let s of b.objectKeys(this.shape)){let n=this.shape[s];e&&!e[s]?t[s]=n:t[s]=n.optional()}return new r(y(c({},this._def),{shape:()=>t}))}required(e){let t={};for(let s of b.objectKeys(this.shape))if(e&&!e[s])t[s]=this.shape[s];else{let a=this.shape[s];for(;a instanceof E;)a=a._def.innerType;t[s]=a}return new r(y(c({},this._def),{shape:()=>t}))}keyof(){return ft(b.objectKeys(this.shape))}};O.create=(r,e)=>new O(c({shape:()=>r,unknownKeys:"strip",catchall:P.create(),typeName:g.ZodObject},v(e)));O.strictCreate=(r,e)=>new O(c({shape:()=>r,unknownKeys:"strict",catchall:P.create(),typeName:g.ZodObject},v(e)));O.lazycreate=(r,e)=>new O(c({shape:r,unknownKeys:"strip",catchall:P.create(),typeName:g.ZodObject},v(e)));var ie=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),s=this._def.options;function n(a){for(let i of a)if(i.result.status==="valid")return i.result;for(let i of a)if(i.result.status==="dirty")return t.common.issues.push(...i.ctx.common.issues),i.result;let o=a.map(i=>new A(i.ctx.common.issues));return f(t,{code:d.invalid_union,unionErrors:o}),m}if(t.common.async)return Promise.all(s.map(async a=>{let o=y(c({},t),{common:y(c({},t.common),{issues:[]}),parent:null});return{result:await a._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(n);{let a,o=[];for(let u of s){let l=y(c({},t),{common:y(c({},t.common),{issues:[]}),parent:null}),_=u._parseSync({data:t.data,path:t.path,parent:l});if(_.status==="valid")return _;_.status==="dirty"&&!a&&(a={result:_,ctx:l}),l.common.issues.length&&o.push(l.common.issues)}if(a)return t.common.issues.push(...a.ctx.common.issues),a.result;let i=o.map(u=>new A(u));return f(t,{code:d.invalid_union,unionErrors:i}),m}}get options(){return this._def.options}};ie.create=(r,e)=>new ie(c({options:r,typeName:g.ZodUnion},v(e)));var B=r=>r instanceof ce?B(r.schema):r instanceof M?B(r.innerType()):r instanceof de?[r.value]:r instanceof ue?r.options:r instanceof le?b.objectValues(r.enum):r instanceof fe?B(r._def.innerType):r instanceof ne?[void 0]:r instanceof ae?[null]:r instanceof E?[void 0,...B(r.unwrap())]:r instanceof L?[null,...B(r.unwrap())]:r instanceof Ie||r instanceof pe?B(r.unwrap()):r instanceof he?B(r._def.innerType):[],Ze=class r extends x{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.object)return f(t,{code:d.invalid_type,expected:h.object,received:t.parsedType}),m;let s=this.discriminator,n=t.data[s],a=this.optionsMap.get(n);return a?t.common.async?a._parseAsync({data:t.data,path:t.path,parent:t}):a._parseSync({data:t.data,path:t.path,parent:t}):(f(t,{code:d.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[s]}),m)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,s){let n=new Map;for(let a of t){let o=B(a.shape[e]);if(!o.length)throw new Error("A discriminator value for key `".concat(e,"` could not be extracted from all schema options"));for(let i of o){if(n.has(i))throw new Error("Discriminator property ".concat(String(e)," has duplicate value ").concat(String(i)));n.set(i,a)}}return new r(c({typeName:g.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:n},v(s)))}};function qe(r,e){let t=Z(r),s=Z(e);if(r===e)return{valid:!0,data:r};if(t===h.object&&s===h.object){let n=b.objectKeys(e),a=b.objectKeys(r).filter(i=>n.indexOf(i)!==-1),o=c(c({},r),e);for(let i of a){let u=qe(r[i],e[i]);if(!u.valid)return{valid:!1};o[i]=u.data}return{valid:!0,data:o}}else if(t===h.array&&s===h.array){if(r.length!==e.length)return{valid:!1};let n=[];for(let a=0;a<r.length;a++){let o=r[a],i=e[a],u=qe(o,i);if(!u.valid)return{valid:!1};n.push(u.data)}return{valid:!0,data:n}}else return t===h.date&&s===h.date&&+r==+e?{valid:!0,data:r}:{valid:!1}}var oe=class extends x{_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=(a,o)=>{if(Me(a)||Me(o))return m;let i=qe(a.value,o.value);return i.valid?((Pe(a)||Pe(o))&&t.dirty(),{status:t.value,value:i.data}):(f(s,{code:d.invalid_intersection_types}),m)};return s.common.async?Promise.all([this._def.left._parseAsync({data:s.data,path:s.path,parent:s}),this._def.right._parseAsync({data:s.data,path:s.path,parent:s})]).then(([a,o])=>n(a,o)):n(this._def.left._parseSync({data:s.data,path:s.path,parent:s}),this._def.right._parseSync({data:s.data,path:s.path,parent:s}))}};oe.create=(r,e,t)=>new oe(c({left:r,right:e,typeName:g.ZodIntersection},v(t)));var $=class r extends x{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.array)return f(s,{code:d.invalid_type,expected:h.array,received:s.parsedType}),m;if(s.data.length<this._def.items.length)return f(s,{code:d.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),m;!this._def.rest&&s.data.length>this._def.items.length&&(f(s,{code:d.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let a=[...s.data].map((o,i)=>{let u=this._def.items[i]||this._def.rest;return u?u._parse(new j(s,o,s.path,i)):null}).filter(o=>!!o);return s.common.async?Promise.all(a).then(o=>R.mergeArray(t,o)):R.mergeArray(t,a)}get items(){return this._def.items}rest(e){return new r(y(c({},this._def),{rest:e}))}};$.create=(r,e)=>{if(!Array.isArray(r))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new $(c({items:r,typeName:g.ZodTuple,rest:null},v(e)))};var $e=class r extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.object)return f(s,{code:d.invalid_type,expected:h.object,received:s.parsedType}),m;let n=[],a=this._def.keyType,o=this._def.valueType;for(let i in s.data)n.push({key:a._parse(new j(s,i,s.path,i)),value:o._parse(new j(s,s.data[i],s.path,i)),alwaysSet:i in s.data});return s.common.async?R.mergeObjectAsync(t,n):R.mergeObjectSync(t,n)}get element(){return this._def.valueType}static create(e,t,s){return t instanceof x?new r(c({keyType:e,valueType:t,typeName:g.ZodRecord},v(s))):new r(c({keyType:q.create(),valueType:e,typeName:g.ZodRecord},v(t)))}},be=class extends x{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.map)return f(s,{code:d.invalid_type,expected:h.map,received:s.parsedType}),m;let n=this._def.keyType,a=this._def.valueType,o=[...s.data.entries()].map(([i,u],l)=>({key:n._parse(new j(s,i,s.path,[l,"key"])),value:a._parse(new j(s,u,s.path,[l,"value"]))}));if(s.common.async){let i=new Map;return Promise.resolve().then(async()=>{for(let u of o){let l=await u.key,_=await u.value;if(l.status==="aborted"||_.status==="aborted")return m;(l.status==="dirty"||_.status==="dirty")&&t.dirty(),i.set(l.value,_.value)}return{status:t.value,value:i}})}else{let i=new Map;for(let u of o){let l=u.key,_=u.value;if(l.status==="aborted"||_.status==="aborted")return m;(l.status==="dirty"||_.status==="dirty")&&t.dirty(),i.set(l.value,_.value)}return{status:t.value,value:i}}}};be.create=(r,e,t)=>new be(c({valueType:e,keyType:r,typeName:g.ZodMap},v(t)));var ke=class r extends x{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.parsedType!==h.set)return f(s,{code:d.invalid_type,expected:h.set,received:s.parsedType}),m;let n=this._def;n.minSize!==null&&s.data.size<n.minSize.value&&(f(s,{code:d.too_small,minimum:n.minSize.value,type:"set",inclusive:!0,exact:!1,message:n.minSize.message}),t.dirty()),n.maxSize!==null&&s.data.size>n.maxSize.value&&(f(s,{code:d.too_big,maximum:n.maxSize.value,type:"set",inclusive:!0,exact:!1,message:n.maxSize.message}),t.dirty());let a=this._def.valueType;function o(u){let l=new Set;for(let _ of u){if(_.status==="aborted")return m;_.status==="dirty"&&t.dirty(),l.add(_.value)}return{status:t.value,value:l}}let i=[...s.data.values()].map((u,l)=>a._parse(new j(s,u,s.path,l)));return s.common.async?Promise.all(i).then(u=>o(u)):o(i)}min(e,t){return new r(y(c({},this._def),{minSize:{value:e,message:p.toString(t)}}))}max(e,t){return new r(y(c({},this._def),{maxSize:{value:e,message:p.toString(t)}}))}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}};ke.create=(r,e)=>new ke(c({valueType:r,minSize:null,maxSize:null,typeName:g.ZodSet},v(e)));var Le=class r extends x{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.function)return f(t,{code:d.invalid_type,expected:h.function,received:t.parsedType}),m;function s(i,u){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ye(),z].filter(l=>!!l),issueData:{code:d.invalid_arguments,argumentsError:u}})}function n(i,u){return Oe({data:i,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,ye(),z].filter(l=>!!l),issueData:{code:d.invalid_return_type,returnTypeError:u}})}let a={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof X){let i=this;return S(async function(...u){let l=new A([]),_=await i._def.args.parseAsync(u,a).catch(Re=>{throw l.addIssue(s(u,Re)),l}),T=await Reflect.apply(o,this,_);return await i._def.returns._def.type.parseAsync(T,a).catch(Re=>{throw l.addIssue(n(T,Re)),l})})}else{let i=this;return S(function(...u){let l=i._def.args.safeParse(u,a);if(!l.success)throw new A([s(u,l.error)]);let _=Reflect.apply(o,this,l.data),T=i._def.returns.safeParse(_,a);if(!T.success)throw new A([n(_,T.error)]);return T.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new r(y(c({},this._def),{args:$.create(e).rest(F.create())}))}returns(e){return new r(y(c({},this._def),{returns:e}))}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,s){return new r(c({args:e||$.create([]).rest(F.create()),returns:t||F.create(),typeName:g.ZodFunction},v(s)))}},ce=class extends x{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}};ce.create=(r,e)=>new ce(c({getter:r,typeName:g.ZodLazy},v(e)));var de=class extends x{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:d.invalid_literal,expected:this._def.value}),m}return{status:"valid",value:e.data}}get value(){return this._def.value}};de.create=(r,e)=>new de(c({value:r,typeName:g.ZodLiteral},v(e)));function ft(r,e){return new ue(c({values:r,typeName:g.ZodEnum},v(e)))}var ue=class r extends x{_parse(e){if(typeof e.data!="string"){let t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{expected:b.joinValues(s),received:t.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){let t=this._getOrReturnCtx(e),s=this._def.values;return f(t,{received:t.data,code:d.invalid_enum_value,options:s}),m}return S(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return r.create(e,c(c({},this._def),t))}exclude(e,t=this._def){return r.create(this.options.filter(s=>!e.includes(s)),c(c({},this._def),t))}};ue.create=ft;var le=class extends x{_parse(e){let t=b.getValidEnumValues(this._def.values),s=this._getOrReturnCtx(e);if(s.parsedType!==h.string&&s.parsedType!==h.number){let n=b.objectValues(t);return f(s,{expected:b.joinValues(n),received:s.parsedType,code:d.invalid_type}),m}if(this._cache||(this._cache=new Set(b.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){let n=b.objectValues(t);return f(s,{received:s.data,code:d.invalid_enum_value,options:n}),m}return S(e.data)}get enum(){return this._def.values}};le.create=(r,e)=>new le(c({values:r,typeName:g.ZodNativeEnum},v(e)));var X=class extends x{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==h.promise&&t.common.async===!1)return f(t,{code:d.invalid_type,expected:h.promise,received:t.parsedType}),m;let s=t.parsedType===h.promise?t.data:Promise.resolve(t.data);return S(s.then(n=>this._def.type.parseAsync(n,{path:t.path,errorMap:t.common.contextualErrorMap})))}};X.create=(r,e)=>new X(c({type:r,typeName:g.ZodPromise},v(e)));var M=class extends x{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===g.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:s}=this._processInputParams(e),n=this._def.effect||null,a={addIssue:o=>{f(s,o),o.fatal?t.abort():t.dirty()},get path(){return s.path}};if(a.addIssue=a.addIssue.bind(a),n.type==="preprocess"){let o=n.transform(s.data,a);if(s.common.async)return Promise.resolve(o).then(async i=>{if(t.value==="aborted")return m;let u=await this._def.schema._parseAsync({data:i,path:s.path,parent:s});return u.status==="aborted"?m:u.status==="dirty"?H(u.value):t.value==="dirty"?H(u.value):u});{if(t.value==="aborted")return m;let i=this._def.schema._parseSync({data:o,path:s.path,parent:s});return i.status==="aborted"?m:i.status==="dirty"?H(i.value):t.value==="dirty"?H(i.value):i}}if(n.type==="refinement"){let o=i=>{let u=n.refinement(i,a);if(s.common.async)return Promise.resolve(u);if(u instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return i};if(s.common.async===!1){let i=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});return i.status==="aborted"?m:(i.status==="dirty"&&t.dirty(),o(i.value),{status:t.value,value:i.value})}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(i=>i.status==="aborted"?m:(i.status==="dirty"&&t.dirty(),o(i.value).then(()=>({status:t.value,value:i.value}))))}if(n.type==="transform")if(s.common.async===!1){let o=this._def.schema._parseSync({data:s.data,path:s.path,parent:s});if(!W(o))return m;let i=n.transform(o.value,a);if(i instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:i}}else return this._def.schema._parseAsync({data:s.data,path:s.path,parent:s}).then(o=>W(o)?Promise.resolve(n.transform(o.value,a)).then(i=>({status:t.value,value:i})):m);b.assertNever(n)}};M.create=(r,e,t)=>new M(c({schema:r,typeName:g.ZodEffects,effect:e},v(t)));M.createWithPreprocess=(r,e,t)=>new M(c({schema:e,effect:{type:"preprocess",transform:r},typeName:g.ZodEffects},v(t)));var E=class extends x{_parse(e){return this._getType(e)===h.undefined?S(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};E.create=(r,e)=>new E(c({innerType:r,typeName:g.ZodOptional},v(e)));var L=class extends x{_parse(e){return this._getType(e)===h.null?S(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}};L.create=(r,e)=>new L(c({innerType:r,typeName:g.ZodNullable},v(e)));var fe=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return t.parsedType===h.undefined&&(s=this._def.defaultValue()),this._def.innerType._parse({data:s,path:t.path,parent:t})}removeDefault(){return this._def.innerType}};fe.create=(r,e)=>new fe(c({innerType:r,typeName:g.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default},v(e)));var he=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),s=y(c({},t),{common:y(c({},t.common),{issues:[]})}),n=this._def.innerType._parse({data:s.data,path:s.path,parent:c({},s)});return ge(n)?n.then(a=>({status:"valid",value:a.status==="valid"?a.value:this._def.catchValue({get error(){return new A(s.common.issues)},input:s.data})})):{status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new A(s.common.issues)},input:s.data})}}removeCatch(){return this._def.innerType}};he.create=(r,e)=>new he(c({innerType:r,typeName:g.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch},v(e)));var we=class extends x{_parse(e){if(this._getType(e)!==h.nan){let s=this._getOrReturnCtx(e);return f(s,{code:d.invalid_type,expected:h.nan,received:s.parsedType}),m}return{status:"valid",value:e.data}}};we.create=r=>new we(c({typeName:g.ZodNaN},v(r)));var er=Symbol("zod_brand"),Ie=class extends x{_parse(e){let{ctx:t}=this._processInputParams(e),s=t.data;return this._def.type._parse({data:s,path:t.path,parent:t})}unwrap(){return this._def.type}},Ne=class r extends x{_parse(e){let{status:t,ctx:s}=this._processInputParams(e);if(s.common.async)return(async()=>{let a=await this._def.in._parseAsync({data:s.data,path:s.path,parent:s});return a.status==="aborted"?m:a.status==="dirty"?(t.dirty(),H(a.value)):this._def.out._parseAsync({data:a.value,path:s.path,parent:s})})();{let n=this._def.in._parseSync({data:s.data,path:s.path,parent:s});return n.status==="aborted"?m:n.status==="dirty"?(t.dirty(),{status:"dirty",value:n.value}):this._def.out._parseSync({data:n.value,path:s.path,parent:s})}}static create(e,t){return new r({in:e,out:t,typeName:g.ZodPipeline})}},pe=class extends x{_parse(e){let t=this._def.innerType._parse(e),s=n=>(W(n)&&(n.value=Object.freeze(n.value)),n);return ge(t)?t.then(n=>s(n)):s(t)}unwrap(){return this._def.innerType}};pe.create=(r,e)=>new pe(c({innerType:r,typeName:g.ZodReadonly},v(e)));function ct(r,e){let t=typeof r=="function"?r(e):typeof r=="string"?{message:r}:r;return typeof t=="string"?{message:t}:t}function ht(r,e={},t){return r?Y.create().superRefine((s,n)=>{var o,i;let a=r(s);if(a instanceof Promise)return a.then(u=>{var l,_;if(!u){let T=ct(e,s),me=(_=(l=T.fatal)!=null?l:t)!=null?_:!0;n.addIssue(y(c({code:"custom"},T),{fatal:me}))}});if(!a){let u=ct(e,s),l=(i=(o=u.fatal)!=null?o:t)!=null?i:!0;n.addIssue(y(c({code:"custom"},u),{fatal:l}))}}):Y.create()}var tr={object:O.lazycreate},g;(function(r){r.ZodString="ZodString",r.ZodNumber="ZodNumber",r.ZodNaN="ZodNaN",r.ZodBigInt="ZodBigInt",r.ZodBoolean="ZodBoolean",r.ZodDate="ZodDate",r.ZodSymbol="ZodSymbol",r.ZodUndefined="ZodUndefined",r.ZodNull="ZodNull",r.ZodAny="ZodAny",r.ZodUnknown="ZodUnknown",r.ZodNever="ZodNever",r.ZodVoid="ZodVoid",r.ZodArray="ZodArray",r.ZodObject="ZodObject",r.ZodUnion="ZodUnion",r.ZodDiscriminatedUnion="ZodDiscriminatedUnion",r.ZodIntersection="ZodIntersection",r.ZodTuple="ZodTuple",r.ZodRecord="ZodRecord",r.ZodMap="ZodMap",r.ZodSet="ZodSet",r.ZodFunction="ZodFunction",r.ZodLazy="ZodLazy",r.ZodLiteral="ZodLiteral",r.ZodEnum="ZodEnum",r.ZodEffects="ZodEffects",r.ZodNativeEnum="ZodNativeEnum",r.ZodOptional="ZodOptional",r.ZodNullable="ZodNullable",r.ZodDefault="ZodDefault",r.ZodCatch="ZodCatch",r.ZodPromise="ZodPromise",r.ZodBranded="ZodBranded",r.ZodPipeline="ZodPipeline",r.ZodReadonly="ZodReadonly"})(g||(g={}));var rr=(r,e={message:"Input not instance of ".concat(r.name)})=>ht(t=>t instanceof r,e),pt=q.create,mt=ee.create,sr=we.create,nr=te.create,yt=re.create,ar=se.create,ir=ve.create,or=ne.create,cr=ae.create,dr=Y.create,ur=F.create,lr=P.create,fr=xe.create,hr=U.create,pr=O.create,mr=O.strictCreate,yr=ie.create,gr=Ze.create,_r=oe.create,vr=$.create,xr=$e.create,br=be.create,kr=ke.create,wr=Le.create,Tr=ce.create,Rr=de.create,Cr=ue.create,Sr=le.create,Ar=X.create,Or=M.create,Ir=E.create,Nr=L.create,Er=M.createWithPreprocess,jr=Ne.create,Mr=()=>pt().optional(),Pr=()=>mt().optional(),Zr=()=>yt().optional(),$r={string:r=>q.create(y(c({},r),{coerce:!0})),number:r=>ee.create(y(c({},r),{coerce:!0})),boolean:r=>re.create(y(c({},r),{coerce:!0})),bigint:r=>te.create(y(c({},r),{coerce:!0})),date:r=>se.create(y(c({},r),{coerce:!0}))};var Lr=m;var Fs=Te.union([Te.enum(["low","medium","high","always-visible"]),Te.number()]);var De=5;var Dr=9,J=200,Ve=10;function gt(r,e,t,s,n,a,o="-1"){var Je,Qe;let i=1/0,u=1/0,l=-1/0,_=-1/0,T=new w(-Ve,0,5,t),me=new w(-Ve,0,e,5),Re=new w(e-5,0,e+Ve,t),vt=new w(0,t-5,e,t+Ve),xt=Vr(e,t,s,n,a),bt=[T,me,Re,vt],Ye=new w(-J,-J,e+J*2,t+J*2);for(let k of r){let D,Se;for(let I=0;I<k.bboxes.length;I++){if(k.bboxes[I]==null||(D=k.bboxes[I].boundingBox,Se=k.bboxes[I].index,k.lockedToStrategyIndex!==-1&&Se!==k.lockedToStrategyIndex))continue;let[je,N,K,Ke]=D,[G,kt,Ge,wt]=[k.y-je,k.y+N,k.x-K,k.x+Ke],ze=Ge,Be=G,He=wt-Ge,et=kt-G;i=Math.min(i,ze)-J,u=Math.min(u,Be)-J,l=Math.max(l,ze+He)+J,_=Math.max(_,Be+et)+J,k.bboxes[I].boundingRect=new w(ze,Be,He,et)}}let Ee=new Ae(new w(i,u,l-i,_-u)),Q={msgId:o,colliders:new Array(r.length),staticColliders:[],debug:[]},Xe=0;for(let k=0;k<r.length;k++){let D=r[k];((Qe=(Je=D.bboxes)==null?void 0:Je[0])==null?void 0:Qe.index)===Dr&&(Q.staticColliders.push(D.bboxes[0].boundingRect),Ee.insert(D.bboxes[0].boundingRect),Xe++)}r=r.slice(Xe,r.length);let Ce;for(let k=0;k<r.length;k++)if(Ce=r[k],Q.colliders[k]=[-1,0],Ce.enabledAndVisible){let[D,Se,I]=[1/0,-1,void 0];for(let{index:je,boundingRect:N}of Ce.bboxes){if(N==null)continue;let K=[];if(K=Ee.queryRect(N).filter(G=>N.intersects(G)),Ce.shouldCollideWithScreenEdges&&bt.forEach(G=>{N.intersects(G)&&K.push(G)}),N.intersects(xt)){Q.colliders[k]=[-1,0,N];break}if(K.length<=D&&(I=N,Se=je,D=K.length),K.length===0){Ee.insert(N),Q.colliders[k]=[je,Ye.contains(N)?0:1,N];break}}Ce.rank===De&&I!=null&&(Ee.insert(I),Q.colliders[k]=[Se,Ye.contains(I)?0:1,I])}else Q.colliders[k]=[-1,0];return Q}function Vr(r,e,t,s,n){switch(n){case"top-right":return new w(r-t,0,t,s);case"bottom-left":return new w(0,e-s,t,s);case"bottom-right":return new w(r-t,e-s,t,s);case"top-left":return new w(0,0,t,s)}}function _t(r){let e=r[0].map(t=>{let s=t[0].map(n=>({index:n[4],boundingBox:[n[0],n[1],n[2],n[3]]}));return{enabledAndVisible:t[1]===1,rank:t[2]===1?De:0,x:t[3],y:t[4],shouldCollideWithScreenEdges:t[5]===1,bboxes:s,lockedToStrategyIndex:t[6]}});return{msgId:"-1",totalWidth:r[3],totalHeight:r[2],watermarkWidth:r[4],watermarkHeight:r[5],watermarkPosition:r[6],colliders:e,devicePixelRatio:r[1]}}self.onmessage=r=>{let e=_t(r.data);self.postMessage(gt(e.colliders,e.totalWidth,e.totalHeight,e.watermarkWidth,e.watermarkHeight,e.watermarkPosition,e.msgId))};})();\n';b();b();b();b();b();function wc(o,r){return r.x+r.w<o.x+o.w&&r.x>o.x&&r.y>o.y&&r.y+r.h<o.y+o.h}l(wc,"contains");b();function Tc(o,r){let[e,t]=r;return e>=o.x&&e<=o.x+o.w&&t>=o.y&&t<=o.y+o.h}l(Tc,"intersectPoint");b();function Pc(o,r){let e=r.x,t=r.y,i=r.x+r.w,a=r.y+r.h,s=o.x,c=o.y,u=o.x+o.w,d=o.y+o.h;return e<u&&s<i&&t<d&&c<a}l(Pc,"intersects");b();function Ct(o,r){for(let e=0;e<r.length;e++)o.push(r[e])}l(Ct,"appendItems");b();var ha=class ha{constructor(r,e,t,i,a){h(this,"x");h(this,"y");h(this,"w");h(this,"h");h(this,"userData");this.userData=typeof a>"u"?null:a,this.x=r,this.y=e,this.w=t,this.h=i}contains(r){return r===this?!1:wc(this,r)}intersects(r){return Pc(this,r)}intersectsPoint(r){return Tc(this,r)}draw(r){r.fillStyle="rgba(123,222,26, 0.8)",r.fillRect(this.x,this.y,this.w,this.h)}};l(ha,"Rectangle");var K=ha;var tr=class tr{constructor(r,e){h(this,"topLeft");h(this,"topRight");h(this,"bottomLeft");h(this,"bottomRight");h(this,"divided",!1);h(this,"boundary");h(this,"capacity",16);h(this,"objects",[]);h(this,"parent");this.parent=e,this.boundary=r}getSize(){return this.divided?this.objects.length+this.topLeft.getSize()+this.topRight.getSize()+this.bottomLeft.getSize()+this.bottomRight.getSize():this.objects.length}subdivide(){let{x:r,y:e,w:t,h:i}=this.boundary;this.topLeft=new tr(new K(r,e,t/2,i/2),this),this.topRight=new tr(new K(r+t/2,e,t/2,i/2),this),this.bottomLeft=new tr(new K(r,e+i/2,t/2,i/2),this),this.bottomRight=new tr(new K(r+t/2,e+i/2,t/2,i/2),this),this.divided=!0}queryRect(r){let e=[];if(this.boundary.intersects(r))e.push(...this.objects);else return[];return this.divided&&(Ct(e,this.topLeft.queryRect(r)),Ct(e,this.topRight.queryRect(r)),Ct(e,this.bottomLeft.queryRect(r)),Ct(e,this.bottomRight.queryRect(r))),e}queryPoint(r){let e=[];if(this.boundary.intersectsPoint(r))e.push(...this.objects);else return[];return this.divided&&(Ct(e,this.topLeft.queryPoint(r)),Ct(e,this.topRight.queryPoint(r)),Ct(e,this.bottomLeft.queryPoint(r)),Ct(e,this.bottomRight.queryPoint(r))),e}insert(r){return(this.parent?!this.boundary.contains(r):!this.boundary.intersects(r))?!1:this.objects.length<this.capacity?(this.objects.push(r),!0):(this.divided||this.subdivide(),(this.topLeft.insert(r)||this.topRight.insert(r)||this.bottomLeft.insert(r)||this.bottomRight.insert(r))===!1&&this.objects.push(r),!0)}drawObjects(r){this.objects.forEach(e=>e.draw(r)),this.divided&&(this.topLeft.drawObjects(r),this.topRight.drawObjects(r),this.bottomLeft.drawObjects(r),this.bottomRight.drawObjects(r))}draw(r){r.rect(this.boundary.x,this.boundary.y,this.boundary.w,this.boundary.h),this.divided&&(this.topLeft.draw(r),this.topRight.draw(r),this.bottomLeft.draw(r),this.bottomRight.draw(r)),r.strokeStyle="black",r.lineWidth=4,r.stroke()}};l(tr,"QuadTree");var We=tr;b();function Ec(o,r,e){let t,i,a,s=null,c=0;e||(e={});let u=l(function(){c=e.leading===!1?0:Date.now(),s=null,a=o.apply(t,i),s||(t=i=null)},"later");return function(){let d=Date.now();!c&&e.leading===!1&&(c=d);let m=r-(d-c);return t=globalThis,i=arguments,m<=0||m>r?(s&&(clearTimeout(s),s=null),c=d,a=o.apply(t,i),s||(t=i=null)):!s&&e.trailing!==!1&&(s=setTimeout(u,m)),a}}l(Ec,"throttle");function Dc(o){let r=o[0].map(e=>{let t=e[0].map(i=>({index:i[4],boundingBox:[i[0],i[1],i[2],i[3]]}));return{enabledAndVisible:e[1]===1,rank:e[2]===1?Pr:0,x:e[3],y:e[4],shouldCollideWithScreenEdges:e[5]===1,bboxes:t,lockedToStrategyIndex:e[6]}});return{msgId:"-1",totalWidth:o[3],totalHeight:o[2],watermarkWidth:o[4],watermarkHeight:o[5],watermarkPosition:o[6],colliders:r,devicePixelRatio:o[1]}}l(Dc,"unpackMessage");b();var ua=9,Rt=200,In=10;function _c(o,r,e,t,i,a,s="-1"){var O,A;let c=1/0,u=1/0,d=-1/0,m=-1/0,g=new K(-In,0,5,e),M=new K(-In,0,r,5),p=new K(r-5,0,r+In,e),P=new K(0,e-5,r,e+In),E=xh(r,e,t,i,a),f=[g,M,p,P],y=new K(-Rt,-Rt,r+Rt*2,e+Rt*2);for(let I of o){let F,G;for(let R=0;R<I.bboxes.length;R++){if(I.bboxes[R]==null||(F=I.bboxes[R].boundingBox,G=I.bboxes[R].index,I.lockedToStrategyIndex!==-1&&G!==I.lockedToStrategyIndex))continue;let[Z,k,U,Q]=F,[$,ye,ce,ie]=[I.y-Z,I.y+k,I.x-U,I.x+Q],ne=ce,Se=$,me=ie-ce,Me=ye-$;c=Math.min(c,ne)-Rt,u=Math.min(u,Se)-Rt,d=Math.max(d,ne+me)+Rt,m=Math.max(m,Se+Me)+Rt,I.bboxes[R].boundingRect=new K(ne,Se,me,Me)}}let S=new We(new K(c,u,d-c,m-u)),v={msgId:s,colliders:new Array(o.length),staticColliders:[],debug:[]},x=0;for(let I=0;I<o.length;I++){let F=o[I];((A=(O=F.bboxes)==null?void 0:O[0])==null?void 0:A.index)===ua&&(v.staticColliders.push(F.bboxes[0].boundingRect),S.insert(F.bboxes[0].boundingRect),x++)}o=o.slice(x,o.length);let C;for(let I=0;I<o.length;I++)if(C=o[I],v.colliders[I]=[-1,0],C.enabledAndVisible){let[F,G,R]=[1/0,-1,void 0];for(let{index:Z,boundingRect:k}of C.bboxes){if(k==null)continue;let U=[];if(U=S.queryRect(k).filter($=>k.intersects($)),C.shouldCollideWithScreenEdges&&f.forEach($=>{k.intersects($)&&U.push($)}),k.intersects(E)){v.colliders[I]=[-1,0,k];break}if(U.length<=F&&(R=k,G=Z,F=U.length),U.length===0){S.insert(k),v.colliders[I]=[Z,y.contains(k)?0:1,k];break}}C.rank===Pr&&R!=null&&(S.insert(R),v.colliders[I]=[G,y.contains(R)?0:1,R])}else v.colliders[I]=[-1,0];return v}l(_c,"processColliders");function xh(o,r,e,t,i){switch(i){case"top-right":return new K(o-e,0,e,t);case"bottom-left":return new K(0,r-t,e,t);case"bottom-right":return new K(o-e,r-t,e,t);case"top-left":return new K(0,0,e,t)}}l(xh,"getWatermarkBoundary");b();var ma=class ma{constructor(){h(this,"onerror",l(()=>{},"onerror"));h(this,"onmessage",l(()=>{},"onmessage"));h(this,"postMessage",l(r=>{let e=Dc(r);this.onmessage({data:_c(e.colliders,e.totalWidth,e.totalHeight,e.watermarkWidth,e.watermarkHeight,e.watermarkPosition,e.msgId)})},"postMessage"));h(this,"terminate",l(()=>{},"terminate"))}};l(ma,"SyncWorker");var hi=ma;b();b();b();b();b();b();b();b();b();b();b();b();function pa(o){if(!o)throw new Error("coord is required");if(!Array.isArray(o)){if(o.type==="Feature"&&o.geometry!==null&&o.geometry.type==="Point")return o.geometry.coordinates;if(o.type==="Point")return o.coordinates}if(Array.isArray(o)&&o.length>=2&&!Array.isArray(o[0])&&!Array.isArray(o[1]))return o;throw new Error("coord must be GeoJSON Point or an Array of numbers")}l(pa,"getCoord");function rr(o){if(Array.isArray(o))return o;if(o.type==="Feature"){if(o.geometry!==null)return o.geometry.coordinates}else if(o.coordinates)return o.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}l(rr,"getCoords");function Ar(o){return o.type==="Feature"?o.geometry:o}l(Ar,"getGeom");function Ft(o,r,e){if(e===void 0&&(e={}),!o)throw new Error("point is required");if(!r)throw new Error("polygon is required");var t=pa(o),i=Ar(r),a=i.type,s=r.bbox,c=i.coordinates;if(s&&Sh(t,s)===!1)return!1;a==="Polygon"&&(c=[c]);for(var u=!1,d=0;d<c.length&&!u;d++)if(Ic(t,c[d][0],e.ignoreBoundary)){for(var m=!1,g=1;g<c[d].length&&!m;)Ic(t,c[d][g],!e.ignoreBoundary)&&(m=!0),g++;m||(u=!0)}return u}l(Ft,"booleanPointInPolygon");function Ic(o,r,e){var t=!1;r[0][0]===r[r.length-1][0]&&r[0][1]===r[r.length-1][1]&&(r=r.slice(0,r.length-1));for(var i=0,a=r.length-1;i<r.length;a=i++){var s=r[i][0],c=r[i][1],u=r[a][0],d=r[a][1],m=o[1]*(s-u)+c*(u-o[0])+d*(o[0]-s)===0&&(s-o[0])*(u-o[0])<=0&&(c-o[1])*(d-o[1])<=0;if(m)return!e;var g=c>o[1]!=d>o[1]&&o[0]<(u-s)*(o[1]-c)/(d-c)+s;g&&(t=!t)}return t}l(Ic,"inRing");function Sh(o,r){return r[0]<=o[0]&&r[1]<=o[1]&&r[2]>=o[0]&&r[3]>=o[1]}l(Sh,"inBBox");b();b();b();b();b();b();b();b();b();var fa="\xA9 Mappedin",Ph="https://info.mappedin.com/feedback",ya=["top-left","top-right","bottom-left","bottom-right"],Eh=640,Dh=l(()=>"<svg xmlns='http://www.w3.org/2000/svg' width='15' height='15' fill-rule='evenodd' viewBox='0 0 20 20'>\n <circle cx='10' cy='10' r='5.9' style='fill:rgba(255,255,255,1);'/>\n <path style='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'/>\n </svg>","getAttributionButtonIcon"),ga={custom:[],position:"bottom-right",feedback:!0},kr,ba=class ba{constructor(r,e={}){h(this,"controlContainerEl");h(this,"controlPositions");h(this,"compact");D(this,kr);h(this,"attribContainerEl");h(this,"attribInnerEl");h(this,"attribButtonEl");h(this,"feedbackLinkEl");h(this,"attribHTML",fa);h(this,"customAttributions",[]);h(this,"toggleAttribution",l(r=>{this.attribContainerEl!=null&&(r.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",""))))},"toggleAttribution"));L(this,kr,!!e.outdoorEnabled),this.controlContainerEl=document.createElement("div"),this.controlContainerEl.classList.add("mappedin-control-container"),r.appendChild(this.controlContainerEl),this.controlPositions=ya.reduce((t,i)=>{let a=document.createElement("div");return a.classList.add("mappedin-ctrl-".concat(i)),this.controlContainerEl.appendChild(a),t[i]=a,t},{})}addAttributionControl(r=ga){var i;let e=r.position&&ya.includes(r.position)?r.position:ga.position;this.attribContainerEl=document.createElement("details"),this.attribContainerEl.classList.add("mappedin-ctrl-attrib","mappedin-ctrl-attrib-".concat(e)),this.attribContainerEl.open=!0,this.attribContainerEl.ariaLabel="Attribution",this.controlPositions[e].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=Dh(),this.attribContainerEl.appendChild(this.attribButtonEl),this.attribInnerEl=document.createElement("div"),this.attribInnerEl.classList.add("mappedin-ctrl-attrib-inner"),this.attribHTML=n(this,kr)?fa:"",this.attribInnerEl.innerHTML=this.attribHTML,this.attribContainerEl.appendChild(this.attribInnerEl),((i=r.feedback)!=null?i:ga.feedback)&&(this.feedbackLinkEl=document.createElement("a"),this.feedbackLinkEl.href=Ph,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)),r.custom&&(this.customAttributions=r.custom),this.updateAttributionDisplay()}updateAttribution(r){if(!r.style||!this.attribInnerEl||!this.attribContainerEl)return;let e=n(this,kr)?[fa]:[],t=r.style.sourceCaches;for(let i in t){let a=t[i];if(a.used||a.usedForTerrain){let s=a.getSource();s.attribution&&e.indexOf(s.attribution)<0&&e.push(s.attribution)}}e=e.filter(i=>String(i).trim()),e=e.filter((i,a)=>{for(let s=a+1;s<e.length;s++)if(e[s].indexOf(i)>=0)return!1;return!0}),this.attribHTML=e.join(" "),this.updateAttributionDisplay()}updateAttributionDisplay(){let r=[...new Set([this.attribHTML,...this.customAttributions])].filter(Boolean).join(" ");this.attribInnerEl&&(this.attribInnerEl.innerHTML=r)}resizeAttribution(r){this.attribContainerEl&&(r<=Eh||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(r){this.resizeAttribution(r)}updateData(r){this.updateAttribution(r)}destroy(){this.destroyAttributionControl(),this.controlContainerEl.remove(),this.compact=void 0}};kr=new WeakMap,l(ba,"HTMLControlsSystem");var Ln=ba;b();b();var Xe=Object.freeze({Linear:Object.freeze({None:l(function(o){return o},"None"),In:l(function(o){return o},"In"),Out:l(function(o){return o},"Out"),InOut:l(function(o){return o},"InOut")}),Quadratic:Object.freeze({In:l(function(o){return o*o},"In"),Out:l(function(o){return o*(2-o)},"Out"),InOut:l(function(o){return(o*=2)<1?.5*o*o:-.5*(--o*(o-2)-1)},"InOut")}),Cubic:Object.freeze({In:l(function(o){return o*o*o},"In"),Out:l(function(o){return--o*o*o+1},"Out"),InOut:l(function(o){return(o*=2)<1?.5*o*o*o:.5*((o-=2)*o*o+2)},"InOut")}),Quartic:Object.freeze({In:l(function(o){return o*o*o*o},"In"),Out:l(function(o){return 1- --o*o*o*o},"Out"),InOut:l(function(o){return(o*=2)<1?.5*o*o*o*o:-.5*((o-=2)*o*o*o-2)},"InOut")}),Quintic:Object.freeze({In:l(function(o){return o*o*o*o*o},"In"),Out:l(function(o){return--o*o*o*o*o+1},"Out"),InOut:l(function(o){return(o*=2)<1?.5*o*o*o*o*o:.5*((o-=2)*o*o*o*o+2)},"InOut")}),Sinusoidal:Object.freeze({In:l(function(o){return 1-Math.sin((1-o)*Math.PI/2)},"In"),Out:l(function(o){return Math.sin(o*Math.PI/2)},"Out"),InOut:l(function(o){return .5*(1-Math.sin(Math.PI*(.5-o)))},"InOut")}),Exponential:Object.freeze({In:l(function(o){return o===0?0:Math.pow(1024,o-1)},"In"),Out:l(function(o){return o===1?1:1-Math.pow(2,-10*o)},"Out"),InOut:l(function(o){return o===0?0:o===1?1:(o*=2)<1?.5*Math.pow(1024,o-1):.5*(-Math.pow(2,-10*(o-1))+2)},"InOut")}),Circular:Object.freeze({In:l(function(o){return 1-Math.sqrt(1-o*o)},"In"),Out:l(function(o){return Math.sqrt(1- --o*o)},"Out"),InOut:l(function(o){return(o*=2)<1?-.5*(Math.sqrt(1-o*o)-1):.5*(Math.sqrt(1-(o-=2)*o)+1)},"InOut")}),Elastic:Object.freeze({In:l(function(o){return o===0?0:o===1?1:-Math.pow(2,10*(o-1))*Math.sin((o-1.1)*5*Math.PI)},"In"),Out:l(function(o){return o===0?0:o===1?1:Math.pow(2,-10*o)*Math.sin((o-.1)*5*Math.PI)+1},"Out"),InOut:l(function(o){return o===0?0:o===1?1:(o*=2,o<1?-.5*Math.pow(2,10*(o-1))*Math.sin((o-1.1)*5*Math.PI):.5*Math.pow(2,-10*(o-1))*Math.sin((o-1.1)*5*Math.PI)+1)},"InOut")}),Back:Object.freeze({In:l(function(o){var r=1.70158;return o===1?1:o*o*((r+1)*o-r)},"In"),Out:l(function(o){var r=1.70158;return o===0?0:--o*o*((r+1)*o+r)+1},"Out"),InOut:l(function(o){var r=2.5949095;return(o*=2)<1?.5*(o*o*((r+1)*o-r)):.5*((o-=2)*o*((r+1)*o+r)+2)},"InOut")}),Bounce:Object.freeze({In:l(function(o){return 1-Xe.Bounce.Out(1-o)},"In"),Out:l(function(o){return o<.36363636363636365?7.5625*o*o:o<.7272727272727273?7.5625*(o-=.5454545454545454)*o+.75:o<.9090909090909091?7.5625*(o-=.8181818181818182)*o+.9375:7.5625*(o-=.9545454545454546)*o+.984375},"Out"),InOut:l(function(o){return o<.5?Xe.Bounce.In(o*2)*.5:Xe.Bounce.Out(o*2-1)*.5+.5},"InOut")}),generatePow:l(function(o){return o===void 0&&(o=4),o=o<Number.EPSILON?Number.EPSILON:o,o=o>1e4?1e4:o,{In:l(function(r){return Math.pow(r,o)},"In"),Out:l(function(r){return 1-Math.pow(1-r,o)},"Out"),InOut:l(function(r){return r<.5?Math.pow(r*2,o)/2:(1-Math.pow(2-r*2,o))/2+.5},"InOut")}},"generatePow")}),ui=l(function(){return performance.now()},"now"),On=function(){function o(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];this._tweens={},this._tweensAddedDuringUpdate={},this.add.apply(this,r)}return l(o,"Group"),o.prototype.getAll=function(){var r=this;return Object.keys(this._tweens).map(function(e){return r._tweens[e]})},o.prototype.removeAll=function(){this._tweens={}},o.prototype.add=function(){for(var r,e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var i=0,a=e;i<a.length;i++){var s=a[i];(r=s._group)===null||r===void 0||r.remove(s),s._group=this,this._tweens[s.getId()]=s,this._tweensAddedDuringUpdate[s.getId()]=s}},o.prototype.remove=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];for(var t=0,i=r;t<i.length;t++){var a=i[t];a._group=void 0,delete this._tweens[a.getId()],delete this._tweensAddedDuringUpdate[a.getId()]}},o.prototype.allStopped=function(){return this.getAll().every(function(r){return!r.isPlaying()})},o.prototype.update=function(r,e){r===void 0&&(r=ui()),e===void 0&&(e=!0);var t=Object.keys(this._tweens);if(t.length!==0)for(;t.length>0;){this._tweensAddedDuringUpdate={};for(var i=0;i<t.length;i++){var a=this._tweens[t[i]],s=!e;a&&a.update(r,s)===!1&&!e&&this.remove(a)}t=Object.keys(this._tweensAddedDuringUpdate)}},o}(),Rr={Linear:l(function(o,r){var e=o.length-1,t=e*r,i=Math.floor(t),a=Rr.Utils.Linear;return r<0?a(o[0],o[1],t):r>1?a(o[e],o[e-1],e-t):a(o[i],o[i+1>e?e:i+1],t-i)},"Linear"),Bezier:l(function(o,r){for(var e=0,t=o.length-1,i=Math.pow,a=Rr.Utils.Bernstein,s=0;s<=t;s++)e+=i(1-r,t-s)*i(r,s)*o[s]*a(t,s);return e},"Bezier"),CatmullRom:l(function(o,r){var e=o.length-1,t=e*r,i=Math.floor(t),a=Rr.Utils.CatmullRom;return o[0]===o[e]?(r<0&&(i=Math.floor(t=e*(1+r))),a(o[(i-1+e)%e],o[i],o[(i+1)%e],o[(i+2)%e],t-i)):r<0?o[0]-(a(o[0],o[0],o[1],o[1],-t)-o[0]):r>1?o[e]-(a(o[e],o[e],o[e-1],o[e-1],t-e)-o[e]):a(o[i?i-1:0],o[i],o[e<i+1?e:i+1],o[e<i+2?e:i+2],t-i)},"CatmullRom"),Utils:{Linear:l(function(o,r,e){return(r-o)*e+o},"Linear"),Bernstein:l(function(o,r){var e=Rr.Utils.Factorial;return e(o)/e(r)/e(o-r)},"Bernstein"),Factorial:function(){var o=[1];return function(r){var e=1;if(o[r])return o[r];for(var t=r;t>1;t--)e*=t;return o[r]=e,e}}(),CatmullRom:l(function(o,r,e,t,i){var a=(e-o)*.5,s=(t-r)*.5,c=i*i,u=i*c;return(2*r-2*e+a+s)*u+(-3*r+3*e-2*a-s)*c+a*i+r},"CatmullRom")}},Oc=function(){function o(){}return l(o,"Sequence"),o.nextId=function(){return o._nextId++},o._nextId=0,o}(),va=new On,Ac=function(){function o(r,e){this._isPaused=!1,this._pauseStart=0,this._valuesStart={},this._valuesEnd={},this._valuesStartRepeat={},this._duration=1e3,this._isDynamic=!1,this._initialRepeat=0,this._repeat=0,this._yoyo=!1,this._isPlaying=!1,this._reversed=!1,this._delayTime=0,this._startTime=0,this._easingFunction=Xe.Linear.None,this._interpolationFunction=Rr.Linear,this._chainedTweens=[],this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._id=Oc.nextId(),this._isChainStopped=!1,this._propertiesAreSetUp=!1,this._goToEnd=!1,this._object=r,typeof e=="object"?(this._group=e,e.add(this)):e===!0&&(this._group=va,va.add(this))}return l(o,"Tween"),o.prototype.getId=function(){return this._id},o.prototype.isPlaying=function(){return this._isPlaying},o.prototype.isPaused=function(){return this._isPaused},o.prototype.getDuration=function(){return this._duration},o.prototype.to=function(r,e){if(e===void 0&&(e=1e3),this._isPlaying)throw new Error("Can not call Tween.to() while Tween is already started or paused. Stop the Tween first.");return this._valuesEnd=r,this._propertiesAreSetUp=!1,this._duration=e<0?0:e,this},o.prototype.duration=function(r){return r===void 0&&(r=1e3),this._duration=r<0?0:r,this},o.prototype.dynamic=function(r){return r===void 0&&(r=!1),this._isDynamic=r,this},o.prototype.start=function(r,e){if(r===void 0&&(r=ui()),e===void 0&&(e=!1),this._isPlaying)return this;if(this._repeat=this._initialRepeat,this._reversed){this._reversed=!1;for(var t in this._valuesStartRepeat)this._swapEndStartRepeatValues(t),this._valuesStart[t]=this._valuesStartRepeat[t]}if(this._isPlaying=!0,this._isPaused=!1,this._onStartCallbackFired=!1,this._onEveryStartCallbackFired=!1,this._isChainStopped=!1,this._startTime=r,this._startTime+=this._delayTime,!this._propertiesAreSetUp||e){if(this._propertiesAreSetUp=!0,!this._isDynamic){var i={};for(var a in this._valuesEnd)i[a]=this._valuesEnd[a];this._valuesEnd=i}this._setupProperties(this._object,this._valuesStart,this._valuesEnd,this._valuesStartRepeat,e)}return this},o.prototype.startFromCurrentValues=function(r){return this.start(r,!0)},o.prototype._setupProperties=function(r,e,t,i,a){for(var s in t){var c=r[s],u=Array.isArray(c),d=u?"array":typeof c,m=!u&&Array.isArray(t[s]);if(!(d==="undefined"||d==="function")){if(m){var g=t[s];if(g.length===0)continue;for(var M=[c],p=0,P=g.length;p<P;p+=1){var E=this._handleRelativeValue(c,g[p]);if(isNaN(E)){m=!1,console.warn("Found invalid interpolation list. Skipping.");break}M.push(E)}m&&(t[s]=M)}if((d==="object"||u)&&c&&!m){e[s]=u?[]:{};var f=c;for(var y in f)e[s][y]=f[y];i[s]=u?[]:{};var g=t[s];if(!this._isDynamic){var S={};for(var y in g)S[y]=g[y];t[s]=g=S}this._setupProperties(f,e[s],g,i[s],a)}else(typeof e[s]>"u"||a)&&(e[s]=c),u||(e[s]*=1),m?i[s]=t[s].slice().reverse():i[s]=e[s]||0}}},o.prototype.stop=function(){return this._isChainStopped||(this._isChainStopped=!0,this.stopChainedTweens()),this._isPlaying?(this._isPlaying=!1,this._isPaused=!1,this._onStopCallback&&this._onStopCallback(this._object),this):this},o.prototype.end=function(){return this._goToEnd=!0,this.update(this._startTime+this._duration),this},o.prototype.pause=function(r){return r===void 0&&(r=ui()),this._isPaused||!this._isPlaying?this:(this._isPaused=!0,this._pauseStart=r,this)},o.prototype.resume=function(r){return r===void 0&&(r=ui()),!this._isPaused||!this._isPlaying?this:(this._isPaused=!1,this._startTime+=r-this._pauseStart,this._pauseStart=0,this)},o.prototype.stopChainedTweens=function(){for(var r=0,e=this._chainedTweens.length;r<e;r++)this._chainedTweens[r].stop();return this},o.prototype.group=function(r){return r?(r.add(this),this):(console.warn("tween.group() without args has been removed, use group.add(tween) instead."),this)},o.prototype.remove=function(){var r;return(r=this._group)===null||r===void 0||r.remove(this),this},o.prototype.delay=function(r){return r===void 0&&(r=0),this._delayTime=r,this},o.prototype.repeat=function(r){return r===void 0&&(r=0),this._initialRepeat=r,this._repeat=r,this},o.prototype.repeatDelay=function(r){return this._repeatDelayTime=r,this},o.prototype.yoyo=function(r){return r===void 0&&(r=!1),this._yoyo=r,this},o.prototype.easing=function(r){return r===void 0&&(r=Xe.Linear.None),this._easingFunction=r,this},o.prototype.interpolation=function(r){return r===void 0&&(r=Rr.Linear),this._interpolationFunction=r,this},o.prototype.chain=function(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return this._chainedTweens=r,this},o.prototype.onStart=function(r){return this._onStartCallback=r,this},o.prototype.onEveryStart=function(r){return this._onEveryStartCallback=r,this},o.prototype.onUpdate=function(r){return this._onUpdateCallback=r,this},o.prototype.onRepeat=function(r){return this._onRepeatCallback=r,this},o.prototype.onComplete=function(r){return this._onCompleteCallback=r,this},o.prototype.onStop=function(r){return this._onStopCallback=r,this},o.prototype.update=function(r,e){var t=this,i;if(r===void 0&&(r=ui()),e===void 0&&(e=o.autoStartOnUpdate),this._isPaused)return!0;var a;if(!this._goToEnd&&!this._isPlaying)if(e)this.start(r,!0);else return!1;if(this._goToEnd=!1,r<this._startTime)return!0;this._onStartCallbackFired===!1&&(this._onStartCallback&&this._onStartCallback(this._object),this._onStartCallbackFired=!0),this._onEveryStartCallbackFired===!1&&(this._onEveryStartCallback&&this._onEveryStartCallback(this._object),this._onEveryStartCallbackFired=!0);var s=r-this._startTime,c=this._duration+((i=this._repeatDelayTime)!==null&&i!==void 0?i:this._delayTime),u=this._duration+this._repeat*c,d=l(function(){if(t._duration===0||s>u)return 1;var E=Math.trunc(s/c),f=s-E*c,y=Math.min(f/t._duration,1);return y===0&&s===t._duration?1:y},"calculateElapsedPortion"),m=d(),g=this._easingFunction(m);if(this._updateProperties(this._object,this._valuesStart,this._valuesEnd,g),this._onUpdateCallback&&this._onUpdateCallback(this._object,m),this._duration===0||s>=this._duration)if(this._repeat>0){var M=Math.min(Math.trunc((s-this._duration)/c)+1,this._repeat);isFinite(this._repeat)&&(this._repeat-=M);for(a in this._valuesStartRepeat)!this._yoyo&&typeof this._valuesEnd[a]=="string"&&(this._valuesStartRepeat[a]=this._valuesStartRepeat[a]+parseFloat(this._valuesEnd[a])),this._yoyo&&this._swapEndStartRepeatValues(a),this._valuesStart[a]=this._valuesStartRepeat[a];return this._yoyo&&(this._reversed=!this._reversed),this._startTime+=c*M,this._onRepeatCallback&&this._onRepeatCallback(this._object),this._onEveryStartCallbackFired=!1,!0}else{this._onCompleteCallback&&this._onCompleteCallback(this._object);for(var p=0,P=this._chainedTweens.length;p<P;p++)this._chainedTweens[p].start(this._startTime+this._duration,!1);return this._isPlaying=!1,!1}return!0},o.prototype._updateProperties=function(r,e,t,i){for(var a in t)if(e[a]!==void 0){var s=e[a]||0,c=t[a],u=Array.isArray(r[a]),d=Array.isArray(c),m=!u&&d;m?r[a]=this._interpolationFunction(c,i):typeof c=="object"&&c?this._updateProperties(r[a],s,c,i):(c=this._handleRelativeValue(s,c),typeof c=="number"&&(r[a]=s+(c-s)*i))}},o.prototype._handleRelativeValue=function(r,e){return typeof e!="string"?e:e.charAt(0)==="+"||e.charAt(0)==="-"?r+parseFloat(e):parseFloat(e)},o.prototype._swapEndStartRepeatValues=function(r){var e=this._valuesStartRepeat[r],t=this._valuesEnd[r];typeof t=="string"?this._valuesStartRepeat[r]=this._valuesStartRepeat[r]+parseFloat(t):this._valuesStartRepeat[r]=this._valuesEnd[r],this._valuesEnd[r]=e},o.autoStartOnUpdate=!1,o}();var Xg=Oc.nextId,ut=va,Yg=ut.getAll.bind(ut),qg=ut.removeAll.bind(ut),$g=ut.add.bind(ut),Jg=ut.remove.bind(ut),Kg=ut.update.bind(ut);b();b();b();b();b();var kc=l((o,r)=>(r-o+Math.PI)%(Math.PI*2)+Math.PI*2%(Math.PI*2)-Math.PI,"differenceBetweenAngles"),Rc=l((o,r)=>new Y(o.clientX-r.offsetLeft,o.clientY-r.offsetTop),"getTouchPos"),xa=l((o,r)=>Math.atan2(r.y-o.y,r.x-o.x),"angle"),mi=l((o,r)=>Math.sqrt((r.y-o.y)**2+(r.x-o.x)**2),"distance"),Sa=l((o,r)=>new Y((o.x+r.x)/2,(o.y+r.y)/2),"average"),Ma=l(o=>{let r=0,{wheelDelta:e,detail:t}=o;return e!==void 0?r=e:t!==void 0&&(r=-t),r},"getScrollDelta");var Ca=class Ca{constructor(r,e){h(this,"input1");h(this,"input2");h(this,"lastAngle");h(this,"lastDistance");h(this,"totalDistance");h(this,"first");h(this,"second");this.input1=r,this.input2=e,this.lastAngle=xa(r,e),this.lastDistance=mi(r,e),this.totalDistance=0,this.first=r,this.second=e}update(r,e){let t=mi(r,e);this.input1=r,this.input2=e;let i=xa(r,e);this.lastAngle=i,this.lastDistance=t,this.totalDistance+=(mi(this.first,r)+mi(this.second,e))/2,this.first=Sa(this.first,r),this.second=Sa(this.second,e)}};l(Ca,"InputSet");var An=Ca;b();var wa=class wa{constructor(r,e,t){h(this,"touch");h(this,"camera");h(this,"cameraPlane");h(this,"viewCoordinate");h(this,"snapHolderMatrix");h(this,"snapCamera");h(this,"cameraPosition");h(this,"raycaster");h(this,"worldCoordinate");h(this,"snapshotted",!1);this.touch=r,this.camera=e,this.cameraPlane=t,this.viewCoordinate={x:r.x,y:r.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 r=new Y(this.viewCoordinate.x,this.viewCoordinate.y);this.raycaster=this.raycaster||new st,this.raycaster.setFromCamera(r,this.snapCamera);let e=this.raycaster.intersectObject(this.cameraPlane,!0);this.worldCoordinate=e&&e.length>0?e[0].point:null,this.snapshotted=!0}updateAnchorState(r,e){this.camera=r,this.snapCamera=r.clone(),this.snapHolderMatrix=r.matrixWorld.clone(),this.updateViewCoordinate(e),this.snapshotCameraState()}updateViewCoordinate(r){this.viewCoordinate={x:r.x,y:r.y}}reUnproject(){var t,i;let r=new Y(this.viewCoordinate.x,this.viewCoordinate.y);(t=this.raycaster)==null||t.setFromCamera(r,this.snapCamera);let e=(i=this.raycaster)==null?void 0:i.intersectObject(this.cameraPlane,!0)[0];return e?e.point:void 0}};l(wa,"TouchAnchor");var pi=wa;var Ye={};gh(Ye,{BLOCK_MERCATOR_ZOOM_LEVEL:()=>Ih,CLIPPING_RADIUS:()=>fi,CONTROL_OPTIONS:()=>_h,DEFAULT_ANIMATION_DURATION:()=>_a,DEFAULT_BEARING:()=>Rh,DEFAULT_MAX_ZOOM_LEVEL:()=>Ah,DEFAULT_MIN_ZOOM_LEVEL:()=>Ia,DEFAULT_PITCH:()=>kh,DEFAULT_ZOOM_LEVEL:()=>Oh,EVENTS:()=>Nn,MAPLIBRE_TILE_SIZE:()=>kn,MAX_LAT:()=>Pa,MAX_MERCATOR_ZOOM_LEVEL:()=>Fn,MIN_LAT:()=>Ta,MIN_MERCATOR_ZOOM_LEVEL:()=>Rn,ROOM_MERCATOR_ZOOM_LEVEL:()=>Lh,TWO_PI:()=>Ea,WHEEL_ZOOM_MULTIPLIER:()=>Da,ZRANGE:()=>Fr});b();var kn=512,Ta=-85.051129,Pa=85.051129,fi=1e4,_h={chain:"chain",cancel:"cancel"},Ea=Math.PI*2,Fr=100,Da=1e4,Rn=0,Fn=24,Ih=17,Lh=20,_a=200,Nn=["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"],Oh=18,Ia=12,Ah=22,kh=0,Rh=0;var Gn=!1,Fh=!1;var Bn,zn=class zn extends J{constructor(e,t,i,a,s){super();h(this,"dirty",!1);h(this,"zoomDirty",!1);h(this,"rotationDirty",!1);h(this,"panDirty",!1);h(this,"stateDirty",!1);D(this,Bn,Ia);h(this,"zoomSpeed",5);h(this,"rotateSpeed",100);h(this,"enabled",!0);h(this,"enableZoom",!0);h(this,"enablePan",!0);h(this,"enablePedestal",!1);h(this,"maxPedestal",1/0);h(this,"minPedestal",0);h(this,"enableRotate",!0);h(this,"minZoomAltitude",0);h(this,"maxZoomAltitude",1/0);h(this,"ignoreZoomLimits",!1);h(this,"zoomFactor",1);h(this,"panBounds",{min:new B(1/0,1/0),max:new B(-1/0,-1/0),center:new B(0,0,0),radius:1/0});h(this,"minTilt",0);h(this,"maxTilt",1.2);h(this,"MOUSE_BUTTONS",{ORBIT:an.RIGHT,ZOOM:an.MIDDLE,PAN:an.LEFT});h(this,"camera");h(this,"scene");h(this,"renderer");h(this,"elevation");h(this,"orbit");h(this,"cameraPlane");h(this,"raycaster",new st);h(this,"rendererState");h(this,"options");h(this,"state",-1);h(this,"intersection");h(this,"viewState",null);h(this,"tweens",new Map);h(this,"clock",new gl(!0));h(this,"coords",{mouse:new Y,rotateStart:new Y,rotateEnd:new Y,rotateDelta:new Y,panStart:new B,panCameraStart:new B,panEnd:new B,panDelta:new B,initialShiftPos:new Y,initialPedestal:0,floorAnchor:new B});h(this,"touch",{origin:{offsetLeft:0,offsetTop:0},touches:[],anchor1:null,anchor2:null,inputs:null});h(this,"scrollTimer",null);h(this,"lastWheelTime",0);h(this,"resetZoom",!1);h(this,"zoomStart");h(this,"pedestalScaleFactor",1);h(this,"isUserZooming",!1);h(this,"stayInsideBounds",!0);h(this,"userInteracting",!1);h(this,"cameraMoving",!1);h(this,"lastCameraMoveTime",Date.now());h(this,"raycastToFloor",l(e=>{this.raycaster.setFromCamera(e,this.camera);let t=this.raycaster.intersectObject(this.cameraPlane,!1)[0];return t?t.point:new B},"raycastToFloor"));h(this,"isUserInteracting",l(()=>this.userInteracting,"isUserInteracting"));h(this,"getPosition",l(()=>new B(this.orbit.position.x,this.orbit.position.y,this.orbit.position.z),"getPosition"));h(this,"getPedestal",l(()=>this.orbit.position.z,"getPedestal"));h(this,"pan",l((e,t)=>{isNaN(e)||isNaN(t)||(this.setPosition(this.orbit.position.x+e,this.orbit.position.y+t),this.publish("position-updated"))},"pan"));h(this,"postRender",l(()=>{(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"))},"postRender"));h(this,"isCameraMoving",l(()=>this.cameraMoving,"isCameraMoving"));h(this,"lastCameraStoppedMovingTime",l(()=>this.lastCameraMoveTime,"lastCameraStoppedMovingTime"));h(this,"setPosition",l((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)},"setPosition"));h(this,"updateCameraPosition",l((e,t)=>{let i=e-this.panBounds.center.x,a=t-this.panBounds.center.y,s=Math.sqrt(i*i+a*a);if(this.stayInsideBounds&&s>this.panBounds.radius){let c=Math.atan2(a,i),u={x:Math.cos(c)*this.panBounds.radius+this.panBounds.center.x,y:Math.sin(c)*this.panBounds.radius+this.panBounds.center.y};this.orbit.position.x=u.x,this.orbit.position.y=u.y}else this.orbit.position.x=e,this.orbit.position.y=t},"updateCameraPosition"));h(this,"tilt",l(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},"tilt"));h(this,"zoomIn",l((e,t,i)=>{let a=this.getZoomAltitude();this.animateCamera({zoom:a/1.5},e,t,i)},"zoomIn"));h(this,"zoomOut",l((e,t,i)=>{let a=this.getZoomAltitude();this.animateCamera({zoom:a*1.5},e,t,i)},"zoomOut"));h(this,"getRotation",l(()=>(-this.orbit.rotation.z+Math.PI*2)%(Math.PI*2),"getRotation"));h(this,"cancelAnimation",l(()=>{let e=Array.from(this.tweens.keys()),t=e[e.length-1];t.state===7&&this.publish("multi-cancel",{zooming:!0,rotating:!0,tilting:!0}),this.completeTween(t)},"cancelAnimation"));h(this,"animateCamera",l((e,t,i,a,s,c)=>{let u=ee({interruptible:!0},c),d={},m={},g=this.getPosition();if(e.position!=null&&(e.position.x!==void 0&&(d.x=g.x,m.x=e.position.x),e.position.y!==void 0&&(d.y=g.y,m.y=e.position.y),e.position.z!==void 0&&(d.z=g.z,m.z=e.position.z)),e.zoom!==void 0&&(d.zoom=this.stayInsideBounds?Math.min(Math.max(this.getZoomAltitude(),this.getZoomScaledMin()),this.getZoomScaledMax()):this.getZoomAltitude(),this.viewState==="multi_floor"||!this.stayInsideBounds?m.zoom=e.zoom:m.zoom=Math.min(Math.max(e.zoom,this.getZoomScaledMin()),this.getZoomScaledMax())),e.rotation!==void 0){let{start:v,end:x}=Tl(this.getRotation(),e.rotation);d.rotation=v,m.rotation=x}e.tilt!==void 0&&(d.tilt=this.getTilt(),this.viewState==="multi_floor"||!this.stayInsideBounds?m.tilt=e.tilt:m.tilt=Math.max(Math.min(e.tilt,this.maxTilt),this.minTilt));let M=d.zoom!==m.zoom,p=d.rotation!==m.rotation,P=d.tilt!==m.tilt,E=new Ac(d).to(m,_.env.TESTING?0:t).onUpdate(v=>{this.setMulti({x:v.x,y:v.y,z:v.z},v.zoom,v.rotation,v.tilt)}).onComplete(()=>{this.completeTween(E),this.publish("multi-end",{zooming:M,rotating:p,tilting:P}),a&&a()}).onStart(()=>{this.state!==7&&(this.state=7,E.state=7,this.publish("multi-start",{zooming:M,rotating:p,tilting:P})),this.publish("change")});this.rendererState.internalTweenGroup.add(E);let f=Array.from(this.tweens.entries()),y=f[f.length-1],S=!1;return y!=null&&(y[1].interruptible?(typeof y[1].cancelledCallback=="function"&&y[1].cancelledCallback(),this.completeTween(y[0])):(S=!0,y[0].chain(E))),this.tweens.set(E,{cancelledCallback:s,interruptible:u.interruptible}),i?E.easing(i):E.easing(Xe.Quadratic.In),!e.doNotAutoStart&&!S&&(E.start(),this.publish("change")),E.cameraAnimation=!0,E},"animateCamera"));h(this,"setMulti",l((e,t,i,a,s=!0)=>{this.state===-1&&this.publish("multi-start");let c=!1;e!=null&&(e.x!==void 0&&!isNaN(e.x)&&e.y!==void 0&&!isNaN(e.y)&&(this.updateCameraPosition(e.x,e.y),c=!0),e.z!==void 0&&!isNaN(e.z)&&(this.setPedestal(e.z,!0,!1),c=!0)),c&&this.publish("position-updated");let u={zooming:!1,tilting:!!t,rotating:!1};if(t!==void 0&&!isNaN(t)){let d=this.stayInsideBounds?Math.min(Math.max(t,this.getZoomScaledMin()),this.getZoomScaledMax()):t;d!==this.camera.position.z&&(u.zooming=!0,this.camera.position.z=d,this.publish("zoom-updated"),this.zoomDirty=!0,this.viewState==="multi_floor"?t>fi&&(this.camera.near=t-fi,this.camera.far=t+fi):(this.camera.near=t/Fr,this.camera.far=t*Fr),this.camera.updateProjectionMatrix())}if(i!==void 0&&!isNaN(i)&&i!==this.getRotation()&&(u.rotating=!0,this.orbit.rotation.z=-i,this.publish("rotation-updated")),a!==void 0&&!isNaN(a)){let d=this.stayInsideBounds?Math.max(Math.min(a,this.maxTilt),this.minTilt):a;d!==this.elevation.rotation.x&&(u.tilting=!0,this.elevation.rotation.x=d,this.publish("tilt-updated"))}s&&this.publish("change"),this.state===-1&&this.publish("multi-end",u),this.stateDirty=!0},"setMulti"));h(this,"getZoomScaledMin",l(()=>this.minZoomAltitude*this.zoomFactor,"getZoomScaledMin"));h(this,"getZoomScaledMax",l(()=>{let e=this.minZoomAltitude*this.zoomFactor;return Math.max(this.maxZoomAltitude,e)},"getZoomScaledMax"));h(this,"setRotation",l((e,t)=>{if(isNaN(e))return;this.state===-1&&!t&&this.publish("rotate-start");let i=-(e%Ea);i!==this.orbit.rotation.z&&(this.orbit.rotation.z=i,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)},"setRotation"));h(this,"setZoomAltitude",l(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/Fr,this.camera.far=t*Fr,this.camera.updateProjectionMatrix(),this.publish("change"),this.state===-1&&this.publish("zoom-end"),this.dirty=!0,this.stateDirty=!0},"setZoomAltitude"));h(this,"setZoomLevel",l(e=>{this.setZoomAltitude(this.convertZoomLevelToAltitude(e))},"setZoomLevel"));h(this,"getZoomAltitude",l(()=>this.camera.position.z,"getZoomAltitude"));h(this,"getZoomLevel",l(()=>this.convertAltitudeToZoomLevel(this.getZoomAltitude()),"getZoomLevel"));h(this,"setTilt",l((e,t)=>{if(isNaN(e))return;this.state===-1&&!t&&this.publish("rotate-start");let i=this.stayInsideBounds?Math.max(Math.min(e,this.maxTilt),this.minTilt):e;i!==this.elevation.rotation.x&&(this.elevation.rotation.x=i,t||this.publish("tilt-updated")),t||this.publish("change"),this.state===-1&&!t&&this.publish("rotate-end"),this.dirty=!0,t||(this.stateDirty=!0)},"setTilt"));h(this,"getTilt",l(()=>this.elevation.rotation.x,"getTilt"));h(this,"setCameraPlaneElevation",l(e=>{this.cameraPlane.position.z=e},"setCameraPlaneElevation"));h(this,"zoom",l(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},"zoom"));h(this,"getProjectionScaleFactor",l((e,t,i)=>ra(e,t,i),"getProjectionScaleFactor"));h(this,"update",l(()=>{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())},"update"));h(this,"setPedestal",l((e,t=!1,i=!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,i&&(this.stateDirty=!0))},"setPedestal"));h(this,"dispose",l(()=>{for(let e of Nn)e.endsWith("start")?(this.off(e,this.setCameraMoving),e.startsWith("user")&&this.off(e,this.setUserInteracting)):(e.endsWith("end")||e.endsWith("cancel"))&&(this.off(e,this.unsetCameraMoving),e.startsWith("user")&&this.off(e,this.unsetUserInteracting));this.removeEventListeners(),this.scene.remove(this.cameraPlane),this.destroy()},"dispose"));h(this,"createCameraPlane",l(()=>{let e=Gn?2e3:1e10,t=Gn?100:1,i=new xt(e,e,t,t),a=new je({color:0,wireframe:Gn,visible:Gn}),s=new te(i,a);return this.scene.add(s),s},"createCameraPlane"));h(this,"addEventListeners",l(()=>{let{domElement:e}=this.renderer;for(let t of Nn)t.endsWith("start")?(this.on(t,this.setCameraMoving),t.startsWith("user")&&this.on(t,this.setUserInteracting)):(t.endsWith("end")||t.endsWith("cancel"))&&(this.on(t,this.unsetCameraMoving),t.startsWith("user")&&this.on(t,this.unsetUserInteracting));e.addEventListener("contextmenu",this.onContextMenu,!1),e.addEventListener("mousedown",this.onMouseDown,!1),e.addEventListener("wheel",this.onMouseWheel,{passive:!1}),e.addEventListener("touchstart",this.onTouchStart,!1),e.addEventListener("touchend",this.onTouchEnd,!1),e.addEventListener("touchmove",this.onTouchMove,!1)},"addEventListeners"));h(this,"addMouseEventListeners",l(()=>{this.addMouseMoveEventListeners(),window.addEventListener("mouseup",this.onMouseUp,!1),window.addEventListener("mouseout",this.onMouseUp,!1)},"addMouseEventListeners"));h(this,"addMouseMoveEventListeners",l(()=>{this.renderer.domElement.addEventListener("mousemove",this.onMouseMove,!1)},"addMouseMoveEventListeners"));h(this,"removeMouseMoveEventListeners",l(()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1)},"removeMouseMoveEventListeners"));h(this,"removeEventListeners",l(()=>{let{domElement:e}=this.renderer;e.removeEventListener("contextmenu",this.onContextMenu,!1),e.removeEventListener("mousedown",this.onMouseDown,!1),e.removeEventListener("wheel",this.onMouseWheel,!1),e.removeEventListener("touchstart",this.onTouchStart,!1),e.removeEventListener("touchend",this.onTouchEnd,!1),e.removeEventListener("touchmove",this.onTouchMove,!1),e.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)},"removeEventListeners"));h(this,"removeMouseUpEventListeners",l(()=>{this.renderer.domElement.removeEventListener("mousemove",this.onMouseMove,!1),window.removeEventListener("mouseup",this.onMouseUp,!1),window.removeEventListener("mouseout",this.onMouseUp,!1)},"removeMouseUpEventListeners"));h(this,"onContextMenu",l(e=>{e.preventDefault()},"onContextMenu"));h(this,"onMouseUp",l(()=>{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}},"onMouseUp"));h(this,"onMouseMove",l(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)},"onMouseMove"));h(this,"onTouchStart",l(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 An(this.touch.touches[0],this.touch.touches[1]);break;default:this.state=-1}this.state}},"onTouchStart"));h(this,"onTouchMove",l(e=>{if(this.enabled!==!1)switch(this.touchToScene(e),e.touches.length){case 2:e.preventDefault(),e.stopPropagation();let t=ee({},this.touch.inputs.first),i=ee({},this.touch.inputs.second),a=new Y(this.touch.touches[0].x,this.touch.touches[0].y),s=new Y(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 c=t.y<a.y&&i.y<s.y,u=t.y>a.y&&i.y>s.y;this.enableRotate&&this.state!==4&&(u||c)?(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}},"onTouchMove"));h(this,"onTouchEnd",l(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}},"onTouchEnd"));h(this,"handleTouchMovePan",l(e=>{let t=Object.hasOwn(e,"x")?new Y(e.x,e.y):this.touch.touches[0],i=this.raycastToFloor(t);this.coords.panEnd.set(i.x,i.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},"handleTouchMovePan"));h(this,"handleTouchStartDolly",l(()=>{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 i=new Y(this.touch.touches[0].x-e/2,this.touch.touches[0].y-t/2);this.coords.floorAnchor=this.raycastToFloor(i),this.orbit.updateMatrixWorld(),this.touch.anchor1=new pi(this.touch.touches[0],this.camera,this.cameraPlane),this.touch.anchor2=new pi(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")},"handleTouchStartDolly"));h(this,"handleMouseMovePan",l(()=>{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},"handleMouseMovePan"));h(this,"handleTouchStartTilt",l(e=>{this.coords.rotateStart.set(e.touches[1].clientX,e.touches[1].clientY),this.publish("user-tilt-start"),this.publish("rotate-start")},"handleTouchStartTilt"));h(this,"handleTouchMovePedestal",l(e=>{this.handleMouseMovePedestal(e.touches[0])},"handleTouchMovePedestal"));h(this,"handleTouchMoveTilt",l(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)},"handleTouchMoveTilt"));h(this,"handleTouchMoveDolly",l(()=>{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 i=this.makeTransformFromTouchAnchors(this.touch.anchor1,this.touch.anchor2);i&&this.setCameraFromTransformMatrix(i),this.orbit.updateMatrixWorld(),this.touch.anchor1.updateAnchorState(this.camera,e),this.touch.anchor2.updateAnchorState(this.camera,t)},"handleTouchMoveDolly"));h(this,"handleTouchEnd",l(()=>{this.state===4||this.state===5?this.publish("multi-end"):this.state===6&&this.publish("pan-end"),this.panDirty=!1},"handleTouchEnd"));h(this,"handleTouchStartPan",l(e=>{let t=Object.hasOwn(e,"x")?new Y(e.x,e.y):this.touch.touches[0],i=this.raycastToFloor(t);this.coords.panStart.set(i.x,i.y,0),this.coords.panCameraStart.set(this.orbit.position.x,this.orbit.position.y,0),this.publish("user-pan-start"),this.publish("pan-start")},"handleTouchStartPan"));h(this,"handleTouchStartPedestal",l(e=>{this.handleMouseDownPedestal(e.touches[0])},"handleTouchStartPedestal"));h(this,"onMouseDown",l(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&&(this.enablePan?(this.handleMouseDownPan(),this.state=2):this.enablePedestal&&(this.handleMouseDownPedestal(e),this.state=8));this.state!==-1&&this.addMouseEventListeners()}},"onMouseDown"));h(this,"onMouseWheel",l(e=>{this.enabled===!1||this.enableZoom===!1||this.state!==-1&&this.state!==3||(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))},"onMouseWheel"));h(this,"handleMouseWheel",l(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(),i=t-Ma(e)*t/Da*this.zoomSpeed;if(this.setZoomAltitude(i),this.enablePan){let a=i/this.zoomStart;this.coords.panDelta.subVectors(this.coords.floorAnchor,this.coords.panCameraStart).multiplyScalar(1-a),this.setPosition(this.coords.panCameraStart.x+this.coords.panDelta.x,this.coords.panCameraStart.y+this.coords.panDelta.y)}this.publish("change")},"handleMouseWheel"));h(this,"setCameraFromTransformMatrix",l(e=>{this.orbit.updateMatrixWorld();let t=new xr;t.setFromRotationMatrix(e,"ZYX");let i=(e.elements[14]-this.cameraPlane.position.z)/Math.cos(t.x),a=t.z,s=new B(0,0,1);s.applyEuler(t),s.setLength(i);let c=new B;c.setFromMatrixPosition(e),c.sub(s),this.enablePan&&this.setPosition(c.x,c.y),this.enableZoom&&this.setZoomAltitude(i),this.enableRotate&&this.setRotation(-a)},"setCameraFromTransformMatrix"));h(this,"makeTransformFromTouchAnchors",l((e,t)=>{this.orbit.updateMatrixWorld(),this.camera.updateProjectionMatrix();let i=this.camera.projectionMatrix.clone(),a=e.worldCoordinate,s=t.worldCoordinate,c=e.reUnproject(),u=t.reUnproject();if(!c||!u||!a||!s)return null;let d=e.viewCoordinate,m=t.viewCoordinate,g=s.x-a.x,M=s.y-a.y,p=Math.atan2(M,g),P=u.x-c.x,E=u.y-c.y,f=Math.atan2(E,P),y=kc(p,f),S=new Ke;S.makeRotationZ(-y);let v=S.clone();v.multiply(e.snapHolderMatrix);let x=l((mh,ph,fh)=>mh.elements[(ph-1)*4+fh-1],"m"),C=x(i,1,1)*x(v,1,1)-d.x*x(i,3,4)*x(v,3,1),O=x(i,1,1)*x(v,1,2)-d.x*x(i,3,4)*x(v,3,2),A=x(i,1,1)*x(v,1,3)-d.x*x(i,3,4)*x(v,3,3),I=a.x*C+a.y*O+a.z*A,F=x(i,2,2)*x(v,2,1)-d.y*x(i,3,4)*x(v,3,1),G=x(i,2,2)*x(v,2,2)-d.y*x(i,3,4)*x(v,3,2),R=x(i,2,2)*x(v,2,3)-d.y*x(i,3,4)*x(v,3,3),Z=a.x*F+a.y*G+a.z*R,k=x(i,1,1)*x(v,1,1)-m.x*x(i,3,4)*x(v,3,1),U=x(i,1,1)*x(v,1,2)-m.x*x(i,3,4)*x(v,3,2),Q=x(i,1,1)*x(v,1,3)-m.x*x(i,3,4)*x(v,3,3),$=s.x*k+s.y*U+s.z*Q,ye=x(i,2,2)*x(v,2,1)-m.y*x(i,3,4)*x(v,3,1),ce=x(i,2,2)*x(v,2,2)-m.y*x(i,3,4)*x(v,3,2),ie=x(i,2,2)*x(v,2,3)-m.y*x(i,3,4)*x(v,3,3),ne=s.x*ye+s.y*ce+s.z*ie,Se=Math.abs(k-C),me=Math.abs(U-O),Me=Math.abs(Q-A),ke=Math.abs(k-F),pe=Math.abs(U-G),De=Math.abs(Q-R),Re=Math.abs(ye-C),bt=Math.abs(ce-O),vr=Math.abs(ie-A),He=Math.abs(ye-F),at=Math.abs(ce-G),X=Math.abs(ie-R),V=Math.min(Se+me+Me,ke+pe+De),de=Math.min(Re+bt+vr,He+at+X);V<de&&(k=ye,U=ce,Q=ie,$=ne);let Ie=F*A-C*R,$t=G*A-O*R,nn=Z*A-I*R,Jt=k*R-F*Q,Vo=U*R-G*Q,Ws=$*R-Z*Q,lh=(Ws*$t-nn*Vo)/(Jt*$t-Ie*Vo),ch=(Ws*Ie-nn*Jt)/(Vo*Ie-$t*Jt),Xs=G*C-O*F,dh=R*C-A*F,hh=Z*C-I*F,Ys=U*F-G*k,uh=Q*F-R*k,qs=(($*F-Z*k)*Xs-hh*Ys)/(uh*Xs-dh*Ys),on=v.clone();return on.elements[12]=lh,on.elements[13]=ch,on.elements[14]=qs,qs>0?on:null},"makeTransformFromTouchAnchors"));h(this,"updateTouchOrigin",l(()=>{let e=this.renderer.domElement;this.touch.origin.offsetLeft=e.getBoundingClientRect().left,this.touch.origin.offsetTop=e.getBoundingClientRect().top},"updateTouchOrigin"));h(this,"touchToScene",l(e=>{this.touch.touches=[];for(let t=0,i=e.touches.length;t<i;t++){let a=e.touches[t],s=Rc(a,this.touch.origin);this.touch.touches.push(new Y(s.x/this.renderer.domElement.width*this.rendererState.pixelRatio*2-1,-(s.y/this.renderer.domElement.height*this.rendererState.pixelRatio)*2+1))}this.coords.mouse=this.touch.touches[0]},"touchToScene"));h(this,"canScrollZoom",l(e=>{let t=Ma(e),i=this.getZoomAltitude();return!(t<0&&i===this.getZoomScaledMax()||t>0&&i===this.getZoomScaledMin())},"canScrollZoom"));h(this,"mouseToScene",l(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},"mouseToScene"));h(this,"getMousePos",l(e=>({x:e.offsetX,y:e.offsetY}),"getMousePos"));h(this,"handleMouseDownRotate",l(e=>{this.coords.rotateStart.set(e.clientX,e.clientY),this.publish("rotate-start"),this.publish("user-rotate-start")},"handleMouseDownRotate"));h(this,"handleMouseDownPan",l(()=>{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")},"handleMouseDownPan"));h(this,"handleMouseDownPedestal",l(e=>{let t=new Y(e.clientX,e.clientY);this.coords.initialShiftPos=t,this.coords.initialPedestal=this.getPedestal(),this.pedestalScaleFactor=ra(this.camera.fov,this.renderer.domElement.clientHeight,this.getZoomAltitude()),this.publish("pedestal-start"),this.publish("user-pedestal-start")},"handleMouseDownPedestal"));h(this,"handleMouseMovePedestal",l(e=>{let t={x:e.clientX,y:e.clientY},i=this.coords.initialPedestal+this.pedestalScaleFactor*(t.y-this.coords.initialShiftPos.y);this.stayInsideBounds&&(i<this.minPedestal?i=Math.max(i,this.minPedestal):i>this.maxPedestal&&(i=Math.min(i,this.maxPedestal))),i!==this.getPedestal()&&this.setPedestal(i,!0)},"handleMouseMovePedestal"));h(this,"handleMouseMoveRotate",l(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")},"handleMouseMoveRotate"));h(this,"publishUserZoomDebounced",li(()=>{this.isUserZooming=!1,this.publish("user-zoom-end")},250));h(this,"publishUserZoomEvent",l(()=>{this.isUserZooming?this.publishUserZoomDebounced():(this.publish("user-zoom-start"),this.isUserZooming=!0,this.publishUserZoomDebounced())},"publishUserZoomEvent"));h(this,"setCameraMoving",l(()=>{this.cameraMoving=!0},"setCameraMoving"));h(this,"unsetCameraMoving",l(()=>{this.cameraMoving=!1,this.lastCameraMoveTime=Date.now()},"unsetCameraMoving"));h(this,"setUserInteracting",l(()=>{this.userInteracting=!0},"setUserInteracting"));h(this,"unsetUserInteracting",l(()=>{this.userInteracting=!1},"unsetUserInteracting"));h(this,"publishPedestalChangeEvent",l(e=>{this.publish("pedestal-change",{pedestal:e,scrolledToTop:this.scrolledToTop,scrolledToBottom:this.scrolledToBottom,scrollPercent:this.scrollPercent})},"publishPedestalChangeEvent"));h(this,"convertAltitudeToZoomLevel",l(e=>{let[,t]=this.center,a=e*2*Math.tan(q.degToRad(this.camera.fov)/2)/this.options.canvasHeight,s=Math.cos(q.degToRad(t))*2*Math.PI*Jo/a;return q.clamp(Math.log2(s/512),Rn,Fn)},"convertAltitudeToZoomLevel"));h(this,"convertZoomLevelToAltitude",l(e=>{let[,t]=this.center,i=q.clamp(e,Rn,Fn),a=Math.pow(2,i),s=q.clamp(t,Ta,Pa),c=a*512;return Math.cos(q.degToRad(s))*Math.PI*2*Jo/c*this.options.canvasHeight/2/Math.tan(q.degToRad(this.camera.fov)/2)},"convertZoomLevelToAltitude"));h(this,"completeTween",l(e=>{e.isPlaying()&&e.stop(),this.rendererState.internalTweenGroup.remove(e),this.tweens.delete(e)},"completeTween"));h(this,"debugContainer",new Kt);this.camera=e,this.renderer=i,this.rendererState=a,this.scene=t,this.options=s,this.elevation=e.parent,this.orbit=this.elevation.parent,this.cameraPlane=this.createCameraPlane(),this.zoomStart=e.position.z,s.mode!=="outdoors-overlay"&&this.addEventListeners()}get maxZoomLevel(){return this.convertAltitudeToZoomLevel(this.minZoomAltitude)}setMaxZoomLevel(e){this.minZoomAltitude=this.convertZoomLevelToAltitude(e),this.stateDirty=!0}get defaultMinZoomLevel(){return n(this,Bn)}get minZoomLevel(){return this.convertAltitudeToZoomLevel(this.maxZoomAltitude)}setMinZoomLevel(e){this.maxZoomAltitude=this.convertZoomLevelToAltitude(e),this.stateDirty=!0}get scrollPercent(){let e=this.minPedestal,t=this.maxPedestal,i=this.getPedestal();return i=Math.min(i,t),i=Math.max(i,e),(i-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(){var a,s,c,u;let e=this.getPosition(),{lat:t,lon:i}=Mn((s=(a=this.rendererState.center)==null?void 0:a[1])!=null?s:0,(u=(c=this.rendererState.center)==null?void 0:c[0])!=null?u:0,e.x,e.y);return[i,t]}setCenter(e,t){var s,c,u,d;let{x:i,y:a}=Cn((c=(s=this.rendererState.center)==null?void 0:s[1])!=null?c:0,(d=(u=this.rendererState.center)==null?void 0:u[0])!=null?d:0,t,e);this.setPosition(i,a)}get isAnimating(){return this.rendererState.internalTweenGroup.getAll().some(e=>e.cameraAnimation)}getCameraFrameForCoordinates(e,t){var M,p;let i=t.minZoom!==void 0?t.minZoom:this.minZoomAltitude,a=t.maxZoom!==void 0?t.maxZoom:this.maxZoomAltitude,s=this.options.canvasWidth,c=this.options.canvasHeight,u=this.getRotation(),d=this.getTilt(),m=this.getPosition();this.setRotation((M=t.rotation)!=null?M:u,!0),this.setTilt((p=t.tilt)!=null?p:d,!0);let g=Fc(e,{canvasWidth:s,canvasHeight:c,paddingOption:t.padding,verticalPadding:t.verticalPadding,minZoom:i,maxZoom:a,position:m,camera:this.camera,orbit:this.orbit});return this.setRotation(u,!0),this.setTilt(d,!0),{center:g.position,zoomLevel:this.convertAltitudeToZoomLevel(g.zoom)}}focusOn(e,t){if(Fh){this.debugContainer&&ve(this.debugContainer);let f=new Dt(4,4,4),y=new je({color:65280,depthTest:!1}),S=new Lt(f,y,e.length),v=new Ke;e.forEach((x,C)=>{v.setPosition(x),S.setMatrixAt(C,v)}),S.instanceMatrix.needsUpdate=!0,this.debugContainer.add(S),this.scene.add(this.debugContainer)}let i=t.curve,a=t.callback,s=t.cancelledCallback,c=t.minZoom!==void 0?t.minZoom:this.minZoomAltitude,u=t.maxZoom!==void 0?t.maxZoom:this.maxZoomAltitude,d=this.options.canvasWidth,m=this.options.canvasHeight,g;t.duration!==void 0?g=t.duration:_.env.TESTING==="true"?g=0:g=_a;let M=t.padding,p=this.getRotation(),P=this.getTilt();t.rotation!=null&&this.setRotation(t.rotation),t.tilt!=null&&this.setTilt(t.tilt);let E=Fc(e,{canvasHeight:m,paddingOption:M,canvasWidth:d,minZoom:c,maxZoom:u,camera:this.camera,orbit:this.orbit,position:this.getPosition(),verticalPadding:t.verticalPadding});this.setRotation(p),this.setTilt(P),this.animateCamera({position:E.position,tilt:t.tilt,rotation:t.rotation,zoom:E.zoom},g,i,a,s,t)}resize(e,t){this.options.canvasWidth=e,this.options.canvasHeight=t}};Bn=new WeakMap,l(zn,"CameraSystem"),h(zn,"CAMERA_FRAME_PADDING_SIDES",["top","bottom","left","right"]);var Nr=zn;function Fc(o,{canvasWidth:r,orbit:e,paddingOption:t,verticalPadding:i=0,canvasHeight:a,minZoom:s,maxZoom:c,camera:u,position:d}){let m={zoom:s,position:d};if(o.length===0)return m;for(let Ie of Nr.CAMERA_FRAME_PADDING_SIDES)typeof t[Ie]!="number"&&(t[Ie]=0);let g=t.type==="portion"?{top:t.top*a,bottom:t.bottom*a,left:t.left*r,right:t.right*r,type:"pixel"}:t;if(g.left+g.right>=r||g.top+g.bottom>=a)return m;e.updateMatrixWorld();let M=u.matrixWorldInverse,p=u.fov*(Math.PI/180)/2,P=p,f=Math.atan(Math.tan(p)*(r/a)),y=new B(1/0,1/0,1/0),S=new B(-1/0,-1/0,-1/0),v=new Le,x=new B;for(let Ie=0,$t=o.length;Ie<$t;Ie++)x.copy(o[Ie]),v.expandByPoint(x),x.applyMatrix4(M),y.min(x),S.max(x),x.copy(o[Ie]),x.z-=i,x.applyMatrix4(M),y.min(x),S.max(x),x.copy(o[Ie]),x.z+=i,x.applyMatrix4(M),y.min(x),S.max(x);let C=S.x-y.x,O=S.y-y.y,A=r-g.left-g.right,I=a-g.top-g.bottom,F=(S.x+y.x)/2,G=(S.y+y.y)/2,R=C/A,Z=O/I,k=s,U=c,Q=k*Math.tan(f)*2,$=U*Math.tan(f)*2,ye=Q/r,ce=$/r,ie=Math.max(R,Z);ie=q.clamp(ie,ye,ce);let ne=A*ie,Se=I*ie,me={min:{x:F-ne/2-g.left*ie,y:G-Se/2-g.bottom*ie},max:{x:F+ne/2+g.right*ie,y:G+Se/2+g.top*ie}},Me=(me.min.x+me.max.x)/2,ke=(me.min.y+me.max.y)/2,pe=v.getCenter(new B),De=Math.abs(Me-me.min.x),Re=Math.abs(ke-me.min.y),bt=De/Math.tan(f),vr=Re/Math.tan(P),He=new B;He.set(Me,ke,S.z+Math.max(bt,vr)),He.applyMatrix4(u.matrixWorld);let at=new B;at.set(Me,ke,S.z),at.applyMatrix4(u.matrixWorld);let X=new B().subVectors(at,He),V=(pe.z-He.z)/X.z,de=new B().copy(He).add(X.clone().multiplyScalar(V));return at.set(de.x,de.y,de.z),He.sub(at),{position:de,zoom:He.length()}}l(Fc,"getCameraFrameForPoints");var Nh=0,Gh=90,Bh=(_.env.NODE_ENV==="test",!1),Zn={linear:Xe.Linear.None,"ease-in":Xe.Quadratic.In,"ease-out":Xe.Quadratic.Out,"ease-in-out":Xe.Quadratic.InOut},zh=-50,z,H,wt,gi,yi,Oa,Aa=class Aa{constructor(r,e,t){D(this,yi);D(this,z);D(this,H);D(this,wt);D(this,gi);L(this,z,r),L(this,H,e),L(this,wt,t),n(this,z).map&&n(this,z).map.transform.setMinElevationForCurrentTile(zh),n(this,H).cameraSystem.on("pedestal-change",({pedestal:i})=>{n(this,H).cameraSystem.setCameraPlaneElevation(i)})}get center(){var r,e;return n(this,z).mode==="outdoors-overlay"&&n(this,z).map?(e=(r=n(this,z).map).getCenter)==null?void 0:e.call(r).toArray():n(this,H).cameraSystem.center}setCenter(r){var e;if(n(this,z).mode==="outdoors-overlay"&&n(this,z).map){(e=n(this,z).map)==null||e.setCenter(r),n(this,H).interactionSystem.handleHover();return}n(this,H).cameraSystem.setCenter(r[0],r[1]),n(this,H).interactionSystem.handleHover()}get zoomLevel(){var r;return n(this,z).mode==="outdoors-overlay"&&n(this,z).map?(r=n(this,z).map)==null?void 0:r.getZoom():n(this,H).cameraSystem.getZoomLevel()}setZoomLevel(r){var e;n(this,z).mode==="outdoors-overlay"&&n(this,z).map&&((e=n(this,z).map)==null||e.setZoom(r)),n(this,H).cameraSystem.setZoomLevel(lt(r,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 n(this,H).cameraSystem.isAnimating}cancelAnimation(){n(this,H).cameraSystem.cancelAnimation()}get maxZoomLevel(){return n(this,H).cameraSystem.maxZoomLevel}get minZoomLevel(){return n(this,H).cameraSystem.minZoomLevel}setAutoMinZoomLevel(r){n(this,H).panBoundsSystem.autoMinZoomLevel=r,r&&(n(this,H).panBoundsSystem.dirty=!0,n(this,H).panBoundsSystem.update())}get autoMinZoomLevel(){return n(this,H).panBoundsSystem.autoMinZoomLevel}setMinZoomLevel(r,e=!1){var i;e&&this.setAutoMinZoomLevel(!1);let t=lt(r,Ye.MIN_MERCATOR_ZOOM_LEVEL,this.maxZoomLevel,"setMinZoomLevel was clamped. minZoomLevel must be between ".concat(Ye.MIN_MERCATOR_ZOOM_LEVEL," and maxZoomLevel."));n(this,H).cameraSystem.setMinZoomLevel(t),this.zoomLevel<t&&this.setZoomLevel(t),(i=n(this,z).map)==null||i.setMinZoom(t)}setMaxZoomLevel(r){var t;let e=lt(r,this.minZoomLevel,Ye.MAX_MERCATOR_ZOOM_LEVEL,"setMaxZoomLevel was clamped. maxZoomLevel must be between minZoomLevel and ".concat(Ye.MAX_MERCATOR_ZOOM_LEVEL,"."));n(this,H).cameraSystem.setMaxZoomLevel(e),this.zoomLevel>e&&this.setZoomLevel(e),(t=n(this,z).map)==null||t.setMaxZoom(e)}get maxPitch(){var r,e;return n(this,z).mode==="outdoors-overlay"&&n(this,z).map?(e=(r=n(this,z).map)==null?void 0:r.getMaxPitch)==null?void 0:e.call(r):q.radToDeg(n(this,H).cameraSystem.maxTilt)}get minPitch(){var r,e;return n(this,z).mode==="outdoors-overlay"&&n(this,z).map?(e=(r=n(this,z).map)==null?void 0:r.getMinPitch)==null?void 0:e.call(r):q.radToDeg(n(this,H).cameraSystem.minTilt)}setMinPitch(r){var t;let e=Math.max(Nh,r);(t=n(this,z).map)==null||t.setMinPitch(e),n(this,H).cameraSystem.minTilt=q.degToRad(e)}setMaxPitch(r){var t;let e=Math.min(Gh,r);(t=n(this,z).map)==null||t.setMaxPitch(e),n(this,H).cameraSystem.maxTilt=q.degToRad(e)}get bearing(){var r;return n(this,z).mode==="outdoors-overlay"&&n(this,z).map?(r=n(this,z).map)==null?void 0:r.getBearing():q.radToDeg(n(this,H).cameraSystem.getRotation())}setBearing(r){var e;if(n(this,z).mode==="outdoors-overlay"&&n(this,z).map){(e=n(this,z).map)==null||e.setBearing(r);return}n(this,H).cameraSystem.setRotation(q.degToRad(r))}get pitch(){var r;return n(this,z).mode==="outdoors-overlay"&&n(this,z).map?(r=n(this,z).map)==null?void 0:r.getPitch():q.radToDeg(n(this,H).cameraSystem.getTilt())}setPitch(r){var e;if(n(this,z).mode==="outdoors-overlay"&&n(this,z).map){(e=n(this,z).map)==null||e.setPitch(r);return}n(this,H).cameraSystem.setTilt(q.degToRad(lt(r,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 n(this,H).cameraSystem.getPedestal()}setElevation(r){n(this,H).cameraSystem.setPedestal(r,!0)}animateElevation(r,e){return n(this,gi)&&n(this,gi).stop(),new Promise(t=>{var i;n(this,H).cameraSystem.animateCamera({position:{z:r}},(e==null?void 0:e.duration)||300,Zn[(e==null?void 0:e.easing)||"ease-in-out"],t,t,{interruptible:(i=e==null?void 0:e.interruptible)!=null?i:!0})})}get insetsPadding(){return n(this,wt).insetsPadding}get panMode(){return n(this,H).cameraSystem.enablePan===!1&&n(this,H).cameraSystem.enablePedestal===!0?"elevation":"default"}setPanMode(r){if(r!=="default"&&r!=="elevation")throw new Error("Invalid pan mode");r!==this.panMode&&(r==="default"?(n(this,H).cameraSystem.enablePan=!0,n(this,H).cameraSystem.enablePedestal=!1):(n(this,H).cameraSystem.enablePan=!1,n(this,H).cameraSystem.enablePedestal=!0))}setInsetPadding(r){n(this,wt).insetsPadding=Object.assign({},n(this,wt).insetsPadding,r)}animateTo(r){var s,c,u,d,m,g;if(n(this,z).mode==="outdoors-overlay"&&n(this,z).map)return(g=n(this,z).map)==null||g.flyTo({center:(s=r.center)!=null?s:this.center,zoom:(c=r.zoomLevel)!=null?c:this.zoomLevel,bearing:(u=r.bearing)!=null?u:this.bearing,pitch:(d=r.pitch)!=null?d:this.pitch,duration:(m=r.duration)!=null?m:600}),Promise.resolve();let e=r.center?n(this,z).convertTo3DMapPosition(r.center[1],r.center[0],r.center[2]||this.elevation):void 0,t=r.zoomLevel!==void 0?n(this,H).cameraSystem.convertZoomLevelToAltitude(lt(r.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,i=r.bearing!==void 0?q.degToRad(r.bearing):void 0,a=r.pitch!==void 0?q.degToRad(lt(r.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(M=>{var p;n(this,H).cameraSystem.animateCamera({position:e,zoom:t,rotation:i,tilt:a},r.duration||0,Zn[r.easing||"ease-in-out"],()=>{n(this,H).interactionSystem.handleHover(),M()},M,{interruptible:(p=r==null?void 0:r.interruptible)!=null?p:!0})})}getCameraFrameForCoordinates(r,e){let t=oe(this,yi,Oa).call(this,e||{},()=>Promise.resolve()),{pointCloud:i}=Nc(r,n(this,z),n(this,wt).geometry3DMap);if(i.length===0)return W.error("No valid coordinates found in targets:",r),{center:this.center,zoomLevel:this.zoomLevel};let{center:a,zoomLevel:s}=n(this,H).cameraSystem.getCameraFrameForCoordinates(i,t);return{center:n(this,z).convert3DMapPositionToCoordinate(a),zoomLevel:s}}focusOn(r,e){var s,c,u,d;let{pointCloud:t,geoBounds:i,firstPosition:a}=Nc(r,n(this,z),n(this,wt).geometry3DMap);return t.length===0?(W.error("No valid coordinates found in targets:",r),Promise.resolve()):n(this,z).mode==="outdoors-overlay"&&n(this,z).map?(t.length===1&&a?(s=n(this,z).map)==null||s.flyTo({center:[a[0],a[1]],duration:(e==null?void 0:e.duration)||n(this,z).map.getBearing(),animate:!0,bearing:(e==null?void 0:e.bearing)===void 0?n(this,z).map.getBearing():e==null?void 0:e.bearing,pitch:(e==null?void 0:e.pitch)===void 0?n(this,z).map.getPitch():e==null?void 0:e.pitch,zoom:(e==null?void 0:e.maxZoomLevel)||n(this,z).map.getMaxZoom()}):(Bh&&Zh(n(this,z),i),(d=n(this,z).map)==null||d.fitBounds(i,{duration:(c=e==null?void 0:e.duration)!=null?c:Ye.DEFAULT_ANIMATION_DURATION,bearing:(e==null?void 0:e.bearing)===void 0?n(this,z).map.getBearing():e==null?void 0:e.bearing,pitch:(e==null?void 0:e.pitch)===void 0?n(this,z).map.getPitch():e==null?void 0:e.pitch,maxZoom:(u=e==null?void 0:e.maxZoomLevel)!=null?u:n(this,z).map.getMaxZoom()})),n(this,H).interactionSystem.handleHover(),Promise.resolve()):new Promise(m=>{n(this,H).cameraSystem.focusOn(t,oe(this,yi,Oa).call(this,e||{},m))})}};z=new WeakMap,H=new WeakMap,wt=new WeakMap,gi=new WeakMap,yi=new WeakSet,Oa=l(function(r,e){var t;return{minZoom:(r==null?void 0:r.maxZoomLevel)===void 0?void 0:n(this,H).cameraSystem.convertZoomLevelToAltitude(lt(r.maxZoomLevel,this.minZoomLevel,this.maxZoomLevel,"maxZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMaxZoomLevel() to adjust limits.")),maxZoom:(r==null?void 0:r.minZoomLevel)===void 0?void 0:n(this,H).cameraSystem.convertZoomLevelToAltitude(lt(r.minZoomLevel,this.minZoomLevel,this.maxZoomLevel,"minZoomLevel was clamped to minZoomLevel/maxZoomLevel bounds. Use mapView.Camera.setMinZoomLevel() to adjust limits.")),padding:r!=null&&r.padding?Object.assign({},xn,r==null?void 0:r.padding):this.insetsPadding,curve:Zn[(r==null?void 0:r.easing)||"ease-in-out"],rotation:(r==null?void 0:r.bearing)===void 0?void 0:q.degToRad(r.bearing),tilt:(r==null?void 0:r.pitch)!==void 0?q.degToRad(lt(r.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:r==null?void 0:r.duration,callback:l(()=>{n(this,H).interactionSystem.handleHover(),e()},"callback"),cancelledCallback:e,interruptible:(t=r==null?void 0:r.interruptible)!=null?t:!0,verticalPadding:r==null?void 0:r.verticalPadding}},"#convertToLegacy"),l(Aa,"Camera");var Un=Aa;function La(o,r){o[0]=Math.min(o[0],r[0]),o[1]=Math.min(o[1],r[1]),o[2]=Math.max(o[2],r[0]),o[3]=Math.max(o[3],r[1])}l(La,"updateBounds");function Nc(o,r,e){var c;let t=[],i=[1/0,1/0,-1/0,-1/0],a=null;if(!o||!Array.isArray(o)||o.length===0)return{pointCloud:t,geoBounds:i,firstPosition:a};let s=r.getSystems().renderSystem;(s.threeDdirty||s.twoDdirty)&&r.renderSync();for(let u of o)if(typeof u=="string"){let d=e.get(u);if(!d){W.error("Entity not found with id:",u);continue}let m=new Le;kl(r,"userData"in d&&(c=d.userData.entityId)!=null?c:d.id,t,m,d instanceof we?d.position.z:void 0);let g=r.convert3DMapPositionToCoordinate(m.min),M=r.convert3DMapPositionToCoordinate(m.max);La(i,g),La(i,M),a||(a=r.convert3DMapPositionToCoordinate(m.getCenter(new B)))}else t.push(r.convertTo3DMapPosition(u[1],u[0],u[2]||0)),La(i,u),a||(a=u);return{pointCloud:t,geoBounds:i,firstPosition:a}}l(Nc,"processTargets");function Zh(o,r){var t,i,a,s;let e=[[r[0],r[1]],[r[0],r[3]],[r[2],r[3]],[r[2],r[1]],[r[0],r[1]]];(t=o.map)!=null&&t.getLayer("bounds-outline")&&o.map.removeLayer("bounds-outline"),(i=o.map)!=null&&i.getSource("bounds-source")&&o.map.removeSource("bounds-source"),(a=o.map)==null||a.addSource("bounds-source",{type:"geojson",data:{type:"Feature",properties:{},geometry:{type:"LineString",coordinates:e}}}),(s=o.map)==null||s.addLayer({id:"bounds-outline",type:"line",source:"bounds-source",layout:{},paint:{"line-color":"#FF0000","line-width":2,"line-opacity":.8}})}l(Zh,"drawBounds");var ka="";var Gr=!1,Uh=150,Fa=class Fa extends J{constructor(e,t,i=!0){super();h(this,"worker");h(this,"debugContext");h(this,"debugCanvas");h(this,"collidersDirty",!0);h(this,"packedMessage",[[],0,0,0,0,0,"bottom-left"]);h(this,"visibleCollidersQTree",new We(new K(0,0,0,0)));h(this,"interactiveCollidersQTree",new We(new K(0,0,0,0)));h(this,"coreState");h(this,"postMessage");h(this,"showCollisionBoxes",l(()=>{Gr=!0,this.debugCanvas.style.display="block"},"showCollisionBoxes"));h(this,"hideCollisionBoxes",l(()=>{Gr=!1,this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugCanvas.style.display="none"},"hideCollisionBoxes"));h(this,"currentMsgId","");h(this,"working",!1);h(this,"_postMessage",l(()=>{this.worker.postMessage(this.packedMessage)},"_postMessage"));h(this,"componentArray",[]);h(this,"update",l((e,t,i="bottom-left",a=!1,s=[])=>{let c=!1;if(this.collidersDirty){this.packedMessage=[[],0,0,0,0,0,"bottom-left"],this.componentArray=[];let m;for(let g of this.coreState.geometry2DIdsInScene){let M=this.coreState.geometry2DMap.get(g);M&&(m=M.components[0],this.componentArray.push(m))}this.resize(e,t,i),this.collidersDirty=!1,c=!0}else c=this.componentArray.some(m=>m.collisionDirty===!0);c&&this.componentArray.sort((m,g)=>g.rank-m.rank);let u=0;for(let m of s)this.packedMessage[0][u]==null&&(this.packedMessage[0][u]=[]),this.packedMessage[0][u][0]==null&&(this.packedMessage[0][u][0]=[]),this.packedMessage[0][u][0]=[[m.h/2,m.h/2,m.w/2,m.w/2,ua]],this.packedMessage[0][u][1]=1,this.packedMessage[0][u][2]=1,this.packedMessage[0][u][3]=m.x,this.packedMessage[0][u][4]=m.y,this.packedMessage[0][u][5]=0,this.packedMessage[0][u][6]=-1,u++;let d=0;for(;u<this.componentArray.length+s.length;){if(this.packedMessage){let m=this.componentArray[d].toPackedMessage(a&&!c);this.packedMessage[0][u]==null&&(this.packedMessage[0][u]=[]),this.packedMessage[0][u][0]==null&&(this.packedMessage[0][u][0]=[]),this.packedMessage[0][u][0]=m.bboxes,this.packedMessage[0][u][1]=m.enabled&&this.componentArray[d].visible&&!this.componentArray[d].isOccluded?1:0,this.packedMessage[0][u][2]=m.rank===Pr?1:0,this.packedMessage[0][u][3]=m.x,this.packedMessage[0][u][4]=m.y,this.packedMessage[0][u][5]=m.shouldCollideWithScreenEdges?1:0,this.packedMessage[0][u][6]=m.lockedToStrategyIndex}u++,d++}this.working||this.postMessage()},"update"));h(this,"resolve",l(e=>{if(this.working=!1,this.collidersDirty||!e.data)return;let t=e.data.colliders,i=-1,a,s,c,u=new K(0,0,this.debugCanvas.width,this.debugCanvas.height);if(this.visibleCollidersQTree=new We(u),this.interactiveCollidersQTree=new We(u),Gr)for(let d of e.data.staticColliders)this.visibleCollidersQTree.insert(new K(d.x,d.y,d.w,d.h));for(let d=0;d<this.componentArray.length;d++){let m=this.componentArray[d];t[d]!=null&&(i=t[d][0],a=t[d][2],m.offscreen=t[d][1]===1,i!==-1&&a!=null?(c=new K(a.x,a.y,a.w,a.h,{entityId:m.id}),this.visibleCollidersQTree.insert(c),s=this.coreState.geometry2DMap.get(m.id),(s==null?void 0:s.components[1])!=null&&this.interactiveCollidersQTree.insert(c),(m.canShow===!1||m.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in m&&(m.visibilityNeedsUpdate="show"),i!==-1&&i!==m.currentStrategyIndex&&(m.activeBoundingBox=c,m.onStrategySelected(i))):((m.canShow===!0||m.visibilityNeedsUpdate!==!1)&&"visibilityNeedsUpdate"in m&&(m.visibilityNeedsUpdate="hide"),i!==-1&&i!==m.currentStrategyIndex&&m.onStrategySelected(i)))}Gr&&this.drawDebug(),this.publish("visibility-changed")},"resolve"));h(this,"drawDebug",l(()=>{Gr&&this.visibleCollidersQTree&&(this.debugContext.clearRect(0,0,this.debugCanvas.width,this.debugCanvas.height),this.debugContext.beginPath(),this.visibleCollidersQTree.drawObjects(this.debugContext))},"drawDebug"));h(this,"destroy",l(()=>{this.worker.terminate()},"destroy"));this.worker=i===!1?new hi:ka!==""?new Worker(ka):new Worker(URL.createObjectURL(new Blob([Cc],{type:"text/javascript"}))),this.worker.onerror=()=>{this.worker=new hi,this.worker.onmessage=a=>this.resolve(a)},this.coreState=t,this.debugCanvas=e,this.debugContext=e.getContext("2d"),this.worker.onmessage=a=>this.resolve(a),this.postMessage=Ec(this._postMessage,Uh,!1),Gr?this.showCollisionBoxes():this.hideCollisionBoxes()}resize(e,t,i){this.packedMessage[6]=i,this.packedMessage[5]=t,this.packedMessage[4]=e,this.packedMessage[3]=this.debugCanvas.width,this.packedMessage[2]=this.debugCanvas.height}};l(Fa,"CollisionSystem");var jn=Fa;b();b();b();b();var Ga=class Ga{constructor(r){h(this,"type");h(this,"event");this.type=0,this.event=r}get timestamp(){return this.event.timeStamp}};l(Ga,"Tap");var Vn=Ga,Ba=class Ba{constructor(){h(this,"taps",[])}add(r){this.lastPointerDown&&r.timestamp-this.lastPointerDown.timestamp<50?this.lastPointerDown.type=1:this.taps.push(r)}get lastPointerDown(){return this.taps.length>=1?this.taps[this.taps.length-1]:void 0}get isSingleTapWithTwoFingers(){var r;return this.isSingleTap&&((r=this.lastPointerDown)==null?void 0:r.type)===1}get isSingleTapWithOneFinger(){var r;return this.isSingleTap&&((r=this.lastPointerDown)==null?void 0:r.type)===0}get isDoubleTapWithOneFinger(){var r,e;return this.isDoubleTap&&((r=this.taps[0])==null?void 0:r.type)===0&&((e=this.taps[1])==null?void 0:e.type)===0}get isSingleTap(){return this.taps.length===1}get isDoubleTap(){return this.taps.length===2}discardOutsideOfWaitWindow(r){this.taps=this.taps.filter(e=>r-e.timestamp<300)}flush(){this.taps=[]}get _taps(){return this.taps}destroy(){this.flush()}};l(Ba,"TapsController");var Hn=Ba;b();function za(o){let r=new Set;for(let e of o){let t=e.object;for(;t.visible&&t.parent&&t.parent.visible===!0&&!r.has(t.parent);)t=t.parent,t instanceof we&&t.type==="group-container"&&t.visible&&t.components[0]&&r.add(t)}return Array.from(r)}l(za,"getUniqueIntersectedGroupContainers");var Br,Za=class Za extends J{constructor(e,t,i,a,s){super();h(this,"raycaster",new st);h(this,"state",{hovered3DEntity:void 0,hovered2DEntity:void 0,hovered3DContainers:void 0,lastHover:void 0,interaction:{mouseDownStart:void 0,distanceFromMouseDown:void 0,isPanning:!1}});h(this,"coreState");h(this,"camera");h(this,"worldPlane");h(this,"_quadtree",new We(new K(0,0,0,0)));h(this,"_container");h(this,"lastPointerEvent");h(this,"cursor","grab");h(this,"touchesCount",0);h(this,"isUserInteracting");h(this,"hasTouched",!1);D(this,Br);h(this,"onPointerMoveRaf",l(e=>{this.lastPointerEvent=e,n(this,Br)&&cancelAnimationFrame(n(this,Br)),L(this,Br,requestAnimationFrame(()=>{this.onPointerMove(e)}))},"onPointerMoveRaf"));h(this,"onPointerMove",l(e=>{e.preventDefault(),this.updateInteractionStateIfPanning(e),(e.pointerType!=="touch"||e.pointerType===void 0&&this.hasTouched)&&this.handleHover(e),this.handleCursor()},"onPointerMove"));h(this,"tapsControl",new Hn);h(this,"onPointerDown",l(e=>{e.target===this._container&&(this._container.addEventListener("pointerup",this.onPointerUp,!1),this._container.addEventListener("pointercancel",this.onPointerUp,!1),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 Vn(e)),this.touchesCount=Math.max(0,this.touchesCount+1)))},"onPointerDown"));h(this,"clickTimeout");h(this,"onPointerUp",l(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,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!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.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())},"onPointerUp"));h(this,"dirty3D",!0);h(this,"cachedHitBoxes",{entities:[]});h(this,"ndcPoint",new Y);h(this,"debugPanel");this.isUserInteracting=s,this.raycaster.layers.enableAll(),this.raycaster.layers.disable(1),this.camera=i,this._container=e,this.coreState=t,this.worldPlane=a,this._container.addEventListener("pointerdown",this.onPointerDown,!1),this._container.addEventListener("pointermove",this.onPointerMoveRaf,!1),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)}}getThreeDIntersectsFromXY(e){this.raycaster.setFromCamera(e,this.camera),this.raycaster.layers.enable(0);let t=this.raycaster.intersectObjects(this._hitBoxes.entities,!0).filter(a=>{var s,c;return((s=a.object)==null?void 0:s.name)==="worldPlane"||((c=a.object)==null?void 0:c.visible)}),i=t.findIndex(a=>{var s;return((s=a.object)==null?void 0:s.name)==="worldPlane"});return i!==-1&&t.push(t.splice(i,1)[0]),t}getGroupContainerIntersectsFromXY(e){let t=this.getThreeDIntersectsFromXY(e),i;return t!=null&&t.length>0&&(i=za(t)),i}flush(){this.tapsControl.flush(),this.clickTimeout!=null&&(clearTimeout(this.clickTimeout),this.clickTimeout=void 0)}handleHover(e){let t=e||this.lastPointerEvent;if(this.state.interaction.mouseDownStart||!t||this.isUserInteracting())return;let{entity3D:i,entity2D:a,position:s,groupContainers:c}=this.intersect(t);(this.detect3DEntityHover(i)||this.detect2DEntityHover(a)||this.detect3DContainerHover(c))&&(this.state.hovered3DEntity=i,this.state.lastHover=i,this.state.hovered2DEntity=a,this.state.hovered3DContainers=c,this.publish("hover",{entity2D:this.state.hovered2DEntity,entity3D:this.state.hovered3DEntity,position:s,groupContainers:c})),this.handleCursor()}handleCursor(){var s;let e=!!(this.state.hovered3DEntity&&((s=this.state.hovered3DEntity)!=null&&s.components[2])||this.state.hovered2DEntity),t=!!this.state.interaction.mouseDownStart,i=this.state.interaction.isPanning,a=Hh(e,i,t);this.cursor!==a&&(this.cursor=a,a==="pointer"?this._container.classList.add("mappedin-interaction-hover"):this._container.classList.remove("mappedin-interaction-hover"))}detect2DEntityHover(e){return this.state.hovered2DEntity!==e}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}})}get _hitBoxes(){if(this.dirty3D){this.cachedHitBoxes.entities=[];let e;for(let t of this.coreState.geometry3DIdsInScene)e=this.coreState.geometry3DMap.get(t),((e==null?void 0:e.type)==="geometry"||(e==null?void 0:e.type)==="model"||(e==null?void 0:e.type)==="path"||(e==null?void 0:e.type)==="custom-geometry")&&e.components[0].mesh&&!this.cachedHitBoxes.entities.includes(e.components[0].mesh)&&this.cachedHitBoxes.entities.push(e.components[0].mesh);return this.dirty3D=!1,this.cachedHitBoxes.entities.push(this.worldPlane),this.cachedHitBoxes}return this.cachedHitBoxes}intersect(e){var y,S,v,x,C;let{offsetX:t,offsetY:i}=e,a=[t,i],s=this._quadtree.queryPoint(a),[c]=s.filter(O=>O.intersectsPoint(a));this.ndcPoint.x=t/this._container.clientWidth*2-1,this.ndcPoint.y=-(i/this._container.clientHeight)*2+1;let u=this.getThreeDIntersectsFromXY(this.ndcPoint),d=(y=u[0])==null?void 0:y.point,m=[],g=[],M=u.filter(O=>O.object.name!=="worldPlane");for(let O of M)O.object instanceof te&&O.object.material.depthTest===!1?m.push(O):g.push(O);let p=(v=(S=m[0])!=null?S:g[0])!=null?v:void 0,P,E;if(p!=null){if(P=Xh(p.object,this.coreState.geometry3DMap),!P){let O=(x=p==null?void 0:p.instanceId)!=null?x:p==null?void 0:p.batchId;P=O!=null&&(p!=null&&p.object.userData.entities)?this.coreState.geometry3DMap.get(p==null?void 0:p.object.userData.entities[O]):this.coreState.geometry3DMap.get(p==null?void 0:p.object.userData.entityId)}P!=null&&P.components[2]&&(E=P)}let f=za(M);return{entity2D:((C=c==null?void 0:c.userData)==null?void 0:C.entityId)==="watermark"?{id:"watermark"}:this.coreState.geometry2DMap.get(c==null?void 0:c.userData.entityId),entity3D:E,position:d,groupContainers:f.length>0?f:void 0}}detect3DEntityHover(e){return this.state.lastHover!==e&&(this.state.lastHover&&jc(this.state.lastHover,!1,this.coreState),e&&jc(e,!0,this.coreState)),this.state.hovered3DEntity!==e}detect3DContainerHover(e){return!Ml(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,!1),this._container.removeEventListener("pointermove",this.onPointerMoveRaf,!1),this._container.removeEventListener("pointerup",this.onPointerUp,!1),this._container.removeEventListener("pointercancel",this.onPointerUp,!1)}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=>{var i,a,s;this.queueDebugMessage("CLICK \n3D: ".concat((i=t.entity3D)==null?void 0:i.id," \n2D: ").concat((a=t.entity2D)==null?void 0:a.id," \nPos: ").concat((s=t.position)==null?void 0:s.toArray().join(", ")),"#fdffb6")}),this.on("hover",t=>{var i,a,s;this.queueDebugMessage("HOVER \n3D: ".concat((i=t.entity3D)==null?void 0:i.id," \n2D: ").concat((a=t.entity2D)==null?void 0:a.id," \nPos: ").concat((s=t.position)==null?void 0:s.toArray().join(", ")),"#caffbf")})}get _state(){return this.state}queueDebugMessage(e,t){var a;let i=document.createElement("pre");i.style.maxWidth="300px",i.style.transition="opacity 500ms cubic-bezier(0.4, 0, 0.2, 1)",i.style.backgroundColor=t,i.textContent=e,(a=this.debugPanel)==null||a.prepend(i),setTimeout(()=>{i.style.opacity="0",setTimeout(()=>{i.remove()},500)},2500)}getCursor(){return this.cursor}};Br=new WeakMap,l(Za,"InteractionSystem");var bi=Za;function jc(o,r,e){var s;let t=o.components[2];t&&t.hover!==!0&&(t.hover=r?"user-interaction":!1,t.dirty=!0);let i=(s=o.components[0].textMesh)==null?void 0:s.userData.entityId;if(!i)return;let a=e.geometry3DMap.get(i);(a==null?void 0:a.type)==="text3d"&&(a.components[1].hoverByPolygon=r,a.components[1].dirty=!0)}l(jc,"updateHover");function Hh(o,r,e){return r?"grabbing":o?"pointer":e?"grabbing":"grab"}l(Hh,"processCursor");function Wh(o){let r=o;for(;r!=null&&r.parent;){if(r instanceof It)return;if(r.userData.isSingleModel)return r;r=r.parent}}l(Wh,"findModelParent");function Xh(o,r){let e=Wh(o);return e?r.get(e.userData.entityId):void 0}l(Xh,"findModelParentEntity");b();b();var ir,mt,Wn,Gt,Vc,xi,Xn,Hc,Wc,Si,Yn,Mi,Ci,qn,ja=class ja{constructor(r){D(this,Gt);D(this,ir,null);D(this,mt);h(this,"getCurrentSceneGLTF",l(async r=>{let e=ee({onlyVisible:!0,binary:!0,light:!0,scale:1},r),t=await oe(this,Gt,Vc).call(this),i=n(this,Wn).call(this,e),a=await t.parseAsync(i,{trs:!1,maxTextureSize:1/0,onlyVisible:e.onlyVisible,binary:e.binary,scale:e.scale}),s;if(a instanceof ArrayBuffer)s=new Blob([a],{type:"application/octet-stream"});else{let c=JSON.stringify(a,null,2);s=new Blob([c],{type:"text/plain"})}return s},"getCurrentSceneGLTF"));D(this,Wn,l(r=>{let{scale:e,light:t,onlyVisible:i}=r,a=new It,s=new Le().setFromObject(n(this,mt).entityScene);if(n(this,xi).call(this,n(this,mt).entityScene,a,i),t){let c=new gn(16777215,.3*Math.PI);c.position.set(0,Math.max(s.max.x,s.max.y)*e*.5,s.max.y*e*4),c.lookAt(0,0,-1),c.target.position.set(0,0,-1),c.add(c.target),a.add(c)}return a},"#getExportedScene"));D(this,xi,l((r,e,t)=>{r.material&&(r instanceof mn?oe(this,Gt,Hc).call(this,r).forEach(i=>e.add(i)):r instanceof ii&&e.add(oe(this,Gt,Wc).call(this,r))),r.children.forEach(i=>{(!t||i.visible)&&n(this,xi).call(this,i,e,t)})},"#processObject3D"));D(this,Xn,l((r,e,t)=>{let i=new pl({color:new be(r),metalness:0});return i.opacity=e,i.transparent=t,i},"#createStandardMaterial"));D(this,Si,l(r=>{let{geometry:e,material:t,position:i,rotation:a,quaternion:s,scale:c}=r;if(!(e!=null&&e.isBufferGeometry))return r;let u=e.attributes.position,d=e.attributes.normal,m=e.attributes.uv;return n(this,Yn).call(this,u,d),n(this,Ci).call(this,i,c,a,s),m&&n(this,qn).call(this,m),t!=null&&t.map&&e.type==="PlaneGeometry"&&(r.side=vt),r},"#convertGeometry"));D(this,Yn,l((r,e)=>{let t=new B,i=new B;for(let a=0;a<r.count;a++)t.fromBufferAttribute(r,a),n(this,Mi).call(this,t),r.setXYZ(a,t.x,t.y,t.z),e&&(i.fromBufferAttribute(e,a),n(this,Mi).call(this,i),e.setXYZ(a,i.x,i.y,i.z))},"#convertAttributes"));D(this,Mi,l(r=>{let e=r.y;r.y=r.z,r.z=-e},"#convertVector"));D(this,Ci,l((r,e,t,i)=>{let a=r.y;r.y=r.z,r.z=-a;let s=e.y;if(e.y=e.z,e.z=s,t instanceof xr)t.order="YXZ",t.set(t.x,t.y,t.z,t.order);else{let c=i.y;i.set(i.x,i.z,-c,i.w)}},"#convertObjectProperties"));D(this,qn,l(r=>{for(let e=0;e<r.count;e++){let t=r.getX(e),i=r.getY(e);r.setXY(e,t,i)}},"#convertUVs"));L(this,mt,r),n(this,mt).entityScene=r.entityScene,n(this,mt).geometry3DMap=r.geometry3DMap}destroy(){L(this,ir,null)}};ir=new WeakMap,mt=new WeakMap,Wn=new WeakMap,Gt=new WeakSet,Vc=l(async function(){if(!n(this,ir)){let{GLTFExporter:r}=await import("./GLTFExporter-BPHG4XL7.js");L(this,ir,new r)}return n(this,ir)},"#getGLTFExporter"),xi=new WeakMap,Xn=new WeakMap,Hc=l(function(r){var s,c;let e=[],i=((s=r.userData)!=null&&s.entities?Object.values((c=r.userData)==null?void 0:c.entities):[]).map(u=>n(this,mt).geometry3DMap.get(u)),a=new Map;return i.forEach(u=>{var p;if(!u||!(u instanceof le))return;let d=u.components[1],m=u.components[2];if(!d.visible||d instanceof ht&&d.opacity===0||d instanceof ci||d instanceof Tn)return;let g=m!=null&&m.hover?d.hoverColor||n(this,mt).hoverColor:d.color,M="".concat(g,"-").concat(d.opacity,"-").concat(Number(d.visible));a.has(M)||a.set(M,[]),(p=a.get(M))==null||p.push(u)}),a.forEach((u,d)=>{let[m,g,M]=d.split("-"),p=u.reduce((y,S)=>{if(S.type==="custom-geometry")return y;let v=S.components[0];return"geometry"in v&&v.geometry instanceof hn&&y.push(v.geometry),y},[]),P=n(this,Xn).call(this,m,Number(g),r.material.transparent),E=dt(p,!0),f=new te(E,P);f.position.copy(r.position),f.rotation.copy(r.rotation),f.scale.copy(r.scale),f.visible=!!M,n(this,Ci).call(this,f.position,f.scale,f.rotation,f.quaternion),e.push(n(this,Si).call(this,f))}),e},"#processBatchedMesh"),Wc=l(function(r){let e=r.geometry.clone(),t=r.material,i=new je({color:t.color,side:vt});i.opacity=t.opacity,i.transparent=t.transparent;let a=new ii(e,i);return a.position.copy(r.position),a.rotation.copy(r.rotation),a.scale.copy(r.scale),a.visible=r.visible,n(this,Si).call(this,a)},"#processLineSegments"),Si=new WeakMap,Yn=new WeakMap,Mi=new WeakMap,Ci=new WeakMap,qn=new WeakMap,l(ja,"ExporterSystem");var vi=ja;b();b();var Yh="gray",qh=.1,wi=100,Va=new ct.ClipperOffset;function $h(o,r){Va.Clear(),r/=2;let e=o.map(i=>({X:i.x*wi,Y:i.y*wi}));Va.AddPath(e,ct.JoinType.jtMiter,ct.EndType.etClosedPolygon);let t=new ct.Paths;return Va.Execute(t,r*wi),t.length?t.map(a=>a.map(s=>({x:s.X/wi,y:s.Y/wi}))):[o]}l($h,"offset");function $n(o,r,e){var p,P,E,f,y;let{color:t=Yh,opacity:i=1,altitude:a=0,height:s=qh}=e||{};Array.isArray(i)&&(i=1);let c={min:{x:1/0,y:1/0,z:a},max:{x:-1/0,y:-1/0,z:s+a},center:{x:0,y:0,z:(s+a)/2}},d=o.geometry.coordinates[0].map(S=>{let v=r(S[1],S[0]);return c.min.x=Math.min(c.min.x,v.x),c.min.y=Math.min(c.min.y,v.y),c.max.x=Math.max(c.max.x,v.x),c.max.y=Math.max(c.max.y,v.y),v});((P=(p=o.properties)==null?void 0:p.style)==null?void 0:P.edgeOffset)!=null&&o.properties.style.edgeOffset!==0||((E=o.properties)==null?void 0:E.image)!=null?d=$h(d,((y=(f=o.properties)==null?void 0:f.style)==null?void 0:y.edgeOffset)||0):d=[d];let m=[];for(let S of d){let v=new Mr;v.moveTo(S[0].x,S[0].y),S.slice(1).forEach(A=>v.lineTo(A.x,A.y)),v.lineTo(S[0].x,S[0].y);let x=o.geometry.coordinates.slice(1);v.holes=x.map(A=>{let I=A.map(G=>r(G[1],G[0])),F=new Sr;return F.moveTo(I[0].x,I[0].y),I.slice(1).forEach(G=>F.lineTo(G.x,G.y)),F.lineTo(I[0].x,I[0].y),F});let C=ai(e==null?void 0:e.bevel,s),O=new Cr(v,C);O.userData={style:{color:t,opacity:i},usedBevelSettings:C},m.push(O)}if(m.length===1)return m[0];let g=dt(m);m.forEach(S=>S.dispose());let M=ai(e==null?void 0:e.bevel,s);return g.userData={style:{color:t,opacity:i},usedBevelSettings:M,_split:!0},g}l($n,"renderPolygonGeometry");b();var Jh="gray",Kh=.1;function Jn(o,r,e){let{color:t=Jh,opacity:i=1,altitude:a=0,height:s=Kh}=e||{};Array.isArray(i)&&(i=1);let c={min:{x:1/0,y:1/0,z:a},max:{x:-1/0,y:-1/0,z:s+a}},u=ai(e==null?void 0:e.bevel,s),d=[];o.geometry.coordinates.forEach(g=>{let M=new Mr,p=g[0].map(f=>{let y=r(f[1],f[0]);return c.min.x=Math.min(c.min.x,y.x),c.min.y=Math.min(c.min.y,y.y),c.max.x=Math.max(c.max.x,y.x),c.max.y=Math.max(c.max.y,y.y),y});M.moveTo(p[0].x,p[0].y),p.slice(1).forEach(f=>M.lineTo(f.x,f.y)),M.lineTo(p[0].x,p[0].y);let P=g.slice(1);M.holes=P.map(f=>{let y=f.map(v=>r(v[1],v[0])),S=new Sr;return S.moveTo(y[0].x,y[0].y),y.slice(1).forEach(v=>S.lineTo(v.x,v.y)),S.lineTo(y[0].x,y[0].y),S});let E=new Cr(M,u);d.push(E)});let m=dt(d);return d.forEach(g=>g.dispose()),m.translate(0,0,a||0),m.userData={style:{color:t,opacity:i},usedBevelSettings:u},m}l(Jn,"renderMultiPolygonGeometry");b();var Be=100,Qh=.22,eu=.01;function Xc(o,r,e={}){let{width:t=Qh,height:i=eu,color:a="gray",opacity:s=1,altitude:c=0}=e,u={min:{x:1/0,y:1/0,z:c},max:{x:-1/0,y:-1/0,z:c+i}},d={bevelEnabled:!1,depth:i},m=new ct.ClipperOffset,g=o.geometry.coordinates.map(E=>E.map(f=>r(f[1],f[0])));m.AddPaths(g.map(E=>E.map(f=>({X:f.x*Be,Y:f.y*Be}))),ct.JoinType.jsMiter,ct.EndType.etOpenRound);let M=new ct.PolyTree;m.Execute(M,t/2*Be);let p=[];for(let E of M.m_AllPolys){let f=new Mr;if(E.IsHole())continue;u.min.x=Math.min(u.min.x,E.m_polygon[0].X),u.min.y=Math.min(u.min.y,E.m_polygon[0].Y),u.max.x=Math.max(u.max.x,E.m_polygon[0].X),u.max.y=Math.max(u.max.y,E.m_polygon[0].Y);let y=E.m_polygon;f.moveTo(y[0].X/Be,y[0].Y/Be),y.slice(1).forEach(S=>f.lineTo(S.X/Be,S.Y/Be)),f.lineTo(y[0].X/Be,y[0].Y/Be),f.holes=E.m_Childs.map(S=>{let v=new Sr,x=S.m_polygon;return v.moveTo(x[0].X/Be,x[0].Y/Be),x.slice(1).forEach(C=>v.lineTo(C.X/Be,C.Y/Be)),v.lineTo(x[0].X/Be,x[0].Y/Be),v}),p.push(new Cr(f,d))}let P=dt(p);return P.translate(0,0,c||0),P.userData={style:{color:a,opacity:s}},m.Clear(),P}l(Xc,"renderMultiLineStringGeometry");b();b();var zr=N.object({type:N.enum(["Point"]),coordinates:N.array(N.number()).min(2).max(3)});var tu=N.object({rotation:N.array(N.number()).length(3).optional(),altitude:N.number().optional(),scale:N.array(N.number()).length(3).optional(),interactive:N.boolean().optional(),verticalOffset:N.number().optional(),id:N.union([N.number(),N.string()]).optional()}),ru=N.object({type:N.enum(["Feature"]),geometry:zr,properties:tu}),iu=N.object({type:N.enum(["FeatureCollection"]),features:N.array(ru)}),nu=N.object({color:N.string()}),ou=N.object({url:N.string(),color:N.string().optional(),opacity:N.number().optional(),material:N.record(N.string(),nu).optional()});function qc(o,r,e){N.union([N.number(),N.string()]).parse(o),iu.parse(r),ou.parse(e)}l(qc,"validateModelGroup");var Ti,Pi,Ha=class Ha{constructor(r){h(this,"mesh");h(this,"type","model");h(this,"positionDirty",!0);h(this,"outline");h(this,"geometry");h(this,"material");h(this,"feature");h(this,"instanceIndex",-1);h(this,"visible",!0);h(this,"color",new be);h(this,"position",new B);D(this,Ti,0);D(this,Pi,1);this.feature=r}setOpacity(){}setColor(){}get altitude(){return n(this,Ti)}set altitude(r){this.mesh&&(this.mesh.position.z=r,L(this,Ti,r))}getRotation(){return this.mesh?[this.mesh.rotation.x,this.mesh.rotation.y,this.mesh.rotation.z]:void 0}setRotation(r){this.mesh&&this.mesh.rotation.set(q.degToRad(r[0]),q.degToRad(r[1]),q.degToRad(r[2]))}getScale(){return this.mesh?[this.mesh.scale.x,this.mesh.scale.y,this.mesh.scale.z]:void 0}setScale(r){this.mesh&&this.mesh.scale.set(r[0],r[1],r[2])}get opacity(){return n(this,Pi)}set opacity(r){var e,t,i;if(this.mesh){if(this.mesh.children[0]instanceof Lt){for(let a of this.mesh.children)if(a instanceof Lt){((e=a.userData)==null?void 0:e.originalOpacity)===void 0&&(a.userData.originalOpacity=a.material.opacity);let s=er(r,0,(t=a.userData)==null?void 0:t.originalOpacity,0,1);a.material.opacity=s,a.material.transparent=s<1,a.material.needsUpdate=!0}}else(i=this.mesh)==null||i.traverse(a=>{a instanceof te&&a.material&&(Array.isArray(a.material)?a.material.forEach(s=>{Yc(s,r)}):Yc(a.material,r))});L(this,Pi,r)}}};Ti=new WeakMap,Pi=new WeakMap,l(Ha,"ModelComponent");var Bt=Ha;function Yc(o,r){o.opacity!==r&&(r===1?(o.opacity=1,o.transparent=!1):(o.opacity=r,o.transparent=!0),o.needsUpdate=!0)}l(Yc,"updateMaterialOpacity");b();function Kn(o){var c,u;let r=o.components[0],e=o.components[1];e.opacity!=null&&e.opacity!==r.opacity&&(r.opacity=e.opacity);let t=e.material,i=e.color;if(t||i){let d=au(i,t);(c=r.mesh)==null||c.traverse(m=>{m instanceof te&&m.material&&(Array.isArray(m.material)?m.material.forEach(g=>{d[g.name]?g.color.set(d[g.name].color):g.color.set(i)}):d[m.material.name]?m.material.color.set(d[m.material.name].color):m.material.color.set(i))})}let a=(u=r.feature.geometry.coordinates[2])!=null?u:0,s=e.verticalOffset+a;r.altitude!==s&&(r.altitude=s),e.visible!==r.visible&&(r.visible=e.visible),e.rotation&&r.setRotation(e.rotation),e.scale&&r.setScale(e.scale)}l(Kn,"applyModelGeometryStyle");function au(o,r){let e={};if(o&&Object.assign(e,{Default:{color:o},Fabric:{color:o},Mpdn_Logo:{color:o},CouchLogo:{color:o}}),r)for(let t in r)r[t].color&&(e[t]?e[t].color=r[t].color:e[t]={color:r[t].color});return e}l(au,"consolidateColorAndMaterial");function $c(o,r){var s,c;let e=o.components[0],i=(s=o.components[1].verticalOffset)!=null?s:0,a=e.feature.geometry.coordinates.slice();a[2]=((c=a[2])!=null?c:0)+i,e.mesh?e.mesh.position.copy(r(a)):e.position.copy(r(a))}l($c,"applyModelPosition");function Jc(o){return o instanceof Ce?o.material:null}l(Jc,"getMaterial");function Kc(o){return o.side===Wo?"back":o.side===ti?"front":"double"}l(Kc,"getMaterialSide");function Qc(o,r){o.side=r==="back"?Wo:r==="front"?ti:vt}l(Qc,"setMaterialSide");function su(o){let{color:r,opacity:e,topColor:t,texture:i,topTexture:a}=o;return"".concat(r).concat(e).concat(t||"").concat(i||"").concat(a||"")}l(su,"generateIndex");var Wa=class Wa extends J{constructor(e,t){super();h(this,"state");h(this,"convertTo3DMapPosition");h(this,"loader");h(this,"optimizePromise",[]);this.state=e,this.convertTo3DMapPosition=t}async getGLTFLoader(){if(this.loader)return this.loader;let{GLTFLoader:e}=await import("./GLTFLoader-5XXRE2UW.js");return this.loader=new e,this.loader}createEntityFromFeature(e,t,i){var m,g,M;let a=new Ce(t),s=(m=t==null?void 0:t.properties)==null?void 0:m.bevel,c=i&&"bevel"in i?i.bevel:void 0,u;c?u=ee(ee({},s),c):s&&(u=s);let d=new le(a,new ht(Fe(ee({},i),{url:(M=(g=t.properties)==null?void 0:g.image)==null?void 0:M.path,bevel:u})));return i!=null&&i.outline&&(d.components[3]=new Wl(ql(i.color))),i!=null&&i.focusable&&(d.components[4]=new di),d.id=e,d}createModelFromFeature(e,t,i){let a=new Bt(t),s=ee({},i);t.properties.verticalOffset!=null&&(s.verticalOffset=t.properties.verticalOffset),t.properties.rotation!=null&&(s.rotation=t.properties.rotation),t.properties.scale!=null&&(s.scale=t.properties.scale);let c=new Tn(s),u=new le(a,c);return u.id=e,u}populateEntityMesh(e,t){let i=e.components[0];i.geometry=t,i.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},i.currentHeight=e.components[1].height,i.dirty=!1}async populateModelGroup(e,t,i){let a=new Ke,s=new xr,c=new dn,u=new B,d=new At,m=await this.getGLTFLoader(),g=new Promise(M=>{m.load(t,p=>{"entities3D"in i.userData&&(i.userData.entities3D.size>1?p.scene.traverse(P=>{let E=P;if("isMesh"in E&&E.isMesh===!0){let f=new Lt(E.geometry,E.material,e.size);f.userData={entities:{}},d.add(f),i.add(d)}}):(p.scene.traverse(P=>{"isMesh"in P&&P.isMesh===!0&&(P.position.set(0,0,0),P.rotation.set(0,0,0),P.scale.set(1,1,1),P.updateMatrix())}),d.add(p.scene),i.add(d),d.userData.isSingleModel=!0,d.userData.entityId=e.values().next().value,d.userData.type="model")),M()})});return this.optimizePromise.push(g.then(()=>{var P,E,f,y,S,v,x,C,O,A,I,F;let M=0,p;for(let G of e.values()){if(p=this.state.geometry3DMap.get(G),!p||(p==null?void 0:p.type)!=="model")continue;let R=p.components[0],Z=p.components[1],k=p.components[0].feature;R.mesh=d,R.instanceIndex=M,Kn(p),p.components[1].dirty=!1;let{x:U,y:Q}=this.convertTo3DMapPosition(k.geometry.coordinates[1],k.geometry.coordinates[0],0);R.position.set(U,Q,R.altitude),s.set(q.degToRad((E=(P=Z.rotation)==null?void 0:P[0])!=null?E:Lr[0]),q.degToRad((y=(f=Z.rotation)==null?void 0:f[1])!=null?y:Lr[1]),q.degToRad((v=(S=Z.rotation)==null?void 0:S[2])!=null?v:Lr[2])),u.set((C=(x=Z.scale)==null?void 0:x[0])!=null?C:Ir[0],(A=(O=Z.scale)==null?void 0:O[1])!=null?A:Ir[1],(F=(I=Z.scale)==null?void 0:I[2])!=null?F:Ir[2]),c.setFromEuler(s),a.compose(R.position,c,u),d.children.forEach($=>{!p||(p==null?void 0:p.type)!=="model"||!($ instanceof Lt)||($.setMatrixAt(M,a),$.userData.entities[M]=p.id)}),R.mesh.userData.isSingleModel&&(R.mesh.matrix.copy(a),R.mesh.matrix.decompose(R.mesh.position,R.mesh.quaternion,R.mesh.scale)),M++}this.publish("model-loaded")})),d}populateEntityGroup(e){var c;let t,i,a,s;for(let u of e.values())s=this.state.geometry3DMap.get(u),s.components[0]instanceof Ce&&(i=s.components[0].feature,a=s.components[1],i.geometry.type==="Polygon"?(t=$n(i,this.convertTo3DMapPosition,a),(c=i.properties)!=null&&c.textures&&i.properties.textures.length>0&&$l(t,i.properties.textures,this.state.naturalBearing,this.convertTo3DMapPosition),this.populateEntityMesh(s,t)):i.geometry.type==="MultiPolygon"?(t=Jn(i,this.convertTo3DMapPosition,a),this.populateEntityMesh(s,t)):i.geometry.type==="LineString"?(t=yc(i,this.convertTo3DMapPosition,a),this.populateEntityMesh(s,t)):i.geometry.type==="MultiLineString"&&(t=Xc(i,this.convertTo3DMapPosition,a),this.populateEntityMesh(s,t)));return e}update(){var e;for(let t of this.state.geometryGroupIdsToLoad.values()){let i=this.state.geometry3DMap.get(t);if(i instanceof Qe&&i.userData.dirty){if(i.userData.modelURL)i.userData.modelURL&&(this.populateModelGroup(i.userData.entities3D,i.userData.modelURL,i),i.userData.dirty=!1);else try{this.populateEntityGroup(i.userData.entities3D)}catch(c){W.warn(c)}let a,s={};for(let c of i.userData.entities3D.values()){a=this.state.geometry3DMap.get(c);let u=a==null?void 0:a.components[0];if((a==null?void 0:a.type)==="geometry"){let d=a.components[1],m=su(d);s[m]===void 0&&(s[m]={style:d,entities:[]}),s[m].entities.push(a)}else u&&"mesh"in u&&u.mesh&&((e=u.mesh)==null?void 0:e.parent)!==i&&i.add(u.mesh)}for(let c in s){let u=Yl(s[c].entities,s[c].style);i.add(u)}for(let c of i.userData.entities3D.values())if(a=this.state.geometry3DMap.get(c),a!=null&&a.entities2D.size>0)for(let u of a.entities2D.values())u&&(a.attach(u),this.publish("geometry-2d-added"));this.publish("geometry-group-added"),i.userData.dirty=!1}}return Promise.resolve()}};l(Wa,"MeshCreationAndOptimizationSystem");var Qn=Wa;b();var Xa=class Xa{constructor(r,e){h(this,"state");h(this,"dirty",!0);h(this,"domTree");this.state=r,this.domTree=e}update(){if(this.dirty){let r;for(let e of Array.from(this.domTree.children))if(r=this.state.geometry2DMap.get(e.userData.entityId),r){let t=r.components[0];(!t.enabled||!t.visible||!this.state.geometry2DIdsInScene.has(e.userData.entityId))&&this.domTree.removeChild(e)}else this.domTree.removeChild(e);for(let e of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(e),r){let t=r.components[0];t instanceof Mt&&t.enabled&&t.markerContainer&&!this.domTree.contains(t.markerContainer)&&(t.markerContainer.userData={entityId:r.id},this.domTree.appendChild(t.markerContainer),t.updateDimensions())}this.dirty=!1}}};l(Xa,"DOMVisibilitySystem");var eo=Xa;b();var Ya=class Ya{constructor(r,e){h(this,"state");h(this,"project");this.state=r,this.project=e}update(){let r,e=0,t,i;for(let a of this.state.geometry2DIdsInScene)if(r=this.state.geometry2DMap.get(a),r){i=r.components[0];let s=r.attachedTo?this.state.geometry3DMap.get(r.attachedTo):void 0;if(s instanceof le)if(this.state.geometry3DIdsInScene.has(s.id)){t=s.components[1],i=r.components[0],(t.dirty||r.components[0].attachedDirty)&&(e=t.height,r.setAltitude(e));let c=t.visible;i.visible!==c&&(i.visible=c)}else i.visible===!0&&(i.visible=!1);this.project(r.components[0].projection,r.position),r.components[0].attachedDirty=!1}}};l(Ya,"TwoDProjectionSystem");var to=Ya;b();b();b();var lu=l(function(){let r,e;return t=>{if((!e||!e)&&(r=document.createElement("canvas"),r.width=500*t,r.height=500*t,r.style.width="500px",r.style.height="500px",e=r.getContext("2d")),!e)throw new Error("Could not get 2D context");return{measureCanvas:r,measureCanvasContext:e}}},"createMeasureCanvasContext")(),ed=l(({text:o,size:r,maxWidth:e,pixelRatio:t,maxLines:i=2,lineHeight:a=1.2,options:s={strokeText:!0}})=>{let c="bold ".concat(r*t,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),{measureCanvasContext:u}=lu(t);u.font=c;let d=[],m=o.split(" "),g=0,M=0,p=0;for(;M<m.length;){let y=m[M];if(g===i&&g>0){d[g-1]+="...";break}if(d[g]==null&&(d[g]=y,M++),m.length===1){d[g]=y;break}if(m[M]==null)break;let{width:S}=u.measureText(d[g]+" "+m[M]);S<=e*t?(d[g]+=" "+m[M],M++):g++}d.forEach(y=>{let{width:S}=u.measureText(y);p=Math.max(S,p)});let P=r*t*a,E=d.length*P;return{maxWidth:p,maxHeight:E,lines:d.length,draw:l((y,S,v)=>{d.length===1?(s.strokeText&&y.strokeText(d[0],S,v),y.fillText(d[0],S,v)):(s.strokeText&&(y.strokeText(d[0],S,v-P/2),y.strokeText(d[1],S,v+P/2)),y.fillText(d[0],S,v-P/2),y.fillText(d[1],S,v+P/2))},"draw")}},"shaveText");b();function td(o){let r=new Image;return o&&(/<svg[\s\S]*>/i.test(o)?r.src="data:image/svg+xml;base64,".concat(btoa(o)):r.src=o),r}l(td,"createImage");var $a=class $a extends J{constructor(e,t,i){super();h(this,"dirty",!1);h(this,"state");h(this,"colliderContext");h(this,"colliderCanvas");h(this,"transformRequestFunc");h(this,"transformRequest",l(async e=>this.transformRequestFunc?await this.transformRequestFunc(e):{url:e},"transformRequest"));h(this,"pinCache",{});h(this,"imageCache",{});h(this,"imagePromiseCache",{});h(this,"imageDimensionsCache",{});h(this,"textCache",{});h(this,"update",l(e=>{let t=this.state.pixelRatio;this.colliderContext.clearRect(0,0,this.colliderCanvas.width,this.colliderCanvas.height);let i,a,s,c,u,d,m;for(let g of this.state.geometry2DIdsInScene)if(m=this.state.geometry2DMap.get(g),m!=null&&(d=m.components[0],d instanceof St&&!m.disposed)){if(u=d.appearance.iconVisible,d.appearance.icon!=null&&u!=null){let p=typeof u=="boolean"?u:e>=u;p!==d.iconVisible&&(d.iconVisible=p,d.dirty=!0)}if((d.dirty||this.dirty)&&d.calculatePinSize(),a={active:d.appearance.pinColor,inactive:d.appearance.pinColorInactive},s={active:d.appearance.pinOutlineColor,inactive:d.appearance.pinOutlineColorInactive},c=wr(d.pinSize,2),i="".concat(a.active,"-").concat(a.inactive,"-").concat(s.active,"-").concat(s.inactive,"-").concat(c,"-").concat(d.iconVisible),d.labelCacheId=i,(!this.pinCache[i]||this.dirty)&&(this.prepare(d,i,this.colliderContext),d.dirty=!0),(d.appearance.icon&&(!d.imageHash||d.pinDirty)||this.dirty)&&this.cacheImage(d),this.textCache[d.id]==null||d.textDirty||this.dirty){d.dirty=!0,this.textCache[d.id]={};let{textDrawFn:p,width:P,height:E}=this.processText(d.text,d.appearance.textSize,d.appearance.maxWidth,d.appearance.maxLines,d.appearance.lineHeight);["left","center","right"].forEach(f=>{this.textCache[d.id][f]=this.textToCanvas(p,d.appearance.textSize,f,P,E,d.appearance.textColor,d.appearance.textOutlineColor)}),d.dimensions={width:Math.ceil(P/t),height:Math.ceil(E/t)}}let M=1;if(d.appearance.iconScale)if(typeof d.appearance.iconScale=="number")M=d.appearance.iconScale;else{let{on:p,input:P,output:E,easing:f}=d.appearance.iconScale;p==="zoom-level"?M=Il(e,P,E,f!=null?f:"linear"):W.warn("Unsupported interpolation property: ".concat(p))}d.recomputeCurrentStrategy(d.iconVisible?M:1),d.canShow&&d.visible&&(d.enabled||d.visibilityNeedsUpdate!==!1)&&this.draw(d,i,this.colliderContext),d.textDirty=!1,d.pinDirty=!1}this.dirty=!1},"update"));h(this,"processText",l((e,t,i,a,s)=>{let c=this.state.pixelRatio,{draw:u,maxWidth:d,maxHeight:m}=ed({text:e,size:t,pixelRatio:c,maxWidth:i,maxLines:a,lineHeight:s});return{textDrawFn:u,width:d+2.5*c*2,height:m+2.5*c*2}},"processText"));h(this,"textToCanvas",l((e,t,i,a,s,c,u)=>{let d=this.state.pixelRatio,m,g=a,M=s;window.OffscreenCanvas!=null&&!Rl()?m=new OffscreenCanvas(g,M):(m=document.createElement("canvas"),m.width=g,m.height=M,m.style.width=g+"px",m.style.height=M+"px");let p=m.getContext("2d",{willReadFrequently:!0});if(!p)return;let P=2.5*d;p.textAlign=i,p.font="bold ".concat(t*d,"px 'InterUI-Regular', Helvetica Neue, Arial, sans-serif"),p.textBaseline="middle",p.lineJoin="miter",p.miterLimit=2,p.strokeStyle="white",p.lineWidth=P,p.fillStyle=c,p.strokeStyle=u;let E=i==="left"?P/2:i==="center"?g/2:g-P/2;return e(p,E,(M+P/2)/2),m},"textToCanvas"));h(this,"cacheImage",l(e=>{if(!e.appearance.icon)return;let t=Gl(e.appearance.icon);this.imagePromiseCache[t]||(this.imagePromiseCache[t]=new Promise(i=>{this.transformRequest(e.appearance.icon).then(a=>{let s=td(a.url);s.onload=()=>{this.imageCache[t]=s,this.publish("img:loaded"),i(s)}})})),e.imageHash!==t&&(e.imageHash=t,this.imagePromiseCache[t].then(()=>{e.dirty=!0}))},"cacheImage"));h(this,"createPinCanvas",l((e,t,i,a,s=1)=>{let c,u=this.state.pixelRatio,d=e.totalPinSize*2*u*s;window.OffscreenCanvas!=null?c=new OffscreenCanvas(d,d):(c=document.createElement("canvas"),c.width=d,c.height=d,c.style.width=d/u+"px",c.style.height=d/u+"px");let m=c.getContext("2d");return m.shadowColor="rgba(0,0,0,0.3)",m.shadowOffsetY=2*u,m.shadowBlur=5*u,m.beginPath(),m.arc(d/2,d/2,(t/2+2.5*u/2)*s,0,2*Math.PI),m.fillStyle=i,m.fill(),m.beginPath(),m.arc(d/2,d/2,t/2*s,0,2*Math.PI),m.shadowColor="transparent",m.fillStyle=a,m.fill(),c},"createPinCanvas"));h(this,"prepare",l((e,t,i)=>{let a=this.state.pixelRatio;i.lineWidth=4*a;let s=typeof e.appearance.iconScale=="number"?[e.appearance.iconScale]:e.appearance.iconScale==null?[]:e.appearance.iconScale.output,c=s.length>0?Math.max(...s):void 0,u=this.createPinCanvas(e,e.pinSize,e.appearance.pinOutlineColor,e.appearance.pinColor,c),d=this.createPinCanvas(e,3.5*a,e.appearance.pinOutlineColorInactive,e.appearance.pinColorInactive,c);this.pinCache[t]=[u,d]},"prepare"));this.state=e,this.colliderCanvas=t,this.colliderContext=t.getContext("2d"),this.transformRequestFunc=i}draw(e,t,i){var m;if(!e.canShow||!e.visible)return;i.save(),i.globalAlpha=e.opacity;let a=this.state.pixelRatio,s=e.projection.x*a,c=e.projection.y*a,u=e.style.pinVisibility===1?this.pinCache[t][0]:this.pinCache[t][1],d=e.style.pinVisibility===1?e.scaledPinSize*a:e.totalPinSize*a;if(e.style.pinVisibility!==0&&i.drawImage(u,s-d,c-d,d*2,d*2),e.appearance.icon&&e.iconVisible&&e.imageHash&&e.appearance.iconSize&&this.imageCache[e.imageHash]&&e.style.pinVisibility===1){let g=this.imageCache[e.imageHash],M=(e.scaledPinSize-e.scaledIconPadding)*a,p=e.appearance.iconFit,P=M,E=M,f="".concat(e.imageHash,"_").concat(p);if(this.imageDimensionsCache[f])P=this.imageDimensionsCache[f].width,E=this.imageDimensionsCache[f].height;else{let y=g.width*a,S=g.height*a;if(p==="contain"){let v=Math.sqrt(y**2+S**2),x=M/v;P=y*x,E=S*x}if(p==="cover"){let v=M/y,x=M/S,C=Math.max(v,x);P=y*C,E=S*C}}i.save(),i.beginPath(),i.arc(s,c,M/2,0,2*Math.PI),i.closePath(),((m=e==null?void 0:e.appearance)==null?void 0:m.iconOverflow)!=="visible"&&i.clip(),i.drawImage(g,s-P/2,c-E/2,P,E),i.restore()}e.style.textLabelVisible&&e.style.textAlign!=null&&e.style.left!=null&&e.style.top!=null&&i.drawImage(this.textCache[e.id][e.style.textAlign],s+e.style.left*a,c+e.style.top*a),i.restore()}};l($a,"TwoDDrawSystem");var ro=$a;b();b();var zt=class zt{constructor(){h(this,"loader");this.loader=new fn}static getInstance(){return zt.instance||(zt.instance=new zt),zt.instance}getLoader(){return this.loader}load(r){return new Promise((e,t)=>{this.loader.load(r,e,void 0,t)})}};l(zt,"TextureLoaderSingleton"),h(zt,"instance");var Ja=zt,Zt=Ja.getInstance();function mu(o,r){let e=o.components[2],t=o.components[1];return e!=null&&e.hover?[t.hoverColor||r,t.hoverColor||r]:[t.color,t.topColor||t.color]}l(mu,"processColor");var nr,Ei,Ka=class Ka extends J{constructor(e,t){super();D(this,nr);h(this,"state");h(this,"convertTo3DMapPosition");h(this,"textureLoadingCache",new Map);this.convertTo3DMapPosition=t,this.state=e}processTextures(e,t,i){var a;if(t.texture!==e.texture&&t.texture!==""&&oe(this,nr,Ei).call(this,t.texture,e,"texture"),t.topTexture!==e.topTexture&&t.topTexture!==""&&oe(this,nr,Ei).call(this,t.topTexture,e,"topTexture"),(e.texture==null||e.topTexture==null)&&Array.isArray((a=e.feature.properties)==null?void 0:a.textures)&&e.feature.properties.textures.length>0)for(let s of e.feature.properties.textures)s.face==="top"&&e.topTexture!==s.path?oe(this,nr,Ei).call(this,s.path,e,"topTexture"):s.face==="side"&&e.texture!==s.path&&oe(this,nr,Ei).call(this,s.path,e,"texture"),e.blendTexture=!0;(e.texture!=null||e.topTexture!=null)&&(i!=null&&i.hover&&e.texturesVisible?e.hideTextures():e.texturesVisible||e.showTextures(),t.texture===""&&e.removeSideTexture(),t.topTexture===""&&e.removeTopTexture())}update(){var a,s,c,u,d,m,g,M,p,P,E,f,y,S,v,x,C;let e,t,i;for(let O of this.state.geometry3DIdsInScene)if(i=this.state.geometry3DMap.get(O),i&&(i.type==="geometry"||i.type==="custom-geometry")&&((a=i.components[1])!=null&&a.dirty||(s=i.components[2])!=null&&s.dirty)){let A=i.components[0],I=i.components[1];t=i.components[2];let F=mu(i,this.state.hoverColor);A.setColor(F[0],F[1]);let G=Jc(A);if(I.visible!==A.visible&&(A.visible=I.visible,A instanceof Ce&&A.textMesh)){let Z=this.state.geometry3DMap.get(A.textMesh.userData.entityId);(Z==null?void 0:Z.type)==="text3d"&&Z.components[0].polygonEntityId!=null&&(Z.components[0].visible=I.visible)}I.altitude!==A.altitude&&(A.altitude=I.altitude);let R=I.opacity*Dr(i);R!==A.opacity&&(A.opacity=R),I.renderOrder!==A.renderOrder&&(A.renderOrder=I.renderOrder),G&&I.side!==Kc(G)&&Qc(G,I.side),A instanceof Ce&&I.shading!=null&&(((c=I.shading)==null?void 0:c.start)!==(G==null?void 0:G.getGradientShading().start)||((u=I.shading)==null?void 0:u.end)!==(G==null?void 0:G.getGradientShading().end)||((d=I.shading)==null?void 0:d.intensity)!==(G==null?void 0:G.getGradientShading().intensity))&&(G==null||G.setGradientShading((g=(m=I.shading)==null?void 0:m.start)!=null?g:0,(p=(M=I.shading)==null?void 0:M.end)!=null?p:0,(E=(P=I.shading)==null?void 0:P.intensity)!=null?E:0)),I.dirty=!1,A instanceof Ce&&this.processTextures(A,I,t),i.components[2]&&(i.components[2].dirty=!1)}else if((i==null?void 0:i.type)==="model")i.components[1].dirty&&(Kn(i),i.components[1].dirty=!1),i.components[0].positionDirty&&($c(i,this.convertTo3DMapPosition),i.components[0].positionDirty=!1);else if((i==null?void 0:i.type)==="image"&&((f=i.components[1])!=null&&f.dirty)){e=i.components[0];let A=i.components[1];A.visible!==e.visible&&(e.visible=A.visible),A.dirty=!1}else if((i==null?void 0:i.type)==="text3d"&&((y=i.components[1])!=null&&y.dirty)&&i.components[0].polygonEntityId!=null){e=i.components[0];let A=i.components[1];A.visible!=null&&A.visible!==e.visible&&(e.visible=A.visible);let{textMesh:I}=e;if(I){Object.assign(I,A.getState());let F=(S=A.hoverColor)!=null?S:this.state.text3dHoverColor;I.color=A.hoverByPolygon?F:(v=A.color)!=null?v:_r.color,I.outlineColor=A.hoverByPolygon?F:(x=A.outlineColor)!=null?x:_r.outlineColor,I.strokeColor=A.hoverByPolygon?F:(C=A.strokeColor)!=null?C:_r.strokeColor}A.dirty=!1}}destroy(){this.textureLoadingCache.forEach(async e=>{(await e).dispose()}),this.textureLoadingCache.clear()}};nr=new WeakSet,Ei=l(async function(e,t,i){if(!(!e||!t.showTextures))if(this.textureLoadingCache.has(e)){i==="topTexture"?t.topTexture=await this.textureLoadingCache.get(e):t.texture=await this.textureLoadingCache.get(e),t.showTextures();return}else{let a=new Promise((s,c)=>{Zt.getLoader().load(e,u=>{i==="topTexture"?t.topTexture=u:t.texture=u,t.showTextures(),this.publish("texture-loaded"),s(u)},void 0,()=>{W.error("Failed to load texture: ".concat(e)),c("Failed to load texture: ".concat(e))})});this.textureLoadingCache.set(e,a)}},"#loadTexture"),l(Ka,"DrawSystem");var io=Ka;b();var Qa=class Qa extends J{constructor(e){super();h(this,"state");h(this,"animating",new Map);h(this,"isAnimating",!1);h(this,"startTime",-1);h(this,"showDuration",300);h(this,"hideDuration",250);h(this,"update",l(()=>{this.animating.clear();let e,t;for(let i of this.state.geometry2DIdsInScene)e=this.state.geometry2DMap.get(i),e&&(t=e.components[0],t instanceof St&&(t.visibilityNeedsUpdate==="show"?(t.canShow=!0,this.animating.set(t,[t.opacity,1])):t.visibilityNeedsUpdate==="hide"&&this.animating.set(t,[t.opacity,0])));this.startTime=performance.now(),this.publish("animate:2d")},"update"));h(this,"playAnimations");this.state=e,this.playAnimations=this._playAnimations}_playAnimations(){let e=performance.now();for(let[t,[i,a]]of this.animating.entries()){let s=a===1?this.showDuration:this.hideDuration,c=(e-this.startTime)/s;t.opacity=er(c,0,1,i,a,a===0?El:Dl),e-this.startTime>=s&&(a===1?t.canShow=!0:a===0&&(t.canShow=!1),t.visibilityNeedsUpdate=!1,this.animating.delete(t))}this.publish("draw:2d"),this.animating.size>0&&this.publish("animate:2d")}};l(Qa,"TwoDVisibilitySystem");var no=Qa;b();var es=class es extends J{constructor(e,t,i,a,s,c,u){super();h(this,"state");h(this,"renderer");h(this,"mode");h(this,"scene");h(this,"cameraObject");h(this,"viewCamera");h(this,"systems");h(this,"needs2DRecompute",!1);h(this,"twoDdirty",!0);h(this,"threeDdirty",!0);h(this,"frameId",null);h(this,"twoDFrameId",null);h(this,"animationFrameId",null);h(this,"nextFrame",null);h(this,"update",l((e=!1)=>{var t;if(((t=this.renderer)==null?void 0:t.renderer)==null)return Promise.resolve();if(e){let i=this.commitRenderState();return this.paint(),i}else return this.frameId?Promise.resolve():new Promise((i,a)=>{this.frameId=requestAnimationFrame(()=>{var s,c;return((s=this.renderer)==null?void 0:s.renderer)==null?i():this.mode==="standalone"?(c=this.commitRenderState())==null?void 0:c.then(()=>{this.paint(),i()}).catch(u=>{a(u)}):i()})})},"update"));h(this,"animate2D",l(()=>{this.animationFrameId=requestAnimationFrame(()=>{this.animationFrameId=null,this.systems.twoDVisiblitySystem.playAnimations()})},"animate2D"));h(this,"drawEntities2D",l(()=>{this.twoDFrameId||(this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel())}))},"drawEntities2D"));h(this,"updateEntities2D",l(()=>{this.twoDFrameId&&(cancelAnimationFrame(this.twoDFrameId),this.twoDFrameId=null),this.twoDFrameId=requestAnimationFrame(()=>{this.twoDFrameId=null,this.systems.watermarkSystem.insertIntoQuadTree(this.systems.collisionSystem.interactiveCollidersQTree),this.systems.interactionSystem.updateQuadtree(this.systems.collisionSystem.interactiveCollidersQTree),this.systems.twoDVisiblitySystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting())})},"updateEntities2D"));h(this,"commitRenderState",l(()=>{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(),Nl(this.state.entityScene,this.state.geometry2DIdsInScene),this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.collidersDirty=!0,this.systems.domMutationSystem.dirty=!0,this.systems.panBoundsSystem.dirty=!0,this.twoDdirty=!1),this.threeDdirty&&(this.state.geometry3DIdsInScene.clear(),this.state.geometryGroupIdsToLoad.clear(),Fl(this.state.entityScene,this.state.geometry3DIdsInScene,this.state.geometryGroupIdsToLoad),this.threeDdirty=!1,this.systems.interactionSystem.dirty3D=!0,this.systems.panBoundsSystem.dirty=!0,this.systems.outlineInterpolationSystem.geometries3DDirty=!0,this.systems.geometryInFocusSystem.focusablesDirty=!0);let t=this.systems.meshOptimizationSystem.update();t&&e.push(t),this.systems.borderSystem.update(),this.systems.meshModificationSystem.update(),this.systems.meshDetachmentSystem.update(),this.systems.imageSystem.update(this.systems.cameraSystem.getRotation()),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.getRotation()),this.systems.cameraSystem.postRender(),this.systems.domVisiblitySystem.update(),this.systems.domMutationSystem.update(),this.systems.twoDProjectionSystem.update(),this.systems.occlusion2DSystem.update(),this.systems.twoDDrawSystem.update(this.systems.cameraSystem.getZoomLevel()),this.systems.domDrawSystem.update(this.systems.cameraSystem.isUserInteracting()),this.systems.watermarkSystem.update();let i=this.needs2DRecompute;return this.nextFrame=requestAnimationFrame(()=>{this.systems.collisionSystem.update(this.systems.watermarkSystem.width,this.systems.watermarkSystem.height,this.systems.watermarkSystem.options.position,!i,this.systems.imageSystem.currentImageScreenBBoxes)}),this.systems.drawSystem.update(),this.systems.geometryDisposalSystem.update(),this.systems.cameraSystem.dirty=!1,this.systems.cameraSystem.zoomDirty=!1,this.systems.cameraSystem.rotationDirty=!1,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)}},"commitRenderState"));this.renderer=e,this.state=t,this.mode=i,this.scene=a,this.cameraObject=s,this.viewCamera=c,this.systems=u,this.systems.collisionSystem.on("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.on("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.on("animate:2d",this.animate2D),this.systems.cameraSystem.on("pan-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("zoom-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("zoom-end",()=>this.needs2DRecompute=!0),this.systems.cameraSystem.on("rotate-start",()=>this.needs2DRecompute=!1),this.systems.cameraSystem.on("rotate-end",()=>this.needs2DRecompute=!0)}paint(){var e;(e=this.renderer)!=null&&e.renderer&&(this.mode==="standalone"&&this.renderer.clear(),this.renderer.render(this.scene,this.state.useStandaloneCamera||this.mode==="standalone"?this.cameraObject:this.viewCamera))}destroy(){this.frameId&&cancelAnimationFrame(this.frameId),this.twoDFrameId&&cancelAnimationFrame(this.twoDFrameId),this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.nextFrame&&cancelAnimationFrame(this.nextFrame),this.state.geometry2DIdsInScene.clear(),this.state.geometry3DIdsInScene.clear(),this.systems.domVisiblitySystem.dirty=!0,this.systems.collisionSystem.collidersDirty=!0,this.update(),this.systems.collisionSystem.off("visibility-changed",this.updateEntities2D),this.systems.twoDVisiblitySystem.off("draw:2d",this.drawEntities2D),this.systems.twoDVisiblitySystem.off("animate:2d",this.animate2D)}};l(es,"RenderSystem");var oo=es;b();var pu=N.object({interactive:N.boolean().optional(),id:N.string().optional(),width:N.union([N.number(),N.object({on:N.literal("zoom-level").optional(),input:N.array(N.number()).nonempty(),output:N.array(N.number()).nonempty(),easing:N.string().optional()})]).optional(),accentColor:N.string().optional(),displayArrowsOnPath:N.boolean().optional(),animateArrowsOnPath:N.boolean().optional(),visibleThroughGeometry:N.boolean().optional(),dashed:N.boolean().optional()}),fu=N.object({type:N.enum(["Feature"]),geometry:zr,properties:N.object({parentId:N.any().optional()})});function rd(o,r){N.object({features:N.array(fu)}).parse(o),pu.parse(r)}l(rd,"validatePath");var Di,ts=class ts{constructor(r,e){h(this,"type","path");h(this,"mesh",new At);h(this,"material");h(this,"geometry");h(this,"outline");h(this,"feature");h(this,"options");h(this,"width",{on:"zoom-level",input:[17,22],output:[.8,.4]});h(this,"breakpoint",0);h(this,"altitudeBreakpoints");h(this,"accentColor","blue");h(this,"completeFraction",1);h(this,"altitudeAdjustment",1);h(this,"displayArrowsOnPath",!1);h(this,"animateArrowsOnPath",!1);h(this,"visibleThroughGeometry",!1);h(this,"dashed",!1);h(this,"isVertical",!1);h(this,"dirty",!0);h(this,"materialDirty",!0);h(this,"position",new B);D(this,Di,0);var t,i,a,s,c,u;this.feature=r,this.options=e||{},this.width=(t=e==null?void 0:e.width)!=null?t:this.width,this.accentColor=(i=e==null?void 0:e.accentColor)!=null?i:this.accentColor,this.displayArrowsOnPath=(a=e==null?void 0:e.displayArrowsOnPath)!=null?a:this.displayArrowsOnPath,this.animateArrowsOnPath=(s=e==null?void 0:e.animateArrowsOnPath)!=null?s:this.animateArrowsOnPath,this.visibleThroughGeometry=(c=e==null?void 0:e.visibleThroughGeometry)!=null?c:this.visibleThroughGeometry,this.dashed=(u=e==null?void 0:e.dashed)!=null?u:this.dashed}setColor(){}setOpacity(){}set visible(r){this.mesh&&(this.mesh.visible=r)}get visible(){return this.mesh?this.mesh.visible:!1}get altitude(){return n(this,Di)}set altitude(r){this.mesh&&(this.mesh.position.z=r,L(this,Di,r))}set complete(r){this.material&&(this.material.uniforms.complete.value=r,this.material.needsUpdate=!0)}};Di=new WeakMap,l(ts,"PathComponent");var Ut=ts;b();var gu=300,_i,Ii,rs=class rs{constructor(r){h(this,"state");D(this,_i,new B);D(this,Ii,new B);this.state=r}update(r){var i;let e,t;this.state.cameraObject.getWorldPosition(n(this,Ii));for(let a of this.state.geometry2DIdsInScene)if(e=this.state.geometry2DMap.get(a),e&&(t=e.components[0],t&&"containerEl"in t&&t.markerContainer!=null)){if(t.visibilityNeedsUpdate!==!1&&(t.visibilityNeedsUpdate==="show"?t.canShow=!0:t.canShow=!1),(t.canShow&&t.visible===!0||((i=t.animation)==null?void 0:i.pending)===!0)&&!t.offscreen)if(t.options.zIndex!=null)t.markerContainer.style.transform="translate3D(".concat(t.projection.x,"px, ").concat(t.projection.y,"px, ").concat(t.options.zIndex,"px)");else{e.object3d.getWorldPosition(n(this,_i));let s=n(this,Ii).distanceTo(n(this,_i));t.markerContainer.style.transform="translate3D(".concat(t.projection.x,"px, ").concat(t.projection.y,"px, ").concat(-s,"px)")}if(t.canShow===!0&&t.visible===!0?t.markerContainer.style.pointerEvents=r?"none":t.pointerEvents:t.markerContainer.style.pointerEvents="none",t.currentStrategyIndex===-1&&t.visible&&t.visibilityNeedsUpdate==="show")continue;t.visibilityNeedsUpdate!==!1&&!t.offscreen&&(t.visibilityNeedsUpdate==="show"&&(t.markerContainer.style.opacity="0"),t.animation&&t.animation.cancel(),t.animation=t.markerContainer.animate([{opacity:t.canShow&&t.visible?"1":"0"}],{duration:gu,easing:"ease-in-out",fill:"forwards"}),t.visibilityNeedsUpdate=!1)}}};_i=new WeakMap,Ii=new WeakMap,l(rs,"DOMDrawSystem");var ao=rs;b();var is=class is extends J{constructor(e,t){super();h(this,"state");h(this,"dirty",!0);h(this,"domTree");h(this,"observers",new Map);h(this,"updateDimensions",l(e=>{e.forEach(t=>{var s;let a=(s=t.target.parentElement)==null?void 0:s.getAttribute("data-marker-id");if(a){let c=this.state.geometry2DMap.get(a),u=c==null?void 0:c.components[0];c&&u instanceof Mt&&(u.updateDimensions(t.contentRect.width,t.contentRect.height),u.collisionDirty=!0)}}),this.publish("dimensions-update")},"updateDimensions"));this.state=e,this.domTree=t}setupObserver(){var i;if(this.observers){for(let a of this.observers.values())a.disconnect();this.observers.clear()}let e,t;for(let a of this.domTree.children){let s=a.getAttribute("data-marker-id");if(s!=null&&(e=this.state.geometry2DMap.get(s),t=e.components[0],(i=t.options)!=null&&i.dynamicResize)){let c=new ResizeObserver(this.updateDimensions);c.observe(t.containerEl),this.observers.set(a.userData.entityId,c)}}}update(){this.dirty&&(this.setupObserver(),this.dirty=!1)}destroy(){for(let e of this.observers.values())e.disconnect();this.observers.clear()}};l(is,"DOMResizeSystem");var so=is;b();b();var id="uniform vec4 uSize;\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n // Scale the position by the size of the quad\n // and shift to top left corner for 0,0\n vec2 transformed = position.xy * uSize.xy - vec2(1.0, -1.0);\n // Apply width .x and height .y of image\n transformed += vec2(uSize.x, -uSize.y);\n // Apply left .w and top .z offset\n transformed += vec2(uSize.w, -uSize.z) * 2.0;\n gl_Position = vec4(transformed, 1.0, 1.0);\n}";b();var nd="varying vec2 vUv;\nuniform sampler2D uTexture;\nuniform float uOpacity;\nvoid main() {\n #ifndef debug\n vec4 texture = texture2D(uTexture, vUv);\n gl_FragColor = vec4(texture.rgb, texture.a * uOpacity);\n #else\n gl_FragColor = vec4(1.0, 0.0, 0.0, 1.0);\n #endif\n}";b();var od=4.291666666666667,ad=15,sd=25,ld=43/60;b();var cd=["horizontal","icon"],yu=new Map([[cd[0],'<svg viewBox="0 0 206 48">\n <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"/>\n <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"/>\n <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"/>\n <path d="M204 40C205.115 40 206 39.0857 206 38V37.9886C206 36.9029 205.126 36 204 36C202.885 36 202 36.9143 202 38V38.0114C202 39.0971 202.874 40 204 40ZM204 39.7829C202.989 39.7829 202.23 38.9829 202.23 38.0114V38C202.23 37.0286 203 36.2171 204 36.2171C205.011 36.2171 205.77 37.0171 205.77 37.9886V38C205.77 38.9714 205 39.7829 204 39.7829ZM203.218 38.9714H203.609V38.2743H204.034L204.517 38.9714H204.989L204.448 38.2057C204.724 38.1257 204.92 37.92 204.92 37.5886C204.92 37.1657 204.586 36.9486 204.138 36.9486H203.218V38.9714ZM203.609 37.9543V37.2914H204.103C204.368 37.2914 204.517 37.4057 204.517 37.6229C204.517 37.8171 204.368 37.9543 204.103 37.9543H203.609Z"/>\n </svg>'],[cd[1],'<svg viewBox="0 0 43 60">\n <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"/>\n <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"/>\n <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"/>\n </svg>']]),bu=/<svg([^>]*)>/g;function dd(o,r,e,t){let i=yu.get(o);return i?i.replace(bu,'<svg$1 width="'.concat(e,'" height="').concat(t,'" xmlns="http://www.w3.org/2000/svg" style="fill: ').concat(r,';">')):""}l(dd,"getLogoIcon");var hd=!1,ae,Tt,Zr,Te,ze,or,et,pt,ns=class ns extends J{constructor(e,t,i){super();D(this,ae,{padding:16,scale:1,iconOnly:!1,position:"bottom-left",color:"dark",onClick:l(()=>{window!=null&&window.open("https://www.mappedin.com")},"onClick"),interactive:!0,visible:!0});D(this,Tt);D(this,Zr);D(this,Te);D(this,ze);D(this,or);D(this,et,0);D(this,pt,0);h(this,"dirty",!0);h(this,"getPositionAlignedCanvasCoordinates",l((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}})[n(this,ae).position],"getPositionAlignedCanvasCoordinates"));h(this,"getPositionAlignedPadding",l(()=>{var i,a,s,c;let e=n(this,ae).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}}[n(this,ae).position];let t={top:(i=e.top)!=null?i:0,right:(a=e.right)!=null?a:0,bottom:(s=e.bottom)!=null?s:0,left:(c=e.left)!=null?c:0};return{x:t.left-t.right,y:t.top-t.bottom}},"getPositionAlignedPadding"));i&&Object.entries(i).forEach(([a,s])=>{s!==void 0&&(n(this,ae)[a]=s)}),L(this,Zr,e),L(this,Tt,t)}get color(){return n(this,ae).color==="light"?"white":"#293136"}get iconName(){return n(this,ae).iconOnly?"icon":"horizontal"}get minWidth(){return n(this,ae).iconOnly?ad:75}get defaultWidth(){return n(this,ae).iconOnly?sd:150}get aspectRatio(){return n(this,ae).iconOnly?ld:od}get options(){return ee({},n(this,ae))}set options(e){var t,i;L(this,ae,{padding:e.padding||n(this,ae).padding,position:e.position||n(this,ae).position,iconOnly:e.iconOnly||n(this,ae).iconOnly,color:e.color||n(this,ae).color,scale:e.scale||n(this,ae).scale,onClick:n(this,ae).onClick,interactive:(t=e.interactive)!=null?t:n(this,ae).interactive,visible:(i=e.visible)!=null?i:n(this,ae).visible})}get icon(){return dd(this.iconName,this.color,n(this,et)*n(this,Tt).pixelRatio,n(this,pt)*n(this,Tt).pixelRatio)}setSize(e,t){n(this,ze)&&(n(this,ze).uniforms.uSize.value.x=e,n(this,ze).uniforms.uSize.value.y=t)}setXY(e,t){n(this,ze)&&(n(this,ze).uniforms.uSize.value.w=e,n(this,ze).uniforms.uSize.value.z=t)}get width(){return n(this,et)}get height(){return n(this,pt)}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)}}[n(this,ae).position]}insertIntoQuadTree(e){n(this,or)!=null&&typeof n(this,ae).onClick=="function"&&n(this,ae).interactive&&e.insert(n(this,or))}resize(e,t){if(n(this,ae).visible!==!0)return;let i=this.getPositionAlignedCanvasCoordinates(e,t),a=this.getPositionAlignedPadding(),s=this.getPositionAlignedOffset(n(this,et),n(this,pt)),c=Math.min(e-n(this,et),Math.max(0,i.x+a.x+s.x)),u=Math.min(t-n(this,pt),Math.max(0,i.y+a.y+s.y));this.setSize(n(this,et)/e,n(this,pt)/t),this.setXY(c/e,u/t),L(this,or,new K(c,u,n(this,et),n(this,pt),{entityId:"watermark"}))}update(){this.dirty&&(n(this,ae).visible===!0?(L(this,et,Math.min(n(this,Tt).canvasWidth,Math.max(this.minWidth,this.defaultWidth*n(this,ae).scale))),L(this,pt,n(this,et)/this.aspectRatio),Zt.getLoader().load("data:image/svg+xml;base64,".concat(btoa(this.icon)),e=>{if(L(this,ze,new _t({uniforms:{uTexture:{value:e},uSize:{value:new al(0,0,0,0)},uOpacity:{value:.7}},vertexShader:id,fragmentShader:nd,depthWrite:!1,depthTest:!1,defines:{debug:hd},wireframe:hd,transparent:!0,visible:!0})),n(this,Te))n(this,Te).visible=!0,n(this,Te).material=n(this,ze),n(this,Te).material.needsUpdate=!0;else{let t=new xt(2,2,1,1);L(this,Te,new te(t,n(this,ze))),n(this,Te).position.set(0,0,-1),n(this,Te).frustumCulled=!1,n(this,Te).renderOrder=999;let i=new Dt(1,1,1),a=new te(i,new je({transparent:!0,opacity:0,depthTest:!1,depthWrite:!1}));a.frustumCulled=!1,a.layers.set(1),n(this,Te).add(a),n(this,Zr).add(n(this,Te))}this.resize(n(this,Tt).canvasWidth,n(this,Tt).canvasHeight),this.publish("texture-loaded")})):n(this,Te)&&(n(this,Te).visible=!1),this.dirty=!1)}destroy(){n(this,Te)&&(n(this,Zr).remove(n(this,Te)),ve(n(this,Te))),L(this,Te,void 0),n(this,ze)&&n(this,ze).dispose(),L(this,ze,void 0),L(this,or,void 0)}};ae=new WeakMap,Tt=new WeakMap,Zr=new WeakMap,Te=new WeakMap,ze=new WeakMap,or=new WeakMap,et=new WeakMap,pt=new WeakMap,l(ns,"WatermarkSystem");var lo=ns;b();var co=100,Su=!1,os=class os extends J{constructor(e,t){super();h(this,"currentTotalBoundingBox");h(this,"state");h(this,"cameraSystem");h(this,"debugMesh",null);h(this,"dirty",!0);h(this,"autoMinZoomLevel",!0);this.state=e,this.cameraSystem=t}update(){if(this.dirty){this.currentTotalBoundingBox==null&&(this.currentTotalBoundingBox=new Le,this.state.entityScene.children.length===0?this.currentTotalBoundingBox.setFromCenterAndSize(new B(0,0,0),new B(co*2,co*2,0)):(this.currentTotalBoundingBox.setFromObject(this.state.entityScene),this.currentTotalBoundingBox.expandByScalar(co)));let e=new Le().setFromObject(this.state.entityScene);this.currentTotalBoundingBox.union(e);let t=e.getSize(new B),i=Math.max(t.x,t.y,t.z);for(let s of this.state.geometry2DMap.values())s.positionDirty===!0&&(this.currentTotalBoundingBox.expandByPoint(s.position),s.positionDirty=!1);let a=ho.copy(this.currentTotalBoundingBox).expandByScalar(Math.max(i,co)).getBoundingSphere(Mu).radius;if(this.cameraSystem.panBounds={center:this.currentTotalBoundingBox.getCenter(new B),min:ho.min,max:ho.max,radius:a},this.publish("update"),this.cameraSystem.dirty=!0,this.dirty=!1,Su&&this.state.entityScene.parent instanceof It){this.debugMesh&&(this.state.entityScene.parent.remove(this.debugMesh),this.debugMesh=null),this.debugMesh=new Kt,this.debugMesh.add(new te(new pn(this.cameraSystem.panBounds.radius),new je({color:16711680,transparent:!0,opacity:.2}))),this.debugMesh.position.copy(this.cameraSystem.panBounds.center),this.state.entityScene.parent.add(this.debugMesh);let s=new B;ho.getSize(s);let c=new Dt(s.x,s.y,s.z),u=new je({color:65280,wireframe:!0,transparent:!0,opacity:.5}),d=new te(c,u);d.position.copy(this.currentTotalBoundingBox.getCenter(new B)),this.debugMesh.add(d)}}}};l(os,"PanBoundsSystem");var uo=os,ho=new Le,Mu=new ll;b();var Li,Oi,as=class as{constructor(r,e){h(this,"mesh");h(this,"type","custom-geometry");h(this,"dirty",!0);h(this,"feature");h(this,"builder");h(this,"outline");D(this,Li,1);h(this,"color",new be);D(this,Oi,0);this.mesh=new At,this.feature=r,this.builder=e}get visible(){return this.mesh.visible}set visible(r){this.mesh.visible=r}set opacity(r){L(this,Li,r)}get opacity(){return n(this,Li)}setColor(r){this.color.set(r)}get position(){var r;return(r=this.mesh)==null?void 0:r.position}get altitude(){return n(this,Oi)}set altitude(r){this.mesh&&(this.mesh.position.z=r,L(this,Oi,r))}get renderOrder(){return this.mesh?this.mesh.renderOrder:0}set renderOrder(r){this.mesh&&(this.mesh.renderOrder=r)}};Li=new WeakMap,Oi=new WeakMap,l(as,"CustomGeometryComponent");var Ur=as;b();var ss=class ss{constructor(r,e){h(this,"state");h(this,"convertTo3DMapPosition");this.state=r,this.convertTo3DMapPosition=e}update(){let r,e;for(let t of this.state.geometry3DIdsInScene){let i=this.state.geometry3DMap.get(t);(i==null?void 0:i.type)==="custom-geometry"&&(r=i.components[0],e=i.components[1],r.dirty&&e.visible!==!1&&(r.position.copy(this.convertTo3DMapPosition(r.feature.geometry.coordinates[1],r.feature.geometry.coordinates[0],e.altitude)),r.builder.setup(r.mesh),r.mesh.traverse(a=>{a.userData=Fe(ee({},a.userData),{entityId:t,type:"custom-geometry"})}),r.dirty=!1),e.visible!==!1&&r.builder.update(r.mesh))}}};l(ss,"CustomGeometrySystem");var mo=ss;b();b();function ud(o){return o.children.some(r=>r.userData.isOutline)}l(ud,"hasOutline");function md(o,r){var t;let e=o.userData.entities3D.values().next().value;return e?((t=r.geometry3DMap.get(e))==null?void 0:t.components[3])!==void 0:!1}l(md,"needsOutline");function po(o,r,e,t){let a=o.getAttribute("position").array,s=-1/0;for(let c=0;c<r.count;c++){let d=(r.start+c)*3,m=a[d+2];s=Math.max(s,m)}for(let c=0;c<r.count;c++){let d=(r.start+c)*3,m=a[d+2];Math.abs(m-s)<1e-4?a[d+2]=Math.max(e+t,2e-4+t):a[d+2]=t}o.attributes.position.needsUpdate=!0}l(po,"updateBufferGeometryHeight");b();function ls(o){var d,m;let r=new hn,e=(d=o.mesh)==null?void 0:d.geometry;if(!e||!((m=o.batchedProps)!=null&&m.range))return;let t=o.batchedProps.range,i=t.start,a=t.count,s=e.getAttribute("position");if(s){let g=new Float32Array(a*3);for(let M=0;M<a;M++){let p=i+M;g[M*3]=s.array[p*3],g[M*3+1]=s.array[p*3+1],g[M*3+2]=s.array[p*3+2]}r.setAttribute("position",new Ne(g,3))}let c=e.getAttribute("normal");if(c){let g=new Float32Array(a*3);for(let M=0;M<a;M++){let p=i+M;g[M*3]=c.array[p*3],g[M*3+1]=c.array[p*3+1],g[M*3+2]=c.array[p*3+2]}r.setAttribute("normal",new Ne(g,3))}let u=e.getAttribute("uv");if(u){let g=new Float32Array(a*2);for(let M=0;M<a;M++){let p=i+M;g[M*2]=u.array[p*2],g[M*2+1]=u.array[p*2+1]}r.setAttribute("uv",new Ne(g,2))}if(e.index){let g=e.index,M=new Uint32Array(a);for(let p=0;p<a;p++)M[p]=g.array[i+p];r.setIndex(new Ne(M,1))}return r}l(ls,"extractBufferGeometryFromBatchedGeometry");function pd(o,r){let e=ls(o);if(!e||!o.mesh)return;o.mesh.deleteInstance(o.instanceIndex),o.mesh.optimize();let t=r.addGeometry(e);r.addInstance(t);let i=r.getGeometryIdAt(t),a=r.getGeometryRangeAt(i);return a&&o.batchedProps&&(o.batchedProps.range=a),e.dispose(),t}l(pd,"transferGeometryToNewBatchedMesh");b();b();var fd="// Modified from https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderLib/linedashed.glsl.js\nuniform float scale;\nattribute float lineDistance;\n\nvarying float vLineDistance;\nattribute float visibility;\nvarying vec4 v_color;\n\n#include <common>\n#include <uv_pars_vertex>\n#include <color_pars_vertex>\n#include <fog_pars_vertex>\n#include <morphtarget_pars_vertex>\n#include <logdepthbuf_pars_vertex>\n#include <clipping_planes_pars_vertex>\n\nvoid main() {\n\n vLineDistance = scale * lineDistance;\n v_color = color;\n\n #include <uv_vertex>\n #include <color_vertex>\n #include <morphinstance_vertex>\n #include <morphcolor_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <project_vertex>\n if (visibility < 0.5) {\n gl_Position = vec4(-2.0, -2.0, -2.0, 1.0);\n }\n #include <logdepthbuf_vertex>\n #include <clipping_planes_vertex>\n #include <fog_vertex>\n\n}";b();var gd="// Modified from https://github.com/mrdoob/three.js/blob/dev/src/renderers/shaders/ShaderLib/linedashed.glsl.js\nuniform vec3 diffuse;\nuniform float opacity;\n\nuniform float dashSize;\nuniform float totalSize;\n\nvarying float vLineDistance;\nvarying vec4 v_color;\n\n#include <common>\n#include <color_pars_fragment>\n#include <uv_pars_fragment>\n#include <map_pars_fragment>\n#include <fog_pars_fragment>\n#include <logdepthbuf_pars_fragment>\n#include <clipping_planes_pars_fragment>\n\nvoid main() {\n\n vec4 diffuseColor = vec4( diffuse, opacity );\n #include <clipping_planes_fragment>\n\n if ( mod( vLineDistance, totalSize ) > dashSize ) {\n\n discard;\n\n }\n\n vec3 outgoingLight = vec3( 0.0 );\n\n #include <logdepthbuf_fragment>\n #include <map_fragment>\n #include <color_fragment>\n\n outgoingLight = diffuseColor.rgb; // simple shader\n\n #include <opaque_fragment>\n #include <tonemapping_fragment>\n #include <colorspace_fragment>\n #include <fog_fragment>\n #include <premultiplied_alpha_fragment>\n\n // Discard alpha lower than 0.01 to avoid opacity fighting\n if (v_color.a <= 0.01) { \n discard;\n }\n}\n";var cs=class cs extends dl{constructor(r){super(r),this.onBeforeCompile=e=>{e.vertexShader=fd,e.fragmentShader=gd}}};l(cs,"OutlineLineMaterial");var fo=cs;var Tu=80,ar,jr,yo,bo,ds=class ds{constructor(r){h(this,"rendererState");h(this,"outlineOpacitiesDirty",!0);D(this,ar,!0);D(this,jr,-1/0);D(this,yo,new Map);D(this,bo,new fo({vertexColors:!0,linewidth:1,transparent:!0,opacity:1,side:ti}));this.rendererState=r}get geometries3DDirty(){return n(this,ar)}set geometries3DDirty(r){L(this,ar,r)}update(r,e=!0){var a,s,c;let t;if(this.geometries3DDirty){for(let u of this.rendererState.geometry3DIdsInScene){let d=this.rendererState.geometry3DMap.get(u);if(d instanceof Qe&&md(d,this.rendererState)&&!ud(d)&&d.userData.entities3D.size>0){let m=[];for(let v of d.userData.entities3D.values()){let x=this.rendererState.geometry3DMap.get(v);if(x instanceof le&&x.type==="geometry"&&x.components[3]&&x.components[3].dirty===!0&&x.components[0].material!=null){let C=x.components[0].geometry,O=!1;C||(C=ls(x.components[0]),O=!0);let A=x.components[1];m.push([x.components[3],new ul(C,(a=A.bevel)!=null&&a.enabled?1:Tu)]),O&&(C==null||C.dispose(),C=void 0)}}if(m.length===0)continue;let g=dt(m.map(v=>v[1]),!1);if(g==null)continue;let M=g.getAttribute("position"),p=new Float32Array(M.count*4),P=new Ne(p,4);g.setAttribute("color",P);let E=new Uint8Array(M.count);E.fill(0);let f=new Ne(E,1,!1);g.setAttribute("visibility",f);let y=0;for(let v=0;v<m.length;v++){let[x,C]=m[v],O=C.getAttribute("position").count;x.edgeColors=P,x.edgeVisibility=f,x.geometry=g,x.ranges={count:O,start:y},y+=O,C.dispose()}let S=new ii(g,n(this,bo));S.userData.isOutline=!0,d.add(S)}}L(this,ar,!1),this.outlineOpacitiesDirty=!0}for(let u of this.rendererState.geometry3DIdsInScene){let d=this.rendererState.geometry3DMap.get(u);if(d instanceof le&&d.type==="geometry"&&d.components[3]&&d.components[3].dirty===!0&&d.components[0].material!=null&&d.parentObject3D instanceof Qe){let m=d.components[3].geometry;if(!m)continue;let g=d.components[3];if(!g)continue;let M=g.enabled&&d.components[1].visible;if(g.visible!==M&&(g.visible=M),!g.visible)continue;let p=g.edgeColors;if(!p||!g.ranges)continue;let P=new be(g.color);for(let S=0;S<g.ranges.count;S++){let v=g.ranges.start+S;p.setXYZ(v,P.r,P.g,P.b)}let E=d.components[1].height,f=d.components[1].altitude;((c=(s=d.components[1])==null?void 0:s.bevel)==null?void 0:c.enabled)||po(m,g.ranges,E,f),m.attributes.color.needsUpdate=!0,m.computeBoundingSphere(),g.dirty=!1}}let i=e?er(r,16,19,0,1):n(this,jr);if((i!==n(this,jr)||this.outlineOpacitiesDirty)&&this.rendererState.geometry3DIdsInScene.size>0){for(let u of this.rendererState.geometry3DIdsInScene)if(t=this.rendererState.geometry3DMap.get(u),(t==null?void 0:t.type)==="geometry"&&t.components[0]instanceof Ce){let d=t.components[3];if(d&&d.edgeColors&&d.geometry&&d.visible){let m=Math.min(i,t.components[1].opacity*Dr(t));if(d.currentOpacity!==m){for(let g=0;g<d.ranges.count;g++){let M=d.ranges.start+g;d.edgeColors.setW(M,m)}d.geometry.attributes.color.needsUpdate=!0}}}}L(this,jr,i),L(this,ar,!1),this.outlineOpacitiesDirty=!1}destroy(){n(this,yo).clear()}};ar=new WeakMap,jr=new WeakMap,yo=new WeakMap,bo=new WeakMap,l(ds,"OutlineInterpolationSystem");var go=ds;b();b();var hs=class hs extends te{constructor(){super(...arguments);h(this,"userData",{entityId:""})}};l(hs,"EntityMesh");var vo=hs,Pu=N.object({flipImageToFaceCamera:N.boolean().optional(),url:N.string()}),Eu=N.object({type:N.enum(["Feature"]),properties:N.object({width:N.number(),height:N.number(),rotation:N.number().min(0).max(360).optional(),verticalOffset:N.number().optional()}),geometry:zr});function yd(o,r,e){N.union([N.number(),N.string()]).parse(o),Eu.parse(r),Pu.parse(e)}l(yd,"validateImage");var us=class us{constructor(r){h(this,"mesh",new At);h(this,"imageMesh");h(this,"outline");h(this,"type","image");h(this,"instanceIndex",-1);h(this,"geometry");h(this,"material");h(this,"feature");h(this,"position",new B);this.feature=r}get visible(){var r,e;return(e=(r=this.mesh)==null?void 0:r.visible)!=null?e:!1}set visible(r){this.mesh&&(this.mesh.visible=r)}};l(us,"ImageComponent");var xo=us;b();function ms(o,r){return{x:o.x*Math.cos(r)-o.y*Math.sin(r),y:o.x*Math.sin(r)+o.y*Math.cos(r)}}l(ms,"rotatePoint");function Du(o,r){return o.map(e=>ms(e,r))}l(Du,"rotatePoints");function _u(o){let r=1/0,e=1/0,t=-1/0,i=-1/0;for(let a of o)r=Math.min(r,a.x),e=Math.min(e,a.y),t=Math.max(t,a.x),i=Math.max(i,a.y);return{minX:r,minY:e,maxX:t,maxY:i}}l(_u,"getBounds");function Iu(o,r){let e=!1;for(let t=0,i=r.length-1;t<r.length;i=t++){let a=r[t].x,s=r[t].y,c=r[i].x,u=r[i].y;s>o.y!=u>o.y&&o.x<(c-a)*(o.y-s)/(u-s)+a&&(e=!e)}return e}l(Iu,"pointInPolygon");function bd(o,r,e,t,i){for(let a=0;a<i;a++)for(let s=0;s<t;s++)if(o[e+a][r+s]!==1)return!1;return!0}l(bd,"isValidRectangle");function Lu(o,r,e){let t=o.maxX-o.minX,i=o.maxY-o.minY,a,s,c=ee({},o);return t/i>r?(s=i/e,a=s*r,c.minX+=(t-a*e)/2):(a=t/e,s=a/r,c.minY+=(i-s*e)/2),{dx:a,dy:s,gridBounds:c}}l(Lu,"calculateGridDimensions");function Ou(o,r,e,t,i){let a=Array(e).fill(0).map(()=>Array(e).fill(0));for(let s=0;s<e;s++)for(let c=0;c<e;c++){let u={x:r.minX+c*t,y:r.minY+s*i};Iu(u,o)&&(a[s][c]=1)}return a}l(Ou,"createAndFillGrid");function Au(o,r){let e=Array(r).fill(0).map(()=>Array(r).fill(0));for(let t=0;t<r;t++)for(let i=0;i<r;i++)if(o[t][i]===1){let a=0;for(let s=1;s<=Math.min(r-i,r-t)&&bd(o,i,t,s,s);s++)a=s;e[t][i]=a}return e}l(Au,"calculateRectSizes");function ku(o,r,e,t,i,a){let s=0,c=0,u=0;for(let d=0;d<t;d++)for(let m=0;m<t;m++)if(o[d][m]===1){let g=Math.pow(r[d][m],2),M=e.minX+m*i,p=e.minY+d*a;s+=g,c+=M*g,u+=p*g}return{x:c/s,y:u/s}}l(ku,"calculatePolygonCenter");function Ru(o,r,e,t,i,a,s){let c=-1/0,u=null,d=o.length,m=Math.sqrt(Math.pow(r.maxX-r.minX,2)+Math.pow(r.maxY-r.minY,2));for(let g=0;g<d;g++)for(let M=0;M<d;M++)if(o[g][M]===1)for(let p=1;p<=d-M;p++){let P=p;if(!(P>d-g)&&bd(o,M,g,p,P)){let E=p*P,f=r.minX+(M+p/2)*e,y=r.minY+(g+P/2)*t,S={x:f,y},x=Math.sqrt(Math.pow(S.x-i.x,2)+Math.pow(S.y-i.y,2))/m,C=E*(1-a)-x*a*E;C>c&&(c=C,u={center:S,width:p*e*s,height:p*t*s})}}return u}l(Ru,"findBestRectangle");function ps(o,r,e,t={}){let{scaleFactor:i=.9,centerPriority:a=.5,resolution:s=100,minimumSizeRatio:c=.5}=t,u=Cl(e),d=o.width/o.height,m=Du(r,u),g=_u(m),{dx:M,dy:p,gridBounds:P}=Lu(g,d,s),E=Ou(m,P,s,M,p),f=Au(E,s),y=ku(E,f,P,s,M,p),S=Ru(E,P,M,p,y,a,i);return!S||S.width<o.width*c||S.height<o.height*c?o:Fe(ee({},S),{center:ms(S.center,-u),rotation:e,polygonCenter:ms(y,-u)})}l(ps,"findLargestInteriorRectangle");var Ai=Math.PI*2,Fu=Math.PI/2,Nu=Math.PI*1.5,Gu=wr(Fu,2),Bu=wr(Nu,2),zu=.01,vd=!1,fs=class fs extends J{constructor(e,t,i,a=0,s=0,c={}){super();h(this,"rendererState");h(this,"convertTo3DMapPosition");h(this,"projectToScreen");h(this,"initialBearing",0);h(this,"naturalBearing",0);h(this,"imagePlacementOptions");h(this,"cameraFrustum",new un);h(this,"imageLoadingCache",new Map);h(this,"currentImageScreenBBoxes",[]);h(this,"viewProjectionMatrix",new Ke);this.rendererState=e,this.convertTo3DMapPosition=t,this.projectToScreen=i,this.initialBearing=a,this.naturalBearing=s,this.imagePlacementOptions=c}createImageMesh(e,t,i,a=0,s,c){var P,E,f;let u={width:i.width,height:i.height,center:this.convertTo3DMapPosition(s),rotation:(P=i.rotation)!=null?P:0},d=(E=this.imagePlacementOptions.mode)!=null?E:"default",m=(()=>{switch(d){case"fit-nearest-90":let y=(this.initialBearing-this.naturalBearing+360)%180;return y>=45&&y<=135?ps(u,c,u.rotation+90,this.imagePlacementOptions):u;case"fit-initial-bearing":return ps(u,c,this.initialBearing,this.imagePlacementOptions);case"default":case"none":default:return u}})();if(vd&&m.polygonCenter){let y=new te(new pn(1),new ni({color:65280}));y.position.set(m.polygonCenter.x,m.polygonCenter.y,a),this.rendererState.entityScene.add(y)}let g=new ni({transparent:!0,depthWrite:!1,side:vt}),M=new xt(m.width,m.height),p=new vo(M);if(p.visible=!1,p.renderOrder=1,(f=this.getOrDownloadImage(t))==null||f.then(y=>{g.map=y,g.needsUpdate=!0,g.map.colorSpace=sn,p.visible=!0,this.publish("image-loaded")}),p.userData.entityId=e,p.material=g,vd){let y=new te(new xt(i.width,i.height),new ni({color:"gray"}));p.add(y);let S=new yl;p.add(S),S.scale.set(10,10,10)}return p.position.set(m.center.x,m.center.y,a+zu),p.rotation.z=(-q.degToRad(m.rotation)+Ai)%Ai,p}getOrDownloadImage(e){var t;if(this.imageLoadingCache.has(e))return(t=this.imageLoadingCache.get(e))==null?void 0:t.promise;{let i=new Promise(a=>{Zt.getLoader().load(e,s=>{let c=this.imageLoadingCache.get(e);c&&!c.loaded&&(c.loaded=!0),a(s)})});return this.imageLoadingCache.set(e,{loaded:!1,promise:i}),i}}flipIfNeeded(e,t){if(e.imageMesh==null)return;let i=-t,a=e.imageMesh.rotation.z,s=wr((a-i+Ai)%Ai,2);s>Gu&&s<Bu&&(e.imageMesh.rotation.z=(a+Math.PI)%Ai)}update(e){var s,c,u,d,m;this.currentImageScreenBBoxes=[],this.viewProjectionMatrix.identity().multiply(this.rendererState.cameraObject.projectionMatrix).multiply(this.rendererState.cameraObject.matrixWorldInverse),this.cameraFrustum.setFromProjectionMatrix(this.viewProjectionMatrix);let t,i,a;for(let g of this.rendererState.geometry3DIdsInScene)if(t=this.rendererState.geometry3DMap.get(g),(t==null?void 0:t.type)==="image"){if(i=t.components[0],a=t.components[1],a.url&&i.imageMesh==null){let M=this.convertTo3DMapPosition(i.feature.geometry.coordinates),p={x:M.x,y:M.y};i.imageMesh=this.createImageMesh(t.id,a.url,i.feature.properties,i.feature.properties.verticalOffset,i.feature.geometry.coordinates,[p]),i.mesh.add(i.imageMesh),i.position.copy(i.imageMesh.position)}i.imageMesh&&(a.flipImageToFaceCamera&&this.flipIfNeeded(i,e),i.imageMesh.material instanceof ni&&a.dirty&&(i.imageMesh.material.opacity=a.opacity))}else if((t==null?void 0:t.type)==="geometry"){if(i=t.components[0],a=t.components[1],a.showImage&&((s=i.feature.properties)!=null&&s.image)&&i.imageMesh==null&&i.visible&&i.mesh!=null&&i.mesh.parent!=null&&((c=i.feature.properties)==null?void 0:c.image.position)!=null&&i.feature.geometry.coordinates!=null&&i.feature.geometry.coordinates.length>0){let M=i.feature.geometry.coordinates[0].map(P=>{let E=this.convertTo3DMapPosition(P);return{x:E.x,y:E.y}}),p=this.createImageMesh(g,(u=i.feature.properties)==null?void 0:u.image.path,(d=i.feature.properties)==null?void 0:d.image,a.height,(m=i.feature.properties)==null?void 0:m.image.position,M);i.mesh.parent.add(p),i.imageMesh=p}if(i.imageMesh){if(!i.visible)i.imageMesh.visible=!1;else if(a.showImage&&!i.imageMesh.visible)if(a.url){let M=this.imageLoadingCache.get(a.url);M&&M.loaded&&(i.imageMesh.visible=!0)}else i.imageMesh.visible=!0;else!a.showImage&&i.imageMesh.visible&&(i.imageMesh.visible=!1);a.flipImageToFaceCamera&&this.flipIfNeeded(i,e),a.enableImageCollisions===!0&&this.updateImageScreenBBoxes(i)}}}updateImageScreenBBoxes(e){if(e.imageMesh==null)return;let t=e.imageMesh.geometry.boundingBox;if(t!=null){let i=new B;if(e.imageMesh.getWorldPosition(i),!this.cameraFrustum.containsPoint(i))return;let a=new Y;this.projectToScreen(a,i);let s=[new B(t.min.x,t.min.y,t.min.z),new B(t.max.x,t.min.y,t.min.z),new B(t.min.x,t.max.y,t.min.z),new B(t.max.x,t.max.y,t.min.z),new B(t.min.x,t.min.y,t.max.z),new B(t.max.x,t.min.y,t.max.z),new B(t.min.x,t.max.y,t.max.z),new B(t.max.x,t.max.y,t.max.z)],c=[];for(let p of s){let P=p.clone().applyMatrix4(e.imageMesh.matrixWorld),E=new Y;this.projectToScreen(E,P),c.push(E)}let u=1/0,d=1/0,m=-1/0,g=-1/0;for(let p of c)u=Math.min(u,p.x),d=Math.min(d,p.y),m=Math.max(m,p.x),g=Math.max(g,p.y);let M=new K(a.x,a.y,m-u,g-d);this.currentImageScreenBBoxes.push(M)}}};l(fs,"ImageSystem");var So=fs;b();var Zu=250,jt,gs=class gs extends J{constructor(e,t){super();h(this,"cameraDirty",!0);h(this,"focusablesDirty",!0);h(this,"state");h(this,"camera");h(this,"debugEl",null);h(this,"raycasters",[]);h(this,"collisions",new Map);h(this,"focusableEntities",new Set);h(this,"debugRaycasters",!1);D(this,jt);h(this,"update",l((e=!1,t=Date.now())=>{this.focusablesDirty&&this.updateFocusableEntities(),!e&&(Date.now()-t>Zu||(n(this,jt)&&cancelAnimationFrame(n(this,jt)),L(this,jt,requestAnimationFrame(()=>{this.updateRaf()}))))},"update"));this.state=e,this.camera=t,this.buildRaycasters()}resize(){this.buildRaycasters()}buildRaycasters(){this.debugEl&&this.debugEl.remove();let e=new Y(this.state.canvasWidth/2,this.state.canvasHeight/2),t=new Y(e.x/1.2,e.y/1.2),i=new Y(e.x+(e.x-t.x),t.y),a=new Y(t.x,e.y+(e.y-t.y)),s=new Y(i.x,a.y),c=new Y(e.x,e.y/1.5),u=new Y(e.x,e.y+(e.y-c.y));this.debugEl=document.createElement("div"),Object.assign(this.debugEl.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",pointerEvents:"none"}),document.body.append(this.debugEl),this.raycasters=[e,c,u,t,i,a,s].map((d,m)=>{if(this.debugRaycasters){let E=document.createElement("div");E.style.position="absolute",E.style.top=d.y+"px",E.style.left=d.x+"px",E.style.width="10px",E.style.height="10px",E.style.backgroundColor="red",this.debugEl.append(E)}let g=d.x/this.state.canvasWidth*2-1,M=-(d.y/this.state.canvasHeight)*2+1,p=new Y(g,M),P=new st;return P.setFromCamera(p,this.camera),[P,p,m===0?10:m<7?2:1]})}updateFocusableEntities(){this.focusableEntities.clear();let e,t,i;for(let a of this.state.geometry3DIdsInScene)if(i=this.state.geometry3DMap.get(a),i!=null){if(i.type==="group-container"&&i.components[1]!==void 0&&i.components[1]instanceof di){if(t=i.components[1],t.dirty===!0||t.focusMesh==null){t.focusMesh&&ve(t.focusMesh);let s=new Le;s.setFromObject(i);let c=s.max.x-s.min.x,u=s.max.y-s.min.y,d=s.max.z-s.min.z;if(!isFinite(c)||!isFinite(u)||!isFinite(d)||isNaN(c)||isNaN(u)||isNaN(d)||c<=0||u<=0||d<=0)continue;let m=new Dt(c,u,d),g={transparent:!0,opacity:this.debugRaycasters?1:0,visible:this.debugRaycasters};if(this.debugRaycasters){let P=["red","green","blue","yellow","purple","orange","pink","brown","gray","black"];g.color=P[Math.floor(Math.random()*P.length)]}let M=new je(g),p=new te(m,M);p.position.set((s.min.x+s.max.x)/2,(s.min.y+s.max.y)/2,0),p.userData={entityId:i.userData.entityId},t.focusMesh=p,i.add(p),i.components[1].dirty=!1}this.focusableEntities.add(t.focusMesh)}else if(i.type==="geometry"&&i.components[4]&&i.components[4]instanceof di&&(e=i.components[0],t=i.components[4],e instanceof Ce&&e.geometry!=null&&(t.dirty===!0||t.focusMesh==null))){if(t.focusMesh==null){let s=new te(e.geometry);s.userData={entityId:i.id},t.focusMesh=s}this.focusableEntities.add(t.focusMesh)}}this.focusablesDirty=!1}updateRaf(){if(this.focusableEntities.size===0){this.publish("geometry-in-focus",[]);return}this.cameraDirty&&this.raycast()}raycast(){this.collisions.clear();for(let[t,i]of this.raycasters)t.setFromCamera(i,this.camera);for(let[t,i,a]of this.raycasters)t.intersectObjects(Array.from(this.focusableEntities.values())).forEach(c=>{var u;if((c==null?void 0:c.object)!=null&&"isMesh"in c.object&&(c!=null&&c.object.isMesh)){let d=c.object.userData.entityId,m=(u=this.collisions.get(d))!=null?u:0;this.collisions.set(d,m+a)}});let e=Array.from(this.collisions,([t,i])=>({entityId:t,weight:i})).sort((t,i)=>i.weight-t.weight).map(({entityId:t})=>t);this.publish("geometry-in-focus",e),this.cameraDirty=!1}showRaycasters(){this.debugRaycasters=!0,this.buildRaycasters()}hideRaycasters(){this.debugRaycasters=!1,this.buildRaycasters()}destroy(){n(this,jt)&&cancelAnimationFrame(n(this,jt)),this.debugEl&&this.debugEl.remove(),this.collisions.clear(),this.focusableEntities.clear(),this.raycasters=[]}};jt=new WeakMap,l(gs,"GeometryInFocusSystem");var Mo=gs;b();b();b();b();b();function Uu(o){if(!o)throw new Error("geojson is required");var r=[];return Ot(o,function(e){ju(e,r)}),Qt(r)}l(Uu,"lineSegment");function ju(o,r){var e=[],t=o.geometry;if(t!==null){switch(t.type){case"Polygon":e=rr(t);break;case"LineString":e=[rr(t)]}e.forEach(function(i){var a=Vu(i,o.properties);a.forEach(function(s){s.id=r.length,r.push(s)})})}}l(ju,"lineSegmentFeature");function Vu(o,r){var e=[];return o.reduce(function(t,i){var a=bn([t,i],r);return a.bbox=Hu(t,i),e.push(a),i}),e}l(Vu,"createSegments");function Hu(o,r){var e=o[0],t=o[1],i=r[0],a=r[1],s=e<i?e:i,c=t<a?t:a,u=e>i?e:i,d=t>a?t:a;return[s,c,u,d]}l(Hu,"bbox");var ys=Uu;var Nd=yh(Rd(),1);function bm(o,r){var e={},t=[];if(o.type==="LineString"&&(o=Yo(o)),r.type==="LineString"&&(r=Yo(r)),o.type==="Feature"&&r.type==="Feature"&&o.geometry!==null&&r.geometry!==null&&o.geometry.type==="LineString"&&r.geometry.type==="LineString"&&o.geometry.coordinates.length===2&&r.geometry.coordinates.length===2){var i=Fd(o,r);return i&&t.push(i),Qt(t)}var a=(0,Nd.default)();return a.load(ys(r)),$o(ys(o),function(s){$o(a.search(s),function(c){var u=Fd(s,c);if(u){var d=rr(u).join(",");e[d]||(e[d]=!0,t.push(u))}})}),Qt(t)}l(bm,"lineIntersect");function Fd(o,r){var e=rr(o),t=rr(r);if(e.length!==2)throw new Error("<intersects> line1 must only contain 2 coordinates");if(t.length!==2)throw new Error("<intersects> line2 must only contain 2 coordinates");var i=e[0][0],a=e[0][1],s=e[1][0],c=e[1][1],u=t[0][0],d=t[0][1],m=t[1][0],g=t[1][1],M=(g-d)*(s-i)-(m-u)*(c-a),p=(m-u)*(a-d)-(g-d)*(i-u),P=(s-i)*(a-d)-(c-a)*(i-u);if(M===0)return null;var E=p/M,f=P/M;if(E>=0&&E<=1&&f>=0&&f<=1){var y=i+E*(s-i),S=a+E*(c-a);return qo([y,S])}return null}l(Fd,"intersects");var Po=bm;b();function Ri(o,r){r===void 0&&(r={});var e=Ar(o);switch(!r.properties&&o.type==="Feature"&&(r.properties=o.properties),e.type){case"Polygon":return vm(e,r);case"MultiPolygon":return xm(e,r);default:throw new Error("invalid poly")}}l(Ri,"default");function vm(o,r){r===void 0&&(r={});var e=Ar(o),t=e.coordinates,i=r.properties?r.properties:o.type==="Feature"?o.properties:{};return Gd(t,i)}l(vm,"polygonToLine");function xm(o,r){r===void 0&&(r={});var e=Ar(o),t=e.coordinates,i=r.properties?r.properties:o.type==="Feature"?o.properties:{},a=[];return t.forEach(function(s){a.push(Gd(s,i))}),Qt(a)}l(xm,"multiPolygonToLine");function Gd(o,r){return o.length>1?vl(o,r):bn(o[0],r)}l(Gd,"coordsToLine");function Sm(o,r){var e=!0;return Ot(o,function(t){Ot(r,function(i){if(e===!1)return!1;e=Mm(t.geometry,i.geometry)})}),e}l(Sm,"booleanDisjoint");function Mm(o,r){switch(o.type){case"Point":switch(r.type){case"Point":return!Pm(o.coordinates,r.coordinates);case"LineString":return!Bd(r,o);case"Polygon":return!Ft(o,r)}break;case"LineString":switch(r.type){case"Point":return!Bd(o,r);case"LineString":return!Cm(o,r);case"Polygon":return!zd(r,o)}break;case"Polygon":switch(r.type){case"Point":return!Ft(r,o);case"LineString":return!zd(o,r);case"Polygon":return!wm(r,o)}}return!1}l(Mm,"disjoint");function Bd(o,r){for(var e=0;e<o.coordinates.length-1;e++)if(Tm(o.coordinates[e],o.coordinates[e+1],r.coordinates))return!0;return!1}l(Bd,"isPointOnLine");function Cm(o,r){var e=Po(o,r);return e.features.length>0}l(Cm,"isLineOnLine");function zd(o,r){for(var e=0,t=r.coordinates;e<t.length;e++){var i=t[e];if(Ft(i,o))return!0}var a=Po(r,Ri(o));return a.features.length>0}l(zd,"isLineInPoly");function wm(o,r){for(var e=0,t=o.coordinates[0];e<t.length;e++){var i=t[e];if(Ft(i,r))return!0}for(var a=0,s=r.coordinates[0];a<s.length;a++){var c=s[a];if(Ft(c,o))return!0}var u=Po(Ri(o),Ri(r));return u.features.length>0}l(wm,"isPolyInPoly");function Tm(o,r,e){var t=e[0]-o[0],i=e[1]-o[1],a=r[0]-o[0],s=r[1]-o[1],c=t*s-i*a;return c!==0?!1:Math.abs(a)>=Math.abs(s)?a>0?o[0]<=e[0]&&e[0]<=r[0]:r[0]<=e[0]&&e[0]<=o[0]:s>0?o[1]<=e[1]&&e[1]<=r[1]:r[1]<=e[1]&&e[1]<=o[1]}l(Tm,"isPointOnLineSegment");function Pm(o,r){return o[0]===r[0]&&o[1]===r[1]}l(Pm,"compareCoords");var Zd=Sm;function Is(o,r){var e=!1;return Ot(o,function(t){Ot(r,function(i){if(e===!0)return!0;e=!Zd(t.geometry,i.geometry)})}),e}l(Is,"booleanIntersects");var Ud=20,Em=5e3,Ls="outdoor-system-debug-container",jd=!1,tt,he,Fi,sr,rt,Hr,Ht,lr,qe,Wr,Ni,Gi,Bi,gt,Eo,cr,it,Wt,Xt,dr,_o,zi,Zi,Vd,Hd,Os=class Os{constructor(r){D(this,gt);D(this,tt,!0);D(this,he);D(this,Fi,"");D(this,sr,new Set);D(this,rt,new Set);D(this,Hr);D(this,Ht);D(this,lr);D(this,qe,null);D(this,Wr,!1);D(this,Ni,l(r=>{if(!n(this,he))throw new Error("Map not initialized");let t=[[r[0],r[1]],[r[2],r[1]],[r[2],r[3]],[r[0],r[3]]].map(u=>n(this,he).project(u)),i=Math.max(...t.map(u=>u.x)),a=Math.min(...t.map(u=>u.x)),s=Math.max(...t.map(u=>u.y)),c=Math.min(...t.map(u=>u.y));return[new Ho.default(a,c),new Ho.default(i,s)]},"#getScreenPoints"));D(this,Gi,l(()=>{n(this,qe)&&(clearTimeout(n(this,qe)),L(this,qe,null),L(this,tt,!1))},"#stopTrying"));D(this,Bi,l(()=>{n(this,qe)&&(clearTimeout(n(this,qe)),L(this,qe,null)),L(this,qe,setTimeout(()=>{n(this,Gi).call(this)},Em))},"#startTrying"));D(this,cr,l(async()=>{if(jd&&n(this,Ht)){let r=n(this,Ni).call(this,n(this,Ht));oe(this,gt,Hd).call(this,r)}if(!(!n(this,he)||!n(this,Wr))&&n(this,tt)&&!(!n(this,rt)||n(this,rt).size===0)){if(n(this,Wt)&&(n(this,_o).call(this),L(this,Wt,!1)),n(this,Hr)){let r=n(this,he).project(n(this,Hr)),e=n(this,he).queryRenderedFeatures(r,{layers:Array.from(n(this,rt))});if(e.length>0){for(let t of e)n(this,it).push(["!=",["id"],t.id]);n(this,it).length>0&&n(this,rt).forEach(t=>{var i;(i=n(this,he))==null||i.setFilter(t,["all",...n(this,it)])}),L(this,it,[]),L(this,Wt,!1),L(this,tt,!1)}}else if(n(this,Ht)&&n(this,lr)){let r=n(this,Ni).call(this,n(this,Ht)),e=n(this,he).queryRenderedFeatures(r,{layers:Array.from(n(this,rt))});if(e.length>0){L(this,Wt,!0),n(this,Xt).push(()=>{n(this,it).length>0&&(n(this,rt).forEach(t=>{var i;(i=n(this,he))==null||i.setFilter(t,["all",...n(this,it)])}),L(this,tt,!1)),L(this,it,[])});for(let t=0;t<e.length;t+=Ud){let i=e.slice(t,t+Ud);n(this,Xt).push(()=>{for(let a of i)if(a.geometry!=null&&"coordinates"in a.geometry){if(n(this,lr)==null)return;let s;if(a.geometry.type==="Polygon"?s=yn(a.geometry.coordinates):a.geometry.type==="MultiPolygon"&&(s=xl(a.geometry.coordinates)),!s)continue;for(let c of n(this,lr))if(Is(c,s)){n(this,it).push(["!=",["id"],a.id]);continue}}})}n(this,zi).call(this)}}}},"#handleRender"));D(this,it,[]);D(this,Wt,!1);D(this,Xt,[]);D(this,dr,null);D(this,_o,l(()=>{n(this,dr)&&(globalThis.cancelAnimationFrame(n(this,dr)),L(this,dr,null)),L(this,Xt,[])},"#cancelJobs"));D(this,zi,l(()=>{let r=n(this,Xt).pop();typeof r=="function"&&(r(),n(this,Xt).length>0&&L(this,dr,globalThis.requestAnimationFrame(n(this,zi)))),L(this,Wt,!1),n(this,Gi).call(this)},"#runJobs"));D(this,Zi,l(r=>{var e,t;if(n(this,he)&&r&&r.dataType==="style"&&r.type==="styledata"&&n(this,sr).size>0){let i=(t=(e=r==null?void 0:r.style)==null?void 0:e.stylesheet)==null?void 0:t.id;(!i||i!==n(this,Fi))&&(L(this,Fi,i),oe(this,gt,Eo).call(this),L(this,tt,!0))}},"#handleStyleChange"));r&&(L(this,he,r),n(this,he).on("styledata",n(this,Zi)),n(this,he).on("render",n(this,cr)),L(this,Wr,n(this,he).loaded()),n(this,he).on("load",()=>{L(this,Wr,!0)})),jd&&oe(this,gt,Vd).call(this)}hideLayersUnderPoint(r,e){n(this,Bi).call(this),L(this,Hr,r);for(let t of e)n(this,sr).add(t);L(this,tt,!0),oe(this,gt,Eo).call(this),n(this,cr).call(this)}hideLayersIntersectingPolygons(r,e,t){n(this,qe)&&clearTimeout(n(this,qe)),n(this,Bi).call(this),L(this,Ht,r),L(this,lr,e.reduce((i,a)=>{if(a.geometry.type==="Polygon"){let s=yn(a.geometry.coordinates);i.push(s)}else a.geometry.type==="MultiPolygon"&&i.push(...a.geometry.coordinates.map(s=>yn(s)));return i},[]));for(let i of t)n(this,sr).add(i);L(this,tt,!0),oe(this,gt,Eo).call(this),n(this,cr).call(this)}destroy(){n(this,he)&&(n(this,he).off("styledata",n(this,Zi)),n(this,he).off("render",n(this,cr)))}};tt=new WeakMap,he=new WeakMap,Fi=new WeakMap,sr=new WeakMap,rt=new WeakMap,Hr=new WeakMap,Ht=new WeakMap,lr=new WeakMap,qe=new WeakMap,Wr=new WeakMap,Ni=new WeakMap,Gi=new WeakMap,Bi=new WeakMap,gt=new WeakSet,Eo=l(function(){if(L(this,rt,new Set),n(this,he))for(let r of n(this,sr))n(this,he).getLayer(r)&&n(this,rt).add(r)},"#filterStylesInMap"),cr=new WeakMap,it=new WeakMap,Wt=new WeakMap,Xt=new WeakMap,dr=new WeakMap,_o=new WeakMap,zi=new WeakMap,Zi=new WeakMap,Vd=l(function(){if(!document.getElementById(Ls)&&n(this,he)){let r=document.createElement("div");r.id=Ls,r.style.position="absolute",r.style.top="0",r.style.left="0",r.style.bottom="0",r.style.right="0",r.style.pointerEvents="none",r.style.zIndex="1000",n(this,he).getContainer().appendChild(r)}},"#addDebugContainer"),Hd=l(function(r){let e=document.getElementById(Ls);if(!e)return;let t=document.getElementById("bbox");t==null&&(t=document.createElement("div"),t.id="bbox",t.style.position="absolute",e.appendChild(t));let i=[Math.min(r[0].x,r[1].x),Math.min(r[0].y,r[1].y)],a=[Math.max(r[0].x,r[1].x),Math.max(r[0].y,r[1].y)];t.style.top=i[1]+"px",t.style.left=i[0]+"px",t.style.width=a[0]-i[0]+"px",t.style.height=a[1]-i[1]+"px",t.style.border="2px solid ".concat(n(this,tt)?"red":"blue")},"#updateDebugBBox"),l(Os,"OutdoorLayers");var Do=Os;b();b();b();b();var Io="attribute float pathDistance;\nattribute vec3 pathNormal;\nattribute vec3 pathTangent;\n\nuniform vec2 uvScale;\nuniform float vertexes;\nuniform float complete;\nuniform float nearRadius;\nuniform float farRadius;\nuniform float nearZoom;\nuniform float farZoom;\nuniform float pulse;\nuniform float pulseLength;\nuniform bool pathIsVertical;\nuniform bool displayArrowsOnPath;\nuniform vec2 cameraParameters;\nuniform float flattenFactor;\n\nvarying float zoomLevel;\nvarying float radius;\nvarying vec2 fragTexcoord;\nvarying float fragTopTextureU;\nvarying float fragPathDistance;\n\n// Map the x value from the range [xMin, xMax] to the range [yMin, yMax] using\n// linear interpolation/extrapolation.\n//\n// This performs a pure linear mapping y = mx + b where\n// 'm = (yMax - yMin) / (xMax - xMin)',\n// 'b = -xMin * (yMax - yMin) / (xMax - xMin) + yMin'.\nfloat remap(float x, float xMin, float xMax, float yMin, float yMax) {\n return (x - xMin) / (xMax - xMin) * (yMax - yMin) + yMin;\n}\n\n// Map the x value from [xMin, xMax] to the range [yMin, yMax] using linear\n// interpolation, clamping result values outside [yMin, yMax].\nfloat clampRemap(float x, float xMin, float xMax, float yMin, float yMax) {\n return clamp(remap(x, xMin, xMax, yMin, yMax), yMin, yMax);\n}\n\nvoid main() {\n fragPathDistance = pathDistance;\n\n // We can get an origin point for the cross-section of the path by\n // subtracting the surface normal times the radius, since the surface normal\n // points strictly away from the centre.\n vec3 origin = position - nearRadius * normal;\n\n // Inflate the path along its surface normal to increase its radius from\n // 'nearRadius' to 'farRadius' when the camera is at 'farZoom'.\n vec3 adjustedPosition = position;\n zoomLevel = clampRemap(cameraParameters.x, nearZoom, farZoom, 0.0, 1.0);\n adjustedPosition += normal * (farRadius - nearRadius) * zoomLevel;\n\n // Determine how far the path extends \"up\" or \"down\" in the direction of the\n // path normal.\n float height = dot(adjustedPosition - origin, pathNormal);\n\n // Flatten the bottom half of the path entirely so that it's flat\n // against the floor. This makes the path look nicer when it's\n // semitransparent behind opaque geometry, so you don't see it\n // peeking through.\n float desiredHeight = max(height, 0.0);\n\n desiredHeight = desiredHeight * flattenFactor;\n\n float flattenMagnitude = height - desiredHeight;\n adjustedPosition = adjustedPosition - pathNormal * flattenMagnitude;\n\n // Transform the vertices into NDC.\n vec4 mvPosition = modelViewMatrix * vec4(adjustedPosition, 1.0);\n gl_Position = projectionMatrix * mvPosition;\n\n fragTexcoord = uv;\n\n // Compute a texture coordinate for mapping the arrow texture to the path.\n // We don't want to use the u-value that Three.js provides, because the\n // path may end up twisting arbitrarily -- but we want the arrow texture to\n // always be on the top of the path.\n vec3 bitangent = cross(normal, pathTangent);\n fragTopTextureU = -dot(bitangent, pathNormal) * 0.5 + 0.5;\n\n radius = mix(nearRadius, farRadius, zoomLevel);\n}\n";b();var As="#define ARROW_FADING_POINT 0.15\n\nuniform float complete;\nuniform float nearRadius;\nuniform float farRadius;\nuniform vec2 resolution;\nuniform vec2 cameraParameters;\nuniform vec3 color;\nuniform float pathLength;\nuniform bool showPulse;\nuniform vec3 pulseColor;\nuniform float pulse;\nuniform float pulseLength;\nuniform bool pathIsVertical;\nuniform bool displayArrowsOnPath;\nuniform float arrowAnimationTimer;\nuniform float opacityMultiplier;\nuniform bool dashed;\nuniform sampler2D arrowTexture;\n\nvarying float zoomLevel;\nvarying float radius;\nvarying vec2 fragTexcoord;\nvarying float fragTopTextureU;\nvarying float fragPathDistance;\n\n// How long the arrow should be, as a factor of pathRadius. Since we've\n// mostly flattened the top of the path, values near 2.0 (the diameter)\n// will probably look best.\nconst float arrowLength = 2.0;\n\n// How much of a relative margin the arrow texture should have inside the\n// area laid out for it. Useful to pull the arrow away from the edges of the\n// path, which slope down.\nconst float arrowMargin = 0.1;\n\n// How many arrow-lengths of space should be between arrows on a short path.\nconst float arrowSpacingOnShortPath = 6.0;\n\n// How many arrow-lengths of space should be between arrows on a long path.\nconst float arrowSpacingOnLongPath = 7.5;\n\n// How long a path must be to be considered \"long\", as a factor of\n// the path radius.\nconst float longPathLength = 200.;\n\n// How long a path must be to be considered \"short\", as a factor of the\n// path radius.\nconst float shortPathLength = 75.;\n\n// How much of the path's length the fade-in should comprise when going from\n// zero opacity to full opacity.\nconst float completeLength = 0.1;\n\n// Map the x value from the range [xMin, xMax] to the range [yMin, yMax] using\n// linear interpolation/extrapolation.\n//\n// This performs a pure linear mapping 'y = mx + b' where\n// 'm = (yMax - yMin) / (xMax - xMin)',\n// 'b = -xMin * (yMax - yMin) / (xMax - xMin) + yMin'.\nfloat remap(float x, float xMin, float xMax, float yMin, float yMax) {\n return (x - xMin) / (xMax - xMin) * (yMax - yMin) + yMin;\n}\n\n// Map the x value from [xMin, xMax] to the range [yMin, yMax] using linear\n// interpolation, clamping result values outside [yMin, yMax].\nfloat clampRemap(float x, float xMin, float xMax, float yMin, float yMax) {\n return clamp(remap(x, xMin, xMax, yMin, yMax), yMin, yMax);\n}\n\nvoid main(void) {\n // Compute the opacity of the path based on the distance from the current\n // fragment to the 'complete' value as it varies from 0.0 to 1.0.\n // Fragments that are at the 'complete' value or past it will be fully\n // transparent, while fragments that are at 'complete - completeLength'\n // or before it will be fully opaque. However, we adjust the 'complete'\n // value here so that it overshoots by one full 'completeLength', so that\n // the entire path will be opaque when the 'complete' value is at 1.0.\n float completeLocation = complete * (1.0 + completeLength);\n float completeAmount = clampRemap(\n fragPathDistance,\n completeLocation - completeLength,\n completeLocation,\n 0.0,\n 1.0\n );\n float opacity = 1.0 - smoothstep(0.0, 1.0, completeAmount);\n\n // 2020/01/09 Terence Dickson\n // When we render the background and overlay for the mapbox outdoor context\n // behind everything else in single-buffer rendering, the fact that the path\n // writes to the depth buffer means that the background and overlay will not\n // be drawn behind the path even when the path is still fading in. The effect\n // is subtle and is only visible in single-buffer rendering so this quick fix\n // prevents writes to the depth buffer for zero opacity fragments, which gets\n // rid of the most visually-offensive ghosting.\n if (opacity <= 0.0) {\n discard;\n }\n\n // Push in the texture coordinates so that they ramp up\n // at 'arrowMargin' instead of at zero; this remapping looks somewhat\n // like this:\n // 1 ^ ___\n // | /\n // | /\n // | /\n // | /\n // |___/\n // 0 +---------->\n // 0 ^ 1\n // arrowMargin\n // Making the arrows narrower on the path.\n float u = fragTopTextureU;\n u = clamp(\n u * (1. / (1. - arrowMargin * 2.)) - (1. / (1. - arrowMargin * 2.) - 1.) / 2.,\n 0.0,\n 1.0\n );\n\n float arrowSpacing = clampRemap(\n pathLength,\n shortPathLength * radius,\n longPathLength * radius,\n arrowSpacingOnShortPath,\n arrowSpacingOnLongPath\n );\n\n // Reduce the spacing between arrows when the camera zooms out, as increasing\n // the path radius will increase the arrow size and thus be able to fit\n // fewer arrows on in total, and this secondary movement of the arrows\n // \"zooming off\" the end of the path is unpleasant\n float expandAmount = mix(1.0, farRadius / nearRadius, zoomLevel);\n float effectiveArrowSpacing =\n arrowSpacing * 1.0 / expandAmount +\n arrowMargin * 2.0;\n\n float effectiveArrowLength = arrowLength * radius * (1. - arrowMargin * 2.0);\n\n // Adjust the slope of the vertical texture coordinate so that it goes\n // from 0 to 1 along the length of the arrow plus the spacing between\n // arrows, and adjust its x-intercept so that one arrow moves to the\n // exact position of the next arrow as 'arrowAnimationTimer' goes\n // from 0 to 1\n float v = (\n fragTexcoord.x * (pathLength / effectiveArrowLength)\n - arrowAnimationTimer * (1. + effectiveArrowSpacing)\n );\n\n // Compute a \"looping sawtooth\" wave for determining the vertical texture\n // coordinates of the arrow texture, roughly as follows:\n // 3 ^ /\n // | ___/\n // 2 | /\n // | ___/\n // 1 | /\n // |___/\n // 0 +--------------->\n // 0 ^ ^\n // ^ |_|\n // | effectiveArrowLength\n // |___|\n // effectiveArrowSpacing\n //\n // This is effectively equivalent to this sort of sawtooth wave:\n // ^\n // 1 | / / /\n // |___/ ___/ ___/\n // 0 +--------------->\n //\n // Causing the image of the arrow to repeat, with dead space (the bottom\n // edge of the texture stretched out) between the arrows at the provided\n // spacing. The reason why the \"looping\" design is preferred is because\n // it takes advantage of WebGL's 'GL_REPEAT' texture wrapping behaviour\n // to avoid the discontinuity that can end up causing visual artifacts.\n if (mod(v, (1. + effectiveArrowSpacing)) < 1.) {\n v = v - effectiveArrowSpacing * floor(v / (1. + effectiveArrowSpacing));\n } else {\n v = ceil(v / (1. + effectiveArrowSpacing));\n }\n\n // Use the r-component of the texture to determine whether the arrow covers\n // this fragment or not\n vec2 sampleTexcoord = vec2(u, v);\n float arrowAmount = 0.0;\n vec3 secondColor = pulseColor;\n\n if (displayArrowsOnPath) {\n arrowAmount = texture2D(arrowTexture, sampleTexcoord).r;\n float delta = 1.0 - abs(fragPathDistance * 2.0 - 1.0);\n secondColor = mix(color, pulseColor, 1.0 - smoothstep(ARROW_FADING_POINT, 0.0, delta));\n }\n\n if (dashed) {\n float dashLength = 0.1; // Adjust this value to change the dash length\n float gapLength = 0.1; // Adjust this value to change the gap length\n float totalLength = dashLength + gapLength;\n float numSegments = ceil(1.0 / totalLength);\n float adjustedTotalLength = 1.0 / numSegments;\n float adjustedDashLength = adjustedTotalLength * (dashLength / (dashLength + gapLength));\n float pattern = mod(fragPathDistance, adjustedTotalLength);\n opacity = pattern < adjustedDashLength ? 1.0 : 0.0;\n }\n\n\n if (showPulse) {\n // Add the pulse color to the path by determining how far the current fragment\n // is from 'pulse'\n float pulseLocation = remap(\n pulse,\n 0.0,\n 1.0,\n -pulseLength,\n 1.0 + pulseLength\n );\n float pulseDistance = smoothstep(\n 0.0,\n pulseLength,\n abs(fragPathDistance - pulseLocation)\n );\n\n // Blend the pulse color to the path based on how close this fragment is to\n // the 'pulse' value and whether it's covered by an arrow -- but if it's\n // covered by *both*, then we go back to using the regular path color\n // (making arrows look like \"holes\" when they're overlapping the pulse.)\n float pulseLevel = abs(1.0 - pulseDistance - arrowAmount);\n\n gl_FragColor = vec4(mix(color, secondColor, pulseLevel), opacity * opacityMultiplier);\n } else if (displayArrowsOnPath) {\n gl_FragColor = vec4(mix(color, pulseColor, arrowAmount), opacity * opacityMultiplier);\n } else {\n gl_FragColor = vec4(color, opacity * opacityMultiplier);\n }\n #include <colorspace_fragment>\n}\n";b();var Wd="uniform float complete;\nuniform float nearRadius;\nuniform float farRadius;\nvarying float fragPathDistance;\nconst float completeLength = 0.1;\n\n// Map the x value from the range [xMin, xMax] to the range [yMin, yMax] using\n// linear interpolation/extrapolation.\n//\n// This performs a pure linear mapping 'y = mx + b' where\n// 'm = (yMax - yMin) / (xMax - xMin)',\n// 'b = -xMin * (yMax - yMin) / (xMax - xMin) + yMin'.\nfloat remap(float x, float xMin, float xMax, float yMin, float yMax) {\n return (x - xMin) / (xMax - xMin) * (yMax - yMin) + yMin;\n}\n\n// Map the x value from [xMin, xMax] to the range [yMin, yMax] using linear\n// interpolation, clamping result values outside [yMin, yMax].\nfloat clampRemap(float x, float xMin, float xMax, float yMin, float yMax) {\n return clamp(remap(x, xMin, xMax, yMin, yMax), yMin, yMax);\n}\n\nvoid main(void) {\n // this ensures that the stencil mask moves along with the path above it, to avoid the progress bar effect\n float completeLocation = complete * (1.0 + completeLength);\n float completeAmount = clampRemap(\n fragPathDistance,\n completeLocation - completeLength,\n completeLocation,\n 0.0,\n 1.0\n );\n float opacity = 1.0 - smoothstep(0.0, 1.0, completeAmount);\n\n // 2020/01/09 Terence Dickson\n // When we render the background and overlay for the mapbox outdoor context\n // behind everything else in single-buffer rendering, the fact that the path\n // writes to the depth buffer means that the background and overlay will not\n // be drawn behind the path even when the path is still fading in. The effect\n // is subtle and is only visible in single-buffer rendering so this quick fix\n // prevents writes to the depth buffer for zero opacity fragments, which gets\n // rid of the most visually-offensive ghosting.\n if (opacity <= 0.0) {\n discard;\n }\n\n gl_FragColor = vec4(0.0, 1.0, 0.0, opacity);\n}";var Xd="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==";var _m=new fn;function Yd(o,r,e){var He,at;let{breakpoint:t,width:i,accentColor:a,completeFraction:s,isVertical:c,visibleThroughGeometry:u,dashed:d}=r,{color:m}=e,g=!0,M=0,p=1/0,P=r.displayArrowsOnPath,E=!0,f=P,y=typeof i=="object"?Number(i.output[t])/2:i/2,S=typeof i=="object"?Number((He=i.output[t+1])!=null?He:i.output[t])/2:i/2,v=((at=e.altitude)!=null?at:0)+Im,x=0;o[0].z+=v;for(let X=1;X<o.length;++X){o[X].z+=v;let V=o[X].x-o[X-1].x,de=o[X].z-o[X-1].z;if(c)x+=Math.sqrt(V*V+de*de);else{let Ie=o[X].y-o[X-1].y;x+=Math.sqrt(V*V+Ie*Ie+de*de)}}if(!c){let X=o[0],V=o[o.length-1];o.push(V.clone().setZ(V.z-.01)),o.unshift(X.clone().setZ(X.z-.01))}let C=new ol;f&&(C=_m.load(Xd),C.colorSpace=sn);let O=new be(m),A=new be(a),I={vertexes:{type:"f",value:1},resolution:{type:"v2",value:new Y(1,1)},cameraParameters:{type:"v2",value:new Y(M,0)},complete:{type:"f",value:g?0:1},color:{type:"c",value:O},pathLength:{type:"f",value:x},nearRadius:{type:"f",value:y},farRadius:{type:"f",value:S},nearZoom:{type:"f",value:M},farZoom:{type:"f",value:p},pulseColor:{type:"c",value:A},pulse:{type:"f",value:0},pulseLength:{type:"f",value:.075},pathIsVertical:{type:"b",value:c},arrowAnimationTimer:{type:"f",value:0},arrowTexture:{type:"t",value:C},displayArrowsOnPath:{type:"b",value:P},showPulse:{type:"b",value:E},opacityMultiplier:{type:"f",value:1},dashed:{type:"b",value:d}},F=new hl(o);F.curveType="catmullrom",F.tension=0;let G=30,R=8,Z=G*o.length,k=new ml(F,Z,y,R,!1),U=new Float32Array(k.attributes.position.count);for(let X=o.length;X<U.length;X++)U[X]=X;k.setAttribute("vertexIndex",new Ne(U,1));let Q=new Float32Array(k.attributes.position.count),$=new Ne(Q,1);for(let X=0;X<=Z;X++)for(let V=0;V<=R;++V)$.setX(X*(R+1)+V,X/Z);k.setAttribute("pathDistance",$);let ye=new Float32Array(k.attributes.normal.count*3),ce=new Ne(ye,3);for(let X=0;X<Z;X++){let V=k.tangents[X];for(let de=0;de<=R;++de)ce.setXYZ(X*(R+1)+de,V.x,V.y,V.z)}k.setAttribute("pathTangent",ce);let ie=new Float32Array(k.attributes.normal.count*3),ne=new Ne(ie,3);for(let X=0;X<Z;X++){let V=k.tangents[X];var Se,me,Me;c?(Se=V.x*V.y,me=-1+V.y*V.y,Me=V.z*V.y):(Se=-V.x*V.z,me=-V.y*V.z,Me=1-V.z*V.z);let de=Math.sqrt(Se*Se+me*me+Me*Me);de===0&&(de=1);let Ie=Se/de,$t=me/de,nn=Me/de;for(let Jt=0;Jt<=R;++Jt)ne.setXYZ(X*(R+1)+Jt,Ie,$t,nn)}k.setAttribute("pathNormal",ne);let ke=new _t({uniforms:I,vertexShader:Io,fragmentShader:As});ke.transparent=!0,ke.alphaTest=.5,I.resolution.value.x=1,I.resolution.value.y=1,I.vertexes.value=U.length,I.arrowTexture.value.wrapS=ri,I.arrowTexture.value.wrapT=ri,I.arrowTexture.value.anisotropy=16;let pe=new te(k,ke),De=pe.clone(),Re=Fe(ee({},I),{opacityMultiplier:{type:"f",value:.25}});Re.complete.value=1,De.material=new _t({uniforms:Re,vertexShader:Io,fragmentShader:As}),De.material.transparent=!0,De.material.alphaTest=.5,De.material.depthWrite=!1,De.material.depthTest=!1,Re.resolution.value.x=1,Re.resolution.value.y=1,Re.vertexes.value=U.length,Re.arrowTexture.value.wrapS=ri,Re.arrowTexture.value.wrapT=ri,Re.arrowTexture.value.anisotropy=16,Re.complete.value=s,pe.userData=De.userData=r.mesh.userData;let bt=r.mesh;if(!u){let X=new _t({uniforms:I,vertexShader:Io,fragmentShader:Wd}),V=new te(k,X);V.name="stencil",V.material.colorWrite=!1,V.material.stencilWrite=!0,V.material.stencilRef=1,V.material.stencilFunc=il,V.material.stencilZPass=cn,V.material.stencilZFail=cn,V.material.stencilFail=cn,V.material.depthWrite=!1,V.material.depthTest=!1,V.userData=r.mesh.userData,bt.add(V),bt.add(De),De.renderOrder=0,pe.renderOrder=1}if(bt.add(pe),c){let X=new Le().setFromObject(pe),V=new B;X.getCenter(V),bt.children.forEach(de=>{de.geometry.center(),de.position.copy(V)})}u&&(pe.material.stencilWrite=!0,pe.material.stencilRef=1,pe.material.stencilFunc=rl,pe.material.stencilZPass=ln,pe.material.stencilZFail=ln,pe.material.stencilFail=ln,pe.material.needsUpdate=!0,pe.layers.disableAll(),pe.layers.enable(Sn.ALWAYS_ON_TOP)),k.computeBoundingBox();let vr=new B;return k.boundingBox.getCenter(vr),{mesh:bt,material:ke,center:vr}}l(Yd,"buildPath");var Im=.15;var Lm=.5,ks=class ks extends J{constructor(e,t,i,a){super();h(this,"rendererState");h(this,"verticalDistanceDirty",!0);h(this,"convertTo3DMapPosition");h(this,"getParentContainer");h(this,"convertZoomLevelToAltitude");this.rendererState=e,this.convertTo3DMapPosition=t,this.getParentContainer=i,this.convertZoomLevelToAltitude=a}update(e,t,i,a=0){let s,c=!1;for(let u of this.rendererState.geometry3DIdsInScene)if(s=this.rendererState.geometry3DMap.get(u),s&&s.type==="path"&&s.components[0].type==="path"){let d=s.components[0],m=s.components[1],g=d.isVertical&&this.verticalDistanceDirty;if(!(d instanceof Ut))continue;let M=[];if(d.dirty||m.dirty||g){if(d.mesh.parent!=null)for(let p=d.mesh.children.length-1;p>=0;p--)ve(d.mesh.children[0]);if(d.feature.features.length===2&&d.feature.features[0].properties.parentId&&d.feature.features[1].properties.parentId){let p=d.feature.features[0],P=d.feature.features[d.feature.features.length-1],E,f,y=p.geometry.coordinates[2]||0,S=P.geometry.coordinates[2]||0;p.properties.parentId&&(E=this.getParentContainer(p.properties.parentId,!0),E!=null&&E.altitude!=null&&(y+=E.altitude,d.isVertical=!0)),P.properties.parentId&&(f=this.getParentContainer(P.properties.parentId,!0),f!=null&&f.altitude!=null&&(S+=f.altitude,d.isVertical=!0));let v=this.convertTo3DMapPosition(p.geometry.coordinates[1],p.geometry.coordinates[0],y),x=this.convertTo3DMapPosition(P.geometry.coordinates[1],P.geometry.coordinates[0],S);Math.abs(v.z-x.z)>Lm&&E!=null&&E.visible&&f!=null&&f.visible&&(M=[v,x])}else{let p=d.feature.features;for(let P=0;P<p.length;P++)if(P===0||!Zl(p[P].geometry.coordinates,p[P-1].geometry.coordinates)){let E=this.convertTo3DMapPosition(p[P].geometry.coordinates[1],p[P].geometry.coordinates[0],p[P].geometry.coordinates[2]||0);M.push(E)}}if(M.length>1){let{mesh:p,material:P,center:E}=Yd(M,d,{color:m.color,altitude:m.altitude});d.mesh=p,d.material=P,d.position=E}d.dirty&&typeof d.width=="object"&&d.width.on==="zoom-level"&&(d.altitudeBreakpoints=d.width.input.map(p=>this.convertZoomLevelToAltitude(p))),d.dirty=!1}m.dirty&&(d.mesh.children.forEach(p=>{p.name!=="stencil"&&(p.material.uniforms.color.value.set(m.color),p.material.visible=m.visible,p.material.needsUpdate=!0)}),d.mesh.position.z=m.altitude,m.dirty=!1),d.isVertical&&d.mesh.children.forEach(p=>{p.rotation.z=-a}),d.material&&(d.mesh.children.forEach(p=>{var E,f,y,S,v,x,C;let P=p.material.uniforms;if(p.name==="stencil"){d.materialDirty&&(P.complete.value=d.completeFraction);return}if(typeof d.width=="object"&&d.width.on==="zoom-level"){d.altitudeBreakpoints&&d.altitudeBreakpoints.length>2&&W.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 O=_l(i,(f=(E=d.altitudeBreakpoints)==null?void 0:E.slice(0,2))!=null?f:[e,t]);d.breakpoint=O,P.nearZoom.value=(S=(y=d.altitudeBreakpoints)==null?void 0:y[O])!=null?S:e,P.farZoom.value=(x=(v=d.altitudeBreakpoints)==null?void 0:v[O+1])!=null?x:t,P.nearRadius.value=Number(d.width.output[O])/2,P.farRadius.value=Number((C=d.width.output[O+1])!=null?C:d.width.output[O])/2}P.cameraParameters.value.x=i,d.materialDirty&&(P.displayArrowsOnPath.value=d.displayArrowsOnPath,P.pulseColor.value.set(d.accentColor),P.complete.value=d.completeFraction,typeof d.width=="number"&&(P.nearZoom.value=e,P.farZoom.value=t,P.nearRadius.value=Number(d.width)/2,P.farRadius.value=Number(d.width)/2))}),d.displayArrowsOnPath&&d.animateArrowsOnPath&&(d.mesh.children.forEach(p=>{p.name!=="stencil"&&(p.material.uniforms.arrowAnimationTimer.value=performance.now()/3e3,p.material.needsUpdate=!0)}),c=!0),d.materialDirty=!1)}this.verticalDistanceDirty=!1,c&&this.publish("animate:path")}};l(ks,"PathSystem");var Ui=ks;b();var xe,Xr,Pt,Rs=class Rs{constructor(r){h(this,"rendererState");h(this,"dirty",!1);D(this,xe);D(this,Xr);D(this,Pt);this.rendererState=r}updateOne(r){if(r instanceof le&&r.components[0]instanceof Ce&&r.components[1]instanceof ht&&r.parentObject3D instanceof Qe&&(L(this,xe,r.components[0]),L(this,Pt,r.components[1]),n(this,xe).detached&&n(this,xe).dirty&&n(this,xe).mesh!=null&&n(this,xe).material!=null&&n(this,xe).batchedProps!=null)){L(this,Xr,r.parentObject3D),n(this,xe).visible=!1;let e=new be(n(this,Pt).color),t=n(this,Pt).opacity*Dr(r),i=new Xl({color:e,side:vt,opacity:t!=null?t:1,transparent:t!==void 0?t<1:!1},1,n(this,xe).material.repeatYFactor),a=new xc(1,n(this,xe).batchedProps.positionCount,0,i),s=pd(n(this,xe),a);if(s==null)return;a.userData={entities:{0:r.id},detached:!0},n(this,xe).instanceIndex=s,n(this,xe).material.setColor(n(this,xe).instanceIndex,e,n(this,Pt).topColor?new be(n(this,Pt).topColor):e),n(this,xe).mesh=a,n(this,xe).material=i,n(this,Xr).add(a),n(this,xe).dirty=!1}}update(){if(!this.dirty)return;let r;for(let e of this.rendererState.geometry3DIdsInScene)r=this.rendererState.geometry3DMap.get(e),this.updateOne(r);this.dirty=!1,this.cleanup()}cleanup(){L(this,xe,void 0),L(this,Xr,void 0),L(this,Pt,void 0)}};xe=new WeakMap,Xr=new WeakMap,Pt=new WeakMap,l(Rs,"MeshDetachmentSystem");var Lo=Rs;b();b();function qd(o,r,e){var t;if((t=o.batchedProps)!=null&&t.range&&o.mesh){let i=r||1e-4,a=i/Math.max(e,1e-4);return po(o.mesh.geometry,o.batchedProps.range,i,0),o.material&&(o.material.repeatYFactor=a),o.currentHeight=i,!0}return!1}l(qd,"updateHeight");function $d(o,r,e,t,i,a){return o.mesh&&o.instanceIndex!==-1?(o.mesh.getMatrixAt(o.instanceIndex,e),e.decompose(t,i,a),t.z=r,e.compose(t,i,a),o.mesh.setMatrixAt(o.instanceIndex,e),o.altitude=r,!0):!1}l($d,"updateAltitude");var nt,yt,Ao,ko,Ro,Fo,Fs=class Fs{constructor(r){h(this,"rendererState");h(this,"dirty",!1);D(this,nt);D(this,yt);D(this,Ao,new Ke);D(this,ko,new B);D(this,Ro,new dn);D(this,Fo,new B);this.rendererState=r}updateOne(r){var e;if(r instanceof le&&r.type==="geometry"&&((e=r.components[1])!=null&&e.dirty)&&(L(this,nt,r.components[0]),L(this,yt,r.components[1]),r.type==="geometry")){let t=!1;n(this,yt).height!==n(this,nt).currentHeight&&(t=qd(n(this,nt),n(this,yt).height,n(this,yt).initialHeight)),n(this,yt).altitude!==n(this,nt).altitude&&(t=$d(n(this,nt),n(this,yt).altitude,n(this,Ao),n(this,ko),n(this,Ro),n(this,Fo))),t&&n(this,nt).mesh!=null&&n(this,nt).mesh.computeBoundingSphere()}}update(){let r;for(let e of this.rendererState.geometry3DIdsInScene)r=this.rendererState.geometry3DMap.get(e),this.updateOne(r);this.cleanup()}cleanup(){L(this,nt,void 0),L(this,yt,void 0)}};nt=new WeakMap,yt=new WeakMap,Ao=new WeakMap,ko=new WeakMap,Ro=new WeakMap,Fo=new WeakMap,l(Fs,"MeshModificationSystem");var Oo=Fs;b();var Om={showPolygonLabelTextAreaMesh:!1,showEnvMap:!1,showCollisionBoxes:!1},Ns=class Ns{constructor(r){h(this,"state",Om);h(this,"core");this.core=r}update(r){let e={};for(let[t,i]of Object.entries(r))t in this.state&&this.state[t]!==r[t]&&(this.state[t]=i,e[t]=i);this.handleUpdate(e)}handleUpdate(r){r.showPolygonLabelTextAreaMesh!=null&&(r.showPolygonLabelTextAreaMesh?this.core.getSystems().text3DSystem.showTextAreaMesh():this.core.getSystems().text3DSystem.hideTextAreaMesh()),r.showEnvMap!=null&&(r.showEnvMap?this.core.setEnvironment("basic"):this.core.setEnvironment(!1)),r.showCollisionBoxes!=null&&(r.showCollisionBoxes?(this.core.getSystems().collisionSystem.showCollisionBoxes(),this.core.render()):this.core.getSystems().collisionSystem.hideCollisionBoxes())}};l(Ns,"Debug");var No=Ns;b();var ji=9,Am=!1,Jd=.1;function km(o,r,e){for(let t=0;t<r;t++){let i=(e&16711680)>>16,a=(e&65280)>>8,s=e&255;o[t*3]=i/255,o[t*3+1]=a/255,o[t*3+2]=s/255}}l(km,"fillArrayWithColor");var Gs=class Gs{constructor(r,e,t){h(this,"state");h(this,"renderer");h(this,"renderService");h(this,"pickingTexture");h(this,"pickingMaterial");h(this,"pixelBuffer");h(this,"width",0);h(this,"height",0);h(this,"scale",1/2);h(this,"color",1);h(this,"convertTo3DMapPosition");h(this,"destroyed",!1);h(this,"enabled",!1);h(this,"backgroundId",16777215);h(this,"resize",l(()=>{let r=this.state.pixelRatio;this.width=Math.floor(this.renderer.domElement.width/r*this.scale),this.height=Math.floor(this.renderer.domElement.height/r*this.scale),this.pixelBuffer=new Uint8Array(4*this.width*this.height),this.pickingTexture=new sl(this.width,this.height,{format:tl,type:el,internalFormat:"RGBA"})},"resize"));h(this,"shouldShowByXY",l((r,e,t)=>{if(this.pixelBuffer==null)return!1;let i=r+(this.height-e-1)*this.width,a=this.pixelBuffer[i*4],s=this.pixelBuffer[i*4+1],c=this.pixelBuffer[i*4+2],u=a<<16|s<<8|c;return u===t||u===this.backgroundId},"shouldShowByXY"));h(this,"activeOccluders",new Set);h(this,"update",l(()=>{if(!this.enabled||this.destroyed||(this.activeOccluders.clear(),this.activeOccluders.add(this.backgroundId),!this.pickingTexture||!this.pixelBuffer))return;let r,e;for(let i of this.state.geometry3DIdsInScene){let a=this.state.geometry3DMap.get(i);if(a&&a instanceof we&&a.userData.occluderFeature!=null&&a.userData.occluderId!=null&&(this.activeOccluders.add(a.userData.occluderId),a.userData.occluderDirty)){if(r=a.userData.occluderFeature,r.geometry.type==="Polygon"){let s=$n(r,this.convertTo3DMapPosition,{color:"white",height:Jd});e=this.createOccluderMesh(s,a.userData.occluderId),a.add(e)}else if(r.geometry.type==="MultiPolygon"){let s=Jn(r,this.convertTo3DMapPosition,{color:"white",height:Jd});e=this.createOccluderMesh(s,a.userData.occluderId),a==null||a.add(e)}a.userData.occluderDirty=!1}}this.renderer.setRenderTarget(this.pickingTexture);let t=new be(this.backgroundId);this.renderer.setClearColor(t),this.renderer.clear(),this.state.cameraObject.layers.disableAll(),this.state.cameraObject.layers.enable(ji),this.renderer.render(this.state.entityScene.parent,this.state.cameraObject),this.renderer.setRenderTarget(null),this.state.cameraObject.layers.disable(ji),Am?this.renderService.enabledLayers.add(ji):this.renderService.enabledLayers.delete(ji),this.renderer.readRenderTargetPixelsAsync(this.pickingTexture,0,0,this.width,this.height,this.pixelBuffer).then(()=>{if(!this.destroyed)for(let i of this.state.geometry2DIdsInScene){let a=this.state.geometry2DMap.get(i);if(a&&(a==null?void 0:a.occluderId)!=null&&this.activeOccluders.has(a==null?void 0:a.occluderId)){let s=a.components[0].projection,c=Math.floor(s.x*this.scale),u=Math.floor(s.y*this.scale),d=this.shouldShowByXY(c,u,a.occluderId);a.components[0].isOccluded=!d}}}).catch(i=>{this.destroyed||W.error(i)})},"update"));if(this.state=r,this.convertTo3DMapPosition=e,(t==null?void 0:t.renderer)==null)throw new Error("No Renderer");this.renderService=t,this.renderer=t.renderer,this.resize(),this.pickingMaterial=new _t({glslVersion:nl,vertexShader:"\n attribute vec3 color;\n varying vec3 vColor;\n void main() {\n vColor = color;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n varying vec3 vColor;\n out vec4 fragColor;\n\n void main() {\n fragColor = vec4(vColor, 1.0);\n }\n "})}applyId(r,e){let t=r.attributes.position,i=new Float32Array(t.count*3);km(i,t.count,e),r.setAttribute("color",new Ne(i,3))}createOccluderMesh(r,e){let t=new te(r,this.pickingMaterial);return t.layers.set(ji),this.applyId(t.geometry,e),t.userData.occluderId=e,t}reserveOccluderId(){return this.color++,this.color}enable(){this.enabled=!0}disable(){this.enabled=!1}destroy(){var r;this.destroyed=!0,(r=this.pickingTexture)==null||r.dispose(),this.pickingMaterial.dispose(),this.pickingTexture=void 0,this.pixelBuffer=void 0}};l(Gs,"Occlusion2DSystem");var Go=Gs;b();var Bs=class Bs{constructor(r){this.state=r;h(this,"dirty",!0)}update(){var r;if(this.dirty){for(let e of this.state.geometry3DIdsInScene){let t=this.state.geometry3DMap.get(e);if(t instanceof le&&t.type==="geometry"&&((r=t.components[0])==null?void 0:r.geometry)!=null){let i=t.components[0];i.geometry&&(i.geometry.dispose(),i.geometry=void 0)}}this.dirty=!1}}};l(Bs,"GeometryDisposalSystem");var Bo=Bs;var Kd=new st;var{DEFAULT_PITCH:Gc,DEFAULT_BEARING:Bc,DEFAULT_ZOOM_LEVEL:zc,DEFAULT_MIN_ZOOM_LEVEL:Rm,DEFAULT_MAX_ZOOM_LEVEL:Fm}=Ye,Nm=q.radToDeg(.6435011087932844),fe,ue,hr,Vi,Yr,Yt,ur,qr,Oe,Zs,T,$e,mr,re,ot,ge,Je,_e,w,Hi,Ee,se,Qd,eh,th,Et,Wi,Xi,Yi,qi,$r,zo,$i,Jr,Ji,pr,Us,fr,Ki,Qi,Ze,Ue,js,Zo,Uo,Kr,en,Vs=class Vs extends J{constructor(e,t={}){var P,E,f,y,S,v,x,C,O,A,I,F,G,R,Z;super();D(this,Oe);h(this,"options");h(this,"container");h(this,"Debug");D(this,fe);D(this,ue);D(this,hr);D(this,Vi);D(this,Yr);D(this,Yt);D(this,ur);D(this,qr);h(this,"rendererDomElement");D(this,T,{geometry3DMap:new Map,geometry2DMap:new Map,geometry2DIdsInScene:new Set,geometry3DIdsInScene:new Set,geometryGroupIdsToLoad:new Set,entityScene:new we("__scene"),hoverColor:"#f6efff",text3dHoverColor:"white",insetsPadding:xn,shouldMeasureCanvas:!0,pixelRatio:this.resolutionScale,canvasWidth:0,canvasHeight:0,internalTweenGroup:new On,externalTweenGroup:new On,cameraObject:new Xo,naturalBearing:0,containerOffset:[0,0],useStandaloneCamera:!1});D(this,$e,{});D(this,mr,new AbortController);h(this,"camera");D(this,re);D(this,ot);D(this,ge);D(this,Je);D(this,_e);D(this,w,{});D(this,Hi,window.matchMedia("screen and (min-resolution: 2dppx)"));h(this,"map");D(this,Ee,l(()=>{var e;this.aborted||!((e=n(this,w))!=null&&e.renderSystem)||(n(this,w).renderSystem.twoDdirty=!0)},"#invalidate2DEntities"));D(this,se,l(()=>{var e;this.aborted||!((e=n(this,w))!=null&&e.renderSystem)||(n(this,w).renderSystem.threeDdirty=!0)},"#invalidate3DEntities"));D(this,Et,"standalone");D(this,Wi,l(()=>{n(this,w).geometryDisposalSystem.dirty=!0,this.render()},"#setGeometryDisposalDirty"));D(this,Xi,l(e=>Math.trunc(e*10)/10,"#round10"));D(this,Yi,l(()=>{oe(this,Oe,Zs).call(this,si()),n(this,w).twoDDrawSystem.dirty=!0,n(this,$r).call(this,void 0,void 0,!0)},"#handlePixelRatioChange"));D(this,qi,l(()=>{n(this,$r).call(this)},"#handleWindowResizeWithEvent"));D(this,$r,l((e,t,i=!1)=>{let a=e!=null?e:this.rendererDomElement.clientWidth,s=t!=null?t:this.rendererDomElement.clientHeight;if((a===0||s===0)&&!i)return;n(this,T).canvasWidth=a,n(this,T).canvasHeight=s,oe(this,Oe,Zs).call(this,si()),n(this,pr).call(this),oe(this,Oe,th).call(this),n(this,w).cameraSystem.resize(this.canvasWidth,this.canvasHeight),n(this,w).cameraSystem.dirty=!0,n(this,w).watermarkSystem.resize(this.canvasWidth,this.canvasHeight),n(this,w).htmlControlsSystem.resize(this.canvasWidth),n(this,w).geometryInFocusSystem.resize(),n(this,w).occlusion2DSystem.resize();let{top:c,left:u}=this.container.getBoundingClientRect();n(this,T).containerOffset=[c,u],this.publish("resize"),this.render()},"#handleWindowResize"));D(this,zo,l(()=>{this.renderSync()},"#renderFull"));D(this,$i,new B);D(this,Jr,l((e,t)=>{let i=this.mode==="standalone"?n(this,ue):this.viewCamera;if(n(this,ue).position.z+this.camera.elevation>t.z){n(this,$i).copy(t);let a=n(this,$i).project(i),s=(a.x+1)/2*this.canvasWidth-0/2,c=(-a.y+1)/2*this.canvasHeight-0/2,u=n(this,Xi).call(this,s),d=n(this,Xi).call(this,c);e.x=u,e.y=d}else e.x=-1e3,e.y=-1e3},"#project"));D(this,Ji,l((e,t)=>{n(this,_e).setBufferSize(e,t),n(this,ue).aspect=e/t,n(this,ue).updateProjectionMatrix(),n(this,ue).updateMatrixWorld(!0),n(this,Yr).x=e,n(this,Yr).y=t},"#setBufferSize"));D(this,pr,l(()=>{var s;let e=n(this,T).canvasWidth=this.rendererDomElement.clientWidth,t=n(this,T).canvasHeight=this.rendererDomElement.clientHeight,i=Math.floor(e*this.resolutionScale),a=Math.floor(t*this.resolutionScale);n(this,Ji).call(this,i,a),(s=this.map)==null||s.resize(),n(this,T).shouldMeasureCanvas=!1},"#measureCanvas"));h(this,"getParentContainer",l((e,t=!0)=>{if(!e)return t?n(this,T).entityScene:void 0;if(typeof e=="string"||typeof e=="number"){let i=n(this,T).geometry3DMap.get(e);return i instanceof we?i:(W.warn("Parent (".concat(typeof e=="object"?e.id:e,") is not a valid container, adding to scene")),t?n(this,T).entityScene:void 0)}else if(e.type==="group-container"){let i=n(this,T).geometry3DMap.get(e.id);if(i instanceof we)return i}return t?n(this,T).entityScene:void 0},"getParentContainer"));h(this,"showCollisionBoxes",l(()=>{n(this,w).collisionSystem.showCollisionBoxes(),this.render()},"showCollisionBoxes"));h(this,"hideCollisionBoxes",l(()=>{n(this,w).collisionSystem.hideCollisionBoxes(),this.render()},"hideCollisionBoxes"));h(this,"projectScreenXYToCoordinate",l((e,t,i=!1)=>{var g,M;let a=this.container.getBoundingClientRect(),s=(e-a.left)/n(this,T).canvasWidth*2-1,c=-((t-a.top)/n(this,T).canvasHeight)*2+1,u=new Y(s,c),d,m;if(i)Kd.setFromCamera(u,n(this,ue)),d=(g=Kd.intersectObject(n(this,Yt),!1)[0])==null?void 0:g.point;else{let p=n(this,w).interactionSystem.getThreeDIntersectsFromXY(u);d=(M=p==null?void 0:p[0])==null?void 0:M.point,m=n(this,w).interactionSystem.getGroupContainerIntersectsFromXY(u)}if(d)return{coordinate:this.convert3DMapPositionToCoordinate(d),groupContainers:m}},"projectScreenXYToCoordinate"));h(this,"projectCoordinateToScreenXY",l(e=>{let t=this.convertTo3DMapPosition(e[1],e[0],e[2]||0),i=new Y;return n(this,Jr).call(this,i,t),{x:i.x,y:i.y}},"projectCoordinateToScreenXY"));h(this,"convert3DMapPositionToCoordinate",l(e=>{var a,s,c,u;let{lat:t,lon:i}=Mn((s=(a=n(this,T).center)==null?void 0:a[1])!=null?s:0,(u=(c=n(this,T).center)==null?void 0:c[0])!=null?u:0,e.x,e.y);return[i,t,e.z]},"convert3DMapPositionToCoordinate"));h(this,"setBackgroundColor",l((e,t)=>{n(this,_e).setBackgroundColor(e,t)},"setBackgroundColor"));h(this,"getMetresPerPixel",l(()=>{let e=this.container.clientWidth,t=this.container.clientHeight/2,i=this.projectScreenXYToCoordinate(0,t,!0),a=this.projectScreenXYToCoordinate(e,t,!0);return i==null||a==null?void 0:wl(i.coordinate,a.coordinate)/e},"getMetresPerPixel"));h(this,"hideOutdoorLayersUnderPoint",l((e,t)=>{!this.map||(t==null?void 0:t.length)===0||(n(this,w).outdoorLayersSystem.hideLayersUnderPoint(e,t),this.render())},"hideOutdoorLayersUnderPoint"));h(this,"hideOutdoorLayersIntersectingPolygons",l((e,t,i)=>{n(this,w).outdoorLayersSystem.hideLayersIntersectingPolygons(e,t,i),this.render()},"hideOutdoorLayersIntersectingPolygons"));D(this,fr,new un);D(this,Ki,new Ke);D(this,Qi,l(e=>{var t;W.error("Render failed: ",e,(t=e.stack)!=null?t:"No stack trace available"),this.publish("render-error",{error:e})},"#onRenderError"));h(this,"render",l(()=>{var e;if(!(((e=n(this,w))==null?void 0:e.renderSystem)==null||this.aborted))if(this.map&&(this.mode==="outdoors-interleaved"||this.mode==="outdoors-overlay"))this.map.triggerRepaint();else return n(this,w).renderSystem.update().catch(n(this,Qi))},"render"));h(this,"renderSync",l(()=>this.aborted?Promise.resolve():n(this,w).renderSystem.update(!0).catch(n(this,Qi)),"renderSync"));D(this,Ze,li(()=>{this.publish("user-interaction-start",void 0)},0,!0));D(this,Ue,li(()=>{this.publish("user-interaction-end",void 0),this.render()},0,!0));h(this,"on",l((e,t)=>{this.aborted||(super.on(e,t),["outdoor-view-loaded","outdoor-style-loaded"].includes(e)&&this.mode==="standalone"&&_.env.NODE_ENV!=="test"&&(W.warn('"'.concat(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)))},"on"));h(this,"off",l((e,t)=>{super.off(e,t)},"off"));h(this,"getCursor",l(()=>n(this,w).interactionSystem.getCursor(),"getCursor"));D(this,Zo,l(()=>{if(n(this,T).entityScene.removeEventListener("childadded",n(this,se)),n(this,T).entityScene.removeEventListener("childadded",n(this,Ee)),n(this,T).entityScene.removeEventListener("childremoved",n(this,se)),n(this,T).entityScene.removeEventListener("childremoved",n(this,Ee)),window.removeEventListener("resize",n(this,qi),!1),n(this,Hi).removeEventListener("change",n(this,Yi)),this.map){for(let e in n(this,$e))for(let t of n(this,$e)[e])this.map.off(e,t);L(this,$e,{})}this._subscribers={}},"#cleanupEventListeners"));D(this,Uo,l(()=>{try{n(this,Et)!=="outdoors-overlay"&&(this.map&&this.map.remove(),this.container&&this.rendererDomElement&&this.container.contains(this.rendererDomElement)&&this.container.removeChild(this.rendererDomElement)),this.container&&(n(this,Je)&&this.container.contains(n(this,Je))&&this.container.removeChild(n(this,Je)),n(this,re)&&this.container.contains(n(this,re))&&this.container.removeChild(n(this,re)))}catch(e){W.warn("Error during DOM cleanup, some elements may not have been removed:",e)}},"#cleanupDOMElements"));h(this,"destroy",l(()=>{var e;n(this,w)&&(this.aborted||n(this,mr).abort(),n(this,Zo).call(this),this.remove("__scene"),n(this,w).renderSystem.destroy(),n(this,w).cameraSystem.dispose(),n(this,w).exporterSystem.destroy(),n(this,w).outdoorLayersSystem.destroy(),n(this,w).borderSystem.destroy(),n(this,w).drawSystem.destroy(),n(this,ur)&&n(this,ur).disconnect(),n(this,_e).destroy(),(e=n(this,fe))==null||e.traverse(t=>{ve(t),"dispose"in t&&typeof t.dispose=="function"&&t.dispose()}),L(this,fe,void 0),n(this,w).htmlControlsSystem.destroy(),n(this,w).collisionSystem.destroy(),n(this,w).interactionSystem.destroy(),n(this,w).domMutationSystem.destroy(),n(this,w).geometryInFocusSystem.destroy(),n(this,w).occlusion2DSystem.destroy(),L(this,w,void 0),n(this,Uo).call(this),L(this,_e,void 0))},"destroy"));D(this,Kr,new B);D(this,en,new B);if(L(this,mr,new AbortController),n(this,T).useStandaloneCamera=(P=t.useStandaloneCamera)!=null?P:!1,n(this,T).naturalBearing=(E=t.naturalBearing)!=null?E:0,this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),!e.clientWidth||!e.clientHeight)throw new Error("[MappedinJS] Container width and height must be greater than 0");this.convertTo3DMapPosition=this.convertTo3DMapPosition.bind(this),(t.mode==="outdoors-interleaved"||t.mode==="outdoors-overlay")&&t.map&&(L(this,Et,t.mode),this.map=t.map),n(this,T).entityScene.addEventListener("childadded",()=>{n(this,se).call(this),n(this,Ee).call(this)}),n(this,T).entityScene.addEventListener("childremoved",()=>{n(this,se).call(this),n(this,Ee).call(this)}),n(this,T).geometry3DMap.set(n(this,T).entityScene.userData.entityId,n(this,T).entityScene),t.center&&(n(this,T).center=t.center?[...t.center]:[0,0]),this.options=t,this.container=e,oe(this,Oe,Qd).call(this),oe(this,Oe,eh).call(this),n(this,w).htmlControlsSystem=new Ln(this.container,{outdoorEnabled:!!this.map}),n(this,Et)!=="outdoors-overlay"&&n(this,w).htmlControlsSystem.addAttributionControl(this.options.attribution),window.MappedinDebug||(window.MappedinDebug={}),_.env.NODE_ENV==="test"&&(window.MappedinDebug.mapViewCoreInstance=this),L(this,_e,new _n({antialias:typeof t.antialias=="boolean"?t.antialias:!0,alpha:!1,canvas:this.mode!=="standalone"?(f=t.gl)==null?void 0:f.canvas:void 0,onWebGLContextCreationError:t.onWebGLContextCreationError,onWebGLContextLost:t.onWebGLContextLost,onWebGLContextRestored:l(k=>{var U;(U=t.onWebGLContextRestored)==null||U.call(t,k),n(this,Ee).call(this),n(this,se).call(this),this.render()},"onWebGLContextRestored"),onWebGLRendererError:t.onWebGLRendererError,backgroundColor:t.backgroundColor||"#ffffff",backgroundAlpha:(y=t.backgroundAlpha)!=null?y:1})),L(this,fe,new It),n(this,Et)!=="standalone"&&n(this,fe).add(Ul()),n(this,fe).add(n(this,T).entityScene);let i=window.__THREE_DEVTOOLS__;_.env.NODE_ENV==="dev"&&typeof i<"u"&&(i.dispatchEvent(new CustomEvent("observe",{detail:n(this,fe)})),i.dispatchEvent(new CustomEvent("observe",{detail:n(this,_e)}))),L(this,ue,new Xo(Nm,this.aspect,50,1e5)),n(this,T).cameraObject=n(this,ue),L(this,Vi,new cl),n(this,ue).renderOrder=999;let a=new Kt;a.add(n(this,ue)),L(this,qr,new Kt),n(this,qr).add(a),n(this,fe).add(n(this,qr)),n(this,ue).updateProjectionMatrix(),n(this,ue).updateMatrixWorld(!0),this.referenceMap={scale:1,latitude:0,longitude:0,getNorth:l(()=>0,"getNorth"),georeference:[{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}},{target:{x:0,y:0}}]},this.rendererDomElement=n(this,_e).domElement(),L(this,Yr,new Y);let s=new xt(1e6,1e6),c=new je({color:0,visible:!1});L(this,Yt,new te(s,c)),n(this,Yt).name="worldPlane",n(this,fe).add(n(this,Yt)),(S=t.gl)!=null&&S.canvas||e.appendChild(this.rendererDomElement),window.addEventListener("resize",n(this,qi),!1),n(this,Hi).addEventListener("change",n(this,Yi)),typeof ResizeObserver=="function"&&((v=_.env)==null?void 0:v.NODE_ENV)!=="test"&&(L(this,ur,new ResizeObserver(Ks(k=>{n(this,$r).call(this,k[0].contentRect.width,k[0].contentRect.height)},50))),(x=n(this,ur))==null||x.observe(e)),e.classList.add("mappedin-map"),this.rendererDomElement.style.width=(C=globalThis.MappedinDebug)!=null&&C.TEST_IOS?"1080px":"100%",this.rendererDomElement.style.height=(O=globalThis.MappedinDebug)!=null&&O.TEST_IOS?"1920px":"100%",_.env.NODE_ENV==="test"&&this.rendererDomElement.setAttribute("data-testid","mappedin-canvas"),this.mode!=="outdoors-overlay"&&this.rendererDomElement.tabIndex!==void 0&&this.rendererDomElement.removeAttribute("tabindex"),n(this,T).canvasWidth=this.rendererDomElement.clientWidth,n(this,T).canvasHeight=this.rendererDomElement.clientHeight,this.rendererDomElement.style.touchAction="manipulation";let u=this.canvasWidth,d=this.canvasHeight;n(this,w).watermarkSystem=new lo(n(this,ue),n(this,T),t==null?void 0:t.watermark),n(this,w).watermarkSystem.on("texture-loaded",this.render),n(this,T).shouldMeasureCanvas=!0,n(this,T).pixelRatio=this.resolutionScale,n(this,Ji).call(this,Math.floor(u*this.resolutionScale),Math.floor(d*this.resolutionScale));let m=new gn(16777215,.3*Math.PI);m.position.set(-150,-150,350),n(this,fe).add(m);let g=new fl(16777215,.741*Math.PI);n(this,fe).add(g),n(this,w).cameraSystem=new Nr(n(this,ue),n(this,fe),n(this,_e).renderer,n(this,T),{mode:this.mode,canvasHeight:d,canvasWidth:u}),n(this,w).cameraSystem.on("user-dolly-start",n(this,Ze)),n(this,w).cameraSystem.on("user-pan-start",n(this,Ze)),n(this,w).cameraSystem.on("user-rotate-start",n(this,Ze)),n(this,w).cameraSystem.on("user-zoom-start",n(this,Ze)),n(this,w).cameraSystem.on("user-tilt-start",n(this,Ze)),n(this,w).cameraSystem.on("user-pedestal-start",n(this,Ze)),n(this,w).cameraSystem.on("user-dolly-end",n(this,Ue)),n(this,w).cameraSystem.on("user-pan-end",n(this,Ue)),n(this,w).cameraSystem.on("user-rotate-end",n(this,Ue)),n(this,w).cameraSystem.on("user-zoom-end",n(this,Ue)),n(this,w).cameraSystem.on("user-tilt-end",n(this,Ue)),n(this,w).cameraSystem.on("user-pedestal-end",n(this,Ue)),n(this,w).cameraSystem.on("change",()=>{this.publish("camera-change",this.camera),n(this,w).geometryInFocusSystem&&(n(this,w).geometryInFocusSystem.cameraDirty=!0),this.render()}),this.onAbort(()=>{n(this,w).cameraSystem.off("user-dolly-start",n(this,Ze)),n(this,w).cameraSystem.off("user-pan-start",n(this,Ze)),n(this,w).cameraSystem.off("user-rotate-start",n(this,Ze)),n(this,w).cameraSystem.off("user-zoom-start",n(this,Ze)),n(this,w).cameraSystem.off("user-tilt-start",n(this,Ze)),n(this,w).cameraSystem.off("user-pedestal-start",n(this,Ze)),n(this,w).cameraSystem.off("user-dolly-end",n(this,Ue)),n(this,w).cameraSystem.off("user-pan-end",n(this,Ue)),n(this,w).cameraSystem.off("user-rotate-end",n(this,Ue)),n(this,w).cameraSystem.off("user-zoom-end",n(this,Ue)),n(this,w).cameraSystem.off("user-tilt-end",n(this,Ue)),n(this,w).cameraSystem.off("user-pedestal-end",n(this,Ue)),n(this,w).renderSystem.off("measure-canvas",n(this,pr)),n(this,w).cameraSystem.off("change",this.render)}),n(this,w).pathSystem=new Ui(n(this,T),this.convertTo3DMapPosition,this.getParentContainer,n(this,w).cameraSystem.convertZoomLevelToAltitude),n(this,w).pathSystem.on("animate:path",this.render),this.onAbort(()=>{n(this,w).pathSystem.off("animate:path",this.render)}),n(this,w).panBoundsSystem=new uo(n(this,T),n(this,w).cameraSystem);let M=l(()=>{let{panBounds:k,fov:U,convertAltitudeToZoomLevel:Q}=n(this,w).cameraSystem;if(n(this,w).panBoundsSystem.autoMinZoomLevel){if(k.radius<=0)return;let $=Math.min(n(this,T).canvasWidth/n(this,T).canvasHeight,1),ye=U*Math.PI/180*$,ce=Math.tan(ye/2),{radius:ie,center:ne}=n(this,w).cameraSystem.panBounds,Se=ie/ce,me=this.getThreeCamera().getWorldPosition(new B),Me=ne.distanceTo(me),ke=Math.abs(me.z-ne.z),pe=Se*ke/Me,De=Q(pe);zl(De,this.camera.minZoomLevel)&&this.camera.setMinZoomLevel(De)}this.publish("pan-bounds-change",n(this,w).cameraSystem.panBounds)},"handlePanBoundsUpdate");n(this,w).panBoundsSystem.on("update",M),this.onAbort(()=>{n(this,w).panBoundsSystem.off("update",M)}),this.camera=new Un(this,n(this,w),n(this,T)),this.camera.setZoomLevel((A=t.zoomLevel)!=null?A:zc),this.camera.setBearing((I=t.bearing)!=null?I:Bc),this.camera.setPitch((F=t.pitch)!=null?F:Gc),this.camera.setMaxZoomLevel(Fm),this.camera.setMinZoomLevel(Rm),n(this,w).domVisiblitySystem=new eo(n(this,T),n(this,Je)),n(this,w).domMutationSystem=new so(n(this,T),n(this,Je)),n(this,w).domMutationSystem.on("dimensions-update",()=>{n(this,w).collisionSystem.collidersDirty=!0,this.render()}),n(this,w).domDrawSystem=new ao(n(this,T)),n(this,w).collisionSystem=new jn(n(this,ot),n(this,T),((G=t.useCollisionWorker)!=null?G:!0)&&((R=t.useWorkers)!=null?R:!0)),n(this,w).twoDDrawSystem=new ro(n(this,T),n(this,ge),t.transformImageRequest),n(this,w).twoDDrawSystem.on("img:loaded",this.render),n(this,w).interactionSystem=new bi(this.rendererDomElement,n(this,T),n(this,ue),n(this,Yt),n(this,w).cameraSystem.isUserInteracting),n(this,w).interactionSystem.on("doubletap-with-onefinger",k=>{var U;n(this,w).cameraSystem.enableZoom&&this.camera.animateTo({center:(U=this.projectScreenXYToCoordinate(k.clientX,k.clientY))==null?void 0:U.coordinate,zoomLevel:this.camera.zoomLevel+1,duration:ea,easing:"ease-out"})}),n(this,w).interactionSystem.on("singletap-with-twofinger",()=>{n(this,w).cameraSystem.enableZoom&&this.camera.animateTo({zoomLevel:this.camera.zoomLevel-1,duration:ea,easing:"ease-out"})}),n(this,w).interactionSystem.on("hover",this.render),n(this,w).interactionSystem.on("click",k=>{var Q,$,ye,ce,ie,ne,Se,me,Me,ke,pe,De;if(((Q=k.entity2D)==null?void 0:Q.id)==="watermark"&&typeof n(this,w).watermarkSystem.options.onClick=="function"&&n(this,w).watermarkSystem.options.interactive){n(this,w).watermarkSystem.options.onClick();return}let U=k.entity3D?[($=k.entity3D)==null?void 0:$.id]:[];(ie=(ce=(ye=k.entity3D)==null?void 0:ye.parentObject3D)==null?void 0:ce.userData)!=null&&ie.entityId&&U.push((me=(Se=(ne=k.entity3D)==null?void 0:ne.parentObject3D)==null?void 0:Se.userData)==null?void 0:me.entityId),this.publish("click",{coordinate:this.convert3DMapPositionToCoordinate(k.position),geometry:U,paths:((Me=k.entity3D)==null?void 0:Me.components[0])instanceof Ut?[k.entity3D.id]:[],markers:((ke=k.entity2D)==null?void 0:ke.components[0])instanceof Mt?[k.entity2D.id]:[],models:((pe=k.entity3D)==null?void 0:pe.components[0])instanceof Bt?[k.entity3D.id]:[],labels:((De=k.entity2D)==null?void 0:De.components[0])instanceof St?[k.entity2D.id]:[],containers:Array.isArray(k.groupContainers)?k.groupContainers.map(Re=>Re.userData.entityId):[],pointerEvent:k.pointerEvent})}),n(this,w).interactionSystem.on("hover",k=>{var U,Q,$,ye,ce;k.position&&this.publish("hover",{coordinate:this.convert3DMapPositionToCoordinate(k.position),geometry:k.entity3D?[(U=k.entity3D)==null?void 0:U.id]:[],paths:((Q=k.entity3D)==null?void 0:Q.components[0])instanceof Ut?[k.entity3D.id]:[],markers:(($=k.entity2D)==null?void 0:$.components[0])instanceof Mt?[k.entity2D.id]:[],models:((ye=k.entity3D)==null?void 0:ye.components[0])instanceof Bt?[k.entity3D.id]:[],labels:((ce=k.entity2D)==null?void 0:ce.components[0])instanceof St?[k.entity2D.id]:[],containers:Array.isArray(k.groupContainers)?k.groupContainers.map(ie=>ie.userData.entityId):[]})}),n(this,w).geometryInFocusSystem=new Mo(n(this,T),n(this,ue));let p=l(k=>{this.publish("geometry-in-focus",k)},"handleGeometryInFocus");n(this,w).geometryInFocusSystem.on("geometry-in-focus",p),this.onAbort(()=>{n(this,w).geometryInFocusSystem.off("geometry-in-focus",p)}),n(this,w).twoDVisiblitySystem=new no(n(this,T)),n(this,w).drawSystem=new io(n(this,T),this.convertTo3DMapPosition),n(this,w).drawSystem.on("texture-loaded",this.render),n(this,w).twoDProjectionSystem=new to(n(this,T),n(this,Jr)),n(this,w).exporterSystem=new vi(n(this,T)),n(this,w).meshOptimizationSystem=new Qn(n(this,T),this.convertTo3DMapPosition),n(this,w).meshOptimizationSystem.on("model-loaded",this.render),n(this,w).meshOptimizationSystem.on("geometry-2d-added",this.render),n(this,w).meshOptimizationSystem.on("geometry-group-added",n(this,Wi)),this.onAbort(()=>{n(this,w).meshOptimizationSystem.off("model-loaded",this.render),n(this,w).meshOptimizationSystem.off("geometry-2d-added",this.render),n(this,w).meshOptimizationSystem.off("geometry-group-added",n(this,Wi))}),n(this,w).meshDetachmentSystem=new Lo(n(this,T)),n(this,w).meshModificationSystem=new Oo(n(this,T)),n(this,w).geometryDisposalSystem=new Bo(n(this,T)),n(this,w).borderSystem=new bc(n(this,T),this.convertTo3DMapPosition),n(this,w).customGeometrySystem=new mo(n(this,T),this.convertTo3DMapPosition),n(this,w).outlineInterpolationSystem=new go(n(this,T)),n(this,w).renderSystem=new oo(n(this,_e),n(this,T),this.mode,n(this,fe),n(this,ue),this.viewCamera,n(this,w)),n(this,w).imageSystem=new So(n(this,T),this.convertTo3DMapPosition,n(this,Jr),t.bearing,t.naturalBearing,t.imagePlacementOptions),n(this,w).text3DSystem=new Vl(n(this,T),this.convertTo3DMapPosition,(Z=t.useWorkers)!=null?Z:!0),n(this,w).text3DSystem.on("render",this.render),n(this,w).imageSystem.on("image-loaded",this.render),n(this,w).renderSystem.on("pre-render",()=>this.publish("pre-render")),n(this,w).renderSystem.on("post-render",()=>this.publish("post-render")),n(this,w).renderSystem.on("measure-canvas",n(this,pr)),this.onAbort(()=>{n(this,w).renderSystem.off("pre-render",()=>this.publish("pre-render")),n(this,w).renderSystem.off("post-render",()=>this.publish("post-render")),n(this,w).renderSystem.off("measure-canvas",n(this,pr))}),n(this,w).outdoorLayersSystem=new Do(this.map),n(this,w).occlusion2DSystem=new Go(n(this,T),this.convertTo3DMapPosition,n(this,_e)),t.occlusionEnabled&&n(this,w).occlusion2DSystem.enable(),this.Debug=new No(this),t.environment!==!1&&L(this,hr,oe(this,Oe,js).call(this)),n(this,zo).call(this)}get viewCamera(){return n(this,Vi)}get canvasWidth(){return n(this,T).canvasWidth}get canvasHeight(){return n(this,T).canvasHeight}get resolutionScale(){var e,t;return(t=(e=this.map)==null?void 0:e._getClampedPixelRatio(this.canvasWidth,this.canvasHeight))!=null?t:si()}get aspect(){return this.canvasWidth/this.canvasHeight}get mode(){return n(this,Et)}addGroupContainer(e,t,i){if(!n(this,T).geometry3DMap.has(e)&&!n(this,T).geometry2DMap.has(e)){let a=new we(e);a.addEventListener("childadded",()=>{n(this,se).call(this),n(this,Ee).call(this)}),a.addEventListener("childremoved",()=>{n(this,se).call(this),n(this,Ee).call(this)}),(t==null?void 0:t.visible)!==void 0&&(a.visible=t.visible),(t==null?void 0:t.altitude)!==void 0&&a.setAltitude(t.altitude),(t==null?void 0:t.interactive)!==void 0&&Ve(a,t.interactive,n(this,T)),(t==null?void 0:t.focusable)!==void 0&&Dn(a,t.focusable),(t==null?void 0:t.preloadGeometry)!==void 0&&(a.userData.preloadGeometry=t.preloadGeometry),n(this,T).geometry3DMap.set(e,a);let s=this.getParentContainer(i);s instanceof we&&s.addEntity(a),n(this,se).call(this),this.render()}else W.error("Group container with ID '".concat(e,"' already exists. The group container cannot be added."));return{id:e,type:"group-container"}}addCustomGeometry(e,t,i,a,s){if(n(this,T).geometry3DMap.has(e))W.error("Custom geometry with ID '".concat(e,"' already exists. The custom geometry cannot be added."));else{let c=new Ur(t,i),u=new le(c,new ht(a));(a==null?void 0:a.interactive)!==void 0&&Ve(u,a.interactive,n(this,T)),u.id=e,c.mesh.userData={entityId:e,type:"custom-geometry"},n(this,T).geometry3DMap.set(u.id,u);let d=this.getParentContainer(s);s&&d instanceof we?d.addEntity(u):n(this,T).entityScene.addEntity(u),n(this,se).call(this),this.render()}return{id:e,type:"custom-geometry"}}addGeometryGroup(e,t,i,a){var s,u;if(!n(this,T).geometry3DMap.has(e)&&!n(this,T).geometry2DMap.has(e)){let d=new Qe(e);d.addEventListener("childadded",()=>{n(this,se).call(this),n(this,Ee).call(this)}),d.addEventListener("childremoved",()=>{n(this,se).call(this),n(this,Ee).call(this)}),d.userData.dirty=!0,n(this,T).geometry3DMap.set(e,d);for(let g of t.features){if(g.geometry==null||!["Polygon","MultiPolygon","LineString","MultiLineString"].includes(g.geometry.type))continue;let M=(g==null?void 0:g.id)||((s=g==null?void 0:g.properties)==null?void 0:s.id)||Tr(),c=i||{color:vc},{visible:p,altitude:P}=c,E=$s(c,["visible","altitude"]),f=n(this,w).meshOptimizationSystem.createEntityFromFeature(M,g,ee({outline:!0},E));n(this,T).geometry3DMap.set(M,f),d.userData.entities3D.add(M)}d.setVisible((u=i==null?void 0:i.visible)!=null?u:!0),(i==null?void 0:i.altitude)!=null&&d.setAltitude(i.altitude);let m=this.getParentContainer(a);m instanceof we&&m.addEntity(d),n(this,se).call(this),this.render()}else W.error("Geometry group with ID '".concat(e,"' already exists. The geometry group cannot be added."));return n(this,w).outlineInterpolationSystem.geometries3DDirty=!0,{id:e,type:"geometry-group"}}addOccluder(e,t){let i=this.getParentContainer(t),a=n(this,w).occlusion2DSystem.reserveOccluderId();return i==null||i.addOccluderFeature(e,a),a}addImage(e,t,i,a){try{yd(e,t,i)}catch(s){W.error(s);return}if(!n(this,T).geometry3DMap.has(e)&&!n(this,T).geometry2DMap.has(e)){let s=new xo(t),c=new le(s,new ht(i));c.id=e||Tr(),s.mesh.userData={entityId:c.id,type:"path"},n(this,T).geometry3DMap.set(c.id,c);let u=this.getParentContainer(a);u instanceof we&&u.addEntity(c),n(this,se).call(this),this.render()}else W.error("Image with ID '".concat(e,"' already exists. The image cannot be added."));return{id:e,type:"image"}}addModelGroup(e,t,i,{parent:a,onComplete:s}={}){var c,u;try{qc(e,t,i)}catch(d){W.error(d);return}if(!n(this,T).geometry3DMap.has(e)&&!n(this,T).geometry2DMap.has(e)){let d=new Qe(e);d.addEventListener("childadded",()=>{n(this,se).call(this),n(this,Ee).call(this)}),d.addEventListener("childremoved",()=>{n(this,se).call(this),n(this,Ee).call(this)}),n(this,T).geometry3DMap.set(e,d),d.userData.dirty=!0,d.userData.modelURL=i.url;for(let g of t.features){let M=g.id||g.properties.id||Tr(),p=n(this,w).meshOptimizationSystem.createModelFromFeature(M,g,ee({},i));(g.properties.interactive!==void 0||i.interactive!=null)&&Ve(p,(c=g.properties.interactive)!=null?c:i.interactive,n(this,T)),p.parentId=d.userData.entityId,n(this,T).geometry3DMap.set(M,p),d.userData.entities3D.add(M)}let m=this.getParentContainer(a);m instanceof we&&m.addEntity(d),n(this,se).call(this),(u=this.render())==null||u.then(s)}else W.error("Model group with ID '".concat(e,"' already exists. The model group cannot be added."));return{id:e,type:"geometry-group"}}addMarker2D(e,t,i,a){var c;let s=i==null?void 0:i.id;try{Ol(e,t,i||{})}catch(u){W.error(u);return}if(s===void 0||!n(this,T).geometry2DMap.has(s)&&!n(this,T).geometry3DMap.has(s)){let u=oe(this,Oe,Us).call(this,e,new Mt(t,i),i==null?void 0:i.occluderId,i==null?void 0:i.verticalOffset);u.id=s||String(u.id),s=u.id,(i==null?void 0:i.interactive)!=null&&i.interactive!=="pointer-events-auto"&&Ve(u,i==null?void 0:i.interactive,n(this,T));let d=typeof(i==null?void 0:i.attachTo)=="string"||typeof(i==null?void 0:i.attachTo)=="number"?n(this,T).geometry3DMap.get(i.attachTo):void 0;d instanceof le&&d.attach(u),(c=this.getParentContainer(a))==null||c.addEntity(u),this.render()}else W.error("Marker2D with ID '".concat(s,"' already exists. The marker cannot be added."));return{id:s,type:"marker"}}addText3D(e,t,i,a){if(!n(this,T).geometry3DMap.has(e)&&!n(this,T).geometry2DMap.has(e)){let s=new Pn(Fe(ee({},t),{properties:Fe(ee({},t.properties),{id:e,content:t.properties.text})})),c=new le(s,new ci(i==null?void 0:i.appearance));c.id=e,s.mesh.userData.entityId=e.toString(),s.mesh.userData.type="text3d",n(this,T).geometry3DMap.set(e,c);let u=this.getParentContainer(a);u instanceof we&&u.addEntity(c),n(this,se).call(this),this.render()}else W.error("Text3D with ID '".concat(e,"' already exists. The text3d cannot be added."));return{id:e,type:"text3d"}}labelText3D(e,t,i={}){var d,m;try{if(!t||!e)throw new Error("content and meshGeometryId are required");Hl.parse(i)}catch(g){W.error(g);return}let a=n(this,T).geometry3DMap.get(e);if((a==null?void 0:a.type)!=="geometry"){W.error(".labelText3D failed: target incorrect");return}let s=a==null?void 0:a.components[0];if(!s.feature.properties.textArea)return;if(s.textEntityId){let g=n(this,T).geometry3DMap.get(s.textEntityId);if((g==null?void 0:g.type)!=="text3d"){W.error(".labelText3D failed: existing text3d not found");return}return{id:g.id,type:g.type}}let c=new Pn({type:"Feature",geometry:{coordinates:(d=s.feature.properties.textArea)==null?void 0:d.position,type:"Point"},properties:{textArea:s.feature.properties.textArea,content:t,id:Tr()}});c.polygonEntityId=e;let u=new le(c,new ci(i==null?void 0:i.appearance));return s.textEntityId=u.id.toString(),c.mesh.userData.entityId=u.id.toString(),c.mesh.userData.type="text3d",n(this,T).geometry3DMap.set(u.id.toString(),u),i.parentId&&((m=this.getParentContainer(i.parentId))==null||m.addEntity(u)),this.render(),{id:u.id,type:"text3d"}}addLabel2D(e,t,i,a){var c;let s=i==null?void 0:i.id;try{Ll(e,t,i||{})}catch(u){W.error(u);return}if(s===void 0||!n(this,T).geometry2DMap.has(s)&&!n(this,T).geometry3DMap.has(s)){let u=oe(this,Oe,Us).call(this,e,new St(t,i||{},n(this,T)),i==null?void 0:i.occluderId,i==null?void 0:i.verticalOffset);u.id=s||String(u.id),s=u.id,(i==null?void 0:i.interactive)!=null&&Ve(u,i==null?void 0:i.interactive,n(this,T));let d=typeof(i==null?void 0:i.attachTo)=="string"||typeof(i==null?void 0:i.attachTo)=="number"?n(this,T).geometry3DMap.get(i.attachTo):void 0;d instanceof le&&d.attach(u),(c=this.getParentContainer(a))==null||c.addEntity(u),n(this,Ee).call(this),this.render()}else W.error("Label2D with ID '".concat(s,"' already exists. The label cannot be added."));return{id:s,type:"label"}}addPath(e,t={},i){var u,d;try{rd(e,t||{})}catch(m){W.error(m);return}let a=new Ut(e,mc(t)),s=new le(a,new ht({color:(u=t==null?void 0:t.color)!=null?u:"#ff834c",altitude:(d=t==null?void 0:t.verticalOffset)!=null?d:.1}));s.id=(t==null?void 0:t.id)||Tr(),a.mesh.userData={entityId:s.id,type:"path"},n(this,T).geometry3DMap.set(s.id,s),(t==null?void 0:t.interactive)!=null&&Ve(s,t==null?void 0:t.interactive,n(this,T));let c=this.getParentContainer(i);return c instanceof we&&c.addEntity(s),n(this,se).call(this),this.render(),{id:s.id,type:"path"}}updateWatermark(e){n(this,w).watermarkSystem.options=e,n(this,w).watermarkSystem.dirty=!0,n(this,w).collisionSystem.collidersDirty=!0,this.render()}remove(e){var i,a;let t;if(typeof e=="string"||typeof e=="number"?(t=n(this,T).geometry2DMap.get(e),t==null&&(t=n(this,T).geometry3DMap.get(e))):typeof e.id=="string"||typeof e.id=="number"?(t=n(this,T).geometry2DMap.get(e.id),t==null&&(t=n(this,T).geometry3DMap.get(e.id))):t=e,t!=null){if(t.type==="custom-geometry")n(this,T).geometry3DMap.delete(t.id),t.object3d&&ve(t.object3d);else if(t.type==="group-container"){n(this,T).geometry3DMap.delete(t.userData.entityId);for(let c of t.childrenIds.values())this.remove(c),t.userData.entities2D.delete(c);let s=t.components[1];s&&s.focusMesh&&ve(s.focusMesh),ve(t)}else if(t.type==="geometry-group"){n(this,T).geometry3DMap.delete(t.userData.entityId);for(let s of t.userData.entities3D.values())this.remove(s),t.userData.entities3D.delete(s);ve(t)}else if(t.type==="geometry"||t.type==="model"||t.type==="path"){let s=t.components[0],c=t.components[4];if(t.entities2D.size>0){for(let d of t.entities2D.values())this.remove(d);t.removeAllEntities()}let u=(a=(i=t.parentObject3D)==null?void 0:i.userData.entityId)!=null?a:t.parentId;if(u){let d=n(this,T).geometry3DMap.get(u);d instanceof Qe&&d.userData.entities3D.delete(t.id)}if(t.object3d&&ve(t.object3d),t.type==="geometry"){let d=t.components[3];d&&(d.enabled=!1,d.dirty=!0)}c&&"focusMesh"in c&&c.focusMesh!=null&&ve(c.focusMesh),"textMesh"in s&&s.textMesh!=null&&this.remove(s.textMesh.userData.entityId),n(this,T).geometry3DMap.delete(t.id)}else if(t.type==="marker"||t.type==="label"){let s=t.attachedTo;if(s){let c=n(this,T).geometry3DMap.get(s);c instanceof le&&c.detach(t)}t.object3d&&ve(t.object3d),t.type==="label"&&delete n(this,w).twoDDrawSystem.textCache[t.id],n(this,T).geometry2DMap.delete(t.id)}else if(t.type==="image")t.object3d&&ve(t.object3d),n(this,T).geometry3DMap.delete(t.id);else if(t.type==="text3d"){ve(t.object3d);let{batchedText:s,textMesh:c,polygonEntityId:u}=t.components[0];if(c&&(s&&s.removeText(c),ve(c)),u){n(this,w).text3DSystem.remove(u);let d=n(this,T).geometry3DMap.get(u);(d==null?void 0:d.type)==="geometry"&&(d.components[0].textMesh=void 0,d.components[0].textEntityId=void 0)}n(this,T).geometry3DMap.delete(t.id)}n(this,se).call(this),n(this,Ee).call(this),this.render()}}getScene(){return this.getState("__scene")}getThreeScene(){return n(this,fe)}getThreeCamera(){return n(this,ue)}async setEnvironment(e){if(n(this,fe))if(e==="basic"){n(this,hr)||L(this,hr,oe(this,Oe,js).call(this));let t=await n(this,hr);n(this,fe).environment=t}else n(this,fe).environment=null}getEnvironment(){var e;return(e=n(this,fe))!=null&&e.environment?"basic":!1}getCurrentSceneGLTF(e){return n(this,w).exporterSystem.getCurrentSceneGLTF(e)}getBoundingArea(e){(n(this,w).renderSystem.threeDdirty||n(this,w).renderSystem.twoDdirty)&&this.renderSync();let t=new Le;if(e==null)t.setFromObject(n(this,T).entityScene);else{let i=Er(n(this,T),e);if((i==null?void 0:i.type)==="geometry"&&(i==null?void 0:i.object3d)!=null){let a=i.components[0],s=a instanceof Ce?a.geometry:void 0;a.mesh instanceof mn&&s?(s.computeBoundingBox(),s.boundingBox&&t.union(s.boundingBox)):t.setFromObject(i.object3d)}else((i==null?void 0:i.type)==="geometry-group"||(i==null?void 0:i.type)==="group-container")&&(i==null?void 0:i.userData.entityId)!=null&&t.setFromObject(i)}if(vn(t))return Al(t).map(this.convert3DMapPositionToCoordinate)}hasState(e){return Er(n(this,T),e)!=null}getState(e){var i,a,s,c,u,d,m,g,M,p,P,E,f,y,S;if(e==null)return{type:"map-view",hoverColor:n(this,T).hoverColor,text3dHoverColor:n(this,T).text3dHoverColor};let t=Er(n(this,T),e);if((t==null?void 0:t.type)==="custom-geometry"){let v=t.components[0],x=t.components[1];return{id:t.id,type:"custom-geometry",visible:x.visible,altitude:x.altitude,parent:(i=t.parentObject3D)==null?void 0:i.userData.entityId,position:this.convert3DMapPositionToCoordinate(v.position)}}else if((t==null?void 0:t.type)==="geometry-group"){let v=Array.from(t.userData.entities3D.values()),x=v==null?void 0:v[0],C=x?this.getState(x):{};return{id:t.userData.entityId,type:"geometry-group",visible:t.visible,altitude:t.altitude,color:C==null?void 0:C.color,initialColor:C==null?void 0:C.initialColor,side:(a=C==null?void 0:C.side)!=null?a:"double",opacity:C==null?void 0:C.opacity,height:C==null?void 0:C.height,texture:C==null?void 0:C.texture,topColor:C==null?void 0:C.topColor,topTexture:C==null?void 0:C.topTexture,interactive:C==null?void 0:C.interactive,children:v,bevel:C==null?void 0:C.bevel}}else{if((t==null?void 0:t.type)==="group-container")return{id:t.userData.entityId,type:"group-container",visible:t.visible,altitude:(s=t.getWorldPosition(Gm).z)!=null?s:0,opacity:t.opacity,interactive:!!t.components[0],children:Array.from(t.childrenIds.values()).map(v=>this.getState(v)).filter(Boolean)};if((t==null?void 0:t.type)==="label"){let v=t.components[0],x=t.object3d.parent,C=x==null?void 0:x.userData.entityId;return{id:t.id,type:"label",text:v.text||"",parent:{id:C,type:x==null?void 0:x.type},position:this.convert3DMapPositionToCoordinate(t.position),enabled:v.enabled,visible:v.visible,initialRank:oi(v.initialRank),options:{rank:oi(v.rank),appearance:v.appearance,interactive:t.components[1]!=null,verticalOffset:t.verticalOffset,attachTo:t.attachedTo}}}else if((t==null?void 0:t.type)==="marker"){let v=t.components[0],x=t.object3d.parent,C=x==null?void 0:x.userData.entityId;return{id:t.id,type:"marker",enabled:v.enabled,visible:v.visible,placement:v.options.placement,dynamicResize:v.options.dynamicResize,parent:{id:C,type:x==null?void 0:x.type},position:this.convert3DMapPositionToCoordinate(t.position),element:v.containerEl,initialRank:oi(v.initialRank),contentHTML:v.contentHtml,options:{rank:oi(v.rank),interactive:t.components[1]!=null||!1,verticalOffset:t.verticalOffset,attachTo:t.attachedTo,lowPriorityPin:v.options.lowPriorityPin}}}else if((t==null?void 0:t.type)==="geometry"){let{color:v,hoverColor:x,initialColor:C,initialTopColor:O,topColor:A,altitude:I}=t.components[1],F=t.components[0],G=t.components[1],R=t.components[1],Z=t.components[2],k=t.components[3],U=t.parentObject3D;return{id:t.id,type:"geometry",opacity:R.opacity,initialColor:C,color:v,focusable:G!=null&&G.focusMesh!=null,initialTopColor:O,topColor:A,side:R.side,hoverColor:x,hovered:!!(Z!=null&&Z.hover),height:R.height,visible:R.visible,outline:k==null?void 0:k.enabled,showImage:R.showImage,texture:R.texture,topTexture:R.topTexture,flipImageToFaceCamera:R.flipImageToFaceCamera,enableImageCollisions:R.enableImageCollisions,parent:{id:U==null?void 0:U.userData.entityId,type:U==null?void 0:U.type},altitude:I,bevel:R.bevel,position:this.convert3DMapPositionToCoordinate(F.position),interactive:t.components[2]!=null,borderVisible:R.borderVisible,borderColor:R.borderColor,borderWidth:R.borderWidth}}else if((t==null?void 0:t.type)==="model"){let v=t.components[0],x=t.components[1],C=t.components[2];return{id:t.id,type:"model",position:v.mesh?this.convert3DMapPositionToCoordinate((c=v.mesh)==null?void 0:c.getWorldPosition(new B)):this.convert3DMapPositionToCoordinate(v.position),interactive:C!=null,material:x.material,parent:(u=t.parentObject3D)!=null&&u.parent?{id:t.parentObject3D.parent.userData.entityId,type:t.parentObject3D.parent.type}:void 0,visible:x.visible,verticalOffset:x.verticalOffset,color:x.color,opacity:x.opacity,rotation:(d=x.rotation)!=null?d:Lr,scale:(m=x.scale)!=null?m:Ir}}else if((t==null?void 0:t.type)==="path"){let v=t.components[0],x=t.components[2],C=t.components[1];return{id:t.id,type:"path",position:this.convert3DMapPositionToCoordinate(v.position),visible:C.visible,interactive:x!=null,completeFraction:v.completeFraction,color:C.color,accentColor:v.accentColor,width:v.width,animateArrowsOnPath:v.animateArrowsOnPath,displayArrowsOnPath:v.displayArrowsOnPath,verticalOffset:C.altitude}}else if((t==null?void 0:t.type)==="image"){let v=t.components[0];return{id:t.id,type:"image",position:this.convert3DMapPositionToCoordinate(v.position),visible:t.components[1].visible,verticalOffset:(g=v.feature.properties.verticalOffset)!=null?g:0,opacity:t.components[1].opacity,flipImageToFaceCamera:t.components[1].flipImageToFaceCamera,width:(M=v.feature.properties.width)!=null?M:0,height:(p=v.feature.properties.height)!=null?p:0,rotation:(P=v.feature.properties.rotation)!=null?P:0}}else if((t==null?void 0:t.type)==="text3d"&&t.components[0]instanceof Pn&&"textArea"in t.components[0].feature.properties){pc(t);let v=t.components[0],x=t.components[1],{textMesh:C}=v,O=(E=v.mesh)==null?void 0:E.parent;O instanceof we&&((f=O.children.find(F=>F.type==="batchedtext"))==null||f.getWorldPosition(n(this,en))),n(this,Kr).set(0,0,0);let A=C?C.getWorldPosition(n(this,Kr)):n(this,Kr);return Object.assign({},_r,x.getState(),{id:t.id,type:"text3d",position:this.convert3DMapPositionToCoordinate(A.add(n(this,en))),visible:(y=v.visible)!=null?y:!1,content:(S=v.feature.properties.content)!=null?S:""})}else return}}setState(e,t){var a,s;if(typeof e=="object"&&t==null){"hoverColor"in e&&(Pl(e.hoverColor)?n(this,T).hoverColor=(a=e.hoverColor)!=null?a:n(this,T).hoverColor:W.warn('Failed to update global hover color. Invalid color "'.concat(e.hoverColor,'".'))),"text3dHoverColor"in e&&(n(this,T).text3dHoverColor=(s=e.text3dHoverColor)!=null?s:n(this,T).text3dHoverColor);return}let i=Er(n(this,T),e);if(i!=null){if(i.type==="custom-geometry"){let c=n(this,T).geometry3DMap.get(i.id);if(c instanceof le&&c.components[0]instanceof Ur){let u=t;kt(i,n(this,T),u.visible),Or(i,u.altitude),oa(i,u.position,this.convertTo3DMapPosition),aa(i,this.getParentContainer(u.parent,!1)),Ve(i,u.interactive,n(this,T))&&n(this,se).call(this)}}else if(i.type==="path"){let c=t;Ve(i,c.interactive,n(this,T))&&n(this,se).call(this),Or(i,c.verticalOffset),uc(i,n(this,T),c)}else if(i.type==="model"){let c=t;Ve(i,c.interactive,n(this,T))&&n(this,se).call(this),kt(i,n(this,T),c.visible),gc(i,c)}else if(i.type==="group-container"){let c=t;kt(i,n(this,T),c.visible)&&(n(this,w).pathSystem.verticalDistanceDirty=!0,n(this,w).geometryInFocusSystem.focusablesDirty=!0),Or(i,c.altitude)&&(n(this,w).pathSystem.verticalDistanceDirty=!0),Ve(i,c.interactive,n(this,T))&&n(this,se).call(this),En(i,n(this,T),c.opacity)&&(n(this,w).outlineInterpolationSystem.outlineOpacitiesDirty=!0),c.preloadGeometry&&i.userData.preloadGeometry!==!0&&(i.userData.preloadGeometry=!0,n(this,w).outlineInterpolationSystem.geometries3DDirty=!0),Dn(i,c.focusable)&&(n(this,w).geometryInFocusSystem.focusablesDirty=!0)}else if(i.type==="geometry-group"){let c=t;kt(i,n(this,T),c.visible),Jl(i,n(this,T),c),la(i,n(this,T),c.outline),c.height!=null&&na(i,n(this,T),c.height),Or(i,c.altitude),sc(i,n(this,T),c),Kl(i,n(this,T),c.shading),En(i,n(this,T),c.opacity)&&(n(this,w).outlineInterpolationSystem.outlineOpacitiesDirty=!0),Ve(i,c.interactive,n(this,T))&&(n(this,se).call(this),n(this,Ee).call(this)),ca(i,n(this,T),c.side)}else if(i.type==="geometry"){if(i.components[0]instanceof Ce){let c=t;kt(i,n(this,T),c.visible),la(i,n(this,T),c.outline),Ql(i,c),Dn(i,c.focusable)&&(n(this,w).geometryInFocusSystem.focusablesDirty=!0),dc(i,c.renderOrder)&&(n(this,w).meshDetachmentSystem.dirty=!0),cc(i,c.opacity)&&(n(this,w).meshDetachmentSystem.dirty=!0,n(this,w).interactionSystem.dirty3D=!0,n(this,w).outlineInterpolationSystem.outlineOpacitiesDirty=!0),sa(i,c.flipImageToFaceCamera),ac(i,c.enableImageCollisions),Or(i,c.altitude),c.height!=null&&na(i,n(this,T),c.height),lc(i,c)&&(n(this,w).meshDetachmentSystem.dirty=!0),ec(i,c),nc(i,c.hoverColor),Ve(i,c.interactive,n(this,T)),oc(i,c.hovered),ca(i,n(this,T),c.side),hc(i,c)}n(this,se).call(this)}else if(i.type==="label"||i.type==="marker"){let c=t;ic(i,t,n(this,T)),rc(i,t,n(this,T))&&(n(this,Ee).call(this),n(this,w).domMutationSystem.dirty=!0),oa(i,c.position,this.convertTo3DMapPosition),aa(i,this.getParentContainer(c.parent,!1))&&(n(this,Ee).call(this),n(this,w).panBoundsSystem.dirty=!0),tc(i,c.enabled),kt(i,n(this,T),c.visible)}else if(i.type==="image"){let c=t;kt(i,n(this,T),c.visible),En(i,n(this,T),c.opacity),sa(i,c.flipImageToFaceCamera)}else if(i.type==="text3d"){let c=t;fc(i,n(this,T),c)}this.render()}}convertTo3DMapPosition(e,t,i=0,a){var u,d,m,g,M;if(Array.isArray(e))return this.convertTo3DMapPosition(e[1],e[0],(u=e[2])!=null?u:i,typeof t=="function"?t:void 0);if(typeof t!="number")throw new Error("convertTo3DMapPosition failed: longitude must be a number");let{x:s,y:c}=Cn((m=(d=n(this,T).center)==null?void 0:d[1])!=null?m:0,(M=(g=n(this,T).center)==null?void 0:g[0])!=null?M:0,e,t);return a?(a.set(s,c,i),a):new B(s,c,i)}get backgroundColor(){return typeof n(this,_e).backgroundColor=="string"?n(this,_e).backgroundColor:"#".concat(n(this,_e).backgroundColor.getHexString())}get backgroundAlpha(){return n(this,_e).backgroundAlpha}getThreeRenderer(){return n(this,_e)}getCenter(e){let t=Array.isArray(e)?e:this.getBoundingArea(e);return t?Bl(t):void 0}isInView(e){let t=Er(n(this,T),e);if(n(this,Ki).identity().multiply(n(this,ue).projectionMatrix).multiply(n(this,ue).matrixWorldInverse),n(this,fr).setFromProjectionMatrix(n(this,Ki)),t instanceof Qo)return n(this,fr).containsPoint(t.position);if(t instanceof le){let i=t==null?void 0:t.components[0];if(i instanceof Ur||i instanceof Bt)return n(this,fr).containsPoint(this.convertTo3DMapPosition(i.feature.geometry.coordinates));if(i instanceof Ce){let a=new Le(this.convertTo3DMapPosition(i.featureBbox[1],i.featureBbox[0],0),this.convertTo3DMapPosition(i.featureBbox[3],i.featureBbox[2],0));return n(this,fr).intersectsBox(a)}}return!1}queryGeometry2DInView(e){let{screenOffsets:t,fullyContains:i}=e!=null?e:{},[a,s,c,u]=jl(this.container,t),d=new K(a,s,c,u);return n(this,w).collisionSystem.visibleCollidersQTree.queryRect(d).filter(p=>i?d.contains(p):d.intersects(p)).map(p=>n(this,T).geometry2DMap.get(p.userData.entityId)).filter(p=>p!=null).filter(p=>p.components[0]instanceof St||p.components[0]instanceof Mt).map(p=>p.id.toString())}onMapLibreEvent(e,t){if(!this.map){W.warn('Tried to add event listener "'.concat(e,'" but MapLibre map is not initialized.'));return}this.map.on(e,t),n(this,$e)[e]=n(this,$e)[e]||[],n(this,$e)[e].push(t)}offMapLibreEvent(e,t){!this.map||!Array.isArray(n(this,$e)[e])||(this.map.off(e,t),n(this,$e)[e]=n(this,$e)[e].filter(i=>i!==t))}get aborted(){return n(this,mr).signal.aborted}onAbort(e){n(this,mr).signal.addEventListener("abort",e,{once:!0})}getSystems(){return n(this,w)}getInternalState(){return n(this,T)}getInternalTweenGroup(){return n(this,T).internalTweenGroup}getExternalTweenGroup(){return n(this,T).externalTweenGroup}computeMinZOffsetBetweenContainers(e,t,i){if(!e||!t)return-1;Ko(e,"group-container"),Ko(t,"group-container");let a=wn(e,this.getThreeCamera()),s=t.clone(),c=wn(s,this.getThreeCamera());if(!vn(a)||!vn(c))return-1;let u=0,d;i&&this.container.querySelectorAll(".debug-box").forEach(g=>g.remove());do{if(u>1e4)return-1;if(u+=20,s.position.z=u,s.updateMatrixWorld(),c.makeEmpty(),wn(s,n(this,ue),c),d=a.intersectsBox(c),i){let m=ia(a,"blue",this.container),g=ia(c,d?"red":"green",this.container);m.classList.add("debug-box"),g.classList.add("debug-box")}}while(d);return u}};fe=new WeakMap,ue=new WeakMap,hr=new WeakMap,Vi=new WeakMap,Yr=new WeakMap,Yt=new WeakMap,ur=new WeakMap,qr=new WeakMap,Oe=new WeakSet,Zs=l(function(e){var t;n(this,Et)!=="outdoors-overlay"&&((t=this.map)==null||t.setPixelRatio(e)),n(this,T).pixelRatio=this.resolutionScale},"#setResolutionScale"),T=new WeakMap,$e=new WeakMap,mr=new WeakMap,re=new WeakMap,ot=new WeakMap,ge=new WeakMap,Je=new WeakMap,_e=new WeakMap,w=new WeakMap,Hi=new WeakMap,Ee=new WeakMap,se=new WeakMap,Qd=l(function(){L(this,re,document.createElement("div")),n(this,re).classList.add("mappedin__smart-collision-engine__container"),L(this,ot,document.createElement("canvas")),n(this,ot).classList.add("mappedin__smart-collision-engine-debug__container"),this.container.appendChild(n(this,re)),L(this,ge,document.createElement("canvas")),n(this,ge).classList.add("mappedin__smart-collision-engine__container"),n(this,ge).width=n(this,re).clientWidth*this.resolutionScale,n(this,ge).height=n(this,re).clientHeight*this.resolutionScale,n(this,ge).style.width=n(this,re).clientWidth+"px",n(this,ge).style.height=n(this,re).clientHeight+"px",n(this,re).appendChild(n(this,ot)),n(this,re).appendChild(n(this,ge)),n(this,ot).width=n(this,re).clientWidth,n(this,ot).height=n(this,re).clientHeight,n(this,ge).width=n(this,re).clientWidth*this.resolutionScale,n(this,ge).height=n(this,re).clientHeight*this.resolutionScale,n(this,ge).style.width=n(this,re).clientWidth+"px",n(this,ge).style.height=n(this,re).clientHeight+"px"},"#renderEntity2DContainer"),eh=l(function(){L(this,Je,document.createElement("div")),n(this,Je).classList.add("mappedin-2d-entities"),Object.assign(n(this,Je).style,{position:"absolute",top:"0",left:"0",bottom:"0",right:"0",pointerEvents:"none","transform-style":"preserve-3d"}),this.container.appendChild(n(this,Je))},"#renderEntityDOMContainer"),th=l(function(){n(this,ge).width=n(this,re).clientWidth*this.resolutionScale,n(this,ge).height=n(this,re).clientHeight*this.resolutionScale,n(this,ge).style.width=n(this,re).clientWidth+"px",n(this,ge).style.height=n(this,re).clientHeight+"px",n(this,ot).width=n(this,re).clientWidth,n(this,ot).height=n(this,re).clientHeight,n(this,ge).width=n(this,re).clientWidth*this.resolutionScale,n(this,ge).height=n(this,re).clientHeight*this.resolutionScale,n(this,ge).style.width=n(this,re).clientWidth+"px",n(this,ge).style.height=n(this,re).clientHeight+"px",n(this,w).collisionSystem.collidersDirty=!0},"#resizeCollisionCanvas"),Et=new WeakMap,Wi=new WeakMap,Xi=new WeakMap,Yi=new WeakMap,qi=new WeakMap,$r=new WeakMap,zo=new WeakMap,$i=new WeakMap,Jr=new WeakMap,Ji=new WeakMap,pr=new WeakMap,Us=l(function(e,t,i,a){let s=new Qo(t,this.convertTo3DMapPosition(e[1],e[0],e[2]||0),a);return s.occluderId=i!=null?i:n(this,w).occlusion2DSystem.backgroundId,n(this,T).geometry2DMap.set(s.id,s),s},"#createEntity2D"),fr=new WeakMap,Ki=new WeakMap,Qi=new WeakMap,Ze=new WeakMap,Ue=new WeakMap,js=l(async function(){return Zt.load(Sc).then(e=>{var t;return n(this,fe)&&((t=n(this,fe).environment)==null||t.dispose(),e.mapping=Qs,n(this,fe).environment=e,this.render()),e})},"#loadEnvMap"),Zo=new WeakMap,Uo=new WeakMap,Kr=new WeakMap,en=new WeakMap,l(Vs,"Core");var zs=Vs,Gm=new B,Ra=zs;var Hs=class Hs extends J{constructor(e){super();h(this,"gl");h(this,"el",document.createElement("div"));h(this,"core");h(this,"origin");h(this,"map");h(this,"layer");h(this,"handleStyleChange",l(()=>{!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()))},"handleStyleChange"));h(this,"handleMove",l(()=>{if(!this.map)return;let[e,t]=this.map.getCenter().toArray();this.core.getSystems().cameraSystem.setCenter(e,t),this.core.getSystems().cameraSystem.setZoomLevel(this.map.getZoom()),this.core.getSystems().cameraSystem.setRotation(q.degToRad(this.map.getBearing())),this.core.getSystems().cameraSystem.setTilt(q.degToRad(this.map.getPitch()))},"handleMove"));h(this,"handleError",l(e=>{W.warn(e)},"handleError"));this.origin=e}onAdd(e){this.origin=this.origin||e.getCenter().toArray(),this.gl=e.painter.context.gl,this.core=new Ra(e._container,{center:this.origin,zoomLevel:e.getZoom(),pitch:e.getPitch(),bearing:e.getBearing(),gl:this.gl,map:e,mode:"outdoors-overlay"}),this.map=e,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=Js.fromLngLat(this.origin,0);return this.layer=ta(t,this.core.viewCamera,()=>{this.core.renderSync()}),this.map.on("styledata",this.handleStyleChange),this.map.on("move",this.handleMove),this.handleStyleChange(),this.el}onRemove(){this.map&&(this.map.off("styledata",this.handleStyleChange),this.map.off("move",this.handleMove),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}};l(Hs,"MapLibreOverlay");var jo=Hs;b();var rh=Sl("",{prefix:"[MapLibreOverlay]"});b();var ih=l((o,{id:r}={})=>{let e=Array.isArray(o)?o:[o];if(!e.every(a=>typeof a=="string"))return;let t=e.join(""),i=null;if(r){let a=document.getElementById(r);a instanceof HTMLStyleElement&&(i=a)}i==null&&(i=document.createElement("style")),r&&r!==""&&(i.id=r),i.textContent=t,document.head.appendChild(i)},"injectCSS");var nh=".mappedin-marker {\n font-family: 'InterUI-Regular', Helvetica, Arial, sans-serif;\n font-weight: normal;\n top: 0;\n position: absolute;\n font-weight: bold;\n color: black;\n display: flex;\n flex-direction: row;\n will-change: transform, opacity;\n transition: opacity 150ms ease-in-out;\n justify-content: center;\n opacity: 0;\n}\n\n/* Low priority pin strategy styles */\n\n/* Hide child elements as well */\n.mappedin-marker[data-placement='hidden'] > .mappedin-marker-content {\n visibility: hidden;\n}\n\n/* Create the pin using ::before pseudo-element */\n.mappedin-marker::before {\n content: '';\n display: none;\n border-radius: 50%;\n position: relative;\n /* Default values - will be overridden by inline styles */\n width: var(--mappedin-pin-size, 2px);\n height: var(--mappedin-pin-size, 2px);\n background-color: var(--pin-color, #666);\n}\n\n.mappedin-marker[data-placement='hidden']::before {\n display: block;\n}\n";var oh=".mappedin__smart-collision-engine__container {\n position: absolute;\n left: 0px;\n top: 0px;\n bottom: 0px;\n right: 0px;\n pointer-events: none;\n /* Enables colliders to use translate3D */\n transform-style: preserve-3d;\n font-family: 'InterUI-Regular', Helvetica, Arial, sans-serif;\n}\n\n.mappedin__smart-collision-engine-debug__container {\n position: absolute;\n left: 0px;\n top: 0px;\n bottom: 0px;\n right: 0px;\n transition: opacity 300ms ease-in-out;\n pointer-events: none;\n will-change: opacity;\n &.interacting {\n opacity: 0.2;\n }\n}\n";var ah=".mappedin-map {\n .mappedin-interactive {\n cursor: grab;\n\n &:active {\n cursor: grabbing;\n }\n\n &.mappedin-interaction-hover {\n cursor: pointer;\n }\n }\n}\n";var sh=".mappedin-map {\n .mappedin-control-container {\n position: absolute;\n left: 0px;\n top: 0px;\n bottom: 0px;\n right: 0px;\n pointer-events: none;\n font-family: 'InterUI-Regular', Helvetica, Arial, sans-serif;\n\n .mappedin-ctrl-top-left,\n .mappedin-ctrl-top-right,\n .mappedin-ctrl-bottom-left,\n .mappedin-ctrl-bottom-right {\n position: absolute;\n pointer-events: none;\n }\n\n .mappedin-ctrl-top-left {\n top: 0;\n left: 0;\n }\n\n .mappedin-ctrl-top-right {\n top: 0;\n right: 0;\n }\n\n .mappedin-ctrl-bottom-left {\n bottom: 0;\n left: 0;\n }\n\n .mappedin-ctrl-bottom-right {\n bottom: 0;\n right: 0;\n }\n\n .mappedin-ctrl-attrib {\n display: block;\n position: relative;\n pointer-events: auto;\n font: 9px/11px 'InterUI-Regular', Helvetica, Arial, sans-serif;\n padding: 3px 5px 1px 5px;\n background-color: rgba(255, 255, 255, 0.5);\n margin: 0;\n min-width: 11px;\n min-height: 11px;\n user-select: none;\n\n summary.mappedin-ctrl-attrib-button {\n appearance: none;\n list-style: none;\n }\n\n summary.mappedin-ctrl-attrib-button::-webkit-details-marker {\n display: none;\n }\n\n &.mappedin-compact .mappedin-ctrl-attrib-button,\n &.mappedin-compact-show .mappedin-ctrl-attrib-inner {\n display: inline-block;\n }\n\n &.mappedin-compact {\n background-color: transparent;\n }\n\n &.mappedin-compact-show {\n min-width: 15px;\n min-height: 15px;\n box-sizing: border-box;\n background-color: rgba(255, 255, 255, 0.5);\n }\n }\n\n .mappedin-ctrl-attrib-top-left {\n float: left;\n border-bottom-right-radius: 4px;\n }\n\n .mappedin-ctrl-attrib-top-right {\n float: right;\n border-bottom-left-radius: 4px;\n }\n\n .mappedin-ctrl-attrib-bottom-left {\n float: left;\n border-top-right-radius: 4px;\n }\n\n .mappedin-ctrl-attrib-bottom-right {\n float: right;\n border-top-left-radius: 4px;\n }\n .mappedin-ctrl-attrib-top-left,\n .mappedin-ctrl-attrib-bottom-left {\n padding: 3px 5px 1px 20px;\n }\n\n .mappedin-ctrl-attrib-inner {\n display: inline-block;\n margin-right: 12px;\n }\n\n .mappedin-ctrl-attrib-inner,\n .mappedin-ctrl-attrib-inner a {\n color: rgba(0, 0, 0, 0.75);\n text-decoration: none;\n }\n\n .mappedin-ctrl-attrib-inner-bold,\n .mappedin-ctrl-attrib-inner-bold a {\n font-weight: bold;\n }\n\n .mappedin-ctrl-attrib-inner a:hover {\n color: #017ef1;\n text-decoration: underline;\n cursor: pointer;\n }\n\n .mappedin-ctrl-attrib-button {\n display: none;\n cursor: pointer;\n position: absolute;\n width: 15px;\n height: 15px;\n box-sizing: border-box;\n border-radius: 50%;\n top: 0;\n right: 2px;\n border: 1px;\n }\n .mappedin-ctrl-attrib-top-left .mappedin-ctrl-attrib-button,\n .mappedin-ctrl-attrib-bottom-left .mappedin-ctrl-attrib-button {\n left: 2px;\n }\n }\n}\n";var Vm=[nh,oh,ah,sh],M2=l((o,r)=>{tn.instance!=null&&rh.warn("Only a single map venue is supported at this time.");let e=new tn([o.mapCenter.longitude,o.mapCenter.latitude],o,r);return tn.instance=e,e},"createMapLibreOverlay"),Hm=3,Wm={debug:!1,pitch:45,bearing:0,antialiasing:{enabled:!0},shadingAndOutlines:!0,outdoorView:{layersHiddenByGeometry:["building","building-top"]},imagePlacementOptions:{mode:"default"},flipImagesToFaceCamera:!0,multiFloorView:{enabled:!1,floorGap:Hm}},gr,yr,Qr,qt,br,rn=class rn{constructor(r,e,t){D(this,gr);D(this,yr);D(this,Qr);D(this,qt);D(this,br);h(this,"on",l((r,e)=>{n(this,gr).on(r,e)},"on"));h(this,"off",l((r,e)=>{n(this,gr).off(r,e)},"off"));L(this,gr,new J),L(this,br,new jo(r)),L(this,yr,e),L(this,Qr,t)}onAdd(r){var i,a,s;let e=n(this,br).onAdd(r),t=Fe(ee(ee({},Wm),(i=n(this,Qr))!=null?i:{}),{outdoorView:ee({token:n(this,yr).outdoorViewToken},(a=n(this,Qr))==null?void 0:a.outdoorView)});return L(this,qt,new jm(n(this,br).core)),((s=t.injectStyles)==null||s)&&ih(Vm,{id:"mappedin__styles"}),n(this,qt).addMap(n(this,yr),t).then(()=>{n(this,gr).publish("loaded",{mapView:n(this,qt),mapData:n(this,yr)})}),e}onRemove(){n(this,qt)&&n(this,qt).clear(),rn.instance=null,n(this,br).onRemove()}};gr=new WeakMap,yr=new WeakMap,Qr=new WeakMap,qt=new WeakMap,br=new WeakMap,l(rn,"MappedinMapLibreOverlay"),h(rn,"instance");var tn=rn;export{Wm as DEFAULT_MAP_OPTIONS,Hm as FLOOR_GAP,tn as MappedinMapLibreOverlay,M2 as createMapLibreOverlay};
|