@arenarium/maps 1.0.96 → 1.0.97

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.
Files changed (2) hide show
  1. package/dist/index.js +2 -2
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  (function(Nt,Qt){typeof exports=="object"&&typeof module<"u"?Qt(exports):typeof define=="function"&&define.amd?define(["exports"],Qt):(Nt=typeof globalThis<"u"?globalThis:Nt||self,Qt(Nt.arenarium={}))})(this,function(Nt){"use strict";var Fv=Object.defineProperty;var Og=Nt=>{throw TypeError(Nt)};var Ov=(Nt,Qt,Ai)=>Qt in Nt?Fv(Nt,Qt,{enumerable:!0,configurable:!0,writable:!0,value:Ai}):Nt[Qt]=Ai;var Vt=(Nt,Qt,Ai)=>Ov(Nt,typeof Qt!="symbol"?Qt+"":Qt,Ai),Rp=(Nt,Qt,Ai)=>Qt.has(Nt)||Og("Cannot "+Ai);var ki=(Nt,Qt,Ai)=>(Rp(Nt,Qt,"read from private field"),Ai?Ai.call(Nt):Qt.get(Nt)),Ma=(Nt,Qt,Ai)=>Qt.has(Nt)?Og("Cannot add the same private member more than once"):Qt instanceof WeakSet?Qt.add(Nt):Qt.set(Nt,Ai),Gc=(Nt,Qt,Ai,qc)=>(Rp(Nt,Qt,"write to private field"),qc?qc.call(Nt,Ai):Qt.set(Nt,Ai),Ai),jg=(Nt,Qt,Ai)=>(Rp(Nt,Qt,"access private method"),Ai);var La,vo,Rl,bu,Ng,Yf,na,bo,Dl,_s;var Ai=Array.isArray,qc=Array.prototype.indexOf,Vg=Array.from,Ug=Object.defineProperty,vl=Object.getOwnPropertyDescriptor,Dp=Object.prototype,$g=Array.prototype,Lp=Object.getPrototypeOf,Bp=Object.isExtensible;function Gg(v){for(var g=0;g<v.length;g++)v[g]()}const vn=2,Fp=4,Hc=8,Dh=16,Sa=32,oo=64,Wc=128,Hr=256,Xc=512,on=1024,Pa=2048,ds=4096,Kc=8192,Yc=16384,qg=32768,Hg=65536,Wg=1<<19,Op=1<<20,Lh=1<<21,Jc=Symbol("$state");function jp(v){return v===this.v}function Xg(v){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Kg(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Yg(v){throw new Error("https://svelte.dev/e/effect_orphan")}function Jg(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Qg(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function e_(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function t_(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let jv=!1;const i_=2,Wr=Symbol(),r_=[];function n_(v,g=!1){return Qc(v,new Map,"",r_)}function Qc(v,g,w,I,R=null){if(typeof v=="object"&&v!==null){var F=g.get(v);if(F!==void 0)return F;if(v instanceof Map)return new Map(v);if(v instanceof Set)return new Set(v);if(Ai(v)){var S=Array(v.length);g.set(v,S),R!==null&&g.set(R,S);for(var o=0;o<v.length;o+=1){var de=v[o];o in v&&(S[o]=Qc(de,g,w,I))}return S}if(Lp(v)===Dp){S={},g.set(v,S),R!==null&&g.set(R,S);for(var ge in v)S[ge]=Qc(v[ge],g,w,I);return S}if(v instanceof Date)return structuredClone(v);if(typeof v.toJSON=="function")return Qc(v.toJSON(),g,w,I,v)}if(v instanceof EventTarget)return v;try{return structuredClone(v)}catch{return v}}function a_(v){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let Br=null;function Np(v){Br=v}function eu(v,g=!1,w){var I=Br={p:Br,c:null,d:!1,e:null,m:!1,s:v,x:null,l:null};Qp(()=>{I.d=!0})}function tu(v){const g=Br;if(g!==null){v!==void 0&&(g.x=v);const S=g.e;if(S!==null){var w=pi,I=ei;g.e=null;try{for(var R=0;R<S.length;R++){var F=S[R];Ca(F.effect),jn(F.reaction),ru(F.fn)}}finally{Ca(w),jn(I)}}Br=g.p,g.m=!0}return v||{}}function Zp(){return!0}function ps(v){if(typeof v!="object"||v===null||Jc in v)return v;const g=Lp(v);if(g!==Dp&&g!==$g)return v;var w=new Map,I=Ai(v),R=er(0),F=ei,S=o=>{var de=ei;jn(F);var ge=o();return jn(de),ge};return I&&w.set("length",er(v.length)),new Proxy(v,{defineProperty(o,de,ge){(!("value"in ge)||ge.configurable===!1||ge.enumerable===!1||ge.writable===!1)&&Qg();var ze=w.get(de);return ze===void 0?(ze=S(()=>er(ge.value)),w.set(de,ze)):gi(ze,S(()=>ps(ge.value))),!0},deleteProperty(o,de){var ge=w.get(de);if(ge===void 0)de in o&&(w.set(de,S(()=>er(Wr))),Bh(R));else{if(I&&typeof de=="string"){var ze=w.get("length"),Be=Number(de);Number.isInteger(Be)&&Be<ze.v&&gi(ze,Be)}gi(ge,Wr),Bh(R)}return!0},get(o,de,ge){var le;if(de===Jc)return v;var ze=w.get(de),Be=de in o;if(ze===void 0&&(!Be||(le=vl(o,de))!=null&&le.writable)&&(ze=S(()=>er(ps(Be?o[de]:Wr))),w.set(de,ze)),ze!==void 0){var ke=st(ze);return ke===Wr?void 0:ke}return Reflect.get(o,de,ge)},getOwnPropertyDescriptor(o,de){var ge=Reflect.getOwnPropertyDescriptor(o,de);if(ge&&"value"in ge){var ze=w.get(de);ze&&(ge.value=st(ze))}else if(ge===void 0){var Be=w.get(de),ke=Be==null?void 0:Be.v;if(Be!==void 0&&ke!==Wr)return{enumerable:!0,configurable:!0,value:ke,writable:!0}}return ge},has(o,de){var ke;if(de===Jc)return!0;var ge=w.get(de),ze=ge!==void 0&&ge.v!==Wr||Reflect.has(o,de);if(ge!==void 0||pi!==null&&(!ze||(ke=vl(o,de))!=null&&ke.writable)){ge===void 0&&(ge=S(()=>er(ze?ps(o[de]):Wr)),w.set(de,ge));var Be=st(ge);if(Be===Wr)return!1}return ze},set(o,de,ge,ze){var Ot;var Be=w.get(de),ke=de in o;if(I&&de==="length")for(var le=ge;le<Be.v;le+=1){var Oe=w.get(le+"");Oe!==void 0?gi(Oe,Wr):le in o&&(Oe=S(()=>er(Wr)),w.set(le+"",Oe))}Be===void 0?(!ke||(Ot=vl(o,de))!=null&&Ot.writable)&&(Be=S(()=>er(void 0)),gi(Be,S(()=>ps(ge))),w.set(de,Be)):(ke=Be.v!==Wr,gi(Be,S(()=>ps(ge))));var zt=Reflect.getOwnPropertyDescriptor(o,de);if(zt!=null&&zt.set&&zt.set.call(ze,ge),!ke){if(I&&typeof de=="string"){var fi=w.get("length"),kt=Number(de);Number.isInteger(kt)&&kt>=fi.v&&gi(fi,kt+1)}Bh(R)}return!0},ownKeys(o){st(R);var de=Reflect.ownKeys(o).filter(Be=>{var ke=w.get(Be);return ke===void 0||ke.v!==Wr});for(var[ge,ze]of w)ze.v!==Wr&&!(ge in o)&&de.push(ge);return de},setPrototypeOf(){e_()}})}function Bh(v,g=1){gi(v,v.v+g)}function Vp(v){var g=vn|Pa,w=ei!==null&&(ei.f&vn)!==0?ei:null;return pi===null||w!==null&&(w.f&Hr)!==0?g|=Hr:pi.f|=Op,{ctx:Br,deps:null,effects:null,equals:jp,f:g,fn:v,reactions:null,rv:0,v:null,wv:0,parent:w??pi}}function Up(v){const g=Vp(v);return lf(g),g}function $p(v){var g=v.effects;if(g!==null){v.effects=null;for(var w=0;w<g.length;w+=1)fs(g[w])}}function s_(v){for(var g=v.parent;g!==null;){if((g.f&vn)===0)return g;g=g.parent}return null}function Gp(v){var g,w=pi;Ca(s_(v));try{$p(v),g=pf(v)}finally{Ca(w)}return g}function qp(v){var g=Gp(v);if(v.equals(g)||(v.v=g,v.wv=uf()),!co){var w=(Ia||(v.f&Hr)!==0)&&v.deps!==null?ds:on;Nn(v,w)}}const bl=new Map;function Fh(v,g){var w={f:0,v,reactions:null,equals:jp,rv:0,wv:0};return w}function er(v,g){const w=Fh(v);return lf(w),w}function gi(v,g,w=!1){ei!==null&&!On&&Zp()&&(ei.f&(vn|Dh))!==0&&!(Pr!=null&&Pr.includes(v))&&t_();let I=w?ps(g):g;return o_(v,I)}function o_(v,g){if(!v.equals(g)){var w=v.v;co?bl.set(v,g):bl.set(v,w),v.v=g,(v.f&vn)!==0&&((v.f&Pa)!==0&&Gp(v),Nn(v,(v.f&Hr)===0?on:ds)),v.wv=uf(),Hp(v,Pa),pi!==null&&(pi.f&on)!==0&&(pi.f&(Sa|oo))===0&&(ln===null?b_([v]):ln.push(v))}return g}function Hp(v,g){var w=v.reactions;if(w!==null)for(var I=w.length,R=0;R<I;R++){var F=w[R],S=F.f;(S&Pa)===0&&(Nn(F,g),(S&(on|Hr))!==0&&((S&vn)!==0?Hp(F,ds):Vh(F)))}}var Oh,Wp,Xp,Kp;function l_(){if(Oh===void 0){Oh=window,Wp=/Firefox/.test(navigator.userAgent);var v=Element.prototype,g=Node.prototype,w=Text.prototype;Xp=vl(g,"firstChild").get,Kp=vl(g,"nextSibling").get,Bp(v)&&(v.__click=void 0,v.__className=void 0,v.__attributes=null,v.__style=void 0,v.__e=void 0),Bp(w)&&(w.__t=void 0)}}function c_(v=""){return document.createTextNode(v)}function Yp(v){return Xp.call(v)}function Jp(v){return Kp.call(v)}function iu(v,g){return Yp(v)}function u_(v,g=1,w=!1){let I=v;for(;g--;)I=Jp(I);return I}function h_(v){pi===null&&ei===null&&Yg(),ei!==null&&(ei.f&Hr)!==0&&pi===null&&Kg(),co&&Xg()}function d_(v,g){var w=g.last;w===null?g.last=g.first=v:(w.next=v,v.prev=w,g.last=v)}function lo(v,g,w,I=!0){var R=pi,F={ctx:Br,deps:null,nodes_start:null,nodes_end:null,f:v|Pa,first:null,fn:g,last:null,next:null,parent:R,prev:null,teardown:null,transitions:null,wv:0};if(w)try{Zh(F),F.f|=qg}catch(de){throw fs(F),de}else g!==null&&Vh(F);var S=w&&F.deps===null&&F.first===null&&F.nodes_start===null&&F.teardown===null&&(F.f&(Op|Wc))===0;if(!S&&I&&(R!==null&&d_(F,R),ei!==null&&(ei.f&vn)!==0)){var o=ei;(o.effects??(o.effects=[])).push(F)}return F}function Qp(v){const g=lo(Hc,null,!1);return Nn(g,on),g.teardown=v,g}function Fn(v){h_();var g=pi!==null&&(pi.f&Sa)!==0&&Br!==null&&!Br.m;if(g){var w=Br;(w.e??(w.e=[])).push({fn:v,effect:pi,reaction:ei})}else{var I=ru(v);return I}}function p_(v){const g=lo(oo,v,!0);return(w={})=>new Promise(I=>{w.outro?y_(g,()=>{fs(g),I(void 0)}):(fs(g),I(void 0))})}function ru(v){return lo(Fp,v,!1)}function ef(v){return lo(Hc,v,!0)}function jh(v,g=[],w=Vp){const I=g.map(w);return f_(()=>v(...I.map(st)))}function f_(v,g=0){return lo(Hc|Dh|g,v,!0)}function m_(v,g=!0){return lo(Hc|Sa,v,!0,g)}function tf(v){var g=v.teardown;if(g!==null){const w=co,I=ei;of(!0),jn(null);try{g.call(null)}finally{of(w),jn(I)}}}function rf(v,g=!1){var w=v.first;for(v.first=v.last=null;w!==null;){var I=w.next;(w.f&oo)!==0?w.parent=null:fs(w,g),w=I}}function g_(v){for(var g=v.first;g!==null;){var w=g.next;(g.f&Sa)===0&&fs(g),g=w}}function fs(v,g=!0){var w=!1;(g||(v.f&Wg)!==0)&&v.nodes_start!==null&&(__(v.nodes_start,v.nodes_end),w=!0),rf(v,g&&!w),hu(v,0),Nn(v,Yc);var I=v.transitions;if(I!==null)for(const F of I)F.stop();tf(v);var R=v.parent;R!==null&&R.first!==null&&nf(v),v.next=v.prev=v.teardown=v.ctx=v.deps=v.fn=v.nodes_start=v.nodes_end=null}function __(v,g){for(;v!==null;){var w=v===g?null:Jp(v);v.remove(),v=w}}function nf(v){var g=v.parent,w=v.prev,I=v.next;w!==null&&(w.next=I),I!==null&&(I.prev=w),g!==null&&(g.first===v&&(g.first=I),g.last===v&&(g.last=w))}function y_(v,g){var w=[];af(v,w,!0),x_(w,()=>{fs(v),g&&g()})}function x_(v,g){var w=v.length;if(w>0){var I=()=>--w||g();for(var R of v)R.out(I)}else g()}function af(v,g,w){if((v.f&Kc)===0){if(v.f^=Kc,v.transitions!==null)for(const S of v.transitions)(S.is_global||w)&&g.push(S);for(var I=v.first;I!==null;){var R=I.next,F=(I.f&Hg)!==0||(I.f&Sa)!==0;af(I,g,F?w:!1),I=R}}}let nu=[];function v_(){var v=nu;nu=[],Gg(v)}function sf(v){nu.length===0&&queueMicrotask(v_),nu.push(v)}let au=!1,Nh=!1,su=null,ms=!1,co=!1;function of(v){co=v}let ou=[],Nv=[],ei=null,On=!1;function jn(v){ei=v}let pi=null;function Ca(v){pi=v}let Pr=null;function lf(v){ei!==null&&ei.f&Lh&&(Pr===null?Pr=[v]:Pr.push(v))}let Cr=null,Xr=0,ln=null;function b_(v){ln=v}let cf=1,lu=0,Ia=!1;function uf(){return++cf}function cu(v){var Be;var g=v.f;if((g&Pa)!==0)return!0;if((g&ds)!==0){var w=v.deps,I=(g&Hr)!==0;if(w!==null){var R,F,S=(g&Xc)!==0,o=I&&pi!==null&&!Ia,de=w.length;if(S||o){var ge=v,ze=ge.parent;for(R=0;R<de;R++)F=w[R],(S||!((Be=F==null?void 0:F.reactions)!=null&&Be.includes(ge)))&&(F.reactions??(F.reactions=[])).push(ge);S&&(ge.f^=Xc),o&&ze!==null&&(ze.f&Hr)===0&&(ge.f^=Hr)}for(R=0;R<de;R++)if(F=w[R],cu(F)&&qp(F),F.wv>v.wv)return!0}(!I||pi!==null&&!Ia)&&Nn(v,on)}return!1}function w_(v,g){for(var w=g;w!==null;){if((w.f&Wc)!==0)try{w.fn(v);return}catch{w.f^=Wc}w=w.parent}throw au=!1,v}function hf(v){return(v.f&Yc)===0&&(v.parent===null||(v.parent.f&Wc)===0)}function uu(v,g,w,I){if(au){if(w===null&&(au=!1),hf(g))throw v;return}if(w!==null&&(au=!0),w_(v,g),hf(g))throw v}function df(v,g,w=!0){var I=v.reactions;if(I!==null)for(var R=0;R<I.length;R++){var F=I[R];Pr!=null&&Pr.includes(v)||((F.f&vn)!==0?df(F,g,!1):g===F&&(w?Nn(F,Pa):(F.f&on)!==0&&Nn(F,ds),Vh(F)))}}function pf(v){var le;var g=Cr,w=Xr,I=ln,R=ei,F=Ia,S=Pr,o=Br,de=On,ge=v.f;Cr=null,Xr=0,ln=null,Ia=(ge&Hr)!==0&&(On||!ms||ei===null),ei=(ge&(Sa|oo))===0?v:null,Pr=null,Np(v.ctx),On=!1,lu++,v.f|=Lh;try{var ze=(0,v.fn)(),Be=v.deps;if(Cr!==null){var ke;if(hu(v,Xr),Be!==null&&Xr>0)for(Be.length=Xr+Cr.length,ke=0;ke<Cr.length;ke++)Be[Xr+ke]=Cr[ke];else v.deps=Be=Cr;if(!Ia)for(ke=Xr;ke<Be.length;ke++)((le=Be[ke]).reactions??(le.reactions=[])).push(v)}else Be!==null&&Xr<Be.length&&(hu(v,Xr),Be.length=Xr);if(Zp()&&ln!==null&&!On&&Be!==null&&(v.f&(vn|ds|Pa))===0)for(ke=0;ke<ln.length;ke++)df(ln[ke],v);return R!==null&&R!==v&&(lu++,ln!==null&&(I===null?I=ln:I.push(...ln))),ze}finally{Cr=g,Xr=w,ln=I,ei=R,Ia=F,Pr=S,Np(o),On=de,v.f^=Lh}}function T_(v,g){let w=g.reactions;if(w!==null){var I=qc.call(w,v);if(I!==-1){var R=w.length-1;R===0?w=g.reactions=null:(w[I]=w[R],w.pop())}}w===null&&(g.f&vn)!==0&&(Cr===null||!Cr.includes(g))&&(Nn(g,ds),(g.f&(Hr|Xc))===0&&(g.f^=Xc),$p(g),hu(g,0))}function hu(v,g){var w=v.deps;if(w!==null)for(var I=g;I<w.length;I++)T_(v,w[I])}function Zh(v){var g=v.f;if((g&Yc)===0){Nn(v,on);var w=pi,I=Br,R=ms;pi=v,ms=!0;try{(g&Dh)!==0?g_(v):rf(v),tf(v);var F=pf(v);v.teardown=typeof F=="function"?F:null,v.wv=cf;var S=v.deps,o}catch(de){uu(de,v,w,I||v.ctx)}finally{ms=R,pi=w}}}function M_(){try{Jg()}catch(v){if(su!==null)uu(v,su,null);else throw v}}function S_(){var v=ms;try{var g=0;for(ms=!0;ou.length>0;){g++>1e3&&M_();var w=ou,I=w.length;ou=[];for(var R=0;R<I;R++){var F=C_(w[R]);P_(F)}bl.clear()}}finally{Nh=!1,ms=v,su=null}}function P_(v){var g=v.length;if(g!==0)for(var w=0;w<g;w++){var I=v[w];if((I.f&(Yc|Kc))===0)try{cu(I)&&(Zh(I),I.deps===null&&I.first===null&&I.nodes_start===null&&(I.teardown===null?nf(I):I.fn=null))}catch(R){uu(R,I,null,I.ctx)}}}function Vh(v){Nh||(Nh=!0,queueMicrotask(S_));for(var g=su=v;g.parent!==null;){g=g.parent;var w=g.f;if((w&(oo|Sa))!==0){if((w&on)===0)return;g.f^=on}}ou.push(g)}function C_(v){for(var g=[],w=v;w!==null;){var I=w.f,R=(I&(Sa|oo))!==0,F=R&&(I&on)!==0;if(!F&&(I&Kc)===0){if((I&Fp)!==0)g.push(w);else if(R)w.f^=on;else try{cu(w)&&Zh(w)}catch(de){uu(de,w,null,w.ctx)}var S=w.first;if(S!==null){w=S;continue}}var o=w.parent;for(w=w.next;w===null&&o!==null;)w=o.next,o=o.parent}return g}function st(v){var g=v.f,w=(g&vn)!==0;if(ei!==null&&!On){if(!(Pr!=null&&Pr.includes(v))){var I=ei.deps;v.rv<lu&&(v.rv=lu,Cr===null&&I!==null&&I[Xr]===v?Xr++:Cr===null?Cr=[v]:(!Ia||!Cr.includes(v))&&Cr.push(v))}}else if(w&&v.deps===null&&v.effects===null){var R=v,F=R.parent;F!==null&&(F.f&Hr)===0&&(R.f^=Hr)}return w&&(R=v,cu(R)&&qp(R)),co&&bl.has(v)?bl.get(v):v.v}function Uh(v){var g=On;try{return On=!0,v()}finally{On=g}}const I_=-7169;function Nn(v,g){v.f=v.f&I_|g}const k_=["touchstart","touchmove"];function A_(v){return k_.includes(v)}function E_(v){var g=ei,w=pi;jn(null),Ca(null);try{return v()}finally{jn(g),Ca(w)}}const z_=new Set,ff=new Set;function R_(v,g,w,I={}){function R(F){if(I.capture||wl.call(g,F),!F.cancelBubble)return E_(()=>w==null?void 0:w.call(this,F))}return v.startsWith("pointer")||v.startsWith("touch")||v==="wheel"?sf(()=>{g.addEventListener(v,R,I)}):g.addEventListener(v,R,I),R}function D_(v,g,w,I,R){var F={capture:I,passive:R},S=R_(v,g,w,F);(g===document.body||g===window||g===document||g instanceof HTMLMediaElement)&&Qp(()=>{g.removeEventListener(v,S,F)})}function wl(v){var Ot;var g=this,w=g.ownerDocument,I=v.type,R=((Ot=v.composedPath)==null?void 0:Ot.call(v))||[],F=R[0]||v.target,S=0,o=v.__root;if(o){var de=R.indexOf(o);if(de!==-1&&(g===document||g===window)){v.__root=g;return}var ge=R.indexOf(g);if(ge===-1)return;de<=ge&&(S=de)}if(F=R[S]||v.target,F!==g){Ug(v,"currentTarget",{configurable:!0,get(){return F||w}});var ze=ei,Be=pi;jn(null),Ca(null);try{for(var ke,le=[];F!==null;){var Oe=F.assignedSlot||F.parentNode||F.host||null;try{var zt=F["__"+I];if(zt!=null&&(!F.disabled||v.target===F))if(Ai(zt)){var[fi,...kt]=zt;fi.apply(F,[v,...kt])}else zt.call(F,v)}catch(Ti){ke?le.push(Ti):ke=Ti}if(v.cancelBubble||Oe===g||Oe===null)break;F=Oe}if(ke){for(let Ti of le)queueMicrotask(()=>{throw Ti});throw ke}}finally{v.__root=g,delete v.currentTarget,jn(ze),Ca(Be)}}}function L_(v){var g=document.createElement("template");return g.innerHTML=v.replaceAll("<!>","<!---->"),g.content}function B_(v,g){var w=pi;w.nodes_start===null&&(w.nodes_start=v,w.nodes_end=g)}function $h(v,g){var w=(g&i_)!==0,I,R=!v.startsWith("<!>");return()=>{I===void 0&&(I=L_(R?v:"<!>"+v),I=Yp(I));var F=w||Wp?document.importNode(I,!0):I.cloneNode(!0);return B_(F,F),F}}function Gh(v,g){v!==null&&v.before(g)}function qh(v,g){return F_(v,g)}const uo=new Map;function F_(v,{target:g,anchor:w,props:I={},events:R,context:F,intro:S=!0}){l_();var o=new Set,de=Be=>{for(var ke=0;ke<Be.length;ke++){var le=Be[ke];if(!o.has(le)){o.add(le);var Oe=A_(le);g.addEventListener(le,wl,{passive:Oe});var zt=uo.get(le);zt===void 0?(document.addEventListener(le,wl,{passive:Oe}),uo.set(le,1)):uo.set(le,zt+1)}}};de(Vg(z_)),ff.add(de);var ge=void 0,ze=p_(()=>{var Be=w??g.appendChild(c_());return m_(()=>{if(F){eu({});var ke=Br;ke.c=F}R&&(I.$$events=R),ge=v(Be,I)||{},F&&tu()}),()=>{var Oe;for(var ke of o){g.removeEventListener(ke,wl);var le=uo.get(ke);--le===0?(document.removeEventListener(ke,wl),uo.delete(ke)):uo.set(ke,le)}ff.delete(de),Be!==w&&((Oe=Be.parentNode)==null||Oe.removeChild(Be))}});return Hh.set(ge,ze),ge}let Hh=new WeakMap;function O_(v,g){const w=Hh.get(v);return w?(Hh.delete(v),w(g)):Promise.resolve()}const mf=[...`
2
- \r\f \v\uFEFF`];function j_(v,g,w){var I=v==null?"":""+v;if(w){for(var R in w)if(w[R])I=I?I+" "+R:R;else if(I.length)for(var F=R.length,S=0;(S=I.indexOf(R,S))>=0;){var o=S+F;(S===0||mf.includes(I[S-1]))&&(o===I.length||mf.includes(I[o]))?I=(S===0?"":I.substring(0,S))+I.substring(o+1):S=o}}return I===""?null:I}function gf(v,g=!1){var w=g?" !important;":";",I="";for(var R in v){var F=v[R];F!=null&&F!==""&&(I+=" "+R+": "+F+w)}return I}function Wh(v){return v[0]!=="-"||v[1]!=="-"?v.toLowerCase():v}function N_(v,g){if(g){var w="",I,R;if(Array.isArray(g)?(I=g[0],R=g[1]):I=g,v){v=String(v).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var F=!1,S=0,o=!1,de=[];I&&de.push(...Object.keys(I).map(Wh)),R&&de.push(...Object.keys(R).map(Wh));var ge=0,ze=-1;const zt=v.length;for(var Be=0;Be<zt;Be++){var ke=v[Be];if(o?ke==="/"&&v[Be-1]==="*"&&(o=!1):F?F===ke&&(F=!1):ke==="/"&&v[Be+1]==="*"?o=!0:ke==='"'||ke==="'"?F=ke:ke==="("?S++:ke===")"&&S--,!o&&F===!1&&S===0){if(ke===":"&&ze===-1)ze=Be;else if(ke===";"||Be===zt-1){if(ze!==-1){var le=Wh(v.substring(ge,ze).trim());if(!de.includes(le)){ke!==";"&&Be++;var Oe=v.substring(ge,Be).trim();w+=" "+Oe+";"}}ge=Be+1,ze=-1}}}}return I&&(w+=gf(I)),R&&(w+=gf(R,!0)),w=w.trim(),w===""?null:w}return v==null?null:String(v)}function _f(v,g,w,I,R,F){var S=v.__className;if(S!==w||S===void 0){var o=j_(w,I,F);o==null?v.removeAttribute("class"):v.className=o,v.__className=w}else if(F&&R!==F)for(var de in F){var ge=!!F[de];(R==null||ge!==!!R[de])&&v.classList.toggle(de,ge)}return F}function Xh(v,g={},w,I){for(var R in w){var F=w[R];g[R]!==F&&(w[R]==null?v.style.removeProperty(R):v.style.setProperty(R,F,I))}}function Kh(v,g,w,I){var R=v.__style;if(R!==g){var F=N_(g,I);F==null?v.removeAttribute("style"):v.style.cssText=F,v.__style=g}else I&&(Array.isArray(I)?(Xh(v,w==null?void 0:w[0],I[0]),Xh(v,w==null?void 0:w[1],I[1],"important")):Xh(v,w,I));return I}const Z_=()=>performance.now(),Zn={tick:v=>requestAnimationFrame(v),now:()=>Z_(),tasks:new Set};function yf(){const v=Zn.now();Zn.tasks.forEach(g=>{g.c(v)||(Zn.tasks.delete(g),g.f())}),Zn.tasks.size!==0&&Zn.tick(yf)}function V_(v){let g;return Zn.tasks.size===0&&Zn.tick(yf),{promise:new Promise(w=>{Zn.tasks.add(g={c:v,f:w})}),abort(){Zn.tasks.delete(g)}}}const wu=class wu{constructor(g){Ma(this,bu);Ma(this,La,new WeakMap);Ma(this,vo);Ma(this,Rl);Gc(this,Rl,g)}observe(g,w){var I=ki(this,La).get(g)||new Set;return I.add(w),ki(this,La).set(g,I),jg(this,bu,Ng).call(this).observe(g,ki(this,Rl)),()=>{var R=ki(this,La).get(g);R.delete(w),R.size===0&&(ki(this,La).delete(g),ki(this,vo).unobserve(g))}}};La=new WeakMap,vo=new WeakMap,Rl=new WeakMap,bu=new WeakSet,Ng=function(){return ki(this,vo)??Gc(this,vo,new ResizeObserver(g=>{for(var w of g){wu.entries.set(w.target,w);for(var I of ki(this,La).get(w.target)||[])I(w)}}))},Vt(wu,"entries",new WeakMap);let Yh=wu;var U_=new Yh({box:"border-box"});function du(v,g,w){var I=U_.observe(v,()=>w(v[g]));ru(()=>(Uh(()=>w(v[g])),I))}function xf(v,g){return v===g||(v==null?void 0:v[Jc])===g}function gs(v={},g,w,I){return ru(()=>{var R,F;return ef(()=>{R=F,F=[],Uh(()=>{v!==w(...F)&&(g(v,...F),R&&xf(w(...R),v)&&g(null,...R))})}),()=>{sf(()=>{F&&xf(w(...F),v)&&g(null,...F)})}}),v}function vf(v){Br===null&&a_(),Fn(()=>{const g=Uh(v);if(typeof g=="function")return g})}const $_="5";typeof window<"u"&&((Yf=window.__svelte??(window.__svelte={})).v??(Yf.v=new Set)).add($_);function bf(v){return Object.prototype.toString.call(v)==="[object Date]"}function G_(v){return v}function wf(v){return-.5*(Math.cos(Math.PI*v)-1)}function q_(v){const g=Math.cos(v*Math.PI*.5);return Math.abs(g)<1e-14?1:1-g}function H_(v){return Math.sin(v*Math.PI/2)}function Jh(v,g){if(v===g||v!==v)return()=>v;const w=typeof v;if(w!==typeof g||Array.isArray(v)!==Array.isArray(g))throw new Error("Cannot interpolate values of different type");if(Array.isArray(v)){const I=g.map((R,F)=>Jh(v[F],R));return R=>I.map(F=>F(R))}if(w==="object"){if(!v||!g)throw new Error("Object cannot be null");if(bf(v)&&bf(g)){const F=v.getTime(),o=g.getTime()-F;return de=>new Date(F+de*o)}const I=Object.keys(g),R={};return I.forEach(F=>{R[F]=Jh(v[F],g[F])}),F=>{const S={};return I.forEach(o=>{S[o]=R[o](F)}),S}}if(w==="number"){const I=g-v;return R=>v+R*I}return()=>g}const fd=class fd{constructor(g,w={}){Ma(this,na,Fh(void 0));Ma(this,bo,Fh(void 0));Ma(this,Dl);Ma(this,_s,null);ki(this,na).v=ki(this,bo).v=g,Gc(this,Dl,w)}static of(g,w){const I=new fd(g(),w);return ef(()=>{I.set(g())}),I}set(g,w){var Be;gi(ki(this,bo),g);let{delay:I=0,duration:R=400,easing:F=G_,interpolate:S=Jh}={...ki(this,Dl),...w};if(R===0)return(Be=ki(this,_s))==null||Be.abort(),gi(ki(this,na),g),Promise.resolve();const o=Zn.now()+I;let de,ge=!1,ze=ki(this,_s);return Gc(this,_s,V_(ke=>{if(ke<o)return!0;if(!ge){ge=!0;const Oe=ki(this,na).v;de=S(Oe,g),typeof R=="function"&&(R=R(Oe,g)),ze==null||ze.abort()}const le=ke-o;return le>R?(gi(ki(this,na),g),!1):(gi(ki(this,na),de(F(le/R))),!0)})),ki(this,_s).promise}get current(){return st(ki(this,na))}get target(){return st(ki(this,bo))}set target(g){this.set(g)}};na=new WeakMap,bo=new WeakMap,Dl=new WeakMap,_s=new WeakMap;let Tl=fd;class W_{constructor(){Vt(this,"animationsRunning",!1);Vt(this,"animationsLimit",128);Vt(this,"animations",new Map)}start(){window.requestAnimationFrame(this.tick.bind(this))}tick(){const g=Array.from(this.animations.values()).sort((w,I)=>I.priority-w.priority);for(let w=0;w<g.length;w++){const I=g[w];try{I.callback()}catch(R){console.error(R)}finally{this.animations.delete(I.id)}if(w==this.animationsLimit)break}window.requestAnimationFrame(this.tick.bind(this))}equeue(g,w,I){this.animations.set(g,{id:g,priority:w,callback:I}),this.animationsRunning==!1&&(this.animationsRunning=!0,this.start())}setLimit(g){this.animationsLimit=g}}const Tf=new W_;function Mf(v,g,w){const I=w*(Math.PI/180),R=v/2,F=g/2,S=Math.sqrt(R*R+F*F),o=Math.atan(F/R)*(180/Math.PI),de=o,ge=180-o,ze=180+o,Be=360-o;switch(!0){case(de<=w&&w<=ge):return{offsetX:S*Math.cos(I)-R,offsetY:0};case(ge<=w&&w<=ze):return{offsetX:-v,offsetY:S*Math.sin(I)-F};case(ze<=w&&w<=Be):return{offsetX:S*Math.cos(I)-R,offsetY:-g};default:return{offsetX:0,offsetY:S*Math.sin(I)-F}}}function X_(v,g,w){const I=Mf(v,g,w),R=I.offsetX,F=I.offsetY,S=g,o=v,de=Mf(S,o,w),ge=S/2+de.offsetX,ze=o/2+de.offsetY,ke=Math.atan2(ze,ge)/Math.PI*180-45,le=0,Oe=30,zt=R+v/2,fi=F+g/2,kt=Math.sqrt(zt*zt+fi*fi),Ot=Math.min(v,g)/2,Ti=Math.sqrt(v*v+g*g)/2,Wt=(kt-Ot)/(Ti-Ot),jt=le+Wt*(Oe-le);return{markerOffsetX:R,markerOffsetY:F,pinAngleDeg:ke,pinSkewDeg:jt}}const Sf=512,Qh=0,ho=18,Pf=10,K_=6,Y_=128,Cf=270,J_=8;var Q_=$h('<div><div class="pin svelte-lc2z35"></div> <div class="marker svelte-lc2z35"><div class="body svelte-lc2z35"></div></div></div>');function ey(v,g){eu(g,!0);let w,I,R,F,S=er(0),o=er(0);const de=()=>F;Fn(()=>{st(S)&&st(o)&&(R.style.width=`${Math.min(st(S),st(o))/4}px`,R.style.height=`${Math.min(st(S),st(o))/4}px`)});const ge=()=>st(S),ze=()=>st(o);let Be=er(!0);function ke(yt){gi(Be,yt,!0)}function le(){return st(Be)}let Oe=er(!0);function zt(yt){gi(Oe,yt,!0)}function fi(){return Ti.current==0}function kt(){return st(Oe)==!1}let Ot=0,Ti=new Tl(Ot);Fn(()=>{st(Be)==!1&&Ti.set(Ot,{duration:0})}),Fn(()=>{st(Oe)==!0&&Ot!=0&&(Ot=0,Ti.set(0,{duration:75,easing:q_})),st(Oe)==!1&&Ot!=1&&(Ot=1,Ti.set(1,{duration:150,easing:H_}))});let Wt=Cf,jt=!1,Rt=new Tl(Cf,{easing:wf,interpolate:xr});Fn(()=>{st(Be)==!1&&Rt.set(Wt,{duration:0})}),Fn(()=>{st(Oe)==!0&&Rt.set(Wt,{duration:75})});function xr(yt,ii){if(Math.abs(ii-yt)<180)return mt=>yt+mt*(ii-yt);{const mt=360-Math.abs(ii-yt),tr=yt<ii?-1:1;return zi=>(360+yt+zi*mt*tr)%360}}function qt(yt){if(st(Be)==!1&&(Wt=yt,bn(st(S),st(o),Ot,Wt)),yt!=Wt){let ii=Math.abs(yt-Rt.current),mt=ii<180?ii:360-ii,tr=Math.log(mt)*75;Wt=yt,Rt.set(yt,{duration:jt?tr:0})}jt=!0}Fn(()=>{bn(st(S),st(o),Ti.current,Rt.current)});function bn(yt,ii,mt,tr){if(!w||!I||!R)return;const zi=X_(yt,ii,tr);Tf.equeue(g.id,g.priority,()=>{w.style.opacity=`${mt}`;const Jr=Math.round(zi.markerOffsetX),cr=Math.round(zi.markerOffsetY);I.style.transform=`translate(${Jr}px, ${cr}px)`,I.style.scale=`${mt}`;const Un=zi.pinAngleDeg,qi=zi.pinSkewDeg;R.style.transform=`rotate(${Un}deg) skew(${qi}deg, ${qi}deg)`,R.style.scale=`${mt}`})}var Yr=Q_();let Ir;var lr=iu(Yr);gs(lr,yt=>R=yt,()=>R);var Ei=u_(lr,2);Kh(Ei,"",{},{padding:J_+"px"});var _i=iu(Ei);let un;return gs(_i,yt=>F=yt,()=>F),gs(Ei,yt=>I=yt,()=>I),gs(Yr,yt=>w=yt,()=>w),jh(yt=>{Ir=_f(Yr,1,"anchor svelte-lc2z35",null,Ir,yt),un=Kh(_i,"",un,{width:`${g.width}px`,height:`${g.height}px`})},[()=>({displayed:st(Be)})]),du(Ei,"clientWidth",yt=>gi(S,yt)),du(Ei,"clientHeight",yt=>gi(o,yt)),Gh(v,Yr),tu({getBody:de,getWidth:ge,getHeight:ze,setDisplayed:ke,getDisplayed:le,setCollapsed:zt,getCollapsed:fi,getExpanded:kt,setAngle:qt})}var ty=$h('<div><div class="body svelte-frr21"></div></div>');function iy(v,g){eu(g,!0);let w,I;function R(){return I}let F=er(!1);function S(kt){gi(F,kt,!0)}function o(){return st(F)}let de=0,ge=new Tl(0,{easing:wf});Fn(()=>{ze(ge.current)}),Fn(()=>{st(F)==!1&&(ge.set(de,{duration:0}),ze(de))});function ze(kt){w&&Tf.equeue(g.id,g.priority,()=>{w.style.scale=kt.toString(),w.style.filter=`brightness(${.3+.7*kt})`,I.style.opacity=kt.toString()})}function Be(kt){kt!=de&&(de=kt,ge.set(kt,{duration:75}))}function ke(){return ge.current==0}function le(){return de}var Oe=ty();let zt;var fi=iu(Oe);return gs(fi,kt=>I=kt,()=>I),gs(Oe,kt=>w=kt,()=>w),jh(kt=>zt=_f(Oe,1,"circle svelte-frr21",null,zt,kt),[()=>({displayed:st(F)})]),Gh(v,Oe),tu({getBody:R,setDisplayed:S,getDisplayed:o,setScale:Be,getCollapsed:ke,getScale:le})}function ry(v){return v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v}var pu={exports:{}};/**
2
+ \r\f \v\uFEFF`];function j_(v,g,w){var I=v==null?"":""+v;if(w){for(var R in w)if(w[R])I=I?I+" "+R:R;else if(I.length)for(var F=R.length,S=0;(S=I.indexOf(R,S))>=0;){var o=S+F;(S===0||mf.includes(I[S-1]))&&(o===I.length||mf.includes(I[o]))?I=(S===0?"":I.substring(0,S))+I.substring(o+1):S=o}}return I===""?null:I}function gf(v,g=!1){var w=g?" !important;":";",I="";for(var R in v){var F=v[R];F!=null&&F!==""&&(I+=" "+R+": "+F+w)}return I}function Wh(v){return v[0]!=="-"||v[1]!=="-"?v.toLowerCase():v}function N_(v,g){if(g){var w="",I,R;if(Array.isArray(g)?(I=g[0],R=g[1]):I=g,v){v=String(v).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var F=!1,S=0,o=!1,de=[];I&&de.push(...Object.keys(I).map(Wh)),R&&de.push(...Object.keys(R).map(Wh));var ge=0,ze=-1;const zt=v.length;for(var Be=0;Be<zt;Be++){var ke=v[Be];if(o?ke==="/"&&v[Be-1]==="*"&&(o=!1):F?F===ke&&(F=!1):ke==="/"&&v[Be+1]==="*"?o=!0:ke==='"'||ke==="'"?F=ke:ke==="("?S++:ke===")"&&S--,!o&&F===!1&&S===0){if(ke===":"&&ze===-1)ze=Be;else if(ke===";"||Be===zt-1){if(ze!==-1){var le=Wh(v.substring(ge,ze).trim());if(!de.includes(le)){ke!==";"&&Be++;var Oe=v.substring(ge,Be).trim();w+=" "+Oe+";"}}ge=Be+1,ze=-1}}}}return I&&(w+=gf(I)),R&&(w+=gf(R,!0)),w=w.trim(),w===""?null:w}return v==null?null:String(v)}function _f(v,g,w,I,R,F){var S=v.__className;if(S!==w||S===void 0){var o=j_(w,I,F);o==null?v.removeAttribute("class"):v.className=o,v.__className=w}else if(F&&R!==F)for(var de in F){var ge=!!F[de];(R==null||ge!==!!R[de])&&v.classList.toggle(de,ge)}return F}function Xh(v,g={},w,I){for(var R in w){var F=w[R];g[R]!==F&&(w[R]==null?v.style.removeProperty(R):v.style.setProperty(R,F,I))}}function Kh(v,g,w,I){var R=v.__style;if(R!==g){var F=N_(g,I);F==null?v.removeAttribute("style"):v.style.cssText=F,v.__style=g}else I&&(Array.isArray(I)?(Xh(v,w==null?void 0:w[0],I[0]),Xh(v,w==null?void 0:w[1],I[1],"important")):Xh(v,w,I));return I}const Z_=()=>performance.now(),Zn={tick:v=>requestAnimationFrame(v),now:()=>Z_(),tasks:new Set};function yf(){const v=Zn.now();Zn.tasks.forEach(g=>{g.c(v)||(Zn.tasks.delete(g),g.f())}),Zn.tasks.size!==0&&Zn.tick(yf)}function V_(v){let g;return Zn.tasks.size===0&&Zn.tick(yf),{promise:new Promise(w=>{Zn.tasks.add(g={c:v,f:w})}),abort(){Zn.tasks.delete(g)}}}const wu=class wu{constructor(g){Ma(this,bu);Ma(this,La,new WeakMap);Ma(this,vo);Ma(this,Rl);Gc(this,Rl,g)}observe(g,w){var I=ki(this,La).get(g)||new Set;return I.add(w),ki(this,La).set(g,I),jg(this,bu,Ng).call(this).observe(g,ki(this,Rl)),()=>{var R=ki(this,La).get(g);R.delete(w),R.size===0&&(ki(this,La).delete(g),ki(this,vo).unobserve(g))}}};La=new WeakMap,vo=new WeakMap,Rl=new WeakMap,bu=new WeakSet,Ng=function(){return ki(this,vo)??Gc(this,vo,new ResizeObserver(g=>{for(var w of g){wu.entries.set(w.target,w);for(var I of ki(this,La).get(w.target)||[])I(w)}}))},Vt(wu,"entries",new WeakMap);let Yh=wu;var U_=new Yh({box:"border-box"});function du(v,g,w){var I=U_.observe(v,()=>w(v[g]));ru(()=>(Uh(()=>w(v[g])),I))}function xf(v,g){return v===g||(v==null?void 0:v[Jc])===g}function gs(v={},g,w,I){return ru(()=>{var R,F;return ef(()=>{R=F,F=[],Uh(()=>{v!==w(...F)&&(g(v,...F),R&&xf(w(...R),v)&&g(null,...R))})}),()=>{sf(()=>{F&&xf(w(...F),v)&&g(null,...F)})}}),v}function vf(v){Br===null&&a_(),Fn(()=>{const g=Uh(v);if(typeof g=="function")return g})}const $_="5";typeof window<"u"&&((Yf=window.__svelte??(window.__svelte={})).v??(Yf.v=new Set)).add($_);function bf(v){return Object.prototype.toString.call(v)==="[object Date]"}function G_(v){return v}function wf(v){return-.5*(Math.cos(Math.PI*v)-1)}function q_(v){const g=Math.cos(v*Math.PI*.5);return Math.abs(g)<1e-14?1:1-g}function H_(v){return Math.sin(v*Math.PI/2)}function Jh(v,g){if(v===g||v!==v)return()=>v;const w=typeof v;if(w!==typeof g||Array.isArray(v)!==Array.isArray(g))throw new Error("Cannot interpolate values of different type");if(Array.isArray(v)){const I=g.map((R,F)=>Jh(v[F],R));return R=>I.map(F=>F(R))}if(w==="object"){if(!v||!g)throw new Error("Object cannot be null");if(bf(v)&&bf(g)){const F=v.getTime(),o=g.getTime()-F;return de=>new Date(F+de*o)}const I=Object.keys(g),R={};return I.forEach(F=>{R[F]=Jh(v[F],g[F])}),F=>{const S={};return I.forEach(o=>{S[o]=R[o](F)}),S}}if(w==="number"){const I=g-v;return R=>v+R*I}return()=>g}const fd=class fd{constructor(g,w={}){Ma(this,na,Fh(void 0));Ma(this,bo,Fh(void 0));Ma(this,Dl);Ma(this,_s,null);ki(this,na).v=ki(this,bo).v=g,Gc(this,Dl,w)}static of(g,w){const I=new fd(g(),w);return ef(()=>{I.set(g())}),I}set(g,w){var Be;gi(ki(this,bo),g);let{delay:I=0,duration:R=400,easing:F=G_,interpolate:S=Jh}={...ki(this,Dl),...w};if(R===0)return(Be=ki(this,_s))==null||Be.abort(),gi(ki(this,na),g),Promise.resolve();const o=Zn.now()+I;let de,ge=!1,ze=ki(this,_s);return Gc(this,_s,V_(ke=>{if(ke<o)return!0;if(!ge){ge=!0;const Oe=ki(this,na).v;de=S(Oe,g),typeof R=="function"&&(R=R(Oe,g)),ze==null||ze.abort()}const le=ke-o;return le>R?(gi(ki(this,na),g),!1):(gi(ki(this,na),de(F(le/R))),!0)})),ki(this,_s).promise}get current(){return st(ki(this,na))}get target(){return st(ki(this,bo))}set target(g){this.set(g)}};na=new WeakMap,bo=new WeakMap,Dl=new WeakMap,_s=new WeakMap;let Tl=fd;class W_{constructor(){Vt(this,"animationsRunning",!1);Vt(this,"animationsLimit",128);Vt(this,"animations",new Map)}start(){window.requestAnimationFrame(this.tick.bind(this))}tick(){const g=Array.from(this.animations.values()).sort((w,I)=>I.priority-w.priority);for(let w=0;w<g.length;w++){const I=g[w];try{I.callback()}catch(R){console.error(R)}finally{this.animations.delete(I.id)}if(w==this.animationsLimit)break}window.requestAnimationFrame(this.tick.bind(this))}equeue(g,w,I){this.animations.set(g,{id:g,priority:w,callback:I}),this.animationsRunning==!1&&(this.animationsRunning=!0,this.start())}setLimit(g){this.animationsLimit=g}}const Tf=new W_;function Mf(v,g,w){const I=w*(Math.PI/180),R=v/2,F=g/2,S=Math.sqrt(R*R+F*F),o=Math.atan(F/R)*(180/Math.PI),de=o,ge=180-o,ze=180+o,Be=360-o;switch(!0){case(de<=w&&w<=ge):return{offsetX:S*Math.cos(I)-R,offsetY:0};case(ge<=w&&w<=ze):return{offsetX:-v,offsetY:S*Math.sin(I)-F};case(ze<=w&&w<=Be):return{offsetX:S*Math.cos(I)-R,offsetY:-g};default:return{offsetX:0,offsetY:S*Math.sin(I)-F}}}function X_(v,g,w){const I=Mf(v,g,w),R=I.offsetX,F=I.offsetY,S=g,o=v,de=Mf(S,o,w),ge=S/2+de.offsetX,ze=o/2+de.offsetY,ke=Math.atan2(ze,ge)/Math.PI*180-45,le=0,Oe=30,zt=R+v/2,fi=F+g/2,kt=Math.sqrt(zt*zt+fi*fi),Ot=Math.min(v,g)/2,Ti=Math.sqrt(v*v+g*g)/2,Wt=(kt-Ot)/(Ti-Ot),jt=le+Wt*(Oe-le);return{markerOffsetX:R,markerOffsetY:F,pinAngleDeg:ke,pinSkewDeg:jt}}const Sf=512,Qh=0,ho=18,Pf=10,K_=6,Y_=128,Cf=270,J_=8;var Q_=$h('<div><div class="pin svelte-lc2z35"></div> <div class="marker svelte-lc2z35"><div class="body svelte-lc2z35"></div></div></div>');function ey(v,g){eu(g,!0);let w,I,R,F,S=er(0),o=er(0);const de=()=>F;Fn(()=>{st(S)&&st(o)&&(R.style.width=`${Math.min(st(S),st(o))/4}px`,R.style.height=`${Math.min(st(S),st(o))/4}px`)});const ge=()=>st(S),ze=()=>st(o);let Be=er(!0);function ke(yt){gi(Be,yt,!0)}function le(){return st(Be)}let Oe=er(!0);function zt(yt){gi(Oe,yt,!0)}function fi(){return Ti.current==0}function kt(){return st(Oe)==!1}let Ot=0,Ti=new Tl(Ot);Fn(()=>{st(Be)==!1&&Ti.set(Ot,{duration:0})}),Fn(()=>{st(Oe)==!0&&Ot!=0&&(Ot=0,Ti.set(0,{duration:75,easing:q_})),st(Oe)==!1&&Ot!=1&&(Ot=1,Ti.set(1,{duration:150,easing:H_}))});let Wt=Cf,jt=!1,Rt=new Tl(Cf,{easing:wf,interpolate:xr});Fn(()=>{st(Be)==!1&&Rt.set(Wt,{duration:0})}),Fn(()=>{st(Oe)==!0&&Rt.set(Wt,{duration:75})});function xr(yt,ii){if(Math.abs(ii-yt)<180)return mt=>yt+mt*(ii-yt);{const mt=360-Math.abs(ii-yt),tr=yt<ii?-1:1;return zi=>(360+yt+zi*mt*tr)%360}}function qt(yt){if(st(Be)==!1&&(Wt=yt,bn(st(S),st(o),Ot,Wt)),yt!=Wt){let ii=Math.abs(yt-Rt.current),mt=ii<180?ii:360-ii,tr=Math.log(mt)*75;Wt=yt,Rt.set(yt,{duration:jt?tr:0})}jt=!0}Fn(()=>{bn(st(S),st(o),Ti.current,Rt.current)});function bn(yt,ii,mt,tr){if(!w||!I||!R)return;const zi=X_(yt,ii,tr);Tf.equeue(g.id,g.priority,()=>{w.style.opacity=`${mt}`;const Jr=Math.round(zi.markerOffsetX),cr=Math.round(zi.markerOffsetY);I.style.transform=`translate(${Jr}px, ${cr}px)`,I.style.scale=`${mt}`;const Un=zi.pinAngleDeg,qi=zi.pinSkewDeg;R.style.transform=`rotate(${Un}deg) skew(${qi}deg, ${qi}deg)`,R.style.scale=`${mt}`})}var Yr=Q_();let Ir;var lr=iu(Yr);gs(lr,yt=>R=yt,()=>R);var Ei=u_(lr,2);Kh(Ei,"",{},{padding:J_+"px"});var _i=iu(Ei);let un;return gs(_i,yt=>F=yt,()=>F),gs(Ei,yt=>I=yt,()=>I),gs(Yr,yt=>w=yt,()=>w),jh(yt=>{Ir=_f(Yr,1,"anchor svelte-lc2z35",null,Ir,yt),un=Kh(_i,"",un,{width:`${g.width}px`,height:`${g.height}px`})},[()=>({displayed:st(Be)})]),du(Ei,"clientWidth",yt=>gi(S,yt)),du(Ei,"clientHeight",yt=>gi(o,yt)),Gh(v,Yr),tu({getBody:de,getWidth:ge,getHeight:ze,setDisplayed:ke,getDisplayed:le,setCollapsed:zt,getCollapsed:fi,getExpanded:kt,setAngle:qt})}var ty=$h('<div><div class="body svelte-frr21"></div></div>');function iy(v,g){eu(g,!0);let w,I;function R(){return I}let F=er(!1);function S(kt){gi(F,kt,!0)}function o(){return st(F)}let de=0,ge=new Tl(0,{easing:wf});Fn(()=>{ze(ge.current)}),Fn(()=>{st(F)==!1&&(ge.set(de,{duration:0}),ze(de))});function ze(kt){w&&Tf.equeue(g.id,g.priority,()=>{w.style.scale=kt.toString(),w.style.filter=`brightness(${.25+.75*kt})`,I.style.opacity=kt.toString()})}function Be(kt){kt!=de&&(de=kt,ge.set(kt,{duration:75}))}function ke(){return ge.current==0}function le(){return de}var Oe=ty();let zt;var fi=iu(Oe);return gs(fi,kt=>I=kt,()=>I),gs(Oe,kt=>w=kt,()=>w),jh(kt=>zt=_f(Oe,1,"circle svelte-frr21",null,zt,kt),[()=>({displayed:st(F)})]),Gh(v,Oe),tu({getBody:R,setDisplayed:S,getDisplayed:o,setScale:Be,getCollapsed:ke,getScale:le})}function ry(v){return v&&v.__esModule&&Object.prototype.hasOwnProperty.call(v,"default")?v.default:v}var pu={exports:{}};/**
3
3
  * MapLibre GL JS
4
4
  * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.5.0/LICENSE.txt
5
5
  */var ny=pu.exports,If;function ay(){return If||(If=1,function(v,g){(function(w,I){v.exports=I()})(ny,function(){var w={},I={};function R(S,o,de){if(I[S]=de,S==="index"){var ge="var sharedModule = {}; ("+I.shared+")(sharedModule); ("+I.worker+")(sharedModule);",ze={};return I.shared(ze),I.index(w,ze),typeof window<"u"&&w.setWorkerUrl(window.URL.createObjectURL(new Blob([ge],{type:"text/javascript"}))),w}}R("shared",["exports"],function(S){function o(n,t,r,a){return new(r||(r=Promise))(function(c,d){function p(b){try{y(a.next(b))}catch(M){d(M)}}function m(b){try{y(a.throw(b))}catch(M){d(M)}}function y(b){var M;b.done?c(b.value):(M=b.value,M instanceof r?M:new r(function(C){C(M)})).then(p,m)}y((a=a.apply(n,t||[])).next())})}function de(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var ge,ze;function Be(){if(ze)return ge;function n(t,r){this.x=t,this.y=r}return ze=1,ge=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,r){return this.clone()._rotateAround(t,r)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var r=t.x-this.x,a=t.y-this.y;return r*r+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,r){return Math.atan2(this.x*r-this.y*t,this.x*t+this.y*r)},_matMult:function(t){var r=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var r=Math.cos(t),a=Math.sin(t),c=a*this.x+r*this.y;return this.x=r*this.x-a*this.y,this.y=c,this},_rotateAround:function(t,r){var a=Math.cos(t),c=Math.sin(t),d=r.y+c*(this.x-r.x)+a*(this.y-r.y);return this.x=r.x+a*(this.x-r.x)-c*(this.y-r.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t},ge}typeof SuppressedError=="function"&&SuppressedError;var ke,le,Oe=de(Be()),zt=function(){if(le)return ke;function n(t,r,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=a,this.p2y=c}return le=1,ke=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<r)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<r));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},ke}(),fi=de(zt);let kt,Ot;function Ti(){return kt==null&&(kt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),kt}function Wt(){if(Ot==null&&(Ot=!1,Ti())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let a=0;a<5*5;a++){const c=4*a;t.fillStyle=`rgb(${c},${c+1},${c+2})`,t.fillRect(a%5,Math.floor(a/5),1,1)}const r=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&r[a]!==a){Ot=!0;break}}}return Ot||!1}var jt=1e-6,Rt=typeof Float32Array<"u"?Float32Array:Array;function xr(){var n=new Rt(9);return Rt!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function qt(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function bn(){var n=new Rt(3);return Rt!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function Yr(n){return Math.hypot(n[0],n[1],n[2])}function Ir(n,t,r){var a=new Rt(3);return a[0]=n,a[1]=t,a[2]=r,a}Math.hypot||(Math.hypot=function(){for(var n=0,t=arguments.length;t--;)n+=arguments[t]*arguments[t];return Math.sqrt(n)});var lr,Ei=Yr;function _i(n,t,r){var a=t[0],c=t[1],d=t[2],p=t[3];return n[0]=r[0]*a+r[4]*c+r[8]*d+r[12]*p,n[1]=r[1]*a+r[5]*c+r[9]*d+r[13]*p,n[2]=r[2]*a+r[6]*c+r[10]*d+r[14]*p,n[3]=r[3]*a+r[7]*c+r[11]*d+r[15]*p,n}function un(){var n=new Rt(4);return Rt!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function yt(){var n=new Rt(2);return Rt!=Float32Array&&(n[0]=0,n[1]=0),n}function ii(n,t){var r=new Rt(2);return r[0]=n,r[1]=t,r}bn(),lr=new Rt(4),Rt!=Float32Array&&(lr[0]=0,lr[1]=0,lr[2]=0,lr[3]=0),bn(),Ir(1,0,0),Ir(0,1,0),un(),un(),xr(),yt();const mt=8192;function tr(n,t,r){return t*(mt/(n.tileSize*Math.pow(2,r-n.tileID.overscaledZ)))}function zi(n,t){return(n%t+t)%t}function Jr(n,t,r){return n*(1-r)+t*r}function cr(n){if(n<=0)return 0;if(n>=1)return 1;const t=n*n,r=t*n;return 4*(n<.5?r:3*(n-t)+r-.75)}function Un(n,t,r,a){const c=new fi(n,t,r,a);return d=>c.solve(d)}const qi=Un(.25,.1,.25,1);function Mi(n,t,r){return Math.min(r,Math.max(t,n))}function yi(n,t,r){const a=r-t,c=((n-t)%a+a)%a+t;return c===t?r:c}function xi(n,...t){for(const r of t)for(const a in r)n[a]=r[a];return n}let jr=1;function hn(n,t,r){const a={};for(const c in n)a[c]=t.call(this,n[c],c,n);return a}function $n(n,t,r){const a={};for(const c in n)t.call(this,n[c],c,n)&&(a[c]=n[c]);return a}function ir(n){return Array.isArray(n)?n.map(ir):typeof n=="object"&&n?hn(n,ir):n}const ur={};function Hi(n){ur[n]||(typeof console<"u"&&console.warn(n),ur[n]=!0)}function Ut(n,t,r){return(r.y-n.y)*(t.x-n.x)>(t.y-n.y)*(r.x-n.x)}function Nr(n){return typeof WorkerGlobalScope<"u"&&n!==void 0&&n instanceof WorkerGlobalScope}let dn=null;function vr(n){return typeof ImageBitmap<"u"&&n instanceof ImageBitmap}const wn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Tn(n,t,r,a,c){return o(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(n,{timestamp:0});try{const p=d==null?void 0:d.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const m=p.startsWith("BGR"),y=new Uint8ClampedArray(a*c*4);if(yield d.copyTo(y,function(b,M,C,E,D){const L=4*Math.max(1,0),j=(Math.max(0,C)-C)*E*4+L,U=4*E,X=Math.max(0,M),ne=Math.max(0,C);return{rect:{x:X,y:ne,width:Math.min(b.width,M+E)-X,height:Math.min(b.height,C+D)-ne},layout:[{offset:j,stride:U}]}}(n,t,r,a,c)),m)for(let b=0;b<y.length;b+=4){const M=y[b];y[b]=y[b+2],y[b+2]=M}return y}finally{d.close()}})}let De,Ye;function Ze(n,t,r,a){return n.addEventListener(t,r,a),{unsubscribe:()=>{n.removeEventListener(t,r,a)}}}function lt(n){return n*Math.PI/180}function bt(n){return n/Math.PI*180}const gt={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},hr={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},Mn="AbortError";function Sn(){return new Error(Mn)}const Pn={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Gn(n){return Pn.REGISTERED_PROTOCOLS[n.substring(0,n.indexOf("://"))]}const Ba="global-dispatcher";class Zr extends Error{constructor(t,r,a,c){super(`AJAXError: ${r} (${t}): ${a}`),this.status=t,this.statusText=r,this.url=a,this.body=c}}const br=()=>Nr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,pn=function(n,t){if(/:\/\//.test(n.url)&&!/^https?:|^file:/.test(n.url)){const a=Gn(n.url);if(a)return a(n,t);if(Nr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,targetMapId:Ba},t)}if(!(/^file:/.test(r=n.url)||/^file:/.test(br())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(a,c){return o(this,void 0,void 0,function*(){const d=new Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,cache:a.cache,referrer:br(),signal:c.signal});let p,m;a.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{p=yield fetch(d)}catch(b){throw new Zr(0,b.message,a.url,new Blob)}if(!p.ok){const b=yield p.blob();throw new Zr(p.status,p.statusText,a.url,b)}m=a.type==="arrayBuffer"||a.type==="image"?p.arrayBuffer():a.type==="json"?p.json():p.text();const y=yield m;if(c.signal.aborted)throw Sn();return{data:y,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(n,t);if(Nr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,mustQueue:!0,targetMapId:Ba},t)}var r;return function(a,c){return new Promise((d,p)=>{var m;const y=new XMLHttpRequest;y.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(y.responseType="arraybuffer");for(const b in a.headers)y.setRequestHeader(b,a.headers[b]);a.type==="json"&&(y.responseType="text",!((m=a.headers)===null||m===void 0)&&m.Accept||y.setRequestHeader("Accept","application/json")),y.withCredentials=a.credentials==="include",y.onerror=()=>{p(new Error(y.statusText))},y.onload=()=>{if(!c.signal.aborted)if((y.status>=200&&y.status<300||y.status===0)&&y.response!==null){let b=y.response;if(a.type==="json")try{b=JSON.parse(y.response)}catch(M){return void p(M)}d({data:b,cacheControl:y.getResponseHeader("Cache-Control"),expires:y.getResponseHeader("Expires")})}else{const b=new Blob([y.response],{type:y.getResponseHeader("Content-Type")});p(new Zr(y.status,y.statusText,a.url,b))}},c.signal.addEventListener("abort",()=>{y.abort(),p(Sn())}),y.send(a.body)})}(n,t)};function ce(n){if(!n||n.indexOf("://")<=0||n.indexOf("data:image/")===0||n.indexOf("blob:")===0)return!0;const t=new URL(n),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function N(n,t,r){r[n]&&r[n].indexOf(t)!==-1||(r[n]=r[n]||[],r[n].push(t))}function Z(n,t,r){if(r&&r[n]){const a=r[n].indexOf(t);a!==-1&&r[n].splice(a,1)}}class G{constructor(t,r={}){xi(this,r),this.type=t}}class J extends G{constructor(t,r={}){super("error",xi({error:t},r))}}class ae{on(t,r){return this._listeners=this._listeners||{},N(t,r,this._listeners),{unsubscribe:()=>{this.off(t,r)}}}off(t,r){return Z(t,r,this._listeners),Z(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},N(t,r,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,r){typeof t=="string"&&(t=new G(t,r||{}));const a=t.type;if(this.listens(a)){t.target=this;const c=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const m of c)m.call(this,t);const d=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const m of d)Z(a,m,this._oneTimeListeners),m.call(this,t);const p=this._eventedParent;p&&(xi(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof J&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var $={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const me=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function oe(n,t){const r={};for(const a in n)a!=="ref"&&(r[a]=n[a]);return me.forEach(a=>{a in t&&(r[a]=t[a])}),r}function he(n,t){if(Array.isArray(n)){if(!Array.isArray(t)||n.length!==t.length)return!1;for(let r=0;r<n.length;r++)if(!he(n[r],t[r]))return!1;return!0}if(typeof n=="object"&&n!==null&&t!==null){if(typeof t!="object"||Object.keys(n).length!==Object.keys(t).length)return!1;for(const r in n)if(!he(n[r],t[r]))return!1;return!0}return n===t}function _e(n,t){n.push(t)}function ue(n,t,r){_e(r,{command:"addSource",args:[n,t[n]]})}function Ce(n,t,r){_e(t,{command:"removeSource",args:[n]}),r[n]=!0}function Ne(n,t,r,a){Ce(n,r,a),ue(n,t,r)}function Ue(n,t,r){let a;for(a in n[r])if(Object.prototype.hasOwnProperty.call(n[r],a)&&a!=="data"&&!he(n[r][a],t[r][a]))return!1;for(a in t[r])if(Object.prototype.hasOwnProperty.call(t[r],a)&&a!=="data"&&!he(n[r][a],t[r][a]))return!1;return!0}function Qe(n,t,r,a,c,d){n=n||{},t=t||{};for(const p in n)Object.prototype.hasOwnProperty.call(n,p)&&(he(n[p],t[p])||r.push({command:d,args:[a,p,t[p],c]}));for(const p in t)Object.prototype.hasOwnProperty.call(t,p)&&!Object.prototype.hasOwnProperty.call(n,p)&&(he(n[p],t[p])||r.push({command:d,args:[a,p,t[p],c]}))}function ct(n){return n.id}function at(n,t){return n[t.id]=t,n}class we{constructor(t,r,a,c){this.message=(t?`${t}: `:"")+a,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Ft(n,...t){for(const r of t)for(const a in r)n[a]=r[a];return n}class Tt extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class Et{constructor(t,r=[]){this.parent=t,this.bindings={};for(const[a,c]of r)this.bindings[a]=c}concat(t){return new Et(this,t)}get(t){if(this.bindings[t])return this.bindings[t];if(this.parent)return this.parent.get(t);throw new Error(`${t} not found in scope.`)}has(t){return!!this.bindings[t]||!!this.parent&&this.parent.has(t)}}const nt={kind:"null"},Pe={kind:"number"},it={kind:"string"},ut={kind:"boolean"},li={kind:"color"},ci={kind:"projectionDefinition"},wr={kind:"object"},ht={kind:"value"},Fa={kind:"collator"},ys={kind:"formatted"},aa={kind:"padding"},xs={kind:"colorArray"},Cn={kind:"numberArray"},sa={kind:"resolvedImage"},vi={kind:"variableAnchorOffsetCollection"};function kr(n,t){return{kind:"array",itemType:n,N:t}}function ti(n){if(n.kind==="array"){const t=ti(n.itemType);return typeof n.N=="number"?`array<${t}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${t}>`}return n.kind}const vs=[nt,Pe,it,ut,li,ci,ys,wr,kr(ht),aa,Cn,xs,sa,vi];function Oa(n,t){if(t.kind==="error")return null;if(n.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Oa(n.itemType,t.itemType))&&(typeof n.N!="number"||n.N===t.N))return null}else{if(n.kind===t.kind)return null;if(n.kind==="value"){for(const r of vs)if(!Oa(r,t))return null}}return`Expected ${ti(n)} but found ${ti(t)} instead.`}function Ll(n,t){return t.some(r=>r.kind===n.kind)}function oa(n,t){return t.some(r=>r==="null"?n===null:r==="array"?Array.isArray(n):r==="object"?n&&!Array.isArray(n)&&typeof n=="object":r===typeof n)}function In(n,t){return n.kind==="array"&&t.kind==="array"?n.itemType.kind===t.itemType.kind&&typeof n.N=="number":n.kind===t.kind}const Tu=.96422,Bl=.82521,Mu=4/29,ja=6/29,Su=3*ja*ja,md=ja*ja*ja,gd=Math.PI/180,_d=180/Math.PI;function Pu(n){return(n%=360)<0&&(n+=360),n}function Fl([n,t,r,a]){let c,d;const p=Ol((.2225045*(n=la(n))+.7168786*(t=la(t))+.0606169*(r=la(r)))/1);n===t&&t===r?c=d=p:(c=Ol((.4360747*n+.3850649*t+.1430804*r)/Tu),d=Ol((.0139322*n+.0971045*t+.7141733*r)/Bl));const m=116*p-16;return[m<0?0:m,500*(c-p),200*(p-d),a]}function la(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Ol(n){return n>md?Math.pow(n,1/3):n/Su+Mu}function Cu([n,t,r,a]){let c=(n+16)/116,d=isNaN(t)?c:c+t/500,p=isNaN(r)?c:c-r/200;return c=1*jl(c),d=Tu*jl(d),p=Bl*jl(p),[ca(3.1338561*d-1.6168667*c-.4906146*p),ca(-.9787684*d+1.9161415*c+.033454*p),ca(.0719453*d-.2289914*c+1.4052427*p),a]}function ca(n){return(n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055)<0?0:n>1?1:n}function jl(n){return n>ja?n*n*n:Su*(n-Mu)}const yd=Object.hasOwn||function(n,t){return Object.prototype.hasOwnProperty.call(n,t)};function bs(n,t){return yd(n,t)?n[t]:void 0}function ws(n){return parseInt(n.padEnd(2,n),16)/255}function Nl(n,t){return dr(t?n/100:n,0,1)}function dr(n,t,r){return Math.min(Math.max(t,n),r)}function It(n){return!n.some(Number.isNaN)}const Na={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function pr(n,t,r){return n+r*(t-n)}function ua(n,t,r){return n.map((a,c)=>pr(a,t[c],r))}class Mt{constructor(t,r,a,c=1,d=!0){this.r=t,this.g=r,this.b=a,this.a=c,d||(this.r*=c,this.g*=c,this.b*=c,c||this.overwriteGetter("rgb",[t,r,a,c]))}static parse(t){if(t instanceof Mt)return t;if(typeof t!="string")return;const r=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const c=bs(Na,a);if(c){const[p,m,y]=c;return[p/255,m/255,y/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){const p=a.length<6?1:2;let m=1;return[ws(a.slice(m,m+=p)),ws(a.slice(m,m+=p)),ws(a.slice(m,m+=p)),ws(a.slice(m,m+p)||"ff")]}if(a.startsWith("rgb")){const p=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[m,y,b,M,C,E,D,L,j,U,X,ne]=p,Y=[M||" ",D||" ",U].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const z=[b,E,j].join(""),V=z==="%%%"?100:z===""?255:0;if(V){const Q=[dr(+y/V,0,1),dr(+C/V,0,1),dr(+L/V,0,1),X?Nl(+X,ne):1];if(It(Q))return Q}}return}}const d=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[p,m,y,b,M,C,E,D,L]=d,j=[y||" ",M||" ",E].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const U=[+m,dr(+b,0,100),dr(+C,0,100),D?Nl(+D,L):1];if(It(U))return function([X,ne,Y,z]){function V(Q){const fe=(Q+X/30)%12,Ie=ne*Math.min(Y,1-Y);return Y-Ie*Math.max(-1,Math.min(fe-3,9-fe,1))}return X=Pu(X),ne/=100,Y/=100,[V(0),V(8),V(4),z]}(U)}}}(t);return r?new Mt(...r,!1):void 0}get rgb(){const{r:t,g:r,b:a,a:c}=this,d=c||1/0;return this.overwriteGetter("rgb",[t/d,r/d,a/d,c])}get hcl(){return this.overwriteGetter("hcl",function(t){const[r,a,c,d]=Fl(t),p=Math.sqrt(a*a+c*c);return[Math.round(1e4*p)?Pu(Math.atan2(c,a)*_d):NaN,p,r,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",Fl(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){const[t,r,a,c]=this.rgb;return`rgba(${[t,r,a].map(d=>Math.round(255*d)).join(",")},${c})`}static interpolate(t,r,a,c="rgb"){switch(c){case"rgb":{const[d,p,m,y]=ua(t.rgb,r.rgb,a);return new Mt(d,p,m,y,!1)}case"hcl":{const[d,p,m,y]=t.hcl,[b,M,C,E]=r.hcl;let D,L;if(isNaN(d)||isNaN(b))isNaN(d)?isNaN(b)?D=NaN:(D=b,m!==1&&m!==0||(L=M)):(D=d,C!==1&&C!==0||(L=p));else{let Y=b-d;b>d&&Y>180?Y-=360:b<d&&d-b>180&&(Y+=360),D=d+a*Y}const[j,U,X,ne]=function([Y,z,V,Q]){return Y=isNaN(Y)?0:Y*gd,Cu([V,Math.cos(Y)*z,Math.sin(Y)*z,Q])}([D,L??pr(p,M,a),pr(m,C,a),pr(y,E,a)]);return new Mt(j,U,X,ne,!1)}case"lab":{const[d,p,m,y]=Cu(ua(t.lab,r.lab,a));return new Mt(d,p,m,y,!1)}}}}Mt.black=new Mt(0,0,0,1),Mt.white=new Mt(1,1,1,1),Mt.transparent=new Mt(0,0,0,0),Mt.red=new Mt(1,0,0,1);class Ts{constructor(t,r,a){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Ms=["bottom","center","top"];class Za{constructor(t,r,a,c,d,p){this.text=t,this.image=r,this.scale=a,this.fontStack=c,this.textColor=d,this.verticalAlign=p}}class Tr{constructor(t){this.sections=t}static fromString(t){return new Tr([new Za(t,null,null,null,null,null)])}isEmpty(){return this.sections.length===0||!this.sections.some(t=>t.text.length!==0||t.image&&t.image.name.length!==0)}static factory(t){return t instanceof Tr?t:Tr.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class Wi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Wi)return t;if(typeof t=="number")return new Wi([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new Wi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){return new Wi(ua(t.values,r.values,a))}}class bi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof bi)return t;if(typeof t=="number")return new bi([t]);if(Array.isArray(t)){for(const r of t)if(typeof r!="number")return;return new bi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){return new bi(ua(t.values,r.values,a))}}class Xi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Xi)return t;if(typeof t=="string"){const a=Mt.parse(t);return a?new Xi([a]):void 0}if(!Array.isArray(t))return;const r=[];for(const a of t){if(typeof a!="string")return;const c=Mt.parse(a);if(!c)return;r.push(c)}return new Xi(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a,c="rgb"){const d=[];if(t.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let p=0;p<t.values.length;p++)d.push(Mt.interpolate(t.values[p],r.values[p],a,c));return new Xi(d)}}class Xt extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const Va=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class fr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof fr)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r<t.length;r+=2){const a=t[r],c=t[r+1];if(typeof a!="string"||!Va.has(a)||!Array.isArray(c)||c.length!==2||typeof c[0]!="number"||typeof c[1]!="number")return}return new fr(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){const c=t.values,d=r.values;if(c.length!==d.length)throw new Xt(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`);const p=[];for(let m=0;m<c.length;m+=2){if(c[m]!==d[m])throw new Xt(`Cannot interpolate values containing mismatched anchors. from[${m}]: ${c[m]}, to[${m}]: ${d[m]}`);p.push(c[m]);const[y,b]=c[m+1],[M,C]=d[m+1];p.push([pr(y,M,a),pr(b,C,a)])}return new fr(p)}}class Ar{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Ar({name:t,available:!1}):null}}class Mr{constructor(t,r,a){this.from=t,this.to=r,this.transition=a}static interpolate(t,r,a){return new Mr(t,r,a)}static parse(t){return t instanceof Mr?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new Mr(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new Mr(t.from,t.to,t.transition):typeof t=="string"?new Mr(t,t,1):void 0}}function Ss(n,t,r,a){return typeof n=="number"&&n>=0&&n<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[n,t,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[n,t,r,a]:[n,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function $t(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof Mr||n instanceof Mt||n instanceof Ts||n instanceof Tr||n instanceof Wi||n instanceof bi||n instanceof Xi||n instanceof fr||n instanceof Ar)return!0;if(Array.isArray(n)){for(const t of n)if(!$t(t))return!1;return!0}if(typeof n=="object"){for(const t in n)if(!$t(n[t]))return!1;return!0}return!1}function ui(n){if(n===null)return nt;if(typeof n=="string")return it;if(typeof n=="boolean")return ut;if(typeof n=="number")return Pe;if(n instanceof Mt)return li;if(n instanceof Mr)return ci;if(n instanceof Ts)return Fa;if(n instanceof Tr)return ys;if(n instanceof Wi)return aa;if(n instanceof bi)return Cn;if(n instanceof Xi)return xs;if(n instanceof fr)return vi;if(n instanceof Ar)return sa;if(Array.isArray(n)){const t=n.length;let r;for(const a of n){const c=ui(a);if(r){if(r===c)continue;r=ht;break}r=c}return kr(r||ht,t)}return wr}function St(n){const t=typeof n;return n===null?"":t==="string"||t==="number"||t==="boolean"?String(n):n instanceof Mt||n instanceof Mr||n instanceof Tr||n instanceof Wi||n instanceof bi||n instanceof Xi||n instanceof fr||n instanceof Ar?n.toString():JSON.stringify(n)}class ot{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!$t(t[1]))return r.error("invalid value");const a=t[1];let c=ui(a);const d=r.expectedType;return c.kind!=="array"||c.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(c=d),new ot(c,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Ua={string:it,number:Pe,boolean:ut,object:wr};class dt{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a,c=1;const d=t[0];if(d==="array"){let m,y;if(t.length>2){const b=t[1];if(typeof b!="string"||!(b in Ua)||b==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Ua[b],c++}else m=ht;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);y=t[2],c++}a=kr(m,y)}else{if(!Ua[d])throw new Error(`Types doesn't contain name = ${d}`);a=Ua[d]}const p=[];for(;c<t.length;c++){const m=r.parse(t[c],c,ht);if(!m)return null;p.push(m)}return new dt(a,p)}evaluate(t){for(let r=0;r<this.args.length;r++){const a=this.args[r].evaluate(t);if(!Oa(this.type,ui(a)))return a;if(r===this.args.length-1)throw new Xt(`Expected value to be of type ${ti(this.type)}, but found ${ti(ui(a))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const wo={"to-boolean":ut,"to-color":li,"to-number":Pe,"to-string":it};class rr{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const a=t[0];if(!wo[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&t.length!==2)return r.error("Expected one argument.");const c=wo[a],d=[];for(let p=1;p<t.length;p++){const m=r.parse(t[p],p,ht);if(!m)return null;d.push(m)}return new rr(c,d)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,a;for(const c of this.args){if(r=c.evaluate(t),a=null,r instanceof Mt)return r;if(typeof r=="string"){const d=t.parseColor(r);if(d)return d}else if(Array.isArray(r)&&(a=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:Ss(r[0],r[1],r[2],r[3]),!a))return new Mt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Xt(a||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const a of this.args){r=a.evaluate(t);const c=Wi.parse(r);if(c)return c}throw new Xt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"numberArray":{let r;for(const a of this.args){r=a.evaluate(t);const c=bi.parse(r);if(c)return c}throw new Xt(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"colorArray":{let r;for(const a of this.args){r=a.evaluate(t);const c=Xi.parse(r);if(c)return c}throw new Xt(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const a of this.args){r=a.evaluate(t);const c=fr.parse(r);if(c)return c}throw new Xt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const a of this.args){if(r=a.evaluate(t),r===null)return 0;const c=Number(r);if(!isNaN(c))return c}throw new Xt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Tr.fromString(St(this.args[0].evaluate(t)));case"resolvedImage":return Ar.fromString(St(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return St(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Zl=["Unknown","Point","LineString","Polygon"];class Vl{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Zl[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache.get(t);return r||(r=Mt.parse(t),this._parseColorCache.set(t,r)),r}}class Ps{constructor(t,r,a=[],c,d=new Et,p=[]){this.registry=t,this.path=a,this.key=a.map(m=>`[${m}]`).join(""),this.scope=d,this.errors=p,this.expectedType=c,this._isConstant=r}parse(t,r,a,c,d={}){return r?this.concat(r,a,c)._parse(t,d):this._parse(t,d)}_parse(t,r){function a(c,d,p){return p==="assert"?new dt(d,[c]):p==="coerce"?new rr(d,[c]):c}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const c=t[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[c];if(d){let p=d.parse(t,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,y=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||y.kind!=="value"){if(m.kind==="projectionDefinition"&&["string","array"].includes(y.kind)||["color","formatted","resolvedImage"].includes(m.kind)&&["value","string"].includes(y.kind)||["padding","numberArray"].includes(m.kind)&&["value","number","array"].includes(y.kind)||m.kind==="colorArray"&&["value","string","array"].includes(y.kind)||m.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(y.kind))p=a(p,m,r.typeAnnotation||"coerce");else if(this.checkSubtype(m,y))return null}else p=a(p,m,r.typeAnnotation||"assert")}if(!(p instanceof ot)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const m=new Vl;try{p=new ot(p.type,p.evaluate(m))}catch(y){return this.error(y.message),null}}return p}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,a){const c=typeof t=="number"?this.path.concat(t):this.path,d=a?this.scope.concat(a):this.scope;return new Ps(this.registry,this._isConstant,c,r||null,d,this.errors)}error(t,...r){const a=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Tt(a,t))}checkSubtype(t,r){const a=Oa(t,r);return a&&this.error(a),a}}class $a{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const a=[];for(let d=1;d<t.length-1;d+=2){const p=t[d];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,d);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",d);const m=r.parse(t[d+1],d+1);if(!m)return null;a.push([p,m])}const c=r.parse(t[t.length-1],t.length-1,r.expectedType,a);return c?new $a(a,c):null}outputDefined(){return this.result.outputDefined()}}class Cs{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const a=t[1];return r.scope.has(a)?new Cs(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Ul{constructor(t,r,a){this.type=t,this.index=r,this.input=a}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,Pe),c=r.parse(t[2],2,kr(r.expectedType||ht));return a&&c?new Ul(c.type.itemType,a,c):null}evaluate(t){const r=this.index.evaluate(t),a=this.input.evaluate(t);if(r<0)throw new Xt(`Array index out of bounds: ${r} < 0.`);if(r>=a.length)throw new Xt(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r!==Math.floor(r))throw new Xt(`Array index must be an integer, but found ${r} instead.`);return a[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class To{constructor(t,r){this.type=ut,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,ht),c=r.parse(t[2],2,ht);return a&&c?Ll(a.type,[ut,it,Pe,nt,ht])?new To(a,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ti(a.type)} instead`):null}evaluate(t){const r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!oa(r,["boolean","string","number","null"]))throw new Xt(`Expected first argument to be of type boolean, string, number or null, but found ${ti(ui(r))} instead.`);if(!oa(a,["string","array"]))throw new Xt(`Expected second argument to be of type array or string, but found ${ti(ui(a))} instead.`);return a.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Is{constructor(t,r,a){this.type=Pe,this.needle=t,this.haystack=r,this.fromIndex=a}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,ht),c=r.parse(t[2],2,ht);if(!a||!c)return null;if(!Ll(a.type,[ut,it,Pe,nt,ht]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${ti(a.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,Pe);return d?new Is(a,c,d):null}return new Is(a,c)}evaluate(t){const r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!oa(r,["boolean","string","number","null"]))throw new Xt(`Expected first argument to be of type boolean, string, number or null, but found ${ti(ui(r))} instead.`);let c;if(this.fromIndex&&(c=this.fromIndex.evaluate(t)),oa(a,["string"])){const d=a.indexOf(r,c);return d===-1?-1:[...a.slice(0,d)].length}if(oa(a,["array"]))return a.indexOf(r,c);throw new Xt(`Expected second argument to be of type array or string, but found ${ti(ui(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class ha{constructor(t,r,a,c,d,p){this.inputType=t,this.type=r,this.input=a,this.cases=c,this.outputs=d,this.otherwise=p}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let a,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const d={},p=[];for(let b=2;b<t.length-1;b+=2){let M=t[b];const C=t[b+1];Array.isArray(M)||(M=[M]);const E=r.concat(b);if(M.length===0)return E.error("Expected at least one branch label.");for(const L of M){if(typeof L!="number"&&typeof L!="string")return E.error("Branch labels must be numbers or strings.");if(typeof L=="number"&&Math.abs(L)>Number.MAX_SAFE_INTEGER)return E.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof L=="number"&&Math.floor(L)!==L)return E.error("Numeric branch labels must be integer values.");if(a){if(E.checkSubtype(a,ui(L)))return null}else a=ui(L);if(d[String(L)]!==void 0)return E.error("Branch labels must be unique.");d[String(L)]=p.length}const D=r.parse(C,b,c);if(!D)return null;c=c||D.type,p.push(D)}const m=r.parse(t[1],1,ht);if(!m)return null;const y=r.parse(t[t.length-1],t.length-1,c);return y?m.type.kind!=="value"&&r.concat(1).checkSubtype(a,m.type)?null:new ha(a,c,m,d,p,y):null}evaluate(t){const r=this.input.evaluate(t);return(ui(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class ji{constructor(t,r,a){this.type=t,this.branches=r,this.otherwise=a}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);const c=[];for(let p=1;p<t.length-1;p+=2){const m=r.parse(t[p],p,ut);if(!m)return null;const y=r.parse(t[p+1],p+1,a);if(!y)return null;c.push([m,y]),a=a||y.type}const d=r.parse(t[t.length-1],t.length-1,a);if(!d)return null;if(!a)throw new Error("Can't infer output type");return new ji(a,c,d)}evaluate(t){for(const[r,a]of this.branches)if(r.evaluate(t))return a.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[r,a]of this.branches)t(r),t(a);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class da{constructor(t,r,a,c){this.type=t,this.input=r,this.beginIndex=a,this.endIndex=c}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,ht),c=r.parse(t[2],2,Pe);if(!a||!c)return null;if(!Ll(a.type,[kr(ht),it,ht]))return r.error(`Expected first argument to be of type array or string, but found ${ti(a.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,Pe);return d?new da(a.type,a,c,d):null}return new da(a.type,a,c)}evaluate(t){const r=this.input.evaluate(t),a=this.beginIndex.evaluate(t);let c;if(this.endIndex&&(c=this.endIndex.evaluate(t)),oa(r,["string"]))return[...r].slice(a,c).join("");if(oa(r,["array"]))return r.slice(a,c);throw new Xt(`Expected first argument to be of type array or string, but found ${ti(ui(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function ks(n,t){const r=n.length-1;let a,c,d=0,p=r,m=0;for(;d<=p;)if(m=Math.floor((d+p)/2),a=n[m],c=n[m+1],a<=t){if(m===r||t<c)return m;d=m+1}else{if(!(a>t))throw new Xt("Input is not a number.");p=m-1}return 0}class qn{constructor(t,r,a){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(const[c,d]of a)this.labels.push(c),this.outputs.push(d)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");const a=r.parse(t[1],1,Pe);if(!a)return null;const c=[];let d=null;r.expectedType&&r.expectedType.kind!=="value"&&(d=r.expectedType);for(let p=1;p<t.length;p+=2){const m=p===1?-1/0:t[p],y=t[p+1],b=p,M=p+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',b);if(c.length&&c[c.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',b);const C=r.parse(y,M,d);if(!C)return null;d=d||C.type,c.push([m,C])}return new qn(d,a,c)}evaluate(t){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=r[0])return a[0].evaluate(t);const d=r.length;return c>=r[d-1]?a[d-1].evaluate(t):a[ks(r,c)].evaluate(t)}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Ni(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Mo,So,Iu=function(){if(So)return Mo;function n(t,r,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=a,this.p2y=c}return So=1,Mo=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<r)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<r));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Mo}(),xd=Ni(Iu);class nr{constructor(t,r,a,c,d){this.type=t,this.operator=r,this.interpolation=a,this.input=c,this.labels=[],this.outputs=[];for(const[p,m]of d)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(t,r,a,c){let d=0;if(t.name==="exponential")d=As(r,t.base,a,c);else if(t.name==="linear")d=As(r,1,a,c);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new xd(p[0],p[1],p[2],p[3]).solve(As(r,1,a,c))}return d}static parse(t,r){let[a,c,d,...p]=t;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const b=c[1];if(typeof b!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:b}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const b=c.slice(1);if(b.length!==4||b.some(M=>typeof M!="number"||M<0||M>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:b}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(d=r.parse(d,2,Pe),!d)return null;const m=[];let y=null;a!=="interpolate-hcl"&&a!=="interpolate-lab"||r.expectedType==xs?r.expectedType&&r.expectedType.kind!=="value"&&(y=r.expectedType):y=li;for(let b=0;b<p.length;b+=2){const M=p[b],C=p[b+1],E=b+3,D=b+4;if(typeof M!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',E);if(m.length&&m[m.length-1][0]>=M)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',E);const L=r.parse(C,D,y);if(!L)return null;y=y||L.type,m.push([M,L])}return In(y,Pe)||In(y,ci)||In(y,li)||In(y,aa)||In(y,Cn)||In(y,xs)||In(y,vi)||In(y,kr(Pe))?new nr(y,a,c,d,m):r.error(`Type ${ti(y)} is not interpolatable.`)}evaluate(t){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=r[0])return a[0].evaluate(t);const d=r.length;if(c>=r[d-1])return a[d-1].evaluate(t);const p=ks(r,c),m=nr.interpolationFactor(this.interpolation,c,r[p],r[p+1]),y=a[p].evaluate(t),b=a[p+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return pr(y,b,m);case"color":return Mt.interpolate(y,b,m);case"padding":return Wi.interpolate(y,b,m);case"colorArray":return Xi.interpolate(y,b,m);case"numberArray":return bi.interpolate(y,b,m);case"variableAnchorOffsetCollection":return fr.interpolate(y,b,m);case"array":return ua(y,b,m);case"projectionDefinition":return Mr.interpolate(y,b,m)}case"interpolate-hcl":switch(this.type.kind){case"color":return Mt.interpolate(y,b,m,"hcl");case"colorArray":return Xi.interpolate(y,b,m,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return Mt.interpolate(y,b,m,"lab");case"colorArray":return Xi.interpolate(y,b,m,"lab")}}}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function As(n,t,r,a){const c=a-r,d=n-r;return c===0?0:t===1?d/c:(Math.pow(t,d)-1)/(Math.pow(t,c)-1)}const fn={color:Mt.interpolate,number:pr,padding:Wi.interpolate,numberArray:bi.interpolate,colorArray:Xi.interpolate,variableAnchorOffsetCollection:fr.interpolate,array:ua};class pa{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a=null;const c=r.expectedType;c&&c.kind!=="value"&&(a=c);const d=[];for(const m of t.slice(1)){const y=r.parse(m,1+d.length,a,void 0,{typeAnnotation:"omit"});if(!y)return null;a=a||y.type,d.push(y)}if(!a)throw new Error("No output type");const p=c&&d.some(m=>Oa(c,m.type));return new pa(p?ht:a,d)}evaluate(t){let r,a=null,c=0;for(const d of this.args)if(c++,a=d.evaluate(t),a&&a instanceof Ar&&!a.available&&(r||(r=a.name),a=null,c===this.args.length&&(a=r)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Es(n,t){return n==="=="||n==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function Vr(n,t,r,a){return a.compare(t,r)===0}function fa(n,t,r){const a=n!=="=="&&n!=="!=";return class Zg{constructor(d,p,m){this.type=ut,this.lhs=d,this.rhs=p,this.collator=m,this.hasUntypedArgument=d.type.kind==="value"||p.type.kind==="value"}static parse(d,p){if(d.length!==3&&d.length!==4)return p.error("Expected two or three arguments.");const m=d[0];let y=p.parse(d[1],1,ht);if(!y)return null;if(!Es(m,y.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${ti(y.type)}'.`);let b=p.parse(d[2],2,ht);if(!b)return null;if(!Es(m,b.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${ti(b.type)}'.`);if(y.type.kind!==b.type.kind&&y.type.kind!=="value"&&b.type.kind!=="value")return p.error(`Cannot compare types '${ti(y.type)}' and '${ti(b.type)}'.`);a&&(y.type.kind==="value"&&b.type.kind!=="value"?y=new dt(b.type,[y]):y.type.kind!=="value"&&b.type.kind==="value"&&(b=new dt(y.type,[b])));let M=null;if(d.length===4){if(y.type.kind!=="string"&&b.type.kind!=="string"&&y.type.kind!=="value"&&b.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(M=p.parse(d[3],3,Fa),!M)return null}return new Zg(y,b,M)}evaluate(d){const p=this.lhs.evaluate(d),m=this.rhs.evaluate(d);if(a&&this.hasUntypedArgument){const y=ui(p),b=ui(m);if(y.kind!==b.kind||y.kind!=="string"&&y.kind!=="number")throw new Xt(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${y.kind}, ${b.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const y=ui(p),b=ui(m);if(y.kind!=="string"||b.kind!=="string")return t(d,p,m)}return this.collator?r(d,p,m,this.collator.evaluate(d)):t(d,p,m)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const Po=fa("==",function(n,t,r){return t===r},Vr),vd=fa("!=",function(n,t,r){return t!==r},function(n,t,r,a){return!Vr(0,t,r,a)}),$l=fa("<",function(n,t,r){return t<r},function(n,t,r,a){return a.compare(t,r)<0}),bd=fa(">",function(n,t,r){return t>r},function(n,t,r,a){return a.compare(t,r)>0}),wd=fa("<=",function(n,t,r){return t<=r},function(n,t,r,a){return a.compare(t,r)<=0}),Td=fa(">=",function(n,t,r){return t>=r},function(n,t,r,a){return a.compare(t,r)>=0});class Co{constructor(t,r,a){this.type=Fa,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");const a=t[1];if(typeof a!="object"||Array.isArray(a))return r.error("Collator options argument must be an object.");const c=r.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,ut);if(!c)return null;const d=r.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,ut);if(!d)return null;let p=null;return a.locale&&(p=r.parse(a.locale,1,it),!p)?null:new Co(c,d,p)}evaluate(t){return new Ts(this.caseSensitive.evaluate(t),this.diacriticSensitive.evaluate(t),this.locale?this.locale.evaluate(t):null)}eachChild(t){t(this.caseSensitive),t(this.diacriticSensitive),this.locale&&t(this.locale)}outputDefined(){return!1}}class Ga{constructor(t,r,a,c,d){this.type=it,this.number=t,this.locale=r,this.currency=a,this.minFractionDigits=c,this.maxFractionDigits=d}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");const a=r.parse(t[1],1,Pe);if(!a)return null;const c=t[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let d=null;if(c.locale&&(d=r.parse(c.locale,1,it),!d))return null;let p=null;if(c.currency&&(p=r.parse(c.currency,1,it),!p))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Pe),!m))return null;let y=null;return c["max-fraction-digits"]&&(y=r.parse(c["max-fraction-digits"],1,Pe),!y)?null:new Ga(a,d,p,m,y)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class Io{constructor(t){this.type=ys,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const a=t[1];if(!Array.isArray(a)&&typeof a=="object")return r.error("First argument must be an image or text section.");const c=[];let d=!1;for(let p=1;p<=t.length-1;++p){const m=t[p];if(d&&typeof m=="object"&&!Array.isArray(m)){d=!1;let y=null;if(m["font-scale"]&&(y=r.parse(m["font-scale"],1,Pe),!y))return null;let b=null;if(m["text-font"]&&(b=r.parse(m["text-font"],1,kr(it)),!b))return null;let M=null;if(m["text-color"]&&(M=r.parse(m["text-color"],1,li),!M))return null;let C=null;if(m["vertical-align"]){if(typeof m["vertical-align"]=="string"&&!Ms.includes(m["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${m["vertical-align"]}' instead.`);if(C=r.parse(m["vertical-align"],1,it),!C)return null}const E=c[c.length-1];E.scale=y,E.font=b,E.textColor=M,E.verticalAlign=C}else{const y=r.parse(t[p],1,ht);if(!y)return null;const b=y.type.kind;if(b!=="string"&&b!=="value"&&b!=="null"&&b!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,c.push({content:y,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Io(c)}evaluate(t){return new Tr(this.sections.map(r=>{const a=r.content.evaluate(t);return ui(a)===sa?new Za("",a,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new Za(St(a),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor),r.verticalAlign&&t(r.verticalAlign)}outputDefined(){return!1}}class ko{constructor(t){this.type=sa,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");const a=r.parse(t[1],1,it);return a?new ko(a):r.error("No image name provided.")}evaluate(t){const r=this.input.evaluate(t),a=Ar.fromString(r);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(r)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class Ao{constructor(t){this.type=Pe,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=r.parse(t[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${ti(a.type)} instead.`):new Ao(a):null}evaluate(t){const r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new Xt(`Expected value to be of type string or array, but found ${ti(ui(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const mn=8192;function ku(n,t){const r=(180+n[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n[1]*Math.PI/360)))/360,c=Math.pow(2,t.z);return[Math.round(r*c*mn),Math.round(a*c*mn)]}function Gl(n,t){const r=Math.pow(2,t.z);return[(c=(n[0]/mn+t.x)/r,360*c-180),(a=(n[1]/mn+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,c}function zs(n,t){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function Rs(n,t){return!(n[0]<=t[0]||n[2]>=t[2]||n[1]<=t[1]||n[3]>=t[3])}function Md(n,t,r){const a=n[0]-t[0],c=n[1]-t[1],d=n[0]-r[0],p=n[1]-r[1];return a*p-d*c==0&&a*d<=0&&c*p<=0}function Eo(n,t,r,a){return(c=[a[0]-r[0],a[1]-r[1]])[0]*(d=[t[0]-n[0],t[1]-n[1]])[1]-c[1]*d[0]!=0&&!(!Ru(n,t,r,a)||!Ru(r,a,n,t));var c,d}function Au(n,t,r){for(const a of r)for(let c=0;c<a.length-1;++c)if(Eo(n,t,a[c],a[c+1]))return!0;return!1}function ma(n,t,r=!1){let a=!1;for(const m of t)for(let y=0;y<m.length-1;y++){if(Md(n,m[y],m[y+1]))return r;(d=m[y])[1]>(c=n)[1]!=(p=m[y+1])[1]>c[1]&&c[0]<(p[0]-d[0])*(c[1]-d[1])/(p[1]-d[1])+d[0]&&(a=!a)}var c,d,p;return a}function Eu(n,t){for(const r of t)if(ma(n,r))return!0;return!1}function zu(n,t){for(const r of n)if(!ma(r,t))return!1;for(let r=0;r<n.length-1;++r)if(Au(n[r],n[r+1],t))return!1;return!0}function Sd(n,t){for(const r of t)if(zu(n,r))return!0;return!1}function Ru(n,t,r,a){const c=a[0]-r[0],d=a[1]-r[1],p=(n[0]-r[0])*d-c*(n[1]-r[1]),m=(t[0]-r[0])*d-c*(t[1]-r[1]);return p>0&&m<0||p<0&&m>0}function Ds(n,t,r){const a=[];for(let c=0;c<n.length;c++){const d=[];for(let p=0;p<n[c].length;p++){const m=ku(n[c][p],r);zs(t,m),d.push(m)}a.push(d)}return a}function Du(n,t,r){const a=[];for(let c=0;c<n.length;c++){const d=Ds(n[c],t,r);a.push(d)}return a}function Lu(n,t,r,a){if(n[0]<r[0]||n[0]>r[2]){const c=.5*a;let d=n[0]-r[0]>c?-a:r[0]-n[0]>c?a:0;d===0&&(d=n[0]-r[2]>c?-a:r[2]-n[0]>c?a:0),n[0]+=d}zs(t,n)}function Bu(n,t,r,a){const c=Math.pow(2,a.z)*mn,d=[a.x*mn,a.y*mn],p=[];for(const m of n)for(const y of m){const b=[y.x+d[0],y.y+d[1]];Lu(b,t,r,c),p.push(b)}return p}function ql(n,t,r,a){const c=Math.pow(2,a.z)*mn,d=[a.x*mn,a.y*mn],p=[];for(const y of n){const b=[];for(const M of y){const C=[M.x+d[0],M.y+d[1]];zs(t,C),b.push(C)}p.push(b)}if(t[2]-t[0]<=c/2){(m=t)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const y of p)for(const b of y)Lu(b,t,r,c)}var m;return p}class Hn{constructor(t,r){this.type=ut,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if($t(t[1])){const a=t[1];if(a.type==="FeatureCollection"){const c=[];for(const d of a.features){const{type:p,coordinates:m}=d.geometry;p==="Polygon"&&c.push(m),p==="MultiPolygon"&&c.push(...m)}if(c.length)return new Hn(a,{type:"MultiPolygon",coordinates:c})}else if(a.type==="Feature"){const c=a.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new Hn(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new Hn(a,a)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(a.type==="Polygon"){const m=Ds(a.coordinates,d,p),y=Bu(r.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const b of y)if(!ma(b,m))return!1}if(a.type==="MultiPolygon"){const m=Du(a.coordinates,d,p),y=Bu(r.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const b of y)if(!Eu(b,m))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(a.type==="Polygon"){const m=Ds(a.coordinates,d,p),y=ql(r.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const b of y)if(!zu(b,m))return!1}if(a.type==="MultiPolygon"){const m=Du(a.coordinates,d,p),y=ql(r.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const b of y)if(!Sd(b,m))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let Fu=class{constructor(n=[],t=(r,a)=>r<a?-1:r>a?1:0){if(this.data=n,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:t,compare:r}=this,a=t[n];for(;n>0;){const c=n-1>>1,d=t[c];if(r(a,d)>=0)break;t[n]=d,n=c}t[n]=a}_down(n){const{data:t,compare:r}=this,a=this.length>>1,c=t[n];for(;n<a;){let d=1+(n<<1);const p=d+1;if(p<this.length&&r(t[p],t[d])<0&&(d=p),r(t[d],c)>=0)break;t[n]=t[d],n=d}t[n]=c}};function Ou(n,t,r=0,a=n.length-1,c=ju){for(;a>r;){if(a-r>600){const y=a-r+1,b=t-r+1,M=Math.log(y),C=.5*Math.exp(2*M/3),E=.5*Math.sqrt(M*C*(y-C)/y)*(b-y/2<0?-1:1);Ou(n,t,Math.max(r,Math.floor(t-b*C/y+E)),Math.min(a,Math.floor(t+(y-b)*C/y+E)),c)}const d=n[t];let p=r,m=a;for(qa(n,r,t),c(n[a],d)>0&&qa(n,r,a);p<m;){for(qa(n,p,m),p++,m--;c(n[p],d)<0;)p++;for(;c(n[m],d)>0;)m--}c(n[r],d)===0?qa(n,r,m):(m++,qa(n,m,a)),m<=t&&(r=m+1),t<=m&&(a=m-1)}}function qa(n,t,r){const a=n[t];n[t]=n[r],n[r]=a}function ju(n,t){return n<t?-1:n>t?1:0}function zo(n,t){if(n.length<=1)return[n];const r=[];let a,c;for(const d of n){const p=Cd(d);p!==0&&(d.area=Math.abs(p),c===void 0&&(c=p<0),c===p<0?(a&&r.push(a),a=[d]):a.push(d))}if(a&&r.push(a),t>1)for(let d=0;d<r.length;d++)r[d].length<=t||(Ou(r[d],t,1,r[d].length-1,Pd),r[d]=r[d].slice(0,t));return r}function Pd(n,t){return t.area-n.area}function Cd(n){let t=0;for(let r,a,c=0,d=n.length,p=d-1;c<d;p=c++)r=n[c],a=n[p],t+=(a.x-r.x)*(r.y+a.y);return t}const Hl=1/298.257223563,Nu=Hl*(2-Hl),Zu=Math.PI/180;class Wl{constructor(t){const r=6378.137*Zu*1e3,a=Math.cos(t*Zu),c=1/(1-Nu*(1-a*a)),d=Math.sqrt(c);this.kx=r*d*a,this.ky=r*d*c*(1-Nu)}distance(t,r){const a=this.wrap(t[0]-r[0])*this.kx,c=(t[1]-r[1])*this.ky;return Math.sqrt(a*a+c*c)}pointOnLine(t,r){let a,c,d,p,m=1/0;for(let y=0;y<t.length-1;y++){let b=t[y][0],M=t[y][1],C=this.wrap(t[y+1][0]-b)*this.kx,E=(t[y+1][1]-M)*this.ky,D=0;C===0&&E===0||(D=(this.wrap(r[0]-b)*this.kx*C+(r[1]-M)*this.ky*E)/(C*C+E*E),D>1?(b=t[y+1][0],M=t[y+1][1]):D>0&&(b+=C/this.kx*D,M+=E/this.ky*D)),C=this.wrap(r[0]-b)*this.kx,E=(r[1]-M)*this.ky;const L=C*C+E*E;L<m&&(m=L,a=b,c=M,d=y,p=D)}return{point:[a,c],index:d,t:Math.max(0,Math.min(1,p))}}wrap(t){for(;t<-180;)t+=360;for(;t>180;)t-=360;return t}}function Vu(n,t){return t[0]-n[0]}function At(n){return n[1]-n[0]+1}function kn(n,t){return n[1]>=n[0]&&n[1]<t}function Xl(n,t){if(n[0]>n[1])return[null,null];const r=At(n);if(t){if(r===2)return[n,null];const c=Math.floor(r/2);return[[n[0],n[0]+c],[n[0]+c,n[1]]]}if(r===1)return[n,null];const a=Math.floor(r/2)-1;return[[n[0],n[0]+a],[n[0]+a+1,n[1]]]}function Kl(n,t){if(!kn(t,n.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let a=t[0];a<=t[1];++a)zs(r,n[a]);return r}function Yl(n){const t=[1/0,1/0,-1/0,-1/0];for(const r of n)for(const a of r)zs(t,a);return t}function Uu(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function Jl(n,t,r){if(!Uu(n)||!Uu(t))return NaN;let a=0,c=0;return n[2]<t[0]&&(a=t[0]-n[2]),n[0]>t[2]&&(a=n[0]-t[2]),n[1]>t[3]&&(c=n[1]-t[3]),n[3]<t[1]&&(c=t[1]-n[3]),r.distance([0,0],[a,c])}function ga(n,t,r){const a=r.pointOnLine(t,n);return r.distance(n,a.point)}function Ql(n,t,r,a,c){const d=Math.min(ga(n,[r,a],c),ga(t,[r,a],c)),p=Math.min(ga(r,[n,t],c),ga(a,[n,t],c));return Math.min(d,p)}function Id(n,t,r,a,c){if(!kn(t,n.length)||!kn(a,r.length))return 1/0;let d=1/0;for(let p=t[0];p<t[1];++p){const m=n[p],y=n[p+1];for(let b=a[0];b<a[1];++b){const M=r[b],C=r[b+1];if(Eo(m,y,M,C))return 0;d=Math.min(d,Ql(m,y,M,C,c))}}return d}function kd(n,t,r,a,c){if(!kn(t,n.length)||!kn(a,r.length))return NaN;let d=1/0;for(let p=t[0];p<=t[1];++p)for(let m=a[0];m<=a[1];++m)if(d=Math.min(d,c.distance(n[p],r[m])),d===0)return d;return d}function Ad(n,t,r){if(ma(n,t,!0))return 0;let a=1/0;for(const c of t){const d=c[0],p=c[c.length-1];if(d!==p&&(a=Math.min(a,ga(n,[p,d],r)),a===0))return a;const m=r.pointOnLine(c,n);if(a=Math.min(a,r.distance(n,m.point)),a===0)return a}return a}function Ed(n,t,r,a){if(!kn(t,n.length))return NaN;for(let d=t[0];d<=t[1];++d)if(ma(n[d],r,!0))return 0;let c=1/0;for(let d=t[0];d<t[1];++d){const p=n[d],m=n[d+1];for(const y of r)for(let b=0,M=y.length,C=M-1;b<M;C=b++){const E=y[C],D=y[b];if(Eo(p,m,E,D))return 0;c=Math.min(c,Ql(p,m,E,D,a))}}return c}function $u(n,t){for(const r of n)for(const a of r)if(ma(a,t,!0))return!0;return!1}function zd(n,t,r,a=1/0){const c=Yl(n),d=Yl(t);if(a!==1/0&&Jl(c,d,r)>=a)return a;if(Rs(c,d)){if($u(n,t))return 0}else if($u(t,n))return 0;let p=1/0;for(const m of n)for(let y=0,b=m.length,M=b-1;y<b;M=y++){const C=m[M],E=m[y];for(const D of t)for(let L=0,j=D.length,U=j-1;L<j;U=L++){const X=D[U],ne=D[L];if(Eo(C,E,X,ne))return 0;p=Math.min(p,Ql(C,E,X,ne,r))}}return p}function Gu(n,t,r,a,c,d){if(!d)return;const p=Jl(Kl(a,d),c,r);p<t&&n.push([p,d,[0,0]])}function Ro(n,t,r,a,c,d,p){if(!d||!p)return;const m=Jl(Kl(a,d),Kl(c,p),r);m<t&&n.push([m,d,p])}function Do(n,t,r,a,c=1/0){let d=Math.min(a.distance(n[0],r[0][0]),c);if(d===0)return d;const p=new Fu([[0,[0,n.length-1],[0,0]]],Vu),m=Yl(r);for(;p.length>0;){const y=p.pop();if(y[0]>=d)continue;const b=y[1],M=t?50:100;if(At(b)<=M){if(!kn(b,n.length))return NaN;if(t){const C=Ed(n,b,r,a);if(isNaN(C)||C===0)return C;d=Math.min(d,C)}else for(let C=b[0];C<=b[1];++C){const E=Ad(n[C],r,a);if(d=Math.min(d,E),d===0)return 0}}else{const C=Xl(b,t);Gu(p,d,a,n,m,C[0]),Gu(p,d,a,n,m,C[1])}}return d}function Lo(n,t,r,a,c,d=1/0){let p=Math.min(d,c.distance(n[0],r[0]));if(p===0)return p;const m=new Fu([[0,[0,n.length-1],[0,r.length-1]]],Vu);for(;m.length>0;){const y=m.pop();if(y[0]>=p)continue;const b=y[1],M=y[2],C=t?50:100,E=a?50:100;if(At(b)<=C&&At(M)<=E){if(!kn(b,n.length)&&kn(M,r.length))return NaN;let D;if(t&&a)D=Id(n,b,r,M,c),p=Math.min(p,D);else if(t&&!a){const L=n.slice(b[0],b[1]+1);for(let j=M[0];j<=M[1];++j)if(D=ga(r[j],L,c),p=Math.min(p,D),p===0)return p}else if(!t&&a){const L=r.slice(M[0],M[1]+1);for(let j=b[0];j<=b[1];++j)if(D=ga(n[j],L,c),p=Math.min(p,D),p===0)return p}else D=kd(n,b,r,M,c),p=Math.min(p,D)}else{const D=Xl(b,t),L=Xl(M,a);Ro(m,p,c,n,r,D[0],L[0]),Ro(m,p,c,n,r,D[0],L[1]),Ro(m,p,c,n,r,D[1],L[0]),Ro(m,p,c,n,r,D[1],L[1])}}return p}function ec(n){return n.type==="MultiPolygon"?n.coordinates.map(t=>({type:"Polygon",coordinates:t})):n.type==="MultiLineString"?n.coordinates.map(t=>({type:"LineString",coordinates:t})):n.type==="MultiPoint"?n.coordinates.map(t=>({type:"Point",coordinates:t})):[n]}class _a{constructor(t,r){this.type=Pe,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if($t(t[1])){const a=t[1];if(a.type==="FeatureCollection")return new _a(a,a.features.map(c=>ec(c.geometry)).flat());if(a.type==="Feature")return new _a(a,ec(a.geometry));if("type"in a&&"coordinates"in a)return new _a(a,ec(a))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){const c=r.geometry(),d=c.flat().map(y=>Gl([y.x,y.y],r.canonical));if(c.length===0)return NaN;const p=new Wl(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,Lo(d,!1,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,Lo(d,!1,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,Do(d,!1,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){const c=r.geometry(),d=c.flat().map(y=>Gl([y.x,y.y],r.canonical));if(c.length===0)return NaN;const p=new Wl(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,Lo(d,!0,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,Lo(d,!0,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,Do(d,!0,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,a){const c=r.geometry();if(c.length===0||c[0].length===0)return NaN;const d=zo(c,0).map(y=>y.map(b=>b.map(M=>Gl([M.x,M.y],r.canonical)))),p=new Wl(d[0][0][0][1]);let m=1/0;for(const y of a)for(const b of d){switch(y.type){case"Point":m=Math.min(m,Do([y.coordinates],!1,b,p,m));break;case"LineString":m=Math.min(m,Do(y.coordinates,!0,b,p,m));break;case"Polygon":m=Math.min(m,zd(b,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Bo{constructor(t){this.type=ht,this.key=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=t[1];return a==null?r.error("Global state property must be defined."):typeof a!="string"?r.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Bo(a)}evaluate(t){var r;const a=(r=t.globals)===null||r===void 0?void 0:r.globalState;return a&&Object.keys(a).length!==0?bs(a,this.key):null}eachChild(){}outputDefined(){return!1}}const Ha={"==":Po,"!=":vd,">":bd,"<":$l,">=":Td,"<=":wd,array:dt,at:Ul,boolean:dt,case:ji,coalesce:pa,collator:Co,format:Io,image:ko,in:To,"index-of":Is,interpolate:nr,"interpolate-hcl":nr,"interpolate-lab":nr,length:Ao,let:$a,literal:ot,match:ha,number:dt,"number-format":Ga,object:dt,slice:da,step:qn,string:dt,"to-boolean":rr,"to-color":rr,"to-number":rr,"to-string":rr,var:Cs,within:Hn,distance:_a,"global-state":Bo};class Ur{constructor(t,r,a,c){this.name=t,this.type=r,this._evaluate=a,this.args=c}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){const a=t[0],c=Ur.definitions[a];if(!c)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(c)?c[0]:c.type,p=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=p.filter(([b])=>!Array.isArray(b)||b.length===t.length-1);let y=null;for(const[b,M]of m){y=new Ps(r.registry,Fo,r.path,null,r.scope);const C=[];let E=!1;for(let D=1;D<t.length;D++){const L=t[D],j=Array.isArray(b)?b[D-1]:b.type,U=y.parse(L,1+C.length,j);if(!U){E=!0;break}C.push(U)}if(!E)if(Array.isArray(b)&&b.length!==C.length)y.error(`Expected ${b.length} arguments, but found ${C.length} instead.`);else{for(let D=0;D<C.length;D++){const L=Array.isArray(b)?b[D]:b.type,j=C[D];y.concat(D+1).checkSubtype(L,j.type)}if(y.errors.length===0)return new Ur(a,d,M,C)}}if(m.length===1)r.errors.push(...y.errors);else{const b=(m.length?m:p).map(([C])=>{return E=C,Array.isArray(E)?`(${E.map(ti).join(", ")})`:`(${ti(E.type)}...)`;var E}).join(" | "),M=[];for(let C=1;C<t.length;C++){const E=r.parse(t[C],1+M.length);if(!E)return null;M.push(ti(E.type))}r.error(`Expected arguments of type ${b}, but found (${M.join(", ")}) instead.`)}return null}static register(t,r){Ur.definitions=r;for(const a in r)t[a]=Ur}}function qu(n,[t,r,a,c]){t=t.evaluate(n),r=r.evaluate(n),a=a.evaluate(n);const d=c?c.evaluate(n):1,p=Ss(t,r,a,d);if(p)throw new Xt(p);return new Mt(t/255,r/255,a/255,d,!1)}function Hu(n,t){return n in t}function tc(n,t){const r=t[n];return r===void 0?null:r}function ya(n){return{type:n}}function Fo(n){if(n instanceof Cs)return Fo(n.boundExpression);if(n instanceof Ur&&n.name==="error"||n instanceof Co||n instanceof Hn||n instanceof _a||n instanceof Bo)return!1;const t=n instanceof rr||n instanceof dt;let r=!0;return n.eachChild(a=>{r=t?r&&Fo(a):r&&a instanceof ot}),!!r&&Oo(n)&&jo(n,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function Oo(n){if(n instanceof Ur&&(n.name==="get"&&n.args.length===1||n.name==="feature-state"||n.name==="has"&&n.args.length===1||n.name==="properties"||n.name==="geometry-type"||n.name==="id"||/^filter-/.test(n.name))||n instanceof Hn||n instanceof _a)return!1;let t=!0;return n.eachChild(r=>{t&&!Oo(r)&&(t=!1)}),t}function Ls(n){if(n instanceof Ur&&n.name==="feature-state")return!1;let t=!0;return n.eachChild(r=>{t&&!Ls(r)&&(t=!1)}),t}function jo(n,t){if(n instanceof Ur&&t.indexOf(n.name)>=0)return!1;let r=!0;return n.eachChild(a=>{r&&!jo(a,t)&&(r=!1)}),r}function No(n){return{result:"success",value:n}}function Wa(n){return{result:"error",value:n}}function Xa(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function Wu(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function Zo(n){return!!n.expression&&n.expression.interpolated}function xt(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":n===null?"null":typeof n}function Vo(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&ui(n)===wr}function Uo(n){return n}function ic(n,t){const r=n.stops&&typeof n.stops[0][0]=="object",a=r||!(r||n.property!==void 0),c=n.type||(Zo(t)?"exponential":"interval"),d=function(M){switch(M.type){case"color":return Mt.parse;case"padding":return Wi.parse;case"numberArray":return bi.parse;case"colorArray":return Xi.parse;default:return null}}(t);if(d&&((n=Ft({},n)).stops&&(n.stops=n.stops.map(M=>[M[0],d(M[1])])),n.default=d(n.default?n.default:t.default)),n.colorSpace&&(p=n.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${n.colorSpace}"`);var p;const m=function(M){switch(M){case"exponential":return Xu;case"interval":return Dd;case"categorical":return Rd;case"identity":return Ld;default:throw new Error(`Unknown function type "${M}"`)}}(c);let y,b;if(c==="categorical"){y=Object.create(null);for(const M of n.stops)y[M[0]]=M[1];b=typeof n.stops[0][0]}if(r){const M={},C=[];for(let L=0;L<n.stops.length;L++){const j=n.stops[L],U=j[0].zoom;M[U]===void 0&&(M[U]={zoom:U,type:n.type,property:n.property,default:n.default,stops:[]},C.push(U)),M[U].stops.push([j[0].value,j[1]])}const E=[];for(const L of C)E.push([M[L].zoom,ic(M[L],t)]);const D={name:"linear"};return{kind:"composite",interpolationType:D,interpolationFactor:nr.interpolationFactor.bind(void 0,D),zoomStops:E.map(L=>L[0]),evaluate:({zoom:L},j)=>Xu({stops:E,base:n.base},t,L).evaluate(L,j)}}if(a){const M=c==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:M,interpolationFactor:nr.interpolationFactor.bind(void 0,M),zoomStops:n.stops.map(C=>C[0]),evaluate:({zoom:C})=>m(n,t,C,y,b)}}return{kind:"source",evaluate(M,C){const E=C&&C.properties?C.properties[n.property]:void 0;return E===void 0?Bs(n.default,t.default):m(n,t,E,y,b)}}}function Bs(n,t,r){return n!==void 0?n:t!==void 0?t:r!==void 0?r:void 0}function Rd(n,t,r,a,c){return Bs(typeof r===c?a[r]:void 0,n.default,t.default)}function Dd(n,t,r){if(xt(r)!=="number")return Bs(n.default,t.default);const a=n.stops.length;if(a===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[a-1][0])return n.stops[a-1][1];const c=ks(n.stops.map(d=>d[0]),r);return n.stops[c][1]}function Xu(n,t,r){const a=n.base!==void 0?n.base:1;if(xt(r)!=="number")return Bs(n.default,t.default);const c=n.stops.length;if(c===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[c-1][0])return n.stops[c-1][1];const d=ks(n.stops.map(M=>M[0]),r),p=function(M,C,E,D){const L=D-E,j=M-E;return L===0?0:C===1?j/L:(Math.pow(C,j)-1)/(Math.pow(C,L)-1)}(r,a,n.stops[d][0],n.stops[d+1][0]),m=n.stops[d][1],y=n.stops[d+1][1],b=fn[t.type]||Uo;return typeof m.evaluate=="function"?{evaluate(...M){const C=m.evaluate.apply(void 0,M),E=y.evaluate.apply(void 0,M);if(C!==void 0&&E!==void 0)return b(C,E,p,n.colorSpace)}}:b(m,y,p,n.colorSpace)}function Ld(n,t,r){switch(t.type){case"color":r=Mt.parse(r);break;case"formatted":r=Tr.fromString(r.toString());break;case"resolvedImage":r=Ar.fromString(r.toString());break;case"padding":r=Wi.parse(r);break;case"colorArray":r=Xi.parse(r);break;case"numberArray":r=bi.parse(r);break;default:xt(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return Bs(r,n.default,t.default)}Ur.register(Ha,{error:[{kind:"error"},[it],(n,[t])=>{throw new Xt(t.evaluate(n))}],typeof:[it,[ht],(n,[t])=>ti(ui(t.evaluate(n)))],"to-rgba":[kr(Pe,4),[li],(n,[t])=>{const[r,a,c,d]=t.evaluate(n).rgb;return[255*r,255*a,255*c,d]}],rgb:[li,[Pe,Pe,Pe],qu],rgba:[li,[Pe,Pe,Pe,Pe],qu],has:{type:ut,overloads:[[[it],(n,[t])=>Hu(t.evaluate(n),n.properties())],[[it,wr],(n,[t,r])=>Hu(t.evaluate(n),r.evaluate(n))]]},get:{type:ht,overloads:[[[it],(n,[t])=>tc(t.evaluate(n),n.properties())],[[it,wr],(n,[t,r])=>tc(t.evaluate(n),r.evaluate(n))]]},"feature-state":[ht,[it],(n,[t])=>tc(t.evaluate(n),n.featureState||{})],properties:[wr,[],n=>n.properties()],"geometry-type":[it,[],n=>n.geometryType()],id:[ht,[],n=>n.id()],zoom:[Pe,[],n=>n.globals.zoom],"heatmap-density":[Pe,[],n=>n.globals.heatmapDensity||0],"line-progress":[Pe,[],n=>n.globals.lineProgress||0],accumulated:[ht,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[Pe,ya(Pe),(n,t)=>{let r=0;for(const a of t)r+=a.evaluate(n);return r}],"*":[Pe,ya(Pe),(n,t)=>{let r=1;for(const a of t)r*=a.evaluate(n);return r}],"-":{type:Pe,overloads:[[[Pe,Pe],(n,[t,r])=>t.evaluate(n)-r.evaluate(n)],[[Pe],(n,[t])=>-t.evaluate(n)]]},"/":[Pe,[Pe,Pe],(n,[t,r])=>t.evaluate(n)/r.evaluate(n)],"%":[Pe,[Pe,Pe],(n,[t,r])=>t.evaluate(n)%r.evaluate(n)],ln2:[Pe,[],()=>Math.LN2],pi:[Pe,[],()=>Math.PI],e:[Pe,[],()=>Math.E],"^":[Pe,[Pe,Pe],(n,[t,r])=>Math.pow(t.evaluate(n),r.evaluate(n))],sqrt:[Pe,[Pe],(n,[t])=>Math.sqrt(t.evaluate(n))],log10:[Pe,[Pe],(n,[t])=>Math.log(t.evaluate(n))/Math.LN10],ln:[Pe,[Pe],(n,[t])=>Math.log(t.evaluate(n))],log2:[Pe,[Pe],(n,[t])=>Math.log(t.evaluate(n))/Math.LN2],sin:[Pe,[Pe],(n,[t])=>Math.sin(t.evaluate(n))],cos:[Pe,[Pe],(n,[t])=>Math.cos(t.evaluate(n))],tan:[Pe,[Pe],(n,[t])=>Math.tan(t.evaluate(n))],asin:[Pe,[Pe],(n,[t])=>Math.asin(t.evaluate(n))],acos:[Pe,[Pe],(n,[t])=>Math.acos(t.evaluate(n))],atan:[Pe,[Pe],(n,[t])=>Math.atan(t.evaluate(n))],min:[Pe,ya(Pe),(n,t)=>Math.min(...t.map(r=>r.evaluate(n)))],max:[Pe,ya(Pe),(n,t)=>Math.max(...t.map(r=>r.evaluate(n)))],abs:[Pe,[Pe],(n,[t])=>Math.abs(t.evaluate(n))],round:[Pe,[Pe],(n,[t])=>{const r=t.evaluate(n);return r<0?-Math.round(-r):Math.round(r)}],floor:[Pe,[Pe],(n,[t])=>Math.floor(t.evaluate(n))],ceil:[Pe,[Pe],(n,[t])=>Math.ceil(t.evaluate(n))],"filter-==":[ut,[it,ht],(n,[t,r])=>n.properties()[t.value]===r.value],"filter-id-==":[ut,[ht],(n,[t])=>n.id()===t.value],"filter-type-==":[ut,[it],(n,[t])=>n.geometryType()===t.value],"filter-<":[ut,[it,ht],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a<c}],"filter-id-<":[ut,[ht],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r<a}],"filter->":[ut,[it,ht],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a>c}],"filter-id->":[ut,[ht],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r>a}],"filter-<=":[ut,[it,ht],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a<=c}],"filter-id-<=":[ut,[ht],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r<=a}],"filter->=":[ut,[it,ht],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a>=c}],"filter-id->=":[ut,[ht],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r>=a}],"filter-has":[ut,[ht],(n,[t])=>t.value in n.properties()],"filter-has-id":[ut,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[ut,[kr(it)],(n,[t])=>t.value.indexOf(n.geometryType())>=0],"filter-id-in":[ut,[kr(ht)],(n,[t])=>t.value.indexOf(n.id())>=0],"filter-in-small":[ut,[it,kr(ht)],(n,[t,r])=>r.value.indexOf(n.properties()[t.value])>=0],"filter-in-large":[ut,[it,kr(ht)],(n,[t,r])=>function(a,c,d,p){for(;d<=p;){const m=d+p>>1;if(c[m]===a)return!0;c[m]>a?p=m-1:d=m+1}return!1}(n.properties()[t.value],r.value,0,r.value.length-1)],all:{type:ut,overloads:[[[ut,ut],(n,[t,r])=>t.evaluate(n)&&r.evaluate(n)],[ya(ut),(n,t)=>{for(const r of t)if(!r.evaluate(n))return!1;return!0}]]},any:{type:ut,overloads:[[[ut,ut],(n,[t,r])=>t.evaluate(n)||r.evaluate(n)],[ya(ut),(n,t)=>{for(const r of t)if(r.evaluate(n))return!0;return!1}]]},"!":[ut,[ut],(n,[t])=>!t.evaluate(n)],"is-supported-script":[ut,[it],(n,[t])=>{const r=n.globals&&n.globals.isSupportedScript;return!r||r(t.evaluate(n))}],upcase:[it,[it],(n,[t])=>t.evaluate(n).toUpperCase()],downcase:[it,[it],(n,[t])=>t.evaluate(n).toLowerCase()],concat:[it,ya(ht),(n,t)=>t.map(r=>St(r.evaluate(n))).join("")],"resolved-locale":[it,[Fa],(n,[t])=>t.evaluate(n).resolvedLocale()]});class $o{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new Vl,this._defaultValue=r?function(a){if(a.type==="color"&&Vo(a.default))return new Mt(0,0,0,0);switch(a.type){case"color":return Mt.parse(a.default)||null;case"padding":return Wi.parse(a.default)||null;case"numberArray":return bi.parse(a.default)||null;case"colorArray":return Xi.parse(a.default)||null;case"variableAnchorOffsetCollection":return fr.parse(a.default)||null;case"projectionDefinition":return Mr.parse(a.default)||null;default:return a.default===void 0?null:a.default}}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,r,a,c,d,p){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new Xt(`Expected value to be one of ${Object.keys(this._enumValues).map(y=>JSON.stringify(y)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console<"u"&&console.warn(m.message)),this._defaultValue}}}function Fs(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in Ha}function Go(n,t){const r=new Ps(Ha,Fo,[],t?function(c){const d={color:li,string:it,number:Pe,enum:it,boolean:ut,formatted:ys,padding:aa,numberArray:Cn,colorArray:xs,projectionDefinition:ci,resolvedImage:sa,variableAnchorOffsetCollection:vi};return c.type==="array"?kr(d[c.value]||ht,c.length):d[c.type]}(t):void 0),a=r.parse(n,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?No(new $o(a,t)):Wa(r.errors)}class rc{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Ls(r.expression)}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,c,d,p)}evaluate(t,r,a,c,d,p){return this._styleExpression.evaluate(t,r,a,c,d,p)}}class qo{constructor(t,r,a,c){this.kind=t,this.zoomStops=a,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Ls(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,c,d,p)}evaluate(t,r,a,c,d,p){return this._styleExpression.evaluate(t,r,a,c,d,p)}interpolationFactor(t,r,a){return this.interpolationType?nr.interpolationFactor(this.interpolationType,t,r,a):0}}function nc(n,t){const r=Go(n,t);if(r.result==="error")return r;const a=r.value.expression,c=Oo(a);if(!c&&!Xa(t))return Wa([new Tt("","data expressions not supported")]);const d=jo(a,["zoom"]);if(!d&&!Wu(t))return Wa([new Tt("","zoom expressions not supported")]);const p=js(a);return p||d?p instanceof Tt?Wa([p]):p instanceof nr&&!Zo(t)?Wa([new Tt("",'"interpolate" expressions cannot be used with this property')]):No(p?new qo(c?"camera":"composite",r.value,p.labels,p instanceof nr?p.interpolation:void 0):new rc(c?"constant":"source",r.value)):Wa([new Tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Os{constructor(t,r){this._parameters=t,this._specification=r,Ft(this,ic(this._parameters,this._specification))}static deserialize(t){return new Os(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function js(n){let t=null;if(n instanceof $a)t=js(n.result);else if(n instanceof pa){for(const r of n.args)if(t=js(r),t)break}else(n instanceof qn||n instanceof nr)&&n.input instanceof Ur&&n.input.name==="zoom"&&(t=n);return t instanceof Tt||n.eachChild(r=>{const a=js(r);a instanceof Tt?t=a:!t&&a?t=new Tt("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new Tt("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Ns(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const t of n.slice(1))if(!Ns(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const ac={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function Zs(n){if(n==null)return{filter:()=>!0,needGeometry:!1};Ns(n)||(n=Wo(n));const t=Go(n,ac);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,a,c)=>t.value.evaluate(r,a,{},c),needGeometry:Ku(n)}}function Ho(n,t){return n<t?-1:n>t?1:0}function Ku(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let t=1;t<n.length;t++)if(Ku(n[t]))return!0;return!1}function Wo(n){if(!n)return!0;const t=n[0];return n.length<=1?t!=="any":t==="=="?sc(n[1],n[2],"=="):t==="!="?Xo(sc(n[1],n[2],"==")):t==="<"||t===">"||t==="<="||t===">="?sc(n[1],n[2],t):t==="any"?(r=n.slice(1),["any"].concat(r.map(Wo))):t==="all"?["all"].concat(n.slice(1).map(Wo)):t==="none"?["all"].concat(n.slice(1).map(Wo).map(Xo)):t==="in"?Yu(n[1],n.slice(2)):t==="!in"?Xo(Yu(n[1],n.slice(2))):t==="has"?Ju(n[1]):t!=="!has"||Xo(Ju(n[1]));var r}function sc(n,t,r){switch(n){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,n,t]}}function Yu(n,t){if(t.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",n,["literal",t.sort(Ho)]]:["filter-in-small",n,["literal",t]]}}function Ju(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function Xo(n){return["!",n]}function Ko(n){const t=typeof n;if(t==="number"||t==="boolean"||t==="string"||n==null)return JSON.stringify(n);if(Array.isArray(n)){let c="[";for(const d of n)c+=`${Ko(d)},`;return`${c}]`}const r=Object.keys(n).sort();let a="{";for(let c=0;c<r.length;c++)a+=`${JSON.stringify(r[c])}:${Ko(n[r[c]])},`;return`${a}}`}function Qu(n){let t="";for(const r of me)t+=`/${Ko(n[r])}`;return t}function Vs(n){const t=n.value;return t?[new we(n.key,t,"constants have been deprecated as of v8")]:[]}function mi(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n}function Wn(n){if(Array.isArray(n))return n.map(Wn);if(n instanceof Object&&!(n instanceof Number||n instanceof String||n instanceof Boolean)){const t={};for(const r in n)t[r]=Wn(n[r]);return t}return mi(n)}function Er(n){const t=n.key,r=n.value,a=n.valueSpec||{},c=n.objectElementValidators||{},d=n.style,p=n.styleSpec,m=n.validateSpec;let y=[];const b=xt(r);if(b!=="object")return[new we(t,r,`object expected, ${b} found`)];for(const M in r){const C=M.split(".")[0],E=bs(a,C)||a["*"];let D;if(bs(c,C))D=c[C];else if(bs(a,C))D=m;else if(c["*"])D=c["*"];else{if(!a["*"]){y.push(new we(t,r[M],`unknown property "${M}"`));continue}D=m}y=y.concat(D({key:(t&&`${t}.`)+M,value:r[M],valueSpec:E,style:d,styleSpec:p,object:r,objectKey:M,validateSpec:m},r))}for(const M in a)c[M]||a[M].required&&a[M].default===void 0&&r[M]===void 0&&y.push(new we(t,r,`missing required property "${M}"`));return y}function oc(n){const t=n.value,r=n.valueSpec,a=n.style,c=n.styleSpec,d=n.key,p=n.arrayElementValidator||n.validateSpec;if(xt(t)!=="array")return[new we(d,t,`array expected, ${xt(t)} found`)];if(r.length&&t.length!==r.length)return[new we(d,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new we(d,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let m={type:r.value,values:r.values};c.$version<7&&(m.function=r.function),xt(r.value)==="object"&&(m=r.value);let y=[];for(let b=0;b<t.length;b++)y=y.concat(p({array:t,arrayIndex:b,value:t[b],valueSpec:m,validateSpec:n.validateSpec,style:a,styleSpec:c,key:`${d}[${b}]`}));return y}function Us(n){const t=n.key,r=n.value,a=n.valueSpec;let c=xt(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new we(t,r,`number expected, ${c} found`)]:"minimum"in a&&r<a.minimum?[new we(t,r,`${r} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&r>a.maximum?[new we(t,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function lc(n){const t=n.valueSpec,r=mi(n.value.type);let a,c,d,p={};const m=r!=="categorical"&&n.value.property===void 0,y=!m,b=xt(n.value.stops)==="array"&&xt(n.value.stops[0])==="array"&&xt(n.value.stops[0][0])==="object",M=Er({key:n.key,value:n.value,valueSpec:n.styleSpec.function,validateSpec:n.validateSpec,style:n.style,styleSpec:n.styleSpec,objectElementValidators:{stops:function(D){if(r==="identity")return[new we(D.key,D.value,'identity function may not have a "stops" property')];let L=[];const j=D.value;return L=L.concat(oc({key:D.key,value:j,valueSpec:D.valueSpec,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,arrayElementValidator:C})),xt(j)==="array"&&j.length===0&&L.push(new we(D.key,j,"array must have at least one stop")),L},default:function(D){return D.validateSpec({key:D.key,value:D.value,valueSpec:t,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec})}}});return r==="identity"&&m&&M.push(new we(n.key,n.value,'missing required property "property"')),r==="identity"||n.value.stops||M.push(new we(n.key,n.value,'missing required property "stops"')),r==="exponential"&&n.valueSpec.expression&&!Zo(n.valueSpec)&&M.push(new we(n.key,n.value,"exponential functions not supported")),n.styleSpec.$version>=8&&(y&&!Xa(n.valueSpec)?M.push(new we(n.key,n.value,"property functions not supported")):m&&!Wu(n.valueSpec)&&M.push(new we(n.key,n.value,"zoom functions not supported"))),r!=="categorical"&&!b||n.value.property!==void 0||M.push(new we(n.key,n.value,'"property" property is required')),M;function C(D){let L=[];const j=D.value,U=D.key;if(xt(j)!=="array")return[new we(U,j,`array expected, ${xt(j)} found`)];if(j.length!==2)return[new we(U,j,`array length 2 expected, length ${j.length} found`)];if(b){if(xt(j[0])!=="object")return[new we(U,j,`object expected, ${xt(j[0])} found`)];if(j[0].zoom===void 0)return[new we(U,j,"object stop key must have zoom")];if(j[0].value===void 0)return[new we(U,j,"object stop key must have value")];if(d&&d>mi(j[0].zoom))return[new we(U,j[0].zoom,"stop zoom values must appear in ascending order")];mi(j[0].zoom)!==d&&(d=mi(j[0].zoom),c=void 0,p={}),L=L.concat(Er({key:`${U}[0]`,value:j[0],valueSpec:{zoom:{}},validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec,objectElementValidators:{zoom:Us,value:E}}))}else L=L.concat(E({key:`${U}[0]`,value:j[0],validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec},j));return Fs(Wn(j[1]))?L.concat([new we(`${U}[1]`,j[1],"expressions are not allowed in function stops.")]):L.concat(D.validateSpec({key:`${U}[1]`,value:j[1],valueSpec:t,validateSpec:D.validateSpec,style:D.style,styleSpec:D.styleSpec}))}function E(D,L){const j=xt(D.value),U=mi(D.value),X=D.value!==null?D.value:L;if(a){if(j!==a)return[new we(D.key,X,`${j} stop domain type must match previous stop domain type ${a}`)]}else a=j;if(j!=="number"&&j!=="string"&&j!=="boolean")return[new we(D.key,X,"stop domain value must be a number, string, or boolean")];if(j!=="number"&&r!=="categorical"){let ne=`number expected, ${j} found`;return Xa(t)&&r===void 0&&(ne+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new we(D.key,X,ne)]}return r!=="categorical"||j!=="number"||isFinite(U)&&Math.floor(U)===U?r!=="categorical"&&j==="number"&&c!==void 0&&U<c?[new we(D.key,X,"stop domain values must appear in ascending order")]:(c=U,r==="categorical"&&U in p?[new we(D.key,X,"stop domain values must be unique")]:(p[U]=!0,[])):[new we(D.key,X,`integer expected, found ${U}`)]}}function gn(n){const t=(n.expressionContext==="property"?nc:Go)(Wn(n.value),n.valueSpec);if(t.result==="error")return t.value.map(a=>new we(`${n.key}${a.key}`,n.value,a.message));const r=t.value.expression||t.value._styleExpression.expression;if(n.expressionContext==="property"&&n.propertyKey==="text-font"&&!r.outputDefined())return[new we(n.key,n.value,`Invalid data expression for "${n.propertyKey}". Output values must be contained as literals within the expression.`)];if(n.expressionContext==="property"&&n.propertyType==="layout"&&!Ls(r))return[new we(n.key,n.value,'"feature-state" data expressions are not supported with layout properties.')];if(n.expressionContext==="filter"&&!Ls(r))return[new we(n.key,n.value,'"feature-state" data expressions are not supported with filters.')];if(n.expressionContext&&n.expressionContext.indexOf("cluster")===0){if(!jo(r,["zoom","feature-state"]))return[new we(n.key,n.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(n.expressionContext==="cluster-initial"&&!Oo(r))return[new we(n.key,n.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function cc(n){const t=n.key,r=n.value,a=xt(r);return a!=="string"?[new we(t,r,`color expected, ${a} found`)]:Mt.parse(String(r))?[]:[new we(t,r,`color expected, "${r}" found`)]}function $s(n){const t=n.key,r=n.value,a=n.valueSpec,c=[];return Array.isArray(a.values)?a.values.indexOf(mi(r))===-1&&c.push(new we(t,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(a.values).indexOf(mi(r))===-1&&c.push(new we(t,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function uc(n){return Ns(Wn(n.value))?gn(Ft({},n,{expressionContext:"filter",valueSpec:{value:"boolean"}})):eh(n)}function eh(n){const t=n.value,r=n.key;if(xt(t)!=="array")return[new we(r,t,`array expected, ${xt(t)} found`)];const a=n.styleSpec;let c,d=[];if(t.length<1)return[new we(r,t,"filter array must have at least 1 element")];switch(d=d.concat($s({key:`${r}[0]`,value:t[0],valueSpec:a.filter_operator,style:n.style,styleSpec:n.styleSpec})),mi(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&mi(t[1])==="$type"&&d.push(new we(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new we(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(c=xt(t[1]),c!=="string"&&d.push(new we(`${r}[1]`,t[1],`string expected, ${c} found`)));for(let p=2;p<t.length;p++)c=xt(t[p]),mi(t[1])==="$type"?d=d.concat($s({key:`${r}[${p}]`,value:t[p],valueSpec:a.geometry_type,style:n.style,styleSpec:n.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&d.push(new we(`${r}[${p}]`,t[p],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let p=1;p<t.length;p++)d=d.concat(eh({key:`${r}[${p}]`,value:t[p],style:n.style,styleSpec:n.styleSpec}));break;case"has":case"!has":c=xt(t[1]),t.length!==2?d.push(new we(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):c!=="string"&&d.push(new we(`${r}[1]`,t[1],`string expected, ${c} found`))}return d}function th(n,t){const r=n.key,a=n.validateSpec,c=n.style,d=n.styleSpec,p=n.value,m=n.objectKey,y=d[`${t}_${n.layerType}`];if(!y)return[];const b=m.match(/^(.*)-transition$/);if(t==="paint"&&b&&y[b[1]]&&y[b[1]].transition)return a({key:r,value:p,valueSpec:d.transition,style:c,styleSpec:d});const M=n.valueSpec||y[m];if(!M)return[new we(r,p,`unknown property "${m}"`)];let C;if(xt(p)==="string"&&Xa(M)&&!M.tokens&&(C=/^{([^}]+)}$/.exec(p)))return[new we(r,p,`"${m}" does not support interpolation syntax
@@ -739,4 +739,4 @@ uniform ${P} ${A} u_${k};
739
739
  `),se=ee.concat(dr.prelude.vertexSource,_.vertexSource,i.vertexSource).join(`
740
740
  `);rr(P)||(ie=function(xe){return xe.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(ie),se=function(xe){return xe.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(se));const re=P.createShader(P.FRAGMENT_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(re,ie),P.compileShader(re),!P.getShaderParameter(re,P.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${P.getShaderInfoLog(re)}`);P.attachShader(this.program,re);const pe=P.createShader(P.VERTEX_SHADER);if(P.isContextLost())return void(this.failedToCreate=!0);if(P.shaderSource(pe,se),P.compileShader(pe),!P.getShaderParameter(pe,P.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${P.getShaderInfoLog(pe)}`);P.attachShader(this.program,pe),this.attributes={};const Me={};this.numAttributes=B.length;for(let xe=0;xe<this.numAttributes;xe++)B[xe]&&(P.bindAttribLocation(this.program,xe,B[xe]),this.attributes[B[xe]]=xe);if(P.linkProgram(this.program),!P.getProgramParameter(this.program,P.LINK_STATUS))throw new Error(`Program failed to link: ${P.getProgramInfoLog(this.program)}`);P.deleteShader(pe),P.deleteShader(re);for(let xe=0;xe<te.length;xe++){const ve=te[xe];if(ve&&!Me[ve]){const be=P.getUniformLocation(this.program,ve);be&&(Me[ve]=be)}}this.fixedUniforms=l(e,Me),this.terrainUniforms=((xe,ve)=>({u_depth:new o.bH(xe,ve.u_depth),u_terrain:new o.bH(xe,ve.u_terrain),u_terrain_dim:new o.b8(xe,ve.u_terrain_dim),u_terrain_matrix:new o.bJ(xe,ve.u_terrain_matrix),u_terrain_unpack:new o.bK(xe,ve.u_terrain_unpack),u_terrain_exaggeration:new o.b8(xe,ve.u_terrain_exaggeration)}))(e,Me),this.projectionUniforms=((xe,ve)=>({u_projection_matrix:new o.bJ(xe,ve.u_projection_matrix),u_projection_tile_mercator_coords:new o.bK(xe,ve.u_projection_tile_mercator_coords),u_projection_clipping_plane:new o.bK(xe,ve.u_projection_clipping_plane),u_projection_transition:new o.b8(xe,ve.u_projection_transition),u_projection_fallback_matrix:new o.bJ(xe,ve.u_projection_fallback_matrix)}))(e,Me),this.binderUniforms=s?s.getUniforms(e,Me):[]}draw(e,i,s,l,h,f,_,x,T,P,A,k,B,O,H,q,W,K,te){const ee=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(s),e.setStencilMode(l),e.setColorMode(h),e.setCullFace(f),x){e.activeTexture.set(ee.TEXTURE2),ee.bindTexture(ee.TEXTURE_2D,x.depthTexture),e.activeTexture.set(ee.TEXTURE3),ee.bindTexture(ee.TEXTURE_2D,x.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(x[se])}if(T)for(const se in T)this.projectionUniforms[Co[se]].set(T[se]);if(_)for(const se in this.fixedUniforms)this.fixedUniforms[se].set(_[se]);q&&q.setUniforms(e,this.binderUniforms,O,{zoom:H});let ie=0;switch(i){case ee.LINES:ie=2;break;case ee.TRIANGLES:ie=3;break;case ee.LINE_STRIP:ie=1}for(const se of B.get()){const re=se.vaos||(se.vaos={});(re[P]||(re[P]=new wd)).bind(e,this,A,q?q.getPaintVertexBuffers():[],k,se.vertexOffset,W,K,te),ee.drawElements(i,se.primitiveLength*ie,ee.UNSIGNED_SHORT,se.primitiveOffset*ie*2)}}}function ko(u,e,i){const s=1/o.az(i,1,e.transform.tileZoom),l=Math.pow(2,i.tileID.overscaledZ),h=i.tileSize*Math.pow(2,e.transform.tileZoom)/l,f=h*(i.tileID.canonical.x+i.tileID.wrap*l),_=h*i.tileID.canonical.y;return{u_image:0,u_texsize:i.imageAtlasTexture.size,u_scale:[s,u.fromScale,u.toScale],u_fade:u.t,u_pixel_coord_upper:[f>>16,_>>16],u_pixel_coord_lower:[65535&f,65535&_]}}const Ao=(u,e,i,s)=>{const l=u.style.light,h=l.properties.get("position"),f=[h.x,h.y,h.z],_=o.bN();l.properties.get("anchor")==="viewport"&&o.bO(_,u.transform.bearingInRadians),o.bP(f,f,_);const x=u.transform.transformLightDirection(f),T=l.properties.get("color");return{u_lightpos:f,u_lightpos_globe:x,u_lightintensity:l.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+e,u_opacity:i,u_fill_translate:s}},mn=(u,e,i,s,l,h,f)=>o.e(Ao(u,e,i,s),ko(h,u,f),{u_height_factor:-Math.pow(2,l.overscaledZ)/f.tileSize/8}),ku=(u,e,i,s)=>o.e(ko(e,u,i),{u_fill_translate:s}),Gl=(u,e)=>({u_world:u,u_fill_translate:e}),zs=(u,e,i,s,l)=>o.e(ku(u,e,i,l),{u_world:s}),Rs=(u,e,i,s,l)=>{const h=u.transform;let f,_,x=0;if(i.paint.get("circle-pitch-alignment")==="map"){const T=o.az(e,1,h.zoom);f=!0,_=[T,T],x=T/(o.Z*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*l}else f=!1,_=h.pixelsToGLUnits;return{u_camera_to_center_distance:h.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+f,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:x,u_translate:s}},Md=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),Eo=u=>({u_viewport_size:[u.width,u.height]}),Au=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),ma=(u,e,i,s)=>{const l=o.az(u,1,e)/(o.Z*Math.pow(2,u.tileID.overscaledZ))*2*Math.PI*s;return{u_extrude_scale:o.az(u,1,e),u_intensity:i,u_globe_extrude_scale:l}},Eu=(u,e,i,s)=>{const l=o.K();o.bQ(l,0,u.width,u.height,0,0,1);const h=u.context.gl;return{u_matrix:l,u_world:[h.drawingBufferWidth,h.drawingBufferHeight],u_image:i,u_color_ramp:s,u_opacity:e.paint.get("heatmap-opacity")}},zu=(u,e,i)=>{const s=i.paint.get("hillshade-accent-color");let l;switch(i.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}const h=i.getIlluminationProperties();for(let f=0;f<h.directionRadians.length;f++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(h.directionRadians[f]+=u.transform.bearingInRadians);return{u_image:0,u_latrange:Ru(0,e.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:h.altitudeRadians,u_azimuths:h.directionRadians,u_accent:s,u_method:l,u_highlights:h.highlightColor,u_shadows:h.shadowColor}},Sd=(u,e)=>{const i=e.stride,s=o.K();return o.bQ(s,0,o.Z,-8192,0,0,1),o.L(s,s,[0,-8192,0]),{u_matrix:s,u_image:1,u_dimension:[i,i],u_zoom:u.overscaledZ,u_unpack:e.getUnpackVector()}};function Ru(u,e){const i=Math.pow(2,e.canonical.z),s=e.canonical.y;return[new o.$(0,s/i).toLngLat().lat,new o.$(0,(s+1)/i).toLngLat().lat]}const Ds=(u,e,i,s)=>{const l=u.transform;return{u_translation:Hn(u,e,i),u_ratio:s/o.az(e,1,l.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},Du=(u,e,i,s,l)=>o.e(Ds(u,e,i,s),{u_image:0,u_image_height:l}),Lu=(u,e,i,s,l)=>{const h=u.transform,f=ql(e,h);return{u_translation:Hn(u,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:s/o.az(e,1,h.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[f,l.fromScale,l.toScale],u_fade:l.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Bu=(u,e,i,s,l,h)=>{const f=u.lineAtlas,_=ql(e,u.transform),x=i.layout.get("line-cap")==="round",T=f.getDash(l.from,x),P=f.getDash(l.to,x),A=T.width*h.fromScale,k=P.width*h.toScale;return o.e(Ds(u,e,i,s),{u_patternscale_a:[_/A,-T.height/2],u_patternscale_b:[_/k,-P.height/2],u_sdfgamma:f.width/(256*Math.min(A,k)*u.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:P.y,u_mix:h.t})};function ql(u,e){return 1/o.az(u,1,e.tileZoom)}function Hn(u,e,i){return o.aA(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const Fu=(u,e,i,s,l)=>{return{u_tl_parent:u,u_scale_parent:e,u_buffer_scale:1,u_fade_t:i.mix,u_opacity:i.opacity*s.paint.get("raster-opacity"),u_image0:0,u_image1:1,u_brightness_low:s.paint.get("raster-brightness-min"),u_brightness_high:s.paint.get("raster-brightness-max"),u_saturation_factor:(f=s.paint.get("raster-saturation"),f>0?1-1/(1.001-f):-f),u_contrast_factor:(h=s.paint.get("raster-contrast"),h>0?1/(1-h):1+h),u_spin_weights:Ou(s.paint.get("raster-hue-rotate")),u_coords_top:[l[0].x,l[0].y,l[1].x,l[1].y],u_coords_bottom:[l[3].x,l[3].y,l[2].x,l[2].y]};var h,f};function Ou(u){u*=Math.PI/180;const e=Math.sin(u),i=Math.cos(u);return[(2*i+1)/3,(-Math.sqrt(3)*e-i+1)/3,(Math.sqrt(3)*e-i+1)/3]}const qa=(u,e,i,s,l,h,f,_,x,T,P,A,k)=>{const B=f.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:B.cameraToCenterDistance,u_pitch:B.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:B.width/B.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:x,u_is_text:+P,u_pitch_with_map:+s,u_is_along_line:l,u_is_variable_anchor:h,u_texsize:A,u_texture:0,u_translation:T,u_pitched_scale:k}},ju=(u,e,i,s,l,h,f,_,x,T,P,A,k,B)=>{const O=f.transform;return o.e(qa(u,e,i,s,l,h,f,_,x,T,P,A,B),{u_gamma_scale:s?Math.cos(O.pitch*Math.PI/180)*O.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},zo=(u,e,i,s,l,h,f,_,x,T,P,A,k)=>o.e(ju(u,e,i,s,l,h,f,_,x,T,!0,P,0,k),{u_texsize_icon:A,u_texture_icon:1}),Pd=(u,e)=>({u_opacity:u,u_color:e}),Cd=(u,e,i,s,l)=>o.e(function(h,f,_,x){const T=_.imageManager.getPattern(h.from.toString()),P=_.imageManager.getPattern(h.to.toString()),{width:A,height:k}=_.imageManager.getPixelSize(),B=Math.pow(2,x.tileID.overscaledZ),O=x.tileSize*Math.pow(2,_.transform.tileZoom)/B,H=O*(x.tileID.canonical.x+x.tileID.wrap*B),q=O*x.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:P.tl,u_pattern_br_b:P.br,u_texsize:[A,k],u_mix:f.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:P.displaySize,u_scale_a:f.fromScale,u_scale_b:f.toScale,u_tile_units_to_pixels:1/o.az(x,1,_.transform.tileZoom),u_pixel_coord_upper:[H>>16,q>>16],u_pixel_coord_lower:[65535&H,65535&q]}}(i,l,e,s),{u_opacity:u}),Hl=(u,e)=>{},Nu={fillExtrusion:(u,e)=>({u_lightpos:new o.bL(u,e.u_lightpos),u_lightpos_globe:new o.bL(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bL(u,e.u_lightcolor),u_vertical_gradient:new o.b8(u,e.u_vertical_gradient),u_opacity:new o.b8(u,e.u_opacity),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillExtrusionPattern:(u,e)=>({u_lightpos:new o.bL(u,e.u_lightpos),u_lightpos_globe:new o.bL(u,e.u_lightpos_globe),u_lightintensity:new o.b8(u,e.u_lightintensity),u_lightcolor:new o.bL(u,e.u_lightcolor),u_vertical_gradient:new o.b8(u,e.u_vertical_gradient),u_height_factor:new o.b8(u,e.u_height_factor),u_opacity:new o.b8(u,e.u_opacity),u_fill_translate:new o.bM(u,e.u_fill_translate),u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),fill:(u,e)=>({u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillPattern:(u,e)=>({u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillOutline:(u,e)=>({u_world:new o.bM(u,e.u_world),u_fill_translate:new o.bM(u,e.u_fill_translate)}),fillOutlinePattern:(u,e)=>({u_world:new o.bM(u,e.u_world),u_image:new o.bH(u,e.u_image),u_texsize:new o.bM(u,e.u_texsize),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade),u_fill_translate:new o.bM(u,e.u_fill_translate)}),circle:(u,e)=>({u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_scale_with_map:new o.bH(u,e.u_scale_with_map),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_extrude_scale:new o.bM(u,e.u_extrude_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_globe_extrude_scale:new o.b8(u,e.u_globe_extrude_scale),u_translate:new o.bM(u,e.u_translate)}),collisionBox:(u,e)=>({u_pixel_extrude_scale:new o.bM(u,e.u_pixel_extrude_scale)}),collisionCircle:(u,e)=>({u_viewport_size:new o.bM(u,e.u_viewport_size)}),debug:(u,e)=>({u_color:new o.bI(u,e.u_color),u_overlay:new o.bH(u,e.u_overlay),u_overlay_scale:new o.b8(u,e.u_overlay_scale)}),depth:Hl,clippingMask:Hl,heatmap:(u,e)=>({u_extrude_scale:new o.b8(u,e.u_extrude_scale),u_intensity:new o.b8(u,e.u_intensity),u_globe_extrude_scale:new o.b8(u,e.u_globe_extrude_scale)}),heatmapTexture:(u,e)=>({u_matrix:new o.bJ(u,e.u_matrix),u_world:new o.bM(u,e.u_world),u_image:new o.bH(u,e.u_image),u_color_ramp:new o.bH(u,e.u_color_ramp),u_opacity:new o.b8(u,e.u_opacity)}),hillshade:(u,e)=>({u_image:new o.bH(u,e.u_image),u_latrange:new o.bM(u,e.u_latrange),u_exaggeration:new o.b8(u,e.u_exaggeration),u_altitudes:new o.bS(u,e.u_altitudes),u_azimuths:new o.bS(u,e.u_azimuths),u_accent:new o.bI(u,e.u_accent),u_method:new o.bH(u,e.u_method),u_shadows:new o.bR(u,e.u_shadows),u_highlights:new o.bR(u,e.u_highlights)}),hillshadePrepare:(u,e)=>({u_matrix:new o.bJ(u,e.u_matrix),u_image:new o.bH(u,e.u_image),u_dimension:new o.bM(u,e.u_dimension),u_zoom:new o.b8(u,e.u_zoom),u_unpack:new o.bK(u,e.u_unpack)}),line:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels)}),lineGradient:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_image:new o.bH(u,e.u_image),u_image_height:new o.b8(u,e.u_image_height)}),linePattern:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_texsize:new o.bM(u,e.u_texsize),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_image:new o.bH(u,e.u_image),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_scale:new o.bL(u,e.u_scale),u_fade:new o.b8(u,e.u_fade)}),lineSDF:(u,e)=>({u_translation:new o.bM(u,e.u_translation),u_ratio:new o.b8(u,e.u_ratio),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bM(u,e.u_units_to_pixels),u_patternscale_a:new o.bM(u,e.u_patternscale_a),u_patternscale_b:new o.bM(u,e.u_patternscale_b),u_sdfgamma:new o.b8(u,e.u_sdfgamma),u_image:new o.bH(u,e.u_image),u_tex_y_a:new o.b8(u,e.u_tex_y_a),u_tex_y_b:new o.b8(u,e.u_tex_y_b),u_mix:new o.b8(u,e.u_mix)}),raster:(u,e)=>({u_tl_parent:new o.bM(u,e.u_tl_parent),u_scale_parent:new o.b8(u,e.u_scale_parent),u_buffer_scale:new o.b8(u,e.u_buffer_scale),u_fade_t:new o.b8(u,e.u_fade_t),u_opacity:new o.b8(u,e.u_opacity),u_image0:new o.bH(u,e.u_image0),u_image1:new o.bH(u,e.u_image1),u_brightness_low:new o.b8(u,e.u_brightness_low),u_brightness_high:new o.b8(u,e.u_brightness_high),u_saturation_factor:new o.b8(u,e.u_saturation_factor),u_contrast_factor:new o.b8(u,e.u_contrast_factor),u_spin_weights:new o.bL(u,e.u_spin_weights),u_coords_top:new o.bK(u,e.u_coords_top),u_coords_bottom:new o.bK(u,e.u_coords_bottom)}),symbolIcon:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texture:new o.bH(u,e.u_texture),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),symbolSDF:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texture:new o.bH(u,e.u_texture),u_gamma_scale:new o.b8(u,e.u_gamma_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_is_halo:new o.bH(u,e.u_is_halo),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),symbolTextAndIcon:(u,e)=>({u_is_size_zoom_constant:new o.bH(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bH(u,e.u_is_size_feature_constant),u_size_t:new o.b8(u,e.u_size_t),u_size:new o.b8(u,e.u_size),u_camera_to_center_distance:new o.b8(u,e.u_camera_to_center_distance),u_pitch:new o.b8(u,e.u_pitch),u_rotate_symbol:new o.bH(u,e.u_rotate_symbol),u_aspect_ratio:new o.b8(u,e.u_aspect_ratio),u_fade_change:new o.b8(u,e.u_fade_change),u_label_plane_matrix:new o.bJ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bJ(u,e.u_coord_matrix),u_is_text:new o.bH(u,e.u_is_text),u_pitch_with_map:new o.bH(u,e.u_pitch_with_map),u_is_along_line:new o.bH(u,e.u_is_along_line),u_is_variable_anchor:new o.bH(u,e.u_is_variable_anchor),u_texsize:new o.bM(u,e.u_texsize),u_texsize_icon:new o.bM(u,e.u_texsize_icon),u_texture:new o.bH(u,e.u_texture),u_texture_icon:new o.bH(u,e.u_texture_icon),u_gamma_scale:new o.b8(u,e.u_gamma_scale),u_device_pixel_ratio:new o.b8(u,e.u_device_pixel_ratio),u_is_halo:new o.bH(u,e.u_is_halo),u_translation:new o.bM(u,e.u_translation),u_pitched_scale:new o.b8(u,e.u_pitched_scale)}),background:(u,e)=>({u_opacity:new o.b8(u,e.u_opacity),u_color:new o.bI(u,e.u_color)}),backgroundPattern:(u,e)=>({u_opacity:new o.b8(u,e.u_opacity),u_image:new o.bH(u,e.u_image),u_pattern_tl_a:new o.bM(u,e.u_pattern_tl_a),u_pattern_br_a:new o.bM(u,e.u_pattern_br_a),u_pattern_tl_b:new o.bM(u,e.u_pattern_tl_b),u_pattern_br_b:new o.bM(u,e.u_pattern_br_b),u_texsize:new o.bM(u,e.u_texsize),u_mix:new o.b8(u,e.u_mix),u_pattern_size_a:new o.bM(u,e.u_pattern_size_a),u_pattern_size_b:new o.bM(u,e.u_pattern_size_b),u_scale_a:new o.b8(u,e.u_scale_a),u_scale_b:new o.b8(u,e.u_scale_b),u_pixel_coord_upper:new o.bM(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bM(u,e.u_pixel_coord_lower),u_tile_units_to_pixels:new o.b8(u,e.u_tile_units_to_pixels)}),terrain:(u,e)=>({u_texture:new o.bH(u,e.u_texture),u_ele_delta:new o.b8(u,e.u_ele_delta),u_fog_matrix:new o.bJ(u,e.u_fog_matrix),u_fog_color:new o.bI(u,e.u_fog_color),u_fog_ground_blend:new o.b8(u,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new o.b8(u,e.u_fog_ground_blend_opacity),u_horizon_color:new o.bI(u,e.u_horizon_color),u_horizon_fog_blend:new o.b8(u,e.u_horizon_fog_blend),u_is_globe_mode:new o.b8(u,e.u_is_globe_mode)}),terrainDepth:(u,e)=>({u_ele_delta:new o.b8(u,e.u_ele_delta)}),terrainCoords:(u,e)=>({u_texture:new o.bH(u,e.u_texture),u_terrain_coords_id:new o.b8(u,e.u_terrain_coords_id),u_ele_delta:new o.b8(u,e.u_ele_delta)}),projectionErrorMeasurement:(u,e)=>({u_input:new o.b8(u,e.u_input),u_output_expected:new o.b8(u,e.u_output_expected)}),atmosphere:(u,e)=>({u_sun_pos:new o.bL(u,e.u_sun_pos),u_atmosphere_blend:new o.b8(u,e.u_atmosphere_blend),u_globe_position:new o.bL(u,e.u_globe_position),u_globe_radius:new o.b8(u,e.u_globe_radius),u_inv_proj_matrix:new o.bJ(u,e.u_inv_proj_matrix)}),sky:(u,e)=>({u_sky_color:new o.bI(u,e.u_sky_color),u_horizon_color:new o.bI(u,e.u_horizon_color),u_horizon:new o.bM(u,e.u_horizon),u_horizon_normal:new o.bM(u,e.u_horizon_normal),u_sky_horizon_blend:new o.b8(u,e.u_sky_horizon_blend),u_sky_blend:new o.b8(u,e.u_sky_blend)})};class Zu{constructor(e,i,s){this.context=e;const l=e.gl;this.buffer=l.createBuffer(),this.dynamicDraw=!!s,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),l.bufferData(l.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?l.DYNAMIC_DRAW:l.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindElementBuffer.set(this.buffer)}updateData(e){const i=this.context.gl;if(!this.dynamicDraw)throw new Error("Attempted to update data while not in dynamic mode.");this.context.unbindVAO(),this.bind(),i.bufferSubData(i.ELEMENT_ARRAY_BUFFER,0,e.arrayBuffer)}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}const Wl={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Vu{constructor(e,i,s,l){this.length=i.length,this.attributes=s,this.itemSize=i.bytesPerElement,this.dynamicDraw=l,this.context=e;const h=e.gl;this.buffer=h.createBuffer(),e.bindVertexBuffer.set(this.buffer),h.bufferData(h.ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?h.DYNAMIC_DRAW:h.STATIC_DRAW),this.dynamicDraw||delete i.arrayBuffer}bind(){this.context.bindVertexBuffer.set(this.buffer)}updateData(e){if(e.length!==this.length)throw new Error(`Length of new data is ${e.length}, which doesn't match current length of ${this.length}`);const i=this.context.gl;this.bind(),i.bufferSubData(i.ARRAY_BUFFER,0,e.arrayBuffer)}enableAttributes(e,i){for(let s=0;s<this.attributes.length;s++){const l=i.attributes[this.attributes[s].name];l!==void 0&&e.enableVertexAttribArray(l)}}setVertexAttribPointers(e,i,s){for(let l=0;l<this.attributes.length;l++){const h=this.attributes[l],f=i.attributes[h.name];f!==void 0&&e.vertexAttribPointer(f,h.components,e[Wl[h.type]],!1,this.itemSize,h.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class At{constructor(e){this.gl=e.gl,this.default=this.getDefault(),this.current=this.default,this.dirty=!1}get(){return this.current}set(e){}getDefault(){return this.default}setDefault(){this.set(this.default)}}class kn extends At{getDefault(){return o.b7.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Xl extends At{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Kl extends At{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Yl extends At{getDefault(){return[!0,!0,!0,!0]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.colorMask(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Uu extends At{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Jl extends At{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class ga extends At{getDefault(){return{func:this.gl.ALWAYS,ref:0,mask:255}}set(e){const i=this.current;(e.func!==i.func||e.ref!==i.ref||e.mask!==i.mask||this.dirty)&&(this.gl.stencilFunc(e.func,e.ref,e.mask),this.current=e,this.dirty=!1)}}class Ql extends At{getDefault(){const e=this.gl;return[e.KEEP,e.KEEP,e.KEEP]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||this.dirty)&&(this.gl.stencilOp(e[0],e[1],e[2]),this.current=e,this.dirty=!1)}}class Id extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.STENCIL_TEST):i.disable(i.STENCIL_TEST),this.current=e,this.dirty=!1}}class kd extends At{getDefault(){return[0,1]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.depthRange(e[0],e[1]),this.current=e,this.dirty=!1)}}class Ad extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.DEPTH_TEST):i.disable(i.DEPTH_TEST),this.current=e,this.dirty=!1}}class Ed extends At{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class $u extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.BLEND):i.disable(i.BLEND),this.current=e,this.dirty=!1}}class zd extends At{getDefault(){const e=this.gl;return[e.ONE,e.ZERO]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||this.dirty)&&(this.gl.blendFunc(e[0],e[1]),this.current=e,this.dirty=!1)}}class Gu extends At{getDefault(){return o.b7.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class Ro extends At{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class Do extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;e?i.enable(i.CULL_FACE):i.disable(i.CULL_FACE),this.current=e,this.dirty=!1}}class Lo extends At{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class ec extends At{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class _a extends At{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Bo extends At{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Ha extends At{getDefault(){const e=this.gl;return[0,0,e.drawingBufferWidth,e.drawingBufferHeight]}set(e){const i=this.current;(e[0]!==i[0]||e[1]!==i[1]||e[2]!==i[2]||e[3]!==i[3]||this.dirty)&&(this.gl.viewport(e[0],e[1],e[2],e[3]),this.current=e,this.dirty=!1)}}class Ur extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindFramebuffer(i.FRAMEBUFFER,e),this.current=e,this.dirty=!1}}class qu extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindRenderbuffer(i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Hu extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindTexture(i.TEXTURE_2D,e),this.current=e,this.dirty=!1}}class tc extends At{getDefault(){return null}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.bindBuffer(i.ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class ya extends At{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Fo extends At{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const s=this.gl;rr(s)?s.bindVertexArray(e):(i=s.getExtension("OES_vertex_array_object"))===null||i===void 0||i.bindVertexArrayOES(e),this.current=e,this.dirty=!1}}class Oo extends At{getDefault(){return 4}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_ALIGNMENT,e),this.current=e,this.dirty=!1}}class Ls extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,e),this.current=e,this.dirty=!1}}class jo extends At{getDefault(){return!1}set(e){if(e===this.current&&!this.dirty)return;const i=this.gl;i.pixelStorei(i.UNPACK_FLIP_Y_WEBGL,e),this.current=e,this.dirty=!1}}class No extends At{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class Wa extends No{setDirty(){this.dirty=!0}set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.TEXTURE_2D,e,0),this.current=e,this.dirty=!1}}class Xa extends No{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}class Wu extends No{set(e){if(e===this.current&&!this.dirty)return;this.context.bindFramebuffer.set(this.parent);const i=this.gl;i.framebufferRenderbuffer(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.RENDERBUFFER,e),this.current=e,this.dirty=!1}}const Zo="Framebuffer is not complete";class xt{constructor(e,i,s,l,h){this.context=e,this.width=i,this.height=s;const f=e.gl,_=this.framebuffer=f.createFramebuffer();if(this.colorAttachment=new Wa(e,_),l)this.depthAttachment=h?new Wu(e,_):new Xa(e,_);else if(h)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(Zo)}destroy(){const e=this.context.gl,i=this.colorAttachment.get();if(i&&e.deleteTexture(i),this.depthAttachment){const s=this.depthAttachment.get();s&&e.deleteRenderbuffer(s)}e.deleteFramebuffer(this.framebuffer)}}class Vo{constructor(e){var i,s;if(this.gl=e,this.clearColor=new kn(this),this.clearDepth=new Xl(this),this.clearStencil=new Kl(this),this.colorMask=new Yl(this),this.depthMask=new Uu(this),this.stencilMask=new Jl(this),this.stencilFunc=new ga(this),this.stencilOp=new Ql(this),this.stencilTest=new Id(this),this.depthRange=new kd(this),this.depthTest=new Ad(this),this.depthFunc=new Ed(this),this.blend=new $u(this),this.blendFunc=new zd(this),this.blendColor=new Gu(this),this.blendEquation=new Ro(this),this.cullFace=new Do(this),this.cullFaceSide=new Lo(this),this.frontFace=new ec(this),this.program=new _a(this),this.activeTexture=new Bo(this),this.viewport=new Ha(this),this.bindFramebuffer=new Ur(this),this.bindRenderbuffer=new qu(this),this.bindTexture=new Hu(this),this.bindVertexBuffer=new tc(this),this.bindElementBuffer=new ya(this),this.bindVertexArray=new Fo(this),this.pixelStoreUnpack=new Oo(this),this.pixelStoreUnpackPremultiplyAlpha=new Ls(this),this.pixelStoreUnpackFlipY=new jo(this),this.extTextureFilterAnisotropic=e.getExtension("EXT_texture_filter_anisotropic")||e.getExtension("MOZ_EXT_texture_filter_anisotropic")||e.getExtension("WEBKIT_EXT_texture_filter_anisotropic"),this.extTextureFilterAnisotropic&&(this.extTextureFilterAnisotropicMax=e.getParameter(this.extTextureFilterAnisotropic.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE),rr(e)){this.HALF_FLOAT=e.HALF_FLOAT;const l=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(i=e.RGBA16F)!==null&&i!==void 0?i:l==null?void 0:l.RGBA16F_EXT,this.RGB16F=(s=e.RGB16F)!==null&&s!==void 0?s:l==null?void 0:l.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const l=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=l==null?void 0:l.HALF_FLOAT_OES}}setDefault(){this.unbindVAO(),this.clearColor.setDefault(),this.clearDepth.setDefault(),this.clearStencil.setDefault(),this.colorMask.setDefault(),this.depthMask.setDefault(),this.stencilMask.setDefault(),this.stencilFunc.setDefault(),this.stencilOp.setDefault(),this.stencilTest.setDefault(),this.depthRange.setDefault(),this.depthTest.setDefault(),this.depthFunc.setDefault(),this.blend.setDefault(),this.blendFunc.setDefault(),this.blendColor.setDefault(),this.blendEquation.setDefault(),this.cullFace.setDefault(),this.cullFaceSide.setDefault(),this.frontFace.setDefault(),this.program.setDefault(),this.activeTexture.setDefault(),this.bindFramebuffer.setDefault(),this.pixelStoreUnpack.setDefault(),this.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.pixelStoreUnpackFlipY.setDefault()}setDirty(){this.clearColor.dirty=!0,this.clearDepth.dirty=!0,this.clearStencil.dirty=!0,this.colorMask.dirty=!0,this.depthMask.dirty=!0,this.stencilMask.dirty=!0,this.stencilFunc.dirty=!0,this.stencilOp.dirty=!0,this.stencilTest.dirty=!0,this.depthRange.dirty=!0,this.depthTest.dirty=!0,this.depthFunc.dirty=!0,this.blend.dirty=!0,this.blendFunc.dirty=!0,this.blendColor.dirty=!0,this.blendEquation.dirty=!0,this.cullFace.dirty=!0,this.cullFaceSide.dirty=!0,this.frontFace.dirty=!0,this.program.dirty=!0,this.activeTexture.dirty=!0,this.viewport.dirty=!0,this.bindFramebuffer.dirty=!0,this.bindRenderbuffer.dirty=!0,this.bindTexture.dirty=!0,this.bindVertexBuffer.dirty=!0,this.bindElementBuffer.dirty=!0,this.bindVertexArray.dirty=!0,this.pixelStoreUnpack.dirty=!0,this.pixelStoreUnpackPremultiplyAlpha.dirty=!0,this.pixelStoreUnpackFlipY.dirty=!0}createIndexBuffer(e,i){return new Zu(this,e,i)}createVertexBuffer(e,i,s){return new Vu(this,e,i,s)}createRenderbuffer(e,i,s){const l=this.gl,h=l.createRenderbuffer();return this.bindRenderbuffer.set(h),l.renderbufferStorage(l.RENDERBUFFER,e,i,s),this.bindRenderbuffer.set(null),h}createFramebuffer(e,i,s,l){return new xt(this,e,i,s,l)}clear({color:e,depth:i,stencil:s}){const l=this.gl;let h=0;e&&(h|=l.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),i!==void 0&&(h|=l.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),s!==void 0&&(h|=l.STENCIL_BUFFER_BIT,this.clearStencil.set(s),this.stencilMask.set(255)),l.clear(h)}setCullFace(e){e.enable===!1?this.cullFace.set(!1):(this.cullFace.set(!0),this.cullFaceSide.set(e.mode),this.frontFace.set(e.frontFace))}setDepthMode(e){e.func!==this.gl.ALWAYS||e.mask?(this.depthTest.set(!0),this.depthFunc.set(e.func),this.depthMask.set(e.mask),this.depthRange.set(e.range)):this.depthTest.set(!1)}setStencilMode(e){e.test.func!==this.gl.ALWAYS||e.mask?(this.stencilTest.set(!0),this.stencilMask.set(e.mask),this.stencilOp.set([e.fail,e.depthFail,e.pass]),this.stencilFunc.set({func:e.test.func,ref:e.ref,mask:e.test.mask})):this.stencilTest.set(!1)}setColorMode(e){o.bE(e.blendFunction,$t.Replace)?this.blend.set(!1):(this.blend.set(!0),this.blendFunc.set(e.blendFunction),this.blendColor.set(e.blendColor)),this.colorMask.set(e.mask)}createVertexArray(){var e;return rr(this.gl)?this.gl.createVertexArray():(e=this.gl.getExtension("OES_vertex_array_object"))===null||e===void 0?void 0:e.createVertexArrayOES()}deleteVertexArray(e){var i;return rr(this.gl)?this.gl.deleteVertexArray(e):(i=this.gl.getExtension("OES_vertex_array_object"))===null||i===void 0?void 0:i.deleteVertexArrayOES(e)}unbindVAO(){this.bindVertexArray.set(null)}}let Uo;function ic(u,e,i,s,l){const h=u.context,f=u.transform,_=h.gl,x=u.useProgram("collisionBox"),T=[];let P=0,A=0;for(let W=0;W<s.length;W++){const K=s[W],te=e.getTile(K).getBucket(i);if(!te)continue;const ee=l?te.textCollisionBox:te.iconCollisionBox,ie=te.collisionCircleArray;ie.length>0&&(T.push({circleArray:ie,circleOffset:A,coord:K}),P+=ie.length/4,A=P),ee&&x.draw(h,_.LINES,ot.disabled,dt.disabled,u.colorModeForRenderPass(),St.disabled,Md(u.transform),u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),f.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,null,u.transform.zoom,null,null,ee.collisionVertexBuffer)}if(!l||!T.length)return;const k=u.useProgram("collisionCircle"),B=new o.bT;B.resize(4*P),B._trim();let O=0;for(const W of T)for(let K=0;K<W.circleArray.length/4;K++){const te=4*K,ee=W.circleArray[te+0],ie=W.circleArray[te+1],se=W.circleArray[te+2],re=W.circleArray[te+3];B.emplace(O++,ee,ie,se,re,0),B.emplace(O++,ee,ie,se,re,1),B.emplace(O++,ee,ie,se,re,2),B.emplace(O++,ee,ie,se,re,3)}(!Uo||Uo.length<2*P)&&(Uo=function(W){const K=2*W,te=new o.bV;te.resize(K),te._trim();for(let ee=0;ee<K;ee++){const ie=6*ee;te.uint16[ie+0]=4*ee+0,te.uint16[ie+1]=4*ee+1,te.uint16[ie+2]=4*ee+2,te.uint16[ie+3]=4*ee+2,te.uint16[ie+4]=4*ee+3,te.uint16[ie+5]=4*ee+0}return te}(P));const H=h.createIndexBuffer(Uo,!0),q=h.createVertexBuffer(B,o.bU.members,!0);for(const W of T){const K=Eo(u.transform);k.draw(h,_.TRIANGLES,ot.disabled,dt.disabled,u.colorModeForRenderPass(),St.disabled,K,u.style.map.terrain&&u.style.map.terrain.getTerrainData(W.coord),null,i.id,q,H,o.aJ.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,u.transform.zoom,null,null,null)}q.destroy(),H.destroy()}const Bs=o.ad(new Float32Array(16));function Rd(u,e,i,s,l,h){const{horizontalAlign:f,verticalAlign:_}=o.aE(u);return new o.P((-(f-.5)*e/l+s[0])*h,(-(_-.5)*i/l+s[1])*h)}function Dd(u,e,i,s,l,h){const f=e.tileAnchorPoint.add(new o.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=s.mult(h);i||(_=_.rotate(-l));const x=f.add(_);return we(x.x,x.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const _=ci(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(u),x=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(s.rotate(x))}return u.add(s)}function Xu(u,e,i,s,l,h,f,_,x,T,P,A){const k=u.text.placedSymbolArray,B=u.text.dynamicLayoutVertexArray,O=u.icon.dynamicLayoutVertexArray,H={};B.clear();for(let q=0;q<k.length;q++){const W=k.get(q),K=W.hidden||!W.crossTileID||u.allowVerticalPlacement&&!W.placedOrientation?null:s[W.crossTileID];if(K){const te=new o.P(W.anchorX,W.anchorY),ee={getElevation:A,width:l.width,height:l.height,pitchedLabelPlaneMatrix:h,pitchWithMap:i,transform:l,tileAnchorPoint:te,translation:T,unwrappedTileID:P},ie=i?ht(te.x,te.y,ee):ci(te.x,te.y,ee),se=Ft(l.cameraToCenterDistance,ie.signedDistanceFromCamera);let re=o.am(u.textSizeData,_,W)*se/o.ay;i&&(re*=u.tilePixelRatio/f);const{width:pe,height:Me,anchor:xe,textOffset:ve,textBoxScale:be}=K,je=Rd(xe,pe,Me,ve,be,re),Fe=l.getPitchedTextCorrection(te.x+T[0],te.y+T[1],P),Ee=Dd(ie.point,ee,e,je,-l.bearingInRadians,Fe),He=u.allowVerticalPlacement&&W.placedOrientation===o.al.vertical?Math.PI/2:0;for(let pt=0;pt<W.numGlyphs;pt++)o.as(B,Ee,He);x&&W.associatedIconIndex>=0&&(H[W.associatedIconIndex]={shiftedAnchor:Ee,angle:He})}else Cn(W.numGlyphs,B)}if(x){O.clear();const q=u.icon.placedSymbolArray;for(let W=0;W<q.length;W++){const K=q.get(W);if(K.hidden)Cn(K.numGlyphs,O);else{const te=H[W];if(te)for(let ee=0;ee<K.numGlyphs;ee++)o.as(O,te.shiftedAnchor,te.angle);else Cn(K.numGlyphs,O)}}u.icon.dynamicLayoutVertexBuffer.updateData(O)}u.text.dynamicLayoutVertexBuffer.updateData(B)}function Ld(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function $o(u,e,i,s,l,h,f,_,x,T,P,A,k){const B=u.context,O=B.gl,H=u.transform,q=_==="map",W=x==="map",K=_!=="viewport"&&i.layout.get("symbol-placement")!=="point",te=q&&!W&&!K,ee=!i.layout.get("symbol-sort-key").isConstant();let ie=!1;const se=u.getDepthModeForSublayer(0,ot.ReadOnly),re=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),pe=[],Me=H.getCircleRadiusCorrection();for(const xe of s){const ve=e.getTile(xe),be=ve.getBucket(i);if(!be)continue;const je=l?be.text:be.icon;if(!je||!je.segments.get().length||!je.hasVisibleVertices)continue;const Fe=je.programConfigurations.get(i.id),Ee=l||be.sdfIcons,He=l?be.textSizeData:be.iconSizeData,pt=W||H.pitch!==0,Pt=u.useProgram(Ld(Ee,l,be),Fe),ni=o.ak(He,H.zoom),Gt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(xe);let ai,si,Ht,Dt,Di=[0,0],Zi=null;if(l)si=ve.glyphAtlasTexture,Ht=O.LINEAR,ai=ve.glyphAtlasTexture.size,be.iconsInText&&(Di=ve.imageAtlasTexture.size,Zi=ve.imageAtlasTexture,Dt=pt||u.options.rotating||u.options.zooming||He.kind==="composite"||He.kind==="camera"?O.LINEAR:O.NEAREST);else{const Pi=i.layout.get("icon-size").constantOr(0)!==1||be.iconsNeedLinear;si=ve.imageAtlasTexture,Ht=Ee||u.options.rotating||u.options.zooming||Pi||pt?O.LINEAR:O.NEAREST,ai=ve.imageAtlasTexture.size}const Ki=o.az(ve,1,u.transform.zoom),Lt=Qe(q,u.transform,Ki),Xn=o.K();o.an(Xn,Lt);const yn=ct(W,q,u.transform,Ki),Kn=o.aA(H,ve,h,f),ba=H.getProjectionData({overscaledTileID:xe,applyGlobeMatrix:!k,applyTerrainMatrix:!0}),Ys=re&&be.hasTextData(),Yn=i.layout.get("icon-text-fit")!=="none"&&Ys&&be.hasIconData();if(K){const Pi=u.style.map.terrain?(gr,Yt)=>u.style.map.terrain.getElevation(xe,gr,Yt):null,Ci=i.layout.get("text-rotation-alignment")==="map";Et(be,u,l,Lt,Xn,W,T,Ci,xe.toUnwrapped(),H.width,H.height,Kn,Pi)}const wa=l&&re||Yn,zr=K||wa?Bs:W?Lt:u.transform.clipSpaceToPixelsMatrix,Jn=Ee&&i.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let En;En=Ee?be.iconsInText?zo(He.kind,ni,te,W,K,wa,u,zr,yn,Kn,ai,Di,Me):ju(He.kind,ni,te,W,K,wa,u,zr,yn,Kn,l,ai,0,Me):qa(He.kind,ni,te,W,K,wa,u,zr,yn,Kn,l,ai,Me);const Qn={program:Pt,buffers:je,uniformValues:En,projectionData:ba,atlasTexture:si,atlasTextureIcon:Zi,atlasInterpolation:Ht,atlasInterpolationIcon:Dt,isSDF:Ee,hasHalo:Jn};if(ee&&be.canOverlap){ie=!0;const Pi=je.segments.get();for(const Ci of Pi)pe.push({segments:new o.aJ([Ci]),sortKey:Ci.sortKey,state:Qn,terrainData:Gt})}else pe.push({segments:je.segments,sortKey:0,state:Qn,terrainData:Gt})}ie&&pe.sort((xe,ve)=>xe.sortKey-ve.sortKey);for(const xe of pe){const ve=xe.state;if(B.activeTexture.set(O.TEXTURE0),ve.atlasTexture.bind(ve.atlasInterpolation,O.CLAMP_TO_EDGE),ve.atlasTextureIcon&&(B.activeTexture.set(O.TEXTURE1),ve.atlasTextureIcon&&ve.atlasTextureIcon.bind(ve.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),ve.isSDF){const be=ve.uniformValues;ve.hasHalo&&(be.u_is_halo=1,Fs(ve.buffers,xe.segments,i,u,ve.program,se,P,A,be,ve.projectionData,xe.terrainData)),be.u_is_halo=0}Fs(ve.buffers,xe.segments,i,u,ve.program,se,P,A,ve.uniformValues,ve.projectionData,xe.terrainData)}}function Fs(u,e,i,s,l,h,f,_,x,T,P){const A=s.context;l.draw(A,A.gl.TRIANGLES,h,f,_,St.backCCW,x,P,T,i.id,u.layoutVertexBuffer,u.indexBuffer,e,i.paint,s.transform.zoom,u.programConfigurations.get(i.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function Go(u,e,i,s,l){const h=u.context,f=h.gl,_=dt.disabled,x=new $t([f.ONE,f.ONE],o.b7.transparent,[!0,!0,!0,!0]),T=e.getBucket(i);if(!T)return;const P=s.key;let A=i.heatmapFbos.get(P);A||(A=qo(h,e.tileSize,e.tileSize),i.heatmapFbos.set(P,A)),h.bindFramebuffer.set(A.framebuffer),h.viewport.set([0,0,e.tileSize,e.tileSize]),h.clear({color:o.b7.transparent});const k=T.programConfigurations.get(i.id),B=u.useProgram("heatmap",k,!l),O=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),H=u.style.map.terrain.getTerrainData(s);B.draw(h,f.TRIANGLES,ot.disabled,_,x,St.disabled,ma(e,u.transform.zoom,i.paint.get("heatmap-intensity"),1),H,O,i.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,i.paint,u.transform.zoom,k)}function rc(u,e,i,s,l){const h=u.context,f=h.gl,_=u.transform;h.setColorMode(u.colorModeForRenderPass());const x=nc(h,e),T=i.key,P=e.heatmapFbos.get(T);if(!P)return;h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,P.colorAttachment.get()),h.activeTexture.set(f.TEXTURE1),x.bind(f.LINEAR,f.CLAMP_TO_EDGE);const A=_.getProjectionData({overscaledTileID:i,applyTerrainMatrix:l,applyGlobeMatrix:!s});u.useProgram("heatmapTexture").draw(h,f.TRIANGLES,ot.disabled,dt.disabled,u.colorModeForRenderPass(),St.disabled,Eu(u,e,0,1),null,A,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,_.zoom),P.destroy(),e.heatmapFbos.delete(T)}function qo(u,e,i){var s,l;const h=u.gl,f=h.createTexture();h.bindTexture(h.TEXTURE_2D,f),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.LINEAR),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.LINEAR);const _=(s=u.HALF_FLOAT)!==null&&s!==void 0?s:h.UNSIGNED_BYTE,x=(l=u.RGBA16F)!==null&&l!==void 0?l:h.RGBA;h.texImage2D(h.TEXTURE_2D,0,x,e,i,0,h.RGBA,_,null);const T=u.createFramebuffer(e,i,!1,!1);return T.colorAttachment.set(f),T}function nc(u,e){return e.colorRampTexture||(e.colorRampTexture=new qt(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function Os(u,e,i,s,l){if(!i||!s||!s.imageAtlas)return;const h=s.imageAtlas.patternPositions;let f=h[i.to.toString()],_=h[i.from.toString()];if(!f&&_&&(f=_),!_&&f&&(_=f),!f||!_){const x=l.getPaintProperty(e);f=h[x],_=h[x]}f&&_&&u.setConstantPatternPositions(f,_)}function js(u,e,i,s,l,h,f,_){const x=u.context.gl,T="fill-pattern",P=i.paint.get(T),A=P&&P.constantOr(1),k=i.getCrossfadeParameters();let B,O,H,q,W;const K=u.transform,te=i.paint.get("fill-translate"),ee=i.paint.get("fill-translate-anchor");f?(O=A&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",B=x.LINES):(O=A?"fillPattern":"fill",B=x.TRIANGLES);const ie=P.constantOr(null);for(const se of s){const re=e.getTile(se);if(A&&!re.patternsLoaded())continue;const pe=re.getBucket(i);if(!pe)continue;const Me=pe.programConfigurations.get(i.id),xe=u.useProgram(O,Me),ve=u.style.map.terrain&&u.style.map.terrain.getTerrainData(se);A&&(u.context.activeTexture.set(x.TEXTURE0),re.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),Me.updatePaintBuffers(k)),Os(Me,T,ie,re,i);const be=K.getProjectionData({overscaledTileID:se,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),je=o.aA(K,re,te,ee);if(f){q=pe.indexBuffer2,W=pe.segments2;const Ee=[x.drawingBufferWidth,x.drawingBufferHeight];H=O==="fillOutlinePattern"&&A?zs(u,k,re,Ee,je):Gl(Ee,je)}else q=pe.indexBuffer,W=pe.segments,H=A?ku(u,k,re,je):{u_fill_translate:je};const Fe=u.stencilModeForClipping(se);xe.draw(u.context,B,l,Fe,h,St.backCCW,H,ve,be,i.id,pe.layoutVertexBuffer,q,W,i.paint,u.transform.zoom,Me)}}function Ns(u,e,i,s,l,h,f,_){const x=u.context,T=x.gl,P="fill-extrusion-pattern",A=i.paint.get(P),k=A.constantOr(1),B=i.getCrossfadeParameters(),O=i.paint.get("fill-extrusion-opacity"),H=A.constantOr(null),q=u.transform;for(const W of s){const K=e.getTile(W),te=K.getBucket(i);if(!te)continue;const ee=u.style.map.terrain&&u.style.map.terrain.getTerrainData(W),ie=te.programConfigurations.get(i.id),se=u.useProgram(k?"fillExtrusionPattern":"fillExtrusion",ie);k&&(u.context.activeTexture.set(T.TEXTURE0),K.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),ie.updatePaintBuffers(B));const re=q.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!_,applyTerrainMatrix:!0});Os(ie,P,H,K,i);const pe=o.aA(q,K,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),Me=i.paint.get("fill-extrusion-vertical-gradient"),xe=k?mn(u,Me,O,pe,W,B,K):Ao(u,Me,O,pe);se.draw(x,x.gl.TRIANGLES,l,h,f,St.backCCW,xe,ee,re,i.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,i.paint,u.transform.zoom,ie,u.style.map.terrain&&te.centroidVertexBuffer)}}function ac(u,e,i,s,l,h,f,_,x){var T;const P=u.style.projection,A=u.context,k=u.transform,B=A.gl,O=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],H=u.useProgram("hillshade",null,!1,O),q=!u.options.moving;for(const W of s){const K=e.getTile(W),te=K.fbo;if(!te)continue;const ee=P.getMeshFromTileID(A,W.canonical,_,!0,"raster"),ie=(T=u.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(W);A.activeTexture.set(B.TEXTURE0),B.bindTexture(B.TEXTURE_2D,te.colorAttachment.get());const se=k.getProjectionData({overscaledTileID:W,aligned:q,applyGlobeMatrix:!x,applyTerrainMatrix:!0});H.draw(A,B.TRIANGLES,h,l[W.overscaledZ],f,St.backCCW,zu(u,K,i),ie,se,i.id,ee.vertexBuffer,ee.indexBuffer,ee.segments)}}const Zs=[new o.P(0,0),new o.P(o.Z,0),new o.P(o.Z,o.Z),new o.P(0,o.Z)];function Ho(u,e,i,s,l,h,f,_,x=!1,T=!1){const P=s[s.length-1].overscaledZ,A=u.context,k=A.gl,B=u.useProgram("raster"),O=u.transform,H=u.style.projection,q=u.colorModeForRenderPass(),W=!u.options.moving;for(const K of s){const te=u.getDepthModeForSublayer(K.overscaledZ-P,i.paint.get("raster-opacity")===1?ot.ReadWrite:ot.ReadOnly,k.LESS),ee=e.getTile(K);ee.registerFadeDuration(i.paint.get("raster-fade-duration"));const ie=e.findLoadedParent(K,0),se=e.findLoadedSibling(K),re=Ku(ee,ie||se||null,e,i,u.transform,u.style.map.terrain);let pe,Me;const xe=i.paint.get("raster-resampling")==="nearest"?k.NEAREST:k.LINEAR;A.activeTexture.set(k.TEXTURE0),ee.texture.bind(xe,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),A.activeTexture.set(k.TEXTURE1),ie?(ie.texture.bind(xe,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),pe=Math.pow(2,ie.tileID.overscaledZ-ee.tileID.overscaledZ),Me=[ee.tileID.canonical.x*pe%1,ee.tileID.canonical.y*pe%1]):ee.texture.bind(xe,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),ee.texture.useMipmap&&A.extTextureFilterAnisotropic&&u.transform.pitch>20&&k.texParameterf(k.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax);const ve=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),be=O.getProjectionData({overscaledTileID:K,aligned:W,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),je=Fu(Me||[0,0],pe||1,re,i,_),Fe=H.getMeshFromTileID(A,K.canonical,h,f,"raster");B.draw(A,k.TRIANGLES,te,l?l[K.overscaledZ]:dt.disabled,q,x?St.frontCCW:St.backCCW,je,ve,be,i.id,Fe.vertexBuffer,Fe.indexBuffer,Fe.segments)}}function Ku(u,e,i,s,l,h){const f=s.paint.get("raster-fade-duration");if(!h&&f>0){const _=ke.now(),x=(_-u.timeAdded)/f,T=e?(_-e.timeAdded)/f:-1,P=i.getSource(),A=me(l,{tileSize:P.tileSize,roundZoom:P.roundZoom}),k=!e||Math.abs(e.tileID.overscaledZ-A)>Math.abs(u.tileID.overscaledZ-A),B=k&&u.refreshedUponExpiration?1:o.ae(k?x:1-T,0,1);return u.refreshedUponExpiration&&x>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-B}:{opacity:B,mix:0}}return{opacity:1,mix:0}}const Wo=new o.b7(1,0,0,1),sc=new o.b7(0,1,0,1),Yu=new o.b7(0,0,1,1),Ju=new o.b7(1,0,1,1),Xo=new o.b7(0,1,1,1);function Ko(u,e,i,s){Vs(u,0,e+i/2,u.transform.width,i,s)}function Qu(u,e,i,s){Vs(u,e-i/2,0,i,u.transform.height,s)}function Vs(u,e,i,s,l,h){const f=u.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*u.pixelRatio,i*u.pixelRatio,s*u.pixelRatio,l*u.pixelRatio),f.clear({color:h}),_.disable(_.SCISSOR_TEST)}function mi(u,e,i){const s=u.context,l=s.gl,h=u.useProgram("debug"),f=ot.disabled,_=dt.disabled,x=u.colorModeForRenderPass(),T="$debug",P=u.style.map.terrain&&u.style.map.terrain.getTerrainData(i);s.activeTexture.set(l.TEXTURE0);const A=e.getTileByID(i.key).latestRawTileData,k=Math.floor((A&&A.byteLength||0)/1024),B=e.getTile(i).tileSize,O=512/Math.min(B,512)*(i.overscaledZ/u.transform.zoom)*.5;let H=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(H+=` => ${i.overscaledZ}`),function(W,K){W.initDebugOverlayCanvas();const te=W.debugOverlayCanvas,ee=W.context.gl,ie=W.debugOverlayCanvas.getContext("2d");ie.clearRect(0,0,te.width,te.height),ie.shadowColor="white",ie.shadowBlur=2,ie.lineWidth=1.5,ie.strokeStyle="white",ie.textBaseline="top",ie.font="bold 36px Open Sans, sans-serif",ie.fillText(K,5,5),ie.strokeText(K,5,5),W.debugOverlayTexture.update(te),W.debugOverlayTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE)}(u,`${H} ${k}kB`);const q=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(s,l.TRIANGLES,f,_,$t.alphaBlended,St.disabled,Au(o.b7.transparent,O),null,q,T,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(s,l.LINE_STRIP,f,_,x,St.disabled,Au(o.b7.red),P,q,T,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function Wn(u,e,i,s){const{isRenderingGlobe:l}=s,h=u.context,f=h.gl,_=u.transform,x=u.colorModeForRenderPass(),T=u.getDepthModeFor3D(),P=u.useProgram("terrain");h.bindFramebuffer.set(null),h.viewport.set([0,0,u.width,u.height]);for(const A of i){const k=e.getTerrainMesh(A.tileID),B=u.renderToTexture.getTexture(A),O=e.getTerrainData(A.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,B.texture);const H=e.getMeshFrameDelta(_.zoom),q=_.calculateFogMatrix(A.tileID.toUnwrapped()),W=Td(H,q,u.style.sky,_.pitch,l),K=_.getProjectionData({overscaledTileID:A.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});P.draw(h,f.TRIANGLES,T,dt.disabled,x,St.backCCW,W,O,K,"terrain",k.vertexBuffer,k.indexBuffer,k.segments)}}function Er(u,e){if(!e.mesh){const i=new o.aI;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const s=new o.aK;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),e.mesh=new Na(u.createVertexBuffer(i,pr.members),u.createIndexBuffer(s),o.aJ.simpleSegment(0,0,i.length,s.length))}return e.mesh}class oc{constructor(e,i){this.context=new Vo(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:o.ad(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=he.maxUnderzooming+he.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new ws}resize(e,i,s){if(this.width=Math.floor(e*s),this.height=Math.floor(i*s),this.pixelRatio=s,this.context.viewport.set([0,0,this.width,this.height]),this.style)for(const l of this.style._order)this.style._layers[l].resize()}setup(){const e=this.context,i=new o.aI;i.emplaceBack(0,0),i.emplaceBack(o.Z,0),i.emplaceBack(0,o.Z),i.emplaceBack(o.Z,o.Z),this.tileExtentBuffer=e.createVertexBuffer(i,pr.members),this.tileExtentSegments=o.aJ.simpleSegment(0,0,4,2);const s=new o.aI;s.emplaceBack(0,0),s.emplaceBack(o.Z,0),s.emplaceBack(0,o.Z),s.emplaceBack(o.Z,o.Z),this.debugBuffer=e.createVertexBuffer(s,pr.members),this.debugSegments=o.aJ.simpleSegment(0,0,4,5);const l=new o.b_;l.emplaceBack(0,0,0,0),l.emplaceBack(o.Z,0,o.Z,0),l.emplaceBack(0,o.Z,0,o.Z),l.emplaceBack(o.Z,o.Z,o.Z,o.Z),this.rasterBoundsBuffer=e.createVertexBuffer(l,bd.members),this.rasterBoundsSegments=o.aJ.simpleSegment(0,0,4,2);const h=new o.aI;h.emplaceBack(0,0),h.emplaceBack(o.Z,0),h.emplaceBack(0,o.Z),h.emplaceBack(o.Z,o.Z),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(h,pr.members),this.rasterBoundsSegmentsPosOnly=o.aJ.simpleSegment(0,0,4,5);const f=new o.aI;f.emplaceBack(0,0),f.emplaceBack(1,0),f.emplaceBack(0,1),f.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(f,pr.members),this.viewportSegments=o.aJ.simpleSegment(0,0,4,2);const _=new o.b$;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const x=new o.aK;x.emplaceBack(1,0,2),x.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(x);const T=this.context.gl;this.stencilClearMode=new dt({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO),this.tileExtentMesh=new Na(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=o.K();o.bQ(s,0,this.width,this.height,0,0,1),o.M(s,s,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const l={mainMatrix:s,tileMercatorCoords:[0,0,1,1],clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:s};this.useProgram("clippingMask",null,!0).draw(e,i.TRIANGLES,ot.disabled,this.stencilClearMode,$t.disabled,St.disabled,null,null,l,"$clipping",this.viewportBuffer,this.quadTriangleIndexBuffer,this.viewportSegments)}_renderTileClippingMasks(e,i,s){if(this.currentStencilSource===e.source||!e.isTileClipped()||!i||!i.length)return;this.currentStencilSource=e.source,this.nextStencilID+i.length>256&&this.clearStencil();const l=this.context;l.setColorMode($t.disabled),l.setDepthMode(ot.disabled);const h={};for(const f of i)h[f.key]=this.nextStencilID++;this._renderTileMasks(h,i,s,!0),this._renderTileMasks(h,i,s,!1),this._tileClippingMaskIDs=h}_renderTileMasks(e,i,s,l){const h=this.context,f=h.gl,_=this.style.projection,x=this.transform,T=this.useProgram("clippingMask");for(const P of i){const A=e[P.key],k=this.style.map.terrain&&this.style.map.terrain.getTerrainData(P),B=_.getMeshFromTileID(this.context,P.canonical,l,!0,"stencil"),O=x.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!s,applyTerrainMatrix:!0});T.draw(h,f.TRIANGLES,ot.disabled,new dt({func:f.ALWAYS,mask:0},A,255,f.KEEP,f.KEEP,f.REPLACE),$t.disabled,s?St.disabled:St.backCCW,null,k,O,"$clipping",B.vertexBuffer,B.indexBuffer,B.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,s=this.style.projection,l=this.transform,h=this.useProgram("depth"),f=this.getDepthModeFor3D(),_=oe(l,{tileSize:l.tileSize});for(const x of _){const T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(x),P=s.getMeshFromTileID(this.context,x.canonical,!0,!0,"raster"),A=l.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(e,i.TRIANGLES,f,dt.disabled,$t.disabled,St.backCCW,null,T,A,"$clipping",P.vertexBuffer,P.indexBuffer,P.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new dt({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new dt({func:i.EQUAL,mask:255},this._tileClippingMaskIDs[e.key],0,i.KEEP,i.KEEP,i.REPLACE)}getStencilConfigForOverlapAndUpdateStencilID(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const f={};for(let _=0;_<h;_++)f[_+l]=new dt({func:i.GEQUAL,mask:255},_+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[f,s]}return[{[l]:dt.disabled},s]}stencilConfigForOverlapTwoPass(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(this.clearStencil(),h>1){const f={},_={};for(let x=0;x<h;x++)f[x+l]=new dt({func:i.GREATER,mask:255},h+1+x,255,i.KEEP,i.KEEP,i.REPLACE),_[x+l]=new dt({func:i.GREATER,mask:255},1+x,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*h+1,[f,_,s]}return this.nextStencilID=3,[{[l]:new dt({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[l]:new dt({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},s]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new $t([e.CONSTANT_COLOR,e.ONE],new o.b7(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?$t.unblended:$t.alphaBlended}getDepthModeForSublayer(e,i,s){if(!this.opaquePassEnabledForLayer())return ot.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ot(s||this.context.gl.LEQUAL,i,[l,l])}getDepthModeFor3D(){return new ot(this.context.gl.LEQUAL,ot.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var s,l;this.style=e,this.options=i,this.lineAtlas=e.lineAtlas,this.imageManager=e.imageManager,this.glyphManager=e.glyphManager,this.symbolFadeChange=e.placement.symbolFadeChange(ke.now()),this.imageManager.beginFrame();const h=this.style._order,f=this.style.sourceCaches,_={},x={},T={},P={isRenderingToTexture:!1,isRenderingGlobe:((s=e.projection)===null||s===void 0?void 0:s.transitionState)>0};for(const k in f){const B=f[k];B.used&&B.prepare(this.context),_[k]=B.getVisibleCoordinates(!1),x[k]=_[k].slice().reverse(),T[k]=B.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let k=0;k<h.length;k++)if(this.style._layers[h[k]].is3D()){this.opaquePassCutoff=k;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const k of h){const B=this.style._layers[k];if(!B.hasOffscreenPass()||B.isHidden(this.transform.zoom))continue;const O=x[B.source];(B.type==="custom"||O.length)&&this.renderLayer(this,f[B.source],B,O,P)}if((l=this.style.projection)===null||l===void 0||l.updateGPUdependent({context:this.context,useProgram:k=>this.useProgram(k)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?o.b7.black:o.b7.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(k,B){const O=k.context,H=O.gl,q=((se,re,pe)=>{const Me=Math.cos(re.rollInRadians),xe=Math.sin(re.rollInRadians),ve=ce(re),be=re.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:se.properties.get("sky-color"),u_horizon_color:se.properties.get("horizon-color"),u_horizon:[(re.width/2-ve*xe)*pe,(re.height/2+ve*Me)*pe],u_horizon_normal:[-xe,Me],u_sky_horizon_blend:se.properties.get("sky-horizon-blend")*re.height/2*pe,u_sky_blend:be}})(B,k.style.map.transform,k.pixelRatio),W=new ot(H.LEQUAL,ot.ReadWrite,[0,1]),K=dt.disabled,te=k.colorModeForRenderPass(),ee=k.useProgram("sky"),ie=Er(O,B);ee.draw(O,H.TRIANGLES,W,K,te,St.disabled,q,null,void 0,"sky",ie.vertexBuffer,ie.indexBuffer,ie.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=h.length-1;this.currentLayer>=0;this.currentLayer--){const k=this.style._layers[h[this.currentLayer]],B=f[k.source],O=_[k.source];this._renderTileClippingMasks(k,O,!1),this.renderLayer(this,B,k,O,P)}this.renderPass="translucent";let A=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const k=this.style._layers[h[this.currentLayer]],B=f[k.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(k,P))continue;this.opaquePassEnabledForLayer()||A||(A=!0,P.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const O=(k.type==="symbol"?T:x)[k.source];this._renderTileClippingMasks(k,_[k.source],!!this.renderToTexture),this.renderLayer(this,B,k,O,P)}if(P.isRenderingGlobe&&function(k,B,O){const H=k.context,q=H.gl,W=k.useProgram("atmosphere"),K=new ot(q.LEQUAL,ot.ReadOnly,[0,1]),te=k.transform,ee=function(be,je){const Fe=be.properties.get("position"),Ee=[-Fe.x,-Fe.y,-Fe.z],He=o.ad(new Float64Array(16));return be.properties.get("anchor")==="map"&&(o.a_(He,He,je.rollInRadians),o.a$(He,He,-je.pitchInRadians),o.a_(He,He,je.bearingInRadians),o.a$(He,He,je.center.lat*Math.PI/180),o.bp(He,He,-je.center.lng*Math.PI/180)),o.bZ(Ee,Ee,He),Ee}(O,k.transform),ie=te.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),se=B.properties.get("atmosphere-blend")*ie.projectionTransition;if(se===0)return;const re=da(te.worldSize,te.center.lat),pe=te.inverseProjectionMatrix,Me=new Float64Array(4);Me[3]=1,o.at(Me,Me,te.modelViewProjectionMatrix),Me[0]/=Me[3],Me[1]/=Me[3],Me[2]/=Me[3],Me[3]=1,o.at(Me,Me,pe),Me[0]/=Me[3],Me[1]/=Me[3],Me[2]/=Me[3],Me[3]=1;const xe=((be,je,Fe,Ee,He)=>({u_sun_pos:be,u_atmosphere_blend:je,u_globe_position:Fe,u_globe_radius:Ee,u_inv_proj_matrix:He}))(ee,se,[Me[0],Me[1],Me[2]],re,pe),ve=Er(H,B);W.draw(H,q.TRIANGLES,K,dt.disabled,$t.alphaBlended,St.disabled,xe,null,null,"atmosphere",ve.vertexBuffer,ve.indexBuffer,ve.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const k=function(B,O){let H=null;const q=Object.values(B._layers).flatMap(ee=>ee.source&&!ee.isHidden(O)?[B.sourceCaches[ee.source]]:[]),W=q.filter(ee=>ee.getSource().type==="vector"),K=q.filter(ee=>ee.getSource().type!=="vector"),te=ee=>{(!H||H.getSource().maxzoom<ee.getSource().maxzoom)&&(H=ee)};return W.forEach(ee=>te(ee)),H||K.forEach(ee=>te(ee)),H}(this.style,this.transform.zoom);k&&function(B,O,H){for(let q=0;q<H.length;q++)mi(B,O,H[q])}(this,k,k.getVisibleCoordinates())}this.options.showPadding&&function(k){const B=k.transform.padding;Ko(k,k.transform.height-(B.top||0),3,Wo),Ko(k,B.bottom||0,3,sc),Qu(k,B.left||0,3,Yu),Qu(k,k.transform.width-(B.right||0),3,Ju);const O=k.transform.centerPoint;(function(H,q,W,K){Vs(H,q-1,W-10,2,20,K),Vs(H,q-10,W-1,20,2,K)})(k,O.x,k.transform.height-O.y,Xo)}(this),this.context.setDefault()}maybeDrawDepthAndCoords(e){if(!this.style||!this.style.map||!this.style.map.terrain)return;const i=this.terrainFacilitator.matrix,s=this.transform.modelViewProjectionMatrix;let l=this.terrainFacilitator.dirty;l||(l=e?!o.c0(i,s):!o.c1(i,s)),l||(l=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),l&&(o.c2(i,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,f){const _=h.context,x=_.gl,T=h.transform,P=$t.unblended,A=new ot(x.LEQUAL,ot.ReadWrite,[0,1]),k=f.sourceCache.getRenderableTiles(),B=h.useProgram("terrainDepth");_.bindFramebuffer.set(f.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.b7.transparent,depth:1});for(const O of k){const H=f.getTerrainMesh(O.tileID),q=f.getTerrainData(O.tileID),W=T.getProjectionData({overscaledTileID:O.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),K={u_ele_delta:f.getMeshFrameDelta(T.zoom)};B.draw(_,x.TRIANGLES,A,dt.disabled,P,St.backCCW,K,q,W,"terrain",H.vertexBuffer,H.indexBuffer,H.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,f){const _=h.context,x=_.gl,T=h.transform,P=$t.unblended,A=new ot(x.LEQUAL,ot.ReadWrite,[0,1]),k=f.getCoordsTexture(),B=f.sourceCache.getRenderableTiles(),O=h.useProgram("terrainCoords");_.bindFramebuffer.set(f.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.b7.transparent,depth:1}),f.coordsIndex=[];for(const H of B){const q=f.getTerrainMesh(H.tileID),W=f.getTerrainData(H.tileID);_.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,k.texture);const K={u_terrain_coords_id:(255-f.coordsIndex.length)/255,u_texture:0,u_ele_delta:f.getMeshFrameDelta(T.zoom)},te=T.getProjectionData({overscaledTileID:H.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});O.draw(_,x.TRIANGLES,A,dt.disabled,P,St.backCCW,K,W,te,"terrain",q.vertexBuffer,q.indexBuffer,q.segments),f.coordsIndex.push(H.tileID.key)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain))}renderLayer(e,i,s,l,h){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(l||[]).length)&&(this.id=s.id,o.c3(s)?function(f,_,x,T,P,A){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:k}=A,B=dt.disabled,O=f.colorModeForRenderPass();(x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(H,q,W,K,te,ee,ie,se,re){const pe=q.transform,Me=q.style.map.terrain,xe=te==="map",ve=ee==="map";for(const be of H){const je=K.getTile(be),Fe=je.getBucket(W);if(!Fe||!Fe.text||!Fe.text.segments.get().length)continue;const Ee=o.ak(Fe.textSizeData,pe.zoom),He=o.az(je,1,q.transform.zoom),pt=Qe(xe,q.transform,He),Pt=W.layout.get("icon-text-fit")!=="none"&&Fe.hasIconData();if(Ee){const ni=Math.pow(2,pe.zoom-je.tileID.overscaledZ),Gt=Me?(ai,si)=>Me.getElevation(be,ai,si):null;Xu(Fe,xe,ve,re,pe,pt,ni,Ee,Pt,o.aA(pe,je,ie,se),be.toUnwrapped(),Gt)}}}(T,f,x,_,x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),P),x.paint.get("icon-opacity").constantOr(1)!==0&&$o(f,_,x,T,!1,x.paint.get("icon-translate"),x.paint.get("icon-translate-anchor"),x.layout.get("icon-rotation-alignment"),x.layout.get("icon-pitch-alignment"),x.layout.get("icon-keep-upright"),B,O,k),x.paint.get("text-opacity").constantOr(1)!==0&&$o(f,_,x,T,!0,x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.layout.get("text-keep-upright"),B,O,k),_.map.showCollisionBoxes&&(ic(f,_,x,T,!0),ic(f,_,x,T,!1))}(e,i,s,l,this.style.placement.variableOffsets,h):o.c4(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=P,k=x.paint.get("circle-opacity"),B=x.paint.get("circle-stroke-width"),O=x.paint.get("circle-stroke-opacity"),H=!x.layout.get("circle-sort-key").isConstant();if(k.constantOr(1)===0&&(B.constantOr(1)===0||O.constantOr(1)===0))return;const q=f.context,W=q.gl,K=f.transform,te=f.getDepthModeForSublayer(0,ot.ReadOnly),ee=dt.disabled,ie=f.colorModeForRenderPass(),se=[],re=K.getCircleRadiusCorrection();for(let pe=0;pe<T.length;pe++){const Me=T[pe],xe=_.getTile(Me),ve=xe.getBucket(x);if(!ve)continue;const be=x.paint.get("circle-translate"),je=x.paint.get("circle-translate-anchor"),Fe=o.aA(K,xe,be,je),Ee=ve.programConfigurations.get(x.id),He=f.useProgram("circle",Ee),pt=ve.layoutVertexBuffer,Pt=ve.indexBuffer,ni=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Me),Gt={programConfiguration:Ee,program:He,layoutVertexBuffer:pt,indexBuffer:Pt,uniformValues:Rs(f,xe,x,Fe,re),terrainData:ni,projectionData:K.getProjectionData({overscaledTileID:Me,applyGlobeMatrix:!A,applyTerrainMatrix:!0})};if(H){const ai=ve.segments.get();for(const si of ai)se.push({segments:new o.aJ([si]),sortKey:si.sortKey,state:Gt})}else se.push({segments:ve.segments,sortKey:0,state:Gt})}H&&se.sort((pe,Me)=>pe.sortKey-Me.sortKey);for(const pe of se){const{programConfiguration:Me,program:xe,layoutVertexBuffer:ve,indexBuffer:be,uniformValues:je,terrainData:Fe,projectionData:Ee}=pe.state;xe.draw(q,W.TRIANGLES,te,ee,ie,St.backCCW,je,Fe,Ee,x.id,ve,be,pe.segments,x.paint,f.transform.zoom,Me)}}(e,i,s,l,h):o.c5(s)?function(f,_,x,T,P){if(x.paint.get("heatmap-opacity")===0)return;const A=f.context,{isRenderingToTexture:k,isRenderingGlobe:B}=P;if(f.style.map.terrain){for(const O of T){const H=_.getTile(O);_.hasRenderableParent(O)||(f.renderPass==="offscreen"?Go(f,H,x,O,B):f.renderPass==="translucent"&&rc(f,x,O,k,B))}A.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(O,H,q,W){const K=O.context,te=K.gl,ee=O.transform,ie=dt.disabled,se=new $t([te.ONE,te.ONE],o.b7.transparent,[!0,!0,!0,!0]);(function(re,pe,Me){const xe=re.gl;re.activeTexture.set(xe.TEXTURE1),re.viewport.set([0,0,pe.width/4,pe.height/4]);let ve=Me.heatmapFbos.get(o.bW);ve?(xe.bindTexture(xe.TEXTURE_2D,ve.colorAttachment.get()),re.bindFramebuffer.set(ve.framebuffer)):(ve=qo(re,pe.width/4,pe.height/4),Me.heatmapFbos.set(o.bW,ve))})(K,O,q),K.clear({color:o.b7.transparent});for(let re=0;re<W.length;re++){const pe=W[re];if(H.hasRenderableParent(pe))continue;const Me=H.getTile(pe),xe=Me.getBucket(q);if(!xe)continue;const ve=xe.programConfigurations.get(q.id),be=O.useProgram("heatmap",ve),je=ee.getProjectionData({overscaledTileID:pe,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Fe=ee.getCircleRadiusCorrection();be.draw(K,te.TRIANGLES,ot.disabled,ie,se,St.backCCW,ma(Me,ee.zoom,q.paint.get("heatmap-intensity"),Fe),null,je,q.id,xe.layoutVertexBuffer,xe.indexBuffer,xe.segments,q.paint,ee.zoom,ve)}K.viewport.set([0,0,O.width,O.height])}(f,_,x,T):f.renderPass==="translucent"&&function(O,H){const q=O.context,W=q.gl;q.setColorMode(O.colorModeForRenderPass());const K=H.heatmapFbos.get(o.bW);K&&(q.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,K.colorAttachment.get()),q.activeTexture.set(W.TEXTURE1),nc(q,H).bind(W.LINEAR,W.CLAMP_TO_EDGE),O.useProgram("heatmapTexture").draw(q,W.TRIANGLES,ot.disabled,dt.disabled,O.colorModeForRenderPass(),St.disabled,Eu(O,H,0,1),null,null,H.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,H.paint,O.transform.zoom))}(f,x)}(e,i,s,l,h):o.c6(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=P,k=x.paint.get("line-opacity"),B=x.paint.get("line-width");if(k.constantOr(1)===0||B.constantOr(1)===0)return;const O=f.getDepthModeForSublayer(0,ot.ReadOnly),H=f.colorModeForRenderPass(),q=x.paint.get("line-dasharray"),W=x.paint.get("line-pattern"),K=W.constantOr(1),te=x.paint.get("line-gradient"),ee=x.getCrossfadeParameters(),ie=K?"linePattern":q?"lineSDF":te?"lineGradient":"line",se=f.context,re=se.gl,pe=f.transform;let Me=!0;for(const xe of T){const ve=_.getTile(xe);if(K&&!ve.patternsLoaded())continue;const be=ve.getBucket(x);if(!be)continue;const je=be.programConfigurations.get(x.id),Fe=f.context.program.get(),Ee=f.useProgram(ie,je),He=Me||Ee.program!==Fe,pt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(xe),Pt=W.constantOr(null);if(Pt&&ve.imageAtlas){const Ht=ve.imageAtlas,Dt=Ht.patternPositions[Pt.to.toString()],Di=Ht.patternPositions[Pt.from.toString()];Dt&&Di&&je.setConstantPatternPositions(Dt,Di)}const ni=pe.getProjectionData({overscaledTileID:xe,applyGlobeMatrix:!A,applyTerrainMatrix:!0}),Gt=pe.getPixelScale(),ai=K?Lu(f,ve,x,Gt,ee):q?Bu(f,ve,x,Gt,q,ee):te?Du(f,ve,x,Gt,be.lineClipsArray.length):Ds(f,ve,x,Gt);if(K)se.activeTexture.set(re.TEXTURE0),ve.imageAtlasTexture.bind(re.LINEAR,re.CLAMP_TO_EDGE),je.updatePaintBuffers(ee);else if(q&&(He||f.lineAtlas.dirty))se.activeTexture.set(re.TEXTURE0),f.lineAtlas.bind(se);else if(te){const Ht=be.gradients[x.id];let Dt=Ht.texture;if(x.gradientVersion!==Ht.version){let Di=256;if(x.stepInterpolant){const Zi=_.getSource().maxzoom,Ki=xe.canonical.z===Zi?Math.ceil(1<<f.transform.maxZoom-xe.canonical.z):1;Di=o.ae(o.bX(be.maxLineLength/o.Z*1024*Ki),256,se.maxTextureSize)}Ht.gradient=o.bY({expression:x.gradientExpression(),evaluationKey:"lineProgress",resolution:Di,image:Ht.gradient||void 0,clips:be.lineClipsArray}),Ht.texture?Ht.texture.update(Ht.gradient):Ht.texture=new qt(se,Ht.gradient,re.RGBA),Ht.version=x.gradientVersion,Dt=Ht.texture}se.activeTexture.set(re.TEXTURE0),Dt.bind(x.stepInterpolant?re.NEAREST:re.LINEAR,re.CLAMP_TO_EDGE)}const si=f.stencilModeForClipping(xe);Ee.draw(se,re.TRIANGLES,O,si,H,St.disabled,ai,pt,ni,x.id,be.layoutVertexBuffer,be.indexBuffer,be.segments,x.paint,f.transform.zoom,je,be.layoutVertexBuffer2),Me=!1}}(e,i,s,l,h):o.c7(s)?function(f,_,x,T,P){const A=x.paint.get("fill-color"),k=x.paint.get("fill-opacity");if(k.constantOr(1)===0)return;const{isRenderingToTexture:B}=P,O=f.colorModeForRenderPass(),H=x.paint.get("fill-pattern"),q=f.opaquePassEnabledForLayer()&&!H.constantOr(1)&&A.constantOr(o.b7.transparent).a===1&&k.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===q){const W=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?ot.ReadWrite:ot.ReadOnly);js(f,_,x,T,W,O,!1,B)}if(f.renderPass==="translucent"&&x.paint.get("fill-antialias")){const W=f.getDepthModeForSublayer(x.getPaintProperty("fill-outline-color")?2:0,ot.ReadOnly);js(f,_,x,T,W,O,!0,B)}}(e,i,s,l,h):o.c8(s)?function(f,_,x,T,P){const A=x.paint.get("fill-extrusion-opacity");if(A===0)return;const{isRenderingToTexture:k}=P;if(f.renderPass==="translucent"){const B=new ot(f.context.gl.LEQUAL,ot.ReadWrite,f.depthRangeFor3D);if(A!==1||x.paint.get("fill-extrusion-pattern").constantOr(1))Ns(f,_,x,T,B,dt.disabled,$t.disabled,k),Ns(f,_,x,T,B,f.stencilModeFor3D(),f.colorModeForRenderPass(),k);else{const O=f.colorModeForRenderPass();Ns(f,_,x,T,B,dt.disabled,O,k)}}}(e,i,s,l,h):o.c9(s)?function(f,_,x,T,P){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=P,k=f.context,B=f.style.projection.useSubdivision,O=f.getDepthModeForSublayer(0,ot.ReadOnly),H=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function(q,W,K,te,ee,ie,se){const re=q.context,pe=re.gl;for(const Me of K){const xe=W.getTile(Me),ve=xe.dem;if(!ve||!ve.data||!xe.needsHillshadePrepare)continue;const be=ve.dim,je=ve.stride,Fe=ve.getPixels();if(re.activeTexture.set(pe.TEXTURE1),re.pixelStoreUnpackPremultiplyAlpha.set(!1),xe.demTexture=xe.demTexture||q.getTileTexture(je),xe.demTexture){const He=xe.demTexture;He.update(Fe,{premultiply:!1}),He.bind(pe.NEAREST,pe.CLAMP_TO_EDGE)}else xe.demTexture=new qt(re,Fe,pe.RGBA,{premultiply:!1}),xe.demTexture.bind(pe.NEAREST,pe.CLAMP_TO_EDGE);re.activeTexture.set(pe.TEXTURE0);let Ee=xe.fbo;if(!Ee){const He=new qt(re,{width:be,height:be,data:null},pe.RGBA);He.bind(pe.LINEAR,pe.CLAMP_TO_EDGE),Ee=xe.fbo=re.createFramebuffer(be,be,!0,!1),Ee.colorAttachment.set(He.texture)}re.bindFramebuffer.set(Ee.framebuffer),re.viewport.set([0,0,be,be]),q.useProgram("hillshadePrepare").draw(re,pe.TRIANGLES,ee,ie,se,St.disabled,Sd(xe.tileID,ve),null,null,te.id,q.rasterBoundsBuffer,q.quadTriangleIndexBuffer,q.rasterBoundsSegments),xe.needsHillshadePrepare=!1}})(f,_,T,x,O,dt.disabled,H),k.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(B){const[q,W,K]=f.stencilConfigForOverlapTwoPass(T);ac(f,_,x,K,q,O,H,!1,A),ac(f,_,x,K,W,O,H,!0,A)}else{const[q,W]=f.getStencilConfigForOverlapAndUpdateStencilID(T);ac(f,_,x,W,q,O,H,!1,A)}}(e,i,s,l,h):o.ca(s)?function(f,_,x,T,P){if(f.renderPass!=="translucent"||x.paint.get("raster-opacity")===0||!T.length)return;const{isRenderingToTexture:A}=P,k=_.getSource(),B=f.style.projection.useSubdivision;if(k instanceof De)Ho(f,_,x,T,null,!1,!1,k.tileCoords,k.flippedWindingOrder,A);else if(B){const[O,H,q]=f.stencilConfigForOverlapTwoPass(T);Ho(f,_,x,q,O,!1,!0,Zs,!1,A),Ho(f,_,x,q,H,!0,!0,Zs,!1,A)}else{const[O,H]=f.getStencilConfigForOverlapAndUpdateStencilID(T);Ho(f,_,x,H,O,!1,!0,Zs,!1,A)}}(e,i,s,l,h):o.cb(s)?function(f,_,x,T,P){const A=x.paint.get("background-color"),k=x.paint.get("background-opacity");if(k===0)return;const{isRenderingToTexture:B}=P,O=f.context,H=O.gl,q=f.style.projection,W=f.transform,K=W.tileSize,te=x.paint.get("background-pattern");if(f.isPatternMissing(te))return;const ee=!te&&A.a===1&&k===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==ee)return;const ie=dt.disabled,se=f.getDepthModeForSublayer(0,ee==="opaque"?ot.ReadWrite:ot.ReadOnly),re=f.colorModeForRenderPass(),pe=f.useProgram(te?"backgroundPattern":"background"),Me=T||oe(W,{tileSize:K,terrain:f.style.map.terrain});te&&(O.activeTexture.set(H.TEXTURE0),f.imageManager.bind(f.context));const xe=x.getCrossfadeParameters();for(const ve of Me){const be=W.getProjectionData({overscaledTileID:ve,applyGlobeMatrix:!B,applyTerrainMatrix:!0}),je=te?Cd(k,f,te,{tileID:ve,tileSize:K},xe):Pd(k,A),Fe=f.style.map.terrain&&f.style.map.terrain.getTerrainData(ve),Ee=q.getMeshFromTileID(O,ve.canonical,!1,!0,"raster");pe.draw(O,H.TRIANGLES,se,ie,re,St.backCCW,je,Fe,be,x.id,Ee.vertexBuffer,Ee.indexBuffer,Ee.segments)}}(e,0,s,l,h):o.cc(s)&&function(f,_,x,T){const{isRenderingGlobe:P}=T,A=f.context,k=x.implementation,B=f.style.projection,O=f.transform,H=O.getProjectionDataForCustomLayer(P),q={farZ:O.farZ,nearZ:O.nearZ,fov:O.fov*Math.PI/180,modelViewProjectionMatrix:O.modelViewProjectionMatrix,projectionMatrix:O.projectionMatrix,shaderData:{variantName:B.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
741
741
  uniform mat4 u_projection_matrix;
742
- ${B.shaderPreludeCode.vertexSource}`,define:B.shaderDefine},defaultProjectionData:H},W=k.renderingMode?k.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=k.prerender;K&&(f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),K.call(k,A.gl,q),A.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),A.setStencilMode(dt.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,ot.ReadOnly);A.setDepthMode(K),k.render(A.gl,q),A.setDirty(),f.setBaseState(),A.bindFramebuffer.set(null)}}(e,0,s,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!i||!s}useProgram(e,i,s=!1,l=[]){this.cache=this.cache||{};const h=!!this.style.map.terrain,f=this.style.projection,_=s?dr.projectionMercator:f.shaderPreludeCode,x=s?ua:f.shaderDefine,T=e+(i?i.cacheKey:"")+`/${s?Mt:f.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(h?"/terrain":"")+(l?`/${l.join("/")}`:"");return this.cache[T]||(this.cache[T]=new Io(this.context,dr[e],i,Nu[e],this._showOverdrawInspector,h,_,x,l)),this.cache[T]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new qt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:i}=this.context.gl;return this.width!==e||this.height!==i}}function Us(u,e){let i,s=!1,l=null,h=null;const f=()=>{l=null,s&&(u.apply(h,i),l=setTimeout(f,e),s=!1)};return(..._)=>(s=!0,h=this,i=_,l||f(),l)}class lc{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let s;return i.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(s=l)}),(s&&s[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:s,pitch:+(i[4]||0)}),!0},this._updateHashUnthrottled=()=>{const i=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,i)},this._removeHash=()=>{const i=this._getCurrentHash();if(i.length===0)return;const s=i.join("/");let l=s;l.split("&").length>0&&(l=l.split("&")[0]),this._hashName&&(l=`${this._hashName}=${s}`);let h=window.location.hash.replace(l,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let f=window.location.href.replace(/(#.+)?$/,h);f=f.replace("&&","&"),window.history.replaceState(window.history.state,null,f)},this._updateHash=Us(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,l=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,l),f=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,x=this._map.getBearing(),T=this._map.getPitch();let P="";if(P+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(x||T)&&(P+="/"+Math.round(10*x)/10),T&&(P+=`/${Math.round(T)}`),this._hashName){const A=this._hashName;let k=!1;const B=window.location.hash.slice(1).split("&").map(O=>{const H=O.split("=")[0];return H===A?(k=!0,`${H}=${P}`):O}).filter(O=>O);return k||B.push(`${A}=${P}`),`#${B.join("&")}`}return`#${P}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new o.Q(+e[2],+e[1])}catch{return!1}const i=+e[0],s=+(e[3]||0),l=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&s>=-180&&s<=180&&l>=this._map.getMinPitch()&&l<=this._map.getMaxPitch()}}const gn={linearity:.3,easing:o.cd(0,0,.3,1)},cc=o.e({deceleration:2500,maxSpeed:1400},gn),$s=o.e({deceleration:20,maxSpeed:1400},gn),uc=o.e({deceleration:1e3,maxSpeed:360},gn),eh=o.e({deceleration:1e3,maxSpeed:90},gn),th=o.e({deceleration:1e3,maxSpeed:360},gn);class ih{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ke.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=ke.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)i.zoom+=h.zoomDelta||0,i.bearing+=h.bearingDelta||0,i.pitch+=h.pitchDelta||0,i.roll+=h.rollDelta||0,h.panDelta&&i.pan._add(h.panDelta),h.around&&(i.around=h.around),h.pinchAround&&(i.pinchAround=h.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(i.pan.mag()){const h=Ya(i.pan.mag(),s,o.e({},cc,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,Ka(l,h)}if(i.zoom){const h=Ya(i.zoom,s,$s);l.zoom=this._map.transform.zoom+h.amount,Ka(l,h)}if(i.bearing){const h=Ya(i.bearing,s,uc);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),Ka(l,h)}if(i.pitch){const h=Ya(i.pitch,s,eh);l.pitch=this._map.transform.pitch+h.amount,Ka(l,h)}if(i.roll){const h=Ya(i.roll,s,th);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),Ka(l,h)}if(l.zoom||l.bearing){const h=i.pinchAround===void 0?i.around:i.pinchAround;l.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),o.e(l,{noMoveStart:!0})}}function Ka(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function Ya(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ae(u*l/(e/1e3),-s,s),_=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*_,amount:f*(_/2)}}class Ri extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s,l={}){s=s instanceof MouseEvent?s:new MouseEvent(e,s);const h=le.mousePos(i.getCanvas(),s),f=i.unproject(h);super(e,o.e({point:h,lngLat:f,originalEvent:s},l)),this._defaultPrevented=!1,this.target=i}}class Ja extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){const l=e==="touchend"?s.changedTouches:s.touches,h=le.touchPos(i.getCanvasContainer(),l),f=h.map(x=>i.unproject(x)),_=h.reduce((x,T,P,A)=>x.add(T.div(A.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class hc extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class rh{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new hc(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new Ri(e.type,this._map,e))}mouseup(e){this._map.fire(new Ri(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new Ri(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Ri(e.type,this._map,e))}mouseover(e){this._map.fire(new Ri(e.type,this._map,e))}mouseout(e){this._map.fire(new Ri(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Ja(e.type,this._map,e))}touchmove(e){this._map.fire(new Ja(e.type,this._map,e))}touchend(e){this._map.fire(new Ja(e.type,this._map,e))}touchcancel(e){this._map.fire(new Ja(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class nh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Ri(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ri("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Ri(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Qa{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(o.P.convert(e),this._map.terrain)}}class dc{constructor(e,i){this._map=e,this._tr=new Qa(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&e.button===0&&(le.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const s=i;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const l=this._startPos;this._lastPos=s,this._box||(this._box=le.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(l.x,s.x),f=Math.max(l.x,s.x),_=Math.min(l.y,s.y),x=Math.max(l.y,s.y);le.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),le.suppressClick(),s.x!==l.x||s.y!==l.y)return this._map.fire(new o.l("boxzoomend",{originalEvent:e})),{cameraAnimation:h=>h.fitScreenCoordinates(s,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(le.remove(this._box),this._box=null),le.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Yo(u,e){if(u.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${e.length}`);const i={};for(let s=0;s<u.length;s++)i[u[s].identifier]=e[s];return i}class ah{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(l){const h=new o.P(0,0);for(const f of l)h._add(f);return h.div(l.length)}(i),this.touches=Yo(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Yo(s,i);for(const h in this.touches){const f=l[h];(!f||f.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(e,i,s){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class es{constructor(e){this.singleTap=new ah(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,i,s){this.singleTap.touchstart(e,i,s)}touchmove(e,i,s){this.singleTap.touchmove(e,i,s)}touchend(e,i,s){const l=this.singleTap.touchend(e,i,s);if(l){const h=e.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(l)<30;if(h&&f||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class sh{constructor(e){this._tr=new Qa(e),this._zoomIn=new es({numTouches:1,numTaps:2}),this._zoomOut=new es({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,s){this._zoomIn.touchstart(e,i,s),this._zoomOut.touchstart(e,i,s)}touchmove(e,i,s){this._zoomIn.touchmove(e,i,s),this._zoomOut.touchmove(e,i,s)}touchend(e,i,s){const l=this._zoomIn.touchend(e,i,s),h=this._zoomOut.touchend(e,i,s),f=this._tr;return l?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom-1,around:f.unproject(h)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ar{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const i=this._moveFunction(...e);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(e,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,i){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const l=Array.isArray(i)?i[0]:i;return!this._moved&&l.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=l,this._move(s,l))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&le.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Qr={0:1,2:2};class ts{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=le.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=Qr[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return le.mouseButton(e)===this._eventButton}}class en{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class is{constructor(e=new ts({checkCorrectEvent:()=>!0}),i=new en){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(e,i,s){return e instanceof MouseEvent?i(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?s(e):void 0}startMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.startMove(i),i=>this.oneFingerTouchMoveStateManager.startMove(i))}endMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.endMove(i),i=>this.oneFingerTouchMoveStateManager.endMove(i))}isValidStartEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidStartEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidStartEvent(i))}isValidMoveEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidMoveEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(i))}isValidEndEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidEndEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidEndEvent(i))}}const Jo=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Bd{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,i,s){return this._calculateTransform(e,i,s)}touchmove(e,i,s){if(this._active){if(!this._shouldBePrevented(s.length))return e.preventDefault(),this._calculateTransform(e,i,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,i,s){this._calculateTransform(e,i,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,s){s.length>0&&(this._active=!0);const l=Yo(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const P=l[T],A=this._touches[T];A&&(h._add(P),f._add(P.sub(A)),_++,l[T]=P)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const x=f.div(_);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class pc{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,i,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,s){if(!this._firstTwoTouches)return;e.preventDefault();const[l,h]=this._firstTwoTouches,f=Qo(s,i,l),_=Qo(s,i,h);if(!f||!_)return;const x=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],x,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=Qo(s,i,l),_=Qo(s,i,h);f&&_||(this._active&&le.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Qo(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function fc(u,e){return Math.log(u/e)/Math.LN2}class rs extends pc{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){const s=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(fc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:fc(this._distance,s),pinchAround:i}}}function _n(u,e){return 180*u.angleWith(e)/Math.PI}class $e extends pc{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i,s){const l=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:_n(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=_n(e,this._startVector);return Math.abs(s)<i}}function el(u){return Math.abs(u.y)>Math.abs(u.x)}class tl extends pc{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,i,s){super.touchstart(e,i,s),this._currentTouchCount=s.length}_start(e){this._lastPoints=e,el(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const l=e[0].sub(this._lastPoints[0]),h=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,h,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(l.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,s){if(this._valid!==void 0)return this._valid;const l=e.mag()>=2,h=i.mag()>=2;if(!l&&!h)return;if(!l||!h)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=e.y>0==i.y>0;return el(e)&&el(i)&&f}}const oh={panStep:100,bearingStep:15,pitchStep:10};class ns{constructor(e){this._tr=new Qa(e);const i=oh;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,s=0,l=0,h=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),h=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),h=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,l=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Gs,zoom:i?Math.round(x.zoom)+i*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:x.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Gs(u){return u*(2-u)}const mc=4.000244140625;class vt{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new Qa(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const s=ke.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%mc==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(l*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=le.mousePos(this._map.getCanvas(),e),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(o.Q.convert(s.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>mc?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const T=typeof this._targetZoom!="number"?e.scale:o.ac(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),o.ah(T*x)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,s=this._startZoom,l=this._easing;let h,f=!1;if(this._type==="wheel"&&s&&l){const _=ke.now()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),T=l(x);h=o.B.number(s,i,T),x<1?this._frameId||(this._frameId=!0):f=!0}else h=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=h,{noInertia:!0,needsRenderFrame:!f,zoomDelta:h-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=o.cf;if(this._prevEase){const s=this._prevEase,l=(ke.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=o.cd(f,_,.25,1)}return this._prevEase={start:ke.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class il{constructor(e,i){this._clickZoom=e,this._tapZoom=i}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Fd{constructor(e){this._tr=new Qa(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class gc{constructor(){this._tap=new es({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,i,s){if(!this._swipePoint)if(this._tapTime){const l=i[0],h=e.timeStamp-this._tapTime<500,f=this._tapPoint.dist(l)<30;h&&f?s.length>0&&(this._swipePoint=l,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(e,i,s)}touchmove(e,i,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const l=i[0],h=l.y-this._swipePoint.y;return this._swipePoint=l,e.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(e,i,s)}touchend(e,i,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const l=this._tap.touchend(e,i,s);l&&(this._tapTime=e.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class lh{constructor(e,i,s){this._el=e,this._mousePan=i,this._touchPan=s}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ch{constructor(e,i,s,l){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=s,this._mouseRoll=l}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class _c{constructor(e,i,s,l){this._el=e,this._touchZoom=i,this._touchRotate=s,this._tapDragZoom=l,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class rl{constructor(e,i){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=le.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),l=document.createElement("div");l.className="maplibregl-desktop-message",l.textContent=i,this._container.appendChild(l);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=s,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(le.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new o.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const qs=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Od extends o.l{}function nl(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class jd{constructor(e,i){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,h)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},x={},T={};for(const{handlerName:k,handler:B,allowed:O}of this._handlers){if(!B.isEnabled())continue;let H;if(this._blockedByActive(T,O,k))B.reset();else if(B[h||l.type]){if(o.cg(l,h||l.type)){const q=le.mousePos(this._map.getCanvas(),l);H=B[h||l.type](l,q)}else if(o.ch(l,h||l.type)){const q=this._getMapTouches(l.touches),W=le.touchPos(this._map.getCanvas(),q);H=B[h||l.type](l,W,q)}else o.ci(h||l.type)||(H=B[h||l.type](l));this.mergeHandlerResult(_,x,H,k,f),H&&H.needsRenderFrame&&this._triggerRenderFrame()}(H||B.isActive())&&(T[k]=B)}const P={};for(const k in this._previousActiveHandlers)T[k]||(P[k]=f);this._previousActiveHandlers=T,(Object.keys(P).length||nl(_))&&(this._changes.push([_,x,P]),this._triggerRenderFrame()),(Object.keys(T).length||nl(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=_;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ih(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,h,f]of this._listeners)le.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)le.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new rh(i,e));const l=i.boxZoom=new dc(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new rl(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new sh(i),_=new Fd(i);i.doubleClickZoom=new il(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new gc;this._add("tapDragZoom",x);const T=i.touchPitch=new tl(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const P=()=>i.project(i.getCenter()),A=function({enable:ee,clickTolerance:ie,aroundCenter:se=!0,minPixelCenterThreshold:re=100,rotateDegreesPerPixelMoved:pe=.8},Me){const xe=new ts({checkCorrectEvent:ve=>le.mouseButton(ve)===0&&ve.ctrlKey||le.mouseButton(ve)===2&&!ve.ctrlKey});return new ar({clickTolerance:ie,move:(ve,be)=>{const je=Me();if(se&&Math.abs(je.y-ve.y)>re)return{bearingDelta:o.ce(new o.P(ve.x,be.y),be,je)};let Fe=(be.x-ve.x)*pe;return se&&be.y<je.y&&(Fe=-Fe),{bearingDelta:Fe}},moveStateManager:xe,enable:ee,assignEvents:Jo})}(e,P),k=function({enable:ee,clickTolerance:ie,pitchDegreesPerPixelMoved:se=-.5}){const re=new ts({checkCorrectEvent:pe=>le.mouseButton(pe)===0&&pe.ctrlKey||le.mouseButton(pe)===2});return new ar({clickTolerance:ie,move:(pe,Me)=>({pitchDelta:(Me.y-pe.y)*se}),moveStateManager:re,enable:ee,assignEvents:Jo})}(e),B=function({enable:ee,clickTolerance:ie,rollDegreesPerPixelMoved:se=.3},re){const pe=new ts({checkCorrectEvent:Me=>le.mouseButton(Me)===2&&Me.ctrlKey});return new ar({clickTolerance:ie,move:(Me,xe)=>{const ve=re();let be=(xe.x-Me.x)*se;return xe.y<ve.y&&(be=-be),{rollDelta:be}},moveStateManager:pe,enable:ee,assignEvents:Jo})}(e,P);i.dragRotate=new ch(e,A,k,B),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",k,["mouseRotate","mouseRoll"]),this._add("mouseRoll",B,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:ee,clickTolerance:ie}){const se=new ts({checkCorrectEvent:re=>le.mouseButton(re)===0&&!re.ctrlKey});return new ar({clickTolerance:ie,move:(re,pe)=>({around:pe,panDelta:pe.sub(re)}),activateOnStart:!0,moveStateManager:se,enable:ee,assignEvents:Jo})}(e),H=new Bd(e,i);i.dragPan=new lh(s,O,H),this._add("mousePan",O),this._add("touchPan",H,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new $e,W=new rs;i.touchZoomRotate=new _c(s,W,q,x),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new vt(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const te=i.keyboard=new ns(i);this._add("keyboard",te),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new nh(i))}_add(e,i,s){this._handlers.push({handlerName:e,handler:i,allowed:s}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(const{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!qs(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,s){for(const l in e)if(l!==s&&(!i||i.indexOf(l)<0))return!0;return!1}_getMapTouches(e){const i=[];for(const s of e)this._el.contains(s.target)&&i.push(s);return i}mergeHandlerResult(e,i,s,l,h){if(!s)return;o.e(e,s);const f={handlerName:l,originalEvent:s.originalEvent||h};s.zoomDelta!==void 0&&(i.zoom=f),s.panDelta!==void 0&&(i.drag=f),s.rollDelta!==void 0&&(i.roll=f),s.pitchDelta!==void 0&&(i.pitch=f),s.bearingDelta!==void 0&&(i.rotate=f)}_applyChanges(){const e={},i={},s={};for(const[l,h,f]of this._changes)l.panDelta&&(e.panDelta=(e.panDelta||new o.P(0,0))._add(l.panDelta)),l.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+l.pitchDelta),l.rollDelta&&(e.rollDelta=(e.rollDelta||0)+l.rollDelta),l.around!==void 0&&(e.around=l.around),l.pinchAround!==void 0&&(e.pinchAround=l.pinchAround),l.noInertia&&(e.noInertia=l.noInertia),o.e(i,h),o.e(s,f);this._updateMapTransform(e,i,s),this._changes=[]}_updateMapTransform(e,i,s){const l=this._map,h=l._getTransformForUpdate(),f=l.terrain;if(!(nl(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:T,pitchDelta:P,rollDelta:A,around:k,pinchAround:B}=e;B!==void 0&&(k=B),k=k||l.transform.centerPoint,f&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const O={panDelta:_,zoomDelta:x,rollDelta:A,pitchDelta:P,bearingDelta:T,around:k};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const H=k.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?k.sub(_):k);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(O,h,H):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(O,h,H))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._map.cameraHelper.handleMapControlsPan(O,h,H)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=qs(this._eventsInProgress),h=qs(e),f={};for(const A in e){const{originalEvent:k}=e[A];this._eventsInProgress[A]||(f[`${A}start`]=k),this._eventsInProgress[A]=e[A]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const A in f)this._fireEvent(A,f[A]);h&&this._fireEvent("move",h.originalEvent);for(const A in e){const{originalEvent:k}=e[A];this._fireEvent(A,k)}const _={};let x;for(const A in this._eventsInProgress){const{handlerName:k,originalEvent:B}=this._eventsInProgress[A];this._handlersById[k].isActive()||(delete this._eventsInProgress[A],x=i[k]||B,_[`${A}end`]=x)}for(const A in _)this._fireEvent(A,_[A]);const T=qs(this._eventsInProgress),P=(l||h)&&!T;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const A=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&A.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(A)}if(s&&P){this._updatingCamera=!0;const A=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),k=B=>B!==0&&-this._bearingSnap<B&&B<this._bearingSnap;!A||!A.essential&&ke.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:x})),k(this._map.getBearing())&&this._map.resetNorth()):(k(A.bearing||this._map.getBearing())&&(A.bearing=0),A.freezeElevation=!0,this._map.easeTo(A,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new o.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Od("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Nd extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((ke.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(l)),l<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,i){e.apply(this.transform),this.transform=e,this.cameraHelper=i}getCenter(){return new o.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,s){return e=o.P.convert(e).mult(-1),this.panTo(this.transform.center,o.e({offset:e},i),s)}panTo(e,i,s){return this.easeTo(o.e({center:e},i),s)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(e,i,s){return this.easeTo(o.e({zoom:e},i),s)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)).fire(new o.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(e,i,s){return this.easeTo(o.e({bearing:e},i),s)}resetNorth(e,i){return this.rotateTo(0,o.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(o.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}getRoll(){return this.transform.roll}setRoll(e,i){return this.jumpTo({roll:e},i),this}cameraForBounds(e,i){e=Ut.convert(e).adjustAntiMeridian();const s=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,i)}_cameraForBoxAndBearing(e,i,s,l){const h={top:0,bottom:0,right:0,left:0};if(typeof(l=o.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const T=l.padding;l.padding={top:T,bottom:T,right:T,left:T}}const f=o.e(h,l.padding);l.padding=f;const _=this.transform,x=new Ut(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,x,s,_)}fitBounds(e,i,s){return this._fitInternal(this.cameraForBounds(e,i),i,s)}fitScreenCoordinates(e,i,s,l,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(o.P.convert(e)),this.transform.screenPointToLocation(o.P.convert(i)),s,l),l,h)}_fitInternal(e,i,s){return e?(delete(i=o.e(e,i)).padding,i.linear?this.easeTo(i,s):this.flyTo(i,s)):this}jumpTo(e,i){this.stop();const s=this._getTransformForUpdate();let l=!1,h=!1,f=!1;const _=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const x=s.zoom!==_;return"elevation"in e&&s.elevation!==+e.elevation&&s.setElevation(+e.elevation),"bearing"in e&&s.bearing!==+e.bearing&&(l=!0,s.setBearing(+e.bearing)),"pitch"in e&&s.pitch!==+e.pitch&&(h=!0,s.setPitch(+e.pitch)),"roll"in e&&s.roll!==+e.roll&&(f=!0,s.setRoll(+e.roll)),e.padding==null||s.isPaddingEqual(e.padding)||s.setPadding(e.padding),this._applyUpdatedTransform(s),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)),x&&this.fire(new o.l("zoomstart",i)).fire(new o.l("zoom",i)).fire(new o.l("zoomend",i)),l&&this.fire(new o.l("rotatestart",i)).fire(new o.l("rotate",i)).fire(new o.l("rotateend",i)),h&&this.fire(new o.l("pitchstart",i)).fire(new o.l("pitch",i)).fire(new o.l("pitchend",i)),f&&this.fire(new o.l("rollstart",i)).fire(new o.l("roll",i)).fire(new o.l("rollend",i)),this.fire(new o.l("moveend",i))}calculateCameraOptionsFromTo(e,i,s,l=0){const h=o.$.fromLngLat(e,i),f=o.$.fromLngLat(s,l),_=f.x-h.x,x=f.y-h.y,T=f.z-h.z,P=Math.hypot(_,x,T);if(P===0)throw new Error("Can't calculate camera options with same From and To");const A=Math.hypot(_,x),k=o.ah(this.transform.cameraToCenterDistance/P/this.transform.tileSize),B=180*Math.atan2(_,-x)/Math.PI;let O=180*Math.acos(A/P)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:k,pitch:O,bearing:B}}calculateCameraOptionsFromCameraLngLatAltRotation(e,i,s,l,h){const f=this.transform.calculateCenterFromCameraLngLatAlt(e,i,s,l);return{center:f.center,elevation:f.elevation,zoom:f.zoom,bearing:s,pitch:l,roll:h}}easeTo(e,i){this._stop(!1,e.easeId),((e=o.e({offset:[0,0],duration:500,easing:o.cf},e)).animate===!1||!e.essential&&ke.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,_="bearing"in e?this._normalizeBearing(e.bearing,l):l,x="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:s.padding,A=o.P.convert(e.offset);let k,B;e.around&&(k=o.Q.convert(e.around),B=s.locationToScreenPoint(k));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},H=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:T,padding:P,around:k,aroundPoint:B,offsetAsPoint:A,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||x!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(P),this._zooming=this._zooming||H.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,O),this.terrain&&this._prepareElevation(H.elevationCenter),this._ease(q=>{H.easeFunc(q),this.terrain&&!e.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},q=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,q)},e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new o.l("movestart",e)),this._zooming&&!s.zooming&&this.fire(new o.l("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new o.l("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new o.l("pitchstart",e)),this._rolling&&!s.rolling&&this.fire(new o.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(i-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(o.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:_,roll:x,pitch:T,bearing:P,elevation:A}=l(h);f&&h.setCenter(f),A!==void 0&&h.setElevation(A),_!==void 0&&h.setZoom(_),x!==void 0&&h.setRoll(x),T!==void 0&&h.setPitch(T),P!==void 0&&h.setBearing(P),s.apply(h)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new o.l("move",e)),this._zooming&&this.fire(new o.l("zoom",e)),this._rotating&&this.fire(new o.l("rotate",e)),this._pitching&&this.fire(new o.l("pitch",e)),this._rolling&&this.fire(new o.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const s=this._zooming,l=this._rotating,h=this._pitching,f=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,s&&this.fire(new o.l("zoomend",e)),l&&this.fire(new o.l("rotateend",e)),h&&this.fire(new o.l("pitchend",e)),f&&this.fire(new o.l("rollend",e)),this.fire(new o.l("moveend",e))}flyTo(e,i){if(!e.essential&&ke.prefersReducedMotion){const be=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(be,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cf},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,x="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,P="roll"in e?this._normalizeBearing(e.roll,f):f,A="padding"in e?e.padding:s.padding,k=o.P.convert(e.offset);let B=s.centerPoint.add(k);const O=s.screenPointToLocation(B),H=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:T,roll:P,padding:A,locationAtOffset:O,offsetAsPoint:k,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const W=Math.max(s.width,s.height),K=W/H.scaleOfZoom,te=H.pixelPathLength;typeof H.scaleOfMinZoom=="number"&&(q=Math.sqrt(W/H.scaleOfMinZoom/te*2));const ee=q*q;function ie(be){const je=(K*K-W*W+(be?-1:1)*ee*ee*te*te)/(2*(be?K:W)*ee*te);return Math.log(Math.sqrt(je*je+1)-je)}function se(be){return(Math.exp(be)-Math.exp(-be))/2}function re(be){return(Math.exp(be)+Math.exp(-be))/2}const pe=ie(!1);let Me=function(be){return re(pe)/re(pe+q*be)},xe=function(be){return W*((re(pe)*(se(je=pe+q*be)/re(je))-se(pe))/ee)/te;var je},ve=(ie(!0)-pe)/q;if(Math.abs(te)<2e-6||!isFinite(ve)){if(Math.abs(W-K)<1e-6)return this.easeTo(e,i);const be=K<W?-1:1;ve=Math.abs(Math.log(K/W))/q,xe=()=>0,Me=je=>Math.exp(be*q*je)}return e.duration="duration"in e?+e.duration:1e3*ve/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==x,this._pitching=T!==h,this._rolling=P!==f,this._padding=!s.isPaddingEqual(A),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(H.targetCenter),this._ease(be=>{const je=be*ve,Fe=1/Me(je),Ee=xe(je);this._rotating&&s.setBearing(o.B.number(l,x,be)),this._pitching&&s.setPitch(o.B.number(h,T,be)),this._rolling&&s.setRoll(o.B.number(f,P,be)),this._padding&&(s.interpolatePadding(_,A,be),B=s.centerPoint.add(k)),H.easeFunc(be,Fe,Ee,B),this.terrain&&!e.freezeElevation&&this._updateElevation(be),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const l=this._onEaseEnd;delete this._onEaseEnd,l.call(this,i)}return e||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(e,i,s){s.animate===!1||s.duration===0?(e(1),i()):(this._easeStart=ke.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=o.aL(e,-180,180);const s=Math.abs(e-i);return Math.abs(e-360-i)<s&&(e-=360),Math.abs(e+360-i)<s&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(o.Q.convert(e),this.transform.tileZoom):null}}const An={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Kt{constructor(e=An){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=le.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=le.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=le.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){le.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,i){const s=this._map._getUIString(`AttributionControl.${i}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const i=this._map.style.sourceCaches;for(const l in i){const h=i[l];if(h.used||h.usedForTerrain){const f=h.getSource();f.attribution&&e.indexOf(f.attribution)<0&&e.push(f.attribution)}}e=e.filter(l=>String(l).trim()),e.sort((l,h)=>l.length-h.length),e=e.filter((l,h)=>{for(let f=h+1;f<e.length;f++)if(e[f].indexOf(l)>=0)return!1;return!0});const s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=le.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Hs{constructor(e={}){this._updateCompact=()=>{const i=this._container.children;if(i.length){const s=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=le.create("div","maplibregl-ctrl");const i=le.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){le.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class yc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){const i=this._currentlyRunning,s=i?this._queue.concat(i):this._queue;for(const l of s)if(l.id===e)return void(l.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const s of i)if(!s.cancelled&&(s.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var uh=o.aG([{name:"a_pos3d",type:"Int16",components:3}]);class hh extends o.E{constructor(e){super(),this._lastTilesetChange=ke.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const s={};for(const l of oe(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))s[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.terrainRttPosMatrix32f=new Float64Array(16),o.bQ(l.terrainRttPosMatrix32f,0,o.Z,o.Z,0,0,1),this._tiles[l.key]=new Pn(l,this.tileSize),this._lastTilesetChange=ke.now());for(const l in this._tiles)s[l]||delete this._tiles[l]}freeRtt(e){for(const i in this._tiles){const s=this._tiles[i];(!e||s.tileID.equals(e)||s.tileID.isChildOf(e)||e.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,i){return i?this._getTerrainCoordsForTileRanges(e,i):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const s of this._renderableTilesKeys){const l=this._tiles[s].tileID,h=e.clone(),f=o.b2();if(l.canonical.equals(e.canonical))o.bQ(f,0,o.Z,o.Z,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,x=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,P,P,0,0,1),o.L(f,f,[-x*P,-T*P,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[x*P,T*P,0]),o.M(f,f,[1/2**_,1/2**_,0])}}h.terrainRttPosMatrix32f=new Float32Array(f),i[s]=h}return i}_getTerrainCoordsForTileRanges(e,i){const s={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID;if(!this._isWithinTileRanges(h,i))continue;const f=e.clone(),_=o.b2();if(h.canonical.z===e.canonical.z){const x=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bQ(_,0,o.Z,o.Z,0,0,1),o.L(_,_,[x*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const x=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>x<<x),P=h.canonical.y-(h.canonical.y>>x<<x),A=e.canonical.x-(h.canonical.x>>x),k=e.canonical.y-(h.canonical.y>>x),B=o.Z>>x;o.bQ(_,0,B,B,0,0,1),o.L(_,_,[-T*B+A*o.Z,-P*B+k*o.Z,0])}else{const x=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>x<<x),P=e.canonical.y-(e.canonical.y>>x<<x),A=(e.canonical.x>>x)-h.canonical.x,k=(e.canonical.y>>x)-h.canonical.y,B=o.Z<<x;o.bQ(_,0,B,B,0,0,1),o.L(_,_,[T*o.Z+A*B,P*o.Z+k*B,0])}f.terrainRttPosMatrix32f=new Float32Array(_),s[l]=f}return s}getSourceTile(e,i){const s=this.sourceCache._source;let l=e.overscaledZ-this.deltaZoom;if(l>s.maxzoom&&(l=s.maxzoom),l<s.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(l).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!h||!h.dem)&&i)for(;l>=s.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(e.scaledTo(l--).key);return h}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,i){return i[e.canonical.z]&&e.canonical.x>=i[e.canonical.z].minTileX&&e.canonical.x<=i[e.canonical.z].maxTileX&&e.canonical.y>=i[e.canonical.z].minTileY&&e.canonical.y<=i[e.canonical.z].maxTileY}}class dh{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new hh(i),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,s,l=o.Z){var h;if(!(i>=0&&i<l&&s>=0&&s<l))return 0;const f=this.getTerrainData(e),_=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const x=o.cj([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[x[0]*_.dim,x[1]*_.dim],P=Math.floor(T[0]),A=Math.floor(T[1]),k=T[0]-P,B=T[1]-A;return _.get(P,A)*(1-k)*(1-B)+_.get(P+1,A)*k*(1-B)+_.get(P,A+1)*(1-k)*B+_.get(P+1,A+1)*k*B}getElevationForLngLatZoom(e,i){if(!o.ck(i,e.wrap()))return 0;const{tileID:s,mercatorX:l,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(s,l%o.Z,h%o.Z,o.Z)}getElevation(e,i,s,l=o.Z){return this.getDEMElevation(e,i,s,l)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const l=this.painter.context,h=new o.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new qt(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new qt(l,new o.R({width:1,height:1}),l.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=o.ad([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const l=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new qt(l,i.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),i.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const l=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=l?h=e.canonical.z-l:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>h<<h),_=e.canonical.y-(e.canonical.y>>h<<h),x=o.cl(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(x,x,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,s=i.width/devicePixelRatio,l=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new qt(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new qt(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(s,l,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,s,l))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,f=0;h<this._coordsTextureSize;h++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)i[f+0]=255&_,i[f+1]=255&h,i[f+2]=_>>8<<4|h>>8,i[f+3]=0;const s=new o.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),l=new qt(e,s,e.gl.RGBA,{premultiply:!1});return l.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),s=this.painter.context,l=s.gl,h=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,_-f-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const x=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),P=this.coordsIndex[255-i[3]],A=P&&this.sourceCache.getTileByID(P);if(!A)return null;const k=this._coordsTextureSize,B=(1<<A.tileID.canonical.z)*k;return new o.$((A.tileID.canonical.x*k+x)/B+A.tileID.wrap,(A.tileID.canonical.y*k+T)/B,this.getElevation(A.tileID,x,T,k))}depthAtPoint(e){const i=new Uint8Array(4),s=this.painter.context,l=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const s=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,l=s&&e.canonical.y===0,h=s&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${l?"n":""}_${h?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,x=new o.cm,T=new o.aK,P=this.meshSize,A=o.Z/P,k=P*P;for(let re=0;re<=P;re++)for(let pe=0;pe<=P;pe++)x.emplaceBack(pe*A,re*A,0);for(let re=0;re<k;re+=P+1)for(let pe=0;pe<P;pe++)T.emplaceBack(pe+re,P+pe+re+1,P+pe+re+2),T.emplaceBack(pe+re,P+pe+re+2,pe+re+1);const B=x.length,O=B+(P+1),H=(P+1)*P,q=l?o.b9:0,W=l?0:1,K=h?o.ba:o.Z,te=h?0:1;for(let re=0;re<=P;re++)x.emplaceBack(re*A,q,W);for(let re=0;re<=P;re++)x.emplaceBack(re*A,K,te);for(let re=0;re<P;re++)T.emplaceBack(H+re,O+re,O+re+1),T.emplaceBack(H+re,O+re+1,H+re+1),T.emplaceBack(0+re,B+re+1,B+re),T.emplaceBack(0+re,0+re+1,B+re+1);const ee=x.length,ie=ee+2*(P+1);for(const re of[0,1])for(let pe=0;pe<=P;pe++)for(const Me of[0,1])x.emplaceBack(re*o.Z,pe*A,Me);for(let re=0;re<2*P;re+=2)T.emplaceBack(ee+re,ee+re+1,ee+re+3),T.emplaceBack(ee+re,ee+re+3,ee+re+2),T.emplaceBack(ie+re,ie+re+3,ie+re+1),T.emplaceBack(ie+re,ie+re+2,ie+re+3);const se=new Na(_.createVertexBuffer(x,uh.members),_.createIndexBuffer(T),o.aJ.simpleSegment(0,0,x.length,T.length));return this._meshCache[f]=se,se}getMeshFrameDelta(e){return 2*Math.PI*o.bu/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var s;const{tileID:l}=this._getOverscaledTileIDFromLngLatZoom(e,i);return(s=this.getMinMaxElevation(l).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(e){const i=this.getTerrainData(e).tile,s={minElevation:null,maxElevation:null};return i&&i.dem&&(s.minElevation=i.dem.min*this.exaggeration,s.maxElevation=i.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(e,i){const s=o.$.fromLngLat(e.wrap()),l=(1<<i)*o.Z,h=s.x*l,f=s.y*l,_=Math.floor(h/o.Z),x=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,x),mercatorX:h,mercatorY:f}}}class Zd{constructor(e,i,s){this._context=e,this._size=i,this._tileSize=s,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),s=new qt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return s.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(s.texture),{id:e,fbo:i,texture:s,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(i=>e.id!==i),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const i of this._recentlyUsed)if(!this._objects[i].inUse)return this._objects[i];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}const mr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class al{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Zd(e.context,30,i.sourceCache.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(s=>!e._layers[s].isHidden(i)),this._coordsAscending={};for(const s in e.sourceCaches){this._coordsAscending[s]={};const l=e.sourceCaches[s].getVisibleCoordinates(),h=e.sourceCaches[s].getSource(),f=h instanceof De?h.terrainTileRanges:null;for(const _ of l){const x=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in x)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(x[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(mr[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(_=>_.key).sort().join()}}for(const s of this._renderableTiles)for(const l in this._coordsAscendingStr){const h=this._coordsAscendingStr[l][s.tileID.key];h&&h!==s.rttCoords[l]&&(s.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const s=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),l=e.type,h=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(mr[l]&&(this._prevType&&mr[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(mr[this._prevType]||mr[l]&&f){this._prevType=l;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(Wn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const A=this.pool.getObjectForId(T.rtt[_].id);if(A.stamp===T.rtt[_].stamp){this.pool.useObject(A);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),T.rtt[_]={id:P.id,stamp:P.stamp},h.context.bindFramebuffer.set(P.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let A=0;A<x.length;A++){const k=h.style._layers[x[A]],B=k.source?this._coordsAscending[k.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),h._renderTileClippingMasks(k,B,!0),h.renderLayer(h,h.style.sourceCaches[k.source],k,B,s),k.source&&(T.rttCoords[k.source]=this._coordsAscendingStr[k.source][T.tileID.key])}}return Wn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),mr[l]}return!1}}const Xe={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},rt=de,Ws={hash:!1,interactive:!0,bearingSnap:7,attributionControl:An,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:o.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},xc={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class vc{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,le.mousePos(this.element,h)),le.addEventListener(window,"mousemove",this.mousemove),le.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,le.mousePos(this.element,h))},this.mouseup=h=>{this._rotatePitchHanlder.dragEnd(h),this.offTemp()},this.touchstart=h=>{h.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),le.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.move(h,this._lastPos))},this.touchend=h=>{h.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const l=new is;this._rotatePitchHanlder=new ar({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),x=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.ce(new o.P(h.x,f.y),f,x),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,le.addEventListener(i,"mousedown",this.mousedown),le.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),le.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),le.disableDrag()}move(e,i){const s=this.map,{bearingDelta:l,pitchDelta:h}=this._rotatePitchHanlder.dragMove(e,i)||{};l&&s.setBearing(s.getBearing()+l),h&&s.setPitch(s.getPitch()+h)}off(){const e=this.element;le.removeEventListener(e,"mousedown",this.mousedown),le.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend),le.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){le.enableDrag(),le.removeEventListener(window,"mousemove",this.mousemove),le.removeEventListener(window,"mouseup",this.mouseup),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend)}}let Si;function bc(u,e,i,s=!1){if(s||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return u==null?void 0:u.wrap();const l=new o.Q(u.lng,u.lat);if(u=new o.Q(u.lng,u.lat),e){const h=new o.Q(u.lng-360,u.lat),f=new o.Q(u.lng+360,u.lat),_=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(h).distSqr(e)<_?u=h:i.locationToScreenPoint(f).distSqr(e)<_&&(u=f)}for(;Math.abs(u.lng-i.center.lng)>180;){const h=i.locationToScreenPoint(u);if(h.x>=0&&h.y>=0&&h.x<=i.width&&h.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==l.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:l}const $r={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function ph(u,e,i){const s=u.classList;for(const l in $r)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class xa extends o.E{constructor(e){if(super(),this._onKeyPress=i=>{const s=i.code,l=i.charCode||i.keyCode;s!=="Space"&&s!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=i=>{const s=i.originalEvent.target,l=this._element;this._popup&&(s===l||l.contains(s))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!s)&&this._map.once("render",this._update),this._lngLat=bc(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),le.setTransform(this._element,`${$r[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),ke.frameAsync(new AbortController).then(()=>{this._updateOpacity(i&&i.type==="moveend")}).catch(()=>{})},this._onMove=i=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=i.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.l("dragstart"))),this.fire(new o.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new o.l("dragend")),this._state="inactive"},this._addDragHandler=i=>{this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=o.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=le.create("div");const i=le.createNS("http://www.w3.org/2000/svg","svg"),s=41,l=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${s}px`),i.setAttributeNS(null,"width",`${l}px`),i.setAttributeNS(null,"viewBox",`0 0 ${l} ${s}`);const h=le.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const f=le.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=le.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const W of x){const K=le.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",W.rx),K.setAttributeNS(null,"ry",W.ry),_.appendChild(K)}const T=le.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const P=le.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(P);const A=le.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"opacity","0.25"),A.setAttributeNS(null,"fill","#000000");const k=le.createNS("http://www.w3.org/2000/svg","path");k.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),A.appendChild(k);const B=le.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(6.0, 7.0)"),B.setAttributeNS(null,"fill","#FFFFFF");const O=le.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=le.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const q=le.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#FFFFFF"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962"),O.appendChild(H),O.appendChild(q),f.appendChild(_),f.appendChild(T),f.appendChild(A),f.appendChild(B),f.appendChild(O),i.appendChild(f),i.setAttributeNS(null,"height",s*this._scale+"px"),i.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(i),this._offset=o.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),ph(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),le.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=o.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const l=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,s;const l=(i=this._map)===null||i===void 0?void 0:i.terrain,h=this._map.transform.isLocationOccluded(this._lngLat);if(!l||h){const B=h?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==B&&(this._element.style.opacity=B))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,_=f.terrain.depthAtPoint(this._pos),x=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,x)-_<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/f.transform.pixelsPerMeter,P=Math.sin(f.getPitch()*Math.PI/180)*T,A=f.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),k=f.transform.lngLatToCameraDepth(this._lngLat,x+P)-A>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&k&&this._popup.remove(),this._element.style.opacity=k?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=o.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,i){return(this._opacity===void 0||e===void 0&&i===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const hi={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ri=0,as=!1;const Xs={maxWidth:100,unit:"metric"};function Ks(u,e,i){const s=i&&i.maxWidth||100,l=u._container.clientHeight/2,h=u._container.clientWidth/2,f=u.unproject([h-s/2,l]),_=u.unproject([h+s/2,l]),x=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,x,u._container.clientWidth),P=f.distanceTo(_);if(i&&i.unit==="imperial"){const A=3.2808*P;A>5280?va(e,T,A/5280,u._getUIString("ScaleControl.Miles")):va(e,T,A,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?va(e,T,P/1852,u._getUIString("ScaleControl.NauticalMiles")):P>=1e3?va(e,T,P/1e3,u._getUIString("ScaleControl.Kilometers")):va(e,T,P,u._getUIString("ScaleControl.Meters"))}function va(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const wc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Tc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ss(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new o.P(0,0),top:new o.P(0,u),"top-left":new o.P(e,e),"top-right":new o.P(-e,e),bottom:new o.P(0,-u),"bottom-left":new o.P(e,-e),"bottom-right":new o.P(-e,-e),left:new o.P(u,0),right:new o.P(-u,0)}}if(u instanceof o.P||Array.isArray(u)){const e=o.P.convert(u);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:o.P.convert(u.center||[0,0]),top:o.P.convert(u.top||[0,0]),"top-left":o.P.convert(u["top-left"]||[0,0]),"top-right":o.P.convert(u["top-right"]||[0,0]),bottom:o.P.convert(u.bottom||[0,0]),"bottom-left":o.P.convert(u["bottom-left"]||[0,0]),"bottom-right":o.P.convert(u["bottom-right"]||[0,0]),left:o.P.convert(u.left||[0,0]),right:o.P.convert(u.right||[0,0])}}return ss(new o.P(0,0))}const Mc=de;S.AJAXError=o.cq,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cr,S.config=o.a,S.removeProtocol=o.cs,S.AttributionControl=Kt,S.BoxZoomHandler=dc,S.CanvasSource=Ze,S.CooperativeGesturesHandler=rl,S.DoubleClickZoomHandler=il,S.DragPanHandler=lh,S.DragRotateHandler=ch,S.EdgeInsets=Ms,S.FullscreenControl=class extends o.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var e;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=i==null?void 0:i.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:o.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){le.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=le.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);le.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new o.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new o.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},S.GeoJSONSource=Tn,S.GeolocateControl=class extends o.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new o.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new o.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new o.Q(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,l=this._map.getBearing(),h=o.e({bearing:l},this.options.fitBoundsOptions),f=Ut.fromLngLat(i,s);this._map.fitBounds(f,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new o.Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&as)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=le.create("button","maplibregl-ctrl-geolocate",this._container),le.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=le.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new xa({element:this._dotElement}),this._circleElement=le.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new xa({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new o.l("trackuserlocationend")),this.fire(new o.l("userlocationlostfocus")))})}},this.options=o.e({},hi,u)}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(Si!==void 0&&!e)return Si;if(window.navigator.permissions===void 0)return Si=!!window.navigator.geolocation,Si;try{Si=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Si=!!window.navigator.geolocation}return Si})}().then(e=>this._finishSetupUI(e)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),le.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ri=0,as=!1}_isOutOfMapMaxBounds(u){const e=this._map.getMaxBounds(),i=u.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const u=this._map.getBounds(),e=u.getSouthEast(),i=u.getNorthEast(),s=e.distanceTo(i),l=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}trigger(){if(!this._setup)return o.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ri--,as=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new o.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.l("trackuserlocationstart")),this.fire(new o.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ri++,ri>1?(u={maximumAge:6e5,timeout:0},as=!0):(u=this.options.positionOptions,as=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},S.GlobeControl=class{constructor(){this._toggleProjection=()=>{var u;const e=(u=this._map.getProjection())===null||u===void 0?void 0:u.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var u;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((u=this._map.getProjection())===null||u===void 0?void 0:u.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=le.create("button","maplibregl-ctrl-globe",this._container),le.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){le.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=lc,S.ImageSource=De,S.KeyboardHandler=ns,S.LngLatBounds=Ut,S.LogoControl=Hs,S.Map=class extends Nd{constructor(u){var e,i;o.cn.mark(o.co.create);const s=Object.assign(Object.assign(Object.assign({},Ws),u),{canvasContextAttributes:Object.assign(Object.assign({},Ws.canvasContextAttributes),u.canvasContextAttributes)});if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const l=new Va,h=new Ss;if(s.minZoom!==void 0&&l.setMinZoom(s.minZoom),s.maxZoom!==void 0&&l.setMaxZoom(s.maxZoom),s.minPitch!==void 0&&l.setMinPitch(s.minPitch),s.maxPitch!==void 0&&l.setMaxPitch(s.maxPitch),s.renderWorldCopies!==void 0&&l.setRenderWorldCopies(s.renderWorldCopies),super(l,h,{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new yc,this._controls=[],this._mapId=o.a4(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Xe),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this.transformCameraUpdate=s.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Wt.addThrottleControl(()=>this.isMoving()),this._requestManager=new jt(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let _=!1;const x=Us(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?x(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new jd(this,s),this._hash=s.hash&&new lc(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,roll:s.roll}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,o.e({},s.fitBoundsOptions,{duration:0}))));const f=typeof s.style=="string"||((i=(e=s.style)===null||e===void 0?void 0:e.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,f),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new Kt(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Hs,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=o.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new o.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new o.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new o.l("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=u.onAdd(this);this._controls.push(u);const s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(i,s.firstChild):s.appendChild(i),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(u);return e>-1&&this._controls.splice(e,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,e,i,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,i,s)}resize(u,e=!0){const[i,s]=this._containerDimensions(),l=this._getClampedPixelRatio(i,s);if(this._resizeCanvas(i,s,l),this.painter.resize(i,s,l),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const _=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,_),this.painter.resize(i,s,_)}this._resizeTransform(e);const h=!this._moving;return h&&(this.stop(),this.fire(new o.l("movestart",u)).fire(new o.l("move",u))),this.fire(new o.l("resize",u)),h&&this.fire(new o.l("moveend",u)),this}_resizeTransform(u=!0){var e;const[i,s]=this._containerDimensions();this.transform.resize(i,s,u),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,s,u)}_getClampedPixelRatio(u,e){const{0:i,1:s}=this._maxCanvasSize,l=this.getPixelRatio(),h=u*l,f=e*l;return Math.min(h>i?i/h:1,f>s?s/f:1)*l}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(Ut.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.setMinZoom(u),this._update(),this.getZoom()<u&&this.setZoom(u),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.setMaxZoom(u),this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.setMinPitch(u),this._update(),this.getPitch()<u&&this.setPitch(u),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(u>=this.transform.minPitch)return this.transform.setMaxPitch(u),this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.setRenderWorldCopies(u),this._update()}project(u){return this.transform.locationToScreenPoint(o.Q.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(o.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,e,i){if(u==="mouseenter"||u==="mouseover"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:h=>{const f=e.filter(x=>this.getLayer(x)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new Ri(u,this,h.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(u==="mouseleave"||u==="mouseout"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const _=e.filter(x=>this.getLayer(x));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new Ri(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new Ri(u,this,f.originalEvent)))}}}}{const s=l=>{const h=e.filter(_=>this.getLayer(_)),f=h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[];f.length&&(l.features=f,i.call(this,l),delete l.features)};return{layers:e,listener:i,delegates:{[u]:s}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,i){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const s=this._delegatedListeners[u];for(let l=0;l<s.length;l++){const h=s[l];if(h.listener===i&&h.layers.length===e.length&&h.layers.every(f=>e.includes(f))){for(const f in h.delegates)this.off(f,h.delegates[f]);return void s.splice(l,1)}}}on(u,e,i){if(i===void 0)return super.on(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);this._saveDelegatedListener(u,l);for(const h in l.delegates)this.on(h,l.delegates[h]);return{unsubscribe:()=>{this._removeDelegatedListener(u,s,i)}}}once(u,e,i){if(i===void 0)return super.once(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);for(const h in l.delegates){const f=l.delegates[h];l.delegates[h]=(..._)=>{this._removeDelegatedListener(u,s,i),f(..._)}}this._saveDelegatedListener(u,l);for(const h in l.delegates)this.once(h,l.delegates[h]);return this}off(u,e,i){return i===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let i;const s=u instanceof o.P||Array.isArray(u),l=s?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:u)||{},l instanceof o.P||typeof l[0]=="number")i=[o.P.convert(l)];else{const h=o.P.convert(l[0]),f=o.P.convert(l[1]);i=[h,new o.P(f.x,h.y),f,new o.P(h.x,f.y),h]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(u,e))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const e=this._locale[u];if(e==null)throw new Error(`Missing UI string '${u}'`);return e}_updateStyle(u,e){var i,s;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,e));const l=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new $l(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,l):this.style.loadJSON(u,e,l),this):((s=(i=this.style)===null||i===void 0?void 0:i.projection)===null||s===void 0||s.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new $l(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,e){if(typeof u=="string"){const i=this._requestManager.transformRequest(u,"Style");o.j(i,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new o.k(s))})}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(i){o.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(u,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():o.w("There is no style added to the map.")}addSource(u,e){return this._lazyInitEmptyStyle(),this.style.addSource(u,e),this._update(!0)}isSourceLoaded(u){const e=this.style&&this.style.sourceCaches[u];if(e!==void 0)return e.loaded();this.fire(new o.k(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const e=this.style.sourceCaches[u.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&e.reload();for(const i in this.style._layers){const s=this.style._layers[i];s.type==="hillshade"&&s.source===u.source&&o.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new dh(this.painter,e,u),this.painter.renderToTexture=new al(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var s;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==u.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((s=i.source)===null||s===void 0?void 0:s.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new o.l("terrain",{terrain:u})),this}getTerrain(){var u,e;return(e=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const e in u){const i=u[e]._tiles;for(const s in i){const l=i[s];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}setSourceTileLodParams(u,e,i){if(i){const s=this.getSource(i);if(!s)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);s.calculateTileZoom=ae(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=ae(Math.max(1,u),Math.max(1,e));return this._update(!0),this}refreshTiles(u,e){const i=this.style.sourceCaches[u];if(!i)throw new Error(`There is no source cache with ID "${u}", cannot refresh tile`);e===void 0?i.reload():i.refreshTiles(e.map(s=>new o.a1(s.z,s.x,s.y)))}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||o.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new o.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:P,height:A,data:k}=e,B=e;return this.style.addImage(u,{data:new o.R({width:P,height:A},new Uint8Array(k)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0,userImage:B}),B.onAdd&&B.onAdd(this,u),this}}{const{width:P,height:A,data:k}=ke.getImageData(e);this.style.addImage(u,{data:new o.R({width:P,height:A},k),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new o.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=e instanceof HTMLImageElement||o.b(e)?ke.getImageData(e):e,{width:l,height:h,data:f}=s;if(l===void 0||h===void 0)return this.fire(new o.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(l!==i.data.width||h!==i.data.height)return this.fire(new o.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,_),this.style.updateImage(u,i),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new o.k(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return Wt.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,e){return this._lazyInitEmptyStyle(),this.style.addLayer(u,e),this._update(!0)}moveLayer(u,e){return this.style.moveLayer(u,e),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(u,e,i){return this.style.setLayerZoomRange(u,e,i),this._update(!0)}setFilter(u,e,i={}){return this.style.setFilter(u,e,i),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,e,i,s={}){return this.style.setPaintProperty(u,e,i,s),this._update(!0)}getPaintProperty(u,e){return this.style.getPaintProperty(u,e)}setLayoutProperty(u,e,i,s={}){return this.style.setLayoutProperty(u,e,i,s),this._update(!0)}getLayoutProperty(u,e){return this.style.getLayoutProperty(u,e)}setGlyphs(u,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,e,i,s=>{s||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,e,i=>{i||this._update(!0)}),this}setLight(u,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(u,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,e){return this.style.setFeatureState(u,e),this._update()}removeFeatureState(u,e){return this.style.removeFeatureState(u,e),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,e=0;return this._container&&(u=this._container.clientWidth||400,e=this._container.clientHeight||300),[u,e]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const e=this._canvasContainer=le.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=le.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),s=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],s);const l=this._controlContainer=le.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=le.create("div",`maplibregl-ctrl-${f} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,e,i){this._canvas.width=Math.floor(i*u),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const u=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{e={requestedAttributes:u},s&&(e.statusMessage=s.statusMessage,e.type=s.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,u):this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u),!i){const s="Failed to initialize WebGL";throw e?(e.message=s,new Error(JSON.stringify(e))):new Error(s)}this.painter=new oc(i,this.transform),Oe.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const A=this.transform.zoom,k=ke.now();this.style.zoomHistory.update(A,k);const B=new o.C(A,{now:k,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),O=B.crossFadingFactor();O===1&&O===this._crossFadingFactor||(x=!0,this._crossFadingFactor=O),this.style.update(B)}const T=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(s=this.style.projection)===null||s===void 0||s.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((l=this.style.projection)===null||l===void 0?void 0:l.transitionState,(h=this.style.projection)===null||h===void 0?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||T)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,T),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new o.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.cn.mark(o.co.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,o.cn.mark(o.co.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Wt.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),le.remove(this._canvasContainer),le.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cn.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ke.frame(this._frameRequest,u=>{o.cn.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cp(e)&&!function(i){return i.message===Zo}(e))throw e}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return rt}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=Ri,S.MapTouchEvent=Ja,S.MapWheelEvent=hc,S.Marker=xa,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const s=this._map._getUIString(`NavigationControl.${i}`);e.title=s,e.setAttribute("aria-label",s)},this.options=o.e({},xc,u),this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=le.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new vc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){le.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,e){const i=le.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},S.Popup=class extends o.E{constructor(u){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&le.remove(this._content),this._container&&(le.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new o.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=le.create("div","maplibregl-popup",this._map.getContainer()),this._tip=le.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const f of this.options.className.split(" "))this._container.classList.add(f);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=bc(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let s=this.options.anchor;const l=ss(this.options.offset);if(!s){const f=this._container.offsetWidth,_=this._container.offsetHeight;let x;x=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?x.push("left"):i.x>this._map.transform.width-f/2&&x.push("right"),s=x.length===0?"bottom":x.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),le.setTransform(this._container,`${$r[s]} translate(${h.x}px,${h.y}px)`),ph(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(wc),u)}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new o.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=o.Q.convert(u),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const e=document.createDocumentFragment(),i=document.createElement("body");let s;for(i.innerHTML=u;s=i.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=le.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){return this._container&&this._container.classList.add(u),this}removeClassName(u){return this._container&&this._container.classList.remove(u),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}setSubpixelPositioning(u){this.options.subpixelPositioning=u}_createCloseButton(){this.options.closeButton&&(this._closeButton=le.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(Tc);u&&u.focus()}},S.RasterDEMTileSource=wn,S.RasterTileSource=vr,S.ScaleControl=class{constructor(u){this._onMove=()=>{Ks(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Ks(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Xs),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){le.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=vt,S.Style=$l,S.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=le.create("button","maplibregl-ctrl-terrain",this._container),le.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){le.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=tl,S.TwoFingersTouchRotateHandler=$e,S.TwoFingersTouchZoomHandler=rs,S.TwoFingersTouchZoomRotateHandler=_c,S.VectorTileSource=dn,S.VideoSource=Ye,S.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(bt(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{lt[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=qi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Jr),qi=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},S.createTileMesh=Ps,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return Sn().getRTLTextPluginStatus()},S.getVersion=function(){return Mc},S.getWorkerCount=function(){return cr.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return jr().broadcast("IS",u)},S.prewarm=function(){yi().acquire(Jr)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return Sn().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){cr.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var F=w;return F})}(pu)),pu.exports}var sy=ay();const ed=ry(sy);class kf{constructor(g,w,I,R,F){Vt(this,"bounds1");Vt(this,"bounds2");Vt(this,"getBounds",(g,w,I,R)=>new ed.LngLatBounds([g,w],[I,R]));Vt(this,"contains",(g,w)=>this.bounds1.contains([w,g])||this.bounds2.contains([w,g]));const S=g.unproject([w,I]),o=g.unproject([R,F]);if(S.lng<-180){this.bounds1=this.getBounds(-180,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(S.wrap().lng,S.lat,180,o.lat);return}if(o.lng>180){this.bounds1=this.getBounds(S.lng,S.lat,180,o.lat),this.bounds2=this.getBounds(-180,S.lat,o.wrap().lng,o.lat);return}this.bounds1=this.getBounds(S.lng,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(0,0,0,0)}}const oy={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(120, 120, 120, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(128, 128, 128, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(56, 56, 56, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(153, 153, 153, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(104, 104, 104, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(56, 56, 56, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(136, 136, 136, 1)","fill-outline-color":"rgba(102, 102, 102, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(50, 50, 50, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(52, 52, 52, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(88, 88, 88, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20],"line-color":"rgba(102, 102, 102, 1)"}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23],"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":2,"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(51, 51, 51, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(51, 51, 51, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(255, 255, 255, 1)","text-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]},ly={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(220, 220, 220, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(228, 228, 228, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(156, 156, 156, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(253, 253, 253, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(204, 204, 204, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(156, 156, 156, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(236, 236, 236, 1)","fill-outline-color":"rgba(202, 202, 202, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(185, 185, 185)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(150, 150, 150, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(152, 152, 152, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(188, 188, 188)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(185, 185, 185)","line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23]}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":2}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(151, 151, 151, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(151, 151, 151, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1.5}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(0, 0, 0, 1)","text-color":"rgba(0, 0, 0, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]};var Zt;(function(v){v.assertEqual=R=>{};function g(R){}v.assertIs=g;function w(R){throw new Error}v.assertNever=w,v.arrayToEnum=R=>{const F={};for(const S of R)F[S]=S;return F},v.getValidEnumValues=R=>{const F=v.objectKeys(R).filter(o=>typeof R[R[o]]!="number"),S={};for(const o of F)S[o]=R[o];return v.objectValues(S)},v.objectValues=R=>v.objectKeys(R).map(function(F){return R[F]}),v.objectKeys=typeof Object.keys=="function"?R=>Object.keys(R):R=>{const F=[];for(const S in R)Object.prototype.hasOwnProperty.call(R,S)&&F.push(S);return F},v.find=(R,F)=>{for(const S of R)if(F(S))return S},v.isInteger=typeof Number.isInteger=="function"?R=>Number.isInteger(R):R=>typeof R=="number"&&Number.isFinite(R)&&Math.floor(R)===R;function I(R,F=" | "){return R.map(S=>typeof S=="string"?`'${S}'`:S).join(F)}v.joinValues=I,v.jsonStringifyReplacer=(R,F)=>typeof F=="bigint"?F.toString():F})(Zt||(Zt={}));var Af;(function(v){v.mergeShapes=(g,w)=>({...g,...w})})(Af||(Af={}));const Ke=Zt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ka=v=>{switch(typeof v){case"undefined":return Ke.undefined;case"string":return Ke.string;case"number":return Number.isNaN(v)?Ke.nan:Ke.number;case"boolean":return Ke.boolean;case"function":return Ke.function;case"bigint":return Ke.bigint;case"symbol":return Ke.symbol;case"object":return Array.isArray(v)?Ke.array:v===null?Ke.null:v.then&&typeof v.then=="function"&&v.catch&&typeof v.catch=="function"?Ke.promise:typeof Map<"u"&&v instanceof Map?Ke.map:typeof Set<"u"&&v instanceof Set?Ke.set:typeof Date<"u"&&v instanceof Date?Ke.date:Ke.object;default:return Ke.unknown}},Ve=Zt.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"]);class cn extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=I=>{this.issues=[...this.issues,I]},this.addIssues=(I=[])=>{this.issues=[...this.issues,...I]};const w=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,w):this.__proto__=w,this.name="ZodError",this.issues=g}format(g){const w=g||function(F){return F.message},I={_errors:[]},R=F=>{for(const S of F.issues)if(S.code==="invalid_union")S.unionErrors.map(R);else if(S.code==="invalid_return_type")R(S.returnTypeError);else if(S.code==="invalid_arguments")R(S.argumentsError);else if(S.path.length===0)I._errors.push(w(S));else{let o=I,de=0;for(;de<S.path.length;){const ge=S.path[de];de===S.path.length-1?(o[ge]=o[ge]||{_errors:[]},o[ge]._errors.push(w(S))):o[ge]=o[ge]||{_errors:[]},o=o[ge],de++}}};return R(this),I}static assert(g){if(!(g instanceof cn))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Zt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=w=>w.message){const w={},I=[];for(const R of this.issues)R.path.length>0?(w[R.path[0]]=w[R.path[0]]||[],w[R.path[0]].push(g(R))):I.push(g(R));return{formErrors:I,fieldErrors:w}}get formErrors(){return this.flatten()}}cn.create=v=>new cn(v);const Ml=(v,g)=>{let w;switch(v.code){case Ve.invalid_type:v.received===Ke.undefined?w="Required":w=`Expected ${v.expected}, received ${v.received}`;break;case Ve.invalid_literal:w=`Invalid literal value, expected ${JSON.stringify(v.expected,Zt.jsonStringifyReplacer)}`;break;case Ve.unrecognized_keys:w=`Unrecognized key(s) in object: ${Zt.joinValues(v.keys,", ")}`;break;case Ve.invalid_union:w="Invalid input";break;case Ve.invalid_union_discriminator:w=`Invalid discriminator value. Expected ${Zt.joinValues(v.options)}`;break;case Ve.invalid_enum_value:w=`Invalid enum value. Expected ${Zt.joinValues(v.options)}, received '${v.received}'`;break;case Ve.invalid_arguments:w="Invalid function arguments";break;case Ve.invalid_return_type:w="Invalid function return type";break;case Ve.invalid_date:w="Invalid date";break;case Ve.invalid_string:typeof v.validation=="object"?"includes"in v.validation?(w=`Invalid input: must include "${v.validation.includes}"`,typeof v.validation.position=="number"&&(w=`${w} at one or more positions greater than or equal to ${v.validation.position}`)):"startsWith"in v.validation?w=`Invalid input: must start with "${v.validation.startsWith}"`:"endsWith"in v.validation?w=`Invalid input: must end with "${v.validation.endsWith}"`:Zt.assertNever(v.validation):v.validation!=="regex"?w=`Invalid ${v.validation}`:w="Invalid";break;case Ve.too_small:v.type==="array"?w=`Array must contain ${v.exact?"exactly":v.inclusive?"at least":"more than"} ${v.minimum} element(s)`:v.type==="string"?w=`String must contain ${v.exact?"exactly":v.inclusive?"at least":"over"} ${v.minimum} character(s)`:v.type==="number"?w=`Number must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${v.minimum}`:v.type==="date"?w=`Date must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(v.minimum))}`:w="Invalid input";break;case Ve.too_big:v.type==="array"?w=`Array must contain ${v.exact?"exactly":v.inclusive?"at most":"less than"} ${v.maximum} element(s)`:v.type==="string"?w=`String must contain ${v.exact?"exactly":v.inclusive?"at most":"under"} ${v.maximum} character(s)`:v.type==="number"?w=`Number must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="bigint"?w=`BigInt must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="date"?w=`Date must be ${v.exact?"exactly":v.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(v.maximum))}`:w="Invalid input";break;case Ve.custom:w="Invalid input";break;case Ve.invalid_intersection_types:w="Intersection results could not be merged";break;case Ve.not_multiple_of:w=`Number must be a multiple of ${v.multipleOf}`;break;case Ve.not_finite:w="Number must be finite";break;default:w=g.defaultError,Zt.assertNever(v)}return{message:w}};let cy=Ml;function td(){return cy}const id=v=>{const{data:g,path:w,errorMaps:I,issueData:R}=v,F=[...w,...R.path||[]],S={...R,path:F};if(R.message!==void 0)return{...R,path:F,message:R.message};let o="";const de=I.filter(ge=>!!ge).slice().reverse();for(const ge of de)o=ge(S,{data:g,defaultError:o}).message;return{...R,path:F,message:o}};function qe(v,g){const w=td(),I=id({issueData:g,data:v.data,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,w,w===Ml?void 0:Ml].filter(R=>!!R)});v.common.issues.push(I)}class Kr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,w){const I=[];for(const R of w){if(R.status==="aborted")return _t;R.status==="dirty"&&g.dirty(),I.push(R.value)}return{status:g.value,value:I}}static async mergeObjectAsync(g,w){const I=[];for(const R of w){const F=await R.key,S=await R.value;I.push({key:F,value:S})}return Kr.mergeObjectSync(g,I)}static mergeObjectSync(g,w){const I={};for(const R of w){const{key:F,value:S}=R;if(F.status==="aborted"||S.status==="aborted")return _t;F.status==="dirty"&&g.dirty(),S.status==="dirty"&&g.dirty(),F.value!=="__proto__"&&(typeof S.value<"u"||R.alwaysSet)&&(I[F.value]=S.value)}return{status:g.value,value:I}}}const _t=Object.freeze({status:"aborted"}),Sl=v=>({status:"dirty",value:v}),Fr=v=>({status:"valid",value:v}),Ef=v=>v.status==="aborted",zf=v=>v.status==="dirty",po=v=>v.status==="valid",fu=v=>typeof Promise<"u"&&v instanceof Promise;var tt;(function(v){v.errToObj=g=>typeof g=="string"?{message:g}:g||{},v.toString=g=>typeof g=="string"?g:g==null?void 0:g.message})(tt||(tt={}));var mu=function(v,g,w,I){if(w==="a"&&!I)throw new TypeError("Private accessor was defined without a getter");if(typeof g=="function"?v!==g||!I:!g.has(v))throw new TypeError("Cannot read private member from an object whose class did not declare it");return w==="m"?I:w==="a"?I.call(v):I?I.value:g.get(v)},Rf=function(v,g,w,I,R){if(I==="m")throw new TypeError("Private method is not writable");if(I==="a"&&!R)throw new TypeError("Private accessor was defined without a setter");if(typeof g=="function"?v!==g||!R:!g.has(v))throw new TypeError("Cannot write private member to an object whose class did not declare it");return I==="a"?R.call(v,w):R?R.value=w:g.set(v,w),w},Pl,Cl;class Aa{constructor(g,w,I,R){this._cachedPath=[],this.parent=g,this.data=w,this._path=I,this._key=R}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}}const Df=(v,g)=>{if(po(g))return{success:!0,data:g.value};if(!v.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const w=new cn(v.common.issues);return this._error=w,this._error}}};function Ct(v){if(!v)return{};const{errorMap:g,invalid_type_error:w,required_error:I,description:R}=v;if(g&&(w||I))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:R}:{errorMap:(S,o)=>{const{message:de}=v;return S.code==="invalid_enum_value"?{message:de??o.defaultError}:typeof o.data>"u"?{message:de??I??o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:de??w??o.defaultError}},description:R}}class Bt{get description(){return this._def.description}_getType(g){return ka(g.data)}_getOrReturnCtx(g,w){return w||{common:g.parent.common,data:g.data,parsedType:ka(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new Kr,ctx:{common:g.parent.common,data:g.data,parsedType:ka(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const w=this._parse(g);if(fu(w))throw new Error("Synchronous parse encountered promise.");return w}_parseAsync(g){const w=this._parse(g);return Promise.resolve(w)}parse(g,w){const I=this.safeParse(g,w);if(I.success)return I.data;throw I.error}safeParse(g,w){const I={common:{issues:[],async:(w==null?void 0:w.async)??!1,contextualErrorMap:w==null?void 0:w.errorMap},path:(w==null?void 0:w.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:ka(g)},R=this._parseSync({data:g,path:I.path,parent:I});return Df(I,R)}"~validate"(g){var I,R;const w={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:ka(g)};if(!this["~standard"].async)try{const F=this._parseSync({data:g,path:[],parent:w});return po(F)?{value:F.value}:{issues:w.common.issues}}catch(F){(R=(I=F==null?void 0:F.message)==null?void 0:I.toLowerCase())!=null&&R.includes("encountered")&&(this["~standard"].async=!0),w.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:w}).then(F=>po(F)?{value:F.value}:{issues:w.common.issues})}async parseAsync(g,w){const I=await this.safeParseAsync(g,w);if(I.success)return I.data;throw I.error}async safeParseAsync(g,w){const I={common:{issues:[],contextualErrorMap:w==null?void 0:w.errorMap,async:!0},path:(w==null?void 0:w.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:ka(g)},R=this._parse({data:g,path:I.path,parent:I}),F=await(fu(R)?R:Promise.resolve(R));return Df(I,F)}refine(g,w){const I=R=>typeof w=="string"||typeof w>"u"?{message:w}:typeof w=="function"?w(R):w;return this._refinement((R,F)=>{const S=g(R),o=()=>F.addIssue({code:Ve.custom,...I(R)});return typeof Promise<"u"&&S instanceof Promise?S.then(de=>de?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(g,w){return this._refinement((I,R)=>g(I)?!0:(R.addIssue(typeof w=="function"?w(I,R):w),!1))}_refinement(g){return new yo({schema:this,typeName:ft.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}constructor(g){this.spa=this.safeParseAsync,this._def=g,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:w=>this["~validate"](w)}}optional(){return Ra.create(this,this._def)}nullable(){return xo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vn.create(this)}promise(){return El.create(this,this._def)}or(g){return _u.create([this,g],this._def)}and(g){return yu.create(this,g,this._def)}transform(g){return new yo({...Ct(this._def),schema:this,typeName:ft.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const w=typeof g=="function"?g:()=>g;return new ld({...Ct(this._def),innerType:this,defaultValue:w,typeName:ft.ZodDefault})}brand(){return new zy({typeName:ft.ZodBranded,type:this,...Ct(this._def)})}catch(g){const w=typeof g=="function"?g:()=>g;return new cd({...Ct(this._def),innerType:this,catchValue:w,typeName:ft.ZodCatch})}describe(g){const w=this.constructor;return new w({...this._def,description:g})}pipe(g){return ud.create(this,g)}readonly(){return hd.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const uy=/^c[^\s-]{8,}$/i,hy=/^[0-9a-z]+$/,dy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,py=/^[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,fy=/^[a-z0-9_-]{21}$/i,my=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gy=/^[-+]?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)?)??$/,_y=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let rd;const xy=/^(?:(?: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])$/,vy=/^(?:(?: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])$/,by=/^(([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]))$/,wy=/^(([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])$/,Ty=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,My=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Lf="((\\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])))",Sy=new RegExp(`^${Lf}$`);function Bf(v){let g="[0-5]\\d";v.precision?g=`${g}\\.\\d{${v.precision}}`:v.precision==null&&(g=`${g}(\\.\\d+)?`);const w=v.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${g})${w}`}function Py(v){return new RegExp(`^${Bf(v)}$`)}function Cy(v){let g=`${Lf}T${Bf(v)}`;const w=[];return w.push(v.local?"Z?":"Z"),v.offset&&w.push("([+-]\\d{2}:?\\d{2})"),g=`${g}(${w.join("|")})`,new RegExp(`^${g}$`)}function Iy(v,g){return!!((g==="v4"||!g)&&xy.test(v)||(g==="v6"||!g)&&by.test(v))}function ky(v,g){if(!my.test(v))return!1;try{const[w]=v.split("."),I=w.replace(/-/g,"+").replace(/_/g,"/").padEnd(w.length+(4-w.length%4)%4,"="),R=JSON.parse(atob(I));return!(typeof R!="object"||R===null||"typ"in R&&(R==null?void 0:R.typ)!=="JWT"||!R.alg||g&&R.alg!==g)}catch{return!1}}function Ay(v,g){return!!((g==="v4"||!g)&&vy.test(v)||(g==="v6"||!g)&&wy.test(v))}class Ea extends Bt{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Ke.string){const F=this._getOrReturnCtx(g);return qe(F,{code:Ve.invalid_type,expected:Ke.string,received:F.parsedType}),_t}const I=new Kr;let R;for(const F of this._def.checks)if(F.kind==="min")g.data.length<F.value&&(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.too_small,minimum:F.value,type:"string",inclusive:!0,exact:!1,message:F.message}),I.dirty());else if(F.kind==="max")g.data.length>F.value&&(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.too_big,maximum:F.value,type:"string",inclusive:!0,exact:!1,message:F.message}),I.dirty());else if(F.kind==="length"){const S=g.data.length>F.value,o=g.data.length<F.value;(S||o)&&(R=this._getOrReturnCtx(g,R),S?qe(R,{code:Ve.too_big,maximum:F.value,type:"string",inclusive:!0,exact:!0,message:F.message}):o&&qe(R,{code:Ve.too_small,minimum:F.value,type:"string",inclusive:!0,exact:!0,message:F.message}),I.dirty())}else if(F.kind==="email")_y.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"email",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="emoji")rd||(rd=new RegExp(yy,"u")),rd.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"emoji",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="uuid")py.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"uuid",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="nanoid")fy.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"nanoid",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="cuid")uy.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"cuid",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="cuid2")hy.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"cuid2",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="ulid")dy.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"ulid",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="url")try{new URL(g.data)}catch{R=this._getOrReturnCtx(g,R),qe(R,{validation:"url",code:Ve.invalid_string,message:F.message}),I.dirty()}else F.kind==="regex"?(F.regex.lastIndex=0,F.regex.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"regex",code:Ve.invalid_string,message:F.message}),I.dirty())):F.kind==="trim"?g.data=g.data.trim():F.kind==="includes"?g.data.includes(F.value,F.position)||(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.invalid_string,validation:{includes:F.value,position:F.position},message:F.message}),I.dirty()):F.kind==="toLowerCase"?g.data=g.data.toLowerCase():F.kind==="toUpperCase"?g.data=g.data.toUpperCase():F.kind==="startsWith"?g.data.startsWith(F.value)||(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.invalid_string,validation:{startsWith:F.value},message:F.message}),I.dirty()):F.kind==="endsWith"?g.data.endsWith(F.value)||(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.invalid_string,validation:{endsWith:F.value},message:F.message}),I.dirty()):F.kind==="datetime"?Cy(F).test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.invalid_string,validation:"datetime",message:F.message}),I.dirty()):F.kind==="date"?Sy.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.invalid_string,validation:"date",message:F.message}),I.dirty()):F.kind==="time"?Py(F).test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.invalid_string,validation:"time",message:F.message}),I.dirty()):F.kind==="duration"?gy.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"duration",code:Ve.invalid_string,message:F.message}),I.dirty()):F.kind==="ip"?Iy(g.data,F.version)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"ip",code:Ve.invalid_string,message:F.message}),I.dirty()):F.kind==="jwt"?ky(g.data,F.alg)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"jwt",code:Ve.invalid_string,message:F.message}),I.dirty()):F.kind==="cidr"?Ay(g.data,F.version)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"cidr",code:Ve.invalid_string,message:F.message}),I.dirty()):F.kind==="base64"?Ty.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"base64",code:Ve.invalid_string,message:F.message}),I.dirty()):F.kind==="base64url"?My.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"base64url",code:Ve.invalid_string,message:F.message}),I.dirty()):Zt.assertNever(F);return{status:I.value,value:g.data}}_regex(g,w,I){return this.refinement(R=>g.test(R),{validation:w,code:Ve.invalid_string,...tt.errToObj(I)})}_addCheck(g){return new Ea({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...tt.errToObj(g)})}url(g){return this._addCheck({kind:"url",...tt.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...tt.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...tt.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...tt.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...tt.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...tt.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...tt.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...tt.errToObj(g)})}base64url(g){return this._addCheck({kind:"base64url",...tt.errToObj(g)})}jwt(g){return this._addCheck({kind:"jwt",...tt.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...tt.errToObj(g)})}cidr(g){return this._addCheck({kind:"cidr",...tt.errToObj(g)})}datetime(g){return typeof g=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:g}):this._addCheck({kind:"datetime",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,offset:(g==null?void 0:g.offset)??!1,local:(g==null?void 0:g.local)??!1,...tt.errToObj(g==null?void 0:g.message)})}date(g){return this._addCheck({kind:"date",message:g})}time(g){return typeof g=="string"?this._addCheck({kind:"time",precision:null,message:g}):this._addCheck({kind:"time",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,...tt.errToObj(g==null?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...tt.errToObj(g)})}regex(g,w){return this._addCheck({kind:"regex",regex:g,...tt.errToObj(w)})}includes(g,w){return this._addCheck({kind:"includes",value:g,position:w==null?void 0:w.position,...tt.errToObj(w==null?void 0:w.message)})}startsWith(g,w){return this._addCheck({kind:"startsWith",value:g,...tt.errToObj(w)})}endsWith(g,w){return this._addCheck({kind:"endsWith",value:g,...tt.errToObj(w)})}min(g,w){return this._addCheck({kind:"min",value:g,...tt.errToObj(w)})}max(g,w){return this._addCheck({kind:"max",value:g,...tt.errToObj(w)})}length(g,w){return this._addCheck({kind:"length",value:g,...tt.errToObj(w)})}nonempty(g){return this.min(1,tt.errToObj(g))}trim(){return new Ea({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ea({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ea({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(g=>g.kind==="datetime")}get isDate(){return!!this._def.checks.find(g=>g.kind==="date")}get isTime(){return!!this._def.checks.find(g=>g.kind==="time")}get isDuration(){return!!this._def.checks.find(g=>g.kind==="duration")}get isEmail(){return!!this._def.checks.find(g=>g.kind==="email")}get isURL(){return!!this._def.checks.find(g=>g.kind==="url")}get isEmoji(){return!!this._def.checks.find(g=>g.kind==="emoji")}get isUUID(){return!!this._def.checks.find(g=>g.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(g=>g.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(g=>g.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(g=>g.kind==="cuid2")}get isULID(){return!!this._def.checks.find(g=>g.kind==="ulid")}get isIP(){return!!this._def.checks.find(g=>g.kind==="ip")}get isCIDR(){return!!this._def.checks.find(g=>g.kind==="cidr")}get isBase64(){return!!this._def.checks.find(g=>g.kind==="base64")}get isBase64url(){return!!this._def.checks.find(g=>g.kind==="base64url")}get minLength(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxLength(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}}Ea.create=v=>new Ea({checks:[],typeName:ft.ZodString,coerce:(v==null?void 0:v.coerce)??!1,...Ct(v)});function Ey(v,g){const w=(v.toString().split(".")[1]||"").length,I=(g.toString().split(".")[1]||"").length,R=w>I?w:I,F=Number.parseInt(v.toFixed(R).replace(".","")),S=Number.parseInt(g.toFixed(R).replace(".",""));return F%S/10**R}class fo extends Bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){if(this._def.coerce&&(g.data=Number(g.data)),this._getType(g)!==Ke.number){const F=this._getOrReturnCtx(g);return qe(F,{code:Ve.invalid_type,expected:Ke.number,received:F.parsedType}),_t}let I;const R=new Kr;for(const F of this._def.checks)F.kind==="int"?Zt.isInteger(g.data)||(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.invalid_type,expected:"integer",received:"float",message:F.message}),R.dirty()):F.kind==="min"?(F.inclusive?g.data<F.value:g.data<=F.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.too_small,minimum:F.value,type:"number",inclusive:F.inclusive,exact:!1,message:F.message}),R.dirty()):F.kind==="max"?(F.inclusive?g.data>F.value:g.data>=F.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.too_big,maximum:F.value,type:"number",inclusive:F.inclusive,exact:!1,message:F.message}),R.dirty()):F.kind==="multipleOf"?Ey(g.data,F.value)!==0&&(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.not_multiple_of,multipleOf:F.value,message:F.message}),R.dirty()):F.kind==="finite"?Number.isFinite(g.data)||(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.not_finite,message:F.message}),R.dirty()):Zt.assertNever(F);return{status:R.value,value:g.data}}gte(g,w){return this.setLimit("min",g,!0,tt.toString(w))}gt(g,w){return this.setLimit("min",g,!1,tt.toString(w))}lte(g,w){return this.setLimit("max",g,!0,tt.toString(w))}lt(g,w){return this.setLimit("max",g,!1,tt.toString(w))}setLimit(g,w,I,R){return new fo({...this._def,checks:[...this._def.checks,{kind:g,value:w,inclusive:I,message:tt.toString(R)}]})}_addCheck(g){return new fo({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:tt.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tt.toString(g)})}multipleOf(g,w){return this._addCheck({kind:"multipleOf",value:g,message:tt.toString(w)})}finite(g){return this._addCheck({kind:"finite",message:tt.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tt.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tt.toString(g)})}get minValue(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxValue(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}get isInt(){return!!this._def.checks.find(g=>g.kind==="int"||g.kind==="multipleOf"&&Zt.isInteger(g.value))}get isFinite(){let g=null,w=null;for(const I of this._def.checks){if(I.kind==="finite"||I.kind==="int"||I.kind==="multipleOf")return!0;I.kind==="min"?(w===null||I.value>w)&&(w=I.value):I.kind==="max"&&(g===null||I.value<g)&&(g=I.value)}return Number.isFinite(w)&&Number.isFinite(g)}}fo.create=v=>new fo({checks:[],typeName:ft.ZodNumber,coerce:(v==null?void 0:v.coerce)||!1,...Ct(v)});class Il extends Bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){if(this._def.coerce)try{g.data=BigInt(g.data)}catch{return this._getInvalidInput(g)}if(this._getType(g)!==Ke.bigint)return this._getInvalidInput(g);let I;const R=new Kr;for(const F of this._def.checks)F.kind==="min"?(F.inclusive?g.data<F.value:g.data<=F.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.too_small,type:"bigint",minimum:F.value,inclusive:F.inclusive,message:F.message}),R.dirty()):F.kind==="max"?(F.inclusive?g.data>F.value:g.data>=F.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.too_big,type:"bigint",maximum:F.value,inclusive:F.inclusive,message:F.message}),R.dirty()):F.kind==="multipleOf"?g.data%F.value!==BigInt(0)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.not_multiple_of,multipleOf:F.value,message:F.message}),R.dirty()):Zt.assertNever(F);return{status:R.value,value:g.data}}_getInvalidInput(g){const w=this._getOrReturnCtx(g);return qe(w,{code:Ve.invalid_type,expected:Ke.bigint,received:w.parsedType}),_t}gte(g,w){return this.setLimit("min",g,!0,tt.toString(w))}gt(g,w){return this.setLimit("min",g,!1,tt.toString(w))}lte(g,w){return this.setLimit("max",g,!0,tt.toString(w))}lt(g,w){return this.setLimit("max",g,!1,tt.toString(w))}setLimit(g,w,I,R){return new Il({...this._def,checks:[...this._def.checks,{kind:g,value:w,inclusive:I,message:tt.toString(R)}]})}_addCheck(g){return new Il({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tt.toString(g)})}multipleOf(g,w){return this._addCheck({kind:"multipleOf",value:g,message:tt.toString(w)})}get minValue(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxValue(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}}Il.create=v=>new Il({checks:[],typeName:ft.ZodBigInt,coerce:(v==null?void 0:v.coerce)??!1,...Ct(v)});class Ff extends Bt{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Ke.boolean){const I=this._getOrReturnCtx(g);return qe(I,{code:Ve.invalid_type,expected:Ke.boolean,received:I.parsedType}),_t}return Fr(g.data)}}Ff.create=v=>new Ff({typeName:ft.ZodBoolean,coerce:(v==null?void 0:v.coerce)||!1,...Ct(v)});class gu extends Bt{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Ke.date){const F=this._getOrReturnCtx(g);return qe(F,{code:Ve.invalid_type,expected:Ke.date,received:F.parsedType}),_t}if(Number.isNaN(g.data.getTime())){const F=this._getOrReturnCtx(g);return qe(F,{code:Ve.invalid_date}),_t}const I=new Kr;let R;for(const F of this._def.checks)F.kind==="min"?g.data.getTime()<F.value&&(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.too_small,message:F.message,inclusive:!0,exact:!1,minimum:F.value,type:"date"}),I.dirty()):F.kind==="max"?g.data.getTime()>F.value&&(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.too_big,message:F.message,inclusive:!0,exact:!1,maximum:F.value,type:"date"}),I.dirty()):Zt.assertNever(F);return{status:I.value,value:new Date(g.data.getTime())}}_addCheck(g){return new gu({...this._def,checks:[...this._def.checks,g]})}min(g,w){return this._addCheck({kind:"min",value:g.getTime(),message:tt.toString(w)})}max(g,w){return this._addCheck({kind:"max",value:g.getTime(),message:tt.toString(w)})}get minDate(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g!=null?new Date(g):null}get maxDate(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g!=null?new Date(g):null}}gu.create=v=>new gu({checks:[],coerce:(v==null?void 0:v.coerce)||!1,typeName:ft.ZodDate,...Ct(v)});class Of extends Bt{_parse(g){if(this._getType(g)!==Ke.symbol){const I=this._getOrReturnCtx(g);return qe(I,{code:Ve.invalid_type,expected:Ke.symbol,received:I.parsedType}),_t}return Fr(g.data)}}Of.create=v=>new Of({typeName:ft.ZodSymbol,...Ct(v)});class jf extends Bt{_parse(g){if(this._getType(g)!==Ke.undefined){const I=this._getOrReturnCtx(g);return qe(I,{code:Ve.invalid_type,expected:Ke.undefined,received:I.parsedType}),_t}return Fr(g.data)}}jf.create=v=>new jf({typeName:ft.ZodUndefined,...Ct(v)});class Nf extends Bt{_parse(g){if(this._getType(g)!==Ke.null){const I=this._getOrReturnCtx(g);return qe(I,{code:Ve.invalid_type,expected:Ke.null,received:I.parsedType}),_t}return Fr(g.data)}}Nf.create=v=>new Nf({typeName:ft.ZodNull,...Ct(v)});class nd extends Bt{constructor(){super(...arguments),this._any=!0}_parse(g){return Fr(g.data)}}nd.create=v=>new nd({typeName:ft.ZodAny,...Ct(v)});class mo extends Bt{constructor(){super(...arguments),this._unknown=!0}_parse(g){return Fr(g.data)}}mo.create=v=>new mo({typeName:ft.ZodUnknown,...Ct(v)});class za extends Bt{_parse(g){const w=this._getOrReturnCtx(g);return qe(w,{code:Ve.invalid_type,expected:Ke.never,received:w.parsedType}),_t}}za.create=v=>new za({typeName:ft.ZodNever,...Ct(v)});class ad extends Bt{_parse(g){if(this._getType(g)!==Ke.undefined){const I=this._getOrReturnCtx(g);return qe(I,{code:Ve.invalid_type,expected:Ke.void,received:I.parsedType}),_t}return Fr(g.data)}}ad.create=v=>new ad({typeName:ft.ZodVoid,...Ct(v)});class Vn extends Bt{_parse(g){const{ctx:w,status:I}=this._processInputParams(g),R=this._def;if(w.parsedType!==Ke.array)return qe(w,{code:Ve.invalid_type,expected:Ke.array,received:w.parsedType}),_t;if(R.exactLength!==null){const S=w.data.length>R.exactLength.value,o=w.data.length<R.exactLength.value;(S||o)&&(qe(w,{code:S?Ve.too_big:Ve.too_small,minimum:o?R.exactLength.value:void 0,maximum:S?R.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:R.exactLength.message}),I.dirty())}if(R.minLength!==null&&w.data.length<R.minLength.value&&(qe(w,{code:Ve.too_small,minimum:R.minLength.value,type:"array",inclusive:!0,exact:!1,message:R.minLength.message}),I.dirty()),R.maxLength!==null&&w.data.length>R.maxLength.value&&(qe(w,{code:Ve.too_big,maximum:R.maxLength.value,type:"array",inclusive:!0,exact:!1,message:R.maxLength.message}),I.dirty()),w.common.async)return Promise.all([...w.data].map((S,o)=>R.type._parseAsync(new Aa(w,S,w.path,o)))).then(S=>Kr.mergeArray(I,S));const F=[...w.data].map((S,o)=>R.type._parseSync(new Aa(w,S,w.path,o)));return Kr.mergeArray(I,F)}get element(){return this._def.type}min(g,w){return new Vn({...this._def,minLength:{value:g,message:tt.toString(w)}})}max(g,w){return new Vn({...this._def,maxLength:{value:g,message:tt.toString(w)}})}length(g,w){return new Vn({...this._def,exactLength:{value:g,message:tt.toString(w)}})}nonempty(g){return this.min(1,g)}}Vn.create=(v,g)=>new Vn({type:v,minLength:null,maxLength:null,exactLength:null,typeName:ft.ZodArray,...Ct(g)});function go(v){if(v instanceof Oi){const g={};for(const w in v.shape){const I=v.shape[w];g[w]=Ra.create(go(I))}return new Oi({...v._def,shape:()=>g})}else return v instanceof Vn?new Vn({...v._def,type:go(v.element)}):v instanceof Ra?Ra.create(go(v.unwrap())):v instanceof xo?xo.create(go(v.unwrap())):v instanceof ra?ra.create(v.items.map(g=>go(g))):v}class Oi extends Bt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const g=this._def.shape(),w=Zt.objectKeys(g);return this._cached={shape:g,keys:w},this._cached}_parse(g){if(this._getType(g)!==Ke.object){const ge=this._getOrReturnCtx(g);return qe(ge,{code:Ve.invalid_type,expected:Ke.object,received:ge.parsedType}),_t}const{status:I,ctx:R}=this._processInputParams(g),{shape:F,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof za&&this._def.unknownKeys==="strip"))for(const ge in R.data)S.includes(ge)||o.push(ge);const de=[];for(const ge of S){const ze=F[ge],Be=R.data[ge];de.push({key:{status:"valid",value:ge},value:ze._parse(new Aa(R,Be,R.path,ge)),alwaysSet:ge in R.data})}if(this._def.catchall instanceof za){const ge=this._def.unknownKeys;if(ge==="passthrough")for(const ze of o)de.push({key:{status:"valid",value:ze},value:{status:"valid",value:R.data[ze]}});else if(ge==="strict")o.length>0&&(qe(R,{code:Ve.unrecognized_keys,keys:o}),I.dirty());else if(ge!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const ge=this._def.catchall;for(const ze of o){const Be=R.data[ze];de.push({key:{status:"valid",value:ze},value:ge._parse(new Aa(R,Be,R.path,ze)),alwaysSet:ze in R.data})}}return R.common.async?Promise.resolve().then(async()=>{const ge=[];for(const ze of de){const Be=await ze.key,ke=await ze.value;ge.push({key:Be,value:ke,alwaysSet:ze.alwaysSet})}return ge}).then(ge=>Kr.mergeObjectSync(I,ge)):Kr.mergeObjectSync(I,de)}get shape(){return this._def.shape()}strict(g){return tt.errToObj,new Oi({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(w,I)=>{var F,S;const R=((S=(F=this._def).errorMap)==null?void 0:S.call(F,w,I).message)??I.defaultError;return w.code==="unrecognized_keys"?{message:tt.errToObj(g).message??R}:{message:R}}}:{}})}strip(){return new Oi({...this._def,unknownKeys:"strip"})}passthrough(){return new Oi({...this._def,unknownKeys:"passthrough"})}extend(g){return new Oi({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new Oi({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:ft.ZodObject})}setKey(g,w){return this.augment({[g]:w})}catchall(g){return new Oi({...this._def,catchall:g})}pick(g){const w={};for(const I of Zt.objectKeys(g))g[I]&&this.shape[I]&&(w[I]=this.shape[I]);return new Oi({...this._def,shape:()=>w})}omit(g){const w={};for(const I of Zt.objectKeys(this.shape))g[I]||(w[I]=this.shape[I]);return new Oi({...this._def,shape:()=>w})}deepPartial(){return go(this)}partial(g){const w={};for(const I of Zt.objectKeys(this.shape)){const R=this.shape[I];g&&!g[I]?w[I]=R:w[I]=R.optional()}return new Oi({...this._def,shape:()=>w})}required(g){const w={};for(const I of Zt.objectKeys(this.shape))if(g&&!g[I])w[I]=this.shape[I];else{let F=this.shape[I];for(;F instanceof Ra;)F=F._def.innerType;w[I]=F}return new Oi({...this._def,shape:()=>w})}keyof(){return Uf(Zt.objectKeys(this.shape))}}Oi.create=(v,g)=>new Oi({shape:()=>v,unknownKeys:"strip",catchall:za.create(),typeName:ft.ZodObject,...Ct(g)}),Oi.strictCreate=(v,g)=>new Oi({shape:()=>v,unknownKeys:"strict",catchall:za.create(),typeName:ft.ZodObject,...Ct(g)}),Oi.lazycreate=(v,g)=>new Oi({shape:v,unknownKeys:"strip",catchall:za.create(),typeName:ft.ZodObject,...Ct(g)});class _u extends Bt{_parse(g){const{ctx:w}=this._processInputParams(g),I=this._def.options;function R(F){for(const o of F)if(o.result.status==="valid")return o.result;for(const o of F)if(o.result.status==="dirty")return w.common.issues.push(...o.ctx.common.issues),o.result;const S=F.map(o=>new cn(o.ctx.common.issues));return qe(w,{code:Ve.invalid_union,unionErrors:S}),_t}if(w.common.async)return Promise.all(I.map(async F=>{const S={...w,common:{...w.common,issues:[]},parent:null};return{result:await F._parseAsync({data:w.data,path:w.path,parent:S}),ctx:S}})).then(R);{let F;const S=[];for(const de of I){const ge={...w,common:{...w.common,issues:[]},parent:null},ze=de._parseSync({data:w.data,path:w.path,parent:ge});if(ze.status==="valid")return ze;ze.status==="dirty"&&!F&&(F={result:ze,ctx:ge}),ge.common.issues.length&&S.push(ge.common.issues)}if(F)return w.common.issues.push(...F.ctx.common.issues),F.result;const o=S.map(de=>new cn(de));return qe(w,{code:Ve.invalid_union,unionErrors:o}),_t}}get options(){return this._def.options}}_u.create=(v,g)=>new _u({options:v,typeName:ft.ZodUnion,...Ct(g)});function sd(v,g){const w=ka(v),I=ka(g);if(v===g)return{valid:!0,data:v};if(w===Ke.object&&I===Ke.object){const R=Zt.objectKeys(g),F=Zt.objectKeys(v).filter(o=>R.indexOf(o)!==-1),S={...v,...g};for(const o of F){const de=sd(v[o],g[o]);if(!de.valid)return{valid:!1};S[o]=de.data}return{valid:!0,data:S}}else if(w===Ke.array&&I===Ke.array){if(v.length!==g.length)return{valid:!1};const R=[];for(let F=0;F<v.length;F++){const S=v[F],o=g[F],de=sd(S,o);if(!de.valid)return{valid:!1};R.push(de.data)}return{valid:!0,data:R}}else return w===Ke.date&&I===Ke.date&&+v==+g?{valid:!0,data:v}:{valid:!1}}class yu extends Bt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g),R=(F,S)=>{if(Ef(F)||Ef(S))return _t;const o=sd(F.value,S.value);return o.valid?((zf(F)||zf(S))&&w.dirty(),{status:w.value,value:o.data}):(qe(I,{code:Ve.invalid_intersection_types}),_t)};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(([F,S])=>R(F,S)):R(this._def.left._parseSync({data:I.data,path:I.path,parent:I}),this._def.right._parseSync({data:I.data,path:I.path,parent:I}))}}yu.create=(v,g,w)=>new yu({left:v,right:g,typeName:ft.ZodIntersection,...Ct(w)});class ra extends Bt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.array)return qe(I,{code:Ve.invalid_type,expected:Ke.array,received:I.parsedType}),_t;if(I.data.length<this._def.items.length)return qe(I,{code:Ve.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_t;!this._def.rest&&I.data.length>this._def.items.length&&(qe(I,{code:Ve.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w.dirty());const F=[...I.data].map((S,o)=>{const de=this._def.items[o]||this._def.rest;return de?de._parse(new Aa(I,S,I.path,o)):null}).filter(S=>!!S);return I.common.async?Promise.all(F).then(S=>Kr.mergeArray(w,S)):Kr.mergeArray(w,F)}get items(){return this._def.items}rest(g){return new ra({...this._def,rest:g})}}ra.create=(v,g)=>{if(!Array.isArray(v))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ra({items:v,typeName:ft.ZodTuple,rest:null,...Ct(g)})};class Zf extends Bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.map)return qe(I,{code:Ve.invalid_type,expected:Ke.map,received:I.parsedType}),_t;const R=this._def.keyType,F=this._def.valueType,S=[...I.data.entries()].map(([o,de],ge)=>({key:R._parse(new Aa(I,o,I.path,[ge,"key"])),value:F._parse(new Aa(I,de,I.path,[ge,"value"]))}));if(I.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const de of S){const ge=await de.key,ze=await de.value;if(ge.status==="aborted"||ze.status==="aborted")return _t;(ge.status==="dirty"||ze.status==="dirty")&&w.dirty(),o.set(ge.value,ze.value)}return{status:w.value,value:o}})}else{const o=new Map;for(const de of S){const ge=de.key,ze=de.value;if(ge.status==="aborted"||ze.status==="aborted")return _t;(ge.status==="dirty"||ze.status==="dirty")&&w.dirty(),o.set(ge.value,ze.value)}return{status:w.value,value:o}}}}Zf.create=(v,g,w)=>new Zf({valueType:g,keyType:v,typeName:ft.ZodMap,...Ct(w)});class kl extends Bt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.set)return qe(I,{code:Ve.invalid_type,expected:Ke.set,received:I.parsedType}),_t;const R=this._def;R.minSize!==null&&I.data.size<R.minSize.value&&(qe(I,{code:Ve.too_small,minimum:R.minSize.value,type:"set",inclusive:!0,exact:!1,message:R.minSize.message}),w.dirty()),R.maxSize!==null&&I.data.size>R.maxSize.value&&(qe(I,{code:Ve.too_big,maximum:R.maxSize.value,type:"set",inclusive:!0,exact:!1,message:R.maxSize.message}),w.dirty());const F=this._def.valueType;function S(de){const ge=new Set;for(const ze of de){if(ze.status==="aborted")return _t;ze.status==="dirty"&&w.dirty(),ge.add(ze.value)}return{status:w.value,value:ge}}const o=[...I.data.values()].map((de,ge)=>F._parse(new Aa(I,de,I.path,ge)));return I.common.async?Promise.all(o).then(de=>S(de)):S(o)}min(g,w){return new kl({...this._def,minSize:{value:g,message:tt.toString(w)}})}max(g,w){return new kl({...this._def,maxSize:{value:g,message:tt.toString(w)}})}size(g,w){return this.min(g,w).max(g,w)}nonempty(g){return this.min(1,g)}}kl.create=(v,g)=>new kl({valueType:v,minSize:null,maxSize:null,typeName:ft.ZodSet,...Ct(g)});class Al extends Bt{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:w}=this._processInputParams(g);if(w.parsedType!==Ke.function)return qe(w,{code:Ve.invalid_type,expected:Ke.function,received:w.parsedType}),_t;function I(o,de){return id({data:o,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,td(),Ml].filter(ge=>!!ge),issueData:{code:Ve.invalid_arguments,argumentsError:de}})}function R(o,de){return id({data:o,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,td(),Ml].filter(ge=>!!ge),issueData:{code:Ve.invalid_return_type,returnTypeError:de}})}const F={errorMap:w.common.contextualErrorMap},S=w.data;if(this._def.returns instanceof El){const o=this;return Fr(async function(...de){const ge=new cn([]),ze=await o._def.args.parseAsync(de,F).catch(le=>{throw ge.addIssue(I(de,le)),ge}),Be=await Reflect.apply(S,this,ze);return await o._def.returns._def.type.parseAsync(Be,F).catch(le=>{throw ge.addIssue(R(Be,le)),ge})})}else{const o=this;return Fr(function(...de){const ge=o._def.args.safeParse(de,F);if(!ge.success)throw new cn([I(de,ge.error)]);const ze=Reflect.apply(S,this,ge.data),Be=o._def.returns.safeParse(ze,F);if(!Be.success)throw new cn([R(ze,Be.error)]);return Be.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new Al({...this._def,args:ra.create(g).rest(mo.create())})}returns(g){return new Al({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,w,I){return new Al({args:g||ra.create([]).rest(mo.create()),returns:w||mo.create(),typeName:ft.ZodFunction,...Ct(I)})}}class Vf extends Bt{get schema(){return this._def.getter()}_parse(g){const{ctx:w}=this._processInputParams(g);return this._def.getter()._parse({data:w.data,path:w.path,parent:w})}}Vf.create=(v,g)=>new Vf({getter:v,typeName:ft.ZodLazy,...Ct(g)});class od extends Bt{_parse(g){if(g.data!==this._def.value){const w=this._getOrReturnCtx(g);return qe(w,{received:w.data,code:Ve.invalid_literal,expected:this._def.value}),_t}return{status:"valid",value:g.data}}get value(){return this._def.value}}od.create=(v,g)=>new od({value:v,typeName:ft.ZodLiteral,...Ct(g)});function Uf(v,g){return new _o({values:v,typeName:ft.ZodEnum,...Ct(g)})}class _o extends Bt{constructor(){super(...arguments),Pl.set(this,void 0)}_parse(g){if(typeof g.data!="string"){const w=this._getOrReturnCtx(g),I=this._def.values;return qe(w,{expected:Zt.joinValues(I),received:w.parsedType,code:Ve.invalid_type}),_t}if(mu(this,Pl,"f")||Rf(this,Pl,new Set(this._def.values),"f"),!mu(this,Pl,"f").has(g.data)){const w=this._getOrReturnCtx(g),I=this._def.values;return qe(w,{received:w.data,code:Ve.invalid_enum_value,options:I}),_t}return Fr(g.data)}get options(){return this._def.values}get enum(){const g={};for(const w of this._def.values)g[w]=w;return g}get Values(){const g={};for(const w of this._def.values)g[w]=w;return g}get Enum(){const g={};for(const w of this._def.values)g[w]=w;return g}extract(g,w=this._def){return _o.create(g,{...this._def,...w})}exclude(g,w=this._def){return _o.create(this.options.filter(I=>!g.includes(I)),{...this._def,...w})}}Pl=new WeakMap,_o.create=Uf;class $f extends Bt{constructor(){super(...arguments),Cl.set(this,void 0)}_parse(g){const w=Zt.getValidEnumValues(this._def.values),I=this._getOrReturnCtx(g);if(I.parsedType!==Ke.string&&I.parsedType!==Ke.number){const R=Zt.objectValues(w);return qe(I,{expected:Zt.joinValues(R),received:I.parsedType,code:Ve.invalid_type}),_t}if(mu(this,Cl,"f")||Rf(this,Cl,new Set(Zt.getValidEnumValues(this._def.values)),"f"),!mu(this,Cl,"f").has(g.data)){const R=Zt.objectValues(w);return qe(I,{received:I.data,code:Ve.invalid_enum_value,options:R}),_t}return Fr(g.data)}get enum(){return this._def.values}}Cl=new WeakMap,$f.create=(v,g)=>new $f({values:v,typeName:ft.ZodNativeEnum,...Ct(g)});class El extends Bt{unwrap(){return this._def.type}_parse(g){const{ctx:w}=this._processInputParams(g);if(w.parsedType!==Ke.promise&&w.common.async===!1)return qe(w,{code:Ve.invalid_type,expected:Ke.promise,received:w.parsedType}),_t;const I=w.parsedType===Ke.promise?w.data:Promise.resolve(w.data);return Fr(I.then(R=>this._def.type.parseAsync(R,{path:w.path,errorMap:w.common.contextualErrorMap})))}}El.create=(v,g)=>new El({type:v,typeName:ft.ZodPromise,...Ct(g)});class yo extends Bt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ft.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:w,ctx:I}=this._processInputParams(g),R=this._def.effect||null,F={addIssue:S=>{qe(I,S),S.fatal?w.abort():w.dirty()},get path(){return I.path}};if(F.addIssue=F.addIssue.bind(F),R.type==="preprocess"){const S=R.transform(I.data,F);if(I.common.async)return Promise.resolve(S).then(async o=>{if(w.value==="aborted")return _t;const de=await this._def.schema._parseAsync({data:o,path:I.path,parent:I});return de.status==="aborted"?_t:de.status==="dirty"||w.value==="dirty"?Sl(de.value):de});{if(w.value==="aborted")return _t;const o=this._def.schema._parseSync({data:S,path:I.path,parent:I});return o.status==="aborted"?_t:o.status==="dirty"||w.value==="dirty"?Sl(o.value):o}}if(R.type==="refinement"){const S=o=>{const de=R.refinement(o,F);if(I.common.async)return Promise.resolve(de);if(de instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(I.common.async===!1){const o=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});return o.status==="aborted"?_t:(o.status==="dirty"&&w.dirty(),S(o.value),{status:w.value,value:o.value})}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(o=>o.status==="aborted"?_t:(o.status==="dirty"&&w.dirty(),S(o.value).then(()=>({status:w.value,value:o.value}))))}if(R.type==="transform")if(I.common.async===!1){const S=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});if(!po(S))return S;const o=R.transform(S.value,F);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:w.value,value:o}}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(S=>po(S)?Promise.resolve(R.transform(S.value,F)).then(o=>({status:w.value,value:o})):S);Zt.assertNever(R)}}yo.create=(v,g,w)=>new yo({schema:v,typeName:ft.ZodEffects,effect:g,...Ct(w)}),yo.createWithPreprocess=(v,g,w)=>new yo({schema:g,effect:{type:"preprocess",transform:v},typeName:ft.ZodEffects,...Ct(w)});class Ra extends Bt{_parse(g){return this._getType(g)===Ke.undefined?Fr(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Ra.create=(v,g)=>new Ra({innerType:v,typeName:ft.ZodOptional,...Ct(g)});class xo extends Bt{_parse(g){return this._getType(g)===Ke.null?Fr(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}xo.create=(v,g)=>new xo({innerType:v,typeName:ft.ZodNullable,...Ct(g)});class ld extends Bt{_parse(g){const{ctx:w}=this._processInputParams(g);let I=w.data;return w.parsedType===Ke.undefined&&(I=this._def.defaultValue()),this._def.innerType._parse({data:I,path:w.path,parent:w})}removeDefault(){return this._def.innerType}}ld.create=(v,g)=>new ld({innerType:v,typeName:ft.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...Ct(g)});class cd extends Bt{_parse(g){const{ctx:w}=this._processInputParams(g),I={...w,common:{...w.common,issues:[]}},R=this._def.innerType._parse({data:I.data,path:I.path,parent:{...I}});return fu(R)?R.then(F=>({status:"valid",value:F.status==="valid"?F.value:this._def.catchValue({get error(){return new cn(I.common.issues)},input:I.data})})):{status:"valid",value:R.status==="valid"?R.value:this._def.catchValue({get error(){return new cn(I.common.issues)},input:I.data})}}removeCatch(){return this._def.innerType}}cd.create=(v,g)=>new cd({innerType:v,typeName:ft.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...Ct(g)});class Gf extends Bt{_parse(g){if(this._getType(g)!==Ke.nan){const I=this._getOrReturnCtx(g);return qe(I,{code:Ve.invalid_type,expected:Ke.nan,received:I.parsedType}),_t}return{status:"valid",value:g.data}}}Gf.create=v=>new Gf({typeName:ft.ZodNaN,...Ct(v)});class zy extends Bt{_parse(g){const{ctx:w}=this._processInputParams(g),I=w.data;return this._def.type._parse({data:I,path:w.path,parent:w})}unwrap(){return this._def.type}}class ud extends Bt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.common.async)return(async()=>{const F=await this._def.in._parseAsync({data:I.data,path:I.path,parent:I});return F.status==="aborted"?_t:F.status==="dirty"?(w.dirty(),Sl(F.value)):this._def.out._parseAsync({data:F.value,path:I.path,parent:I})})();{const R=this._def.in._parseSync({data:I.data,path:I.path,parent:I});return R.status==="aborted"?_t:R.status==="dirty"?(w.dirty(),{status:"dirty",value:R.value}):this._def.out._parseSync({data:R.value,path:I.path,parent:I})}}static create(g,w){return new ud({in:g,out:w,typeName:ft.ZodPipeline})}}class hd extends Bt{_parse(g){const w=this._def.innerType._parse(g),I=R=>(po(R)&&(R.value=Object.freeze(R.value)),R);return fu(w)?w.then(R=>I(R)):I(w)}unwrap(){return this._def.innerType}}hd.create=(v,g)=>new hd({innerType:v,typeName:ft.ZodReadonly,...Ct(g)});var ft;(function(v){v.ZodString="ZodString",v.ZodNumber="ZodNumber",v.ZodNaN="ZodNaN",v.ZodBigInt="ZodBigInt",v.ZodBoolean="ZodBoolean",v.ZodDate="ZodDate",v.ZodSymbol="ZodSymbol",v.ZodUndefined="ZodUndefined",v.ZodNull="ZodNull",v.ZodAny="ZodAny",v.ZodUnknown="ZodUnknown",v.ZodNever="ZodNever",v.ZodVoid="ZodVoid",v.ZodArray="ZodArray",v.ZodObject="ZodObject",v.ZodUnion="ZodUnion",v.ZodDiscriminatedUnion="ZodDiscriminatedUnion",v.ZodIntersection="ZodIntersection",v.ZodTuple="ZodTuple",v.ZodRecord="ZodRecord",v.ZodMap="ZodMap",v.ZodSet="ZodSet",v.ZodFunction="ZodFunction",v.ZodLazy="ZodLazy",v.ZodLiteral="ZodLiteral",v.ZodEnum="ZodEnum",v.ZodEffects="ZodEffects",v.ZodNativeEnum="ZodNativeEnum",v.ZodOptional="ZodOptional",v.ZodNullable="ZodNullable",v.ZodDefault="ZodDefault",v.ZodCatch="ZodCatch",v.ZodPromise="ZodPromise",v.ZodBranded="ZodBranded",v.ZodPipeline="ZodPipeline",v.ZodReadonly="ZodReadonly"})(ft||(ft={}));const Da=Ea.create,yr=fo.create,Ry=nd.create;mo.create,za.create;const xu=ad.create,dd=Vn.create,Or=Oi.create;_u.create,yu.create;const qf=ra.create,zl=Al.create,pd=od.create,Dy=_o.create,Ly=El.create;Ra.create,xo.create;const vu=Or({lat:yr(),lng:yr()}),By=Or({center:vu,zoom:yr()}),Fy=Or({sw:vu,ne:vu}),Hf=Or({primary:Da().max(64),background:Da().max(64),text:Da().max(64)}),Oy=Or({name:pd("dark").or(pd("light")),colors:Hf}),jy=Or({name:pd("custom"),url:Da().max(256),colors:Hf}),Ny=Oy.or(jy),Zy=Or({container:Da(),position:Or({center:Or({lat:yr(),lng:yr()}),zoom:yr()}),restriction:Or({minZoom:yr().min(Qh).max(ho).optional(),maxZoom:yr().min(Qh).max(ho).optional(),maxBounds:Fy.optional()}).optional(),style:Ny});Dy(["idle","move","click","popup_click"]);const Vy=zl().returns(xu()),Uy=zl().returns(xu()),$y=zl().args(By).returns(xu()),Gy=zl().args(vu).returns(xu()),qy={load:Vy,idle:Uy,move:$y,click:Gy},Wf=Or({id:Da(),rank:yr(),lat:yr(),lng:yr(),width:yr(),height:yr()}),Hy=qf([yr(),dd(qf([yr(),yr()]))]),Xf=zl().args(Da()).returns(Ly(Ry())),Wy=Or({data:Wf,state:Hy,callbacks:Or({body:Xf,pin:Xf.optional()})}),Xy=dd(Wy);Or({key:Da(),data:dd(Wf)});var Ky=$h('<div class="container svelte-puxsd1"><div class="map svelte-puxsd1"></div> <div class="logo svelte-puxsd1"><a href="https://arenarium.dev" target="_blank" class="svelte-puxsd1">@arenarium/maps</a></div></div>');function Kf(v,g){eu(g,!0);let w,I,R,F,S,o=er(0),de=er(0),ge=er(!1),ze=er(void 0);vf(()=>{Zy.parse(g.options),Be(),le()});function Be(){var De,Ye,Ze;R=((De=g.options.restriction)==null?void 0:De.minZoom)??Qh,F=((Ye=g.options.restriction)==null?void 0:Ye.maxZoom)??ho,S=(Ze=g.options.restriction)==null?void 0:Ze.maxBounds,w=new ed.Map({style:mt(g.options.style),center:{lat:g.options.position.center.lat,lng:g.options.position.center.lng},zoom:g.options.position.zoom,minZoom:Rt(R),maxZoom:F,maxBounds:S?[S.sw.lng,S.sw.lat,S.ne.lng,S.ne.lat]:void 0,container:I,pitchWithRotate:!1,attributionControl:{compact:!1}})}const ke=()=>w;function le(){w.on("load",Oe),w.on("move",zt),w.on("idle",fi),w.on("click",kt),w.dragRotate.disable(),w.keyboard.disable(),w.touchZoomRotate.disableRotation(),w.touchPitch.disable()}function Oe(){gi(ge,!0),jt("load",null)}function zt(){const De=w.getCenter(),Ye=w.getZoom();jt("move",{center:De,zoom:Ye});const Ze=w.getBounds();gi(ze,{sw:{lat:Ze.getSouthWest().lat,lng:Ze.getSouthWest().lng},ne:{lat:Ze.getNorthEast().lat,lng:Ze.getNorthEast().lng}},!0)}function fi(){jt("idle",null);const De=w.getBounds();gi(ze,{sw:{lat:De.getSouthWest().lat,lng:De.getSouthWest().lng},ne:{lat:De.getNorthEast().lat,lng:De.getNorthEast().lng}},!0)}function kt(De){jt("click",{lat:De.lngLat.lat,lng:De.lngLat.lng})}const Ot=new Map;function Ti(De,Ye){var bt;const Ze=qy[De];if(!Ze)throw new Error(`No schema defined for event ${De}`);if(!Ze.safeParse(Ye).success)throw new Error(`Invalid handler for event ${De}`);Ot.has(De)||Ot.set(De,new Set),(bt=Ot.get(De))==null||bt.add(Ye)}function Wt(De,Ye){const Ze=Ot.get(De);Ze&&Ze.delete(Ye)&&Ze.size===0&&Ot.delete(De)}function jt(De,Ye){const Ze=Ot.get(De);Ze&&Ze.size>0&&[...Ze].forEach(lt=>{try{lt(Ye)}catch(bt){console.error(bt)}})}function Rt(De){const Ye=Sf,Ze=Math.ceil(Math.log2(st(o)/Ye));return Math.max(De,Ze)}function xr(){const De=w.getCenter();return De?{lat:De.lat,lng:De.lng}:{lat:g.options.position.center.lat,lng:g.options.position.center.lng}}function qt(){return w.getZoom()??g.options.position.zoom}function bn(){if(!w)throw new Error("Map not loaded!");const De=w.getBounds();return{sw:{lat:De.getSouthWest().lat,lng:De.getSouthWest().lng},ne:{lat:De.getNorthEast().lat,lng:De.getNorthEast().lng}}}function Yr(De){if(!w)throw new Error("Map not loaded! Consider using the position option");w.setCenter(De)}function Ir(De){if(!w)throw new Error("Map not loaded! Consider using the position option");w.setZoom(De)}function lr(){if(!w)throw new Error("Map not loaded! Consider using the position option");w.zoomIn()}function Ei(){if(!w)throw new Error("Map not loaded! Consider using the position option.");w.zoomOut()}function _i(De){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");R=De,w.setMinZoom(Rt(De))}function un(De){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");F=De,w.setMaxZoom(De)}function yt(De){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");S=De,w.setMaxBounds([De.sw.lng,De.sw.lat,De.ne.lng,De.ne.lat])}let ii=er(ps(g.options.style));Fn(()=>{st(ge)&&w.setStyle(mt(st(ii)),{diff:!0})});function mt(De){if(De.name=="custom")return De.url;switch(De.name){case"light":return ly;case"dark":return oy}}function tr(){return n_(st(ii))}function zi(De){gi(ii,De,!0),w.setStyle(mt(st(ii)),{diff:!0})}class Jr{constructor(Ye){Vt(this,"id");Vt(this,"lat");Vt(this,"lng");Vt(this,"zoom");Vt(this,"element");Vt(this,"component");Vt(this,"libreMarker");this.id=Ye.data.id,this.lat=Ye.data.lat,this.lng=Ye.data.lng,this.zoom=Ye.state[0],this.element=void 0,this.component=void 0,this.libreMarker=void 0}createLibreMarker(){const Ye=this.element;if(!Ye)throw new Error("Failed to create libre marker");const Ze=new ed.Marker({element:Ye});Ze.setLngLat([this.lng,this.lat]),this.libreMarker=Ze}updateMap(Ye){const Ze=this.libreMarker,lt=this.component;if(Ze==null||lt==null)throw new Error("Failed to update popup map");Ye?Ze._map!=Ye&&Ze.addTo(Ye):Ze._map!=null&&Ze.remove()}isCreated(){return this.element!=null}isInBlock(Ye,Ze){return this.zoom<=Ye&&Ze.contains(this.lat,this.lng)}}class cr extends Jr{constructor(Ze){super(Ze);Vt(this,"pinLoading",!1);Vt(this,"pinLoaded",!1);Vt(this,"pinCallback");this.pinCallback=Ze.callbacks.pin}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=qh(iy,{target:this.element,props:{id:this.id+"_circle",priority:this.zoom}}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ze=this.element;if(!Ze)return;const lt=Math.round((ho-this.zoom)*Pf);Ze.style.zIndex=lt.toString()}updateMap(Ze){var lt;super.updateMap(Ze),(lt=this.component)==null||lt.setDisplayed(Ze!=null)}updateState(Ze){const lt=this.component;if(!lt)throw new Error("Failed to update circle state");lt.setScale(this.getScale(Ze))}updatePin(){var lt;if(this.pinCallback==null||this.pinLoaded||this.pinLoading)return;const Ze=(lt=this.component)==null?void 0:lt.getBody();Ze!=null&&(this.pinLoading=!0,this.pinCallback(this.id).then(bt=>{Ze.appendChild(bt),this.pinLoaded=!0,this.pinLoading=!1}))}setExpanded(Ze){if(this.component==null)throw new Error("Failed to set circle expanded");this.component.setScale(this.getScale(Ze))}setCollapsed(){if(this.component==null)throw new Error("Failed to set circle collapsed");this.component.setScale(0)}getScale(Ze){return Math.max(0,1-(this.zoom-Ze)*.1)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isPinLoaded(){return this.pinCallback==null||this.pinLoaded}}class Un extends Jr{constructor(Ze){super(Ze);Vt(this,"width");Vt(this,"height");Vt(this,"states");Vt(this,"bodyLoading",!1);Vt(this,"bodyLoaded",!1);Vt(this,"bodyCallback");this.id=Ze.data.id,this.states=Ze.state[1],this.width=Ze.data.width,this.height=Ze.data.height,this.bodyCallback=Ze.callbacks.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=qh(ey,{target:this.element,props:{id:this.id+"_marker",priority:this.zoom+ho,width:this.width,height:this.height}}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ze=this.element;if(!Ze)return;const lt=Math.round((ho-this.zoom)*Pf)+1e6;Ze.style.zIndex=lt.toString()}updateMap(Ze){var lt;super.updateMap(Ze),(lt=this.component)==null||lt.setDisplayed(Ze!=null)}updateState(Ze){const lt=this.component;if(!lt)throw new Error("Failed to update marker state");lt.setAngle(this.getAngle(Ze))}updateBody(){var lt;if(this.bodyLoaded||this.bodyLoading)return;const Ze=(lt=this.component)==null?void 0:lt.getBody();Ze!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(bt=>{Ze.appendChild(bt),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(Ze){const lt=this.states.findLast(bt=>bt[0]<=Ze);if(!lt)throw new Error("Angle not found");return lt[1]}setCollapsed(Ze){if(this.component==null)throw new Error("Failed to set marker collapsed");this.component.setCollapsed(Ze)}isExpanded(){return this.component?this.component.getExpanded():!1}isCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class qi{constructor(Ye){Vt(this,"id");Vt(this,"rank");Vt(this,"lat");Vt(this,"lng");Vt(this,"zoom");Vt(this,"circle");Vt(this,"marker");this.id=Ye.data.id,this.rank=Ye.data.rank,this.lat=Ye.data.lat,this.lng=Ye.data.lng,this.zoom=Ye.state[0],this.circle=new cr(Ye),this.marker=new Un(Ye)}}let Mi,yi=new Array,xi=new Map,jr=!1,hn=Sf,$n=Up(()=>st(ze)?new kf(w,-512,st(de)+hn,st(o)+hn,-512):void 0),ir=Up(()=>st(ze)?new kf(w,0,st(de),st(o),0):void 0);vf(()=>{const De=()=>{ur(),Mi=window.setTimeout(De,25)};return De(),()=>clearInterval(Mi)});function ur(){if(st(ge)==!1||st(ir)==null||st($n)==null||yi.length==0||jr)return;const De=w.getZoom();if(!De)return;const Ye=De+K_/Math.max(1,Math.log2(yi.length/Y_)),Ze=De;for(const lt of yi){const bt=lt.circle;st(ir).contains(bt.lat,bt.lng)?De<=bt.zoom&&bt.zoom<=Ye?(bt.isCreated()==!1&&bt.createElement(),bt.updateMap(w),bt.updateState(De),bt.isPinLoaded()==!1&&bt.updatePin()):bt.isCreated()==!0&&(bt.setCollapsed(),bt.isCollapsed()&&bt.updateMap(null)):bt.isCreated()==!0&&bt.updateMap(null);const gt=lt.marker;st($n).contains(gt.lat,gt.lng)?gt.zoom<=Ze?(gt.isCreated()==!1&&gt.createElement(),gt.updateMap(w),gt.updateState(De),gt.setCollapsed(!1),gt.isExpanded()&&gt.isBodyLoaded()==!1&&gt.updateBody()):gt.isCreated()==!0&&(gt.setCollapsed(!0),gt.isCollapsed()&&gt.updateMap(null)):gt.isCreated()==!0&&gt.updateMap(null)}}async function Hi(De){var Ye,Ze;try{jr=!0;const lt=new Map(De.map(gt=>[gt.data.id,new qi(gt)])),bt=Array.from(yi);for(const gt of bt)lt.has(gt.id)==!1&&((Ye=gt.circle.libreMarker)==null||Ye.remove(),(Ze=gt.marker.libreMarker)==null||Ze.remove(),xi.delete(gt.id),yi.splice(yi.indexOf(gt),1));for(const gt of De){const hr=xi.get(gt.data.id);if(hr)hr.circle.zoom=gt.state[0],hr.circle.updateZIndex(),hr.marker.zoom=gt.state[0],hr.marker.states=gt.state[1],hr.marker.updateZIndex();else{const Mn=new qi(gt);xi.set(gt.data.id,Mn),yi.push(Mn)}}yi.sort((gt,hr)=>gt.zoom-hr.zoom)}catch(lt){throw console.error(lt),yi.length=0,xi.clear(),lt}finally{jr=!1}}function Ut(){var De,Ye;try{jr=!0;for(const Ze of yi)(De=Ze.circle.libreMarker)==null||De.remove(),(Ye=Ze.marker.libreMarker)==null||Ye.remove();yi.length=0,xi.clear()}catch(Ze){throw console.error(Ze),yi.length=0,xi.clear(),Ze}finally{jr=!1}}async function Nr(De){if(!(await Xy.safeParseAsync(De)).success)throw new Error("Invalid popups");await Hi(De)}function dn(){Ut()}function vr(De){const Ye=xi.get(De);Ye!=null&&w.flyTo({center:{lat:Ye.lat,lng:Ye.lng},zoom:Ye.zoom})}var wn=Ky();D_("resize",Oh,()=>w.setMinZoom(Rt(R)));var Tn=iu(wn);return gs(Tn,De=>I=De,()=>I),jh(()=>Kh(wn,`--map-style-primary: ${st(ii).colors.primary??""}; --map-style-background: ${st(ii).colors.background??""}; --map-style-text: ${st(ii).colors.text??""};`)),du(Tn,"clientWidth",De=>gi(o,De)),du(Tn,"clientHeight",De=>gi(de,De)),Gh(v,wn),tu({maplibre:ke,on:Ti,off:Wt,emit:jt,getCenter:xr,getZoom:qt,getBounds:bn,setCenter:Yr,setZoom:Ir,zoomIn:lr,zoomOut:Ei,setMinZoom:_i,setMaxZoom:un,setMaxBounds:yt,getStyle:tr,setStyle:zi,updatePopups:Nr,removePopups:dn,revealPopup:vr})}function Yy(v){const g=document.getElementById(v.container);if(!g)throw new Error(`Container not found: ${v.container}`);return qh(Kf,{target:g,props:{options:v}})}function Jy(v){O_(v)}Nt.Map=Kf,Nt.mountMap=Yy,Nt.unmountMap=Jy,Object.defineProperty(Nt,Symbol.toStringTag,{value:"Module"})});
742
+ ${B.shaderPreludeCode.vertexSource}`,define:B.shaderDefine},defaultProjectionData:H},W=k.renderingMode?k.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=k.prerender;K&&(f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),K.call(k,A.gl,q),A.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),A.setStencilMode(dt.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,ot.ReadOnly);A.setDepthMode(K),k.render(A.gl,q),A.setDirty(),f.setBaseState(),A.bindFramebuffer.set(null)}}(e,0,s,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!i||!s}useProgram(e,i,s=!1,l=[]){this.cache=this.cache||{};const h=!!this.style.map.terrain,f=this.style.projection,_=s?dr.projectionMercator:f.shaderPreludeCode,x=s?ua:f.shaderDefine,T=e+(i?i.cacheKey:"")+`/${s?Mt:f.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(h?"/terrain":"")+(l?`/${l.join("/")}`:"");return this.cache[T]||(this.cache[T]=new Io(this.context,dr[e],i,Nu[e],this._showOverdrawInspector,h,_,x,l)),this.cache[T]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new qt(this.context,this.debugOverlayCanvas,this.context.gl.RGBA))}destroy(){this.debugOverlayTexture&&this.debugOverlayTexture.destroy()}overLimit(){const{drawingBufferWidth:e,drawingBufferHeight:i}=this.context.gl;return this.width!==e||this.height!==i}}function Us(u,e){let i,s=!1,l=null,h=null;const f=()=>{l=null,s&&(u.apply(h,i),l=setTimeout(f,e),s=!1)};return(..._)=>(s=!0,h=this,i=_,l||f(),l)}class lc{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let s;return i.split("&").map(l=>l.split("=")).forEach(l=>{l[0]===this._hashName&&(s=l)}),(s&&s[1]||"").split("/")}return i.split("/")},this._onHashChange=()=>{const i=this._getCurrentHash();if(!this._isValidHash(i))return!1;const s=this._map.dragRotate.isEnabled()&&this._map.touchZoomRotate.isEnabled()?+(i[3]||0):this._map.getBearing();return this._map.jumpTo({center:[+i[2],+i[1]],zoom:+i[0],bearing:s,pitch:+(i[4]||0)}),!0},this._updateHashUnthrottled=()=>{const i=window.location.href.replace(/(#.*)?$/,this.getHashString());window.history.replaceState(window.history.state,null,i)},this._removeHash=()=>{const i=this._getCurrentHash();if(i.length===0)return;const s=i.join("/");let l=s;l.split("&").length>0&&(l=l.split("&")[0]),this._hashName&&(l=`${this._hashName}=${s}`);let h=window.location.hash.replace(l,"");h.startsWith("#&")?h=h.slice(0,1)+h.slice(2):h==="#"&&(h="");let f=window.location.href.replace(/(#.+)?$/,h);f=f.replace("&&","&"),window.history.replaceState(window.history.state,null,f)},this._updateHash=Us(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,l=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,l),f=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,x=this._map.getBearing(),T=this._map.getPitch();let P="";if(P+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(x||T)&&(P+="/"+Math.round(10*x)/10),T&&(P+=`/${Math.round(T)}`),this._hashName){const A=this._hashName;let k=!1;const B=window.location.hash.slice(1).split("&").map(O=>{const H=O.split("=")[0];return H===A?(k=!0,`${H}=${P}`):O}).filter(O=>O);return k||B.push(`${A}=${P}`),`#${B.join("&")}`}return`#${P}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new o.Q(+e[2],+e[1])}catch{return!1}const i=+e[0],s=+(e[3]||0),l=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&s>=-180&&s<=180&&l>=this._map.getMinPitch()&&l<=this._map.getMaxPitch()}}const gn={linearity:.3,easing:o.cd(0,0,.3,1)},cc=o.e({deceleration:2500,maxSpeed:1400},gn),$s=o.e({deceleration:20,maxSpeed:1400},gn),uc=o.e({deceleration:1e3,maxSpeed:360},gn),eh=o.e({deceleration:1e3,maxSpeed:90},gn),th=o.e({deceleration:1e3,maxSpeed:360},gn);class ih{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ke.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=ke.now();for(;e.length>0&&i-e[0].time>160;)e.shift()}_onMoveEnd(e){if(this._drainInertiaBuffer(),this._inertiaBuffer.length<2)return;const i={zoom:0,bearing:0,pitch:0,roll:0,pan:new o.P(0,0),pinchAround:void 0,around:void 0};for(const{settings:h}of this._inertiaBuffer)i.zoom+=h.zoomDelta||0,i.bearing+=h.bearingDelta||0,i.pitch+=h.pitchDelta||0,i.roll+=h.rollDelta||0,h.panDelta&&i.pan._add(h.panDelta),h.around&&(i.around=h.around),h.pinchAround&&(i.pinchAround=h.pinchAround);const s=this._inertiaBuffer[this._inertiaBuffer.length-1].time-this._inertiaBuffer[0].time,l={};if(i.pan.mag()){const h=Ya(i.pan.mag(),s,o.e({},cc,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,Ka(l,h)}if(i.zoom){const h=Ya(i.zoom,s,$s);l.zoom=this._map.transform.zoom+h.amount,Ka(l,h)}if(i.bearing){const h=Ya(i.bearing,s,uc);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),Ka(l,h)}if(i.pitch){const h=Ya(i.pitch,s,eh);l.pitch=this._map.transform.pitch+h.amount,Ka(l,h)}if(i.roll){const h=Ya(i.roll,s,th);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),Ka(l,h)}if(l.zoom||l.bearing){const h=i.pinchAround===void 0?i.around:i.pinchAround;l.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),o.e(l,{noMoveStart:!0})}}function Ka(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function Ya(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ae(u*l/(e/1e3),-s,s),_=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*_,amount:f*(_/2)}}class Ri extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s,l={}){s=s instanceof MouseEvent?s:new MouseEvent(e,s);const h=le.mousePos(i.getCanvas(),s),f=i.unproject(h);super(e,o.e({point:h,lngLat:f,originalEvent:s},l)),this._defaultPrevented=!1,this.target=i}}class Ja extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){const l=e==="touchend"?s.changedTouches:s.touches,h=le.touchPos(i.getCanvasContainer(),l),f=h.map(x=>i.unproject(x)),_=h.reduce((x,T,P,A)=>x.add(T.div(A.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class hc extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class rh{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new hc(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new Ri(e.type,this._map,e))}mouseup(e){this._map.fire(new Ri(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new Ri(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Ri(e.type,this._map,e))}mouseover(e){this._map.fire(new Ri(e.type,this._map,e))}mouseout(e){this._map.fire(new Ri(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Ja(e.type,this._map,e))}touchmove(e){this._map.fire(new Ja(e.type,this._map,e))}touchend(e){this._map.fire(new Ja(e.type,this._map,e))}touchcancel(e){this._map.fire(new Ja(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class nh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Ri(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Ri("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Ri(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Qa{constructor(e){this._map=e}get transform(){return this._map._requestedCameraState||this._map.transform}get center(){return{lng:this.transform.center.lng,lat:this.transform.center.lat}}get zoom(){return this.transform.zoom}get pitch(){return this.transform.pitch}get bearing(){return this.transform.bearing}unproject(e){return this.transform.screenPointToLocation(o.P.convert(e),this._map.terrain)}}class dc{constructor(e,i){this._map=e,this._tr=new Qa(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&e.button===0&&(le.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const s=i;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const l=this._startPos;this._lastPos=s,this._box||(this._box=le.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(l.x,s.x),f=Math.max(l.x,s.x),_=Math.min(l.y,s.y),x=Math.max(l.y,s.y);le.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),le.suppressClick(),s.x!==l.x||s.y!==l.y)return this._map.fire(new o.l("boxzoomend",{originalEvent:e})),{cameraAnimation:h=>h.fitScreenCoordinates(s,l,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(le.remove(this._box),this._box=null),le.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Yo(u,e){if(u.length!==e.length)throw new Error(`The number of touches and points are not equal - touches ${u.length}, points ${e.length}`);const i={};for(let s=0;s<u.length;s++)i[u[s].identifier]=e[s];return i}class ah{constructor(e){this.reset(),this.numTouches=e.numTouches}reset(){delete this.centroid,delete this.startTime,delete this.touches,this.aborted=!1}touchstart(e,i,s){(this.centroid||s.length>this.numTouches)&&(this.aborted=!0),this.aborted||(this.startTime===void 0&&(this.startTime=e.timeStamp),s.length===this.numTouches&&(this.centroid=function(l){const h=new o.P(0,0);for(const f of l)h._add(f);return h.div(l.length)}(i),this.touches=Yo(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Yo(s,i);for(const h in this.touches){const f=l[h];(!f||f.dist(this.touches[h])>30)&&(this.aborted=!0)}}touchend(e,i,s){if((!this.centroid||e.timeStamp-this.startTime>500)&&(this.aborted=!0),s.length===0){const l=!this.aborted&&this.centroid;if(this.reset(),l)return l}}}class es{constructor(e){this.singleTap=new ah(e),this.numTaps=e.numTaps,this.reset()}reset(){this.lastTime=1/0,delete this.lastTap,this.count=0,this.singleTap.reset()}touchstart(e,i,s){this.singleTap.touchstart(e,i,s)}touchmove(e,i,s){this.singleTap.touchmove(e,i,s)}touchend(e,i,s){const l=this.singleTap.touchend(e,i,s);if(l){const h=e.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(l)<30;if(h&&f||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=l,this.count===this.numTaps)return this.reset(),l}}}class sh{constructor(e){this._tr=new Qa(e),this._zoomIn=new es({numTouches:1,numTaps:2}),this._zoomOut=new es({numTouches:2,numTaps:1}),this.reset()}reset(){this._active=!1,this._zoomIn.reset(),this._zoomOut.reset()}touchstart(e,i,s){this._zoomIn.touchstart(e,i,s),this._zoomOut.touchstart(e,i,s)}touchmove(e,i,s){this._zoomIn.touchmove(e,i,s),this._zoomOut.touchmove(e,i,s)}touchend(e,i,s){const l=this._zoomIn.touchend(e,i,s),h=this._zoomOut.touchend(e,i,s),f=this._tr;return l?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(l)},{originalEvent:e})}):h?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom-1,around:f.unproject(h)},{originalEvent:e})}):void 0}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class ar{constructor(e){this._enabled=!!e.enable,this._moveStateManager=e.moveStateManager,this._clickTolerance=e.clickTolerance||1,this._moveFunction=e.move,this._activateOnStart=!!e.activateOnStart,e.assignEvents(this),this.reset()}reset(e){this._active=!1,this._moved=!1,delete this._lastPoint,this._moveStateManager.endMove(e)}_move(...e){const i=this._moveFunction(...e);if(i.bearingDelta||i.pitchDelta||i.rollDelta||i.around||i.panDelta)return this._active=!0,i}dragStart(e,i){this.isEnabled()&&!this._lastPoint&&this._moveStateManager.isValidStartEvent(e)&&(this._moveStateManager.startMove(e),this._lastPoint=Array.isArray(i)?i[0]:i,this._activateOnStart&&this._lastPoint&&(this._active=!0))}dragMove(e,i){if(!this.isEnabled())return;const s=this._lastPoint;if(!s)return;if(e.preventDefault(),!this._moveStateManager.isValidMoveEvent(e))return void this.reset(e);const l=Array.isArray(i)?i[0]:i;return!this._moved&&l.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=l,this._move(s,l))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&le.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Qr={0:1,2:2};class ts{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=le.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=Qr[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return le.mouseButton(e)===this._eventButton}}class en{constructor(){this._firstTouch=void 0}_isOneFingerTouch(e){return e.targetTouches.length===1}_isSameTouchEvent(e){return e.targetTouches[0].identifier===this._firstTouch}startMove(e){this._firstTouch=e.targetTouches[0].identifier}endMove(e){delete this._firstTouch}isValidStartEvent(e){return this._isOneFingerTouch(e)}isValidMoveEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}isValidEndEvent(e){return this._isOneFingerTouch(e)&&this._isSameTouchEvent(e)}}class is{constructor(e=new ts({checkCorrectEvent:()=>!0}),i=new en){this.mouseMoveStateManager=e,this.oneFingerTouchMoveStateManager=i}_executeRelevantHandler(e,i,s){return e instanceof MouseEvent?i(e):typeof TouchEvent<"u"&&e instanceof TouchEvent?s(e):void 0}startMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.startMove(i),i=>this.oneFingerTouchMoveStateManager.startMove(i))}endMove(e){this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.endMove(i),i=>this.oneFingerTouchMoveStateManager.endMove(i))}isValidStartEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidStartEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidStartEvent(i))}isValidMoveEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidMoveEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidMoveEvent(i))}isValidEndEvent(e){return this._executeRelevantHandler(e,i=>this.mouseMoveStateManager.isValidEndEvent(i),i=>this.oneFingerTouchMoveStateManager.isValidEndEvent(i))}}const Jo=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Bd{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new o.P(0,0)}_shouldBePrevented(e){return e<(this._map.cooperativeGestures.isEnabled()?2:1)}touchstart(e,i,s){return this._calculateTransform(e,i,s)}touchmove(e,i,s){if(this._active){if(!this._shouldBePrevented(s.length))return e.preventDefault(),this._calculateTransform(e,i,s);this._map.cooperativeGestures.notifyGestureBlocked("touch_pan",e)}}touchend(e,i,s){this._calculateTransform(e,i,s),this._active&&this._shouldBePrevented(s.length)&&this.reset()}touchcancel(){this.reset()}_calculateTransform(e,i,s){s.length>0&&(this._active=!0);const l=Yo(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const P=l[T],A=this._touches[T];A&&(h._add(P),f._add(P.sub(A)),_++,l[T]=P)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const x=f.div(_);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class pc{constructor(){this.reset()}reset(){this._active=!1,delete this._firstTwoTouches}touchstart(e,i,s){this._firstTwoTouches||s.length<2||(this._firstTwoTouches=[s[0].identifier,s[1].identifier],this._start([i[0],i[1]]))}touchmove(e,i,s){if(!this._firstTwoTouches)return;e.preventDefault();const[l,h]=this._firstTwoTouches,f=Qo(s,i,l),_=Qo(s,i,h);if(!f||!_)return;const x=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],x,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=Qo(s,i,l),_=Qo(s,i,h);f&&_||(this._active&&le.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Qo(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function fc(u,e){return Math.log(u/e)/Math.LN2}class rs extends pc{reset(){super.reset(),delete this._distance,delete this._startDistance}_start(e){this._startDistance=this._distance=e[0].dist(e[1])}_move(e,i){const s=this._distance;if(this._distance=e[0].dist(e[1]),this._active||!(Math.abs(fc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:fc(this._distance,s),pinchAround:i}}}function _n(u,e){return 180*u.angleWith(e)/Math.PI}class $e extends pc{reset(){super.reset(),delete this._minDiameter,delete this._startVector,delete this._vector}_start(e){this._startVector=this._vector=e[0].sub(e[1]),this._minDiameter=e[0].dist(e[1])}_move(e,i,s){const l=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:_n(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=_n(e,this._startVector);return Math.abs(s)<i}}function el(u){return Math.abs(u.y)>Math.abs(u.x)}class tl extends pc{constructor(e){super(),this._currentTouchCount=0,this._map=e}reset(){super.reset(),this._valid=void 0,delete this._firstMove,delete this._lastPoints}touchstart(e,i,s){super.touchstart(e,i,s),this._currentTouchCount=s.length}_start(e){this._lastPoints=e,el(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const l=e[0].sub(this._lastPoints[0]),h=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(l,h,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(l.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,s){if(this._valid!==void 0)return this._valid;const l=e.mag()>=2,h=i.mag()>=2;if(!l&&!h)return;if(!l||!h)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=e.y>0==i.y>0;return el(e)&&el(i)&&f}}const oh={panStep:100,bearingStep:15,pitchStep:10};class ns{constructor(e){this._tr=new Qa(e);const i=oh;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,s=0,l=0,h=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),h=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),h=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,l=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:Gs,zoom:i?Math.round(x.zoom)+i*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:x.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function Gs(u){return u*(2-u)}const mc=4.000244140625;class vt{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new Qa(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const s=ke.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%mc==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":l>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(l*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=le.mousePos(this._map.getCanvas(),e),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(o.Q.convert(s.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>mc?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const T=typeof this._targetZoom!="number"?e.scale:o.ac(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),o.ah(T*x)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,s=this._startZoom,l=this._easing;let h,f=!1;if(this._type==="wheel"&&s&&l){const _=ke.now()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),T=l(x);h=o.B.number(s,i,T),x<1?this._frameId||(this._frameId=!0):f=!0}else h=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=h,{noInertia:!0,needsRenderFrame:!f,zoomDelta:h-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=o.cf;if(this._prevEase){const s=this._prevEase,l=(ke.now()-s.start)/s.duration,h=s.easing(l+.01)-s.easing(l),f=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=o.cd(f,_,.25,1)}return this._prevEase={start:ke.now(),duration:e,easing:i},i}reset(){this._active=!1,this._zooming=!1,delete this._targetZoom,delete this._lastExpectedZoom,this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout)}}class il{constructor(e,i){this._clickZoom=e,this._tapZoom=i}enable(){this._clickZoom.enable(),this._tapZoom.enable()}disable(){this._clickZoom.disable(),this._tapZoom.disable()}isEnabled(){return this._clickZoom.isEnabled()&&this._tapZoom.isEnabled()}isActive(){return this._clickZoom.isActive()||this._tapZoom.isActive()}}class Fd{constructor(e){this._tr=new Qa(e),this.reset()}reset(){this._active=!1}dblclick(e,i){return e.preventDefault(),{cameraAnimation:s=>{s.easeTo({duration:300,zoom:this._tr.zoom+(e.shiftKey?-1:1),around:this._tr.unproject(i)},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class gc{constructor(){this._tap=new es({numTouches:1,numTaps:1}),this.reset()}reset(){this._active=!1,delete this._swipePoint,delete this._swipeTouch,delete this._tapTime,delete this._tapPoint,this._tap.reset()}touchstart(e,i,s){if(!this._swipePoint)if(this._tapTime){const l=i[0],h=e.timeStamp-this._tapTime<500,f=this._tapPoint.dist(l)<30;h&&f?s.length>0&&(this._swipePoint=l,this._swipeTouch=s[0].identifier):this.reset()}else this._tap.touchstart(e,i,s)}touchmove(e,i,s){if(this._tapTime){if(this._swipePoint){if(s[0].identifier!==this._swipeTouch)return;const l=i[0],h=l.y-this._swipePoint.y;return this._swipePoint=l,e.preventDefault(),this._active=!0,{zoomDelta:h/128}}}else this._tap.touchmove(e,i,s)}touchend(e,i,s){if(this._tapTime)this._swipePoint&&s.length===0&&this.reset();else{const l=this._tap.touchend(e,i,s);l&&(this._tapTime=e.timeStamp,this._tapPoint=l)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class lh{constructor(e,i,s){this._el=e,this._mousePan=i,this._touchPan=s}enable(e){this._inertiaOptions=e||{},this._mousePan.enable(),this._touchPan.enable(),this._el.classList.add("maplibregl-touch-drag-pan")}disable(){this._mousePan.disable(),this._touchPan.disable(),this._el.classList.remove("maplibregl-touch-drag-pan")}isEnabled(){return this._mousePan.isEnabled()&&this._touchPan.isEnabled()}isActive(){return this._mousePan.isActive()||this._touchPan.isActive()}}class ch{constructor(e,i,s,l){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=s,this._mouseRoll=l}enable(){this._mouseRotate.enable(),this._pitchWithRotate&&this._mousePitch.enable(),this._rollEnabled&&this._mouseRoll.enable()}disable(){this._mouseRotate.disable(),this._mousePitch.disable(),this._mouseRoll.disable()}isEnabled(){return this._mouseRotate.isEnabled()&&(!this._pitchWithRotate||this._mousePitch.isEnabled())&&(!this._rollEnabled||this._mouseRoll.isEnabled())}isActive(){return this._mouseRotate.isActive()||this._mousePitch.isActive()||this._mouseRoll.isActive()}}class _c{constructor(e,i,s,l){this._el=e,this._touchZoom=i,this._touchRotate=s,this._tapDragZoom=l,this._rotationDisabled=!1,this._enabled=!0}enable(e){this._touchZoom.enable(e),this._rotationDisabled||this._touchRotate.enable(e),this._tapDragZoom.enable(),this._el.classList.add("maplibregl-touch-zoom-rotate")}disable(){this._touchZoom.disable(),this._touchRotate.disable(),this._tapDragZoom.disable(),this._el.classList.remove("maplibregl-touch-zoom-rotate")}isEnabled(){return this._touchZoom.isEnabled()&&(this._rotationDisabled||this._touchRotate.isEnabled())&&this._tapDragZoom.isEnabled()}isActive(){return this._touchZoom.isActive()||this._touchRotate.isActive()||this._tapDragZoom.isActive()}disableRotation(){this._rotationDisabled=!0,this._touchRotate.disable()}enableRotation(){this._rotationDisabled=!1,this._touchZoom.isEnabled()&&this._touchRotate.enable()}}class rl{constructor(e,i){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=le.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),l=document.createElement("div");l.className="maplibregl-desktop-message",l.textContent=i,this._container.appendChild(l);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=s,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(le.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new o.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const qs=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Od extends o.l{}function nl(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class jd{constructor(e,i){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,h)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},x={},T={};for(const{handlerName:k,handler:B,allowed:O}of this._handlers){if(!B.isEnabled())continue;let H;if(this._blockedByActive(T,O,k))B.reset();else if(B[h||l.type]){if(o.cg(l,h||l.type)){const q=le.mousePos(this._map.getCanvas(),l);H=B[h||l.type](l,q)}else if(o.ch(l,h||l.type)){const q=this._getMapTouches(l.touches),W=le.touchPos(this._map.getCanvas(),q);H=B[h||l.type](l,W,q)}else o.ci(h||l.type)||(H=B[h||l.type](l));this.mergeHandlerResult(_,x,H,k,f),H&&H.needsRenderFrame&&this._triggerRenderFrame()}(H||B.isActive())&&(T[k]=B)}const P={};for(const k in this._previousActiveHandlers)T[k]||(P[k]=f);this._previousActiveHandlers=T,(Object.keys(P).length||nl(_))&&(this._changes.push([_,x,P]),this._triggerRenderFrame()),(Object.keys(T).length||nl(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=_;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new ih(e),this._bearingSnap=i.bearingSnap,this._previousActiveHandlers={},this._eventsInProgress={},this._addDefaultHandlers(i);const s=this._el;this._listeners=[[s,"touchstart",{passive:!0}],[s,"touchmove",{passive:!1}],[s,"touchend",void 0],[s,"touchcancel",void 0],[s,"mousedown",void 0],[s,"mousemove",void 0],[s,"mouseup",void 0],[document,"mousemove",{capture:!0}],[document,"mouseup",void 0],[s,"mouseover",void 0],[s,"mouseout",void 0],[s,"dblclick",void 0],[s,"click",void 0],[s,"keydown",{capture:!1}],[s,"keyup",void 0],[s,"wheel",{passive:!1}],[s,"contextmenu",void 0],[window,"blur",void 0]];for(const[l,h,f]of this._listeners)le.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)le.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new rh(i,e));const l=i.boxZoom=new dc(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new rl(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new sh(i),_=new Fd(i);i.doubleClickZoom=new il(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new gc;this._add("tapDragZoom",x);const T=i.touchPitch=new tl(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const P=()=>i.project(i.getCenter()),A=function({enable:ee,clickTolerance:ie,aroundCenter:se=!0,minPixelCenterThreshold:re=100,rotateDegreesPerPixelMoved:pe=.8},Me){const xe=new ts({checkCorrectEvent:ve=>le.mouseButton(ve)===0&&ve.ctrlKey||le.mouseButton(ve)===2&&!ve.ctrlKey});return new ar({clickTolerance:ie,move:(ve,be)=>{const je=Me();if(se&&Math.abs(je.y-ve.y)>re)return{bearingDelta:o.ce(new o.P(ve.x,be.y),be,je)};let Fe=(be.x-ve.x)*pe;return se&&be.y<je.y&&(Fe=-Fe),{bearingDelta:Fe}},moveStateManager:xe,enable:ee,assignEvents:Jo})}(e,P),k=function({enable:ee,clickTolerance:ie,pitchDegreesPerPixelMoved:se=-.5}){const re=new ts({checkCorrectEvent:pe=>le.mouseButton(pe)===0&&pe.ctrlKey||le.mouseButton(pe)===2});return new ar({clickTolerance:ie,move:(pe,Me)=>({pitchDelta:(Me.y-pe.y)*se}),moveStateManager:re,enable:ee,assignEvents:Jo})}(e),B=function({enable:ee,clickTolerance:ie,rollDegreesPerPixelMoved:se=.3},re){const pe=new ts({checkCorrectEvent:Me=>le.mouseButton(Me)===2&&Me.ctrlKey});return new ar({clickTolerance:ie,move:(Me,xe)=>{const ve=re();let be=(xe.x-Me.x)*se;return xe.y<ve.y&&(be=-be),{rollDelta:be}},moveStateManager:pe,enable:ee,assignEvents:Jo})}(e,P);i.dragRotate=new ch(e,A,k,B),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",k,["mouseRotate","mouseRoll"]),this._add("mouseRoll",B,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:ee,clickTolerance:ie}){const se=new ts({checkCorrectEvent:re=>le.mouseButton(re)===0&&!re.ctrlKey});return new ar({clickTolerance:ie,move:(re,pe)=>({around:pe,panDelta:pe.sub(re)}),activateOnStart:!0,moveStateManager:se,enable:ee,assignEvents:Jo})}(e),H=new Bd(e,i);i.dragPan=new lh(s,O,H),this._add("mousePan",O),this._add("touchPan",H,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const q=new $e,W=new rs;i.touchZoomRotate=new _c(s,W,q,x),this._add("touchRotate",q,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new vt(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const te=i.keyboard=new ns(i);this._add("keyboard",te),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new nh(i))}_add(e,i,s){this._handlers.push({handlerName:e,handler:i,allowed:s}),this._handlersById[e]=i}stop(e){if(!this._updatingCamera){for(const{handler:i}of this._handlers)i.reset();this._inertia.clear(),this._fireEvents({},{},e),this._changes=[]}}isActive(){for(const{handler:e}of this._handlers)if(e.isActive())return!0;return!1}isZooming(){return!!this._eventsInProgress.zoom||this._map.scrollZoom.isZooming()}isRotating(){return!!this._eventsInProgress.rotate}isMoving(){return!!qs(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,s){for(const l in e)if(l!==s&&(!i||i.indexOf(l)<0))return!0;return!1}_getMapTouches(e){const i=[];for(const s of e)this._el.contains(s.target)&&i.push(s);return i}mergeHandlerResult(e,i,s,l,h){if(!s)return;o.e(e,s);const f={handlerName:l,originalEvent:s.originalEvent||h};s.zoomDelta!==void 0&&(i.zoom=f),s.panDelta!==void 0&&(i.drag=f),s.rollDelta!==void 0&&(i.roll=f),s.pitchDelta!==void 0&&(i.pitch=f),s.bearingDelta!==void 0&&(i.rotate=f)}_applyChanges(){const e={},i={},s={};for(const[l,h,f]of this._changes)l.panDelta&&(e.panDelta=(e.panDelta||new o.P(0,0))._add(l.panDelta)),l.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+l.zoomDelta),l.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+l.bearingDelta),l.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+l.pitchDelta),l.rollDelta&&(e.rollDelta=(e.rollDelta||0)+l.rollDelta),l.around!==void 0&&(e.around=l.around),l.pinchAround!==void 0&&(e.pinchAround=l.pinchAround),l.noInertia&&(e.noInertia=l.noInertia),o.e(i,h),o.e(s,f);this._updateMapTransform(e,i,s),this._changes=[]}_updateMapTransform(e,i,s){const l=this._map,h=l._getTransformForUpdate(),f=l.terrain;if(!(nl(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:T,pitchDelta:P,rollDelta:A,around:k,pinchAround:B}=e;B!==void 0&&(k=B),k=k||l.transform.centerPoint,f&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const O={panDelta:_,zoomDelta:x,rollDelta:A,pitchDelta:P,bearingDelta:T,around:k};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const H=k.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?k.sub(_):k);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(O,h,H):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(O,h,H))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._map.cameraHelper.handleMapControlsPan(O,h,H)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=qs(this._eventsInProgress),h=qs(e),f={};for(const A in e){const{originalEvent:k}=e[A];this._eventsInProgress[A]||(f[`${A}start`]=k),this._eventsInProgress[A]=e[A]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const A in f)this._fireEvent(A,f[A]);h&&this._fireEvent("move",h.originalEvent);for(const A in e){const{originalEvent:k}=e[A];this._fireEvent(A,k)}const _={};let x;for(const A in this._eventsInProgress){const{handlerName:k,originalEvent:B}=this._eventsInProgress[A];this._handlersById[k].isActive()||(delete this._eventsInProgress[A],x=i[k]||B,_[`${A}end`]=x)}for(const A in _)this._fireEvent(A,_[A]);const T=qs(this._eventsInProgress),P=(l||h)&&!T;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const A=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&A.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(A)}if(s&&P){this._updatingCamera=!0;const A=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),k=B=>B!==0&&-this._bearingSnap<B&&B<this._bearingSnap;!A||!A.essential&&ke.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:x})),k(this._map.getBearing())&&this._map.resetNorth()):(k(A.bearing||this._map.getBearing())&&(A.bearing=0),A.freezeElevation=!0,this._map.easeTo(A,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new o.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Od("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Nd extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((ke.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(l)),l<1&&this._easeFrameId?this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback):this.stop()},this._moving=!1,this._zooming=!1,this.transform=e,this._bearingSnap=s.bearingSnap,this.cameraHelper=i,this.on("moveend",()=>{delete this._requestedCameraState})}migrateProjection(e,i){e.apply(this.transform),this.transform=e,this.cameraHelper=i}getCenter(){return new o.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,s){return e=o.P.convert(e).mult(-1),this.panTo(this.transform.center,o.e({offset:e},i),s)}panTo(e,i,s){return this.easeTo(o.e({center:e},i),s)}getZoom(){return this.transform.zoom}setZoom(e,i){return this.jumpTo({zoom:e},i),this}zoomTo(e,i,s){return this.easeTo(o.e({zoom:e},i),s)}zoomIn(e,i){return this.zoomTo(this.getZoom()+1,e,i),this}zoomOut(e,i){return this.zoomTo(this.getZoom()-1,e,i),this}getVerticalFieldOfView(){return this.transform.fov}setVerticalFieldOfView(e,i){return e!=this.transform.fov&&(this.transform.setFov(e),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)).fire(new o.l("moveend",i))),this}getBearing(){return this.transform.bearing}setBearing(e,i){return this.jumpTo({bearing:e},i),this}getPadding(){return this.transform.padding}setPadding(e,i){return this.jumpTo({padding:e},i),this}rotateTo(e,i,s){return this.easeTo(o.e({bearing:e},i),s)}resetNorth(e,i){return this.rotateTo(0,o.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(o.e({bearing:0,pitch:0,roll:0,duration:1e3},e),i),this}snapToNorth(e,i){return Math.abs(this.getBearing())<this._bearingSnap?this.resetNorth(e,i):this}getPitch(){return this.transform.pitch}setPitch(e,i){return this.jumpTo({pitch:e},i),this}getRoll(){return this.transform.roll}setRoll(e,i){return this.jumpTo({roll:e},i),this}cameraForBounds(e,i){e=Ut.convert(e).adjustAntiMeridian();const s=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,i)}_cameraForBoxAndBearing(e,i,s,l){const h={top:0,bottom:0,right:0,left:0};if(typeof(l=o.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const T=l.padding;l.padding={top:T,bottom:T,right:T,left:T}}const f=o.e(h,l.padding);l.padding=f;const _=this.transform,x=new Ut(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,x,s,_)}fitBounds(e,i,s){return this._fitInternal(this.cameraForBounds(e,i),i,s)}fitScreenCoordinates(e,i,s,l,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(o.P.convert(e)),this.transform.screenPointToLocation(o.P.convert(i)),s,l),l,h)}_fitInternal(e,i,s){return e?(delete(i=o.e(e,i)).padding,i.linear?this.easeTo(i,s):this.flyTo(i,s)):this}jumpTo(e,i){this.stop();const s=this._getTransformForUpdate();let l=!1,h=!1,f=!1;const _=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const x=s.zoom!==_;return"elevation"in e&&s.elevation!==+e.elevation&&s.setElevation(+e.elevation),"bearing"in e&&s.bearing!==+e.bearing&&(l=!0,s.setBearing(+e.bearing)),"pitch"in e&&s.pitch!==+e.pitch&&(h=!0,s.setPitch(+e.pitch)),"roll"in e&&s.roll!==+e.roll&&(f=!0,s.setRoll(+e.roll)),e.padding==null||s.isPaddingEqual(e.padding)||s.setPadding(e.padding),this._applyUpdatedTransform(s),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)),x&&this.fire(new o.l("zoomstart",i)).fire(new o.l("zoom",i)).fire(new o.l("zoomend",i)),l&&this.fire(new o.l("rotatestart",i)).fire(new o.l("rotate",i)).fire(new o.l("rotateend",i)),h&&this.fire(new o.l("pitchstart",i)).fire(new o.l("pitch",i)).fire(new o.l("pitchend",i)),f&&this.fire(new o.l("rollstart",i)).fire(new o.l("roll",i)).fire(new o.l("rollend",i)),this.fire(new o.l("moveend",i))}calculateCameraOptionsFromTo(e,i,s,l=0){const h=o.$.fromLngLat(e,i),f=o.$.fromLngLat(s,l),_=f.x-h.x,x=f.y-h.y,T=f.z-h.z,P=Math.hypot(_,x,T);if(P===0)throw new Error("Can't calculate camera options with same From and To");const A=Math.hypot(_,x),k=o.ah(this.transform.cameraToCenterDistance/P/this.transform.tileSize),B=180*Math.atan2(_,-x)/Math.PI;let O=180*Math.acos(A/P)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:k,pitch:O,bearing:B}}calculateCameraOptionsFromCameraLngLatAltRotation(e,i,s,l,h){const f=this.transform.calculateCenterFromCameraLngLatAlt(e,i,s,l);return{center:f.center,elevation:f.elevation,zoom:f.zoom,bearing:s,pitch:l,roll:h}}easeTo(e,i){this._stop(!1,e.easeId),((e=o.e({offset:[0,0],duration:500,easing:o.cf},e)).animate===!1||!e.essential&&ke.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,_="bearing"in e?this._normalizeBearing(e.bearing,l):l,x="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:s.padding,A=o.P.convert(e.offset);let k,B;e.around&&(k=o.Q.convert(e.around),B=s.locationToScreenPoint(k));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},H=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:T,padding:P,around:k,aroundPoint:B,offsetAsPoint:A,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||x!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(P),this._zooming=this._zooming||H.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,O),this.terrain&&this._prepareElevation(H.elevationCenter),this._ease(q=>{H.easeFunc(q),this.terrain&&!e.freezeElevation&&this._updateElevation(q),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},q=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,q)},e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new o.l("movestart",e)),this._zooming&&!s.zooming&&this.fire(new o.l("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new o.l("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new o.l("pitchstart",e)),this._rolling&&!s.rolling&&this.fire(new o.l("rollstart",e))}_prepareElevation(e){this._elevationCenter=e,this._elevationStart=this.transform.elevation,this._elevationTarget=this.terrain.getElevationForLngLatZoom(e,this.transform.tileZoom),this._elevationFreeze=!0}_updateElevation(e){this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom));const i=this.terrain.getElevationForLngLatZoom(this._elevationCenter,this.transform.tileZoom);if(e<1&&i!==this._elevationTarget){const s=this._elevationTarget-this._elevationStart;this._elevationStart+=e*(s-(i-(s*e+this._elevationStart))/(1-e)),this._elevationTarget=i}this.transform.setElevation(o.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:_,roll:x,pitch:T,bearing:P,elevation:A}=l(h);f&&h.setCenter(f),A!==void 0&&h.setElevation(A),_!==void 0&&h.setZoom(_),x!==void 0&&h.setRoll(x),T!==void 0&&h.setPitch(T),P!==void 0&&h.setBearing(P),s.apply(h)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new o.l("move",e)),this._zooming&&this.fire(new o.l("zoom",e)),this._rotating&&this.fire(new o.l("rotate",e)),this._pitching&&this.fire(new o.l("pitch",e)),this._rolling&&this.fire(new o.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const s=this._zooming,l=this._rotating,h=this._pitching,f=this._rolling;this._moving=!1,this._zooming=!1,this._rotating=!1,this._pitching=!1,this._rolling=!1,this._padding=!1,s&&this.fire(new o.l("zoomend",e)),l&&this.fire(new o.l("rotateend",e)),h&&this.fire(new o.l("pitchend",e)),f&&this.fire(new o.l("rollend",e)),this.fire(new o.l("moveend",e))}flyTo(e,i){if(!e.essential&&ke.prefersReducedMotion){const be=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(be,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cf},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,x="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,P="roll"in e?this._normalizeBearing(e.roll,f):f,A="padding"in e?e.padding:s.padding,k=o.P.convert(e.offset);let B=s.centerPoint.add(k);const O=s.screenPointToLocation(B),H=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:T,roll:P,padding:A,locationAtOffset:O,offsetAsPoint:k,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let q=e.curve;const W=Math.max(s.width,s.height),K=W/H.scaleOfZoom,te=H.pixelPathLength;typeof H.scaleOfMinZoom=="number"&&(q=Math.sqrt(W/H.scaleOfMinZoom/te*2));const ee=q*q;function ie(be){const je=(K*K-W*W+(be?-1:1)*ee*ee*te*te)/(2*(be?K:W)*ee*te);return Math.log(Math.sqrt(je*je+1)-je)}function se(be){return(Math.exp(be)-Math.exp(-be))/2}function re(be){return(Math.exp(be)+Math.exp(-be))/2}const pe=ie(!1);let Me=function(be){return re(pe)/re(pe+q*be)},xe=function(be){return W*((re(pe)*(se(je=pe+q*be)/re(je))-se(pe))/ee)/te;var je},ve=(ie(!0)-pe)/q;if(Math.abs(te)<2e-6||!isFinite(ve)){if(Math.abs(W-K)<1e-6)return this.easeTo(e,i);const be=K<W?-1:1;ve=Math.abs(Math.log(K/W))/q,xe=()=>0,Me=je=>Math.exp(be*q*je)}return e.duration="duration"in e?+e.duration:1e3*ve/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==x,this._pitching=T!==h,this._rolling=P!==f,this._padding=!s.isPaddingEqual(A),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(H.targetCenter),this._ease(be=>{const je=be*ve,Fe=1/Me(je),Ee=xe(je);this._rotating&&s.setBearing(o.B.number(l,x,be)),this._pitching&&s.setPitch(o.B.number(h,T,be)),this._rolling&&s.setRoll(o.B.number(f,P,be)),this._padding&&(s.interpolatePadding(_,A,be),B=s.centerPoint.add(k)),H.easeFunc(be,Fe,Ee,B),this.terrain&&!e.freezeElevation&&this._updateElevation(be),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},()=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i)},e),this}isEasing(){return!!this._easeFrameId}stop(){return this._stop()}_stop(e,i){var s;if(this._easeFrameId&&(this._cancelRenderFrame(this._easeFrameId),delete this._easeFrameId,delete this._onEaseFrame),this._onEaseEnd){const l=this._onEaseEnd;delete this._onEaseEnd,l.call(this,i)}return e||(s=this.handlers)===null||s===void 0||s.stop(!1),this}_ease(e,i,s){s.animate===!1||s.duration===0?(e(1),i()):(this._easeStart=ke.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=o.aL(e,-180,180);const s=Math.abs(e-i);return Math.abs(e-360-i)<s&&(e-=360),Math.abs(e+360-i)<s&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(o.Q.convert(e),this.transform.tileZoom):null}}const An={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Kt{constructor(e=An){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=le.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=le.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=le.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){le.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,i){const s=this._map._getUIString(`AttributionControl.${i}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(l=>typeof l!="string"?"":l)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const l=this._map.style.stylesheet;this.styleOwner=l.owner,this.styleId=l.id}const i=this._map.style.sourceCaches;for(const l in i){const h=i[l];if(h.used||h.usedForTerrain){const f=h.getSource();f.attribution&&e.indexOf(f.attribution)<0&&e.push(f.attribution)}}e=e.filter(l=>String(l).trim()),e.sort((l,h)=>l.length-h.length),e=e.filter((l,h)=>{for(let f=h+1;f<e.length;f++)if(e[f].indexOf(l)>=0)return!1;return!0});const s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=le.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class Hs{constructor(e={}){this._updateCompact=()=>{const i=this._container.children;if(i.length){const s=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=le.create("div","maplibregl-ctrl");const i=le.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){le.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class yc{constructor(){this._queue=[],this._id=0,this._cleared=!1,this._currentlyRunning=!1}add(e){const i=++this._id;return this._queue.push({callback:e,id:i,cancelled:!1}),i}remove(e){const i=this._currentlyRunning,s=i?this._queue.concat(i):this._queue;for(const l of s)if(l.id===e)return void(l.cancelled=!0)}run(e=0){if(this._currentlyRunning)throw new Error("Attempting to run(), but is already running.");const i=this._currentlyRunning=this._queue;this._queue=[];for(const s of i)if(!s.cancelled&&(s.callback(e),this._cleared))break;this._cleared=!1,this._currentlyRunning=!1}clear(){this._currentlyRunning&&(this._cleared=!0),this._queue=[]}}var uh=o.aG([{name:"a_pos3d",type:"Int16",components:3}]);class hh extends o.E{constructor(e){super(),this._lastTilesetChange=ke.now(),this.sourceCache=e,this._tiles={},this._renderableTilesKeys=[],this._sourceTileCache={},this.minzoom=0,this.maxzoom=22,this.deltaZoom=1,this.tileSize=e._source.tileSize*2**this.deltaZoom,e.usedForTerrain=!0,e.tileSize=this.tileSize}destruct(){this.sourceCache.usedForTerrain=!1,this.sourceCache.tileSize=null}update(e,i){this.sourceCache.update(e,i),this._renderableTilesKeys=[];const s={};for(const l of oe(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))s[l.key]=!0,this._renderableTilesKeys.push(l.key),this._tiles[l.key]||(l.terrainRttPosMatrix32f=new Float64Array(16),o.bQ(l.terrainRttPosMatrix32f,0,o.Z,o.Z,0,0,1),this._tiles[l.key]=new Pn(l,this.tileSize),this._lastTilesetChange=ke.now());for(const l in this._tiles)s[l]||delete this._tiles[l]}freeRtt(e){for(const i in this._tiles){const s=this._tiles[i];(!e||s.tileID.equals(e)||s.tileID.isChildOf(e)||e.isChildOf(s.tileID))&&(s.rtt=[])}}getRenderableTiles(){return this._renderableTilesKeys.map(e=>this.getTileByID(e))}getTileByID(e){return this._tiles[e]}getTerrainCoords(e,i){return i?this._getTerrainCoordsForTileRanges(e,i):this._getTerrainCoordsForRegularTile(e)}_getTerrainCoordsForRegularTile(e){const i={};for(const s of this._renderableTilesKeys){const l=this._tiles[s].tileID,h=e.clone(),f=o.b2();if(l.canonical.equals(e.canonical))o.bQ(f,0,o.Z,o.Z,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,x=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,P,P,0,0,1),o.L(f,f,[-x*P,-T*P,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),P=o.Z>>_;o.bQ(f,0,o.Z,o.Z,0,0,1),o.L(f,f,[x*P,T*P,0]),o.M(f,f,[1/2**_,1/2**_,0])}}h.terrainRttPosMatrix32f=new Float32Array(f),i[s]=h}return i}_getTerrainCoordsForTileRanges(e,i){const s={};for(const l of this._renderableTilesKeys){const h=this._tiles[l].tileID;if(!this._isWithinTileRanges(h,i))continue;const f=e.clone(),_=o.b2();if(h.canonical.z===e.canonical.z){const x=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bQ(_,0,o.Z,o.Z,0,0,1),o.L(_,_,[x*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const x=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>x<<x),P=h.canonical.y-(h.canonical.y>>x<<x),A=e.canonical.x-(h.canonical.x>>x),k=e.canonical.y-(h.canonical.y>>x),B=o.Z>>x;o.bQ(_,0,B,B,0,0,1),o.L(_,_,[-T*B+A*o.Z,-P*B+k*o.Z,0])}else{const x=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>x<<x),P=e.canonical.y-(e.canonical.y>>x<<x),A=(e.canonical.x>>x)-h.canonical.x,k=(e.canonical.y>>x)-h.canonical.y,B=o.Z<<x;o.bQ(_,0,B,B,0,0,1),o.L(_,_,[T*o.Z+A*B,P*o.Z+k*B,0])}f.terrainRttPosMatrix32f=new Float32Array(_),s[l]=f}return s}getSourceTile(e,i){const s=this.sourceCache._source;let l=e.overscaledZ-this.deltaZoom;if(l>s.maxzoom&&(l=s.maxzoom),l<s.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(l).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!h||!h.dem)&&i)for(;l>=s.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(e.scaledTo(l--).key);return h}anyTilesAfterTime(e=Date.now()){return this._lastTilesetChange>=e}_isWithinTileRanges(e,i){return i[e.canonical.z]&&e.canonical.x>=i[e.canonical.z].minTileX&&e.canonical.x<=i[e.canonical.z].maxTileX&&e.canonical.y>=i[e.canonical.z].minTileY&&e.canonical.y<=i[e.canonical.z].maxTileY}}class dh{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new hh(i),this.options=s,this.exaggeration=typeof s.exaggeration=="number"?s.exaggeration:1,this.qualityFactor=2,this.meshSize=128,this._demMatrixCache={},this.coordsIndex=[],this._coordsTextureSize=1024}getDEMElevation(e,i,s,l=o.Z){var h;if(!(i>=0&&i<l&&s>=0&&s<l))return 0;const f=this.getTerrainData(e),_=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const x=o.cj([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[x[0]*_.dim,x[1]*_.dim],P=Math.floor(T[0]),A=Math.floor(T[1]),k=T[0]-P,B=T[1]-A;return _.get(P,A)*(1-k)*(1-B)+_.get(P+1,A)*k*(1-B)+_.get(P,A+1)*(1-k)*B+_.get(P+1,A+1)*k*B}getElevationForLngLatZoom(e,i){if(!o.ck(i,e.wrap()))return 0;const{tileID:s,mercatorX:l,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(s,l%o.Z,h%o.Z,o.Z)}getElevation(e,i,s,l=o.Z){return this.getDEMElevation(e,i,s,l)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const l=this.painter.context,h=new o.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new qt(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new qt(l,new o.R({width:1,height:1}),l.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=o.ad([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const l=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new qt(l,i.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),i.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const l=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=l?h=e.canonical.z-l:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>h<<h),_=e.canonical.y-(e.canonical.y>>h<<h),x=o.cl(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(x,x,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,s=i.width/devicePixelRatio,l=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new qt(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboCoordsTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fboDepthTexture||(this._fboDepthTexture=new qt(i.context,{width:s,height:l,data:null},i.context.gl.RGBA,{premultiply:!1}),this._fboDepthTexture.bind(i.context.gl.NEAREST,i.context.gl.CLAMP_TO_EDGE)),this._fbo||(this._fbo=i.context.createFramebuffer(s,l,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,s,l))),this._fbo.colorAttachment.set(e==="coords"?this._fboCoordsTexture.texture:this._fboDepthTexture.texture),this._fbo}getCoordsTexture(){const e=this.painter.context;if(this._coordsTexture)return this._coordsTexture;const i=new Uint8Array(this._coordsTextureSize*this._coordsTextureSize*4);for(let h=0,f=0;h<this._coordsTextureSize;h++)for(let _=0;_<this._coordsTextureSize;_++,f+=4)i[f+0]=255&_,i[f+1]=255&h,i[f+2]=_>>8<<4|h>>8,i[f+3]=0;const s=new o.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),l=new qt(e,s,e.gl.RGBA,{premultiply:!1});return l.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),s=this.painter.context,l=s.gl,h=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,_-f-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const x=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),P=this.coordsIndex[255-i[3]],A=P&&this.sourceCache.getTileByID(P);if(!A)return null;const k=this._coordsTextureSize,B=(1<<A.tileID.canonical.z)*k;return new o.$((A.tileID.canonical.x*k+x)/B+A.tileID.wrap,(A.tileID.canonical.y*k+T)/B,this.getElevation(A.tileID,x,T,k))}depthAtPoint(e){const i=new Uint8Array(4),s=this.painter.context,l=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const s=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,l=s&&e.canonical.y===0,h=s&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${l?"n":""}_${h?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,x=new o.cm,T=new o.aK,P=this.meshSize,A=o.Z/P,k=P*P;for(let re=0;re<=P;re++)for(let pe=0;pe<=P;pe++)x.emplaceBack(pe*A,re*A,0);for(let re=0;re<k;re+=P+1)for(let pe=0;pe<P;pe++)T.emplaceBack(pe+re,P+pe+re+1,P+pe+re+2),T.emplaceBack(pe+re,P+pe+re+2,pe+re+1);const B=x.length,O=B+(P+1),H=(P+1)*P,q=l?o.b9:0,W=l?0:1,K=h?o.ba:o.Z,te=h?0:1;for(let re=0;re<=P;re++)x.emplaceBack(re*A,q,W);for(let re=0;re<=P;re++)x.emplaceBack(re*A,K,te);for(let re=0;re<P;re++)T.emplaceBack(H+re,O+re,O+re+1),T.emplaceBack(H+re,O+re+1,H+re+1),T.emplaceBack(0+re,B+re+1,B+re),T.emplaceBack(0+re,0+re+1,B+re+1);const ee=x.length,ie=ee+2*(P+1);for(const re of[0,1])for(let pe=0;pe<=P;pe++)for(const Me of[0,1])x.emplaceBack(re*o.Z,pe*A,Me);for(let re=0;re<2*P;re+=2)T.emplaceBack(ee+re,ee+re+1,ee+re+3),T.emplaceBack(ee+re,ee+re+3,ee+re+2),T.emplaceBack(ie+re,ie+re+3,ie+re+1),T.emplaceBack(ie+re,ie+re+2,ie+re+3);const se=new Na(_.createVertexBuffer(x,uh.members),_.createIndexBuffer(T),o.aJ.simpleSegment(0,0,x.length,T.length));return this._meshCache[f]=se,se}getMeshFrameDelta(e){return 2*Math.PI*o.bu/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var s;const{tileID:l}=this._getOverscaledTileIDFromLngLatZoom(e,i);return(s=this.getMinMaxElevation(l).minElevation)!==null&&s!==void 0?s:0}getMinMaxElevation(e){const i=this.getTerrainData(e).tile,s={minElevation:null,maxElevation:null};return i&&i.dem&&(s.minElevation=i.dem.min*this.exaggeration,s.maxElevation=i.dem.max*this.exaggeration),s}_getOverscaledTileIDFromLngLatZoom(e,i){const s=o.$.fromLngLat(e.wrap()),l=(1<<i)*o.Z,h=s.x*l,f=s.y*l,_=Math.floor(h/o.Z),x=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,x),mercatorX:h,mercatorY:f}}}class Zd{constructor(e,i,s){this._context=e,this._size=i,this._tileSize=s,this._objects=[],this._recentlyUsed=[],this._stamp=0}destruct(){for(const e of this._objects)e.texture.destroy(),e.fbo.destroy()}_createObject(e){const i=this._context.createFramebuffer(this._tileSize,this._tileSize,!0,!0),s=new qt(this._context,{width:this._tileSize,height:this._tileSize,data:null},this._context.gl.RGBA);return s.bind(this._context.gl.LINEAR,this._context.gl.CLAMP_TO_EDGE),this._context.extTextureFilterAnisotropic&&this._context.gl.texParameterf(this._context.gl.TEXTURE_2D,this._context.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,this._context.extTextureFilterAnisotropicMax),i.depthAttachment.set(this._context.createRenderbuffer(this._context.gl.DEPTH_STENCIL,this._tileSize,this._tileSize)),i.colorAttachment.set(s.texture),{id:e,fbo:i,texture:s,stamp:-1,inUse:!1}}getObjectForId(e){return this._objects[e]}useObject(e){e.inUse=!0,this._recentlyUsed=this._recentlyUsed.filter(i=>e.id!==i),this._recentlyUsed.push(e.id)}stampObject(e){e.stamp=++this._stamp}getOrCreateFreeObject(){for(const i of this._recentlyUsed)if(!this._objects[i].inUse)return this._objects[i];if(this._objects.length>=this._size)throw new Error("No free RenderPool available, call freeAllObjects() required!");const e=this._createObject(this._objects.length);return this._objects.push(e),e}freeObject(e){e.inUse=!1}freeAllObjects(){for(const e of this._objects)this.freeObject(e)}isFull(){return!(this._objects.length<this._size)&&this._objects.some(e=>!e.inUse)===!1}}const mr={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class al{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new Zd(e.context,30,i.sourceCache.tileSize*i.qualityFactor)}destruct(){this.pool.destruct()}getTexture(e){return this.pool.getObjectForId(e.rtt[this._stacks.length-1].id).texture}prepareForRender(e,i){this._stacks=[],this._prevType=null,this._rttTiles=[],this._renderableTiles=this.terrain.sourceCache.getRenderableTiles(),this._renderableLayerIds=e._order.filter(s=>!e._layers[s].isHidden(i)),this._coordsAscending={};for(const s in e.sourceCaches){this._coordsAscending[s]={};const l=e.sourceCaches[s].getVisibleCoordinates(),h=e.sourceCaches[s].getSource(),f=h instanceof De?h.terrainTileRanges:null;for(const _ of l){const x=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in x)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(x[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(mr[l.type]&&!this._coordsAscendingStr[h]){this._coordsAscendingStr[h]={};for(const f in this._coordsAscending[h])this._coordsAscendingStr[h][f]=this._coordsAscending[h][f].map(_=>_.key).sort().join()}}for(const s of this._renderableTiles)for(const l in this._coordsAscendingStr){const h=this._coordsAscendingStr[l][s.tileID.key];h&&h!==s.rttCoords[l]&&(s.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const s=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),l=e.type,h=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(mr[l]&&(this._prevType&&mr[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(mr[this._prevType]||mr[l]&&f){this._prevType=l;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(Wn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const A=this.pool.getObjectForId(T.rtt[_].id);if(A.stamp===T.rtt[_].stamp){this.pool.useObject(A);continue}}const P=this.pool.getOrCreateFreeObject();this.pool.useObject(P),this.pool.stampObject(P),T.rtt[_]={id:P.id,stamp:P.stamp},h.context.bindFramebuffer.set(P.fbo.framebuffer),h.context.clear({color:o.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let A=0;A<x.length;A++){const k=h.style._layers[x[A]],B=k.source?this._coordsAscending[k.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,P.fbo.width,P.fbo.height]),h._renderTileClippingMasks(k,B,!0),h.renderLayer(h,h.style.sourceCaches[k.source],k,B,s),k.source&&(T.rttCoords[k.source]=this._coordsAscendingStr[k.source][T.tileID.key])}}return Wn(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),mr[l]}return!1}}const Xe={"AttributionControl.ToggleAttribution":"Toggle attribution","AttributionControl.MapFeedback":"Map feedback","FullscreenControl.Enter":"Enter fullscreen","FullscreenControl.Exit":"Exit fullscreen","GeolocateControl.FindMyLocation":"Find my location","GeolocateControl.LocationNotAvailable":"Location not available","LogoControl.Title":"MapLibre logo","Map.Title":"Map","Marker.Title":"Map marker","NavigationControl.ResetBearing":"Reset bearing to north","NavigationControl.ZoomIn":"Zoom in","NavigationControl.ZoomOut":"Zoom out","Popup.Close":"Close popup","ScaleControl.Feet":"ft","ScaleControl.Meters":"m","ScaleControl.Kilometers":"km","ScaleControl.Miles":"mi","ScaleControl.NauticalMiles":"nm","GlobeControl.Enable":"Enable globe","GlobeControl.Disable":"Disable globe","TerrainControl.Enable":"Enable terrain","TerrainControl.Disable":"Disable terrain","CooperativeGesturesHandler.WindowsHelpText":"Use Ctrl + scroll to zoom the map","CooperativeGesturesHandler.MacHelpText":"Use ⌘ + scroll to zoom the map","CooperativeGesturesHandler.MobileHelpText":"Use two fingers to move the map"},rt=de,Ws={hash:!1,interactive:!0,bearingSnap:7,attributionControl:An,maplibreLogo:!1,refreshExpiredTiles:!0,canvasContextAttributes:{antialias:!1,preserveDrawingBuffer:!1,powerPreference:"high-performance",failIfMajorPerformanceCaveat:!1,desynchronized:!1,contextType:void 0},scrollZoom:!0,minZoom:-2,maxZoom:22,minPitch:0,maxPitch:60,boxZoom:!0,dragRotate:!0,dragPan:!0,keyboard:!0,doubleClickZoom:!0,touchZoomRotate:!0,touchPitch:!0,cooperativeGestures:!1,trackResize:!0,center:[0,0],elevation:0,zoom:0,bearing:0,pitch:0,roll:0,renderWorldCopies:!0,maxTileCacheSize:null,maxTileCacheZoomLevels:o.a.MAX_TILE_CACHE_ZOOM_LEVELS,transformRequest:null,transformCameraUpdate:null,fadeDuration:300,crossSourceCollisions:!0,clickTolerance:3,localIdeographFontFamily:"sans-serif",pitchWithRotate:!0,rollEnabled:!1,validateStyle:!0,maxCanvasSize:[4096,4096],cancelPendingTileRequestsWhileZooming:!0,centerClampedToGround:!0},xc={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class vc{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,le.mousePos(this.element,h)),le.addEventListener(window,"mousemove",this.mousemove),le.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,le.mousePos(this.element,h))},this.mouseup=h=>{this._rotatePitchHanlder.dragEnd(h),this.offTemp()},this.touchstart=h=>{h.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),le.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.move(h,this._lastPos))},this.touchend=h=>{h.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const l=new is;this._rotatePitchHanlder=new ar({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),x=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.ce(new o.P(h.x,f.y),f,x),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,le.addEventListener(i,"mousedown",this.mousedown),le.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),le.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),le.disableDrag()}move(e,i){const s=this.map,{bearingDelta:l,pitchDelta:h}=this._rotatePitchHanlder.dragMove(e,i)||{};l&&s.setBearing(s.getBearing()+l),h&&s.setPitch(s.getPitch()+h)}off(){const e=this.element;le.removeEventListener(e,"mousedown",this.mousedown),le.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend),le.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){le.enableDrag(),le.removeEventListener(window,"mousemove",this.mousemove),le.removeEventListener(window,"mouseup",this.mouseup),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend)}}let Si;function bc(u,e,i,s=!1){if(s||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return u==null?void 0:u.wrap();const l=new o.Q(u.lng,u.lat);if(u=new o.Q(u.lng,u.lat),e){const h=new o.Q(u.lng-360,u.lat),f=new o.Q(u.lng+360,u.lat),_=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(h).distSqr(e)<_?u=h:i.locationToScreenPoint(f).distSqr(e)<_&&(u=f)}for(;Math.abs(u.lng-i.center.lng)>180;){const h=i.locationToScreenPoint(u);if(h.x>=0&&h.y>=0&&h.x<=i.width&&h.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==l.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:l}const $r={center:"translate(-50%,-50%)",top:"translate(-50%,0)","top-left":"translate(0,0)","top-right":"translate(-100%,0)",bottom:"translate(-50%,-100%)","bottom-left":"translate(0,-100%)","bottom-right":"translate(-100%,-100%)",left:"translate(0,-50%)",right:"translate(-100%,-50%)"};function ph(u,e,i){const s=u.classList;for(const l in $r)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class xa extends o.E{constructor(e){if(super(),this._onKeyPress=i=>{const s=i.code,l=i.charCode||i.keyCode;s!=="Space"&&s!=="Enter"&&l!==32&&l!==13||this.togglePopup()},this._onMapClick=i=>{const s=i.originalEvent.target,l=this._element;this._popup&&(s===l||l.contains(s))&&this.togglePopup()},this._update=i=>{if(!this._map)return;const s=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!s)&&this._map.once("render",this._update),this._lngLat=bc(this._lngLat,this._flatPos,this._map.transform),this._flatPos=this._pos=this._map.project(this._lngLat)._add(this._offset),this._map.terrain&&(this._flatPos=this._map.transform.locationToScreenPoint(this._lngLat)._add(this._offset));let l="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?l=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(l=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let h="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?h="rotateX(0deg)":this._pitchAlignment==="map"&&(h=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),le.setTransform(this._element,`${$r[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),ke.frameAsync(new AbortController).then(()=>{this._updateOpacity(i&&i.type==="moveend")}).catch(()=>{})},this._onMove=i=>{if(!this._isDragging){const s=this._clickTolerance||this._map._clickTolerance;this._isDragging=i.point.dist(this._pointerdownPos)>=s}this._isDragging&&(this._pos=i.point.sub(this._positionDelta),this._lngLat=this._map.unproject(this._pos),this.setLngLat(this._lngLat),this._element.style.pointerEvents="none",this._state==="pending"&&(this._state="active",this.fire(new o.l("dragstart"))),this.fire(new o.l("drag")))},this._onUp=()=>{this._element.style.pointerEvents="auto",this._positionDelta=null,this._pointerdownPos=null,this._isDragging=!1,this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),this._state==="active"&&this.fire(new o.l("dragend")),this._state="inactive"},this._addDragHandler=i=>{this._element.contains(i.originalEvent.target)&&(i.preventDefault(),this._positionDelta=i.point.sub(this._pos).add(this._offset),this._pointerdownPos=i.point,this._state="pending",this._map.on("mousemove",this._onMove),this._map.on("touchmove",this._onMove),this._map.once("mouseup",this._onUp),this._map.once("touchend",this._onUp))},this._anchor=e&&e.anchor||"center",this._color=e&&e.color||"#3FB1CE",this._scale=e&&e.scale||1,this._draggable=e&&e.draggable||!1,this._clickTolerance=e&&e.clickTolerance||0,this._subpixelPositioning=e&&e.subpixelPositioning||!1,this._isDragging=!1,this._state="inactive",this._rotation=e&&e.rotation||0,this._rotationAlignment=e&&e.rotationAlignment||"auto",this._pitchAlignment=e&&e.pitchAlignment&&e.pitchAlignment!=="auto"?e.pitchAlignment:this._rotationAlignment,this.setOpacity(e==null?void 0:e.opacity,e==null?void 0:e.opacityWhenCovered),e&&e.element)this._element=e.element,this._offset=o.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=le.create("div");const i=le.createNS("http://www.w3.org/2000/svg","svg"),s=41,l=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${s}px`),i.setAttributeNS(null,"width",`${l}px`),i.setAttributeNS(null,"viewBox",`0 0 ${l} ${s}`);const h=le.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const f=le.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=le.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const W of x){const K=le.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",W.rx),K.setAttributeNS(null,"ry",W.ry),_.appendChild(K)}const T=le.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const P=le.createNS("http://www.w3.org/2000/svg","path");P.setAttributeNS(null,"d","M27,13.5 C27,19.074644 20.250001,27.000002 14.75,34.500002 C14.016665,35.500004 12.983335,35.500004 12.25,34.500002 C6.7499993,27.000002 0,19.222562 0,13.5 C0,6.0441559 6.0441559,0 13.5,0 C20.955844,0 27,6.0441559 27,13.5 Z"),T.appendChild(P);const A=le.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"opacity","0.25"),A.setAttributeNS(null,"fill","#000000");const k=le.createNS("http://www.w3.org/2000/svg","path");k.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),A.appendChild(k);const B=le.createNS("http://www.w3.org/2000/svg","g");B.setAttributeNS(null,"transform","translate(6.0, 7.0)"),B.setAttributeNS(null,"fill","#FFFFFF");const O=le.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=le.createNS("http://www.w3.org/2000/svg","circle");H.setAttributeNS(null,"fill","#000000"),H.setAttributeNS(null,"opacity","0.25"),H.setAttributeNS(null,"cx","5.5"),H.setAttributeNS(null,"cy","5.5"),H.setAttributeNS(null,"r","5.4999962");const q=le.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#FFFFFF"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962"),O.appendChild(H),O.appendChild(q),f.appendChild(_),f.appendChild(T),f.appendChild(A),f.appendChild(B),f.appendChild(O),i.appendChild(f),i.setAttributeNS(null,"height",s*this._scale+"px"),i.setAttributeNS(null,"width",l*this._scale+"px"),this._element.appendChild(i),this._offset=o.P.convert(e&&e.offset||[0,-14])}if(this._element.classList.add("maplibregl-marker"),this._element.addEventListener("dragstart",i=>{i.preventDefault()}),this._element.addEventListener("mousedown",i=>{i.preventDefault()}),ph(this._element,this._anchor,"marker"),e&&e.className)for(const i of e.className.split(" "))this._element.classList.add(i);this._popup=null}addTo(e){return this.remove(),this._map=e,this._element.hasAttribute("aria-label")||this._element.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),le.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=o.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const l=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,s;const l=(i=this._map)===null||i===void 0?void 0:i.terrain,h=this._map.transform.isLocationOccluded(this._lngLat);if(!l||h){const B=h?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==B&&(this._element.style.opacity=B))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,_=f.terrain.depthAtPoint(this._pos),x=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,x)-_<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/f.transform.pixelsPerMeter,P=Math.sin(f.getPitch()*Math.PI/180)*T,A=f.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),k=f.transform.lngLatToCameraDepth(this._lngLat,x+P)-A>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&k&&this._popup.remove(),this._element.style.opacity=k?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=o.P.convert(e),this._update(),this}addClassName(e){this._element.classList.add(e)}removeClassName(e){this._element.classList.remove(e)}toggleClassName(e){return this._element.classList.toggle(e)}setDraggable(e){return this._draggable=!!e,this._map&&(e?(this._map.on("mousedown",this._addDragHandler),this._map.on("touchstart",this._addDragHandler)):(this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler))),this}isDraggable(){return this._draggable}setRotation(e){return this._rotation=e||0,this._update(),this}getRotation(){return this._rotation}setRotationAlignment(e){return this._rotationAlignment=e||"auto",this._update(),this}getRotationAlignment(){return this._rotationAlignment}setPitchAlignment(e){return this._pitchAlignment=e&&e!=="auto"?e:this._rotationAlignment,this._update(),this}getPitchAlignment(){return this._pitchAlignment}setOpacity(e,i){return(this._opacity===void 0||e===void 0&&i===void 0)&&(this._opacity="1",this._opacityWhenCovered="0.2"),e!==void 0&&(this._opacity=e),i!==void 0&&(this._opacityWhenCovered=i),this._map&&this._updateOpacity(!0),this}}const hi={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ri=0,as=!1;const Xs={maxWidth:100,unit:"metric"};function Ks(u,e,i){const s=i&&i.maxWidth||100,l=u._container.clientHeight/2,h=u._container.clientWidth/2,f=u.unproject([h-s/2,l]),_=u.unproject([h+s/2,l]),x=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,x,u._container.clientWidth),P=f.distanceTo(_);if(i&&i.unit==="imperial"){const A=3.2808*P;A>5280?va(e,T,A/5280,u._getUIString("ScaleControl.Miles")):va(e,T,A,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?va(e,T,P/1852,u._getUIString("ScaleControl.NauticalMiles")):P>=1e3?va(e,T,P/1e3,u._getUIString("ScaleControl.Kilometers")):va(e,T,P,u._getUIString("ScaleControl.Meters"))}function va(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const wc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Tc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function ss(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new o.P(0,0),top:new o.P(0,u),"top-left":new o.P(e,e),"top-right":new o.P(-e,e),bottom:new o.P(0,-u),"bottom-left":new o.P(e,-e),"bottom-right":new o.P(-e,-e),left:new o.P(u,0),right:new o.P(-u,0)}}if(u instanceof o.P||Array.isArray(u)){const e=o.P.convert(u);return{center:e,top:e,"top-left":e,"top-right":e,bottom:e,"bottom-left":e,"bottom-right":e,left:e,right:e}}return{center:o.P.convert(u.center||[0,0]),top:o.P.convert(u.top||[0,0]),"top-left":o.P.convert(u["top-left"]||[0,0]),"top-right":o.P.convert(u["top-right"]||[0,0]),bottom:o.P.convert(u.bottom||[0,0]),"bottom-left":o.P.convert(u["bottom-left"]||[0,0]),"bottom-right":o.P.convert(u["bottom-right"]||[0,0]),left:o.P.convert(u.left||[0,0]),right:o.P.convert(u.right||[0,0])}}return ss(new o.P(0,0))}const Mc=de;S.AJAXError=o.cq,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cr,S.config=o.a,S.removeProtocol=o.cs,S.AttributionControl=Kt,S.BoxZoomHandler=dc,S.CanvasSource=Ze,S.CooperativeGesturesHandler=rl,S.DoubleClickZoomHandler=il,S.DragPanHandler=lh,S.DragRotateHandler=ch,S.EdgeInsets=Ms,S.FullscreenControl=class extends o.E{constructor(u={}){super(),this._onFullscreenChange=()=>{var e;let i=window.document.fullscreenElement||window.document.mozFullScreenElement||window.document.webkitFullscreenElement||window.document.msFullscreenElement;for(;!((e=i==null?void 0:i.shadowRoot)===null||e===void 0)&&e.fullscreenElement;)i=i.shadowRoot.fullscreenElement;i===this._container!==this._fullscreen&&this._handleFullscreenChange()},this._onClickFullscreen=()=>{this._isFullscreen()?this._exitFullscreen():this._requestFullscreen()},this._fullscreen=!1,u&&u.container&&(u.container instanceof HTMLElement?this._container=u.container:o.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){le.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=le.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);le.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new o.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new o.l("fullscreenend")),this._prevCooperativeGesturesEnabled&&this._map.cooperativeGestures.enable())}_exitFullscreen(){window.document.exitFullscreen?window.document.exitFullscreen():window.document.mozCancelFullScreen?window.document.mozCancelFullScreen():window.document.msExitFullscreen?window.document.msExitFullscreen():window.document.webkitCancelFullScreen?window.document.webkitCancelFullScreen():this._togglePseudoFullScreen()}_requestFullscreen(){this._container.requestFullscreen?this._container.requestFullscreen():this._container.mozRequestFullScreen?this._container.mozRequestFullScreen():this._container.msRequestFullscreen?this._container.msRequestFullscreen():this._container.webkitRequestFullscreen?this._container.webkitRequestFullscreen():this._togglePseudoFullScreen()}_togglePseudoFullScreen(){this._container.classList.toggle("maplibregl-pseudo-fullscreen"),this._handleFullscreenChange(),this._map.resize()}},S.GeoJSONSource=Tn,S.GeolocateControl=class extends o.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new o.l("outofmaxbounds",e)),this._updateMarker(),void this._finish();if(this.options.trackUserLocation)switch(this._lastKnownPosition=e,this._watchState){case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"BACKGROUND":case"BACKGROUND_ERROR":this._watchState="BACKGROUND",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background");break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}this.options.showUserLocation&&this._watchState!=="OFF"&&this._updateMarker(e),this.options.trackUserLocation&&this._watchState!=="ACTIVE_LOCK"||this._updateCamera(e),this.options.showUserLocation&&this._dotElement.classList.remove("maplibregl-user-location-dot-stale"),this.fire(new o.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new o.Q(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,l=this._map.getBearing(),h=o.e({bearing:l},this.options.fitBoundsOptions),f=Ut.fromLngLat(i,s);this._map.fitBounds(f,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new o.Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&as)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=le.create("button","maplibregl-ctrl-geolocate",this._container),le.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){o.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=le.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new xa({element:this._dotElement}),this._circleElement=le.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new xa({element:this._circleElement,pitchAlignment:"map"}),this.options.trackUserLocation&&(this._watchState="OFF"),this._map.on("zoom",this._onZoom)),this._geolocateButton.addEventListener("click",()=>this.trigger()),this._setup=!0,this.options.trackUserLocation&&this._map.on("movestart",i=>{i.geolocateSource||this._watchState!=="ACTIVE_LOCK"||i.originalEvent&&i.originalEvent.type==="resize"||(this._watchState="BACKGROUND",this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this.fire(new o.l("trackuserlocationend")),this.fire(new o.l("userlocationlostfocus")))})}},this.options=o.e({},hi,u)}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(Si!==void 0&&!e)return Si;if(window.navigator.permissions===void 0)return Si=!!window.navigator.geolocation,Si;try{Si=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Si=!!window.navigator.geolocation}return Si})}().then(e=>this._finishSetupUI(e)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),le.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ri=0,as=!1}_isOutOfMapMaxBounds(u){const e=this._map.getMaxBounds(),i=u.coords;return e&&(i.longitude<e.getWest()||i.longitude>e.getEast()||i.latitude<e.getSouth()||i.latitude>e.getNorth())}_setErrorState(){switch(this._watchState){case"WAITING_ACTIVE":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error");break;case"ACTIVE_LOCK":this._watchState="ACTIVE_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"BACKGROUND":this._watchState="BACKGROUND_ERROR",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting");break;case"ACTIVE_ERROR":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}}_updateCircleRadius(){const u=this._map.getBounds(),e=u.getSouthEast(),i=u.getNorthEast(),s=e.distanceTo(i),l=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${l}px`,this._circleElement.style.height=`${l}px`}trigger(){if(!this._setup)return o.w("Geolocate control triggered before added to a map"),!1;if(this.options.trackUserLocation){switch(this._watchState){case"OFF":this._watchState="WAITING_ACTIVE",this.fire(new o.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ri--,as=!1,this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this.fire(new o.l("trackuserlocationend"));break;case"BACKGROUND":this._watchState="ACTIVE_LOCK",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._lastKnownPosition&&this._updateCamera(this._lastKnownPosition),this.fire(new o.l("trackuserlocationstart")),this.fire(new o.l("userlocationfocus"));break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}switch(this._watchState){case"WAITING_ACTIVE":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"ACTIVE_LOCK":this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-active");break;case"OFF":break;default:throw new Error(`Unexpected watchState ${this._watchState}`)}if(this._watchState==="OFF"&&this._geolocationWatchID!==void 0)this._clearWatch();else if(this._geolocationWatchID===void 0){let u;this._geolocateButton.classList.add("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","true"),ri++,ri>1?(u={maximumAge:6e5,timeout:0},as=!0):(u=this.options.positionOptions,as=!1),this._geolocationWatchID=window.navigator.geolocation.watchPosition(this._onSuccess,this._onError,u)}}else window.navigator.geolocation.getCurrentPosition(this._onSuccess,this._onError,this.options.positionOptions),this._timeoutId=setTimeout(this._finish,1e4);return!0}_clearWatch(){window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0,this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.setAttribute("aria-pressed","false"),this.options.showUserLocation&&this._updateMarker(null)}},S.GlobeControl=class{constructor(){this._toggleProjection=()=>{var u;const e=(u=this._map.getProjection())===null||u===void 0?void 0:u.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var u;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((u=this._map.getProjection())===null||u===void 0?void 0:u.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=le.create("button","maplibregl-ctrl-globe",this._container),le.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){le.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=lc,S.ImageSource=De,S.KeyboardHandler=ns,S.LngLatBounds=Ut,S.LogoControl=Hs,S.Map=class extends Nd{constructor(u){var e,i;o.cn.mark(o.co.create);const s=Object.assign(Object.assign(Object.assign({},Ws),u),{canvasContextAttributes:Object.assign(Object.assign({},Ws.canvasContextAttributes),u.canvasContextAttributes)});if(s.minZoom!=null&&s.maxZoom!=null&&s.minZoom>s.maxZoom)throw new Error("maxZoom must be greater than or equal to minZoom");if(s.minPitch!=null&&s.maxPitch!=null&&s.minPitch>s.maxPitch)throw new Error("maxPitch must be greater than or equal to minPitch");if(s.minPitch!=null&&s.minPitch<0)throw new Error("minPitch must be greater than or equal to 0");if(s.maxPitch!=null&&s.maxPitch>180)throw new Error("maxPitch must be less than or equal to 180");const l=new Va,h=new Ss;if(s.minZoom!==void 0&&l.setMinZoom(s.minZoom),s.maxZoom!==void 0&&l.setMaxZoom(s.maxZoom),s.minPitch!==void 0&&l.setMinPitch(s.minPitch),s.maxPitch!==void 0&&l.setMaxPitch(s.maxPitch),s.renderWorldCopies!==void 0&&l.setRenderWorldCopies(s.renderWorldCopies),super(l,h,{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new yc,this._controls=[],this._mapId=o.a4(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new o.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new o.l("webglcontextrestored",{originalEvent:_}))},this._onMapScroll=_=>{if(_.target===this._container)return this._container.scrollTop=0,this._container.scrollLeft=0,!1},this._onWindowOnline=()=>{this._update()},this._interactive=s.interactive,this._maxTileCacheSize=s.maxTileCacheSize,this._maxTileCacheZoomLevels=s.maxTileCacheZoomLevels,this._canvasContextAttributes=Object.assign({},s.canvasContextAttributes),this._trackResize=s.trackResize===!0,this._bearingSnap=s.bearingSnap,this._centerClampedToGround=s.centerClampedToGround,this._refreshExpiredTiles=s.refreshExpiredTiles===!0,this._fadeDuration=s.fadeDuration,this._crossSourceCollisions=s.crossSourceCollisions===!0,this._collectResourceTiming=s.collectResourceTiming===!0,this._locale=Object.assign(Object.assign({},Xe),s.locale),this._clickTolerance=s.clickTolerance,this._overridePixelRatio=s.pixelRatio,this._maxCanvasSize=s.maxCanvasSize,this.transformCameraUpdate=s.transformCameraUpdate,this.cancelPendingTileRequestsWhileZooming=s.cancelPendingTileRequestsWhileZooming===!0,this._imageQueueHandle=Wt.addThrottleControl(()=>this.isMoving()),this._requestManager=new jt(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let _=!1;const x=Us(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?x(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new jd(this,s),this._hash=s.hash&&new lc(typeof s.hash=="string"&&s.hash||void 0).addTo(this),this._hash&&this._hash._onHashChange()||(this.jumpTo({center:s.center,elevation:s.elevation,zoom:s.zoom,bearing:s.bearing,pitch:s.pitch,roll:s.roll}),s.bounds&&(this.resize(),this.fitBounds(s.bounds,o.e({},s.fitBoundsOptions,{duration:0}))));const f=typeof s.style=="string"||((i=(e=s.style)===null||e===void 0?void 0:e.projection)===null||i===void 0?void 0:i.type)!=="globe";this.resize(null,f),this._localIdeographFontFamily=s.localIdeographFontFamily,this._validateStyle=s.validateStyle,s.style&&this.setStyle(s.style,{localIdeographFontFamily:s.localIdeographFontFamily}),s.attributionControl&&this.addControl(new Kt(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new Hs,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=o.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new o.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new o.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new o.l("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new o.k(new Error("Invalid argument to map.addControl(). Argument must be a control with onAdd and onRemove methods.")));const i=u.onAdd(this);this._controls.push(u);const s=this._controlPositions[e];return e.indexOf("bottom")!==-1?s.insertBefore(i,s.firstChild):s.appendChild(i),this}removeControl(u){if(!u||!u.onRemove)return this.fire(new o.k(new Error("Invalid argument to map.removeControl(). Argument must be a control with onAdd and onRemove methods.")));const e=this._controls.indexOf(u);return e>-1&&this._controls.splice(e,1),u.onRemove(this),this}hasControl(u){return this._controls.indexOf(u)>-1}calculateCameraOptionsFromTo(u,e,i,s){return s==null&&this.terrain&&(s=this.terrain.getElevationForLngLatZoom(i,this.transform.tileZoom)),super.calculateCameraOptionsFromTo(u,e,i,s)}resize(u,e=!0){const[i,s]=this._containerDimensions(),l=this._getClampedPixelRatio(i,s);if(this._resizeCanvas(i,s,l),this.painter.resize(i,s,l),this.painter.overLimit()){const f=this.painter.context.gl;this._maxCanvasSize=[f.drawingBufferWidth,f.drawingBufferHeight];const _=this._getClampedPixelRatio(i,s);this._resizeCanvas(i,s,_),this.painter.resize(i,s,_)}this._resizeTransform(e);const h=!this._moving;return h&&(this.stop(),this.fire(new o.l("movestart",u)).fire(new o.l("move",u))),this.fire(new o.l("resize",u)),h&&this.fire(new o.l("moveend",u)),this}_resizeTransform(u=!0){var e;const[i,s]=this._containerDimensions();this.transform.resize(i,s,u),(e=this._requestedCameraState)===null||e===void 0||e.resize(i,s,u)}_getClampedPixelRatio(u,e){const{0:i,1:s}=this._maxCanvasSize,l=this.getPixelRatio(),h=u*l,f=e*l;return Math.min(h>i?i/h:1,f>s?s/f:1)*l}getPixelRatio(){var u;return(u=this._overridePixelRatio)!==null&&u!==void 0?u:devicePixelRatio}setPixelRatio(u){this._overridePixelRatio=u,this.resize()}getBounds(){return this.transform.getBounds()}getMaxBounds(){return this.transform.getMaxBounds()}setMaxBounds(u){return this.transform.setMaxBounds(Ut.convert(u)),this._update()}setMinZoom(u){if((u=u??-2)>=-2&&u<=this.transform.maxZoom)return this.transform.setMinZoom(u),this._update(),this.getZoom()<u&&this.setZoom(u),this;throw new Error("minZoom must be between -2 and the current maxZoom, inclusive")}getMinZoom(){return this.transform.minZoom}setMaxZoom(u){if((u=u??22)>=this.transform.minZoom)return this.transform.setMaxZoom(u),this._update(),this.getZoom()>u&&this.setZoom(u),this;throw new Error("maxZoom must be greater than the current minZoom")}getMaxZoom(){return this.transform.maxZoom}setMinPitch(u){if((u=u??0)<0)throw new Error("minPitch must be greater than or equal to 0");if(u>=0&&u<=this.transform.maxPitch)return this.transform.setMinPitch(u),this._update(),this.getPitch()<u&&this.setPitch(u),this;throw new Error("minPitch must be between 0 and the current maxPitch, inclusive")}getMinPitch(){return this.transform.minPitch}setMaxPitch(u){if((u=u??60)>180)throw new Error("maxPitch must be less than or equal to 180");if(u>=this.transform.minPitch)return this.transform.setMaxPitch(u),this._update(),this.getPitch()>u&&this.setPitch(u),this;throw new Error("maxPitch must be greater than the current minPitch")}getMaxPitch(){return this.transform.maxPitch}getRenderWorldCopies(){return this.transform.renderWorldCopies}setRenderWorldCopies(u){return this.transform.setRenderWorldCopies(u),this._update()}project(u){return this.transform.locationToScreenPoint(o.Q.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(o.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,e,i){if(u==="mouseenter"||u==="mouseover"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:h=>{const f=e.filter(x=>this.getLayer(x)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new Ri(u,this,h.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(u==="mouseleave"||u==="mouseout"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const _=e.filter(x=>this.getLayer(x));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new Ri(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new Ri(u,this,f.originalEvent)))}}}}{const s=l=>{const h=e.filter(_=>this.getLayer(_)),f=h.length!==0?this.queryRenderedFeatures(l.point,{layers:h}):[];f.length&&(l.features=f,i.call(this,l),delete l.features)};return{layers:e,listener:i,delegates:{[u]:s}}}}_saveDelegatedListener(u,e){this._delegatedListeners=this._delegatedListeners||{},this._delegatedListeners[u]=this._delegatedListeners[u]||[],this._delegatedListeners[u].push(e)}_removeDelegatedListener(u,e,i){if(!this._delegatedListeners||!this._delegatedListeners[u])return;const s=this._delegatedListeners[u];for(let l=0;l<s.length;l++){const h=s[l];if(h.listener===i&&h.layers.length===e.length&&h.layers.every(f=>e.includes(f))){for(const f in h.delegates)this.off(f,h.delegates[f]);return void s.splice(l,1)}}}on(u,e,i){if(i===void 0)return super.on(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);this._saveDelegatedListener(u,l);for(const h in l.delegates)this.on(h,l.delegates[h]);return{unsubscribe:()=>{this._removeDelegatedListener(u,s,i)}}}once(u,e,i){if(i===void 0)return super.once(u,e);const s=typeof e=="string"?[e]:e,l=this._createDelegatedListener(u,s,i);for(const h in l.delegates){const f=l.delegates[h];l.delegates[h]=(..._)=>{this._removeDelegatedListener(u,s,i),f(..._)}}this._saveDelegatedListener(u,l);for(const h in l.delegates)this.once(h,l.delegates[h]);return this}off(u,e,i){return i===void 0?super.off(u,e):(this._removeDelegatedListener(u,typeof e=="string"?[e]:e,i),this)}queryRenderedFeatures(u,e){if(!this.style)return[];let i;const s=u instanceof o.P||Array.isArray(u),l=s?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:u)||{},l instanceof o.P||typeof l[0]=="number")i=[o.P.convert(l)];else{const h=o.P.convert(l[0]),f=o.P.convert(l[1]);i=[h,new o.P(f.x,h.y),f,new o.P(h.x,f.y),h]}return this.style.queryRenderedFeatures(i,e,this.transform)}querySourceFeatures(u,e){return this.style.querySourceFeatures(u,e)}setStyle(u,e){return(e=o.e({},{localIdeographFontFamily:this._localIdeographFontFamily,validate:this._validateStyle},e)).diff!==!1&&e.localIdeographFontFamily===this._localIdeographFontFamily&&this.style&&u?(this._diffStyle(u,e),this):(this._localIdeographFontFamily=e.localIdeographFontFamily,this._updateStyle(u,e))}setTransformRequest(u){return this._requestManager.setTransformRequest(u),this}_getUIString(u){const e=this._locale[u];if(e==null)throw new Error(`Missing UI string '${u}'`);return e}_updateStyle(u,e){var i,s;if(e.transformStyle&&this.style&&!this.style._loaded)return void this.style.once("style.load",()=>this._updateStyle(u,e));const l=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new $l(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,l):this.style.loadJSON(u,e,l),this):((s=(i=this.style)===null||i===void 0?void 0:i.projection)===null||s===void 0||s.destroy(),delete this.style,this)}_lazyInitEmptyStyle(){this.style||(this.style=new $l(this,{}),this.style.setEventedParent(this,{style:this.style}),this.style.loadEmpty())}_diffStyle(u,e){if(typeof u=="string"){const i=this._requestManager.transformRequest(u,"Style");o.j(i,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new o.k(s))})}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(i){o.w(`Unable to perform style diff: ${i.message||i.error||i}. Rebuilding the style from scratch.`),this._updateStyle(u,e)}}getStyle(){if(this.style)return this.style.serialize()}isStyleLoaded(){return this.style?this.style.loaded():o.w("There is no style added to the map.")}addSource(u,e){return this._lazyInitEmptyStyle(),this.style.addSource(u,e),this._update(!0)}isSourceLoaded(u){const e=this.style&&this.style.sourceCaches[u];if(e!==void 0)return e.loaded();this.fire(new o.k(new Error(`There is no source with ID '${u}'`)))}setTerrain(u){if(this.style._checkLoaded(),this._terrainDataCallback&&this.style.off("data",this._terrainDataCallback),u){const e=this.style.sourceCaches[u.source];if(!e)throw new Error(`cannot load terrain, because there exists no source with ID: ${u.source}`);this.terrain===null&&e.reload();for(const i in this.style._layers){const s=this.style._layers[i];s.type==="hillshade"&&s.source===u.source&&o.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new dh(this.painter,e,u),this.painter.renderToTexture=new al(this.painter,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._terrainDataCallback=i=>{var s;i.dataType==="style"?this.terrain.sourceCache.freeRtt():i.dataType==="source"&&i.tile&&(i.sourceId!==u.source||this._elevationFreeze||(this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))),((s=i.source)===null||s===void 0?void 0:s.type)==="image"?this.terrain.sourceCache.freeRtt():this.terrain.sourceCache.freeRtt(i.tile.tileID))},this.style.on("data",this._terrainDataCallback)}else this.terrain&&this.terrain.sourceCache.destruct(),this.terrain=null,this.painter.renderToTexture&&this.painter.renderToTexture.destruct(),this.painter.renderToTexture=null,this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0);return this.fire(new o.l("terrain",{terrain:u})),this}getTerrain(){var u,e;return(e=(u=this.terrain)===null||u===void 0?void 0:u.options)!==null&&e!==void 0?e:null}areTilesLoaded(){const u=this.style&&this.style.sourceCaches;for(const e in u){const i=u[e]._tiles;for(const s in i){const l=i[s];if(l.state!=="loaded"&&l.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}setSourceTileLodParams(u,e,i){if(i){const s=this.getSource(i);if(!s)throw new Error(`There is no source with ID "${i}", cannot set LOD parameters`);s.calculateTileZoom=ae(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=ae(Math.max(1,u),Math.max(1,e));return this._update(!0),this}refreshTiles(u,e){const i=this.style.sourceCaches[u];if(!i)throw new Error(`There is no source cache with ID "${u}", cannot refresh tile`);e===void 0?i.reload():i.refreshTiles(e.map(s=>new o.a1(s.z,s.x,s.y)))}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||o.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new o.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:P,height:A,data:k}=e,B=e;return this.style.addImage(u,{data:new o.R({width:P,height:A},new Uint8Array(k)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0,userImage:B}),B.onAdd&&B.onAdd(this,u),this}}{const{width:P,height:A,data:k}=ke.getImageData(e);this.style.addImage(u,{data:new o.R({width:P,height:A},k),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new o.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=e instanceof HTMLImageElement||o.b(e)?ke.getImageData(e):e,{width:l,height:h,data:f}=s;if(l===void 0||h===void 0)return this.fire(new o.k(new Error("Invalid arguments to map.updateImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));if(l!==i.data.width||h!==i.data.height)return this.fire(new o.k(new Error("The width and height of the updated image must be that same as the previous version of the image")));const _=!(e instanceof HTMLImageElement||o.b(e));return i.data.replace(f,_),this.style.updateImage(u,i),this}getImage(u){return this.style.getImage(u)}hasImage(u){return u?!!this.style.getImage(u):(this.fire(new o.k(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return Wt.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,e){return this._lazyInitEmptyStyle(),this.style.addLayer(u,e),this._update(!0)}moveLayer(u,e){return this.style.moveLayer(u,e),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(u,e,i){return this.style.setLayerZoomRange(u,e,i),this._update(!0)}setFilter(u,e,i={}){return this.style.setFilter(u,e,i),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,e,i,s={}){return this.style.setPaintProperty(u,e,i,s),this._update(!0)}getPaintProperty(u,e){return this.style.getPaintProperty(u,e)}setLayoutProperty(u,e,i,s={}){return this.style.setLayoutProperty(u,e,i,s),this._update(!0)}getLayoutProperty(u,e){return this.style.getLayoutProperty(u,e)}setGlyphs(u,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,e,i,s=>{s||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,e,i=>{i||this._update(!0)}),this}setLight(u,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(u,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,e){return this.style.setFeatureState(u,e),this._update()}removeFeatureState(u,e){return this.style.removeFeatureState(u,e),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,e=0;return this._container&&(u=this._container.clientWidth||400,e=this._container.clientHeight||300),[u,e]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const e=this._canvasContainer=le.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=le.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),s=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],s);const l=this._controlContainer=le.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=le.create("div",`maplibregl-ctrl-${f} `,l)}),this._container.addEventListener("scroll",this._onMapScroll,!1)}_resizeCanvas(u,e,i){this._canvas.width=Math.floor(i*u),this._canvas.height=Math.floor(i*e),this._canvas.style.width=`${u}px`,this._canvas.style.height=`${e}px`}_setupPainter(){const u=Object.assign(Object.assign({},this._canvasContextAttributes),{alpha:!0,depth:!0,stencil:!0,premultipliedAlpha:!0});let e=null;this._canvas.addEventListener("webglcontextcreationerror",s=>{e={requestedAttributes:u},s&&(e.statusMessage=s.statusMessage,e.type=s.type)},{once:!0});let i=null;if(i=this._canvasContextAttributes.contextType?this._canvas.getContext(this._canvasContextAttributes.contextType,u):this._canvas.getContext("webgl2",u)||this._canvas.getContext("webgl",u),!i){const s="Failed to initialize WebGL";throw e?(e.message=s,new Error(JSON.stringify(e))):new Error(s)}this.painter=new oc(i,this.transform),Oe.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const A=this.transform.zoom,k=ke.now();this.style.zoomHistory.update(A,k);const B=new o.C(A,{now:k,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),O=B.crossFadingFactor();O===1&&O===this._crossFadingFactor||(x=!0,this._crossFadingFactor=O),this.style.update(B)}const T=((i=this.style.projection)===null||i===void 0?void 0:i.transitionState)>0!==_;(s=this.style.projection)===null||s===void 0||s.setErrorQueryLatitudeDegrees(this.transform.center.lat),this.transform.setTransitionState((l=this.style.projection)===null||l===void 0?void 0:l.transitionState,(h=this.style.projection)===null||h===void 0?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||T)&&(this._sourcesDirty=!1,this.style._updateSources(this.transform)),this.terrain?(this.terrain.sourceCache.update(this.transform,this.terrain),this.transform.setMinElevationForCurrentTile(this.terrain.getMinTileElevationForLngLatZoom(this.transform.center,this.transform.tileZoom)),!this._elevationFreeze&&this._centerClampedToGround&&this.transform.setElevation(this.terrain.getElevationForLngLatZoom(this.transform.center,this.transform.tileZoom))):(this.transform.setMinElevationForCurrentTile(0),this._centerClampedToGround&&this.transform.setElevation(0)),this._placementDirty=this.style&&this.style._updatePlacement(this.transform,this.showCollisionBoxes,f,this._crossSourceCollisions,T),this.painter.render(this.style,{showTileBoundaries:this.showTileBoundaries,showOverdrawInspector:this._showOverdrawInspector,rotating:this.isRotating(),zooming:this.isZooming(),moving:this.isMoving(),fadeDuration:f,showPadding:this.showPadding}),this.fire(new o.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,o.cn.mark(o.co.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const P=this._sourcesDirty||this._styleDirty||this._placementDirty;return P||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||P||(this._fullyLoaded=!0,o.cn.mark(o.co.fullLoad)),this}redraw(){return this.style&&(this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._render(0)),this}remove(){var u;this._hash&&this._hash.remove();for(const i of this._controls)i.onRemove(this);this._controls=[],this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._renderTaskQueue.clear(),this.painter.destroy(),this.handlers.destroy(),delete this.handlers,this.setStyle(null),typeof window<"u"&&removeEventListener("online",this._onWindowOnline,!1),Wt.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),le.remove(this._canvasContainer),le.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cn.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ke.frame(this._frameRequest,u=>{o.cn.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cp(e)&&!function(i){return i.message===Zo}(e))throw e}},()=>{}))}get showTileBoundaries(){return!!this._showTileBoundaries}set showTileBoundaries(u){this._showTileBoundaries!==u&&(this._showTileBoundaries=u,this._update())}get showPadding(){return!!this._showPadding}set showPadding(u){this._showPadding!==u&&(this._showPadding=u,this._update())}get showCollisionBoxes(){return!!this._showCollisionBoxes}set showCollisionBoxes(u){this._showCollisionBoxes!==u&&(this._showCollisionBoxes=u,u?this.style._generateCollisionBoxes():this._update())}get showOverdrawInspector(){return!!this._showOverdrawInspector}set showOverdrawInspector(u){this._showOverdrawInspector!==u&&(this._showOverdrawInspector=u,this._update())}get repaint(){return!!this._repaint}set repaint(u){this._repaint!==u&&(this._repaint=u,this.triggerRepaint())}get vertices(){return!!this._vertices}set vertices(u){this._vertices=u,this._update()}get version(){return rt}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=Ri,S.MapTouchEvent=Ja,S.MapWheelEvent=hc,S.Marker=xa,S.NavigationControl=class{constructor(u){this._updateZoomButtons=()=>{const e=this._map.getZoom(),i=e===this._map.getMaxZoom(),s=e===this._map.getMinZoom();this._zoomInButton.disabled=i,this._zoomOutButton.disabled=s,this._zoomInButton.setAttribute("aria-disabled",i.toString()),this._zoomOutButton.setAttribute("aria-disabled",s.toString())},this._rotateCompassArrow=()=>{this._compassIcon.style.transform=this.options.visualizePitch&&this.options.visualizeRoll?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateZ(${-this._map.transform.roll}deg) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizePitch?`scale(${1/Math.pow(Math.cos(this._map.transform.pitchInRadians),.5)}) rotateX(${this._map.transform.pitch}deg) rotateZ(${-this._map.transform.bearing}deg)`:this.options.visualizeRoll?`rotate(${-this._map.transform.bearing-this._map.transform.roll}deg)`:`rotate(${-this._map.transform.bearing}deg)`},this._setButtonTitle=(e,i)=>{const s=this._map._getUIString(`NavigationControl.${i}`);e.title=s,e.setAttribute("aria-label",s)},this.options=o.e({},xc,u),this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=le.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new vc(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){le.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,e){const i=le.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},S.Popup=class extends o.E{constructor(u){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&le.remove(this._content),this._container&&(le.remove(this._container),delete this._container),this._map&&(this._map.off("move",this._update),this._map.off("move",this._onClose),this._map.off("click",this._onClose),this._map.off("remove",this.remove),this._map.off("mousemove",this._onMouseMove),this._map.off("mouseup",this._onMouseUp),this._map.off("drag",this._onDrag),this._map._canvasContainer.classList.remove("maplibregl-track-pointer"),delete this._map,this.fire(new o.l("close"))),this),this._onMouseUp=e=>{this._update(e.point)},this._onMouseMove=e=>{this._update(e.point)},this._onDrag=e=>{this._update(e.point)},this._update=e=>{if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=le.create("div","maplibregl-popup",this._map.getContainer()),this._tip=le.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const f of this.options.className.split(" "))this._container.classList.add(f);this._closeButton&&this._closeButton.setAttribute("aria-label",this._map._getUIString("Popup.Close")),this._trackPointer&&this._container.classList.add("maplibregl-popup-track-pointer")}if(this.options.maxWidth&&this._container.style.maxWidth!==this.options.maxWidth&&(this._container.style.maxWidth=this.options.maxWidth),this._lngLat=bc(this._lngLat,this._flatPos,this._map.transform,this._trackPointer),this._trackPointer&&!e)return;const i=this._flatPos=this._pos=this._trackPointer&&e?e:this._map.project(this._lngLat);this._map.terrain&&(this._flatPos=this._trackPointer&&e?e:this._map.transform.locationToScreenPoint(this._lngLat));let s=this.options.anchor;const l=ss(this.options.offset);if(!s){const f=this._container.offsetWidth,_=this._container.offsetHeight;let x;x=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?x.push("left"):i.x>this._map.transform.width-f/2&&x.push("right"),s=x.length===0?"bottom":x.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),le.setTransform(this._container,`${$r[s]} translate(${h.x}px,${h.y}px)`),ph(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(wc),u)}addTo(u){return this._map&&this.remove(),this._map=u,this.options.closeOnClick&&this._map.on("click",this._onClose),this.options.closeOnMove&&this._map.on("move",this._onClose),this._map.on("remove",this.remove),this._update(),this._focusFirstElement(),this._trackPointer?(this._map.on("mousemove",this._onMouseMove),this._map.on("mouseup",this._onMouseUp),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")):this._map.on("move",this._update),this.fire(new o.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=o.Q.convert(u),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const e=document.createDocumentFragment(),i=document.createElement("body");let s;for(i.innerHTML=u;s=i.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=le.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){return this._container&&this._container.classList.add(u),this}removeClassName(u){return this._container&&this._container.classList.remove(u),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}setSubpixelPositioning(u){this.options.subpixelPositioning=u}_createCloseButton(){this.options.closeButton&&(this._closeButton=le.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(Tc);u&&u.focus()}},S.RasterDEMTileSource=wn,S.RasterTileSource=vr,S.ScaleControl=class{constructor(u){this._onMove=()=>{Ks(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Ks(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Xs),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){le.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=vt,S.Style=$l,S.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=le.create("button","maplibregl-ctrl-terrain",this._container),le.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){le.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=tl,S.TwoFingersTouchRotateHandler=$e,S.TwoFingersTouchZoomHandler=rs,S.TwoFingersTouchZoomRotateHandler=_c,S.VectorTileSource=dn,S.VideoSource=Ye,S.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(bt(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{lt[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=qi;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Jr),qi=null):console.warn("Could not clear WebWorkers since there are active Map instances that still reference it. The pre-warmed WebWorker pool can only be cleared when all map instances have been removed with map.remove()"))},S.createTileMesh=Ps,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return Sn().getRTLTextPluginStatus()},S.getVersion=function(){return Mc},S.getWorkerCount=function(){return cr.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return jr().broadcast("IS",u)},S.prewarm=function(){yi().acquire(Jr)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return Sn().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){cr.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var F=w;return F})}(pu)),pu.exports}var sy=ay();const ed=ry(sy);class kf{constructor(g,w,I,R,F){Vt(this,"bounds1");Vt(this,"bounds2");Vt(this,"getBounds",(g,w,I,R)=>new ed.LngLatBounds([g,w],[I,R]));Vt(this,"contains",(g,w)=>this.bounds1.contains([w,g])||this.bounds2.contains([w,g]));const S=g.unproject([w,I]),o=g.unproject([R,F]);if(S.lng<-180){this.bounds1=this.getBounds(-180,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(S.wrap().lng,S.lat,180,o.lat);return}if(o.lng>180){this.bounds1=this.getBounds(S.lng,S.lat,180,o.lat),this.bounds2=this.getBounds(-180,S.lat,o.wrap().lng,o.lat);return}this.bounds1=this.getBounds(S.lng,S.lat,o.lng,o.lat),this.bounds2=this.getBounds(0,0,0,0)}}const oy={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(120, 120, 120, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(128, 128, 128, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(56, 56, 56, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(153, 153, 153, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(104, 104, 104, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(56, 56, 56, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(136, 136, 136, 1)","fill-outline-color":"rgba(102, 102, 102, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(128, 128, 128, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(50, 50, 50, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(52, 52, 52, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(88, 88, 88, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20],"line-color":"rgba(102, 102, 102, 1)"}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23],"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-width":2,"line-color":"rgba(85, 85, 85, 1)"}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(102, 102, 102, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(85, 85, 85, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(102, 102, 102, 1)",6,"rgba(85, 85, 85, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(68, 68, 68, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(51, 51, 51, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(51, 51, 51, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(255, 255, 255, 1)","text-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]},ly={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(220, 220, 220, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(228, 228, 228, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(156, 156, 156, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(253, 253, 253, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(204, 204, 204, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(156, 156, 156, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(236, 236, 236, 1)","fill-outline-color":"rgba(202, 202, 202, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(185, 185, 185)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(150, 150, 150, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(152, 152, 152, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(188, 188, 188)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(185, 185, 185)","line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23]}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":2}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(151, 151, 151, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(151, 151, 151, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1.5}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(0, 0, 0, 1)","text-color":"rgba(0, 0, 0, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]};var Zt;(function(v){v.assertEqual=R=>{};function g(R){}v.assertIs=g;function w(R){throw new Error}v.assertNever=w,v.arrayToEnum=R=>{const F={};for(const S of R)F[S]=S;return F},v.getValidEnumValues=R=>{const F=v.objectKeys(R).filter(o=>typeof R[R[o]]!="number"),S={};for(const o of F)S[o]=R[o];return v.objectValues(S)},v.objectValues=R=>v.objectKeys(R).map(function(F){return R[F]}),v.objectKeys=typeof Object.keys=="function"?R=>Object.keys(R):R=>{const F=[];for(const S in R)Object.prototype.hasOwnProperty.call(R,S)&&F.push(S);return F},v.find=(R,F)=>{for(const S of R)if(F(S))return S},v.isInteger=typeof Number.isInteger=="function"?R=>Number.isInteger(R):R=>typeof R=="number"&&Number.isFinite(R)&&Math.floor(R)===R;function I(R,F=" | "){return R.map(S=>typeof S=="string"?`'${S}'`:S).join(F)}v.joinValues=I,v.jsonStringifyReplacer=(R,F)=>typeof F=="bigint"?F.toString():F})(Zt||(Zt={}));var Af;(function(v){v.mergeShapes=(g,w)=>({...g,...w})})(Af||(Af={}));const Ke=Zt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ka=v=>{switch(typeof v){case"undefined":return Ke.undefined;case"string":return Ke.string;case"number":return Number.isNaN(v)?Ke.nan:Ke.number;case"boolean":return Ke.boolean;case"function":return Ke.function;case"bigint":return Ke.bigint;case"symbol":return Ke.symbol;case"object":return Array.isArray(v)?Ke.array:v===null?Ke.null:v.then&&typeof v.then=="function"&&v.catch&&typeof v.catch=="function"?Ke.promise:typeof Map<"u"&&v instanceof Map?Ke.map:typeof Set<"u"&&v instanceof Set?Ke.set:typeof Date<"u"&&v instanceof Date?Ke.date:Ke.object;default:return Ke.unknown}},Ve=Zt.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"]);class cn extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=I=>{this.issues=[...this.issues,I]},this.addIssues=(I=[])=>{this.issues=[...this.issues,...I]};const w=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,w):this.__proto__=w,this.name="ZodError",this.issues=g}format(g){const w=g||function(F){return F.message},I={_errors:[]},R=F=>{for(const S of F.issues)if(S.code==="invalid_union")S.unionErrors.map(R);else if(S.code==="invalid_return_type")R(S.returnTypeError);else if(S.code==="invalid_arguments")R(S.argumentsError);else if(S.path.length===0)I._errors.push(w(S));else{let o=I,de=0;for(;de<S.path.length;){const ge=S.path[de];de===S.path.length-1?(o[ge]=o[ge]||{_errors:[]},o[ge]._errors.push(w(S))):o[ge]=o[ge]||{_errors:[]},o=o[ge],de++}}};return R(this),I}static assert(g){if(!(g instanceof cn))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Zt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=w=>w.message){const w={},I=[];for(const R of this.issues)R.path.length>0?(w[R.path[0]]=w[R.path[0]]||[],w[R.path[0]].push(g(R))):I.push(g(R));return{formErrors:I,fieldErrors:w}}get formErrors(){return this.flatten()}}cn.create=v=>new cn(v);const Ml=(v,g)=>{let w;switch(v.code){case Ve.invalid_type:v.received===Ke.undefined?w="Required":w=`Expected ${v.expected}, received ${v.received}`;break;case Ve.invalid_literal:w=`Invalid literal value, expected ${JSON.stringify(v.expected,Zt.jsonStringifyReplacer)}`;break;case Ve.unrecognized_keys:w=`Unrecognized key(s) in object: ${Zt.joinValues(v.keys,", ")}`;break;case Ve.invalid_union:w="Invalid input";break;case Ve.invalid_union_discriminator:w=`Invalid discriminator value. Expected ${Zt.joinValues(v.options)}`;break;case Ve.invalid_enum_value:w=`Invalid enum value. Expected ${Zt.joinValues(v.options)}, received '${v.received}'`;break;case Ve.invalid_arguments:w="Invalid function arguments";break;case Ve.invalid_return_type:w="Invalid function return type";break;case Ve.invalid_date:w="Invalid date";break;case Ve.invalid_string:typeof v.validation=="object"?"includes"in v.validation?(w=`Invalid input: must include "${v.validation.includes}"`,typeof v.validation.position=="number"&&(w=`${w} at one or more positions greater than or equal to ${v.validation.position}`)):"startsWith"in v.validation?w=`Invalid input: must start with "${v.validation.startsWith}"`:"endsWith"in v.validation?w=`Invalid input: must end with "${v.validation.endsWith}"`:Zt.assertNever(v.validation):v.validation!=="regex"?w=`Invalid ${v.validation}`:w="Invalid";break;case Ve.too_small:v.type==="array"?w=`Array must contain ${v.exact?"exactly":v.inclusive?"at least":"more than"} ${v.minimum} element(s)`:v.type==="string"?w=`String must contain ${v.exact?"exactly":v.inclusive?"at least":"over"} ${v.minimum} character(s)`:v.type==="number"?w=`Number must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${v.minimum}`:v.type==="date"?w=`Date must be ${v.exact?"exactly equal to ":v.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(v.minimum))}`:w="Invalid input";break;case Ve.too_big:v.type==="array"?w=`Array must contain ${v.exact?"exactly":v.inclusive?"at most":"less than"} ${v.maximum} element(s)`:v.type==="string"?w=`String must contain ${v.exact?"exactly":v.inclusive?"at most":"under"} ${v.maximum} character(s)`:v.type==="number"?w=`Number must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="bigint"?w=`BigInt must be ${v.exact?"exactly":v.inclusive?"less than or equal to":"less than"} ${v.maximum}`:v.type==="date"?w=`Date must be ${v.exact?"exactly":v.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(v.maximum))}`:w="Invalid input";break;case Ve.custom:w="Invalid input";break;case Ve.invalid_intersection_types:w="Intersection results could not be merged";break;case Ve.not_multiple_of:w=`Number must be a multiple of ${v.multipleOf}`;break;case Ve.not_finite:w="Number must be finite";break;default:w=g.defaultError,Zt.assertNever(v)}return{message:w}};let cy=Ml;function td(){return cy}const id=v=>{const{data:g,path:w,errorMaps:I,issueData:R}=v,F=[...w,...R.path||[]],S={...R,path:F};if(R.message!==void 0)return{...R,path:F,message:R.message};let o="";const de=I.filter(ge=>!!ge).slice().reverse();for(const ge of de)o=ge(S,{data:g,defaultError:o}).message;return{...R,path:F,message:o}};function qe(v,g){const w=td(),I=id({issueData:g,data:v.data,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,w,w===Ml?void 0:Ml].filter(R=>!!R)});v.common.issues.push(I)}class Kr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,w){const I=[];for(const R of w){if(R.status==="aborted")return _t;R.status==="dirty"&&g.dirty(),I.push(R.value)}return{status:g.value,value:I}}static async mergeObjectAsync(g,w){const I=[];for(const R of w){const F=await R.key,S=await R.value;I.push({key:F,value:S})}return Kr.mergeObjectSync(g,I)}static mergeObjectSync(g,w){const I={};for(const R of w){const{key:F,value:S}=R;if(F.status==="aborted"||S.status==="aborted")return _t;F.status==="dirty"&&g.dirty(),S.status==="dirty"&&g.dirty(),F.value!=="__proto__"&&(typeof S.value<"u"||R.alwaysSet)&&(I[F.value]=S.value)}return{status:g.value,value:I}}}const _t=Object.freeze({status:"aborted"}),Sl=v=>({status:"dirty",value:v}),Fr=v=>({status:"valid",value:v}),Ef=v=>v.status==="aborted",zf=v=>v.status==="dirty",po=v=>v.status==="valid",fu=v=>typeof Promise<"u"&&v instanceof Promise;var tt;(function(v){v.errToObj=g=>typeof g=="string"?{message:g}:g||{},v.toString=g=>typeof g=="string"?g:g==null?void 0:g.message})(tt||(tt={}));var mu=function(v,g,w,I){if(w==="a"&&!I)throw new TypeError("Private accessor was defined without a getter");if(typeof g=="function"?v!==g||!I:!g.has(v))throw new TypeError("Cannot read private member from an object whose class did not declare it");return w==="m"?I:w==="a"?I.call(v):I?I.value:g.get(v)},Rf=function(v,g,w,I,R){if(I==="m")throw new TypeError("Private method is not writable");if(I==="a"&&!R)throw new TypeError("Private accessor was defined without a setter");if(typeof g=="function"?v!==g||!R:!g.has(v))throw new TypeError("Cannot write private member to an object whose class did not declare it");return I==="a"?R.call(v,w):R?R.value=w:g.set(v,w),w},Pl,Cl;class Aa{constructor(g,w,I,R){this._cachedPath=[],this.parent=g,this.data=w,this._path=I,this._key=R}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}}const Df=(v,g)=>{if(po(g))return{success:!0,data:g.value};if(!v.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const w=new cn(v.common.issues);return this._error=w,this._error}}};function Ct(v){if(!v)return{};const{errorMap:g,invalid_type_error:w,required_error:I,description:R}=v;if(g&&(w||I))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:R}:{errorMap:(S,o)=>{const{message:de}=v;return S.code==="invalid_enum_value"?{message:de??o.defaultError}:typeof o.data>"u"?{message:de??I??o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:de??w??o.defaultError}},description:R}}class Bt{get description(){return this._def.description}_getType(g){return ka(g.data)}_getOrReturnCtx(g,w){return w||{common:g.parent.common,data:g.data,parsedType:ka(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new Kr,ctx:{common:g.parent.common,data:g.data,parsedType:ka(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const w=this._parse(g);if(fu(w))throw new Error("Synchronous parse encountered promise.");return w}_parseAsync(g){const w=this._parse(g);return Promise.resolve(w)}parse(g,w){const I=this.safeParse(g,w);if(I.success)return I.data;throw I.error}safeParse(g,w){const I={common:{issues:[],async:(w==null?void 0:w.async)??!1,contextualErrorMap:w==null?void 0:w.errorMap},path:(w==null?void 0:w.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:ka(g)},R=this._parseSync({data:g,path:I.path,parent:I});return Df(I,R)}"~validate"(g){var I,R;const w={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:ka(g)};if(!this["~standard"].async)try{const F=this._parseSync({data:g,path:[],parent:w});return po(F)?{value:F.value}:{issues:w.common.issues}}catch(F){(R=(I=F==null?void 0:F.message)==null?void 0:I.toLowerCase())!=null&&R.includes("encountered")&&(this["~standard"].async=!0),w.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:w}).then(F=>po(F)?{value:F.value}:{issues:w.common.issues})}async parseAsync(g,w){const I=await this.safeParseAsync(g,w);if(I.success)return I.data;throw I.error}async safeParseAsync(g,w){const I={common:{issues:[],contextualErrorMap:w==null?void 0:w.errorMap,async:!0},path:(w==null?void 0:w.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:ka(g)},R=this._parse({data:g,path:I.path,parent:I}),F=await(fu(R)?R:Promise.resolve(R));return Df(I,F)}refine(g,w){const I=R=>typeof w=="string"||typeof w>"u"?{message:w}:typeof w=="function"?w(R):w;return this._refinement((R,F)=>{const S=g(R),o=()=>F.addIssue({code:Ve.custom,...I(R)});return typeof Promise<"u"&&S instanceof Promise?S.then(de=>de?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(g,w){return this._refinement((I,R)=>g(I)?!0:(R.addIssue(typeof w=="function"?w(I,R):w),!1))}_refinement(g){return new yo({schema:this,typeName:ft.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}constructor(g){this.spa=this.safeParseAsync,this._def=g,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:w=>this["~validate"](w)}}optional(){return Ra.create(this,this._def)}nullable(){return xo.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Vn.create(this)}promise(){return El.create(this,this._def)}or(g){return _u.create([this,g],this._def)}and(g){return yu.create(this,g,this._def)}transform(g){return new yo({...Ct(this._def),schema:this,typeName:ft.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const w=typeof g=="function"?g:()=>g;return new ld({...Ct(this._def),innerType:this,defaultValue:w,typeName:ft.ZodDefault})}brand(){return new zy({typeName:ft.ZodBranded,type:this,...Ct(this._def)})}catch(g){const w=typeof g=="function"?g:()=>g;return new cd({...Ct(this._def),innerType:this,catchValue:w,typeName:ft.ZodCatch})}describe(g){const w=this.constructor;return new w({...this._def,description:g})}pipe(g){return ud.create(this,g)}readonly(){return hd.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const uy=/^c[^\s-]{8,}$/i,hy=/^[0-9a-z]+$/,dy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,py=/^[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,fy=/^[a-z0-9_-]{21}$/i,my=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,gy=/^[-+]?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)?)??$/,_y=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,yy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let rd;const xy=/^(?:(?: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])$/,vy=/^(?:(?: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])$/,by=/^(([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]))$/,wy=/^(([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])$/,Ty=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,My=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Lf="((\\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])))",Sy=new RegExp(`^${Lf}$`);function Bf(v){let g="[0-5]\\d";v.precision?g=`${g}\\.\\d{${v.precision}}`:v.precision==null&&(g=`${g}(\\.\\d+)?`);const w=v.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${g})${w}`}function Py(v){return new RegExp(`^${Bf(v)}$`)}function Cy(v){let g=`${Lf}T${Bf(v)}`;const w=[];return w.push(v.local?"Z?":"Z"),v.offset&&w.push("([+-]\\d{2}:?\\d{2})"),g=`${g}(${w.join("|")})`,new RegExp(`^${g}$`)}function Iy(v,g){return!!((g==="v4"||!g)&&xy.test(v)||(g==="v6"||!g)&&by.test(v))}function ky(v,g){if(!my.test(v))return!1;try{const[w]=v.split("."),I=w.replace(/-/g,"+").replace(/_/g,"/").padEnd(w.length+(4-w.length%4)%4,"="),R=JSON.parse(atob(I));return!(typeof R!="object"||R===null||"typ"in R&&(R==null?void 0:R.typ)!=="JWT"||!R.alg||g&&R.alg!==g)}catch{return!1}}function Ay(v,g){return!!((g==="v4"||!g)&&vy.test(v)||(g==="v6"||!g)&&wy.test(v))}class Ea extends Bt{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Ke.string){const F=this._getOrReturnCtx(g);return qe(F,{code:Ve.invalid_type,expected:Ke.string,received:F.parsedType}),_t}const I=new Kr;let R;for(const F of this._def.checks)if(F.kind==="min")g.data.length<F.value&&(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.too_small,minimum:F.value,type:"string",inclusive:!0,exact:!1,message:F.message}),I.dirty());else if(F.kind==="max")g.data.length>F.value&&(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.too_big,maximum:F.value,type:"string",inclusive:!0,exact:!1,message:F.message}),I.dirty());else if(F.kind==="length"){const S=g.data.length>F.value,o=g.data.length<F.value;(S||o)&&(R=this._getOrReturnCtx(g,R),S?qe(R,{code:Ve.too_big,maximum:F.value,type:"string",inclusive:!0,exact:!0,message:F.message}):o&&qe(R,{code:Ve.too_small,minimum:F.value,type:"string",inclusive:!0,exact:!0,message:F.message}),I.dirty())}else if(F.kind==="email")_y.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"email",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="emoji")rd||(rd=new RegExp(yy,"u")),rd.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"emoji",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="uuid")py.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"uuid",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="nanoid")fy.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"nanoid",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="cuid")uy.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"cuid",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="cuid2")hy.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"cuid2",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="ulid")dy.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"ulid",code:Ve.invalid_string,message:F.message}),I.dirty());else if(F.kind==="url")try{new URL(g.data)}catch{R=this._getOrReturnCtx(g,R),qe(R,{validation:"url",code:Ve.invalid_string,message:F.message}),I.dirty()}else F.kind==="regex"?(F.regex.lastIndex=0,F.regex.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"regex",code:Ve.invalid_string,message:F.message}),I.dirty())):F.kind==="trim"?g.data=g.data.trim():F.kind==="includes"?g.data.includes(F.value,F.position)||(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.invalid_string,validation:{includes:F.value,position:F.position},message:F.message}),I.dirty()):F.kind==="toLowerCase"?g.data=g.data.toLowerCase():F.kind==="toUpperCase"?g.data=g.data.toUpperCase():F.kind==="startsWith"?g.data.startsWith(F.value)||(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.invalid_string,validation:{startsWith:F.value},message:F.message}),I.dirty()):F.kind==="endsWith"?g.data.endsWith(F.value)||(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.invalid_string,validation:{endsWith:F.value},message:F.message}),I.dirty()):F.kind==="datetime"?Cy(F).test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.invalid_string,validation:"datetime",message:F.message}),I.dirty()):F.kind==="date"?Sy.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.invalid_string,validation:"date",message:F.message}),I.dirty()):F.kind==="time"?Py(F).test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.invalid_string,validation:"time",message:F.message}),I.dirty()):F.kind==="duration"?gy.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"duration",code:Ve.invalid_string,message:F.message}),I.dirty()):F.kind==="ip"?Iy(g.data,F.version)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"ip",code:Ve.invalid_string,message:F.message}),I.dirty()):F.kind==="jwt"?ky(g.data,F.alg)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"jwt",code:Ve.invalid_string,message:F.message}),I.dirty()):F.kind==="cidr"?Ay(g.data,F.version)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"cidr",code:Ve.invalid_string,message:F.message}),I.dirty()):F.kind==="base64"?Ty.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"base64",code:Ve.invalid_string,message:F.message}),I.dirty()):F.kind==="base64url"?My.test(g.data)||(R=this._getOrReturnCtx(g,R),qe(R,{validation:"base64url",code:Ve.invalid_string,message:F.message}),I.dirty()):Zt.assertNever(F);return{status:I.value,value:g.data}}_regex(g,w,I){return this.refinement(R=>g.test(R),{validation:w,code:Ve.invalid_string,...tt.errToObj(I)})}_addCheck(g){return new Ea({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...tt.errToObj(g)})}url(g){return this._addCheck({kind:"url",...tt.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...tt.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...tt.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...tt.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...tt.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...tt.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...tt.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...tt.errToObj(g)})}base64url(g){return this._addCheck({kind:"base64url",...tt.errToObj(g)})}jwt(g){return this._addCheck({kind:"jwt",...tt.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...tt.errToObj(g)})}cidr(g){return this._addCheck({kind:"cidr",...tt.errToObj(g)})}datetime(g){return typeof g=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:g}):this._addCheck({kind:"datetime",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,offset:(g==null?void 0:g.offset)??!1,local:(g==null?void 0:g.local)??!1,...tt.errToObj(g==null?void 0:g.message)})}date(g){return this._addCheck({kind:"date",message:g})}time(g){return typeof g=="string"?this._addCheck({kind:"time",precision:null,message:g}):this._addCheck({kind:"time",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,...tt.errToObj(g==null?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...tt.errToObj(g)})}regex(g,w){return this._addCheck({kind:"regex",regex:g,...tt.errToObj(w)})}includes(g,w){return this._addCheck({kind:"includes",value:g,position:w==null?void 0:w.position,...tt.errToObj(w==null?void 0:w.message)})}startsWith(g,w){return this._addCheck({kind:"startsWith",value:g,...tt.errToObj(w)})}endsWith(g,w){return this._addCheck({kind:"endsWith",value:g,...tt.errToObj(w)})}min(g,w){return this._addCheck({kind:"min",value:g,...tt.errToObj(w)})}max(g,w){return this._addCheck({kind:"max",value:g,...tt.errToObj(w)})}length(g,w){return this._addCheck({kind:"length",value:g,...tt.errToObj(w)})}nonempty(g){return this.min(1,tt.errToObj(g))}trim(){return new Ea({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ea({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ea({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(g=>g.kind==="datetime")}get isDate(){return!!this._def.checks.find(g=>g.kind==="date")}get isTime(){return!!this._def.checks.find(g=>g.kind==="time")}get isDuration(){return!!this._def.checks.find(g=>g.kind==="duration")}get isEmail(){return!!this._def.checks.find(g=>g.kind==="email")}get isURL(){return!!this._def.checks.find(g=>g.kind==="url")}get isEmoji(){return!!this._def.checks.find(g=>g.kind==="emoji")}get isUUID(){return!!this._def.checks.find(g=>g.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(g=>g.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(g=>g.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(g=>g.kind==="cuid2")}get isULID(){return!!this._def.checks.find(g=>g.kind==="ulid")}get isIP(){return!!this._def.checks.find(g=>g.kind==="ip")}get isCIDR(){return!!this._def.checks.find(g=>g.kind==="cidr")}get isBase64(){return!!this._def.checks.find(g=>g.kind==="base64")}get isBase64url(){return!!this._def.checks.find(g=>g.kind==="base64url")}get minLength(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxLength(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}}Ea.create=v=>new Ea({checks:[],typeName:ft.ZodString,coerce:(v==null?void 0:v.coerce)??!1,...Ct(v)});function Ey(v,g){const w=(v.toString().split(".")[1]||"").length,I=(g.toString().split(".")[1]||"").length,R=w>I?w:I,F=Number.parseInt(v.toFixed(R).replace(".","")),S=Number.parseInt(g.toFixed(R).replace(".",""));return F%S/10**R}class fo extends Bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){if(this._def.coerce&&(g.data=Number(g.data)),this._getType(g)!==Ke.number){const F=this._getOrReturnCtx(g);return qe(F,{code:Ve.invalid_type,expected:Ke.number,received:F.parsedType}),_t}let I;const R=new Kr;for(const F of this._def.checks)F.kind==="int"?Zt.isInteger(g.data)||(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.invalid_type,expected:"integer",received:"float",message:F.message}),R.dirty()):F.kind==="min"?(F.inclusive?g.data<F.value:g.data<=F.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.too_small,minimum:F.value,type:"number",inclusive:F.inclusive,exact:!1,message:F.message}),R.dirty()):F.kind==="max"?(F.inclusive?g.data>F.value:g.data>=F.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.too_big,maximum:F.value,type:"number",inclusive:F.inclusive,exact:!1,message:F.message}),R.dirty()):F.kind==="multipleOf"?Ey(g.data,F.value)!==0&&(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.not_multiple_of,multipleOf:F.value,message:F.message}),R.dirty()):F.kind==="finite"?Number.isFinite(g.data)||(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.not_finite,message:F.message}),R.dirty()):Zt.assertNever(F);return{status:R.value,value:g.data}}gte(g,w){return this.setLimit("min",g,!0,tt.toString(w))}gt(g,w){return this.setLimit("min",g,!1,tt.toString(w))}lte(g,w){return this.setLimit("max",g,!0,tt.toString(w))}lt(g,w){return this.setLimit("max",g,!1,tt.toString(w))}setLimit(g,w,I,R){return new fo({...this._def,checks:[...this._def.checks,{kind:g,value:w,inclusive:I,message:tt.toString(R)}]})}_addCheck(g){return new fo({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:tt.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:tt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:tt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:tt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:tt.toString(g)})}multipleOf(g,w){return this._addCheck({kind:"multipleOf",value:g,message:tt.toString(w)})}finite(g){return this._addCheck({kind:"finite",message:tt.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:tt.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:tt.toString(g)})}get minValue(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxValue(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}get isInt(){return!!this._def.checks.find(g=>g.kind==="int"||g.kind==="multipleOf"&&Zt.isInteger(g.value))}get isFinite(){let g=null,w=null;for(const I of this._def.checks){if(I.kind==="finite"||I.kind==="int"||I.kind==="multipleOf")return!0;I.kind==="min"?(w===null||I.value>w)&&(w=I.value):I.kind==="max"&&(g===null||I.value<g)&&(g=I.value)}return Number.isFinite(w)&&Number.isFinite(g)}}fo.create=v=>new fo({checks:[],typeName:ft.ZodNumber,coerce:(v==null?void 0:v.coerce)||!1,...Ct(v)});class Il extends Bt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){if(this._def.coerce)try{g.data=BigInt(g.data)}catch{return this._getInvalidInput(g)}if(this._getType(g)!==Ke.bigint)return this._getInvalidInput(g);let I;const R=new Kr;for(const F of this._def.checks)F.kind==="min"?(F.inclusive?g.data<F.value:g.data<=F.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.too_small,type:"bigint",minimum:F.value,inclusive:F.inclusive,message:F.message}),R.dirty()):F.kind==="max"?(F.inclusive?g.data>F.value:g.data>=F.value)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.too_big,type:"bigint",maximum:F.value,inclusive:F.inclusive,message:F.message}),R.dirty()):F.kind==="multipleOf"?g.data%F.value!==BigInt(0)&&(I=this._getOrReturnCtx(g,I),qe(I,{code:Ve.not_multiple_of,multipleOf:F.value,message:F.message}),R.dirty()):Zt.assertNever(F);return{status:R.value,value:g.data}}_getInvalidInput(g){const w=this._getOrReturnCtx(g);return qe(w,{code:Ve.invalid_type,expected:Ke.bigint,received:w.parsedType}),_t}gte(g,w){return this.setLimit("min",g,!0,tt.toString(w))}gt(g,w){return this.setLimit("min",g,!1,tt.toString(w))}lte(g,w){return this.setLimit("max",g,!0,tt.toString(w))}lt(g,w){return this.setLimit("max",g,!1,tt.toString(w))}setLimit(g,w,I,R){return new Il({...this._def,checks:[...this._def.checks,{kind:g,value:w,inclusive:I,message:tt.toString(R)}]})}_addCheck(g){return new Il({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:tt.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:tt.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:tt.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:tt.toString(g)})}multipleOf(g,w){return this._addCheck({kind:"multipleOf",value:g,message:tt.toString(w)})}get minValue(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g}get maxValue(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g}}Il.create=v=>new Il({checks:[],typeName:ft.ZodBigInt,coerce:(v==null?void 0:v.coerce)??!1,...Ct(v)});class Ff extends Bt{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Ke.boolean){const I=this._getOrReturnCtx(g);return qe(I,{code:Ve.invalid_type,expected:Ke.boolean,received:I.parsedType}),_t}return Fr(g.data)}}Ff.create=v=>new Ff({typeName:ft.ZodBoolean,coerce:(v==null?void 0:v.coerce)||!1,...Ct(v)});class gu extends Bt{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Ke.date){const F=this._getOrReturnCtx(g);return qe(F,{code:Ve.invalid_type,expected:Ke.date,received:F.parsedType}),_t}if(Number.isNaN(g.data.getTime())){const F=this._getOrReturnCtx(g);return qe(F,{code:Ve.invalid_date}),_t}const I=new Kr;let R;for(const F of this._def.checks)F.kind==="min"?g.data.getTime()<F.value&&(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.too_small,message:F.message,inclusive:!0,exact:!1,minimum:F.value,type:"date"}),I.dirty()):F.kind==="max"?g.data.getTime()>F.value&&(R=this._getOrReturnCtx(g,R),qe(R,{code:Ve.too_big,message:F.message,inclusive:!0,exact:!1,maximum:F.value,type:"date"}),I.dirty()):Zt.assertNever(F);return{status:I.value,value:new Date(g.data.getTime())}}_addCheck(g){return new gu({...this._def,checks:[...this._def.checks,g]})}min(g,w){return this._addCheck({kind:"min",value:g.getTime(),message:tt.toString(w)})}max(g,w){return this._addCheck({kind:"max",value:g.getTime(),message:tt.toString(w)})}get minDate(){let g=null;for(const w of this._def.checks)w.kind==="min"&&(g===null||w.value>g)&&(g=w.value);return g!=null?new Date(g):null}get maxDate(){let g=null;for(const w of this._def.checks)w.kind==="max"&&(g===null||w.value<g)&&(g=w.value);return g!=null?new Date(g):null}}gu.create=v=>new gu({checks:[],coerce:(v==null?void 0:v.coerce)||!1,typeName:ft.ZodDate,...Ct(v)});class Of extends Bt{_parse(g){if(this._getType(g)!==Ke.symbol){const I=this._getOrReturnCtx(g);return qe(I,{code:Ve.invalid_type,expected:Ke.symbol,received:I.parsedType}),_t}return Fr(g.data)}}Of.create=v=>new Of({typeName:ft.ZodSymbol,...Ct(v)});class jf extends Bt{_parse(g){if(this._getType(g)!==Ke.undefined){const I=this._getOrReturnCtx(g);return qe(I,{code:Ve.invalid_type,expected:Ke.undefined,received:I.parsedType}),_t}return Fr(g.data)}}jf.create=v=>new jf({typeName:ft.ZodUndefined,...Ct(v)});class Nf extends Bt{_parse(g){if(this._getType(g)!==Ke.null){const I=this._getOrReturnCtx(g);return qe(I,{code:Ve.invalid_type,expected:Ke.null,received:I.parsedType}),_t}return Fr(g.data)}}Nf.create=v=>new Nf({typeName:ft.ZodNull,...Ct(v)});class nd extends Bt{constructor(){super(...arguments),this._any=!0}_parse(g){return Fr(g.data)}}nd.create=v=>new nd({typeName:ft.ZodAny,...Ct(v)});class mo extends Bt{constructor(){super(...arguments),this._unknown=!0}_parse(g){return Fr(g.data)}}mo.create=v=>new mo({typeName:ft.ZodUnknown,...Ct(v)});class za extends Bt{_parse(g){const w=this._getOrReturnCtx(g);return qe(w,{code:Ve.invalid_type,expected:Ke.never,received:w.parsedType}),_t}}za.create=v=>new za({typeName:ft.ZodNever,...Ct(v)});class ad extends Bt{_parse(g){if(this._getType(g)!==Ke.undefined){const I=this._getOrReturnCtx(g);return qe(I,{code:Ve.invalid_type,expected:Ke.void,received:I.parsedType}),_t}return Fr(g.data)}}ad.create=v=>new ad({typeName:ft.ZodVoid,...Ct(v)});class Vn extends Bt{_parse(g){const{ctx:w,status:I}=this._processInputParams(g),R=this._def;if(w.parsedType!==Ke.array)return qe(w,{code:Ve.invalid_type,expected:Ke.array,received:w.parsedType}),_t;if(R.exactLength!==null){const S=w.data.length>R.exactLength.value,o=w.data.length<R.exactLength.value;(S||o)&&(qe(w,{code:S?Ve.too_big:Ve.too_small,minimum:o?R.exactLength.value:void 0,maximum:S?R.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:R.exactLength.message}),I.dirty())}if(R.minLength!==null&&w.data.length<R.minLength.value&&(qe(w,{code:Ve.too_small,minimum:R.minLength.value,type:"array",inclusive:!0,exact:!1,message:R.minLength.message}),I.dirty()),R.maxLength!==null&&w.data.length>R.maxLength.value&&(qe(w,{code:Ve.too_big,maximum:R.maxLength.value,type:"array",inclusive:!0,exact:!1,message:R.maxLength.message}),I.dirty()),w.common.async)return Promise.all([...w.data].map((S,o)=>R.type._parseAsync(new Aa(w,S,w.path,o)))).then(S=>Kr.mergeArray(I,S));const F=[...w.data].map((S,o)=>R.type._parseSync(new Aa(w,S,w.path,o)));return Kr.mergeArray(I,F)}get element(){return this._def.type}min(g,w){return new Vn({...this._def,minLength:{value:g,message:tt.toString(w)}})}max(g,w){return new Vn({...this._def,maxLength:{value:g,message:tt.toString(w)}})}length(g,w){return new Vn({...this._def,exactLength:{value:g,message:tt.toString(w)}})}nonempty(g){return this.min(1,g)}}Vn.create=(v,g)=>new Vn({type:v,minLength:null,maxLength:null,exactLength:null,typeName:ft.ZodArray,...Ct(g)});function go(v){if(v instanceof Oi){const g={};for(const w in v.shape){const I=v.shape[w];g[w]=Ra.create(go(I))}return new Oi({...v._def,shape:()=>g})}else return v instanceof Vn?new Vn({...v._def,type:go(v.element)}):v instanceof Ra?Ra.create(go(v.unwrap())):v instanceof xo?xo.create(go(v.unwrap())):v instanceof ra?ra.create(v.items.map(g=>go(g))):v}class Oi extends Bt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const g=this._def.shape(),w=Zt.objectKeys(g);return this._cached={shape:g,keys:w},this._cached}_parse(g){if(this._getType(g)!==Ke.object){const ge=this._getOrReturnCtx(g);return qe(ge,{code:Ve.invalid_type,expected:Ke.object,received:ge.parsedType}),_t}const{status:I,ctx:R}=this._processInputParams(g),{shape:F,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof za&&this._def.unknownKeys==="strip"))for(const ge in R.data)S.includes(ge)||o.push(ge);const de=[];for(const ge of S){const ze=F[ge],Be=R.data[ge];de.push({key:{status:"valid",value:ge},value:ze._parse(new Aa(R,Be,R.path,ge)),alwaysSet:ge in R.data})}if(this._def.catchall instanceof za){const ge=this._def.unknownKeys;if(ge==="passthrough")for(const ze of o)de.push({key:{status:"valid",value:ze},value:{status:"valid",value:R.data[ze]}});else if(ge==="strict")o.length>0&&(qe(R,{code:Ve.unrecognized_keys,keys:o}),I.dirty());else if(ge!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const ge=this._def.catchall;for(const ze of o){const Be=R.data[ze];de.push({key:{status:"valid",value:ze},value:ge._parse(new Aa(R,Be,R.path,ze)),alwaysSet:ze in R.data})}}return R.common.async?Promise.resolve().then(async()=>{const ge=[];for(const ze of de){const Be=await ze.key,ke=await ze.value;ge.push({key:Be,value:ke,alwaysSet:ze.alwaysSet})}return ge}).then(ge=>Kr.mergeObjectSync(I,ge)):Kr.mergeObjectSync(I,de)}get shape(){return this._def.shape()}strict(g){return tt.errToObj,new Oi({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(w,I)=>{var F,S;const R=((S=(F=this._def).errorMap)==null?void 0:S.call(F,w,I).message)??I.defaultError;return w.code==="unrecognized_keys"?{message:tt.errToObj(g).message??R}:{message:R}}}:{}})}strip(){return new Oi({...this._def,unknownKeys:"strip"})}passthrough(){return new Oi({...this._def,unknownKeys:"passthrough"})}extend(g){return new Oi({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new Oi({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:ft.ZodObject})}setKey(g,w){return this.augment({[g]:w})}catchall(g){return new Oi({...this._def,catchall:g})}pick(g){const w={};for(const I of Zt.objectKeys(g))g[I]&&this.shape[I]&&(w[I]=this.shape[I]);return new Oi({...this._def,shape:()=>w})}omit(g){const w={};for(const I of Zt.objectKeys(this.shape))g[I]||(w[I]=this.shape[I]);return new Oi({...this._def,shape:()=>w})}deepPartial(){return go(this)}partial(g){const w={};for(const I of Zt.objectKeys(this.shape)){const R=this.shape[I];g&&!g[I]?w[I]=R:w[I]=R.optional()}return new Oi({...this._def,shape:()=>w})}required(g){const w={};for(const I of Zt.objectKeys(this.shape))if(g&&!g[I])w[I]=this.shape[I];else{let F=this.shape[I];for(;F instanceof Ra;)F=F._def.innerType;w[I]=F}return new Oi({...this._def,shape:()=>w})}keyof(){return Uf(Zt.objectKeys(this.shape))}}Oi.create=(v,g)=>new Oi({shape:()=>v,unknownKeys:"strip",catchall:za.create(),typeName:ft.ZodObject,...Ct(g)}),Oi.strictCreate=(v,g)=>new Oi({shape:()=>v,unknownKeys:"strict",catchall:za.create(),typeName:ft.ZodObject,...Ct(g)}),Oi.lazycreate=(v,g)=>new Oi({shape:v,unknownKeys:"strip",catchall:za.create(),typeName:ft.ZodObject,...Ct(g)});class _u extends Bt{_parse(g){const{ctx:w}=this._processInputParams(g),I=this._def.options;function R(F){for(const o of F)if(o.result.status==="valid")return o.result;for(const o of F)if(o.result.status==="dirty")return w.common.issues.push(...o.ctx.common.issues),o.result;const S=F.map(o=>new cn(o.ctx.common.issues));return qe(w,{code:Ve.invalid_union,unionErrors:S}),_t}if(w.common.async)return Promise.all(I.map(async F=>{const S={...w,common:{...w.common,issues:[]},parent:null};return{result:await F._parseAsync({data:w.data,path:w.path,parent:S}),ctx:S}})).then(R);{let F;const S=[];for(const de of I){const ge={...w,common:{...w.common,issues:[]},parent:null},ze=de._parseSync({data:w.data,path:w.path,parent:ge});if(ze.status==="valid")return ze;ze.status==="dirty"&&!F&&(F={result:ze,ctx:ge}),ge.common.issues.length&&S.push(ge.common.issues)}if(F)return w.common.issues.push(...F.ctx.common.issues),F.result;const o=S.map(de=>new cn(de));return qe(w,{code:Ve.invalid_union,unionErrors:o}),_t}}get options(){return this._def.options}}_u.create=(v,g)=>new _u({options:v,typeName:ft.ZodUnion,...Ct(g)});function sd(v,g){const w=ka(v),I=ka(g);if(v===g)return{valid:!0,data:v};if(w===Ke.object&&I===Ke.object){const R=Zt.objectKeys(g),F=Zt.objectKeys(v).filter(o=>R.indexOf(o)!==-1),S={...v,...g};for(const o of F){const de=sd(v[o],g[o]);if(!de.valid)return{valid:!1};S[o]=de.data}return{valid:!0,data:S}}else if(w===Ke.array&&I===Ke.array){if(v.length!==g.length)return{valid:!1};const R=[];for(let F=0;F<v.length;F++){const S=v[F],o=g[F],de=sd(S,o);if(!de.valid)return{valid:!1};R.push(de.data)}return{valid:!0,data:R}}else return w===Ke.date&&I===Ke.date&&+v==+g?{valid:!0,data:v}:{valid:!1}}class yu extends Bt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g),R=(F,S)=>{if(Ef(F)||Ef(S))return _t;const o=sd(F.value,S.value);return o.valid?((zf(F)||zf(S))&&w.dirty(),{status:w.value,value:o.data}):(qe(I,{code:Ve.invalid_intersection_types}),_t)};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(([F,S])=>R(F,S)):R(this._def.left._parseSync({data:I.data,path:I.path,parent:I}),this._def.right._parseSync({data:I.data,path:I.path,parent:I}))}}yu.create=(v,g,w)=>new yu({left:v,right:g,typeName:ft.ZodIntersection,...Ct(w)});class ra extends Bt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.array)return qe(I,{code:Ve.invalid_type,expected:Ke.array,received:I.parsedType}),_t;if(I.data.length<this._def.items.length)return qe(I,{code:Ve.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_t;!this._def.rest&&I.data.length>this._def.items.length&&(qe(I,{code:Ve.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),w.dirty());const F=[...I.data].map((S,o)=>{const de=this._def.items[o]||this._def.rest;return de?de._parse(new Aa(I,S,I.path,o)):null}).filter(S=>!!S);return I.common.async?Promise.all(F).then(S=>Kr.mergeArray(w,S)):Kr.mergeArray(w,F)}get items(){return this._def.items}rest(g){return new ra({...this._def,rest:g})}}ra.create=(v,g)=>{if(!Array.isArray(v))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new ra({items:v,typeName:ft.ZodTuple,rest:null,...Ct(g)})};class Zf extends Bt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.map)return qe(I,{code:Ve.invalid_type,expected:Ke.map,received:I.parsedType}),_t;const R=this._def.keyType,F=this._def.valueType,S=[...I.data.entries()].map(([o,de],ge)=>({key:R._parse(new Aa(I,o,I.path,[ge,"key"])),value:F._parse(new Aa(I,de,I.path,[ge,"value"]))}));if(I.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const de of S){const ge=await de.key,ze=await de.value;if(ge.status==="aborted"||ze.status==="aborted")return _t;(ge.status==="dirty"||ze.status==="dirty")&&w.dirty(),o.set(ge.value,ze.value)}return{status:w.value,value:o}})}else{const o=new Map;for(const de of S){const ge=de.key,ze=de.value;if(ge.status==="aborted"||ze.status==="aborted")return _t;(ge.status==="dirty"||ze.status==="dirty")&&w.dirty(),o.set(ge.value,ze.value)}return{status:w.value,value:o}}}}Zf.create=(v,g,w)=>new Zf({valueType:g,keyType:v,typeName:ft.ZodMap,...Ct(w)});class kl extends Bt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.parsedType!==Ke.set)return qe(I,{code:Ve.invalid_type,expected:Ke.set,received:I.parsedType}),_t;const R=this._def;R.minSize!==null&&I.data.size<R.minSize.value&&(qe(I,{code:Ve.too_small,minimum:R.minSize.value,type:"set",inclusive:!0,exact:!1,message:R.minSize.message}),w.dirty()),R.maxSize!==null&&I.data.size>R.maxSize.value&&(qe(I,{code:Ve.too_big,maximum:R.maxSize.value,type:"set",inclusive:!0,exact:!1,message:R.maxSize.message}),w.dirty());const F=this._def.valueType;function S(de){const ge=new Set;for(const ze of de){if(ze.status==="aborted")return _t;ze.status==="dirty"&&w.dirty(),ge.add(ze.value)}return{status:w.value,value:ge}}const o=[...I.data.values()].map((de,ge)=>F._parse(new Aa(I,de,I.path,ge)));return I.common.async?Promise.all(o).then(de=>S(de)):S(o)}min(g,w){return new kl({...this._def,minSize:{value:g,message:tt.toString(w)}})}max(g,w){return new kl({...this._def,maxSize:{value:g,message:tt.toString(w)}})}size(g,w){return this.min(g,w).max(g,w)}nonempty(g){return this.min(1,g)}}kl.create=(v,g)=>new kl({valueType:v,minSize:null,maxSize:null,typeName:ft.ZodSet,...Ct(g)});class Al extends Bt{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:w}=this._processInputParams(g);if(w.parsedType!==Ke.function)return qe(w,{code:Ve.invalid_type,expected:Ke.function,received:w.parsedType}),_t;function I(o,de){return id({data:o,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,td(),Ml].filter(ge=>!!ge),issueData:{code:Ve.invalid_arguments,argumentsError:de}})}function R(o,de){return id({data:o,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,td(),Ml].filter(ge=>!!ge),issueData:{code:Ve.invalid_return_type,returnTypeError:de}})}const F={errorMap:w.common.contextualErrorMap},S=w.data;if(this._def.returns instanceof El){const o=this;return Fr(async function(...de){const ge=new cn([]),ze=await o._def.args.parseAsync(de,F).catch(le=>{throw ge.addIssue(I(de,le)),ge}),Be=await Reflect.apply(S,this,ze);return await o._def.returns._def.type.parseAsync(Be,F).catch(le=>{throw ge.addIssue(R(Be,le)),ge})})}else{const o=this;return Fr(function(...de){const ge=o._def.args.safeParse(de,F);if(!ge.success)throw new cn([I(de,ge.error)]);const ze=Reflect.apply(S,this,ge.data),Be=o._def.returns.safeParse(ze,F);if(!Be.success)throw new cn([R(ze,Be.error)]);return Be.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new Al({...this._def,args:ra.create(g).rest(mo.create())})}returns(g){return new Al({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,w,I){return new Al({args:g||ra.create([]).rest(mo.create()),returns:w||mo.create(),typeName:ft.ZodFunction,...Ct(I)})}}class Vf extends Bt{get schema(){return this._def.getter()}_parse(g){const{ctx:w}=this._processInputParams(g);return this._def.getter()._parse({data:w.data,path:w.path,parent:w})}}Vf.create=(v,g)=>new Vf({getter:v,typeName:ft.ZodLazy,...Ct(g)});class od extends Bt{_parse(g){if(g.data!==this._def.value){const w=this._getOrReturnCtx(g);return qe(w,{received:w.data,code:Ve.invalid_literal,expected:this._def.value}),_t}return{status:"valid",value:g.data}}get value(){return this._def.value}}od.create=(v,g)=>new od({value:v,typeName:ft.ZodLiteral,...Ct(g)});function Uf(v,g){return new _o({values:v,typeName:ft.ZodEnum,...Ct(g)})}class _o extends Bt{constructor(){super(...arguments),Pl.set(this,void 0)}_parse(g){if(typeof g.data!="string"){const w=this._getOrReturnCtx(g),I=this._def.values;return qe(w,{expected:Zt.joinValues(I),received:w.parsedType,code:Ve.invalid_type}),_t}if(mu(this,Pl,"f")||Rf(this,Pl,new Set(this._def.values),"f"),!mu(this,Pl,"f").has(g.data)){const w=this._getOrReturnCtx(g),I=this._def.values;return qe(w,{received:w.data,code:Ve.invalid_enum_value,options:I}),_t}return Fr(g.data)}get options(){return this._def.values}get enum(){const g={};for(const w of this._def.values)g[w]=w;return g}get Values(){const g={};for(const w of this._def.values)g[w]=w;return g}get Enum(){const g={};for(const w of this._def.values)g[w]=w;return g}extract(g,w=this._def){return _o.create(g,{...this._def,...w})}exclude(g,w=this._def){return _o.create(this.options.filter(I=>!g.includes(I)),{...this._def,...w})}}Pl=new WeakMap,_o.create=Uf;class $f extends Bt{constructor(){super(...arguments),Cl.set(this,void 0)}_parse(g){const w=Zt.getValidEnumValues(this._def.values),I=this._getOrReturnCtx(g);if(I.parsedType!==Ke.string&&I.parsedType!==Ke.number){const R=Zt.objectValues(w);return qe(I,{expected:Zt.joinValues(R),received:I.parsedType,code:Ve.invalid_type}),_t}if(mu(this,Cl,"f")||Rf(this,Cl,new Set(Zt.getValidEnumValues(this._def.values)),"f"),!mu(this,Cl,"f").has(g.data)){const R=Zt.objectValues(w);return qe(I,{received:I.data,code:Ve.invalid_enum_value,options:R}),_t}return Fr(g.data)}get enum(){return this._def.values}}Cl=new WeakMap,$f.create=(v,g)=>new $f({values:v,typeName:ft.ZodNativeEnum,...Ct(g)});class El extends Bt{unwrap(){return this._def.type}_parse(g){const{ctx:w}=this._processInputParams(g);if(w.parsedType!==Ke.promise&&w.common.async===!1)return qe(w,{code:Ve.invalid_type,expected:Ke.promise,received:w.parsedType}),_t;const I=w.parsedType===Ke.promise?w.data:Promise.resolve(w.data);return Fr(I.then(R=>this._def.type.parseAsync(R,{path:w.path,errorMap:w.common.contextualErrorMap})))}}El.create=(v,g)=>new El({type:v,typeName:ft.ZodPromise,...Ct(g)});class yo extends Bt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ft.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:w,ctx:I}=this._processInputParams(g),R=this._def.effect||null,F={addIssue:S=>{qe(I,S),S.fatal?w.abort():w.dirty()},get path(){return I.path}};if(F.addIssue=F.addIssue.bind(F),R.type==="preprocess"){const S=R.transform(I.data,F);if(I.common.async)return Promise.resolve(S).then(async o=>{if(w.value==="aborted")return _t;const de=await this._def.schema._parseAsync({data:o,path:I.path,parent:I});return de.status==="aborted"?_t:de.status==="dirty"||w.value==="dirty"?Sl(de.value):de});{if(w.value==="aborted")return _t;const o=this._def.schema._parseSync({data:S,path:I.path,parent:I});return o.status==="aborted"?_t:o.status==="dirty"||w.value==="dirty"?Sl(o.value):o}}if(R.type==="refinement"){const S=o=>{const de=R.refinement(o,F);if(I.common.async)return Promise.resolve(de);if(de instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(I.common.async===!1){const o=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});return o.status==="aborted"?_t:(o.status==="dirty"&&w.dirty(),S(o.value),{status:w.value,value:o.value})}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(o=>o.status==="aborted"?_t:(o.status==="dirty"&&w.dirty(),S(o.value).then(()=>({status:w.value,value:o.value}))))}if(R.type==="transform")if(I.common.async===!1){const S=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});if(!po(S))return S;const o=R.transform(S.value,F);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:w.value,value:o}}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(S=>po(S)?Promise.resolve(R.transform(S.value,F)).then(o=>({status:w.value,value:o})):S);Zt.assertNever(R)}}yo.create=(v,g,w)=>new yo({schema:v,typeName:ft.ZodEffects,effect:g,...Ct(w)}),yo.createWithPreprocess=(v,g,w)=>new yo({schema:g,effect:{type:"preprocess",transform:v},typeName:ft.ZodEffects,...Ct(w)});class Ra extends Bt{_parse(g){return this._getType(g)===Ke.undefined?Fr(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Ra.create=(v,g)=>new Ra({innerType:v,typeName:ft.ZodOptional,...Ct(g)});class xo extends Bt{_parse(g){return this._getType(g)===Ke.null?Fr(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}xo.create=(v,g)=>new xo({innerType:v,typeName:ft.ZodNullable,...Ct(g)});class ld extends Bt{_parse(g){const{ctx:w}=this._processInputParams(g);let I=w.data;return w.parsedType===Ke.undefined&&(I=this._def.defaultValue()),this._def.innerType._parse({data:I,path:w.path,parent:w})}removeDefault(){return this._def.innerType}}ld.create=(v,g)=>new ld({innerType:v,typeName:ft.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...Ct(g)});class cd extends Bt{_parse(g){const{ctx:w}=this._processInputParams(g),I={...w,common:{...w.common,issues:[]}},R=this._def.innerType._parse({data:I.data,path:I.path,parent:{...I}});return fu(R)?R.then(F=>({status:"valid",value:F.status==="valid"?F.value:this._def.catchValue({get error(){return new cn(I.common.issues)},input:I.data})})):{status:"valid",value:R.status==="valid"?R.value:this._def.catchValue({get error(){return new cn(I.common.issues)},input:I.data})}}removeCatch(){return this._def.innerType}}cd.create=(v,g)=>new cd({innerType:v,typeName:ft.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...Ct(g)});class Gf extends Bt{_parse(g){if(this._getType(g)!==Ke.nan){const I=this._getOrReturnCtx(g);return qe(I,{code:Ve.invalid_type,expected:Ke.nan,received:I.parsedType}),_t}return{status:"valid",value:g.data}}}Gf.create=v=>new Gf({typeName:ft.ZodNaN,...Ct(v)});class zy extends Bt{_parse(g){const{ctx:w}=this._processInputParams(g),I=w.data;return this._def.type._parse({data:I,path:w.path,parent:w})}unwrap(){return this._def.type}}class ud extends Bt{_parse(g){const{status:w,ctx:I}=this._processInputParams(g);if(I.common.async)return(async()=>{const F=await this._def.in._parseAsync({data:I.data,path:I.path,parent:I});return F.status==="aborted"?_t:F.status==="dirty"?(w.dirty(),Sl(F.value)):this._def.out._parseAsync({data:F.value,path:I.path,parent:I})})();{const R=this._def.in._parseSync({data:I.data,path:I.path,parent:I});return R.status==="aborted"?_t:R.status==="dirty"?(w.dirty(),{status:"dirty",value:R.value}):this._def.out._parseSync({data:R.value,path:I.path,parent:I})}}static create(g,w){return new ud({in:g,out:w,typeName:ft.ZodPipeline})}}class hd extends Bt{_parse(g){const w=this._def.innerType._parse(g),I=R=>(po(R)&&(R.value=Object.freeze(R.value)),R);return fu(w)?w.then(R=>I(R)):I(w)}unwrap(){return this._def.innerType}}hd.create=(v,g)=>new hd({innerType:v,typeName:ft.ZodReadonly,...Ct(g)});var ft;(function(v){v.ZodString="ZodString",v.ZodNumber="ZodNumber",v.ZodNaN="ZodNaN",v.ZodBigInt="ZodBigInt",v.ZodBoolean="ZodBoolean",v.ZodDate="ZodDate",v.ZodSymbol="ZodSymbol",v.ZodUndefined="ZodUndefined",v.ZodNull="ZodNull",v.ZodAny="ZodAny",v.ZodUnknown="ZodUnknown",v.ZodNever="ZodNever",v.ZodVoid="ZodVoid",v.ZodArray="ZodArray",v.ZodObject="ZodObject",v.ZodUnion="ZodUnion",v.ZodDiscriminatedUnion="ZodDiscriminatedUnion",v.ZodIntersection="ZodIntersection",v.ZodTuple="ZodTuple",v.ZodRecord="ZodRecord",v.ZodMap="ZodMap",v.ZodSet="ZodSet",v.ZodFunction="ZodFunction",v.ZodLazy="ZodLazy",v.ZodLiteral="ZodLiteral",v.ZodEnum="ZodEnum",v.ZodEffects="ZodEffects",v.ZodNativeEnum="ZodNativeEnum",v.ZodOptional="ZodOptional",v.ZodNullable="ZodNullable",v.ZodDefault="ZodDefault",v.ZodCatch="ZodCatch",v.ZodPromise="ZodPromise",v.ZodBranded="ZodBranded",v.ZodPipeline="ZodPipeline",v.ZodReadonly="ZodReadonly"})(ft||(ft={}));const Da=Ea.create,yr=fo.create,Ry=nd.create;mo.create,za.create;const xu=ad.create,dd=Vn.create,Or=Oi.create;_u.create,yu.create;const qf=ra.create,zl=Al.create,pd=od.create,Dy=_o.create,Ly=El.create;Ra.create,xo.create;const vu=Or({lat:yr(),lng:yr()}),By=Or({center:vu,zoom:yr()}),Fy=Or({sw:vu,ne:vu}),Hf=Or({primary:Da().max(64),background:Da().max(64),text:Da().max(64)}),Oy=Or({name:pd("dark").or(pd("light")),colors:Hf}),jy=Or({name:pd("custom"),url:Da().max(256),colors:Hf}),Ny=Oy.or(jy),Zy=Or({container:Da(),position:Or({center:Or({lat:yr(),lng:yr()}),zoom:yr()}),restriction:Or({minZoom:yr().min(Qh).max(ho).optional(),maxZoom:yr().min(Qh).max(ho).optional(),maxBounds:Fy.optional()}).optional(),style:Ny});Dy(["idle","move","click","popup_click"]);const Vy=zl().returns(xu()),Uy=zl().returns(xu()),$y=zl().args(By).returns(xu()),Gy=zl().args(vu).returns(xu()),qy={load:Vy,idle:Uy,move:$y,click:Gy},Wf=Or({id:Da(),rank:yr(),lat:yr(),lng:yr(),width:yr(),height:yr()}),Hy=qf([yr(),dd(qf([yr(),yr()]))]),Xf=zl().args(Da()).returns(Ly(Ry())),Wy=Or({data:Wf,state:Hy,callbacks:Or({body:Xf,pin:Xf.optional()})}),Xy=dd(Wy);Or({key:Da(),data:dd(Wf)});var Ky=$h('<div class="container svelte-puxsd1"><div class="map svelte-puxsd1"></div> <div class="logo svelte-puxsd1"><a href="https://arenarium.dev" target="_blank" class="svelte-puxsd1">@arenarium/maps</a></div></div>');function Kf(v,g){eu(g,!0);let w,I,R,F,S,o=er(0),de=er(0),ge=er(!1),ze=er(void 0);vf(()=>{Zy.parse(g.options),Be(),le()});function Be(){var De,Ye,Ze;R=((De=g.options.restriction)==null?void 0:De.minZoom)??Qh,F=((Ye=g.options.restriction)==null?void 0:Ye.maxZoom)??ho,S=(Ze=g.options.restriction)==null?void 0:Ze.maxBounds,w=new ed.Map({style:mt(g.options.style),center:{lat:g.options.position.center.lat,lng:g.options.position.center.lng},zoom:g.options.position.zoom,minZoom:Rt(R),maxZoom:F,maxBounds:S?[S.sw.lng,S.sw.lat,S.ne.lng,S.ne.lat]:void 0,container:I,pitchWithRotate:!1,attributionControl:{compact:!1}})}const ke=()=>w;function le(){w.on("load",Oe),w.on("move",zt),w.on("idle",fi),w.on("click",kt),w.dragRotate.disable(),w.keyboard.disable(),w.touchZoomRotate.disableRotation(),w.touchPitch.disable()}function Oe(){gi(ge,!0),jt("load",null)}function zt(){const De=w.getCenter(),Ye=w.getZoom();jt("move",{center:De,zoom:Ye});const Ze=w.getBounds();gi(ze,{sw:{lat:Ze.getSouthWest().lat,lng:Ze.getSouthWest().lng},ne:{lat:Ze.getNorthEast().lat,lng:Ze.getNorthEast().lng}},!0)}function fi(){jt("idle",null);const De=w.getBounds();gi(ze,{sw:{lat:De.getSouthWest().lat,lng:De.getSouthWest().lng},ne:{lat:De.getNorthEast().lat,lng:De.getNorthEast().lng}},!0)}function kt(De){jt("click",{lat:De.lngLat.lat,lng:De.lngLat.lng})}const Ot=new Map;function Ti(De,Ye){var bt;const Ze=qy[De];if(!Ze)throw new Error(`No schema defined for event ${De}`);if(!Ze.safeParse(Ye).success)throw new Error(`Invalid handler for event ${De}`);Ot.has(De)||Ot.set(De,new Set),(bt=Ot.get(De))==null||bt.add(Ye)}function Wt(De,Ye){const Ze=Ot.get(De);Ze&&Ze.delete(Ye)&&Ze.size===0&&Ot.delete(De)}function jt(De,Ye){const Ze=Ot.get(De);Ze&&Ze.size>0&&[...Ze].forEach(lt=>{try{lt(Ye)}catch(bt){console.error(bt)}})}function Rt(De){const Ye=Sf,Ze=Math.ceil(Math.log2(st(o)/Ye));return Math.max(De,Ze)}function xr(){const De=w.getCenter();return De?{lat:De.lat,lng:De.lng}:{lat:g.options.position.center.lat,lng:g.options.position.center.lng}}function qt(){return w.getZoom()??g.options.position.zoom}function bn(){if(!w)throw new Error("Map not loaded!");const De=w.getBounds();return{sw:{lat:De.getSouthWest().lat,lng:De.getSouthWest().lng},ne:{lat:De.getNorthEast().lat,lng:De.getNorthEast().lng}}}function Yr(De){if(!w)throw new Error("Map not loaded! Consider using the position option");w.setCenter(De)}function Ir(De){if(!w)throw new Error("Map not loaded! Consider using the position option");w.setZoom(De)}function lr(){if(!w)throw new Error("Map not loaded! Consider using the position option");w.zoomIn()}function Ei(){if(!w)throw new Error("Map not loaded! Consider using the position option.");w.zoomOut()}function _i(De){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");R=De,w.setMinZoom(Rt(De))}function un(De){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");F=De,w.setMaxZoom(De)}function yt(De){if(!w)throw new Error("Map not loaded! Consider using the restriction option.");S=De,w.setMaxBounds([De.sw.lng,De.sw.lat,De.ne.lng,De.ne.lat])}let ii=er(ps(g.options.style));Fn(()=>{st(ge)&&w.setStyle(mt(st(ii)),{diff:!0})});function mt(De){if(De.name=="custom")return De.url;switch(De.name){case"light":return ly;case"dark":return oy}}function tr(){return n_(st(ii))}function zi(De){gi(ii,De,!0),w.setStyle(mt(st(ii)),{diff:!0})}class Jr{constructor(Ye){Vt(this,"id");Vt(this,"lat");Vt(this,"lng");Vt(this,"zoom");Vt(this,"element");Vt(this,"component");Vt(this,"libreMarker");this.id=Ye.data.id,this.lat=Ye.data.lat,this.lng=Ye.data.lng,this.zoom=Ye.state[0],this.element=void 0,this.component=void 0,this.libreMarker=void 0}createLibreMarker(){const Ye=this.element;if(!Ye)throw new Error("Failed to create libre marker");const Ze=new ed.Marker({element:Ye});Ze.setLngLat([this.lng,this.lat]),this.libreMarker=Ze}updateMap(Ye){const Ze=this.libreMarker,lt=this.component;if(Ze==null||lt==null)throw new Error("Failed to update popup map");Ye?Ze._map!=Ye&&Ze.addTo(Ye):Ze._map!=null&&Ze.remove()}isCreated(){return this.element!=null}isInBlock(Ye,Ze){return this.zoom<=Ye&&Ze.contains(this.lat,this.lng)}}class cr extends Jr{constructor(Ze){super(Ze);Vt(this,"pinLoading",!1);Vt(this,"pinLoaded",!1);Vt(this,"pinCallback");this.pinCallback=Ze.callbacks.pin}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=qh(iy,{target:this.element,props:{id:this.id+"_circle",priority:this.zoom}}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ze=this.element;if(!Ze)return;const lt=Math.round((ho-this.zoom)*Pf);Ze.style.zIndex=lt.toString()}updateMap(Ze){var lt;super.updateMap(Ze),(lt=this.component)==null||lt.setDisplayed(Ze!=null)}updateState(Ze){const lt=this.component;if(!lt)throw new Error("Failed to update circle state");lt.setScale(this.getScale(Ze))}updatePin(){var lt;if(this.pinCallback==null||this.pinLoaded||this.pinLoading)return;const Ze=(lt=this.component)==null?void 0:lt.getBody();Ze!=null&&(this.pinLoading=!0,this.pinCallback(this.id).then(bt=>{Ze.appendChild(bt),this.pinLoaded=!0,this.pinLoading=!1}))}setExpanded(Ze){if(this.component==null)throw new Error("Failed to set circle expanded");this.component.setScale(this.getScale(Ze))}setCollapsed(){if(this.component==null)throw new Error("Failed to set circle collapsed");this.component.setScale(0)}getScale(Ze){return Math.max(0,1-(this.zoom-Ze)*.125)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isPinLoaded(){return this.pinCallback==null||this.pinLoaded}}class Un extends Jr{constructor(Ze){super(Ze);Vt(this,"width");Vt(this,"height");Vt(this,"states");Vt(this,"bodyLoading",!1);Vt(this,"bodyLoaded",!1);Vt(this,"bodyCallback");this.id=Ze.data.id,this.states=Ze.state[1],this.width=Ze.data.width,this.height=Ze.data.height,this.bodyCallback=Ze.callbacks.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=qh(ey,{target:this.element,props:{id:this.id+"_marker",priority:this.zoom+ho,width:this.width,height:this.height}}),this.createLibreMarker(),this.updateZIndex()}updateZIndex(){const Ze=this.element;if(!Ze)return;const lt=Math.round((ho-this.zoom)*Pf)+1e6;Ze.style.zIndex=lt.toString()}updateMap(Ze){var lt;super.updateMap(Ze),(lt=this.component)==null||lt.setDisplayed(Ze!=null)}updateState(Ze){const lt=this.component;if(!lt)throw new Error("Failed to update marker state");lt.setAngle(this.getAngle(Ze))}updateBody(){var lt;if(this.bodyLoaded||this.bodyLoading)return;const Ze=(lt=this.component)==null?void 0:lt.getBody();Ze!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(bt=>{Ze.appendChild(bt),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(Ze){const lt=this.states.findLast(bt=>bt[0]<=Ze);if(!lt)throw new Error("Angle not found");return lt[1]}setCollapsed(Ze){if(this.component==null)throw new Error("Failed to set marker collapsed");this.component.setCollapsed(Ze)}isExpanded(){return this.component?this.component.getExpanded():!1}isCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class qi{constructor(Ye){Vt(this,"id");Vt(this,"rank");Vt(this,"lat");Vt(this,"lng");Vt(this,"zoom");Vt(this,"circle");Vt(this,"marker");this.id=Ye.data.id,this.rank=Ye.data.rank,this.lat=Ye.data.lat,this.lng=Ye.data.lng,this.zoom=Ye.state[0],this.circle=new cr(Ye),this.marker=new Un(Ye)}}let Mi,yi=new Array,xi=new Map,jr=!1,hn=Sf,$n=Up(()=>st(ze)?new kf(w,-512,st(de)+hn,st(o)+hn,-512):void 0),ir=Up(()=>st(ze)?new kf(w,0,st(de),st(o),0):void 0);vf(()=>{const De=()=>{ur(),Mi=window.setTimeout(De,25)};return De(),()=>clearInterval(Mi)});function ur(){if(st(ge)==!1||st(ir)==null||st($n)==null||yi.length==0||jr)return;const De=w.getZoom();if(!De)return;const Ye=De+K_/Math.max(1,Math.log2(yi.length/Y_)),Ze=De;for(const lt of yi){const bt=lt.circle;st(ir).contains(bt.lat,bt.lng)?De<=bt.zoom&&bt.zoom<=Ye?(bt.isCreated()==!1&&bt.createElement(),bt.updateMap(w),bt.updateState(De),bt.isPinLoaded()==!1&&bt.updatePin()):bt.isCreated()==!0&&(bt.setCollapsed(),bt.isCollapsed()&&bt.updateMap(null)):bt.isCreated()==!0&&bt.updateMap(null);const gt=lt.marker;st($n).contains(gt.lat,gt.lng)?gt.zoom<=Ze?(gt.isCreated()==!1&&gt.createElement(),gt.updateMap(w),gt.updateState(De),gt.setCollapsed(!1),gt.isExpanded()&&gt.isBodyLoaded()==!1&&gt.updateBody()):gt.isCreated()==!0&&(gt.setCollapsed(!0),gt.isCollapsed()&&gt.updateMap(null)):gt.isCreated()==!0&&gt.updateMap(null)}}async function Hi(De){var Ye,Ze;try{jr=!0;const lt=new Map(De.map(gt=>[gt.data.id,new qi(gt)])),bt=Array.from(yi);for(const gt of bt)lt.has(gt.id)==!1&&((Ye=gt.circle.libreMarker)==null||Ye.remove(),(Ze=gt.marker.libreMarker)==null||Ze.remove(),xi.delete(gt.id),yi.splice(yi.indexOf(gt),1));for(const gt of De){const hr=xi.get(gt.data.id);if(hr)hr.circle.zoom=gt.state[0],hr.circle.updateZIndex(),hr.marker.zoom=gt.state[0],hr.marker.states=gt.state[1],hr.marker.updateZIndex();else{const Mn=new qi(gt);xi.set(gt.data.id,Mn),yi.push(Mn)}}yi.sort((gt,hr)=>gt.zoom-hr.zoom)}catch(lt){throw console.error(lt),yi.length=0,xi.clear(),lt}finally{jr=!1}}function Ut(){var De,Ye;try{jr=!0;for(const Ze of yi)(De=Ze.circle.libreMarker)==null||De.remove(),(Ye=Ze.marker.libreMarker)==null||Ye.remove();yi.length=0,xi.clear()}catch(Ze){throw console.error(Ze),yi.length=0,xi.clear(),Ze}finally{jr=!1}}async function Nr(De){if(!(await Xy.safeParseAsync(De)).success)throw new Error("Invalid popups");await Hi(De)}function dn(){Ut()}function vr(De){const Ye=xi.get(De);Ye!=null&&w.flyTo({center:{lat:Ye.lat,lng:Ye.lng},zoom:Ye.zoom})}var wn=Ky();D_("resize",Oh,()=>w.setMinZoom(Rt(R)));var Tn=iu(wn);return gs(Tn,De=>I=De,()=>I),jh(()=>Kh(wn,`--map-style-primary: ${st(ii).colors.primary??""}; --map-style-background: ${st(ii).colors.background??""}; --map-style-text: ${st(ii).colors.text??""};`)),du(Tn,"clientWidth",De=>gi(o,De)),du(Tn,"clientHeight",De=>gi(de,De)),Gh(v,wn),tu({maplibre:ke,on:Ti,off:Wt,emit:jt,getCenter:xr,getZoom:qt,getBounds:bn,setCenter:Yr,setZoom:Ir,zoomIn:lr,zoomOut:Ei,setMinZoom:_i,setMaxZoom:un,setMaxBounds:yt,getStyle:tr,setStyle:zi,updatePopups:Nr,removePopups:dn,revealPopup:vr})}function Yy(v){const g=document.getElementById(v.container);if(!g)throw new Error(`Container not found: ${v.container}`);return qh(Kf,{target:g,props:{options:v}})}function Jy(v){O_(v)}Nt.Map=Kf,Nt.mountMap=Yy,Nt.unmountMap=Jy,Object.defineProperty(Nt,Symbol.toStringTag,{value:"Module"})});