@arenarium/maps 1.0.52 → 1.0.53

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 +5 -5
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
- (function($t,ai){typeof exports=="object"&&typeof module<"u"?ai(exports):typeof define=="function"&&define.amd?define(["exports"],ai):($t=typeof globalThis<"u"?globalThis:$t||self,ai($t.arenarium={}))})(this,function($t){"use strict";var B0=Object.defineProperty;var Jg=$t=>{throw TypeError($t)};var F0=($t,ai,zi)=>ai in $t?B0($t,ai,{enumerable:!0,configurable:!0,writable:!0,value:zi}):$t[ai]=zi;var fs=($t,ai,zi)=>F0($t,typeof ai!="symbol"?ai+"":ai,zi),Jp=($t,ai,zi)=>ai.has($t)||Jg("Cannot "+zi);var Lt=($t,ai,zi)=>(Jp($t,ai,"read from private field"),zi?zi.call($t):ai.get($t)),Cr=($t,ai,zi)=>ai.has($t)?Jg("Cannot add the same private member more than once"):ai instanceof WeakSet?ai.add($t):ai.set($t,zi),fu=($t,ai,zi,mu)=>(Jp($t,ai,"write to private field"),mu?mu.call($t,zi):ai.set($t,zi),zi),Qg=($t,ai,zi)=>(Jp($t,ai,"access private method"),zi);var Va,vo,ql,Yu,e_,mm,ma,bo,Hl,bs;var zi=Array.isArray,mu=Array.prototype.indexOf,dd=Array.from,i_=Object.defineProperty,wl=Object.getOwnPropertyDescriptor,Qp=Object.prototype,r_=Array.prototype,ef=Object.getPrototypeOf,tf=Object.isExtensible;const n_=()=>{};function rf(y){for(var m=0;m<y.length;m++)y[m]()}const bn=2,nf=4,gu=8,pd=16,oa=32,ao=64,_u=128,qr=256,yu=512,jr=1024,la=2048,ms=4096,ca=8192,xu=16384,a_=32768,vu=65536,s_=1<<19,af=1<<20,fd=1<<21,bu=Symbol("$state");function sf(y){return y===this.v}function o_(y,m){return y!=y?m==m:y!==m||y!==null&&typeof y=="object"||typeof y=="function"}function of(y){return!o_(y,this.v)}function l_(y){throw new Error("https://svelte.dev/e/effect_in_teardown")}function c_(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function u_(y){throw new Error("https://svelte.dev/e/effect_orphan")}function h_(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function d_(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function p_(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function f_(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let O0=!1;const m_=1,g_=2,__=16,y_=1,x_=2,Nr=Symbol(),v_=[];function b_(y,m=!1){return wu(y,new Map,"",v_)}function wu(y,m,b,I,z=null){if(typeof y=="object"&&y!==null){var R=m.get(y);if(R!==void 0)return R;if(y instanceof Map)return new Map(y);if(y instanceof Set)return new Set(y);if(zi(y)){var S=Array(y.length);m.set(y,S),z!==null&&m.set(z,S);for(var o=0;o<y.length;o+=1){var le=y[o];o in y&&(S[o]=wu(le,m,b,I))}return S}if(ef(y)===Qp){S={},m.set(y,S),z!==null&&m.set(z,S);for(var he in y)S[he]=wu(y[he],m,b,I);return S}if(y instanceof Date)return structuredClone(y);if(typeof y.toJSON=="function")return wu(y.toJSON(),m,b,I,y)}if(y instanceof EventTarget)return y;try{return structuredClone(y)}catch{return y}}function w_(y){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let Zr=null;function lf(y){Zr=y}function Tu(y,m=!1,b){var I=Zr={p:Zr,c:null,d:!1,e:null,m:!1,s:y,x:null,l:null};xf(()=>{I.d=!0})}function Mu(y){const m=Zr;if(m!==null){y!==void 0&&(m.x=y);const S=m.e;if(S!==null){var b=pi,I=oi;m.e=null;try{for(var z=0;z<S.length;z++){var R=S[z];Da(R.effect),Vn(R.reaction),Iu(R.fn)}}finally{Da(b),Vn(I)}}Zr=m.p,m.m=!0}return y||{}}function cf(){return!0}function ua(y){if(typeof y!="object"||y===null||bu in y)return y;const m=ef(y);if(m!==Qp&&m!==r_)return y;var b=new Map,I=zi(y),z=Ci(0),R=oi,S=o=>{var le=oi;Vn(R);var he=o();return Vn(le),he};return I&&b.set("length",Ci(y.length)),new Proxy(y,{defineProperty(o,le,he){(!("value"in he)||he.configurable===!1||he.enumerable===!1||he.writable===!1)&&d_();var _e=b.get(le);return _e===void 0?(_e=S(()=>Ci(he.value)),b.set(le,_e)):si(_e,S(()=>ua(he.value))),!0},deleteProperty(o,le){var he=b.get(le);if(he===void 0)le in o&&(b.set(le,S(()=>Ci(Nr))),md(z));else{if(I&&typeof le=="string"){var _e=b.get("length"),Re=Number(le);Number.isInteger(Re)&&Re<_e.v&&si(_e,Re)}si(he,Nr),md(z)}return!0},get(o,le,he){var ne;if(le===bu)return y;var _e=b.get(le),Re=le in o;if(_e===void 0&&(!Re||(ne=wl(o,le))!=null&&ne.writable)&&(_e=S(()=>Ci(ua(Re?o[le]:Nr))),b.set(le,_e)),_e!==void 0){var ve=Qe(_e);return ve===Nr?void 0:ve}return Reflect.get(o,le,he)},getOwnPropertyDescriptor(o,le){var he=Reflect.getOwnPropertyDescriptor(o,le);if(he&&"value"in he){var _e=b.get(le);_e&&(he.value=Qe(_e))}else if(he===void 0){var Re=b.get(le),ve=Re==null?void 0:Re.v;if(Re!==void 0&&ve!==Nr)return{enumerable:!0,configurable:!0,value:ve,writable:!0}}return he},has(o,le){var ve;if(le===bu)return!0;var he=b.get(le),_e=he!==void 0&&he.v!==Nr||Reflect.has(o,le);if(he!==void 0||pi!==null&&(!_e||(ve=wl(o,le))!=null&&ve.writable)){he===void 0&&(he=S(()=>Ci(_e?ua(o[le]):Nr)),b.set(le,he));var Re=Qe(he);if(Re===Nr)return!1}return _e},set(o,le,he,_e){var Dt;var Re=b.get(le),ve=le in o;if(I&&le==="length")for(var ne=he;ne<Re.v;ne+=1){var De=b.get(ne+"");De!==void 0?si(De,Nr):ne in o&&(De=S(()=>Ci(Nr)),b.set(ne+"",De))}Re===void 0?(!ve||(Dt=wl(o,le))!=null&&Dt.writable)&&(Re=S(()=>Ci(void 0)),si(Re,S(()=>ua(he))),b.set(le,Re)):(ve=Re.v!==Nr,si(Re,S(()=>ua(he))));var _t=Reflect.getOwnPropertyDescriptor(o,le);if(_t!=null&&_t.set&&_t.set.call(_e,he),!ve){if(I&&typeof le=="string"){var Rt=b.get("length"),yt=Number(le);Number.isInteger(yt)&&yt>=Rt.v&&si(Rt,yt+1)}md(z)}return!0},ownKeys(o){Qe(z);var le=Reflect.ownKeys(o).filter(Re=>{var ve=b.get(Re);return ve===void 0||ve.v!==Nr});for(var[he,_e]of b)_e.v!==Nr&&!(he in o)&&le.push(he);return le},setPrototypeOf(){p_()}})}function md(y,m=1){si(y,y.v+m)}function gd(y){var m=bn|la,b=oi!==null&&(oi.f&bn)!==0?oi:null;return pi===null||b!==null&&(b.f&qr)!==0?m|=qr:pi.f|=af,{ctx:Zr,deps:null,effects:null,equals:sf,f:m,fn:y,reactions:null,rv:0,v:null,wv:0,parent:b??pi}}function Su(y){const m=gd(y);return kf(m),m}function T_(y){const m=gd(y);return m.equals=of,m}function uf(y){var m=y.effects;if(m!==null){y.effects=null;for(var b=0;b<m.length;b+=1)ha(m[b])}}function M_(y){for(var m=y.parent;m!==null;){if((m.f&bn)===0)return m;m=m.parent}return null}function hf(y){var m,b=pi;Da(M_(y));try{uf(y),m=Lf(y)}finally{Da(b)}return m}function df(y){var m=hf(y),b=(La||(y.f&qr)!==0)&&y.deps!==null?ms:jr;wn(y,b),y.equals(m)||(y.v=m,y.wv=Af())}const Tl=new Map;function so(y,m){var b={f:0,v:y,reactions:null,equals:sf,rv:0,wv:0};return b}function Ci(y,m){const b=so(y);return kf(b),b}function S_(y,m=!1){const b=so(y);return m||(b.equals=of),b}function si(y,m,b=!1){oi!==null&&!Zn&&cf()&&(oi.f&(bn|pd))!==0&&!(Ir!=null&&Ir.includes(y))&&f_();let I=b?ua(m):m;return pf(y,I)}function pf(y,m){if(!y.equals(m)){var b=y.v;Pl?Tl.set(y,m):Tl.set(y,b),y.v=m,(y.f&bn)!==0&&((y.f&la)!==0&&hf(y),wn(y,(y.f&qr)===0?jr:ms)),y.wv=Af(),ff(y,la),pi!==null&&(pi.f&jr)!==0&&(pi.f&(oa|ao))===0&&(ln===null?B_([y]):ln.push(y))}return m}function ff(y,m){var b=y.reactions;if(b!==null)for(var I=b.length,z=0;z<I;z++){var R=b[z],S=R.f;(S&la)===0&&(wn(R,m),(S&(jr|qr))!==0&&((S&bn)!==0?ff(R,ms):ju(R)))}}let P_=!1;var _d,mf,gf,_f;function C_(){if(_d===void 0){_d=window,mf=/Firefox/.test(navigator.userAgent);var y=Element.prototype,m=Node.prototype,b=Text.prototype;gf=wl(m,"firstChild").get,_f=wl(m,"nextSibling").get,tf(y)&&(y.__click=void 0,y.__className=void 0,y.__attributes=null,y.__style=void 0,y.__e=void 0),tf(b)&&(b.__t=void 0)}}function yf(y=""){return document.createTextNode(y)}function Pu(y){return gf.call(y)}function Cu(y){return _f.call(y)}function Ml(y,m){return Pu(y)}function I_(y,m){{var b=Pu(y);return b instanceof Comment&&b.data===""?Cu(b):b}}function yd(y,m=1,b=!1){let I=y;for(;m--;)I=Cu(I);return I}function E_(y){y.textContent=""}function k_(y){pi===null&&oi===null&&u_(),oi!==null&&(oi.f&qr)!==0&&pi===null&&c_(),Pl&&l_()}function z_(y,m){var b=m.last;b===null?m.last=m.first=y:(b.next=y,y.prev=b,m.last=y)}function oo(y,m,b,I=!0){var z=pi,R={ctx:Zr,deps:null,nodes_start:null,nodes_end:null,f:y|la,first:null,fn:m,last:null,next:null,parent:z,prev:null,teardown:null,transitions:null,wv:0};if(b)try{bd(R),R.f|=a_}catch(le){throw ha(R),le}else m!==null&&ju(R);var S=b&&R.deps===null&&R.first===null&&R.nodes_start===null&&R.teardown===null&&(R.f&(af|_u))===0;if(!S&&I&&(z!==null&&z_(R,z),oi!==null&&(oi.f&bn)!==0)){var o=oi;(o.effects??(o.effects=[])).push(R)}return R}function xf(y){const m=oo(gu,null,!1);return wn(m,jr),m.teardown=y,m}function lo(y){k_();var m=pi!==null&&(pi.f&oa)!==0&&Zr!==null&&!Zr.m;if(m){var b=Zr;(b.e??(b.e=[])).push({fn:y,effect:pi,reaction:oi})}else{var I=Iu(y);return I}}function A_(y){const m=oo(ao,y,!0);return(b={})=>new Promise(I=>{b.outro?zu(m,()=>{ha(m),I(void 0)}):(ha(m),I(void 0))})}function Iu(y){return oo(nf,y,!1)}function vf(y){return oo(gu,y,!0)}function Eu(y,m=[],b=gd){const I=m.map(b);return ku(()=>y(...I.map(Qe)))}function ku(y,m=0){return oo(gu|pd|m,y,!0)}function co(y,m=!0){return oo(gu|oa,y,!0,m)}function bf(y){var m=y.teardown;if(m!==null){const b=Pl,I=oi;Ef(!0),Vn(null);try{m.call(null)}finally{Ef(b),Vn(I)}}}function wf(y,m=!1){var b=y.first;for(y.first=y.last=null;b!==null;){var I=b.next;(b.f&ao)!==0?b.parent=null:ha(b,m),b=I}}function R_(y){for(var m=y.first;m!==null;){var b=m.next;(m.f&oa)===0&&ha(m),m=b}}function ha(y,m=!0){var b=!1;(m||(y.f&s_)!==0)&&y.nodes_start!==null&&(D_(y.nodes_start,y.nodes_end),b=!0),wf(y,m&&!b),Ou(y,0),wn(y,xu);var I=y.transitions;if(I!==null)for(const R of I)R.stop();bf(y);var z=y.parent;z!==null&&z.first!==null&&Tf(y),y.next=y.prev=y.teardown=y.ctx=y.deps=y.fn=y.nodes_start=y.nodes_end=null}function D_(y,m){for(;y!==null;){var b=y===m?null:Cu(y);y.remove(),y=b}}function Tf(y){var m=y.parent,b=y.prev,I=y.next;b!==null&&(b.next=I),I!==null&&(I.prev=b),m!==null&&(m.first===y&&(m.first=I),m.last===y&&(m.last=b))}function zu(y,m){var b=[];xd(y,b,!0),Mf(b,()=>{ha(y),m&&m()})}function Mf(y,m){var b=y.length;if(b>0){var I=()=>--b||m();for(var z of y)z.out(I)}else m()}function xd(y,m,b){if((y.f&ca)===0){if(y.f^=ca,y.transitions!==null)for(const S of y.transitions)(S.is_global||b)&&m.push(S);for(var I=y.first;I!==null;){var z=I.next,R=(I.f&vu)!==0||(I.f&oa)!==0;xd(I,m,R?b:!1),I=z}}}function Au(y){Sf(y,!0)}function Sf(y,m){if((y.f&ca)!==0){y.f^=ca,(y.f&jr)===0&&(y.f^=jr),Il(y)&&(wn(y,la),ju(y));for(var b=y.first;b!==null;){var I=b.next,z=(b.f&vu)!==0||(b.f&oa)!==0;Sf(b,z?m:!1),b=I}if(y.transitions!==null)for(const R of y.transitions)(R.is_global||m)&&R.in()}}let Sl=[],vd=[];function Pf(){var y=Sl;Sl=[],rf(y)}function L_(){var y=vd;vd=[],rf(y)}function Cf(y){Sl.length===0&&queueMicrotask(Pf),Sl.push(y)}function If(){Sl.length>0&&Pf(),vd.length>0&&L_()}let Ru=!1,Du=!1,Lu=null,gs=!1,Pl=!1;function Ef(y){Pl=y}let Cl=[],j0=[],oi=null,Zn=!1;function Vn(y){oi=y}let pi=null;function Da(y){pi=y}let Ir=null;function kf(y){oi!==null&&oi.f&fd&&(Ir===null?Ir=[y]:Ir.push(y))}let Er=null,Hr=0,ln=null;function B_(y){ln=y}let zf=1,Bu=0,La=!1;function Af(){return++zf}function Il(y){var Re;var m=y.f;if((m&la)!==0)return!0;if((m&ms)!==0){var b=y.deps,I=(m&qr)!==0;if(b!==null){var z,R,S=(m&yu)!==0,o=I&&pi!==null&&!La,le=b.length;if(S||o){var he=y,_e=he.parent;for(z=0;z<le;z++)R=b[z],(S||!((Re=R==null?void 0:R.reactions)!=null&&Re.includes(he)))&&(R.reactions??(R.reactions=[])).push(he);S&&(he.f^=yu),o&&_e!==null&&(_e.f&qr)===0&&(he.f^=qr)}for(z=0;z<le;z++)if(R=b[z],Il(R)&&df(R),R.wv>y.wv)return!0}(!I||pi!==null&&!La)&&wn(y,jr)}return!1}function F_(y,m){for(var b=m;b!==null;){if((b.f&_u)!==0)try{b.fn(y);return}catch{b.f^=_u}b=b.parent}throw Ru=!1,y}function Rf(y){return(y.f&xu)===0&&(y.parent===null||(y.parent.f&_u)===0)}function Fu(y,m,b,I){if(Ru){if(b===null&&(Ru=!1),Rf(m))throw y;return}if(b!==null&&(Ru=!0),F_(y,m),Rf(m))throw y}function Df(y,m,b=!0){var I=y.reactions;if(I!==null)for(var z=0;z<I.length;z++){var R=I[z];Ir!=null&&Ir.includes(y)||((R.f&bn)!==0?Df(R,m,!1):m===R&&(b?wn(R,la):(R.f&jr)!==0&&wn(R,ms),ju(R)))}}function Lf(y){var ne;var m=Er,b=Hr,I=ln,z=oi,R=La,S=Ir,o=Zr,le=Zn,he=y.f;Er=null,Hr=0,ln=null,La=(he&qr)!==0&&(Zn||!gs||oi===null),oi=(he&(oa|ao))===0?y:null,Ir=null,lf(y.ctx),Zn=!1,Bu++,y.f|=fd;try{var _e=(0,y.fn)(),Re=y.deps;if(Er!==null){var ve;if(Ou(y,Hr),Re!==null&&Hr>0)for(Re.length=Hr+Er.length,ve=0;ve<Er.length;ve++)Re[Hr+ve]=Er[ve];else y.deps=Re=Er;if(!La)for(ve=Hr;ve<Re.length;ve++)((ne=Re[ve]).reactions??(ne.reactions=[])).push(y)}else Re!==null&&Hr<Re.length&&(Ou(y,Hr),Re.length=Hr);if(cf()&&ln!==null&&!Zn&&Re!==null&&(y.f&(bn|ms|la))===0)for(ve=0;ve<ln.length;ve++)Df(ln[ve],y);return z!==null&&z!==y&&(Bu++,ln!==null&&(I===null?I=ln:I.push(...ln))),_e}finally{Er=m,Hr=b,ln=I,oi=z,La=R,Ir=S,lf(o),Zn=le,y.f^=fd}}function O_(y,m){let b=m.reactions;if(b!==null){var I=mu.call(b,y);if(I!==-1){var z=b.length-1;z===0?b=m.reactions=null:(b[I]=b[z],b.pop())}}b===null&&(m.f&bn)!==0&&(Er===null||!Er.includes(m))&&(wn(m,ms),(m.f&(qr|yu))===0&&(m.f^=yu),uf(m),Ou(m,0))}function Ou(y,m){var b=y.deps;if(b!==null)for(var I=m;I<b.length;I++)O_(y,b[I])}function bd(y){var m=y.f;if((m&xu)===0){wn(y,jr);var b=pi,I=Zr,z=gs;pi=y,gs=!0;try{(m&pd)!==0?R_(y):wf(y),bf(y);var R=Lf(y);y.teardown=typeof R=="function"?R:null,y.wv=zf;var S=y.deps,o}catch(le){Fu(le,y,b,I||y.ctx)}finally{gs=z,pi=b}}}function j_(){try{h_()}catch(y){if(Lu!==null)Fu(y,Lu,null);else throw y}}function Bf(){var y=gs;try{var m=0;for(gs=!0;Cl.length>0;){m++>1e3&&j_();var b=Cl,I=b.length;Cl=[];for(var z=0;z<I;z++){var R=Z_(b[z]);N_(R)}Tl.clear()}}finally{Du=!1,gs=y,Lu=null}}function N_(y){var m=y.length;if(m!==0)for(var b=0;b<m;b++){var I=y[b];if((I.f&(xu|ca))===0)try{Il(I)&&(bd(I),I.deps===null&&I.first===null&&I.nodes_start===null&&(I.teardown===null?Tf(I):I.fn=null))}catch(z){Fu(z,I,null,I.ctx)}}}function ju(y){Du||(Du=!0,queueMicrotask(Bf));for(var m=Lu=y;m.parent!==null;){m=m.parent;var b=m.f;if((b&(ao|oa))!==0){if((b&jr)===0)return;m.f^=jr}}Cl.push(m)}function Z_(y){for(var m=[],b=y;b!==null;){var I=b.f,z=(I&(oa|ao))!==0,R=z&&(I&jr)!==0;if(!R&&(I&ca)===0){if((I&nf)!==0)m.push(b);else if(z)b.f^=jr;else try{Il(b)&&bd(b)}catch(le){Fu(le,b,null,b.ctx)}var S=b.first;if(S!==null){b=S;continue}}var o=b.parent;for(b=b.next;b===null&&o!==null;)b=o.next,o=o.parent}return m}function V_(y){var m;for(If();Cl.length>0;)Du=!0,Bf(),If();return m}async function U_(){await Promise.resolve(),V_()}function Qe(y){var m=y.f,b=(m&bn)!==0;if(oi!==null&&!Zn){if(!(Ir!=null&&Ir.includes(y))){var I=oi.deps;y.rv<Bu&&(y.rv=Bu,Er===null&&I!==null&&I[Hr]===y?Hr++:Er===null?Er=[y]:(!La||!Er.includes(y))&&Er.push(y))}}else if(b&&y.deps===null&&y.effects===null){var z=y,R=z.parent;R!==null&&(R.f&qr)===0&&(z.f^=qr)}return b&&(z=y,Il(z)&&df(z)),Pl&&Tl.has(y)?Tl.get(y):y.v}function wd(y){var m=Zn;try{return Zn=!0,y()}finally{Zn=m}}const $_=-7169;function wn(y,m){y.f=y.f&$_|m}const G_=["touchstart","touchmove"];function q_(y){return G_.includes(y)}function H_(y){var m=oi,b=pi;Vn(null),Da(null);try{return y()}finally{Vn(m),Da(b)}}const Ff=new Set,Td=new Set;function W_(y,m,b,I={}){function z(R){if(I.capture||El.call(m,R),!R.cancelBubble)return H_(()=>b==null?void 0:b.call(this,R))}return y.startsWith("pointer")||y.startsWith("touch")||y==="wheel"?Cf(()=>{m.addEventListener(y,z,I)}):m.addEventListener(y,z,I),z}function X_(y,m,b,I,z){var R={capture:I,passive:z},S=W_(y,m,b,R);(m===document.body||m===window||m===document)&&xf(()=>{m.removeEventListener(y,S,R)})}function K_(y){for(var m=0;m<y.length;m++)Ff.add(y[m]);for(var b of Td)b(y)}function El(y){var Dt;var m=this,b=m.ownerDocument,I=y.type,z=((Dt=y.composedPath)==null?void 0:Dt.call(y))||[],R=z[0]||y.target,S=0,o=y.__root;if(o){var le=z.indexOf(o);if(le!==-1&&(m===document||m===window)){y.__root=m;return}var he=z.indexOf(m);if(he===-1)return;le<=he&&(S=le)}if(R=z[S]||y.target,R!==m){i_(y,"currentTarget",{configurable:!0,get(){return R||b}});var _e=oi,Re=pi;Vn(null),Da(null);try{for(var ve,ne=[];R!==null;){var De=R.assignedSlot||R.parentNode||R.host||null;try{var _t=R["__"+I];if(_t!=null&&(!R.disabled||y.target===R))if(zi(_t)){var[Rt,...yt]=_t;Rt.apply(R,[y,...yt])}else _t.call(R,y)}catch(Jt){ve?ne.push(Jt):ve=Jt}if(y.cancelBubble||De===m||De===null)break;R=De}if(ve){for(let Jt of ne)queueMicrotask(()=>{throw Jt});throw ve}}finally{y.__root=m,delete y.currentTarget,Vn(_e),Da(Re)}}}function Y_(y){var m=document.createElement("template");return m.innerHTML=y,m.content}function Of(y,m){var b=pi;b.nodes_start===null&&(b.nodes_start=y,b.nodes_end=m)}function uo(y,m){var b=(m&y_)!==0,I=(m&x_)!==0,z,R=!y.startsWith("<!>");return()=>{z===void 0&&(z=Y_(R?y:"<!>"+y),b||(z=Pu(z)));var S=I||mf?document.importNode(z,!0):z.cloneNode(!0);if(b){var o=Pu(S),le=S.lastChild;Of(o,le)}else Of(S,S);return S}}function ho(y,m){y!==null&&y.before(m)}function J_(y,m){return Q_(y,m)}const po=new Map;function Q_(y,{target:m,anchor:b,props:I={},events:z,context:R,intro:S=!0}){C_();var o=new Set,le=Re=>{for(var ve=0;ve<Re.length;ve++){var ne=Re[ve];if(!o.has(ne)){o.add(ne);var De=q_(ne);m.addEventListener(ne,El,{passive:De});var _t=po.get(ne);_t===void 0?(document.addEventListener(ne,El,{passive:De}),po.set(ne,1)):po.set(ne,_t+1)}}};le(dd(Ff)),Td.add(le);var he=void 0,_e=A_(()=>{var Re=b??m.appendChild(yf());return co(()=>{if(R){Tu({});var ve=Zr;ve.c=R}z&&(I.$$events=z),he=y(Re,I)||{},R&&Mu()}),()=>{var De;for(var ve of o){m.removeEventListener(ve,El);var ne=po.get(ve);--ne===0?(document.removeEventListener(ve,El),po.delete(ve)):po.set(ve,ne)}Td.delete(le),Re!==b&&((De=Re.parentNode)==null||De.removeChild(Re))}});return Md.set(he,_e),he}let Md=new WeakMap;function ey(y,m){const b=Md.get(y);return b?(Md.delete(y),b(m)):Promise.resolve()}function ty(y,m,[b,I]=[0,0]){var z=y,R=null,S=null,o=Nr,le=b>0?vu:0,he=!1;const _e=(ve,ne=!0)=>{he=!0,Re(ne,ve)},Re=(ve,ne)=>{o!==(o=ve)&&(o?(R?Au(R):ne&&(R=co(()=>ne(z))),S&&zu(S,()=>{S=null})):(S?Au(S):ne&&(S=co(()=>ne(z,[b+1,I]))),R&&zu(R,()=>{R=null})))};ku(()=>{he=!1,m(_e),he||Re(null,null)},le)}function iy(y,m,b,I){for(var z=[],R=m.length,S=0;S<R;S++)xd(m[S].e,z,!0);var o=R>0&&z.length===0&&b!==null;if(o){var le=b.parentNode;E_(le),le.append(b),I.clear(),Ba(y,m[0].prev,m[R-1].next)}Mf(z,()=>{for(var he=0;he<R;he++){var _e=m[he];o||(I.delete(_e.k),Ba(y,_e.prev,_e.next)),ha(_e.e,!o)}})}function ry(y,m,b,I,z,R=null){var S=y,o={flags:m,items:new Map,first:null};{var le=y;S=le.appendChild(yf())}var he=null,_e=!1,Re=T_(()=>{var ve=b();return zi(ve)?ve:ve==null?[]:dd(ve)});ku(()=>{var ve=Qe(Re),ne=ve.length;_e&&ne===0||(_e=ne===0,ny(ve,o,S,z,m,I,b),R!==null&&(ne===0?he?Au(he):he=co(()=>R(S)):he!==null&&zu(he,()=>{he=null})),Qe(Re))})}function ny(y,m,b,I,z,R,S){var o=y.length,le=m.items,he=m.first,_e=he,Re,ve=null,ne=[],De=[],_t,Rt,yt,Dt;for(Dt=0;Dt<o;Dt+=1){if(_t=y[Dt],Rt=R(_t,Dt),yt=le.get(Rt),yt===void 0){var Jt=_e?_e.e.nodes_start:b;ve=sy(Jt,m,ve,ve===null?m.first:ve.next,_t,Rt,Dt,I,z,S),le.set(Rt,ve),ne=[],De=[],_e=ve.next;continue}if(ay(yt,_t,Dt),(yt.e.f&ca)!==0&&Au(yt.e),yt!==_e){if(Re!==void 0&&Re.has(yt)){if(ne.length<De.length){var Xt=De[0],Et;ve=Xt.prev;var Bt=ne[0],Ri=ne[ne.length-1];for(Et=0;Et<ne.length;Et+=1)jf(ne[Et],Xt,b);for(Et=0;Et<De.length;Et+=1)Re.delete(De[Et]);Ba(m,Bt.prev,Ri.next),Ba(m,ve,Bt),Ba(m,Ri,Xt),_e=Xt,ve=Ri,Dt-=1,ne=[],De=[]}else Re.delete(yt),jf(yt,_e,b),Ba(m,yt.prev,yt.next),Ba(m,yt,ve===null?m.first:ve.next),Ba(m,ve,yt),ve=yt;continue}for(ne=[],De=[];_e!==null&&_e.k!==Rt;)(_e.e.f&ca)===0&&(Re??(Re=new Set)).add(_e),De.push(_e),_e=_e.next;if(_e===null)continue;yt=_e}ne.push(yt),ve=yt,_e=yt.next}if(_e!==null||Re!==void 0){for(var jt=Re===void 0?[]:dd(Re);_e!==null;)(_e.e.f&ca)===0&&jt.push(_e),_e=_e.next;var xr=jt.length;if(xr>0){var cn=o===0?b:null;iy(m,jt,cn,le)}}pi.first=m.first&&m.first.e,pi.last=ve&&ve.e}function ay(y,m,b,I){pf(y.v,m),y.i=b}function sy(y,m,b,I,z,R,S,o,le,he){var _e=(le&m_)!==0,Re=(le&__)===0,ve=_e?Re?S_(z):so(z):z,ne=(le&g_)===0?S:so(S),De={i:ne,v:ve,k:R,a:null,e:null,prev:b,next:I};try{return De.e=co(()=>o(y,ve,ne,he),P_),De.e.prev=b&&b.e,De.e.next=I&&I.e,b===null?m.first=De:(b.next=De,b.e.next=De.e),I!==null&&(I.prev=De,I.e.prev=De.e),De}finally{}}function jf(y,m,b){for(var I=y.next?y.next.e.nodes_start:b,z=m?m.e.nodes_start:b,R=y.e.nodes_start;R!==I;){var S=Cu(R);z.before(R),R=S}}function Ba(y,m,b){m===null?y.first=b:(m.next=b,m.e.next=b&&b.e),b!==null&&(b.prev=m,b.e.prev=m&&m.e)}function oy(y,m,...b){var I=y,z=n_,R;ku(()=>{z!==(z=m())&&(R&&(ha(R),R=null),R=co(()=>z(I,...b)))},vu)}const Nf=[...`
2
- \r\f \v\uFEFF`];function ly(y,m,b){var I=y==null?"":""+y;if(b){for(var z in b)if(b[z])I=I?I+" "+z:z;else if(I.length)for(var R=z.length,S=0;(S=I.indexOf(z,S))>=0;){var o=S+R;(S===0||Nf.includes(I[S-1]))&&(o===I.length||Nf.includes(I[o]))?I=(S===0?"":I.substring(0,S))+I.substring(o+1):S=o}}return I===""?null:I}function Zf(y,m=!1){var b=m?" !important;":";",I="";for(var z in y){var R=y[z];R!=null&&R!==""&&(I+=" "+z+": "+R+b)}return I}function Sd(y){return y[0]!=="-"||y[1]!=="-"?y.toLowerCase():y}function cy(y,m){if(m){var b="",I,z;if(Array.isArray(m)?(I=m[0],z=m[1]):I=m,y){y=String(y).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var R=!1,S=0,o=!1,le=[];I&&le.push(...Object.keys(I).map(Sd)),z&&le.push(...Object.keys(z).map(Sd));var he=0,_e=-1;const _t=y.length;for(var Re=0;Re<_t;Re++){var ve=y[Re];if(o?ve==="/"&&y[Re-1]==="*"&&(o=!1):R?R===ve&&(R=!1):ve==="/"&&y[Re+1]==="*"?o=!0:ve==='"'||ve==="'"?R=ve:ve==="("?S++:ve===")"&&S--,!o&&R===!1&&S===0){if(ve===":"&&_e===-1)_e=Re;else if(ve===";"||Re===_t-1){if(_e!==-1){var ne=Sd(y.substring(he,_e).trim());if(!le.includes(ne)){ve!==";"&&Re++;var De=y.substring(he,Re).trim();b+=" "+De+";"}}he=Re+1,_e=-1}}}}return I&&(b+=Zf(I)),z&&(b+=Zf(z,!0)),b=b.trim(),b===""?null:b}return y==null?null:String(y)}function Vf(y,m,b,I,z,R){var S=y.__className;if(S!==b||S===void 0){var o=ly(b,I,R);o==null?y.removeAttribute("class"):y.className=o,y.__className=b}else if(R&&z!==R)for(var le in R){var he=!!R[le];(z==null||he!==!!z[le])&&y.classList.toggle(le,he)}return R}function Pd(y,m={},b,I){for(var z in b){var R=b[z];m[z]!==R&&(b[z]==null?y.style.removeProperty(z):y.style.setProperty(z,R,I))}}function Nu(y,m,b,I){var z=y.__style;if(z!==m){var R=cy(m,I);R==null?y.removeAttribute("style"):y.style.cssText=R,y.__style=m}else I&&(Array.isArray(I)?(Pd(y,b==null?void 0:b[0],I[0]),Pd(y,b==null?void 0:b[1],I[1],"important")):Pd(y,b,I));return I}const uy=()=>performance.now(),Un={tick:y=>requestAnimationFrame(y),now:()=>uy(),tasks:new Set};function Uf(){const y=Un.now();Un.tasks.forEach(m=>{m.c(y)||(Un.tasks.delete(m),m.f())}),Un.tasks.size!==0&&Un.tick(Uf)}function hy(y){let m;return Un.tasks.size===0&&Un.tick(Uf),{promise:new Promise(b=>{Un.tasks.add(m={c:y,f:b})}),abort(){Un.tasks.delete(m)}}}const Ju=class Ju{constructor(m){Cr(this,Yu);Cr(this,Va,new WeakMap);Cr(this,vo);Cr(this,ql);fu(this,ql,m)}observe(m,b){var I=Lt(this,Va).get(m)||new Set;return I.add(b),Lt(this,Va).set(m,I),Qg(this,Yu,e_).call(this).observe(m,Lt(this,ql)),()=>{var z=Lt(this,Va).get(m);z.delete(b),z.size===0&&(Lt(this,Va).delete(m),Lt(this,vo).unobserve(m))}}};Va=new WeakMap,vo=new WeakMap,ql=new WeakMap,Yu=new WeakSet,e_=function(){return Lt(this,vo)??fu(this,vo,new ResizeObserver(m=>{for(var b of m){Ju.entries.set(b.target,b);for(var I of Lt(this,Va).get(b.target)||[])I(b)}}))},fs(Ju,"entries",new WeakMap);let Cd=Ju;var dy=new Cd({box:"border-box"});function $f(y,m,b){var I=dy.observe(y,()=>b(y[m]));Iu(()=>(wd(()=>b(y[m])),I))}function Gf(y,m){return y===m||(y==null?void 0:y[bu])===m}function Fa(y={},m,b,I){return Iu(()=>{var z,R;return vf(()=>{z=R,R=(I==null?void 0:I())||[],wd(()=>{y!==b(...R)&&(m(y,...R),z&&Gf(b(...z),y)&&m(null,...z))})}),()=>{Cf(()=>{R&&Gf(b(...R),y)&&m(null,...R)})}}),y}function qf(y){Zr===null&&w_(),lo(()=>{const m=wd(y);if(typeof m=="function")return m})}const py="5";typeof window<"u"&&((mm=window.__svelte??(window.__svelte={})).v??(mm.v=new Set)).add(py);function Hf(y){return Object.prototype.toString.call(y)==="[object Date]"}function fy(y){return y}function my(y){return-.5*(Math.cos(Math.PI*y)-1)}function Id(y,m){if(y===m||y!==y)return()=>y;const b=typeof y;if(b!==typeof m||Array.isArray(y)!==Array.isArray(m))throw new Error("Cannot interpolate values of different type");if(Array.isArray(y)){const I=m.map((z,R)=>Id(y[R],z));return z=>I.map(R=>R(z))}if(b==="object"){if(!y||!m)throw new Error("Object cannot be null");if(Hf(y)&&Hf(m)){const R=y.getTime(),o=m.getTime()-R;return le=>new Date(R+le*o)}const I=Object.keys(m),z={};return I.forEach(R=>{z[R]=Id(y[R],m[R])}),R=>{const S={};return I.forEach(o=>{S[o]=z[o](R)}),S}}if(b==="number"){const I=m-y;return z=>y+z*I}return()=>m}const Nd=class Nd{constructor(m,b={}){Cr(this,ma,so(void 0));Cr(this,bo,so(void 0));Cr(this,Hl);Cr(this,bs,null);Lt(this,ma).v=Lt(this,bo).v=m,fu(this,Hl,b)}static of(m,b){const I=new Nd(m(),b);return vf(()=>{I.set(m())}),I}set(m,b){var Re;si(Lt(this,bo),m);let{delay:I=0,duration:z=400,easing:R=fy,interpolate:S=Id}={...Lt(this,Hl),...b};if(z===0)return(Re=Lt(this,bs))==null||Re.abort(),si(Lt(this,ma),m),Promise.resolve();const o=Un.now()+I;let le,he=!1,_e=Lt(this,bs);return fu(this,bs,hy(ve=>{if(ve<o)return!0;if(!he){he=!0;const De=Lt(this,ma).v;le=S(De,m),typeof z=="function"&&(z=z(De,m)),_e==null||_e.abort()}const ne=ve-o;return ne>z?(si(Lt(this,ma),m),!1):(si(Lt(this,ma),le(R(ne/z))),!0)})),Lt(this,bs).promise}get current(){return Qe(Lt(this,ma))}get target(){return Qe(Lt(this,bo))}set target(m){this.set(m)}};ma=new WeakMap,bo=new WeakMap,Hl=new WeakMap,bs=new WeakMap;let Ed=Nd;function Wf(y,m,b){const I=b*(Math.PI/180),z=y/2,R=m/2,S=Math.sqrt(z*z+R*R),o=Math.atan(R/z)*(180/Math.PI),le=o,he=180-o,_e=180+o,Re=360-o;switch(!0){case(le<=b&&b<=he):return{offsetX:S*Math.cos(I)-z,offsetY:0};case(he<=b&&b<=_e):return{offsetX:-y,offsetY:S*Math.sin(I)-R};case(_e<=b&&b<=Re):return{offsetX:S*Math.cos(I)-z,offsetY:-m};default:return{offsetX:0,offsetY:S*Math.sin(I)-R}}}function gy(y,m,b){const I=Wf(y,m,b),z=I.offsetX,R=I.offsetY,S=m,o=y,le=Wf(S,o,b),he=S/2+le.offsetX,_e=o/2+le.offsetY,ve=Math.atan2(_e,he)/Math.PI*180-45,ne=0,De=30,_t=z+y/2,Rt=R+m/2,yt=Math.sqrt(_t*_t+Rt*Rt),Dt=Math.min(y,m)/2,Jt=Math.sqrt(y*y+m*m)/2,Xt=(yt-Dt)/(Jt-Dt),Et=ne+Xt*(De-ne);return{markerOffsetX:z,markerOffsetY:R,pinAngleDeg:ve,pinSkewDeg:Et}}const Xf=512,kd=0,Zu=18,_y=10,Kf=3,yy=.5,zd=270,xy=8;var vy=uo('<div><div class="pin svelte-p9fs91"></div> <div class="marker svelte-p9fs91"><div class="popup svelte-p9fs91"><!></div></div></div>');function by(y,m){Tu(m,!0);let b=Ci(!0),I=Ci(!1);function z(mt){si(b,mt,!0)}function R(mt){si(I,!mt)}function S(){return!Qe(I)}let o=zd,le=zd,he=new Ed(zd,{easing:my,interpolate:Re}),_e=!1;lo(()=>{Qe(I)&&(he.set(o,{duration:0}),le=o,Jt(le))}),lo(()=>{le=he.current});function Re(mt,_i){if(Math.abs(_i-mt)<180)return li=>mt+li*(_i-mt);{const li=360-Math.abs(_i-mt),Ni=mt<_i?-1:1;return vr=>(360+mt+vr*li*Ni)%360}}function ve(){o!=le&&(Jt(le),window.requestAnimationFrame(ve))}function ne(mt){mt!=o&&(o=mt,_e?(he.set(mt,{duration:400}),window.requestAnimationFrame(ve)):(he.set(mt,{duration:0}),le=mt,Jt(le))),_e=!0}let De=Ci(0),_t=Ci(0),Rt,yt,Dt;lo(()=>{Qe(De)&&Qe(_t)&&(Dt.style.width=`${Math.min(Qe(De),Qe(_t))/4}px`,Dt.style.height=`${Math.min(Qe(De),Qe(_t))/4}px`)}),lo(()=>{Qe(De)&&Qe(_t)&&Jt(le)});function Jt(mt){if(!Rt||!yt||!Dt)return;const _i=gy(Qe(De),Qe(_t),mt),li=Math.round(_i.markerOffsetX),Ni=Math.round(_i.markerOffsetY);yt.style.transform=`translate(${li}px, ${Ni}px)`;const vr=_i.pinAngleDeg,un=_i.pinSkewDeg;Dt.style.transform=`rotate(${vr}deg) skew(${un}deg, ${un}deg)`;const Ft=-1-2*(li/Qe(De)),zr=-1-2*(Ni/Qe(_t));Rt.style.filter=` drop-shadow(0px 0px 4px rgba(0,0,0,0.4)) drop-shadow(${Ft}px ${zr}px 2px rgba(0,0,0,0.4))`}const Xt=()=>Qe(De),Et=()=>Qe(_t);var Bt=vy();let Ri;var jt=Ml(Bt);Fa(jt,mt=>Dt=mt,()=>Dt);var xr=yd(jt,2);Nu(xr,"",{},{padding:xy+"px"});var cn=Ml(xr),Vr=Ml(cn);return oy(Vr,()=>m.children),Fa(xr,mt=>yt=mt,()=>yt),Fa(Bt,mt=>Rt=mt,()=>Rt),Eu(mt=>Ri=Vf(Bt,1,"anchor svelte-p9fs91",null,Ri,mt),[()=>({collapsed:Qe(b),hidden:Qe(I)})]),$f(xr,"clientWidth",mt=>si(De,mt)),$f(xr,"clientHeight",mt=>si(_t,mt)),ho(y,Bt),Mu({setCollapsed:z,setDisplayed:R,getDisplayed:S,setAngle:ne,getWidth:Xt,getHeight:Et})}var wy=uo("<div></div>");function Ty(y,m){Tu(m,!0);let b=Ci(!0),I=Ci(0),z=Su(()=>1-.5*Qe(I)),R=Su(()=>Qe(b)?"":`scale(${Qe(z)})`),S=Su(()=>Qe(b)?"":`grayscale(${.5*Qe(I)})`),o=Su(()=>Qe(b)||Qe(I)>0?"":"pulsing");function le(ne){si(b,ne,!0)}function he(ne){si(I,Math.max(0,Math.min(1,ne)),!0)}var _e=wy();let Re,ve;return Eu(ne=>{Re=Vf(_e,1,"circle svelte-q2d1i5",null,Re,ne),ve=Nu(_e,"",ve,{transform:Qe(R),filter:Qe(S)})},[()=>({collapsed:Qe(b),pulsing:Qe(o)})]),ho(y,_e),Mu({setCollapsed:le,setDistance:he})}async function My(y,m,b,I){return await Sy(y,m,b,I)}async function Sy(y,m,b,I){const z="https://arenarium-maps-api.marko-smilja.workers.dev",R={apiKey:y,popups:m,minZoom:b,maxZoom:I},S=await fetch(`${z}/v1/markers`,{method:"POST",body:JSON.stringify(R)});if(!S.ok||!S.body)throw new Error("Failed to get markers");return await S.json()}function Py(y){return y&&y.__esModule&&Object.prototype.hasOwnProperty.call(y,"default")?y.default:y}var Vu={exports:{}};/**
1
+ (function($t,ai){typeof exports=="object"&&typeof module<"u"?ai(exports):typeof define=="function"&&define.amd?define(["exports"],ai):($t=typeof globalThis<"u"?globalThis:$t||self,ai($t.arenarium={}))})(this,function($t){"use strict";var B0=Object.defineProperty;var Jg=$t=>{throw TypeError($t)};var F0=($t,ai,zi)=>ai in $t?B0($t,ai,{enumerable:!0,configurable:!0,writable:!0,value:zi}):$t[ai]=zi;var fs=($t,ai,zi)=>F0($t,typeof ai!="symbol"?ai+"":ai,zi),Jp=($t,ai,zi)=>ai.has($t)||Jg("Cannot "+zi);var Lt=($t,ai,zi)=>(Jp($t,ai,"read from private field"),zi?zi.call($t):ai.get($t)),Cr=($t,ai,zi)=>ai.has($t)?Jg("Cannot add the same private member more than once"):ai instanceof WeakSet?ai.add($t):ai.set($t,zi),fu=($t,ai,zi,mu)=>(Jp($t,ai,"write to private field"),mu?mu.call($t,zi):ai.set($t,zi),zi),Qg=($t,ai,zi)=>(Jp($t,ai,"access private method"),zi);var Va,vo,ql,Yu,e_,mm,ma,bo,Hl,bs;var zi=Array.isArray,mu=Array.prototype.indexOf,dd=Array.from,i_=Object.defineProperty,wl=Object.getOwnPropertyDescriptor,Qp=Object.prototype,r_=Array.prototype,ef=Object.getPrototypeOf,tf=Object.isExtensible;const n_=()=>{};function rf(y){for(var m=0;m<y.length;m++)y[m]()}const bn=2,nf=4,gu=8,pd=16,oa=32,ao=64,_u=128,qr=256,yu=512,jr=1024,la=2048,ms=4096,ca=8192,xu=16384,a_=32768,vu=65536,s_=1<<19,af=1<<20,fd=1<<21,bu=Symbol("$state");function sf(y){return y===this.v}function o_(y,m){return y!=y?m==m:y!==m||y!==null&&typeof y=="object"||typeof y=="function"}function of(y){return!o_(y,this.v)}function l_(y){throw new Error("https://svelte.dev/e/effect_in_teardown")}function c_(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function u_(y){throw new Error("https://svelte.dev/e/effect_orphan")}function h_(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function d_(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function p_(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function f_(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let O0=!1;const m_=1,g_=2,__=16,y_=1,x_=2,Nr=Symbol(),v_=[];function b_(y,m=!1){return wu(y,new Map,"",v_)}function wu(y,m,b,I,z=null){if(typeof y=="object"&&y!==null){var D=m.get(y);if(D!==void 0)return D;if(y instanceof Map)return new Map(y);if(y instanceof Set)return new Set(y);if(zi(y)){var S=Array(y.length);m.set(y,S),z!==null&&m.set(z,S);for(var o=0;o<y.length;o+=1){var le=y[o];o in y&&(S[o]=wu(le,m,b,I))}return S}if(ef(y)===Qp){S={},m.set(y,S),z!==null&&m.set(z,S);for(var he in y)S[he]=wu(y[he],m,b,I);return S}if(y instanceof Date)return structuredClone(y);if(typeof y.toJSON=="function")return wu(y.toJSON(),m,b,I,y)}if(y instanceof EventTarget)return y;try{return structuredClone(y)}catch{return y}}function w_(y){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let Zr=null;function lf(y){Zr=y}function Tu(y,m=!1,b){var I=Zr={p:Zr,c:null,d:!1,e:null,m:!1,s:y,x:null,l:null};xf(()=>{I.d=!0})}function Mu(y){const m=Zr;if(m!==null){y!==void 0&&(m.x=y);const S=m.e;if(S!==null){var b=pi,I=oi;m.e=null;try{for(var z=0;z<S.length;z++){var D=S[z];Da(D.effect),Vn(D.reaction),Iu(D.fn)}}finally{Da(b),Vn(I)}}Zr=m.p,m.m=!0}return y||{}}function cf(){return!0}function ua(y){if(typeof y!="object"||y===null||bu in y)return y;const m=ef(y);if(m!==Qp&&m!==r_)return y;var b=new Map,I=zi(y),z=Ci(0),D=oi,S=o=>{var le=oi;Vn(D);var he=o();return Vn(le),he};return I&&b.set("length",Ci(y.length)),new Proxy(y,{defineProperty(o,le,he){(!("value"in he)||he.configurable===!1||he.enumerable===!1||he.writable===!1)&&d_();var _e=b.get(le);return _e===void 0?(_e=S(()=>Ci(he.value)),b.set(le,_e)):si(_e,S(()=>ua(he.value))),!0},deleteProperty(o,le){var he=b.get(le);if(he===void 0)le in o&&(b.set(le,S(()=>Ci(Nr))),md(z));else{if(I&&typeof le=="string"){var _e=b.get("length"),Re=Number(le);Number.isInteger(Re)&&Re<_e.v&&si(_e,Re)}si(he,Nr),md(z)}return!0},get(o,le,he){var ne;if(le===bu)return y;var _e=b.get(le),Re=le in o;if(_e===void 0&&(!Re||(ne=wl(o,le))!=null&&ne.writable)&&(_e=S(()=>Ci(ua(Re?o[le]:Nr))),b.set(le,_e)),_e!==void 0){var ve=Qe(_e);return ve===Nr?void 0:ve}return Reflect.get(o,le,he)},getOwnPropertyDescriptor(o,le){var he=Reflect.getOwnPropertyDescriptor(o,le);if(he&&"value"in he){var _e=b.get(le);_e&&(he.value=Qe(_e))}else if(he===void 0){var Re=b.get(le),ve=Re==null?void 0:Re.v;if(Re!==void 0&&ve!==Nr)return{enumerable:!0,configurable:!0,value:ve,writable:!0}}return he},has(o,le){var ve;if(le===bu)return!0;var he=b.get(le),_e=he!==void 0&&he.v!==Nr||Reflect.has(o,le);if(he!==void 0||pi!==null&&(!_e||(ve=wl(o,le))!=null&&ve.writable)){he===void 0&&(he=S(()=>Ci(_e?ua(o[le]):Nr)),b.set(le,he));var Re=Qe(he);if(Re===Nr)return!1}return _e},set(o,le,he,_e){var Dt;var Re=b.get(le),ve=le in o;if(I&&le==="length")for(var ne=he;ne<Re.v;ne+=1){var De=b.get(ne+"");De!==void 0?si(De,Nr):ne in o&&(De=S(()=>Ci(Nr)),b.set(ne+"",De))}Re===void 0?(!ve||(Dt=wl(o,le))!=null&&Dt.writable)&&(Re=S(()=>Ci(void 0)),si(Re,S(()=>ua(he))),b.set(le,Re)):(ve=Re.v!==Nr,si(Re,S(()=>ua(he))));var _t=Reflect.getOwnPropertyDescriptor(o,le);if(_t!=null&&_t.set&&_t.set.call(_e,he),!ve){if(I&&typeof le=="string"){var Rt=b.get("length"),yt=Number(le);Number.isInteger(yt)&&yt>=Rt.v&&si(Rt,yt+1)}md(z)}return!0},ownKeys(o){Qe(z);var le=Reflect.ownKeys(o).filter(Re=>{var ve=b.get(Re);return ve===void 0||ve.v!==Nr});for(var[he,_e]of b)_e.v!==Nr&&!(he in o)&&le.push(he);return le},setPrototypeOf(){p_()}})}function md(y,m=1){si(y,y.v+m)}function gd(y){var m=bn|la,b=oi!==null&&(oi.f&bn)!==0?oi:null;return pi===null||b!==null&&(b.f&qr)!==0?m|=qr:pi.f|=af,{ctx:Zr,deps:null,effects:null,equals:sf,f:m,fn:y,reactions:null,rv:0,v:null,wv:0,parent:b??pi}}function Su(y){const m=gd(y);return kf(m),m}function T_(y){const m=gd(y);return m.equals=of,m}function uf(y){var m=y.effects;if(m!==null){y.effects=null;for(var b=0;b<m.length;b+=1)ha(m[b])}}function M_(y){for(var m=y.parent;m!==null;){if((m.f&bn)===0)return m;m=m.parent}return null}function hf(y){var m,b=pi;Da(M_(y));try{uf(y),m=Lf(y)}finally{Da(b)}return m}function df(y){var m=hf(y),b=(La||(y.f&qr)!==0)&&y.deps!==null?ms:jr;wn(y,b),y.equals(m)||(y.v=m,y.wv=Af())}const Tl=new Map;function so(y,m){var b={f:0,v:y,reactions:null,equals:sf,rv:0,wv:0};return b}function Ci(y,m){const b=so(y);return kf(b),b}function S_(y,m=!1){const b=so(y);return m||(b.equals=of),b}function si(y,m,b=!1){oi!==null&&!Zn&&cf()&&(oi.f&(bn|pd))!==0&&!(Ir!=null&&Ir.includes(y))&&f_();let I=b?ua(m):m;return pf(y,I)}function pf(y,m){if(!y.equals(m)){var b=y.v;Pl?Tl.set(y,m):Tl.set(y,b),y.v=m,(y.f&bn)!==0&&((y.f&la)!==0&&hf(y),wn(y,(y.f&qr)===0?jr:ms)),y.wv=Af(),ff(y,la),pi!==null&&(pi.f&jr)!==0&&(pi.f&(oa|ao))===0&&(ln===null?B_([y]):ln.push(y))}return m}function ff(y,m){var b=y.reactions;if(b!==null)for(var I=b.length,z=0;z<I;z++){var D=b[z],S=D.f;(S&la)===0&&(wn(D,m),(S&(jr|qr))!==0&&((S&bn)!==0?ff(D,ms):ju(D)))}}let P_=!1;var _d,mf,gf,_f;function C_(){if(_d===void 0){_d=window,mf=/Firefox/.test(navigator.userAgent);var y=Element.prototype,m=Node.prototype,b=Text.prototype;gf=wl(m,"firstChild").get,_f=wl(m,"nextSibling").get,tf(y)&&(y.__click=void 0,y.__className=void 0,y.__attributes=null,y.__style=void 0,y.__e=void 0),tf(b)&&(b.__t=void 0)}}function yf(y=""){return document.createTextNode(y)}function Pu(y){return gf.call(y)}function Cu(y){return _f.call(y)}function Ml(y,m){return Pu(y)}function I_(y,m){{var b=Pu(y);return b instanceof Comment&&b.data===""?Cu(b):b}}function yd(y,m=1,b=!1){let I=y;for(;m--;)I=Cu(I);return I}function E_(y){y.textContent=""}function k_(y){pi===null&&oi===null&&u_(),oi!==null&&(oi.f&qr)!==0&&pi===null&&c_(),Pl&&l_()}function z_(y,m){var b=m.last;b===null?m.last=m.first=y:(b.next=y,y.prev=b,m.last=y)}function oo(y,m,b,I=!0){var z=pi,D={ctx:Zr,deps:null,nodes_start:null,nodes_end:null,f:y|la,first:null,fn:m,last:null,next:null,parent:z,prev:null,teardown:null,transitions:null,wv:0};if(b)try{bd(D),D.f|=a_}catch(le){throw ha(D),le}else m!==null&&ju(D);var S=b&&D.deps===null&&D.first===null&&D.nodes_start===null&&D.teardown===null&&(D.f&(af|_u))===0;if(!S&&I&&(z!==null&&z_(D,z),oi!==null&&(oi.f&bn)!==0)){var o=oi;(o.effects??(o.effects=[])).push(D)}return D}function xf(y){const m=oo(gu,null,!1);return wn(m,jr),m.teardown=y,m}function lo(y){k_();var m=pi!==null&&(pi.f&oa)!==0&&Zr!==null&&!Zr.m;if(m){var b=Zr;(b.e??(b.e=[])).push({fn:y,effect:pi,reaction:oi})}else{var I=Iu(y);return I}}function A_(y){const m=oo(ao,y,!0);return(b={})=>new Promise(I=>{b.outro?zu(m,()=>{ha(m),I(void 0)}):(ha(m),I(void 0))})}function Iu(y){return oo(nf,y,!1)}function vf(y){return oo(gu,y,!0)}function Eu(y,m=[],b=gd){const I=m.map(b);return ku(()=>y(...I.map(Qe)))}function ku(y,m=0){return oo(gu|pd|m,y,!0)}function co(y,m=!0){return oo(gu|oa,y,!0,m)}function bf(y){var m=y.teardown;if(m!==null){const b=Pl,I=oi;Ef(!0),Vn(null);try{m.call(null)}finally{Ef(b),Vn(I)}}}function wf(y,m=!1){var b=y.first;for(y.first=y.last=null;b!==null;){var I=b.next;(b.f&ao)!==0?b.parent=null:ha(b,m),b=I}}function R_(y){for(var m=y.first;m!==null;){var b=m.next;(m.f&oa)===0&&ha(m),m=b}}function ha(y,m=!0){var b=!1;(m||(y.f&s_)!==0)&&y.nodes_start!==null&&(D_(y.nodes_start,y.nodes_end),b=!0),wf(y,m&&!b),Ou(y,0),wn(y,xu);var I=y.transitions;if(I!==null)for(const D of I)D.stop();bf(y);var z=y.parent;z!==null&&z.first!==null&&Tf(y),y.next=y.prev=y.teardown=y.ctx=y.deps=y.fn=y.nodes_start=y.nodes_end=null}function D_(y,m){for(;y!==null;){var b=y===m?null:Cu(y);y.remove(),y=b}}function Tf(y){var m=y.parent,b=y.prev,I=y.next;b!==null&&(b.next=I),I!==null&&(I.prev=b),m!==null&&(m.first===y&&(m.first=I),m.last===y&&(m.last=b))}function zu(y,m){var b=[];xd(y,b,!0),Mf(b,()=>{ha(y),m&&m()})}function Mf(y,m){var b=y.length;if(b>0){var I=()=>--b||m();for(var z of y)z.out(I)}else m()}function xd(y,m,b){if((y.f&ca)===0){if(y.f^=ca,y.transitions!==null)for(const S of y.transitions)(S.is_global||b)&&m.push(S);for(var I=y.first;I!==null;){var z=I.next,D=(I.f&vu)!==0||(I.f&oa)!==0;xd(I,m,D?b:!1),I=z}}}function Au(y){Sf(y,!0)}function Sf(y,m){if((y.f&ca)!==0){y.f^=ca,(y.f&jr)===0&&(y.f^=jr),Il(y)&&(wn(y,la),ju(y));for(var b=y.first;b!==null;){var I=b.next,z=(b.f&vu)!==0||(b.f&oa)!==0;Sf(b,z?m:!1),b=I}if(y.transitions!==null)for(const D of y.transitions)(D.is_global||m)&&D.in()}}let Sl=[],vd=[];function Pf(){var y=Sl;Sl=[],rf(y)}function L_(){var y=vd;vd=[],rf(y)}function Cf(y){Sl.length===0&&queueMicrotask(Pf),Sl.push(y)}function If(){Sl.length>0&&Pf(),vd.length>0&&L_()}let Ru=!1,Du=!1,Lu=null,gs=!1,Pl=!1;function Ef(y){Pl=y}let Cl=[],j0=[],oi=null,Zn=!1;function Vn(y){oi=y}let pi=null;function Da(y){pi=y}let Ir=null;function kf(y){oi!==null&&oi.f&fd&&(Ir===null?Ir=[y]:Ir.push(y))}let Er=null,Hr=0,ln=null;function B_(y){ln=y}let zf=1,Bu=0,La=!1;function Af(){return++zf}function Il(y){var Re;var m=y.f;if((m&la)!==0)return!0;if((m&ms)!==0){var b=y.deps,I=(m&qr)!==0;if(b!==null){var z,D,S=(m&yu)!==0,o=I&&pi!==null&&!La,le=b.length;if(S||o){var he=y,_e=he.parent;for(z=0;z<le;z++)D=b[z],(S||!((Re=D==null?void 0:D.reactions)!=null&&Re.includes(he)))&&(D.reactions??(D.reactions=[])).push(he);S&&(he.f^=yu),o&&_e!==null&&(_e.f&qr)===0&&(he.f^=qr)}for(z=0;z<le;z++)if(D=b[z],Il(D)&&df(D),D.wv>y.wv)return!0}(!I||pi!==null&&!La)&&wn(y,jr)}return!1}function F_(y,m){for(var b=m;b!==null;){if((b.f&_u)!==0)try{b.fn(y);return}catch{b.f^=_u}b=b.parent}throw Ru=!1,y}function Rf(y){return(y.f&xu)===0&&(y.parent===null||(y.parent.f&_u)===0)}function Fu(y,m,b,I){if(Ru){if(b===null&&(Ru=!1),Rf(m))throw y;return}if(b!==null&&(Ru=!0),F_(y,m),Rf(m))throw y}function Df(y,m,b=!0){var I=y.reactions;if(I!==null)for(var z=0;z<I.length;z++){var D=I[z];Ir!=null&&Ir.includes(y)||((D.f&bn)!==0?Df(D,m,!1):m===D&&(b?wn(D,la):(D.f&jr)!==0&&wn(D,ms),ju(D)))}}function Lf(y){var ne;var m=Er,b=Hr,I=ln,z=oi,D=La,S=Ir,o=Zr,le=Zn,he=y.f;Er=null,Hr=0,ln=null,La=(he&qr)!==0&&(Zn||!gs||oi===null),oi=(he&(oa|ao))===0?y:null,Ir=null,lf(y.ctx),Zn=!1,Bu++,y.f|=fd;try{var _e=(0,y.fn)(),Re=y.deps;if(Er!==null){var ve;if(Ou(y,Hr),Re!==null&&Hr>0)for(Re.length=Hr+Er.length,ve=0;ve<Er.length;ve++)Re[Hr+ve]=Er[ve];else y.deps=Re=Er;if(!La)for(ve=Hr;ve<Re.length;ve++)((ne=Re[ve]).reactions??(ne.reactions=[])).push(y)}else Re!==null&&Hr<Re.length&&(Ou(y,Hr),Re.length=Hr);if(cf()&&ln!==null&&!Zn&&Re!==null&&(y.f&(bn|ms|la))===0)for(ve=0;ve<ln.length;ve++)Df(ln[ve],y);return z!==null&&z!==y&&(Bu++,ln!==null&&(I===null?I=ln:I.push(...ln))),_e}finally{Er=m,Hr=b,ln=I,oi=z,La=D,Ir=S,lf(o),Zn=le,y.f^=fd}}function O_(y,m){let b=m.reactions;if(b!==null){var I=mu.call(b,y);if(I!==-1){var z=b.length-1;z===0?b=m.reactions=null:(b[I]=b[z],b.pop())}}b===null&&(m.f&bn)!==0&&(Er===null||!Er.includes(m))&&(wn(m,ms),(m.f&(qr|yu))===0&&(m.f^=yu),uf(m),Ou(m,0))}function Ou(y,m){var b=y.deps;if(b!==null)for(var I=m;I<b.length;I++)O_(y,b[I])}function bd(y){var m=y.f;if((m&xu)===0){wn(y,jr);var b=pi,I=Zr,z=gs;pi=y,gs=!0;try{(m&pd)!==0?R_(y):wf(y),bf(y);var D=Lf(y);y.teardown=typeof D=="function"?D:null,y.wv=zf;var S=y.deps,o}catch(le){Fu(le,y,b,I||y.ctx)}finally{gs=z,pi=b}}}function j_(){try{h_()}catch(y){if(Lu!==null)Fu(y,Lu,null);else throw y}}function Bf(){var y=gs;try{var m=0;for(gs=!0;Cl.length>0;){m++>1e3&&j_();var b=Cl,I=b.length;Cl=[];for(var z=0;z<I;z++){var D=Z_(b[z]);N_(D)}Tl.clear()}}finally{Du=!1,gs=y,Lu=null}}function N_(y){var m=y.length;if(m!==0)for(var b=0;b<m;b++){var I=y[b];if((I.f&(xu|ca))===0)try{Il(I)&&(bd(I),I.deps===null&&I.first===null&&I.nodes_start===null&&(I.teardown===null?Tf(I):I.fn=null))}catch(z){Fu(z,I,null,I.ctx)}}}function ju(y){Du||(Du=!0,queueMicrotask(Bf));for(var m=Lu=y;m.parent!==null;){m=m.parent;var b=m.f;if((b&(ao|oa))!==0){if((b&jr)===0)return;m.f^=jr}}Cl.push(m)}function Z_(y){for(var m=[],b=y;b!==null;){var I=b.f,z=(I&(oa|ao))!==0,D=z&&(I&jr)!==0;if(!D&&(I&ca)===0){if((I&nf)!==0)m.push(b);else if(z)b.f^=jr;else try{Il(b)&&bd(b)}catch(le){Fu(le,b,null,b.ctx)}var S=b.first;if(S!==null){b=S;continue}}var o=b.parent;for(b=b.next;b===null&&o!==null;)b=o.next,o=o.parent}return m}function V_(y){var m;for(If();Cl.length>0;)Du=!0,Bf(),If();return m}async function U_(){await Promise.resolve(),V_()}function Qe(y){var m=y.f,b=(m&bn)!==0;if(oi!==null&&!Zn){if(!(Ir!=null&&Ir.includes(y))){var I=oi.deps;y.rv<Bu&&(y.rv=Bu,Er===null&&I!==null&&I[Hr]===y?Hr++:Er===null?Er=[y]:(!La||!Er.includes(y))&&Er.push(y))}}else if(b&&y.deps===null&&y.effects===null){var z=y,D=z.parent;D!==null&&(D.f&qr)===0&&(z.f^=qr)}return b&&(z=y,Il(z)&&df(z)),Pl&&Tl.has(y)?Tl.get(y):y.v}function wd(y){var m=Zn;try{return Zn=!0,y()}finally{Zn=m}}const $_=-7169;function wn(y,m){y.f=y.f&$_|m}const G_=["touchstart","touchmove"];function q_(y){return G_.includes(y)}function H_(y){var m=oi,b=pi;Vn(null),Da(null);try{return y()}finally{Vn(m),Da(b)}}const Ff=new Set,Td=new Set;function W_(y,m,b,I={}){function z(D){if(I.capture||El.call(m,D),!D.cancelBubble)return H_(()=>b==null?void 0:b.call(this,D))}return y.startsWith("pointer")||y.startsWith("touch")||y==="wheel"?Cf(()=>{m.addEventListener(y,z,I)}):m.addEventListener(y,z,I),z}function X_(y,m,b,I,z){var D={capture:I,passive:z},S=W_(y,m,b,D);(m===document.body||m===window||m===document)&&xf(()=>{m.removeEventListener(y,S,D)})}function K_(y){for(var m=0;m<y.length;m++)Ff.add(y[m]);for(var b of Td)b(y)}function El(y){var Dt;var m=this,b=m.ownerDocument,I=y.type,z=((Dt=y.composedPath)==null?void 0:Dt.call(y))||[],D=z[0]||y.target,S=0,o=y.__root;if(o){var le=z.indexOf(o);if(le!==-1&&(m===document||m===window)){y.__root=m;return}var he=z.indexOf(m);if(he===-1)return;le<=he&&(S=le)}if(D=z[S]||y.target,D!==m){i_(y,"currentTarget",{configurable:!0,get(){return D||b}});var _e=oi,Re=pi;Vn(null),Da(null);try{for(var ve,ne=[];D!==null;){var De=D.assignedSlot||D.parentNode||D.host||null;try{var _t=D["__"+I];if(_t!=null&&(!D.disabled||y.target===D))if(zi(_t)){var[Rt,...yt]=_t;Rt.apply(D,[y,...yt])}else _t.call(D,y)}catch(Jt){ve?ne.push(Jt):ve=Jt}if(y.cancelBubble||De===m||De===null)break;D=De}if(ve){for(let Jt of ne)queueMicrotask(()=>{throw Jt});throw ve}}finally{y.__root=m,delete y.currentTarget,Vn(_e),Da(Re)}}}function Y_(y){var m=document.createElement("template");return m.innerHTML=y,m.content}function Of(y,m){var b=pi;b.nodes_start===null&&(b.nodes_start=y,b.nodes_end=m)}function uo(y,m){var b=(m&y_)!==0,I=(m&x_)!==0,z,D=!y.startsWith("<!>");return()=>{z===void 0&&(z=Y_(D?y:"<!>"+y),b||(z=Pu(z)));var S=I||mf?document.importNode(z,!0):z.cloneNode(!0);if(b){var o=Pu(S),le=S.lastChild;Of(o,le)}else Of(S,S);return S}}function ho(y,m){y!==null&&y.before(m)}function J_(y,m){return Q_(y,m)}const po=new Map;function Q_(y,{target:m,anchor:b,props:I={},events:z,context:D,intro:S=!0}){C_();var o=new Set,le=Re=>{for(var ve=0;ve<Re.length;ve++){var ne=Re[ve];if(!o.has(ne)){o.add(ne);var De=q_(ne);m.addEventListener(ne,El,{passive:De});var _t=po.get(ne);_t===void 0?(document.addEventListener(ne,El,{passive:De}),po.set(ne,1)):po.set(ne,_t+1)}}};le(dd(Ff)),Td.add(le);var he=void 0,_e=A_(()=>{var Re=b??m.appendChild(yf());return co(()=>{if(D){Tu({});var ve=Zr;ve.c=D}z&&(I.$$events=z),he=y(Re,I)||{},D&&Mu()}),()=>{var De;for(var ve of o){m.removeEventListener(ve,El);var ne=po.get(ve);--ne===0?(document.removeEventListener(ve,El),po.delete(ve)):po.set(ve,ne)}Td.delete(le),Re!==b&&((De=Re.parentNode)==null||De.removeChild(Re))}});return Md.set(he,_e),he}let Md=new WeakMap;function ey(y,m){const b=Md.get(y);return b?(Md.delete(y),b(m)):Promise.resolve()}function ty(y,m,[b,I]=[0,0]){var z=y,D=null,S=null,o=Nr,le=b>0?vu:0,he=!1;const _e=(ve,ne=!0)=>{he=!0,Re(ne,ve)},Re=(ve,ne)=>{o!==(o=ve)&&(o?(D?Au(D):ne&&(D=co(()=>ne(z))),S&&zu(S,()=>{S=null})):(S?Au(S):ne&&(S=co(()=>ne(z,[b+1,I]))),D&&zu(D,()=>{D=null})))};ku(()=>{he=!1,m(_e),he||Re(null,null)},le)}function iy(y,m,b,I){for(var z=[],D=m.length,S=0;S<D;S++)xd(m[S].e,z,!0);var o=D>0&&z.length===0&&b!==null;if(o){var le=b.parentNode;E_(le),le.append(b),I.clear(),Ba(y,m[0].prev,m[D-1].next)}Mf(z,()=>{for(var he=0;he<D;he++){var _e=m[he];o||(I.delete(_e.k),Ba(y,_e.prev,_e.next)),ha(_e.e,!o)}})}function ry(y,m,b,I,z,D=null){var S=y,o={flags:m,items:new Map,first:null};{var le=y;S=le.appendChild(yf())}var he=null,_e=!1,Re=T_(()=>{var ve=b();return zi(ve)?ve:ve==null?[]:dd(ve)});ku(()=>{var ve=Qe(Re),ne=ve.length;_e&&ne===0||(_e=ne===0,ny(ve,o,S,z,m,I,b),D!==null&&(ne===0?he?Au(he):he=co(()=>D(S)):he!==null&&zu(he,()=>{he=null})),Qe(Re))})}function ny(y,m,b,I,z,D,S){var o=y.length,le=m.items,he=m.first,_e=he,Re,ve=null,ne=[],De=[],_t,Rt,yt,Dt;for(Dt=0;Dt<o;Dt+=1){if(_t=y[Dt],Rt=D(_t,Dt),yt=le.get(Rt),yt===void 0){var Jt=_e?_e.e.nodes_start:b;ve=sy(Jt,m,ve,ve===null?m.first:ve.next,_t,Rt,Dt,I,z,S),le.set(Rt,ve),ne=[],De=[],_e=ve.next;continue}if(ay(yt,_t,Dt),(yt.e.f&ca)!==0&&Au(yt.e),yt!==_e){if(Re!==void 0&&Re.has(yt)){if(ne.length<De.length){var Xt=De[0],Et;ve=Xt.prev;var Bt=ne[0],Ri=ne[ne.length-1];for(Et=0;Et<ne.length;Et+=1)jf(ne[Et],Xt,b);for(Et=0;Et<De.length;Et+=1)Re.delete(De[Et]);Ba(m,Bt.prev,Ri.next),Ba(m,ve,Bt),Ba(m,Ri,Xt),_e=Xt,ve=Ri,Dt-=1,ne=[],De=[]}else Re.delete(yt),jf(yt,_e,b),Ba(m,yt.prev,yt.next),Ba(m,yt,ve===null?m.first:ve.next),Ba(m,ve,yt),ve=yt;continue}for(ne=[],De=[];_e!==null&&_e.k!==Rt;)(_e.e.f&ca)===0&&(Re??(Re=new Set)).add(_e),De.push(_e),_e=_e.next;if(_e===null)continue;yt=_e}ne.push(yt),ve=yt,_e=yt.next}if(_e!==null||Re!==void 0){for(var jt=Re===void 0?[]:dd(Re);_e!==null;)(_e.e.f&ca)===0&&jt.push(_e),_e=_e.next;var xr=jt.length;if(xr>0){var cn=o===0?b:null;iy(m,jt,cn,le)}}pi.first=m.first&&m.first.e,pi.last=ve&&ve.e}function ay(y,m,b,I){pf(y.v,m),y.i=b}function sy(y,m,b,I,z,D,S,o,le,he){var _e=(le&m_)!==0,Re=(le&__)===0,ve=_e?Re?S_(z):so(z):z,ne=(le&g_)===0?S:so(S),De={i:ne,v:ve,k:D,a:null,e:null,prev:b,next:I};try{return De.e=co(()=>o(y,ve,ne,he),P_),De.e.prev=b&&b.e,De.e.next=I&&I.e,b===null?m.first=De:(b.next=De,b.e.next=De.e),I!==null&&(I.prev=De,I.e.prev=De.e),De}finally{}}function jf(y,m,b){for(var I=y.next?y.next.e.nodes_start:b,z=m?m.e.nodes_start:b,D=y.e.nodes_start;D!==I;){var S=Cu(D);z.before(D),D=S}}function Ba(y,m,b){m===null?y.first=b:(m.next=b,m.e.next=b&&b.e),b!==null&&(b.prev=m,b.e.prev=m&&m.e)}function oy(y,m,...b){var I=y,z=n_,D;ku(()=>{z!==(z=m())&&(D&&(ha(D),D=null),D=co(()=>z(I,...b)))},vu)}const Nf=[...`
2
+ \r\f \v\uFEFF`];function ly(y,m,b){var I=y==null?"":""+y;if(b){for(var z in b)if(b[z])I=I?I+" "+z:z;else if(I.length)for(var D=z.length,S=0;(S=I.indexOf(z,S))>=0;){var o=S+D;(S===0||Nf.includes(I[S-1]))&&(o===I.length||Nf.includes(I[o]))?I=(S===0?"":I.substring(0,S))+I.substring(o+1):S=o}}return I===""?null:I}function Zf(y,m=!1){var b=m?" !important;":";",I="";for(var z in y){var D=y[z];D!=null&&D!==""&&(I+=" "+z+": "+D+b)}return I}function Sd(y){return y[0]!=="-"||y[1]!=="-"?y.toLowerCase():y}function cy(y,m){if(m){var b="",I,z;if(Array.isArray(m)?(I=m[0],z=m[1]):I=m,y){y=String(y).replaceAll(/\s*\/\*.*?\*\/\s*/g,"").trim();var D=!1,S=0,o=!1,le=[];I&&le.push(...Object.keys(I).map(Sd)),z&&le.push(...Object.keys(z).map(Sd));var he=0,_e=-1;const _t=y.length;for(var Re=0;Re<_t;Re++){var ve=y[Re];if(o?ve==="/"&&y[Re-1]==="*"&&(o=!1):D?D===ve&&(D=!1):ve==="/"&&y[Re+1]==="*"?o=!0:ve==='"'||ve==="'"?D=ve:ve==="("?S++:ve===")"&&S--,!o&&D===!1&&S===0){if(ve===":"&&_e===-1)_e=Re;else if(ve===";"||Re===_t-1){if(_e!==-1){var ne=Sd(y.substring(he,_e).trim());if(!le.includes(ne)){ve!==";"&&Re++;var De=y.substring(he,Re).trim();b+=" "+De+";"}}he=Re+1,_e=-1}}}}return I&&(b+=Zf(I)),z&&(b+=Zf(z,!0)),b=b.trim(),b===""?null:b}return y==null?null:String(y)}function Vf(y,m,b,I,z,D){var S=y.__className;if(S!==b||S===void 0){var o=ly(b,I,D);o==null?y.removeAttribute("class"):y.className=o,y.__className=b}else if(D&&z!==D)for(var le in D){var he=!!D[le];(z==null||he!==!!z[le])&&y.classList.toggle(le,he)}return D}function Pd(y,m={},b,I){for(var z in b){var D=b[z];m[z]!==D&&(b[z]==null?y.style.removeProperty(z):y.style.setProperty(z,D,I))}}function Nu(y,m,b,I){var z=y.__style;if(z!==m){var D=cy(m,I);D==null?y.removeAttribute("style"):y.style.cssText=D,y.__style=m}else I&&(Array.isArray(I)?(Pd(y,b==null?void 0:b[0],I[0]),Pd(y,b==null?void 0:b[1],I[1],"important")):Pd(y,b,I));return I}const uy=()=>performance.now(),Un={tick:y=>requestAnimationFrame(y),now:()=>uy(),tasks:new Set};function Uf(){const y=Un.now();Un.tasks.forEach(m=>{m.c(y)||(Un.tasks.delete(m),m.f())}),Un.tasks.size!==0&&Un.tick(Uf)}function hy(y){let m;return Un.tasks.size===0&&Un.tick(Uf),{promise:new Promise(b=>{Un.tasks.add(m={c:y,f:b})}),abort(){Un.tasks.delete(m)}}}const Ju=class Ju{constructor(m){Cr(this,Yu);Cr(this,Va,new WeakMap);Cr(this,vo);Cr(this,ql);fu(this,ql,m)}observe(m,b){var I=Lt(this,Va).get(m)||new Set;return I.add(b),Lt(this,Va).set(m,I),Qg(this,Yu,e_).call(this).observe(m,Lt(this,ql)),()=>{var z=Lt(this,Va).get(m);z.delete(b),z.size===0&&(Lt(this,Va).delete(m),Lt(this,vo).unobserve(m))}}};Va=new WeakMap,vo=new WeakMap,ql=new WeakMap,Yu=new WeakSet,e_=function(){return Lt(this,vo)??fu(this,vo,new ResizeObserver(m=>{for(var b of m){Ju.entries.set(b.target,b);for(var I of Lt(this,Va).get(b.target)||[])I(b)}}))},fs(Ju,"entries",new WeakMap);let Cd=Ju;var dy=new Cd({box:"border-box"});function $f(y,m,b){var I=dy.observe(y,()=>b(y[m]));Iu(()=>(wd(()=>b(y[m])),I))}function Gf(y,m){return y===m||(y==null?void 0:y[bu])===m}function Fa(y={},m,b,I){return Iu(()=>{var z,D;return vf(()=>{z=D,D=(I==null?void 0:I())||[],wd(()=>{y!==b(...D)&&(m(y,...D),z&&Gf(b(...z),y)&&m(null,...z))})}),()=>{Cf(()=>{D&&Gf(b(...D),y)&&m(null,...D)})}}),y}function qf(y){Zr===null&&w_(),lo(()=>{const m=wd(y);if(typeof m=="function")return m})}const py="5";typeof window<"u"&&((mm=window.__svelte??(window.__svelte={})).v??(mm.v=new Set)).add(py);function Hf(y){return Object.prototype.toString.call(y)==="[object Date]"}function fy(y){return y}function my(y){return-.5*(Math.cos(Math.PI*y)-1)}function Id(y,m){if(y===m||y!==y)return()=>y;const b=typeof y;if(b!==typeof m||Array.isArray(y)!==Array.isArray(m))throw new Error("Cannot interpolate values of different type");if(Array.isArray(y)){const I=m.map((z,D)=>Id(y[D],z));return z=>I.map(D=>D(z))}if(b==="object"){if(!y||!m)throw new Error("Object cannot be null");if(Hf(y)&&Hf(m)){const D=y.getTime(),o=m.getTime()-D;return le=>new Date(D+le*o)}const I=Object.keys(m),z={};return I.forEach(D=>{z[D]=Id(y[D],m[D])}),D=>{const S={};return I.forEach(o=>{S[o]=z[o](D)}),S}}if(b==="number"){const I=m-y;return z=>y+z*I}return()=>m}const Nd=class Nd{constructor(m,b={}){Cr(this,ma,so(void 0));Cr(this,bo,so(void 0));Cr(this,Hl);Cr(this,bs,null);Lt(this,ma).v=Lt(this,bo).v=m,fu(this,Hl,b)}static of(m,b){const I=new Nd(m(),b);return vf(()=>{I.set(m())}),I}set(m,b){var Re;si(Lt(this,bo),m);let{delay:I=0,duration:z=400,easing:D=fy,interpolate:S=Id}={...Lt(this,Hl),...b};if(z===0)return(Re=Lt(this,bs))==null||Re.abort(),si(Lt(this,ma),m),Promise.resolve();const o=Un.now()+I;let le,he=!1,_e=Lt(this,bs);return fu(this,bs,hy(ve=>{if(ve<o)return!0;if(!he){he=!0;const De=Lt(this,ma).v;le=S(De,m),typeof z=="function"&&(z=z(De,m)),_e==null||_e.abort()}const ne=ve-o;return ne>z?(si(Lt(this,ma),m),!1):(si(Lt(this,ma),le(D(ne/z))),!0)})),Lt(this,bs).promise}get current(){return Qe(Lt(this,ma))}get target(){return Qe(Lt(this,bo))}set target(m){this.set(m)}};ma=new WeakMap,bo=new WeakMap,Hl=new WeakMap,bs=new WeakMap;let Ed=Nd;function Wf(y,m,b){const I=b*(Math.PI/180),z=y/2,D=m/2,S=Math.sqrt(z*z+D*D),o=Math.atan(D/z)*(180/Math.PI),le=o,he=180-o,_e=180+o,Re=360-o;switch(!0){case(le<=b&&b<=he):return{offsetX:S*Math.cos(I)-z,offsetY:0};case(he<=b&&b<=_e):return{offsetX:-y,offsetY:S*Math.sin(I)-D};case(_e<=b&&b<=Re):return{offsetX:S*Math.cos(I)-z,offsetY:-m};default:return{offsetX:0,offsetY:S*Math.sin(I)-D}}}function gy(y,m,b){const I=Wf(y,m,b),z=I.offsetX,D=I.offsetY,S=m,o=y,le=Wf(S,o,b),he=S/2+le.offsetX,_e=o/2+le.offsetY,ve=Math.atan2(_e,he)/Math.PI*180-45,ne=0,De=30,_t=z+y/2,Rt=D+m/2,yt=Math.sqrt(_t*_t+Rt*Rt),Dt=Math.min(y,m)/2,Jt=Math.sqrt(y*y+m*m)/2,Xt=(yt-Dt)/(Jt-Dt),Et=ne+Xt*(De-ne);return{markerOffsetX:z,markerOffsetY:D,pinAngleDeg:ve,pinSkewDeg:Et}}const Xf=512,kd=0,Zu=18,_y=10,Kf=3,yy=.5,zd=270,xy=8;var vy=uo('<div><div class="pin svelte-p9fs91"></div> <div class="marker svelte-p9fs91"><div class="popup svelte-p9fs91"><!></div></div></div>');function by(y,m){Tu(m,!0);let b=Ci(!0),I=Ci(!1);function z(mt){si(b,mt,!0)}function D(mt){si(I,!mt)}function S(){return!Qe(I)}let o=zd,le=zd,he=new Ed(zd,{easing:my,interpolate:Re}),_e=!1;lo(()=>{Qe(I)&&(he.set(o,{duration:0}),le=o,Jt(le))}),lo(()=>{le=he.current});function Re(mt,_i){if(Math.abs(_i-mt)<180)return li=>mt+li*(_i-mt);{const li=360-Math.abs(_i-mt),Ni=mt<_i?-1:1;return vr=>(360+mt+vr*li*Ni)%360}}function ve(){o!=le&&(Jt(le),window.requestAnimationFrame(ve))}function ne(mt){mt!=o&&(o=mt,_e?(he.set(mt,{duration:400}),window.requestAnimationFrame(ve)):(he.set(mt,{duration:0}),le=mt,Jt(le))),_e=!0}let De=Ci(0),_t=Ci(0),Rt,yt,Dt;lo(()=>{Qe(De)&&Qe(_t)&&(Dt.style.width=`${Math.min(Qe(De),Qe(_t))/4}px`,Dt.style.height=`${Math.min(Qe(De),Qe(_t))/4}px`)}),lo(()=>{Qe(De)&&Qe(_t)&&Jt(le)});function Jt(mt){if(!Rt||!yt||!Dt)return;const _i=gy(Qe(De),Qe(_t),mt),li=Math.round(_i.markerOffsetX),Ni=Math.round(_i.markerOffsetY);yt.style.transform=`translate(${li}px, ${Ni}px)`;const vr=_i.pinAngleDeg,un=_i.pinSkewDeg;Dt.style.transform=`rotate(${vr}deg) skew(${un}deg, ${un}deg)`;const Ft=-1-2*(li/Qe(De)),zr=-1-2*(Ni/Qe(_t));Rt.style.filter=` drop-shadow(0px 0px 4px rgba(0,0,0,0.4)) drop-shadow(${Ft}px ${zr}px 2px rgba(0,0,0,0.4))`}const Xt=()=>Qe(De),Et=()=>Qe(_t);var Bt=vy();let Ri;var jt=Ml(Bt);Fa(jt,mt=>Dt=mt,()=>Dt);var xr=yd(jt,2);Nu(xr,"",{},{padding:xy+"px"});var cn=Ml(xr),Vr=Ml(cn);return oy(Vr,()=>m.children),Fa(xr,mt=>yt=mt,()=>yt),Fa(Bt,mt=>Rt=mt,()=>Rt),Eu(mt=>Ri=Vf(Bt,1,"anchor svelte-p9fs91",null,Ri,mt),[()=>({collapsed:Qe(b),hidden:Qe(I)})]),$f(xr,"clientWidth",mt=>si(De,mt)),$f(xr,"clientHeight",mt=>si(_t,mt)),ho(y,Bt),Mu({setCollapsed:z,setDisplayed:D,getDisplayed:S,setAngle:ne,getWidth:Xt,getHeight:Et})}var wy=uo("<div></div>");function Ty(y,m){Tu(m,!0);let b=Ci(!0),I=Ci(0),z=Su(()=>1-.5*Qe(I)),D=Su(()=>Qe(b)?"":`scale(${Qe(z)})`),S=Su(()=>Qe(b)?"":`grayscale(${.5*Qe(I)})`),o=Su(()=>Qe(b)||Qe(I)>0?"":"pulsing");function le(ne){si(b,ne,!0)}function he(ne){si(I,Math.max(0,Math.min(1,ne)),!0)}var _e=wy();let Re,ve;return Eu(ne=>{Re=Vf(_e,1,"circle svelte-q2d1i5",null,Re,ne),ve=Nu(_e,"",ve,{transform:Qe(D),filter:Qe(S)})},[()=>({collapsed:Qe(b),pulsing:Qe(o)})]),ho(y,_e),Mu({setCollapsed:le,setDistance:he})}async function My(y){return await Sy(y)}async function Sy(y){const b=await fetch("https://api.maps.areanarium.dev/v1/markers",{method:"POST",body:JSON.stringify(y)});if(!b.ok||!b.body)throw new Error("Failed to get markers");return await b.json()}function Py(y){return y&&y.__esModule&&Object.prototype.hasOwnProperty.call(y,"default")?y.default:y}var Vu={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.4.0/LICENSE.txt
5
- */var Cy=Vu.exports,Yf;function Iy(){return Yf||(Yf=1,function(y,m){(function(b,I){y.exports=I()})(Cy,function(){var b={},I={};function z(S,o,le){if(I[S]=le,S==="index"){var he="var sharedModule = {}; ("+I.shared+")(sharedModule); ("+I.worker+")(sharedModule);",_e={};return I.shared(_e),I.index(b,_e),typeof window<"u"&&b.setWorkerUrl(window.URL.createObjectURL(new Blob([he],{type:"text/javascript"}))),b}}z("shared",["exports"],function(S){function o(r,t,n,a){return new(n||(n=Promise))(function(c,d){function p(w){try{x(a.next(w))}catch(M){d(M)}}function g(w){try{x(a.throw(w))}catch(M){d(M)}}function x(w){var M;w.done?c(w.value):(M=w.value,M instanceof n?M:new n(function(C){C(M)})).then(p,g)}x((a=a.apply(r,t||[])).next())})}function le(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var he,_e;function Re(){if(_e)return he;function r(t,n){this.x=t,this.y=n}return _e=1,he=r,r.prototype={clone:function(){return new r(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,n){return this.clone()._rotateAround(t,n)},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 n=t.x-this.x,a=t.y-this.y;return n*n+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,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},_matMult:function(t){var n=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=n,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 n=Math.cos(t),a=Math.sin(t),c=a*this.x+n*this.y;return this.x=n*this.x-a*this.y,this.y=c,this},_rotateAround:function(t,n){var a=Math.cos(t),c=Math.sin(t),d=n.y+c*(this.x-n.x)+a*(this.y-n.y);return this.x=n.x+a*(this.x-n.x)-c*(this.y-n.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t},he}typeof SuppressedError=="function"&&SuppressedError;var ve,ne,De=le(Re()),_t=function(){if(ne)return ve;function r(t,n,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=a,this.p2y=c}return ne=1,ve=r,r.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,n){if(n===void 0&&(n=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)<n)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var g=0,x=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<n));c++)t>d?g=a:x=a,a=.5*(x-g)+g;return a},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}},ve}(),Rt=le(_t);let yt,Dt;function Jt(){return yt==null&&(yt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),yt}function Xt(){if(Dt==null&&(Dt=!1,Jt())){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 n=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&n[a]!==a){Dt=!0;break}}}return Dt||!1}var Et=1e-6,Bt=typeof Float32Array<"u"?Float32Array:Array;function Ri(){var r=new Bt(9);return Bt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function jt(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function xr(){var r=new Bt(3);return Bt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function cn(r){return Math.hypot(r[0],r[1],r[2])}function Vr(r,t,n){var a=new Bt(3);return a[0]=r,a[1]=t,a[2]=n,a}Math.hypot||(Math.hypot=function(){for(var r=0,t=arguments.length;t--;)r+=arguments[t]*arguments[t];return Math.sqrt(r)});var mt,_i=cn;function li(r,t,n){var a=t[0],c=t[1],d=t[2],p=t[3];return r[0]=n[0]*a+n[4]*c+n[8]*d+n[12]*p,r[1]=n[1]*a+n[5]*c+n[9]*d+n[13]*p,r[2]=n[2]*a+n[6]*c+n[10]*d+n[14]*p,r[3]=n[3]*a+n[7]*c+n[11]*d+n[15]*p,r}function Ni(){var r=new Bt(4);return Bt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function vr(){var r=new Bt(2);return Bt!=Float32Array&&(r[0]=0,r[1]=0),r}function un(r,t){var n=new Bt(2);return n[0]=r,n[1]=t,n}xr(),mt=new Bt(4),Bt!=Float32Array&&(mt[0]=0,mt[1]=0,mt[2]=0,mt[3]=0),xr(),Vr(1,0,0),Vr(0,1,0),Ni(),Ni(),Ri(),vr();const Ft=8192;function zr(r,t,n){return t*(Ft/(r.tileSize*Math.pow(2,n-r.tileID.overscaledZ)))}function Ar(r,t){return(r%t+t)%t}function Hn(r,t,n){return r*(1-n)+t*n}function yi(r){if(r<=0)return 0;if(r>=1)return 1;const t=r*r,n=t*r;return 4*(r<.5?n:3*(r-t)+n-.75)}function Pn(r,t,n,a){const c=new Rt(r,t,n,a);return d=>c.solve(d)}const ir=Pn(.25,.1,.25,1);function Ti(r,t,n){return Math.min(n,Math.max(t,r))}function hn(r,t,n){const a=n-t,c=((r-t)%a+a)%a+t;return c===t?n:c}function hr(r,...t){for(const n of t)for(const a in n)r[a]=n[a];return r}let Wn=1;function Cn(r,t,n){const a={};for(const c in r)a[c]=t.call(this,r[c],c,r);return a}function ga(r,t,n){const a={};for(const c in r)t.call(this,r[c],c,r)&&(a[c]=r[c]);return a}function dr(r){return Array.isArray(r)?r.map(dr):typeof r=="object"&&r?Cn(r,dr):r}const Ki={};function Zi(r){Ki[r]||(typeof console<"u"&&console.warn(r),Ki[r]=!0)}function Wt(r,t,n){return(n.y-r.y)*(t.x-r.x)>(t.y-r.y)*(n.x-r.x)}function rr(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let br=null;function Vi(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const Xr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Kr(r,t,n,a,c){return o(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(r,{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 g=p.startsWith("BGR"),x=new Uint8ClampedArray(a*c*4);if(yield d.copyTo(x,function(w,M,C,A,L){const B=4*Math.max(1,0),j=(Math.max(0,C)-C)*A*4+B,$=4*A,X=Math.max(0,M),se=Math.max(0,C);return{rect:{x:X,y:se,width:Math.min(w.width,M+A)-X,height:Math.min(w.height,C+L)-se},layout:[{offset:j,stride:$}]}}(r,t,n,a,c)),g)for(let w=0;w<x.length;w+=4){const M=x[w];x[w]=x[w+2],x[w+2]=M}return x}finally{d.close()}})}let Di,nr;function Ze(r,t,n,a){return r.addEventListener(t,n,a),{unsubscribe:()=>{r.removeEventListener(t,n,a)}}}function Xe(r){return r/Math.PI*180}const bt={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Kt={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},fi="AbortError";function kt(){return new Error(fi)}const ut={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Gt(r){return ut.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const qt="global-dispatcher";class Li extends Error{constructor(t,n,a,c){super(`AJAXError: ${n} (${t}): ${a}`),this.status=t,this.statusText=n,this.url=a,this.body=c}}const Yt=()=>rr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Mi=function(r,t){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const a=Gt(r.url);if(a)return a(r,t);if(rr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:qt},t)}if(!(/^file:/.test(n=r.url)||/^file:/.test(Yt())&&!/^\w+:/.test(n))){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:Yt(),signal:c.signal});let p,g;a.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{p=yield fetch(d)}catch(w){throw new Li(0,w.message,a.url,new Blob)}if(!p.ok){const w=yield p.blob();throw new Li(p.status,p.statusText,a.url,w)}g=a.type==="arrayBuffer"||a.type==="image"?p.arrayBuffer():a.type==="json"?p.json():p.text();const x=yield g;if(c.signal.aborted)throw kt();return{data:x,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(r,t);if(rr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:qt},t)}var n;return function(a,c){return new Promise((d,p)=>{var g;const x=new XMLHttpRequest;x.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(x.responseType="arraybuffer");for(const w in a.headers)x.setRequestHeader(w,a.headers[w]);a.type==="json"&&(x.responseType="text",!((g=a.headers)===null||g===void 0)&&g.Accept||x.setRequestHeader("Accept","application/json")),x.withCredentials=a.credentials==="include",x.onerror=()=>{p(new Error(x.statusText))},x.onload=()=>{if(!c.signal.aborted)if((x.status>=200&&x.status<300||x.status===0)&&x.response!==null){let w=x.response;if(a.type==="json")try{w=JSON.parse(x.response)}catch(M){return void p(M)}d({data:w,cacheControl:x.getResponseHeader("Cache-Control"),expires:x.getResponseHeader("Expires")})}else{const w=new Blob([x.response],{type:x.getResponseHeader("Content-Type")});p(new Li(x.status,x.statusText,a.url,w))}},c.signal.addEventListener("abort",()=>{x.abort(),p(kt())}),x.send(a.body)})}(r,t)};function pr(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const t=new URL(r),n=window.location;return t.protocol===n.protocol&&t.host===n.host}function ue(r,t,n){n[r]&&n[r].indexOf(t)!==-1||(n[r]=n[r]||[],n[r].push(t))}function N(r,t,n){if(n&&n[r]){const a=n[r].indexOf(t);a!==-1&&n[r].splice(a,1)}}class Z{constructor(t,n={}){hr(this,n),this.type=t}}class G extends Z{constructor(t,n={}){super("error",hr({error:t},n))}}class J{on(t,n){return this._listeners=this._listeners||{},ue(t,n,this._listeners),{unsubscribe:()=>{this.off(t,n)}}}off(t,n){return N(t,n,this._listeners),N(t,n,this._oneTimeListeners),this}once(t,n){return n?(this._oneTimeListeners=this._oneTimeListeners||{},ue(t,n,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,n){typeof t=="string"&&(t=new Z(t,n||{}));const a=t.type;if(this.listens(a)){t.target=this;const c=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const g of c)g.call(this,t);const d=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const g of d)N(a,g,this._oneTimeListeners),g.call(this,t);const p=this._eventedParent;p&&(hr(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof G&&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,n){return this._eventedParent=t,this._eventedParentData=n,this}}var V={$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"},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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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 ce=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ge(r,t){const n={};for(const a in r)a!=="ref"&&(n[a]=r[a]);return ce.forEach(a=>{a in t&&(n[a]=t[a])}),n}function ie(r,t){if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!ie(r[n],t[n]))return!1;return!0}if(typeof r=="object"&&r!==null&&t!==null){if(typeof t!="object"||Object.keys(r).length!==Object.keys(t).length)return!1;for(const n in r)if(!ie(r[n],t[n]))return!1;return!0}return r===t}function ye(r,t){r.push(t)}function be(r,t,n){ye(n,{command:"addSource",args:[r,t[r]]})}function de(r,t,n){ye(t,{command:"removeSource",args:[r]}),n[r]=!0}function ke(r,t,n,a){de(r,n,a),be(r,t,n)}function Ne(r,t,n){let a;for(a in r[n])if(Object.prototype.hasOwnProperty.call(r[n],a)&&a!=="data"&&!ie(r[n][a],t[n][a]))return!1;for(a in t[n])if(Object.prototype.hasOwnProperty.call(t[n],a)&&a!=="data"&&!ie(r[n][a],t[n][a]))return!1;return!0}function Ve(r,t,n,a,c,d){r=r||{},t=t||{};for(const p in r)Object.prototype.hasOwnProperty.call(r,p)&&(ie(r[p],t[p])||n.push({command:d,args:[a,p,t[p],c]}));for(const p in t)Object.prototype.hasOwnProperty.call(t,p)&&!Object.prototype.hasOwnProperty.call(r,p)&&(ie(r[p],t[p])||n.push({command:d,args:[a,p,t[p],c]}))}function rt(r){return r.id}function dt(r,t){return r[t.id]=t,r}class Me{constructor(t,n,a,c){this.message=(t?`${t}: `:"")+a,c&&(this.identifier=c),n!=null&&n.__line__&&(this.line=n.__line__)}}function at(r,...t){for(const n of t)for(const a in n)r[a]=n[a];return r}class Ct extends Error{constructor(t,n){super(n),this.message=n,this.key=t}}class Vt{constructor(t,n=[]){this.parent=t,this.bindings={};for(const[a,c]of n)this.bindings[a]=c}concat(t){return new Vt(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 It={kind:"null"},Ie={kind:"number"},$e={kind:"string"},et={kind:"boolean"},fr={kind:"color"},ar={kind:"projectionDefinition"},ci={kind:"object"},lt={kind:"value"},ws={kind:"collator"},_a={kind:"formatted"},wo={kind:"padding"},Xn={kind:"resolvedImage"},To={kind:"variableAnchorOffsetCollection"};function Ui(r,t){return{kind:"array",itemType:r,N:t}}function ei(r){if(r.kind==="array"){const t=ei(r.itemType);return typeof r.N=="number"?`array<${t}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${t}>`}return r.kind}const $i=[It,Ie,$e,et,fr,ar,_a,ci,Ui(lt),wo,Xn,To];function Ts(r,t){if(t.kind==="error")return null;if(r.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Ts(r.itemType,t.itemType))&&(typeof r.N!="number"||r.N===t.N))return null}else{if(r.kind===t.kind)return null;if(r.kind==="value"){for(const n of $i)if(!Ts(n,t))return null}}return`Expected ${ei(r)} but found ${ei(t)} instead.`}function Mo(r,t){return t.some(n=>n.kind===r.kind)}function Yr(r,t){return t.some(n=>n==="null"?r===null:n==="array"?Array.isArray(r):n==="object"?r&&!Array.isArray(r)&&typeof r=="object":n===typeof r)}function ya(r,t){return r.kind==="array"&&t.kind==="array"?r.itemType.kind===t.itemType.kind&&typeof r.N=="number":r.kind===t.kind}const Qu=.96422,eh=.82521,Wl=4/29,Ua=6/29,Xl=3*Ua*Ua,Zd=Ua*Ua*Ua,Vd=Math.PI/180,Ud=180/Math.PI;function th(r){return(r%=360)<0&&(r+=360),r}function ih([r,t,n,a]){let c,d;const p=Yl((.2225045*(r=Kl(r))+.7168786*(t=Kl(t))+.0606169*(n=Kl(n)))/1);r===t&&t===n?c=d=p:(c=Yl((.4360747*r+.3850649*t+.1430804*n)/Qu),d=Yl((.0139322*r+.0971045*t+.7141733*n)/eh));const g=116*p-16;return[g<0?0:g,500*(c-p),200*(p-d),a]}function Kl(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Yl(r){return r>Zd?Math.pow(r,1/3):r/Xl+Wl}function Jl([r,t,n,a]){let c=(r+16)/116,d=isNaN(t)?c:c+t/500,p=isNaN(n)?c:c-n/200;return c=1*Ql(c),d=Qu*Ql(d),p=eh*Ql(p),[xa(3.1338561*d-1.6168667*c-.4906146*p),xa(-.9787684*d+1.9161415*c+.033454*p),xa(.0719453*d-.2289914*c+1.4052427*p),a]}function xa(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function Ql(r){return r>Ua?r*r*r:Xl*(r-Wl)}function So(r){return parseInt(r.padEnd(2,r),16)/255}function $a(r,t){return Ga(t?r/100:r,0,1)}function Ga(r,t,n){return Math.min(Math.max(t,r),n)}function rh(r){return!r.some(Number.isNaN)}const $d={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 In(r,t,n){return r+n*(t-r)}function qa(r,t,n){return r.map((a,c)=>In(a,t[c],n))}class gt{constructor(t,n,a,c=1,d=!0){this.r=t,this.g=n,this.b=a,this.a=c,d||(this.r*=c,this.g*=c,this.b*=c,c||this.overwriteGetter("rgb",[t,n,a,c]))}static parse(t){if(t instanceof gt)return t;if(typeof t!="string")return;const n=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const c=$d[a];if(c){const[p,g,x]=c;return[p/255,g/255,x/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 g=1;return[So(a.slice(g,g+=p)),So(a.slice(g,g+=p)),So(a.slice(g,g+=p)),So(a.slice(g,g+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[g,x,w,M,C,A,L,B,j,$,X,se]=p,Y=[M||" ",L||" ",$].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const D=[w,A,j].join(""),U=D==="%%%"?100:D===""?255:0;if(U){const Q=[Ga(+x/U,0,1),Ga(+C/U,0,1),Ga(+B/U,0,1),X?$a(+X,se):1];if(rh(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,g,x,w,M,C,A,L,B]=d,j=[x||" ",M||" ",A].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const $=[+g,Ga(+w,0,100),Ga(+C,0,100),L?$a(+L,B):1];if(rh($))return function([X,se,Y,D]){function U(Q){const fe=(Q+X/30)%12,ze=se*Math.min(Y,1-Y);return Y-ze*Math.max(-1,Math.min(fe-3,9-fe,1))}return X=th(X),se/=100,Y/=100,[U(0),U(8),U(4),D]}($)}}}(t);return n?new gt(...n,!1):void 0}get rgb(){const{r:t,g:n,b:a,a:c}=this,d=c||1/0;return this.overwriteGetter("rgb",[t/d,n/d,a/d,c])}get hcl(){return this.overwriteGetter("hcl",function(t){const[n,a,c,d]=ih(t),p=Math.sqrt(a*a+c*c);return[Math.round(1e4*p)?th(Math.atan2(c,a)*Ud):NaN,p,n,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ih(this.rgb))}overwriteGetter(t,n){return Object.defineProperty(this,t,{value:n}),n}toString(){const[t,n,a,c]=this.rgb;return`rgba(${[t,n,a].map(d=>Math.round(255*d)).join(",")},${c})`}static interpolate(t,n,a,c="rgb"){switch(c){case"rgb":{const[d,p,g,x]=qa(t.rgb,n.rgb,a);return new gt(d,p,g,x,!1)}case"hcl":{const[d,p,g,x]=t.hcl,[w,M,C,A]=n.hcl;let L,B;if(isNaN(d)||isNaN(w))isNaN(d)?isNaN(w)?L=NaN:(L=w,g!==1&&g!==0||(B=M)):(L=d,C!==1&&C!==0||(B=p));else{let Y=w-d;w>d&&Y>180?Y-=360:w<d&&d-w>180&&(Y+=360),L=d+a*Y}const[j,$,X,se]=function([Y,D,U,Q]){return Y=isNaN(Y)?0:Y*Vd,Jl([U,Math.cos(Y)*D,Math.sin(Y)*D,Q])}([L,B??In(p,M,a),In(g,C,a),In(x,A,a)]);return new gt(j,$,X,se,!1)}case"lab":{const[d,p,g,x]=Jl(qa(t.lab,n.lab,a));return new gt(d,p,g,x,!1)}}}}gt.black=new gt(0,0,0,1),gt.white=new gt(1,1,1,1),gt.transparent=new gt(0,0,0,0),gt.red=new gt(1,0,0,1);class St{constructor(t,n,a){this.sensitivity=t?n?"variant":"case":n?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,n){return this.collator.compare(t,n)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Ha=["bottom","center","top"];class dn{constructor(t,n,a,c,d,p){this.text=t,this.image=n,this.scale=a,this.fontStack=c,this.textColor=d,this.verticalAlign=p}}class wr{constructor(t){this.sections=t}static fromString(t){return new wr([new dn(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 wr?t:wr.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class sr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof sr)return t;if(typeof t=="number")return new sr([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const n of t)if(typeof n!="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 sr(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,a){return new sr(qa(t.values,n.values,a))}}class xi{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Ms=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Yi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Yi)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let n=0;n<t.length;n+=2){const a=t[n],c=t[n+1];if(typeof a!="string"||!Ms.has(a)||!Array.isArray(c)||c.length!==2||typeof c[0]!="number"||typeof c[1]!="number")return}return new Yi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,a){const c=t.values,d=n.values;if(c.length!==d.length)throw new xi(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${n.toString()}`);const p=[];for(let g=0;g<c.length;g+=2){if(c[g]!==d[g])throw new xi(`Cannot interpolate values containing mismatched anchors. from[${g}]: ${c[g]}, to[${g}]: ${d[g]}`);p.push(c[g]);const[x,w]=c[g+1],[M,C]=d[g+1];p.push([In(x,M,a),In(w,C,a)])}return new Yi(p)}}class Rr{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Rr({name:t,available:!1}):null}}class mr{constructor(t,n,a){this.from=t,this.to=n,this.transition=a}static interpolate(t,n,a){return new mr(t,n,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 Kn(r,t,n,a){return typeof r=="number"&&r>=0&&r<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof n=="number"&&n>=0&&n<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[r,t,n,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[r,t,n,a]:[r,t,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ss(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof mr||r instanceof gt||r instanceof St||r instanceof wr||r instanceof sr||r instanceof Yi||r instanceof Rr)return!0;if(Array.isArray(r)){for(const t of r)if(!Ss(t))return!1;return!0}if(typeof r=="object"){for(const t in r)if(!Ss(r[t]))return!1;return!0}return!1}function vi(r){if(r===null)return It;if(typeof r=="string")return $e;if(typeof r=="boolean")return et;if(typeof r=="number")return Ie;if(r instanceof gt)return fr;if(r instanceof mr)return ar;if(r instanceof St)return ws;if(r instanceof wr)return _a;if(r instanceof sr)return wo;if(r instanceof Yi)return To;if(r instanceof Rr)return Xn;if(Array.isArray(r)){const t=r.length;let n;for(const a of r){const c=vi(a);if(n){if(n===c)continue;n=lt;break}n=c}return Ui(n||lt,t)}return ci}function pn(r){const t=typeof r;return r===null?"":t==="string"||t==="number"||t==="boolean"?String(r):r instanceof gt||r instanceof mr||r instanceof wr||r instanceof sr||r instanceof Yi||r instanceof Rr?r.toString():JSON.stringify(r)}class Yn{constructor(t,n){this.type=t,this.value=n}static parse(t,n){if(t.length!==2)return n.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ss(t[1]))return n.error("invalid value");const a=t[1];let c=vi(a);const d=n.expectedType;return c.kind!=="array"||c.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(c=d),new Yn(c,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Ps={string:$e,number:Ie,boolean:et,object:ci};class Ur{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let a,c=1;const d=t[0];if(d==="array"){let g,x;if(t.length>2){const w=t[1];if(typeof w!="string"||!(w in Ps)||w==="object")return n.error('The item type argument of "array" must be one of string, number, boolean',1);g=Ps[w],c++}else g=lt;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return n.error('The length argument to "array" must be a positive integer literal',2);x=t[2],c++}a=Ui(g,x)}else{if(!Ps[d])throw new Error(`Types doesn't contain name = ${d}`);a=Ps[d]}const p=[];for(;c<t.length;c++){const g=n.parse(t[c],c,lt);if(!g)return null;p.push(g)}return new Ur(a,p)}evaluate(t){for(let n=0;n<this.args.length;n++){const a=this.args[n].evaluate(t);if(!Ts(this.type,vi(a)))return a;if(n===this.args.length-1)throw new xi(`Expected value to be of type ${ei(this.type)}, but found ${ei(vi(a))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Cs={"to-boolean":et,"to-color":fr,"to-number":Ie,"to-string":$e};class Nt{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const a=t[0];if(!Cs[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 n.error("Expected one argument.");const c=Cs[a],d=[];for(let p=1;p<t.length;p++){const g=n.parse(t[p],p,lt);if(!g)return null;d.push(g)}return new Nt(c,d)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let n,a;for(const c of this.args){if(n=c.evaluate(t),a=null,n instanceof gt)return n;if(typeof n=="string"){const d=t.parseColor(n);if(d)return d}else if(Array.isArray(n)&&(a=n.length<3||n.length>4?`Invalid rgba value ${JSON.stringify(n)}: expected an array containing either three or four numeric values.`:Kn(n[0],n[1],n[2],n[3]),!a))return new gt(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new xi(a||`Could not parse color from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"padding":{let n;for(const a of this.args){n=a.evaluate(t);const c=sr.parse(n);if(c)return c}throw new xi(`Could not parse padding from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"variableAnchorOffsetCollection":{let n;for(const a of this.args){n=a.evaluate(t);const c=Yi.parse(n);if(c)return c}throw new xi(`Could not parse variableAnchorOffsetCollection from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"number":{let n=null;for(const a of this.args){if(n=a.evaluate(t),n===null)return 0;const c=Number(n);if(!isNaN(c))return c}throw new xi(`Could not convert ${JSON.stringify(n)} to number.`)}case"formatted":return wr.fromString(pn(this.args[0].evaluate(t)));case"resolvedImage":return Rr.fromString(pn(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return pn(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const ec=["Unknown","Point","LineString","Polygon"];class zt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?ec[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 n=this._parseColorCache[t];return n||(n=this._parseColorCache[t]=gt.parse(t)),n}}class pt{constructor(t,n,a=[],c,d=new Vt,p=[]){this.registry=t,this.path=a,this.key=a.map(g=>`[${g}]`).join(""),this.scope=d,this.errors=p,this.expectedType=c,this._isConstant=n}parse(t,n,a,c,d={}){return n?this.concat(n,a,c)._parse(t,d):this._parse(t,d)}_parse(t,n){function a(c,d,p){return p==="assert"?new Ur(d,[c]):p==="coerce"?new Nt(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 g=this.expectedType,x=p.type;if(g.kind!=="string"&&g.kind!=="number"&&g.kind!=="boolean"&&g.kind!=="object"&&g.kind!=="array"||x.kind!=="value")if(g.kind!=="projectionDefinition"||x.kind!=="string"&&x.kind!=="array")if(g.kind!=="color"&&g.kind!=="formatted"&&g.kind!=="resolvedImage"||x.kind!=="value"&&x.kind!=="string")if(g.kind!=="padding"||x.kind!=="value"&&x.kind!=="number"&&x.kind!=="array")if(g.kind!=="variableAnchorOffsetCollection"||x.kind!=="value"&&x.kind!=="array"){if(this.checkSubtype(g,x))return null}else p=a(p,g,n.typeAnnotation||"coerce");else p=a(p,g,n.typeAnnotation||"coerce");else p=a(p,g,n.typeAnnotation||"coerce");else p=a(p,g,n.typeAnnotation||"coerce");else p=a(p,g,n.typeAnnotation||"assert")}if(!(p instanceof Yn)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const g=new zt;try{p=new Yn(p.type,p.evaluate(g))}catch(x){return this.error(x.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,n,a){const c=typeof t=="number"?this.path.concat(t):this.path,d=a?this.scope.concat(a):this.scope;return new pt(this.registry,this._isConstant,c,n||null,d,this.errors)}error(t,...n){const a=`${this.key}${n.map(c=>`[${c}]`).join("")}`;this.errors.push(new Ct(a,t))}checkSubtype(t,n){const a=Ts(t,n);return a&&this.error(a),a}}class Wa{constructor(t,n){this.type=n.type,this.bindings=[].concat(t),this.result=n}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const n of this.bindings)t(n[1]);t(this.result)}static parse(t,n){if(t.length<4)return n.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 n.error(`Expected string, but found ${typeof p} instead.`,d);if(/[^a-zA-Z0-9_]/.test(p))return n.error("Variable names must contain only alphanumeric characters or '_'.",d);const g=n.parse(t[d+1],d+1);if(!g)return null;a.push([p,g])}const c=n.parse(t[t.length-1],t.length-1,n.expectedType,a);return c?new Wa(a,c):null}outputDefined(){return this.result.outputDefined()}}class Pt{constructor(t,n){this.type=n.type,this.name=t,this.boundExpression=n}static parse(t,n){if(t.length!==2||typeof t[1]!="string")return n.error("'var' expression requires exactly one string literal argument.");const a=t[1];return n.scope.has(a)?new Pt(a,n.scope.get(a)):n.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 Is{constructor(t,n,a){this.type=t,this.index=n,this.input=a}static parse(t,n){if(t.length!==3)return n.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,Ie),c=n.parse(t[2],2,Ui(n.expectedType||lt));return a&&c?new Is(c.type.itemType,a,c):null}evaluate(t){const n=this.index.evaluate(t),a=this.input.evaluate(t);if(n<0)throw new xi(`Array index out of bounds: ${n} < 0.`);if(n>=a.length)throw new xi(`Array index out of bounds: ${n} > ${a.length-1}.`);if(n!==Math.floor(n))throw new xi(`Array index must be an integer, but found ${n} instead.`);return a[n]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Jr{constructor(t,n){this.type=et,this.needle=t,this.haystack=n}static parse(t,n){if(t.length!==3)return n.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,lt),c=n.parse(t[2],2,lt);return a&&c?Mo(a.type,[et,$e,Ie,It,lt])?new Jr(a,c):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${ei(a.type)} instead`):null}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!Yr(n,["boolean","string","number","null"]))throw new xi(`Expected first argument to be of type boolean, string, number or null, but found ${ei(vi(n))} instead.`);if(!Yr(a,["string","array"]))throw new xi(`Expected second argument to be of type array or string, but found ${ei(vi(a))} instead.`);return a.indexOf(n)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Xa{constructor(t,n,a){this.type=Ie,this.needle=t,this.haystack=n,this.fromIndex=a}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,lt),c=n.parse(t[2],2,lt);if(!a||!c)return null;if(!Mo(a.type,[et,$e,Ie,It,lt]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${ei(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,Ie);return d?new Xa(a,c,d):null}return new Xa(a,c)}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!Yr(n,["boolean","string","number","null"]))throw new xi(`Expected first argument to be of type boolean, string, number or null, but found ${ei(vi(n))} instead.`);let c;if(this.fromIndex&&(c=this.fromIndex.evaluate(t)),Yr(a,["string"])){const d=a.indexOf(n,c);return d===-1?-1:[...a.slice(0,d)].length}if(Yr(a,["array"]))return a.indexOf(n,c);throw new xi(`Expected second argument to be of type array or string, but found ${ei(vi(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Po{constructor(t,n,a,c,d,p){this.inputType=t,this.type=n,this.input=a,this.cases=c,this.outputs=d,this.otherwise=p}static parse(t,n){if(t.length<5)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return n.error("Expected an even number of arguments.");let a,c;n.expectedType&&n.expectedType.kind!=="value"&&(c=n.expectedType);const d={},p=[];for(let w=2;w<t.length-1;w+=2){let M=t[w];const C=t[w+1];Array.isArray(M)||(M=[M]);const A=n.concat(w);if(M.length===0)return A.error("Expected at least one branch label.");for(const B of M){if(typeof B!="number"&&typeof B!="string")return A.error("Branch labels must be numbers or strings.");if(typeof B=="number"&&Math.abs(B)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof B=="number"&&Math.floor(B)!==B)return A.error("Numeric branch labels must be integer values.");if(a){if(A.checkSubtype(a,vi(B)))return null}else a=vi(B);if(d[String(B)]!==void 0)return A.error("Branch labels must be unique.");d[String(B)]=p.length}const L=n.parse(C,w,c);if(!L)return null;c=c||L.type,p.push(L)}const g=n.parse(t[1],1,lt);if(!g)return null;const x=n.parse(t[t.length-1],t.length-1,c);return x?g.type.kind!=="value"&&n.concat(1).checkSubtype(a,g.type)?null:new Po(a,c,g,d,p,x):null}evaluate(t){const n=this.input.evaluate(t);return(vi(n)===this.inputType&&this.outputs[this.cases[n]]||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 Co{constructor(t,n,a){this.type=t,this.branches=n,this.otherwise=a}static parse(t,n){if(t.length<4)return n.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return n.error("Expected an odd number of arguments.");let a;n.expectedType&&n.expectedType.kind!=="value"&&(a=n.expectedType);const c=[];for(let p=1;p<t.length-1;p+=2){const g=n.parse(t[p],p,et);if(!g)return null;const x=n.parse(t[p+1],p+1,a);if(!x)return null;c.push([g,x]),a=a||x.type}const d=n.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 Co(a,c,d)}evaluate(t){for(const[n,a]of this.branches)if(n.evaluate(t))return a.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[n,a]of this.branches)t(n),t(a);t(this.otherwise)}outputDefined(){return this.branches.every(([t,n])=>n.outputDefined())&&this.otherwise.outputDefined()}}class Ka{constructor(t,n,a,c){this.type=t,this.input=n,this.beginIndex=a,this.endIndex=c}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,lt),c=n.parse(t[2],2,Ie);if(!a||!c)return null;if(!Mo(a.type,[Ui(lt),$e,lt]))return n.error(`Expected first argument to be of type array or string, but found ${ei(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,Ie);return d?new Ka(a.type,a,c,d):null}return new Ka(a.type,a,c)}evaluate(t){const n=this.input.evaluate(t),a=this.beginIndex.evaluate(t);let c;if(this.endIndex&&(c=this.endIndex.evaluate(t)),Yr(n,["string"]))return[...n].slice(a,c).join("");if(Yr(n,["array"]))return n.slice(a,c);throw new xi(`Expected first argument to be of type array or string, but found ${ei(vi(n))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Es(r,t){const n=r.length-1;let a,c,d=0,p=n,g=0;for(;d<=p;)if(g=Math.floor((d+p)/2),a=r[g],c=r[g+1],a<=t){if(g===n||t<c)return g;d=g+1}else{if(!(a>t))throw new xi("Input is not a number.");p=g-1}return 0}class ks{constructor(t,n,a){this.type=t,this.input=n,this.labels=[],this.outputs=[];for(const[c,d]of a)this.labels.push(c),this.outputs.push(d)}static parse(t,n){if(t.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");const a=n.parse(t[1],1,Ie);if(!a)return null;const c=[];let d=null;n.expectedType&&n.expectedType.kind!=="value"&&(d=n.expectedType);for(let p=1;p<t.length;p+=2){const g=p===1?-1/0:t[p],x=t[p+1],w=p,M=p+1;if(typeof g!="number")return n.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(c.length&&c[c.length-1][0]>=g)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',w);const C=n.parse(x,M,d);if(!C)return null;d=d||C.type,c.push([g,C])}return new ks(d,a,c)}evaluate(t){const n=this.labels,a=this.outputs;if(n.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=n[0])return a[0].evaluate(t);const d=n.length;return c>=n[d-1]?a[d-1].evaluate(t):a[Es(n,c)].evaluate(t)}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function nh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Io,Ya,or=function(){if(Ya)return Io;function r(t,n,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=a,this.p2y=c}return Ya=1,Io=r,r.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,n){if(n===void 0&&(n=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)<n)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var g=0,x=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<n));c++)t>d?g=a:x=a,a=.5*(x-g)+g;return a},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}},Io}(),Eo=nh(or);class Tr{constructor(t,n,a,c,d){this.type=t,this.operator=n,this.interpolation=a,this.input=c,this.labels=[],this.outputs=[];for(const[p,g]of d)this.labels.push(p),this.outputs.push(g)}static interpolationFactor(t,n,a,c){let d=0;if(t.name==="exponential")d=Ja(n,t.base,a,c);else if(t.name==="linear")d=Ja(n,1,a,c);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new Eo(p[0],p[1],p[2],p[3]).solve(Ja(n,1,a,c))}return d}static parse(t,n){let[a,c,d,...p]=t;if(!Array.isArray(c)||c.length===0)return n.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const w=c[1];if(typeof w!="number")return n.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:w}}else{if(c[0]!=="cubic-bezier")return n.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const w=c.slice(1);if(w.length!==4||w.some(M=>typeof M!="number"||M<0||M>1))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:w}}}if(t.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(d=n.parse(d,2,Ie),!d)return null;const g=[];let x=null;a==="interpolate-hcl"||a==="interpolate-lab"?x=fr:n.expectedType&&n.expectedType.kind!=="value"&&(x=n.expectedType);for(let w=0;w<p.length;w+=2){const M=p[w],C=p[w+1],A=w+3,L=w+4;if(typeof M!="number")return n.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',A);if(g.length&&g[g.length-1][0]>=M)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const B=n.parse(C,L,x);if(!B)return null;x=x||B.type,g.push([M,B])}return ya(x,Ie)||ya(x,ar)||ya(x,fr)||ya(x,wo)||ya(x,To)||ya(x,Ui(Ie))?new Tr(x,a,c,d,g):n.error(`Type ${ei(x)} is not interpolatable.`)}evaluate(t){const n=this.labels,a=this.outputs;if(n.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=n[0])return a[0].evaluate(t);const d=n.length;if(c>=n[d-1])return a[d-1].evaluate(t);const p=Es(n,c),g=Tr.interpolationFactor(this.interpolation,c,n[p],n[p+1]),x=a[p].evaluate(t),w=a[p+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return In(x,w,g);case"color":return gt.interpolate(x,w,g);case"padding":return sr.interpolate(x,w,g);case"variableAnchorOffsetCollection":return Yi.interpolate(x,w,g);case"array":return qa(x,w,g);case"projectionDefinition":return mr.interpolate(x,w,g)}case"interpolate-hcl":return gt.interpolate(x,w,g,"hcl");case"interpolate-lab":return gt.interpolate(x,w,g,"lab")}}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Ja(r,t,n,a){const c=a-n,d=r-n;return c===0?0:t===1?d/c:(Math.pow(t,d)-1)/(Math.pow(t,c)-1)}const Qt={color:gt.interpolate,number:In,padding:sr.interpolate,variableAnchorOffsetCollection:Yi.interpolate,array:qa};class zs{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let a=null;const c=n.expectedType;c&&c.kind!=="value"&&(a=c);const d=[];for(const g of t.slice(1)){const x=n.parse(g,1+d.length,a,void 0,{typeAnnotation:"omit"});if(!x)return null;a=a||x.type,d.push(x)}if(!a)throw new Error("No output type");const p=c&&d.some(g=>Ts(c,g.type));return new zs(p?lt:a,d)}evaluate(t){let n,a=null,c=0;for(const d of this.args)if(c++,a=d.evaluate(t),a&&a instanceof Rr&&!a.available&&(n||(n=a.name),a=null,c===this.args.length&&(a=n)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function ko(r,t){return r==="=="||r==="!="?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 tc(r,t,n,a){return a.compare(t,n)===0}function Qa(r,t,n){const a=r!=="=="&&r!=="!=";return class t_{constructor(d,p,g){this.type=et,this.lhs=d,this.rhs=p,this.collator=g,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 g=d[0];let x=p.parse(d[1],1,lt);if(!x)return null;if(!ko(g,x.type))return p.concat(1).error(`"${g}" comparisons are not supported for type '${ei(x.type)}'.`);let w=p.parse(d[2],2,lt);if(!w)return null;if(!ko(g,w.type))return p.concat(2).error(`"${g}" comparisons are not supported for type '${ei(w.type)}'.`);if(x.type.kind!==w.type.kind&&x.type.kind!=="value"&&w.type.kind!=="value")return p.error(`Cannot compare types '${ei(x.type)}' and '${ei(w.type)}'.`);a&&(x.type.kind==="value"&&w.type.kind!=="value"?x=new Ur(w.type,[x]):x.type.kind!=="value"&&w.type.kind==="value"&&(w=new Ur(x.type,[w])));let M=null;if(d.length===4){if(x.type.kind!=="string"&&w.type.kind!=="string"&&x.type.kind!=="value"&&w.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(M=p.parse(d[3],3,ws),!M)return null}return new t_(x,w,M)}evaluate(d){const p=this.lhs.evaluate(d),g=this.rhs.evaluate(d);if(a&&this.hasUntypedArgument){const x=vi(p),w=vi(g);if(x.kind!==w.kind||x.kind!=="string"&&x.kind!=="number")throw new xi(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${x.kind}, ${w.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const x=vi(p),w=vi(g);if(x.kind!=="string"||w.kind!=="string")return t(d,p,g)}return this.collator?n(d,p,g,this.collator.evaluate(d)):t(d,p,g)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const zo=Qa("==",function(r,t,n){return t===n},tc),ic=Qa("!=",function(r,t,n){return t!==n},function(r,t,n,a){return!tc(0,t,n,a)}),Gd=Qa("<",function(r,t,n){return t<n},function(r,t,n,a){return a.compare(t,n)<0}),Ao=Qa(">",function(r,t,n){return t>n},function(r,t,n,a){return a.compare(t,n)>0}),Ro=Qa("<=",function(r,t,n){return t<=n},function(r,t,n,a){return a.compare(t,n)<=0}),Qr=Qa(">=",function(r,t,n){return t>=n},function(r,t,n,a){return a.compare(t,n)>=0});class As{constructor(t,n,a){this.type=ws,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=n}static parse(t,n){if(t.length!==2)return n.error("Expected one argument.");const a=t[1];if(typeof a!="object"||Array.isArray(a))return n.error("Collator options argument must be an object.");const c=n.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,et);if(!c)return null;const d=n.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,et);if(!d)return null;let p=null;return a.locale&&(p=n.parse(a.locale,1,$e),!p)?null:new As(c,d,p)}evaluate(t){return new St(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 es{constructor(t,n,a,c,d){this.type=$e,this.number=t,this.locale=n,this.currency=a,this.minFractionDigits=c,this.maxFractionDigits=d}static parse(t,n){if(t.length!==3)return n.error("Expected two arguments.");const a=n.parse(t[1],1,Ie);if(!a)return null;const c=t[2];if(typeof c!="object"||Array.isArray(c))return n.error("NumberFormat options argument must be an object.");let d=null;if(c.locale&&(d=n.parse(c.locale,1,$e),!d))return null;let p=null;if(c.currency&&(p=n.parse(c.currency,1,$e),!p))return null;let g=null;if(c["min-fraction-digits"]&&(g=n.parse(c["min-fraction-digits"],1,Ie),!g))return null;let x=null;return c["max-fraction-digits"]&&(x=n.parse(c["max-fraction-digits"],1,Ie),!x)?null:new es(a,d,p,g,x)}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 Do{constructor(t){this.type=_a,this.sections=t}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const a=t[1];if(!Array.isArray(a)&&typeof a=="object")return n.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 g=t[p];if(d&&typeof g=="object"&&!Array.isArray(g)){d=!1;let x=null;if(g["font-scale"]&&(x=n.parse(g["font-scale"],1,Ie),!x))return null;let w=null;if(g["text-font"]&&(w=n.parse(g["text-font"],1,Ui($e)),!w))return null;let M=null;if(g["text-color"]&&(M=n.parse(g["text-color"],1,fr),!M))return null;let C=null;if(g["vertical-align"]){if(typeof g["vertical-align"]=="string"&&!Ha.includes(g["vertical-align"]))return n.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${g["vertical-align"]}' instead.`);if(C=n.parse(g["vertical-align"],1,$e),!C)return null}const A=c[c.length-1];A.scale=x,A.font=w,A.textColor=M,A.verticalAlign=C}else{const x=n.parse(t[p],1,lt);if(!x)return null;const w=x.type.kind;if(w!=="string"&&w!=="value"&&w!=="null"&&w!=="resolvedImage")return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,c.push({content:x,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Do(c)}evaluate(t){return new wr(this.sections.map(n=>{const a=n.content.evaluate(t);return vi(a)===Xn?new dn("",a,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(t):null):new dn(pn(a),null,n.scale?n.scale.evaluate(t):null,n.font?n.font.evaluate(t).join(","):null,n.textColor?n.textColor.evaluate(t):null,n.verticalAlign?n.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const n of this.sections)t(n.content),n.scale&&t(n.scale),n.font&&t(n.font),n.textColor&&t(n.textColor),n.verticalAlign&&t(n.verticalAlign)}outputDefined(){return!1}}class Rs{constructor(t){this.type=Xn,this.input=t}static parse(t,n){if(t.length!==2)return n.error("Expected two arguments.");const a=n.parse(t[1],1,$e);return a?new Rs(a):n.error("No image name provided.")}evaluate(t){const n=this.input.evaluate(t),a=Rr.fromString(n);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(n)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class rc{constructor(t){this.type=Ie,this.input=t}static parse(t,n){if(t.length!==2)return n.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=n.parse(t[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?n.error(`Expected argument of type string or array, but found ${ei(a.type)} instead.`):new rc(a):null}evaluate(t){const n=this.input.evaluate(t);if(typeof n=="string")return[...n].length;if(Array.isArray(n))return n.length;throw new xi(`Expected value to be of type string or array, but found ${ei(vi(n))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const fn=8192;function qd(r,t){const n=(180+r[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,c=Math.pow(2,t.z);return[Math.round(n*c*fn),Math.round(a*c*fn)]}function nc(r,t){const n=Math.pow(2,t.z);return[(c=(r[0]/fn+t.x)/n,360*c-180),(a=(r[1]/fn+t.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,c}function Jn(r,t){r[0]=Math.min(r[0],t[0]),r[1]=Math.min(r[1],t[1]),r[2]=Math.max(r[2],t[0]),r[3]=Math.max(r[3],t[1])}function Ds(r,t){return!(r[0]<=t[0]||r[2]>=t[2]||r[1]<=t[1]||r[3]>=t[3])}function ah(r,t,n){const a=r[0]-t[0],c=r[1]-t[1],d=r[0]-n[0],p=r[1]-n[1];return a*p-d*c==0&&a*d<=0&&c*p<=0}function Ls(r,t,n,a){return(c=[a[0]-n[0],a[1]-n[1]])[0]*(d=[t[0]-r[0],t[1]-r[1]])[1]-c[1]*d[0]!=0&&!(!oh(r,t,n,a)||!oh(n,a,r,t));var c,d}function Hd(r,t,n){for(const a of n)for(let c=0;c<a.length-1;++c)if(Ls(r,t,a[c],a[c+1]))return!0;return!1}function va(r,t,n=!1){let a=!1;for(const g of t)for(let x=0;x<g.length-1;x++){if(ah(r,g[x],g[x+1]))return n;(d=g[x])[1]>(c=r)[1]!=(p=g[x+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 Wd(r,t){for(const n of t)if(va(r,n))return!0;return!1}function sh(r,t){for(const n of r)if(!va(n,t))return!1;for(let n=0;n<r.length-1;++n)if(Hd(r[n],r[n+1],t))return!1;return!0}function Xd(r,t){for(const n of t)if(sh(r,n))return!0;return!1}function oh(r,t,n,a){const c=a[0]-n[0],d=a[1]-n[1],p=(r[0]-n[0])*d-c*(r[1]-n[1]),g=(t[0]-n[0])*d-c*(t[1]-n[1]);return p>0&&g<0||p<0&&g>0}function ac(r,t,n){const a=[];for(let c=0;c<r.length;c++){const d=[];for(let p=0;p<r[c].length;p++){const g=qd(r[c][p],n);Jn(t,g),d.push(g)}a.push(d)}return a}function sc(r,t,n){const a=[];for(let c=0;c<r.length;c++){const d=ac(r[c],t,n);a.push(d)}return a}function oc(r,t,n,a){if(r[0]<n[0]||r[0]>n[2]){const c=.5*a;let d=r[0]-n[0]>c?-a:n[0]-r[0]>c?a:0;d===0&&(d=r[0]-n[2]>c?-a:n[2]-r[0]>c?a:0),r[0]+=d}Jn(t,r)}function lc(r,t,n,a){const c=Math.pow(2,a.z)*fn,d=[a.x*fn,a.y*fn],p=[];for(const g of r)for(const x of g){const w=[x.x+d[0],x.y+d[1]];oc(w,t,n,c),p.push(w)}return p}function lh(r,t,n,a){const c=Math.pow(2,a.z)*fn,d=[a.x*fn,a.y*fn],p=[];for(const x of r){const w=[];for(const M of x){const C=[M.x+d[0],M.y+d[1]];Jn(t,C),w.push(C)}p.push(w)}if(t[2]-t[0]<=c/2){(g=t)[0]=g[1]=1/0,g[2]=g[3]=-1/0;for(const x of p)for(const w of x)oc(w,t,n,c)}var g;return p}class ba{constructor(t,n){this.type=et,this.geojson=t,this.geometries=n}static parse(t,n){if(t.length!==2)return n.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ss(t[1])){const a=t[1];if(a.type==="FeatureCollection"){const c=[];for(const d of a.features){const{type:p,coordinates:g}=d.geometry;p==="Polygon"&&c.push(g),p==="MultiPolygon"&&c.push(...g)}if(c.length)return new ba(a,{type:"MultiPolygon",coordinates:c})}else if(a.type==="Feature"){const c=a.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new ba(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new ba(a,a)}return n.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(n,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=n.canonicalID();if(a.type==="Polygon"){const g=ac(a.coordinates,d,p),x=lc(n.geometry(),c,d,p);if(!Ds(c,d))return!1;for(const w of x)if(!va(w,g))return!1}if(a.type==="MultiPolygon"){const g=sc(a.coordinates,d,p),x=lc(n.geometry(),c,d,p);if(!Ds(c,d))return!1;for(const w of x)if(!Wd(w,g))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(n,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=n.canonicalID();if(a.type==="Polygon"){const g=ac(a.coordinates,d,p),x=lh(n.geometry(),c,d,p);if(!Ds(c,d))return!1;for(const w of x)if(!sh(w,g))return!1}if(a.type==="MultiPolygon"){const g=sc(a.coordinates,d,p),x=lh(n.geometry(),c,d,p);if(!Ds(c,d))return!1;for(const w of x)if(!Xd(w,g))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let ch=class{constructor(r=[],t=(n,a)=>n<a?-1:n>a?1:0){if(this.data=r,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:t,compare:n}=this,a=t[r];for(;r>0;){const c=r-1>>1,d=t[c];if(n(a,d)>=0)break;t[r]=d,r=c}t[r]=a}_down(r){const{data:t,compare:n}=this,a=this.length>>1,c=t[r];for(;r<a;){let d=1+(r<<1);const p=d+1;if(p<this.length&&n(t[p],t[d])<0&&(d=p),n(t[d],c)>=0)break;t[r]=t[d],r=d}t[r]=c}};function Lo(r,t,n=0,a=r.length-1,c=Kd){for(;a>n;){if(a-n>600){const x=a-n+1,w=t-n+1,M=Math.log(x),C=.5*Math.exp(2*M/3),A=.5*Math.sqrt(M*C*(x-C)/x)*(w-x/2<0?-1:1);Lo(r,t,Math.max(n,Math.floor(t-w*C/x+A)),Math.min(a,Math.floor(t+(x-w)*C/x+A)),c)}const d=r[t];let p=n,g=a;for(Bs(r,n,t),c(r[a],d)>0&&Bs(r,n,a);p<g;){for(Bs(r,p,g),p++,g--;c(r[p],d)<0;)p++;for(;c(r[g],d)>0;)g--}c(r[n],d)===0?Bs(r,n,g):(g++,Bs(r,g,a)),g<=t&&(n=g+1),t<=g&&(a=g-1)}}function Bs(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function Kd(r,t){return r<t?-1:r>t?1:0}function Bo(r,t){if(r.length<=1)return[r];const n=[];let a,c;for(const d of r){const p=hh(d);p!==0&&(d.area=Math.abs(p),c===void 0&&(c=p<0),c===p<0?(a&&n.push(a),a=[d]):a.push(d))}if(a&&n.push(a),t>1)for(let d=0;d<n.length;d++)n[d].length<=t||(Lo(n[d],t,1,n[d].length-1,uh),n[d]=n[d].slice(0,t));return n}function uh(r,t){return t.area-r.area}function hh(r){let t=0;for(let n,a,c=0,d=r.length,p=d-1;c<d;p=c++)n=r[c],a=r[p],t+=(a.x-n.x)*(n.y+a.y);return t}const dh=1/298.257223563,ph=dh*(2-dh),cc=Math.PI/180;class Fo{constructor(t){const n=6378.137*cc*1e3,a=Math.cos(t*cc),c=1/(1-ph*(1-a*a)),d=Math.sqrt(c);this.kx=n*d*a,this.ky=n*d*c*(1-ph)}distance(t,n){const a=this.wrap(t[0]-n[0])*this.kx,c=(t[1]-n[1])*this.ky;return Math.sqrt(a*a+c*c)}pointOnLine(t,n){let a,c,d,p,g=1/0;for(let x=0;x<t.length-1;x++){let w=t[x][0],M=t[x][1],C=this.wrap(t[x+1][0]-w)*this.kx,A=(t[x+1][1]-M)*this.ky,L=0;C===0&&A===0||(L=(this.wrap(n[0]-w)*this.kx*C+(n[1]-M)*this.ky*A)/(C*C+A*A),L>1?(w=t[x+1][0],M=t[x+1][1]):L>0&&(w+=C/this.kx*L,M+=A/this.ky*L)),C=this.wrap(n[0]-w)*this.kx,A=(n[1]-M)*this.ky;const B=C*C+A*A;B<g&&(g=B,a=w,c=M,d=x,p=L)}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 fh(r,t){return t[0]-r[0]}function Oo(r){return r[1]-r[0]+1}function En(r,t){return r[1]>=r[0]&&r[1]<t}function jo(r,t){if(r[0]>r[1])return[null,null];const n=Oo(r);if(t){if(n===2)return[r,null];const c=Math.floor(n/2);return[[r[0],r[0]+c],[r[0]+c,r[1]]]}if(n===1)return[r,null];const a=Math.floor(n/2)-1;return[[r[0],r[0]+a],[r[0]+a+1,r[1]]]}function uc(r,t){if(!En(t,r.length))return[1/0,1/0,-1/0,-1/0];const n=[1/0,1/0,-1/0,-1/0];for(let a=t[0];a<=t[1];++a)Jn(n,r[a]);return n}function hc(r){const t=[1/0,1/0,-1/0,-1/0];for(const n of r)for(const a of n)Jn(t,a);return t}function mh(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function dc(r,t,n){if(!mh(r)||!mh(t))return NaN;let a=0,c=0;return r[2]<t[0]&&(a=t[0]-r[2]),r[0]>t[2]&&(a=r[0]-t[2]),r[1]>t[3]&&(c=r[1]-t[3]),r[3]<t[1]&&(c=t[1]-r[3]),n.distance([0,0],[a,c])}function Mt(r,t,n){const a=n.pointOnLine(t,r);return n.distance(r,a.point)}function pc(r,t,n,a,c){const d=Math.min(Mt(r,[n,a],c),Mt(t,[n,a],c)),p=Math.min(Mt(n,[r,t],c),Mt(a,[r,t],c));return Math.min(d,p)}function Yd(r,t,n,a,c){if(!En(t,r.length)||!En(a,n.length))return 1/0;let d=1/0;for(let p=t[0];p<t[1];++p){const g=r[p],x=r[p+1];for(let w=a[0];w<a[1];++w){const M=n[w],C=n[w+1];if(Ls(g,x,M,C))return 0;d=Math.min(d,pc(g,x,M,C,c))}}return d}function Jd(r,t,n,a,c){if(!En(t,r.length)||!En(a,n.length))return NaN;let d=1/0;for(let p=t[0];p<=t[1];++p)for(let g=a[0];g<=a[1];++g)if(d=Math.min(d,c.distance(r[p],n[g])),d===0)return d;return d}function Qd(r,t,n){if(va(r,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,Mt(r,[p,d],n)),a===0))return a;const g=n.pointOnLine(c,r);if(a=Math.min(a,n.distance(r,g.point)),a===0)return a}return a}function ep(r,t,n,a){if(!En(t,r.length))return NaN;for(let d=t[0];d<=t[1];++d)if(va(r[d],n,!0))return 0;let c=1/0;for(let d=t[0];d<t[1];++d){const p=r[d],g=r[d+1];for(const x of n)for(let w=0,M=x.length,C=M-1;w<M;C=w++){const A=x[C],L=x[w];if(Ls(p,g,A,L))return 0;c=Math.min(c,pc(p,g,A,L,a))}}return c}function gh(r,t){for(const n of r)for(const a of n)if(va(a,t,!0))return!0;return!1}function tp(r,t,n,a=1/0){const c=hc(r),d=hc(t);if(a!==1/0&&dc(c,d,n)>=a)return a;if(Ds(c,d)){if(gh(r,t))return 0}else if(gh(t,r))return 0;let p=1/0;for(const g of r)for(let x=0,w=g.length,M=w-1;x<w;M=x++){const C=g[M],A=g[x];for(const L of t)for(let B=0,j=L.length,$=j-1;B<j;$=B++){const X=L[$],se=L[B];if(Ls(C,A,X,se))return 0;p=Math.min(p,pc(C,A,X,se,n))}}return p}function _h(r,t,n,a,c,d){if(!d)return;const p=dc(uc(a,d),c,n);p<t&&r.push([p,d,[0,0]])}function No(r,t,n,a,c,d,p){if(!d||!p)return;const g=dc(uc(a,d),uc(c,p),n);g<t&&r.push([g,d,p])}function Zo(r,t,n,a,c=1/0){let d=Math.min(a.distance(r[0],n[0][0]),c);if(d===0)return d;const p=new ch([[0,[0,r.length-1],[0,0]]],fh),g=hc(n);for(;p.length>0;){const x=p.pop();if(x[0]>=d)continue;const w=x[1],M=t?50:100;if(Oo(w)<=M){if(!En(w,r.length))return NaN;if(t){const C=ep(r,w,n,a);if(isNaN(C)||C===0)return C;d=Math.min(d,C)}else for(let C=w[0];C<=w[1];++C){const A=Qd(r[C],n,a);if(d=Math.min(d,A),d===0)return 0}}else{const C=jo(w,t);_h(p,d,a,r,g,C[0]),_h(p,d,a,r,g,C[1])}}return d}function Vo(r,t,n,a,c,d=1/0){let p=Math.min(d,c.distance(r[0],n[0]));if(p===0)return p;const g=new ch([[0,[0,r.length-1],[0,n.length-1]]],fh);for(;g.length>0;){const x=g.pop();if(x[0]>=p)continue;const w=x[1],M=x[2],C=t?50:100,A=a?50:100;if(Oo(w)<=C&&Oo(M)<=A){if(!En(w,r.length)&&En(M,n.length))return NaN;let L;if(t&&a)L=Yd(r,w,n,M,c),p=Math.min(p,L);else if(t&&!a){const B=r.slice(w[0],w[1]+1);for(let j=M[0];j<=M[1];++j)if(L=Mt(n[j],B,c),p=Math.min(p,L),p===0)return p}else if(!t&&a){const B=n.slice(M[0],M[1]+1);for(let j=w[0];j<=w[1];++j)if(L=Mt(r[j],B,c),p=Math.min(p,L),p===0)return p}else L=Jd(r,w,n,M,c),p=Math.min(p,L)}else{const L=jo(w,t),B=jo(M,a);No(g,p,c,r,n,L[0],B[0]),No(g,p,c,r,n,L[0],B[1]),No(g,p,c,r,n,L[1],B[0]),No(g,p,c,r,n,L[1],B[1])}}return p}function fc(r){return r.type==="MultiPolygon"?r.coordinates.map(t=>({type:"Polygon",coordinates:t})):r.type==="MultiLineString"?r.coordinates.map(t=>({type:"LineString",coordinates:t})):r.type==="MultiPoint"?r.coordinates.map(t=>({type:"Point",coordinates:t})):[r]}class wa{constructor(t,n){this.type=Ie,this.geojson=t,this.geometries=n}static parse(t,n){if(t.length!==2)return n.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ss(t[1])){const a=t[1];if(a.type==="FeatureCollection")return new wa(a,a.features.map(c=>fc(c.geometry)).flat());if(a.type==="Feature")return new wa(a,fc(a.geometry));if("type"in a&&"coordinates"in a)return new wa(a,fc(a))}return n.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(n,a){const c=n.geometry(),d=c.flat().map(x=>nc([x.x,x.y],n.canonical));if(c.length===0)return NaN;const p=new Fo(d[0][1]);let g=1/0;for(const x of a){switch(x.type){case"Point":g=Math.min(g,Vo(d,!1,[x.coordinates],!1,p,g));break;case"LineString":g=Math.min(g,Vo(d,!1,x.coordinates,!0,p,g));break;case"Polygon":g=Math.min(g,Zo(d,!1,x.coordinates,p,g))}if(g===0)return g}return g}(t,this.geometries);if(t.geometryType()==="LineString")return function(n,a){const c=n.geometry(),d=c.flat().map(x=>nc([x.x,x.y],n.canonical));if(c.length===0)return NaN;const p=new Fo(d[0][1]);let g=1/0;for(const x of a){switch(x.type){case"Point":g=Math.min(g,Vo(d,!0,[x.coordinates],!1,p,g));break;case"LineString":g=Math.min(g,Vo(d,!0,x.coordinates,!0,p,g));break;case"Polygon":g=Math.min(g,Zo(d,!0,x.coordinates,p,g))}if(g===0)return g}return g}(t,this.geometries);if(t.geometryType()==="Polygon")return function(n,a){const c=n.geometry();if(c.length===0||c[0].length===0)return NaN;const d=Bo(c,0).map(x=>x.map(w=>w.map(M=>nc([M.x,M.y],n.canonical)))),p=new Fo(d[0][0][0][1]);let g=1/0;for(const x of a)for(const w of d){switch(x.type){case"Point":g=Math.min(g,Zo([x.coordinates],!1,w,p,g));break;case"LineString":g=Math.min(g,Zo(x.coordinates,!0,w,p,g));break;case"Polygon":g=Math.min(g,tp(w,x.coordinates,p,g))}if(g===0)return g}return g}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const ts={"==":zo,"!=":ic,">":Ao,"<":Gd,">=":Qr,"<=":Ro,array:Ur,at:Is,boolean:Ur,case:Co,coalesce:zs,collator:As,format:Do,image:Rs,in:Jr,"index-of":Xa,interpolate:Tr,"interpolate-hcl":Tr,"interpolate-lab":Tr,length:rc,let:Wa,literal:Yn,match:Po,number:Ur,"number-format":es,object:Ur,slice:Ka,step:ks,string:Ur,"to-boolean":Nt,"to-color":Nt,"to-number":Nt,"to-string":Nt,var:Pt,within:ba,distance:wa};class $r{constructor(t,n,a,c){this.name=t,this.type=n,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,n){const a=t[0],c=$r.definitions[a];if(!c)return n.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,g=p.filter(([w])=>!Array.isArray(w)||w.length===t.length-1);let x=null;for(const[w,M]of g){x=new pt(n.registry,Uo,n.path,null,n.scope);const C=[];let A=!1;for(let L=1;L<t.length;L++){const B=t[L],j=Array.isArray(w)?w[L-1]:w.type,$=x.parse(B,1+C.length,j);if(!$){A=!0;break}C.push($)}if(!A)if(Array.isArray(w)&&w.length!==C.length)x.error(`Expected ${w.length} arguments, but found ${C.length} instead.`);else{for(let L=0;L<C.length;L++){const B=Array.isArray(w)?w[L]:w.type,j=C[L];x.concat(L+1).checkSubtype(B,j.type)}if(x.errors.length===0)return new $r(a,d,M,C)}}if(g.length===1)n.errors.push(...x.errors);else{const w=(g.length?g:p).map(([C])=>{return A=C,Array.isArray(A)?`(${A.map(ei).join(", ")})`:`(${ei(A.type)}...)`;var A}).join(" | "),M=[];for(let C=1;C<t.length;C++){const A=n.parse(t[C],1+M.length);if(!A)return null;M.push(ei(A.type))}n.error(`Expected arguments of type ${w}, but found (${M.join(", ")}) instead.`)}return null}static register(t,n){$r.definitions=n;for(const a in n)t[a]=$r}}function yh(r,[t,n,a,c]){t=t.evaluate(r),n=n.evaluate(r),a=a.evaluate(r);const d=c?c.evaluate(r):1,p=Kn(t,n,a,d);if(p)throw new xi(p);return new gt(t/255,n/255,a/255,d,!1)}function xh(r,t){return r in t}function mc(r,t){const n=t[r];return n===void 0?null:n}function Ta(r){return{type:r}}function Uo(r){if(r instanceof Pt)return Uo(r.boundExpression);if(r instanceof $r&&r.name==="error"||r instanceof As||r instanceof ba||r instanceof wa)return!1;const t=r instanceof Nt||r instanceof Ur;let n=!0;return r.eachChild(a=>{n=t?n&&Uo(a):n&&a instanceof Yn}),!!n&&$o(r)&&Go(r,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function $o(r){if(r instanceof $r&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof ba||r instanceof wa)return!1;let t=!0;return r.eachChild(n=>{t&&!$o(n)&&(t=!1)}),t}function Fs(r){if(r instanceof $r&&r.name==="feature-state")return!1;let t=!0;return r.eachChild(n=>{t&&!Fs(n)&&(t=!1)}),t}function Go(r,t){if(r instanceof $r&&t.indexOf(r.name)>=0)return!1;let n=!0;return r.eachChild(a=>{n&&!Go(a,t)&&(n=!1)}),n}function vh(r){return{result:"success",value:r}}function is(r){return{result:"error",value:r}}function rs(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function bh(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function gc(r){return!!r.expression&&r.expression.interpolated}function At(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function qo(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function ip(r){return r}function Ho(r,t){const n=t.type==="color",a=r.stops&&typeof r.stops[0][0]=="object",c=a||!(a||r.property!==void 0),d=r.type||(gc(t)?"exponential":"interval");if(n||t.type==="padding"){const M=n?gt.parse:sr.parse;(r=at({},r)).stops&&(r.stops=r.stops.map(C=>[C[0],M(C[1])])),r.default=M(r.default?r.default:t.default)}if(r.colorSpace&&(p=r.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var p;let g,x,w;if(d==="exponential")g=_c;else if(d==="interval")g=np;else if(d==="categorical"){g=rp,x=Object.create(null);for(const M of r.stops)x[M[0]]=M[1];w=typeof r.stops[0][0]}else{if(d!=="identity")throw new Error(`Unknown function type "${d}"`);g=ap}if(a){const M={},C=[];for(let B=0;B<r.stops.length;B++){const j=r.stops[B],$=j[0].zoom;M[$]===void 0&&(M[$]={zoom:$,type:r.type,property:r.property,default:r.default,stops:[]},C.push($)),M[$].stops.push([j[0].value,j[1]])}const A=[];for(const B of C)A.push([M[B].zoom,Ho(M[B],t)]);const L={name:"linear"};return{kind:"composite",interpolationType:L,interpolationFactor:Tr.interpolationFactor.bind(void 0,L),zoomStops:A.map(B=>B[0]),evaluate:({zoom:B},j)=>_c({stops:A,base:r.base},t,B).evaluate(B,j)}}if(c){const M=d==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:M,interpolationFactor:Tr.interpolationFactor.bind(void 0,M),zoomStops:r.stops.map(C=>C[0]),evaluate:({zoom:C})=>g(r,t,C,x,w)}}return{kind:"source",evaluate(M,C){const A=C&&C.properties?C.properties[r.property]:void 0;return A===void 0?Os(r.default,t.default):g(r,t,A,x,w)}}}function Os(r,t,n){return r!==void 0?r:t!==void 0?t:n!==void 0?n:void 0}function rp(r,t,n,a,c){return Os(typeof n===c?a[n]:void 0,r.default,t.default)}function np(r,t,n){if(At(n)!=="number")return Os(r.default,t.default);const a=r.stops.length;if(a===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[a-1][0])return r.stops[a-1][1];const c=Es(r.stops.map(d=>d[0]),n);return r.stops[c][1]}function _c(r,t,n){const a=r.base!==void 0?r.base:1;if(At(n)!=="number")return Os(r.default,t.default);const c=r.stops.length;if(c===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[c-1][0])return r.stops[c-1][1];const d=Es(r.stops.map(M=>M[0]),n),p=function(M,C,A,L){const B=L-A,j=M-A;return B===0?0:C===1?j/B:(Math.pow(C,j)-1)/(Math.pow(C,B)-1)}(n,a,r.stops[d][0],r.stops[d+1][0]),g=r.stops[d][1],x=r.stops[d+1][1],w=Qt[t.type]||ip;return typeof g.evaluate=="function"?{evaluate(...M){const C=g.evaluate.apply(void 0,M),A=x.evaluate.apply(void 0,M);if(C!==void 0&&A!==void 0)return w(C,A,p,r.colorSpace)}}:w(g,x,p,r.colorSpace)}function ap(r,t,n){switch(t.type){case"color":n=gt.parse(n);break;case"formatted":n=wr.fromString(n.toString());break;case"resolvedImage":n=Rr.fromString(n.toString());break;case"padding":n=sr.parse(n);break;default:At(n)===t.type||t.type==="enum"&&t.values[n]||(n=void 0)}return Os(n,r.default,t.default)}$r.register(ts,{error:[{kind:"error"},[$e],(r,[t])=>{throw new xi(t.evaluate(r))}],typeof:[$e,[lt],(r,[t])=>ei(vi(t.evaluate(r)))],"to-rgba":[Ui(Ie,4),[fr],(r,[t])=>{const[n,a,c,d]=t.evaluate(r).rgb;return[255*n,255*a,255*c,d]}],rgb:[fr,[Ie,Ie,Ie],yh],rgba:[fr,[Ie,Ie,Ie,Ie],yh],has:{type:et,overloads:[[[$e],(r,[t])=>xh(t.evaluate(r),r.properties())],[[$e,ci],(r,[t,n])=>xh(t.evaluate(r),n.evaluate(r))]]},get:{type:lt,overloads:[[[$e],(r,[t])=>mc(t.evaluate(r),r.properties())],[[$e,ci],(r,[t,n])=>mc(t.evaluate(r),n.evaluate(r))]]},"feature-state":[lt,[$e],(r,[t])=>mc(t.evaluate(r),r.featureState||{})],properties:[ci,[],r=>r.properties()],"geometry-type":[$e,[],r=>r.geometryType()],id:[lt,[],r=>r.id()],zoom:[Ie,[],r=>r.globals.zoom],"heatmap-density":[Ie,[],r=>r.globals.heatmapDensity||0],"line-progress":[Ie,[],r=>r.globals.lineProgress||0],accumulated:[lt,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[Ie,Ta(Ie),(r,t)=>{let n=0;for(const a of t)n+=a.evaluate(r);return n}],"*":[Ie,Ta(Ie),(r,t)=>{let n=1;for(const a of t)n*=a.evaluate(r);return n}],"-":{type:Ie,overloads:[[[Ie,Ie],(r,[t,n])=>t.evaluate(r)-n.evaluate(r)],[[Ie],(r,[t])=>-t.evaluate(r)]]},"/":[Ie,[Ie,Ie],(r,[t,n])=>t.evaluate(r)/n.evaluate(r)],"%":[Ie,[Ie,Ie],(r,[t,n])=>t.evaluate(r)%n.evaluate(r)],ln2:[Ie,[],()=>Math.LN2],pi:[Ie,[],()=>Math.PI],e:[Ie,[],()=>Math.E],"^":[Ie,[Ie,Ie],(r,[t,n])=>Math.pow(t.evaluate(r),n.evaluate(r))],sqrt:[Ie,[Ie],(r,[t])=>Math.sqrt(t.evaluate(r))],log10:[Ie,[Ie],(r,[t])=>Math.log(t.evaluate(r))/Math.LN10],ln:[Ie,[Ie],(r,[t])=>Math.log(t.evaluate(r))],log2:[Ie,[Ie],(r,[t])=>Math.log(t.evaluate(r))/Math.LN2],sin:[Ie,[Ie],(r,[t])=>Math.sin(t.evaluate(r))],cos:[Ie,[Ie],(r,[t])=>Math.cos(t.evaluate(r))],tan:[Ie,[Ie],(r,[t])=>Math.tan(t.evaluate(r))],asin:[Ie,[Ie],(r,[t])=>Math.asin(t.evaluate(r))],acos:[Ie,[Ie],(r,[t])=>Math.acos(t.evaluate(r))],atan:[Ie,[Ie],(r,[t])=>Math.atan(t.evaluate(r))],min:[Ie,Ta(Ie),(r,t)=>Math.min(...t.map(n=>n.evaluate(r)))],max:[Ie,Ta(Ie),(r,t)=>Math.max(...t.map(n=>n.evaluate(r)))],abs:[Ie,[Ie],(r,[t])=>Math.abs(t.evaluate(r))],round:[Ie,[Ie],(r,[t])=>{const n=t.evaluate(r);return n<0?-Math.round(-n):Math.round(n)}],floor:[Ie,[Ie],(r,[t])=>Math.floor(t.evaluate(r))],ceil:[Ie,[Ie],(r,[t])=>Math.ceil(t.evaluate(r))],"filter-==":[et,[$e,lt],(r,[t,n])=>r.properties()[t.value]===n.value],"filter-id-==":[et,[lt],(r,[t])=>r.id()===t.value],"filter-type-==":[et,[$e],(r,[t])=>r.geometryType()===t.value],"filter-<":[et,[$e,lt],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a<c}],"filter-id-<":[et,[lt],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n<a}],"filter->":[et,[$e,lt],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a>c}],"filter-id->":[et,[lt],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n>a}],"filter-<=":[et,[$e,lt],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a<=c}],"filter-id-<=":[et,[lt],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n<=a}],"filter->=":[et,[$e,lt],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a>=c}],"filter-id->=":[et,[lt],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n>=a}],"filter-has":[et,[lt],(r,[t])=>t.value in r.properties()],"filter-has-id":[et,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[et,[Ui($e)],(r,[t])=>t.value.indexOf(r.geometryType())>=0],"filter-id-in":[et,[Ui(lt)],(r,[t])=>t.value.indexOf(r.id())>=0],"filter-in-small":[et,[$e,Ui(lt)],(r,[t,n])=>n.value.indexOf(r.properties()[t.value])>=0],"filter-in-large":[et,[$e,Ui(lt)],(r,[t,n])=>function(a,c,d,p){for(;d<=p;){const g=d+p>>1;if(c[g]===a)return!0;c[g]>a?p=g-1:d=g+1}return!1}(r.properties()[t.value],n.value,0,n.value.length-1)],all:{type:et,overloads:[[[et,et],(r,[t,n])=>t.evaluate(r)&&n.evaluate(r)],[Ta(et),(r,t)=>{for(const n of t)if(!n.evaluate(r))return!1;return!0}]]},any:{type:et,overloads:[[[et,et],(r,[t,n])=>t.evaluate(r)||n.evaluate(r)],[Ta(et),(r,t)=>{for(const n of t)if(n.evaluate(r))return!0;return!1}]]},"!":[et,[et],(r,[t])=>!t.evaluate(r)],"is-supported-script":[et,[$e],(r,[t])=>{const n=r.globals&&r.globals.isSupportedScript;return!n||n(t.evaluate(r))}],upcase:[$e,[$e],(r,[t])=>t.evaluate(r).toUpperCase()],downcase:[$e,[$e],(r,[t])=>t.evaluate(r).toLowerCase()],concat:[$e,Ta(lt),(r,t)=>t.map(n=>pn(n.evaluate(r))).join("")],"resolved-locale":[$e,[ws],(r,[t])=>t.evaluate(r).resolvedLocale()]});class yc{constructor(t,n){var a;this.expression=t,this._warningHistory={},this._evaluator=new zt,this._defaultValue=n?(a=n).type==="color"&&qo(a.default)?new gt(0,0,0,0):a.type==="color"?gt.parse(a.default)||null:a.type==="padding"?sr.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?Yi.parse(a.default)||null:a.type==="projectionDefinition"?mr.parse(a.default)||null:a.default===void 0?null:a.default:null,this._enumValues=n&&n.type==="enum"?n.values:null}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._evaluator.globals=t,this._evaluator.feature=n,this._evaluator.featureState=a,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,n,a,c,d,p){this._evaluator.globals=t,this._evaluator.feature=n||null,this._evaluator.featureState=a||null,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||null;try{const g=this.expression.evaluate(this._evaluator);if(g==null||typeof g=="number"&&g!=g)return this._defaultValue;if(this._enumValues&&!(g in this._enumValues))throw new xi(`Expected value to be one of ${Object.keys(this._enumValues).map(x=>JSON.stringify(x)).join(", ")}, but found ${JSON.stringify(g)} instead.`);return g}catch(g){return this._warningHistory[g.message]||(this._warningHistory[g.message]=!0,typeof console<"u"&&console.warn(g.message)),this._defaultValue}}}function Ma(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in ts}function js(r,t){const n=new pt(ts,Uo,[],t?function(c){const d={color:fr,string:$e,number:Ie,enum:$e,boolean:et,formatted:_a,padding:wo,projectionDefinition:ar,resolvedImage:Xn,variableAnchorOffsetCollection:To};return c.type==="array"?Ui(d[c.value]||lt,c.length):d[c.type]}(t):void 0),a=n.parse(r,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?vh(new yc(a,t)):is(n.errors)}class xc{constructor(t,n){this.kind=t,this._styleExpression=n,this.isStateDependent=t!=="constant"&&!Fs(n.expression)}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,n,a,c,d,p)}evaluate(t,n,a,c,d,p){return this._styleExpression.evaluate(t,n,a,c,d,p)}}class vc{constructor(t,n,a,c){this.kind=t,this.zoomStops=a,this._styleExpression=n,this.isStateDependent=t!=="camera"&&!Fs(n.expression),this.interpolationType=c}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,n,a,c,d,p)}evaluate(t,n,a,c,d,p){return this._styleExpression.evaluate(t,n,a,c,d,p)}interpolationFactor(t,n,a){return this.interpolationType?Tr.interpolationFactor(this.interpolationType,t,n,a):0}}function wh(r,t){const n=js(r,t);if(n.result==="error")return n;const a=n.value.expression,c=$o(a);if(!c&&!rs(t))return is([new Ct("","data expressions not supported")]);const d=Go(a,["zoom"]);if(!d&&!bh(t))return is([new Ct("","zoom expressions not supported")]);const p=Xo(a);return p||d?p instanceof Ct?is([p]):p instanceof Tr&&!gc(t)?is([new Ct("",'"interpolate" expressions cannot be used with this property')]):vh(p?new vc(c?"camera":"composite",n.value,p.labels,p instanceof Tr?p.interpolation:void 0):new xc(c?"constant":"source",n.value)):is([new Ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Wo{constructor(t,n){this._parameters=t,this._specification=n,at(this,Ho(this._parameters,this._specification))}static deserialize(t){return new Wo(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Xo(r){let t=null;if(r instanceof Wa)t=Xo(r.result);else if(r instanceof zs){for(const n of r.args)if(t=Xo(n),t)break}else(r instanceof ks||r instanceof Tr)&&r.input instanceof $r&&r.input.name==="zoom"&&(t=r);return t instanceof Ct||r.eachChild(n=>{const a=Xo(n);a instanceof Ct?t=a:!t&&a?t=new Ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new Ct("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Ko(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const t of r.slice(1))if(!Ko(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const Th={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function bc(r){if(r==null)return{filter:()=>!0,needGeometry:!1};Ko(r)||(r=Ns(r));const t=js(r,Th);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,a,c)=>t.value.evaluate(n,a,{},c),needGeometry:wc(r)}}function sp(r,t){return r<t?-1:r>t?1:0}function wc(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let t=1;t<r.length;t++)if(wc(r[t]))return!0;return!1}function Ns(r){if(!r)return!0;const t=r[0];return r.length<=1?t!=="any":t==="=="?Yo(r[1],r[2],"=="):t==="!="?ns(Yo(r[1],r[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Yo(r[1],r[2],t):t==="any"?(n=r.slice(1),["any"].concat(n.map(Ns))):t==="all"?["all"].concat(r.slice(1).map(Ns)):t==="none"?["all"].concat(r.slice(1).map(Ns).map(ns)):t==="in"?Tc(r[1],r.slice(2)):t==="!in"?ns(Tc(r[1],r.slice(2))):t==="has"?Jo(r[1]):t!=="!has"||ns(Jo(r[1]));var n}function Yo(r,t,n){switch(r){case"$type":return[`filter-type-${n}`,t];case"$id":return[`filter-id-${n}`,t];default:return[`filter-${n}`,r,t]}}function Tc(r,t){if(t.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(n=>typeof n!=typeof t[0])?["filter-in-large",r,["literal",t.sort(sp)]]:["filter-in-small",r,["literal",t]]}}function Jo(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function ns(r){return["!",r]}function Zs(r){const t=typeof r;if(t==="number"||t==="boolean"||t==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let c="[";for(const d of r)c+=`${Zs(d)},`;return`${c}]`}const n=Object.keys(r).sort();let a="{";for(let c=0;c<n.length;c++)a+=`${JSON.stringify(n[c])}:${Zs(r[n[c]])},`;return`${a}}`}function Qo(r){let t="";for(const n of ce)t+=`/${Zs(r[n])}`;return t}function Mh(r){const t=r.value;return t?[new Me(r.key,t,"constants have been deprecated as of v8")]:[]}function Si(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Sa(r){if(Array.isArray(r))return r.map(Sa);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const t={};for(const n in r)t[n]=Sa(r[n]);return t}return Si(r)}function Gr(r){const t=r.key,n=r.value,a=r.valueSpec||{},c=r.objectElementValidators||{},d=r.style,p=r.styleSpec,g=r.validateSpec;let x=[];const w=At(n);if(w!=="object")return[new Me(t,n,`object expected, ${w} found`)];for(const M in n){const C=M.split(".")[0],A=a[C]||a["*"];let L;if(c[C])L=c[C];else if(a[C])L=g;else if(c["*"])L=c["*"];else{if(!a["*"]){x.push(new Me(t,n[M],`unknown property "${M}"`));continue}L=g}x=x.concat(L({key:(t&&`${t}.`)+M,value:n[M],valueSpec:A,style:d,styleSpec:p,object:n,objectKey:M,validateSpec:g},n))}for(const M in a)c[M]||a[M].required&&a[M].default===void 0&&n[M]===void 0&&x.push(new Me(t,n,`missing required property "${M}"`));return x}function Mc(r){const t=r.value,n=r.valueSpec,a=r.style,c=r.styleSpec,d=r.key,p=r.arrayElementValidator||r.validateSpec;if(At(t)!=="array")return[new Me(d,t,`array expected, ${At(t)} found`)];if(n.length&&t.length!==n.length)return[new Me(d,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new Me(d,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let g={type:n.value,values:n.values};c.$version<7&&(g.function=n.function),At(n.value)==="object"&&(g=n.value);let x=[];for(let w=0;w<t.length;w++)x=x.concat(p({array:t,arrayIndex:w,value:t[w],valueSpec:g,validateSpec:r.validateSpec,style:a,styleSpec:c,key:`${d}[${w}]`}));return x}function Sc(r){const t=r.key,n=r.value,a=r.valueSpec;let c=At(n);return c==="number"&&n!=n&&(c="NaN"),c!=="number"?[new Me(t,n,`number expected, ${c} found`)]:"minimum"in a&&n<a.minimum?[new Me(t,n,`${n} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&n>a.maximum?[new Me(t,n,`${n} is greater than the maximum value ${a.maximum}`)]:[]}function Pc(r){const t=r.valueSpec,n=Si(r.value.type);let a,c,d,p={};const g=n!=="categorical"&&r.value.property===void 0,x=!g,w=At(r.value.stops)==="array"&&At(r.value.stops[0])==="array"&&At(r.value.stops[0][0])==="object",M=Gr({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(L){if(n==="identity")return[new Me(L.key,L.value,'identity function may not have a "stops" property')];let B=[];const j=L.value;return B=B.concat(Mc({key:L.key,value:j,valueSpec:L.valueSpec,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec,arrayElementValidator:C})),At(j)==="array"&&j.length===0&&B.push(new Me(L.key,j,"array must have at least one stop")),B},default:function(L){return L.validateSpec({key:L.key,value:L.value,valueSpec:t,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec})}}});return n==="identity"&&g&&M.push(new Me(r.key,r.value,'missing required property "property"')),n==="identity"||r.value.stops||M.push(new Me(r.key,r.value,'missing required property "stops"')),n==="exponential"&&r.valueSpec.expression&&!gc(r.valueSpec)&&M.push(new Me(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(x&&!rs(r.valueSpec)?M.push(new Me(r.key,r.value,"property functions not supported")):g&&!bh(r.valueSpec)&&M.push(new Me(r.key,r.value,"zoom functions not supported"))),n!=="categorical"&&!w||r.value.property!==void 0||M.push(new Me(r.key,r.value,'"property" property is required')),M;function C(L){let B=[];const j=L.value,$=L.key;if(At(j)!=="array")return[new Me($,j,`array expected, ${At(j)} found`)];if(j.length!==2)return[new Me($,j,`array length 2 expected, length ${j.length} found`)];if(w){if(At(j[0])!=="object")return[new Me($,j,`object expected, ${At(j[0])} found`)];if(j[0].zoom===void 0)return[new Me($,j,"object stop key must have zoom")];if(j[0].value===void 0)return[new Me($,j,"object stop key must have value")];if(d&&d>Si(j[0].zoom))return[new Me($,j[0].zoom,"stop zoom values must appear in ascending order")];Si(j[0].zoom)!==d&&(d=Si(j[0].zoom),c=void 0,p={}),B=B.concat(Gr({key:`${$}[0]`,value:j[0],valueSpec:{zoom:{}},validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec,objectElementValidators:{zoom:Sc,value:A}}))}else B=B.concat(A({key:`${$}[0]`,value:j[0],validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec},j));return Ma(Sa(j[1]))?B.concat([new Me(`${$}[1]`,j[1],"expressions are not allowed in function stops.")]):B.concat(L.validateSpec({key:`${$}[1]`,value:j[1],valueSpec:t,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec}))}function A(L,B){const j=At(L.value),$=Si(L.value),X=L.value!==null?L.value:B;if(a){if(j!==a)return[new Me(L.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 Me(L.key,X,"stop domain value must be a number, string, or boolean")];if(j!=="number"&&n!=="categorical"){let se=`number expected, ${j} found`;return rs(t)&&n===void 0&&(se+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Me(L.key,X,se)]}return n!=="categorical"||j!=="number"||isFinite($)&&Math.floor($)===$?n!=="categorical"&&j==="number"&&c!==void 0&&$<c?[new Me(L.key,X,"stop domain values must appear in ascending order")]:(c=$,n==="categorical"&&$ in p?[new Me(L.key,X,"stop domain values must be unique")]:(p[$]=!0,[])):[new Me(L.key,X,`integer expected, found ${$}`)]}}function Pa(r){const t=(r.expressionContext==="property"?wh:js)(Sa(r.value),r.valueSpec);if(t.result==="error")return t.value.map(a=>new Me(`${r.key}${a.key}`,r.value,a.message));const n=t.value.expression||t.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!n.outputDefined())return[new Me(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!Fs(n))return[new Me(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Fs(n))return[new Me(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Go(n,["zoom","feature-state"]))return[new Me(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!$o(n))return[new Me(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Qn(r){const t=r.key,n=r.value,a=r.valueSpec,c=[];return Array.isArray(a.values)?a.values.indexOf(Si(n))===-1&&c.push(new Me(t,n,`expected one of [${a.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(a.values).indexOf(Si(n))===-1&&c.push(new Me(t,n,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(n)} found`)),c}function Cc(r){return Ko(Sa(r.value))?Pa(at({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ic(r)}function Ic(r){const t=r.value,n=r.key;if(At(t)!=="array")return[new Me(n,t,`array expected, ${At(t)} found`)];const a=r.styleSpec;let c,d=[];if(t.length<1)return[new Me(n,t,"filter array must have at least 1 element")];switch(d=d.concat(Qn({key:`${n}[0]`,value:t[0],valueSpec:a.filter_operator,style:r.style,styleSpec:r.styleSpec})),Si(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Si(t[1])==="$type"&&d.push(new Me(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new Me(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(c=At(t[1]),c!=="string"&&d.push(new Me(`${n}[1]`,t[1],`string expected, ${c} found`)));for(let p=2;p<t.length;p++)c=At(t[p]),Si(t[1])==="$type"?d=d.concat(Qn({key:`${n}[${p}]`,value:t[p],valueSpec:a.geometry_type,style:r.style,styleSpec:r.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&d.push(new Me(`${n}[${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(Ic({key:`${n}[${p}]`,value:t[p],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":c=At(t[1]),t.length!==2?d.push(new Me(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):c!=="string"&&d.push(new Me(`${n}[1]`,t[1],`string expected, ${c} found`))}return d}function Ec(r,t){const n=r.key,a=r.validateSpec,c=r.style,d=r.styleSpec,p=r.value,g=r.objectKey,x=d[`${t}_${r.layerType}`];if(!x)return[];const w=g.match(/^(.*)-transition$/);if(t==="paint"&&w&&x[w[1]]&&x[w[1]].transition)return a({key:n,value:p,valueSpec:d.transition,style:c,styleSpec:d});const M=r.valueSpec||x[g];if(!M)return[new Me(n,p,`unknown property "${g}"`)];let C;if(At(p)==="string"&&rs(M)&&!M.tokens&&(C=/^{([^}]+)}$/.exec(p)))return[new Me(n,p,`"${g}" does not support interpolation syntax
6
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(C[1])} }\`.`)];const A=[];return r.layerType==="symbol"&&(g==="text-field"&&c&&!c.glyphs&&A.push(new Me(n,p,'use of "text-field" requires a style "glyphs" property')),g==="text-font"&&qo(Sa(p))&&Si(p.type)==="identity"&&A.push(new Me(n,p,'"text-font" does not support identity functions'))),A.concat(a({key:r.key,value:p,valueSpec:M,style:c,styleSpec:d,expressionContext:"property",propertyType:t,propertyKey:g}))}function Sh(r){return Ec(r,"paint")}function kc(r){return Ec(r,"layout")}function zc(r){let t=[];const n=r.value,a=r.key,c=r.style,d=r.styleSpec;n.type||n.ref||t.push(new Me(a,n,'either "type" or "ref" is required'));let p=Si(n.type);const g=Si(n.ref);if(n.id){const x=Si(n.id);for(let w=0;w<r.arrayIndex;w++){const M=c.layers[w];Si(M.id)===x&&t.push(new Me(a,n.id,`duplicate layer id "${n.id}", previously used at line ${M.id.__line__}`))}}if("ref"in n){let x;["type","source","source-layer","filter","layout"].forEach(w=>{w in n&&t.push(new Me(a,n[w],`"${w}" is prohibited for ref layers`))}),c.layers.forEach(w=>{Si(w.id)===g&&(x=w)}),x?x.ref?t.push(new Me(a,n.ref,"ref cannot reference another ref layer")):p=Si(x.type):t.push(new Me(a,n.ref,`ref layer "${g}" not found`))}else if(p!=="background")if(n.source){const x=c.sources&&c.sources[n.source],w=x&&Si(x.type);x?w==="vector"&&p==="raster"?t.push(new Me(a,n.source,`layer "${n.id}" requires a raster source`)):w!=="raster-dem"&&p==="hillshade"?t.push(new Me(a,n.source,`layer "${n.id}" requires a raster-dem source`)):w==="raster"&&p!=="raster"?t.push(new Me(a,n.source,`layer "${n.id}" requires a vector source`)):w!=="vector"||n["source-layer"]?w==="raster-dem"&&p!=="hillshade"?t.push(new Me(a,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!n.paint||!n.paint["line-gradient"]||w==="geojson"&&x.lineMetrics||t.push(new Me(a,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Me(a,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new Me(a,n.source,`source "${n.source}" not found`))}else t.push(new Me(a,n,'missing required property "source"'));return t=t.concat(Gr({key:a,value:n,valueSpec:d.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${a}.type`,value:n.type,valueSpec:d.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:n,objectKey:"type"}),filter:Cc,layout:x=>Gr({layer:n,key:x.key,value:x.value,style:x.style,styleSpec:x.styleSpec,validateSpec:x.validateSpec,objectElementValidators:{"*":w=>kc(at({layerType:p},w))}}),paint:x=>Gr({layer:n,key:x.key,value:x.value,style:x.style,styleSpec:x.styleSpec,validateSpec:x.validateSpec,objectElementValidators:{"*":w=>Sh(at({layerType:p},w))}})}})),t}function en(r){const t=r.value,n=r.key,a=At(t);return a!=="string"?[new Me(n,t,`string expected, ${a} found`)]:[]}const Ph={promoteId:function({key:r,value:t}){if(At(t)==="string")return en({key:r,value:t});{const n=[];for(const a in t)n.push(...en({key:`${r}.${a}`,value:t[a]}));return n}}};function Ch(r){const t=r.value,n=r.key,a=r.styleSpec,c=r.style,d=r.validateSpec;if(!t.type)return[new Me(n,t,'"type" is required')];const p=Si(t.type);let g;switch(p){case"vector":case"raster":return g=Gr({key:n,value:t,valueSpec:a[`source_${p.replace("-","_")}`],style:r.style,styleSpec:a,objectElementValidators:Ph,validateSpec:d}),g;case"raster-dem":return g=function(x){var w;const M=(w=x.sourceName)!==null&&w!==void 0?w:"",C=x.value,A=x.styleSpec,L=A.source_raster_dem,B=x.style;let j=[];const $=At(C);if(C===void 0)return j;if($!=="object")return j.push(new Me("source_raster_dem",C,`object expected, ${$} found`)),j;const X=Si(C.encoding)==="custom",se=["redFactor","greenFactor","blueFactor","baseShift"],Y=x.value.encoding?`"${x.value.encoding}"`:"Default";for(const D in C)!X&&se.includes(D)?j.push(new Me(D,C[D],`In "${M}": "${D}" is only valid when "encoding" is set to "custom". ${Y} encoding found`)):L[D]?j=j.concat(x.validateSpec({key:D,value:C[D],valueSpec:L[D],validateSpec:x.validateSpec,style:B,styleSpec:A})):j.push(new Me(D,C[D],`unknown property "${D}"`));return j}({sourceName:n,value:t,style:r.style,styleSpec:a,validateSpec:d}),g;case"geojson":if(g=Gr({key:n,value:t,valueSpec:a.source_geojson,style:c,styleSpec:a,validateSpec:d,objectElementValidators:Ph}),t.cluster)for(const x in t.clusterProperties){const[w,M]=t.clusterProperties[x],C=typeof w=="string"?[w,["accumulated"],["get",x]]:w;g.push(...Pa({key:`${n}.${x}.map`,value:M,expressionContext:"cluster-map"})),g.push(...Pa({key:`${n}.${x}.reduce`,value:C,expressionContext:"cluster-reduce"}))}return g;case"video":return Gr({key:n,value:t,valueSpec:a.source_video,style:c,validateSpec:d,styleSpec:a});case"image":return Gr({key:n,value:t,valueSpec:a.source_image,style:c,validateSpec:d,styleSpec:a});case"canvas":return[new Me(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Qn({key:`${n}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Ih(r){const t=r.value,n=r.styleSpec,a=n.light,c=r.style;let d=[];const p=At(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new Me("light",t,`object expected, ${p} found`)]),d;for(const g in t){const x=g.match(/^(.*)-transition$/);d=d.concat(x&&a[x[1]]&&a[x[1]].transition?r.validateSpec({key:g,value:t[g],valueSpec:n.transition,validateSpec:r.validateSpec,style:c,styleSpec:n}):a[g]?r.validateSpec({key:g,value:t[g],valueSpec:a[g],validateSpec:r.validateSpec,style:c,styleSpec:n}):[new Me(g,t[g],`unknown property "${g}"`)])}return d}function Eh(r){const t=r.value,n=r.styleSpec,a=n.sky,c=r.style,d=At(t);if(t===void 0)return[];if(d!=="object")return[new Me("sky",t,`object expected, ${d} found`)];let p=[];for(const g in t)p=p.concat(a[g]?r.validateSpec({key:g,value:t[g],valueSpec:a[g],style:c,styleSpec:n}):[new Me(g,t[g],`unknown property "${g}"`)]);return p}function kh(r){const t=r.value,n=r.styleSpec,a=n.terrain,c=r.style;let d=[];const p=At(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new Me("terrain",t,`object expected, ${p} found`)]),d;for(const g in t)d=d.concat(a[g]?r.validateSpec({key:g,value:t[g],valueSpec:a[g],validateSpec:r.validateSpec,style:c,styleSpec:n}):[new Me(g,t[g],`unknown property "${g}"`)]);return d}function zh(r){let t=[];const n=r.value,a=r.key;if(Array.isArray(n)){const c=[],d=[];for(const p in n)n[p].id&&c.includes(n[p].id)&&t.push(new Me(a,n,`all the sprites' ids must be unique, but ${n[p].id} is duplicated`)),c.push(n[p].id),n[p].url&&d.includes(n[p].url)&&t.push(new Me(a,n,`all the sprites' URLs must be unique, but ${n[p].url} is duplicated`)),d.push(n[p].url),t=t.concat(Gr({key:`${a}[${p}]`,value:n[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return t}return en({key:a,value:n})}const as={"*":()=>[],array:Mc,boolean:function(r){const t=r.value,n=r.key,a=At(t);return a!=="boolean"?[new Me(n,t,`boolean expected, ${a} found`)]:[]},number:Sc,color:function(r){const t=r.key,n=r.value,a=At(n);return a!=="string"?[new Me(t,n,`color expected, ${a} found`)]:gt.parse(String(n))?[]:[new Me(t,n,`color expected, "${n}" found`)]},constants:Mh,enum:Qn,filter:Cc,function:Pc,layer:zc,object:Gr,source:Ch,light:Ih,sky:Eh,terrain:kh,projection:function(r){const t=r.value,n=r.styleSpec,a=n.projection,c=r.style,d=At(t);if(t===void 0)return[];if(d!=="object")return[new Me("projection",t,`object expected, ${d} found`)];let p=[];for(const g in t)p=p.concat(a[g]?r.validateSpec({key:g,value:t[g],valueSpec:a[g],style:c,styleSpec:n}):[new Me(g,t[g],`unknown property "${g}"`)]);return p},projectionDefinition:function(r){const t=r.key;let n=r.value;n=n instanceof String?n.valueOf():n;const a=At(n);return a!=="array"||function(c){return Array.isArray(c)&&c.length===3&&typeof c[0]=="string"&&typeof c[1]=="string"&&typeof c[2]=="number"}(n)||function(c){return!!["interpolate","step","literal"].includes(c[0])}(n)?["array","string"].includes(a)?[]:[new Me(t,n,`projection expected, invalid type "${a}" found`)]:[new Me(t,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:en,formatted:function(r){return en(r).length===0?[]:Pa(r)},resolvedImage:function(r){return en(r).length===0?[]:Pa(r)},padding:function(r){const t=r.key,n=r.value;if(At(n)==="array"){if(n.length<1||n.length>4)return[new Me(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];const a={type:"number"};let c=[];for(let d=0;d<n.length;d++)c=c.concat(r.validateSpec({key:`${t}[${d}]`,value:n[d],validateSpec:r.validateSpec,valueSpec:a}));return c}return Sc({key:t,value:n,valueSpec:{}})},variableAnchorOffsetCollection:function(r){const t=r.key,n=r.value,a=At(n),c=r.styleSpec;if(a!=="array"||n.length<1||n.length%2!=0)return[new Me(t,n,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let p=0;p<n.length;p+=2)d=d.concat(Qn({key:`${t}[${p}]`,value:n[p],valueSpec:c.layout_symbol["text-anchor"]})),d=d.concat(Mc({key:`${t}[${p+1}]`,value:n[p+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:c}));return d},sprite:zh};function ea(r){const t=r.value,n=r.valueSpec,a=r.styleSpec;return r.validateSpec=ea,n.expression&&qo(Si(t))?Pc(r):n.expression&&Ma(Sa(t))?Pa(r):n.type&&as[n.type]?as[n.type](r):Gr(at({},r,{valueSpec:n.type?a[n.type]:n}))}function Mr(r){const t=r.value,n=r.key,a=en(r);return a.length||(t.indexOf("{fontstack}")===-1&&a.push(new Me(n,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&a.push(new Me(n,t,'"glyphs" url must include a "{range}" token'))),a}function gr(r,t=V){let n=[];return n=n.concat(ea({key:"",value:r,valueSpec:t.$root,styleSpec:t,style:r,validateSpec:ea,objectElementValidators:{glyphs:Mr,"*":()=>[]}})),r.constants&&(n=n.concat(Mh({key:"constants",value:r.constants}))),Ah(n)}function tn(r){return function(t){return r({...t,validateSpec:ea})}}function Ah(r){return[].concat(r).sort((t,n)=>t.line-n.line)}function mn(r){return function(...t){return Ah(r.apply(this,t))}}gr.source=mn(tn(Ch)),gr.sprite=mn(tn(zh)),gr.glyphs=mn(tn(Mr)),gr.light=mn(tn(Ih)),gr.sky=mn(tn(Eh)),gr.terrain=mn(tn(kh)),gr.layer=mn(tn(zc)),gr.filter=mn(tn(Cc)),gr.paintProperty=mn(tn(Sh)),gr.layoutProperty=mn(tn(kc));const gn=gr,Rh=gn.light,Ac=gn.sky,op=gn.paintProperty,Rc=gn.layoutProperty;function Dh(r,t){let n=!1;if(t&&t.length)for(const a of t)r.fire(new G(new Error(a.message))),n=!0;return n}class kn{constructor(t,n,a){const c=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const p=new Int32Array(this.arrayBuffer);t=p[0],this.d=(n=p[1])+2*(a=p[2]);for(let x=0;x<this.d*this.d;x++){const w=p[3+x],M=p[3+x+1];c.push(w===M?null:p.subarray(w,M))}const g=p[3+c.length+1];this.keys=p.subarray(p[3+c.length],g),this.bboxes=p.subarray(g),this.insert=this._insertReadonly}else{this.d=n+2*a;for(let p=0;p<this.d*this.d;p++)c.push([]);this.keys=[],this.bboxes=[]}this.n=n,this.extent=t,this.padding=a,this.scale=n/t,this.uid=0;const d=a/n*t;this.min=-d,this.max=t+d}insert(t,n,a,c,d){this._forEachCell(n,a,c,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(c),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,n,a,c,d,p){this.cells[d].push(p)}query(t,n,a,c,d){const p=this.min,g=this.max;if(t<=p&&n<=p&&g<=a&&g<=c&&!d)return Array.prototype.slice.call(this.keys);{const x=[];return this._forEachCell(t,n,a,c,this._queryCell,x,{},d),x}}_queryCell(t,n,a,c,d,p,g,x){const w=this.cells[d];if(w!==null){const M=this.keys,C=this.bboxes;for(let A=0;A<w.length;A++){const L=w[A];if(g[L]===void 0){const B=4*L;(x?x(C[B+0],C[B+1],C[B+2],C[B+3]):t<=C[B+2]&&n<=C[B+3]&&a>=C[B+0]&&c>=C[B+1])?(g[L]=!0,p.push(M[L])):g[L]=!1}}}}_forEachCell(t,n,a,c,d,p,g,x){const w=this._convertToCellCoord(t),M=this._convertToCellCoord(n),C=this._convertToCellCoord(a),A=this._convertToCellCoord(c);for(let L=w;L<=C;L++)for(let B=M;B<=A;B++){const j=this.d*B+L;if((!x||x(this._convertFromCellCoord(L),this._convertFromCellCoord(B),this._convertFromCellCoord(L+1),this._convertFromCellCoord(B+1)))&&d.call(this,t,n,a,c,j,p,g,x))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,n=3+this.cells.length+1+1;let a=0;for(let p=0;p<this.cells.length;p++)a+=this.cells[p].length;const c=new Int32Array(n+a+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let d=n;for(let p=0;p<t.length;p++){const g=t[p];c[3+p]=d,c.set(g,d),d+=g.length}return c[3+t.length]=d,c.set(this.keys,d),d+=this.keys.length,c[3+t.length+1]=d,c.set(this.bboxes,d),d+=this.bboxes.length,c.buffer}static serialize(t,n){const a=t.toArrayBuffer();return n&&n.push(a),{buffer:a}}static deserialize(t){return new kn(t.buffer)}}const zn={};function Ue(r,t,n={}){if(zn[r])throw new Error(`${r} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:r,writeable:!1}),zn[r]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}Ue("Object",Object),Ue("TransferableGridIndex",kn),Ue("Color",gt),Ue("Error",Error),Ue("AJAXError",Li),Ue("ResolvedImage",Rr),Ue("StylePropertyFunction",Wo),Ue("StyleExpression",yc,{omit:["_evaluator"]}),Ue("ZoomDependentExpression",vc),Ue("ZoomConstantExpression",xc),Ue("CompoundExpression",$r,{omit:["_evaluate"]});for(const r in ts)ts[r]._classRegistryKey||Ue(`Expression_${r}`,ts[r]);function Lh(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Dc(r){return r.$name||r.constructor._classRegistryKey}function Vs(r){return!function(t){if(t===null||typeof t!="object")return!1;const n=Dc(t);return!(!n||n==="Object")}(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||Lh(r)||Vi(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Us(r,t){if(Vs(r))return(Lh(r)||Vi(r))&&t&&t.push(r),ArrayBuffer.isView(r)&&t&&t.push(r.buffer),r instanceof ImageData&&t&&t.push(r.data.buffer),r;if(Array.isArray(r)){const d=[];for(const p of r)d.push(Us(p,t));return d}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const n=Dc(r);if(!n)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!zn[n])throw new Error(`${n} is not registered.`);const{klass:a}=zn[n],c=a.serialize?a.serialize(r,t):{};if(a.serialize){if(t&&c===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in r){if(!r.hasOwnProperty(d)||zn[n].omit.indexOf(d)>=0)continue;const p=r[d];c[d]=zn[n].shallow.indexOf(d)>=0?p:Us(p,t)}r instanceof Error&&(c.message=r.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(c.$name=n),c}function Ca(r){if(Vs(r))return r;if(Array.isArray(r))return r.map(Ca);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const t=Dc(r)||"Object";if(!zn[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:n}=zn[t];if(!n)throw new Error(`can't deserialize unregistered class ${t}`);if(n.deserialize)return n.deserialize(r);const a=Object.create(n.prototype);for(const c of Object.keys(r)){if(c==="$name")continue;const d=r[c];a[c]=zn[t].shallow.indexOf(c)>=0?d:Ca(d)}return a}class $s{constructor(){this.first=!0}update(t,n){const a=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=n):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=n),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=a,!0))}}const vt={"Latin-1 Supplement":r=>r>=128&&r<=255,"Hangul Jamo":r=>r>=4352&&r<=4607,Khmer:r=>r>=6016&&r<=6143,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Kanbun:r=>r>=12688&&r<=12703,"CJK Strokes":r=>r>=12736&&r<=12783,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Hangul Syllables":r=>r>=44032&&r<=55215,"Private Use Area":r=>r>=57344&&r<=63743,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519};function el(r){for(const t of r)if(il(t.charCodeAt(0)))return!0;return!1}function Bh(r){for(const t of r)if(!Fh(t.charCodeAt(0)))return!1;return!0}function tl(r){const t=r.map(n=>{try{return new RegExp(`\\p{sc=${n}}`,"u").source}catch{return null}}).filter(n=>n);return new RegExp(t.join("|"),"u")}const Lc=tl(["Arab","Dupl","Mong","Ougr","Syrc"]);function Fh(r){return!Lc.test(String.fromCodePoint(r))}const Oh=tl(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function il(r){return!(r!==746&&r!==747&&(r<4352||!(vt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||vt["CJK Compatibility"](r)||vt["CJK Strokes"](r)||!(!vt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||vt["Enclosed CJK Letters and Months"](r)||vt["Ideographic Description Characters"](r)||vt.Kanbun(r)||vt.Katakana(r)&&r!==12540||!(!vt["Halfwidth and Fullwidth Forms"](r)||r===65288||r===65289||r===65293||r>=65306&&r<=65310||r===65339||r===65341||r===65343||r>=65371&&r<=65503||r===65507||r>=65512&&r<=65519)||!(!vt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||vt["Vertical Forms"](r)||vt["Yijing Hexagram Symbols"](r)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(r))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(r))||Oh.test(String.fromCodePoint(r)))))}function jh(r){return!(il(r)||function(t){return!!(vt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||vt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||vt["Letterlike Symbols"](t)||vt["Number Forms"](t)||vt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||vt["Control Pictures"](t)&&t!==9251||vt["Optical Character Recognition"](t)||vt["Enclosed Alphanumerics"](t)||vt["Geometric Shapes"](t)||vt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||vt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||vt["CJK Symbols and Punctuation"](t)||vt.Katakana(t)||vt["Private Use Area"](t)||vt["CJK Compatibility Forms"](t)||vt["Small Form Variants"](t)||vt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(r))}const Nh=tl(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Bc(r){return Nh.test(String.fromCodePoint(r))}function Zh(r,t){return!(!t&&Bc(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||vt.Khmer(r))}function lp(r){for(const t of r)if(Bc(t.charCodeAt(0)))return!0;return!1}const ta=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(ta.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,t){return o(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const n=r.pluginURL,a=new Promise(d=>{this.loadScriptResolve=d});t(n);const c=new Promise(d=>setTimeout(()=>d(),this.TIMEOUT));if(yield Promise.race([a,c]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:n};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)})}};class ti{constructor(t,n){this.zoom=t,n?(this.now=n.now,this.fadeDuration=n.fadeDuration,this.zoomHistory=n.zoomHistory,this.transition=n.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new $s,this.transition={})}isSupportedScript(t){return function(n,a){for(const c of n)if(!Zh(c.charCodeAt(0),a))return!1;return!0}(t,ta.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,n=t-Math.floor(t),a=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:n+(1-n)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*n}}}class Gs{constructor(t,n){this.property=t,this.value=n,this.expression=function(a,c){if(qo(a))return new Wo(a,c);if(Ma(a)){const d=wh(a,c);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=a;return c.type==="color"&&typeof a=="string"?d=gt.parse(a):c.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?c.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?d=Yi.parse(a):c.type==="projectionDefinition"&&typeof a=="string"&&(d=mr.parse(a)):d=sr.parse(a),{kind:"constant",evaluate:()=>d}}}(n===void 0?t.specification.default:n,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,n,a){return this.property.possiblyEvaluate(this,t,n,a)}}class rl{constructor(t){this.property=t,this.value=new Gs(t,void 0)}transitioned(t,n){return new qs(this.property,this.value,n,hr({},t.transition,this.transition),t.now)}untransitioned(){return new qs(this.property,this.value,null,{},0)}}class Fc{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return dr(this._values[t].value.value)}setValue(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new rl(this._values[t].property)),this._values[t].value=new Gs(this._values[t].property,n===null?void 0:dr(n))}getTransition(t){return dr(this._values[t].transition)}setTransition(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new rl(this._values[t].property)),this._values[t].transition=dr(n)||void 0}serialize(){const t={};for(const n of Object.keys(this._values)){const a=this.getValue(n);a!==void 0&&(t[n]=a);const c=this.getTransition(n);c!==void 0&&(t[`${n}-transition`]=c)}return t}transitioned(t,n){const a=new Vh(this._properties);for(const c of Object.keys(this._values))a._values[c]=this._values[c].transitioned(t,n._values[c]);return a}untransitioned(){const t=new Vh(this._properties);for(const n of Object.keys(this._values))t._values[n]=this._values[n].untransitioned();return t}}class qs{constructor(t,n,a,c,d){this.property=t,this.value=n,this.begin=d+c.delay||0,this.end=this.begin+c.duration||0,t.specification.transition&&(c.delay||c.duration)&&(this.prior=a)}possiblyEvaluate(t,n,a){const c=t.now||0,d=this.value.possiblyEvaluate(t,n,a),p=this.prior;if(p){if(c>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(c<this.begin)return p.possiblyEvaluate(t,n,a);{const g=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(t,n,a),d,yi(g))}}return d}}class Vh{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,n,a){const c=new nl(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,n,a);return c}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Oc{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return dr(this._values[t].value)}setValue(t,n){this._values[t]=new Gs(this._values[t].property,n===null?void 0:dr(n))}serialize(){const t={};for(const n of Object.keys(this._values)){const a=this.getValue(n);a!==void 0&&(t[n]=a)}return t}possiblyEvaluate(t,n,a){const c=new nl(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,n,a);return c}}class _n{constructor(t,n,a){this.property=t,this.value=n,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,n,a,c){return this.property.evaluate(this.value,this.parameters,t,n,a,c)}}class nl{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ye{constructor(t){this.specification=t}possiblyEvaluate(t,n){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(n)}interpolate(t,n,a){const c=Qt[this.specification.type];return c?c(t,n,a):t}}class nt{constructor(t,n){this.specification=t,this.overrides=n}possiblyEvaluate(t,n,a,c){return new _n(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(n,null,{},a,c)}:t.expression,n)}interpolate(t,n,a){if(t.value.kind!=="constant"||n.value.kind!=="constant")return t;if(t.value.value===void 0||n.value.value===void 0)return new _n(this,{kind:"constant",value:void 0},t.parameters);const c=Qt[this.specification.type];if(c){const d=c(t.value.value,n.value.value,a);return new _n(this,{kind:"constant",value:d},t.parameters)}return t}evaluate(t,n,a,c,d,p){return t.kind==="constant"?t.value:t.evaluate(n,a,c,d,p)}}class Hs extends nt{possiblyEvaluate(t,n,a,c){if(t.value===void 0)return new _n(this,{kind:"constant",value:void 0},n);if(t.expression.kind==="constant"){const d=t.expression.evaluate(n,null,{},a,c),p=t.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,g=this._calculate(p,p,p,n);return new _n(this,{kind:"constant",value:g},n)}if(t.expression.kind==="camera"){const d=this._calculate(t.expression.evaluate({zoom:n.zoom-1}),t.expression.evaluate({zoom:n.zoom}),t.expression.evaluate({zoom:n.zoom+1}),n);return new _n(this,{kind:"constant",value:d},n)}return new _n(this,t.expression,n)}evaluate(t,n,a,c,d,p){if(t.kind==="source"){const g=t.evaluate(n,a,c,d,p);return this._calculate(g,g,g,n)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(n.zoom)-1},a,c),t.evaluate({zoom:Math.floor(n.zoom)},a,c),t.evaluate({zoom:Math.floor(n.zoom)+1},a,c),n):t.value}_calculate(t,n,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:n}:{from:a,to:n}}interpolate(t){return t}}class jc{constructor(t){this.specification=t}possiblyEvaluate(t,n,a,c){if(t.value!==void 0){if(t.expression.kind==="constant"){const d=t.expression.evaluate(n,null,{},a,c);return this._calculate(d,d,d,n)}return this._calculate(t.expression.evaluate(new ti(Math.floor(n.zoom-1),n)),t.expression.evaluate(new ti(Math.floor(n.zoom),n)),t.expression.evaluate(new ti(Math.floor(n.zoom+1),n)),n)}}_calculate(t,n,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:n}:{from:a,to:n}}interpolate(t){return t}}class Nc{constructor(t){this.specification=t}possiblyEvaluate(t,n,a,c){return!!t.expression.evaluate(n,null,{},a,c)}interpolate(){return!1}}class Sr{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const n in t){const a=t[n];a.specification.overridable&&this.overridableProperties.push(n);const c=this.defaultPropertyValues[n]=new Gs(a,void 0),d=this.defaultTransitionablePropertyValues[n]=new rl(a);this.defaultTransitioningPropertyValues[n]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=c.possiblyEvaluate({})}}}Ue("DataDrivenProperty",nt),Ue("DataConstantProperty",Ye),Ue("CrossFadedDataDrivenProperty",Hs),Ue("CrossFadedProperty",jc),Ue("ColorRampProperty",Nc);const Uh="-transition";class yn extends J{constructor(t,n){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),n.layout&&(this._unevaluatedLayout=new Oc(n.layout)),n.paint)){this._transitionablePaint=new Fc(n.paint);for(const a in t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(const a in t.layout)this.setLayoutProperty(a,t.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new nl(n.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,n,a={}){n!=null&&this._validate(Rc,`layers.${this.id}.layout.${t}`,t,n,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,n):this.visibility=n)}getPaintProperty(t){return t.endsWith(Uh)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,n,a={}){if(n!=null&&this._validate(op,`layers.${this.id}.paint.${t}`,t,n,a))return!1;if(t.endsWith(Uh))return this._transitionablePaint.setTransition(t.slice(0,-11),n||void 0),!1;{const c=this._transitionablePaint._values[t],d=c.property.specification["property-type"]==="cross-faded-data-driven",p=c.value.isDataDriven(),g=c.value;this._transitionablePaint.setValue(t,n),this._handleSpecialPaintPropertyUpdate(t);const x=this._transitionablePaint._values[t].value;return x.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(t,g,x)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,n,a){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,n){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,n)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,n)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),ga(t,(n,a)=>!(n===void 0||a==="layout"&&!Object.keys(n).length||a==="paint"&&!Object.keys(n).length))}_validate(t,n,a,c,d={}){return(!d||d.validate!==!1)&&Dh(this,t.call(gn,{key:n,layerType:this.type,objectKey:a,value:c,styleSpec:V,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const n=this.paint.get(t);if(n instanceof _n&&rs(n.property.specification)&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}}const ss={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ws{constructor(t,n){this._structArray=t,this._pos1=n*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class bi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,n){return t._trim(),n&&(t.isTransferred=!0,n.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const n=Object.create(this.prototype);return n.arrayBuffer=t.arrayBuffer,n.length=t.length,n.capacity=t.arrayBuffer.byteLength/n.bytesPerElement,n._refreshViews(),n}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const n=this.uint8;this._refreshViews(),n&&this.uint8.set(n)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ei(r,t=1){let n=0,a=0;return{members:r.map(c=>{const d=ss[c.type].BYTES_PER_ELEMENT,p=n=Zc(n,Math.max(t,d)),g=c.components||1;return a=Math.max(a,d),n+=d*g,{name:c.name,type:c.type,components:g,offset:p}}),size:Zc(n,Math.max(a,t)),alignment:t}}function Zc(r,t){return Math.ceil(r/t)*t}class Xs extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.int16[c+0]=n,this.int16[c+1]=a,t}}Xs.prototype.bytesPerElement=4,Ue("StructArrayLayout2i4",Xs);class al extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.int16[d+0]=n,this.int16[d+1]=a,this.int16[d+2]=c,t}}al.prototype.bytesPerElement=6,Ue("StructArrayLayout3i6",al);class An extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,n,a,c)}emplace(t,n,a,c,d){const p=4*t;return this.int16[p+0]=n,this.int16[p+1]=a,this.int16[p+2]=c,this.int16[p+3]=d,t}}An.prototype.bytesPerElement=8,Ue("StructArrayLayout4i8",An);class sl extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const g=this.length;return this.resize(g+1),this.emplace(g,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,g){const x=6*t;return this.int16[x+0]=n,this.int16[x+1]=a,this.int16[x+2]=c,this.int16[x+3]=d,this.int16[x+4]=p,this.int16[x+5]=g,t}}sl.prototype.bytesPerElement=12,Ue("StructArrayLayout2i4i12",sl);class Ks extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const g=this.length;return this.resize(g+1),this.emplace(g,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,g){const x=4*t,w=8*t;return this.int16[x+0]=n,this.int16[x+1]=a,this.uint8[w+4]=c,this.uint8[w+5]=d,this.uint8[w+6]=p,this.uint8[w+7]=g,t}}Ks.prototype.bytesPerElement=8,Ue("StructArrayLayout2i4ub8",Ks);class os extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.float32[c+0]=n,this.float32[c+1]=a,t}}os.prototype.bytesPerElement=8,Ue("StructArrayLayout2f8",os);class Ys extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,g,x,w,M){const C=this.length;return this.resize(C+1),this.emplace(C,t,n,a,c,d,p,g,x,w,M)}emplace(t,n,a,c,d,p,g,x,w,M,C){const A=10*t;return this.uint16[A+0]=n,this.uint16[A+1]=a,this.uint16[A+2]=c,this.uint16[A+3]=d,this.uint16[A+4]=p,this.uint16[A+5]=g,this.uint16[A+6]=x,this.uint16[A+7]=w,this.uint16[A+8]=M,this.uint16[A+9]=C,t}}Ys.prototype.bytesPerElement=20,Ue("StructArrayLayout10ui20",Ys);class Vc extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,g,x,w,M,C,A){const L=this.length;return this.resize(L+1),this.emplace(L,t,n,a,c,d,p,g,x,w,M,C,A)}emplace(t,n,a,c,d,p,g,x,w,M,C,A,L){const B=12*t;return this.int16[B+0]=n,this.int16[B+1]=a,this.int16[B+2]=c,this.int16[B+3]=d,this.uint16[B+4]=p,this.uint16[B+5]=g,this.uint16[B+6]=x,this.uint16[B+7]=w,this.int16[B+8]=M,this.int16[B+9]=C,this.int16[B+10]=A,this.int16[B+11]=L,t}}Vc.prototype.bytesPerElement=24,Ue("StructArrayLayout4i4ui4i24",Vc);class ls extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.float32[d+0]=n,this.float32[d+1]=a,this.float32[d+2]=c,t}}ls.prototype.bytesPerElement=12,Ue("StructArrayLayout3f12",ls);class Ia extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.uint32[1*t+0]=n,t}}Ia.prototype.bytesPerElement=4,Ue("StructArrayLayout1ul4",Ia);class Uc extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,g,x,w){const M=this.length;return this.resize(M+1),this.emplace(M,t,n,a,c,d,p,g,x,w)}emplace(t,n,a,c,d,p,g,x,w,M){const C=10*t,A=5*t;return this.int16[C+0]=n,this.int16[C+1]=a,this.int16[C+2]=c,this.int16[C+3]=d,this.int16[C+4]=p,this.int16[C+5]=g,this.uint32[A+3]=x,this.uint16[C+8]=w,this.uint16[C+9]=M,t}}Uc.prototype.bytesPerElement=20,Ue("StructArrayLayout6i1ul2ui20",Uc);class ol extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const g=this.length;return this.resize(g+1),this.emplace(g,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,g){const x=6*t;return this.int16[x+0]=n,this.int16[x+1]=a,this.int16[x+2]=c,this.int16[x+3]=d,this.int16[x+4]=p,this.int16[x+5]=g,t}}ol.prototype.bytesPerElement=12,Ue("StructArrayLayout2i2i2i12",ol);class Ea extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d){const p=this.length;return this.resize(p+1),this.emplace(p,t,n,a,c,d)}emplace(t,n,a,c,d,p){const g=4*t,x=8*t;return this.float32[g+0]=n,this.float32[g+1]=a,this.float32[g+2]=c,this.int16[x+6]=d,this.int16[x+7]=p,t}}Ea.prototype.bytesPerElement=16,Ue("StructArrayLayout2f1f2i16",Ea);class $c extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const g=this.length;return this.resize(g+1),this.emplace(g,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,g){const x=16*t,w=4*t,M=8*t;return this.uint8[x+0]=n,this.uint8[x+1]=a,this.float32[w+1]=c,this.float32[w+2]=d,this.int16[M+6]=p,this.int16[M+7]=g,t}}$c.prototype.bytesPerElement=16,Ue("StructArrayLayout2ub2f2i16",$c);class ll extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.uint16[d+0]=n,this.uint16[d+1]=a,this.uint16[d+2]=c,t}}ll.prototype.bytesPerElement=6,Ue("StructArrayLayout3ui6",ll);class cl extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X){const se=this.length;return this.resize(se+1),this.emplace(se,t,n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X)}emplace(t,n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X,se){const Y=24*t,D=12*t,U=48*t;return this.int16[Y+0]=n,this.int16[Y+1]=a,this.uint16[Y+2]=c,this.uint16[Y+3]=d,this.uint32[D+2]=p,this.uint32[D+3]=g,this.uint32[D+4]=x,this.uint16[Y+10]=w,this.uint16[Y+11]=M,this.uint16[Y+12]=C,this.float32[D+7]=A,this.float32[D+8]=L,this.uint8[U+36]=B,this.uint8[U+37]=j,this.uint8[U+38]=$,this.uint32[D+10]=X,this.int16[Y+22]=se,t}}cl.prototype.bytesPerElement=48,Ue("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",cl);class Gc extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X,se,Y,D,U,Q,fe,ze,xe,we,Le,Ae){const Fe=this.length;return this.resize(Fe+1),this.emplace(Fe,t,n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X,se,Y,D,U,Q,fe,ze,xe,we,Le,Ae)}emplace(t,n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X,se,Y,D,U,Q,fe,ze,xe,we,Le,Ae,Fe){const Pe=32*t,Ge=16*t;return this.int16[Pe+0]=n,this.int16[Pe+1]=a,this.int16[Pe+2]=c,this.int16[Pe+3]=d,this.int16[Pe+4]=p,this.int16[Pe+5]=g,this.int16[Pe+6]=x,this.int16[Pe+7]=w,this.uint16[Pe+8]=M,this.uint16[Pe+9]=C,this.uint16[Pe+10]=A,this.uint16[Pe+11]=L,this.uint16[Pe+12]=B,this.uint16[Pe+13]=j,this.uint16[Pe+14]=$,this.uint16[Pe+15]=X,this.uint16[Pe+16]=se,this.uint16[Pe+17]=Y,this.uint16[Pe+18]=D,this.uint16[Pe+19]=U,this.uint16[Pe+20]=Q,this.uint16[Pe+21]=fe,this.uint16[Pe+22]=ze,this.uint32[Ge+12]=xe,this.float32[Ge+13]=we,this.float32[Ge+14]=Le,this.uint16[Pe+30]=Ae,this.uint16[Pe+31]=Fe,t}}Gc.prototype.bytesPerElement=64,Ue("StructArrayLayout8i15ui1ul2f2ui64",Gc);class u extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.float32[1*t+0]=n,t}}u.prototype.bytesPerElement=4,Ue("StructArrayLayout1f4",u);class e extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.uint16[6*t+0]=n,this.float32[d+1]=a,this.float32[d+2]=c,t}}e.prototype.bytesPerElement=12,Ue("StructArrayLayout1ui2f12",e);class i extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=4*t;return this.uint32[2*t+0]=n,this.uint16[d+2]=a,this.uint16[d+3]=c,t}}i.prototype.bytesPerElement=8,Ue("StructArrayLayout1ul2ui8",i);class s extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.uint16[c+0]=n,this.uint16[c+1]=a,t}}s.prototype.bytesPerElement=4,Ue("StructArrayLayout2ui4",s);class l extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.uint16[1*t+0]=n,t}}l.prototype.bytesPerElement=2,Ue("StructArrayLayout1ui2",l);class h extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,n,a,c)}emplace(t,n,a,c,d){const p=4*t;return this.float32[p+0]=n,this.float32[p+1]=a,this.float32[p+2]=c,this.float32[p+3]=d,t}}h.prototype.bytesPerElement=16,Ue("StructArrayLayout4f16",h);class f extends Ws{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new De(this.anchorPointX,this.anchorPointY)}}f.prototype.size=20;class _ extends Uc{get(t){return new f(this,t)}}Ue("CollisionBoxArray",_);class v extends Ws{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}v.prototype.size=48;class T extends cl{get(t){return new v(this,t)}}Ue("PlacedSymbolArray",T);class P extends Ws{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}P.prototype.size=64;class E extends Gc{get(t){return new P(this,t)}}Ue("SymbolInstanceArray",E);class k extends u{getoffsetX(t){return this.float32[1*t+0]}}Ue("GlyphOffsetArray",k);class F extends al{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ue("SymbolLineVertexArray",F);class O extends Ws{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}O.prototype.size=12;class H extends e{get(t){return new O(this,t)}}Ue("TextAnchorOffsetArray",H);class q extends Ws{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}q.prototype.size=8;class W extends i{get(t){return new q(this,t)}}Ue("FeatureIndexArray",W);class K extends Xs{}class ee extends Xs{}class te extends Xs{}class re extends sl{}class oe extends Ks{}class ae extends os{}class pe extends Ys{}class me extends Vc{}class Se extends ls{}class Ce extends Ia{}class Te extends ol{}class je extends $c{}class Be extends ll{}class Ee extends s{}const He=Ei([{name:"a_pos",components:2,type:"Int16"}],4),{members:ft}=He;class st{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,n,a,c){const d=this.segments[this.segments.length-1];return t>st.MAX_VERTEX_ARRAY_LENGTH&&Zi(`Max vertices per segment is ${st.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${st.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+t>st.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==c?this.createNewSegment(n,a,c):d}createNewSegment(t,n,a){const c={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0,vaos:{}};return a!==void 0&&(c.sortKey=a),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(c),c}getOrCreateLatestSegment(t,n,a){return this.prepareSegment(0,t,n,a)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const n in t.vaos)t.vaos[n].destroy()}static simpleSegment(t,n,a,c){return new st([{vertexOffset:t,primitiveOffset:n,vertexLength:a,primitiveLength:c,vaos:{},sortKey:0}])}}function ui(r,t){return 256*(r=Ti(Math.floor(r),0,255))+Ti(Math.floor(t),0,255)}st.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ue("SegmentVector",st);const Ut=Ei([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var hi,ii,Ht,Zt={exports:{}},Gi={exports:{}},Bi={exports:{}},Ji=function(){if(Ht)return Zt.exports;Ht=1;var r=(hi||(hi=1,Gi.exports=function(n,a){var c,d,p,g,x,w,M,C;for(d=n.length-(c=3&n.length),p=a,x=3432918353,w=461845907,C=0;C<d;)M=255&n.charCodeAt(C)|(255&n.charCodeAt(++C))<<8|(255&n.charCodeAt(++C))<<16|(255&n.charCodeAt(++C))<<24,++C,p=27492+(65535&(g=5*(65535&(p=(p^=M=(65535&(M=(M=(65535&M)*x+(((M>>>16)*x&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(g>>>16)&65535)<<16);switch(M=0,c){case 3:M^=(255&n.charCodeAt(C+2))<<16;case 2:M^=(255&n.charCodeAt(C+1))<<8;case 1:p^=M=(65535&(M=(M=(65535&(M^=255&n.charCodeAt(C)))*x+(((M>>>16)*x&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295}return p^=n.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0}),Gi.exports),t=(ii||(ii=1,Bi.exports=function(n,a){for(var c,d=n.length,p=a^d,g=0;d>=4;)c=1540483477*(65535&(c=255&n.charCodeAt(g)|(255&n.charCodeAt(++g))<<8|(255&n.charCodeAt(++g))<<16|(255&n.charCodeAt(++g))<<24))+((1540483477*(c>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),d-=4,++g;switch(d){case 3:p^=(255&n.charCodeAt(g+2))<<16;case 2:p^=(255&n.charCodeAt(g+1))<<8;case 1:p=1540483477*(65535&(p^=255&n.charCodeAt(g)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0}),Bi.exports);return Zt.exports=r,Zt.exports.murmur3=r,Zt.exports.murmur2=t,Zt.exports}(),lr=le(Ji);class xn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,n,a,c){this.ids.push(ia(t)),this.positions.push(n,a,c)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const n=ia(t);let a=0,c=this.ids.length-1;for(;a<c;){const p=a+c>>1;this.ids[p]>=n?c=p:a=p+1}const d=[];for(;this.ids[a]===n;)d.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return d}static serialize(t,n){const a=new Float64Array(t.ids),c=new Uint32Array(t.positions);return Rn(a,c,0,a.length-1),n&&n.push(a.buffer,c.buffer),{ids:a,positions:c}}static deserialize(t){const n=new xn;return n.ids=t.ids,n.positions=t.positions,n.indexed=!0,n}}function ia(r){const t=+r;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:lr(String(r))}function Rn(r,t,n,a){for(;n<a;){const c=r[n+a>>1];let d=n-1,p=a+1;for(;;){do d++;while(r[d]<c);do p--;while(r[p]>c);if(d>=p)break;Dn(r,d,p),Dn(t,3*d,3*p),Dn(t,3*d+1,3*p+1),Dn(t,3*d+2,3*p+2)}p-n<a-p?(Rn(r,t,n,p),n=p+1):(Rn(r,t,p+1,a),a=p)}}function Dn(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}Ue("FeaturePositionMap",xn);class vn{constructor(t,n){this.gl=t.gl,this.location=n}}class ka extends vn{constructor(t,n){super(t,n),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class za extends vn{constructor(t,n){super(t,n),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class Dr extends vn{constructor(t,n){super(t,n),this.current=gt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const ra=new Float32Array(16);function Ln(r){return[ui(255*r.r,255*r.g),ui(255*r.b,255*r.a)]}class Bn{constructor(t,n,a){this.value=t,this.uniformNames=n.map(c=>`u_${c}`),this.type=a}setUniform(t,n,a){t.set(a.constantOr(this.value))}getBinding(t,n,a){return this.type==="color"?new Dr(t,n):new ka(t,n)}}class mi{constructor(t,n){this.uniformNames=n.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,n){this.pixelRatioFrom=n.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=n.tlbr,this.patternTo=t.tlbr}setUniform(t,n,a,c){const d=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;d&&t.set(d)}getBinding(t,n,a){return a.substr(0,9)==="u_pattern"?new za(t,n):new ka(t,n)}}class ri{constructor(t,n,a,c){this.expression=t,this.type=a,this.maxValue=0,this.paintVertexAttributes=n.map(d=>({name:`a_${d}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(t,n,a,c,d){const p=this.paintVertexArray.length,g=this.expression.evaluate(new ti(0),n,{},c,[],d);this.paintVertexArray.resize(t),this._setPaintValue(p,t,g)}updatePaintArray(t,n,a,c){const d=this.expression.evaluate({zoom:0},a,c);this._setPaintValue(t,n,d)}_setPaintValue(t,n,a){if(this.type==="color"){const c=Ln(a);for(let d=t;d<n;d++)this.paintVertexArray.emplace(d,c[0],c[1])}else{for(let c=t;c<n;c++)this.paintVertexArray.emplace(c,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Pi{constructor(t,n,a,c,d,p){this.expression=t,this.uniformNames=n.map(g=>`u_${g}_t`),this.type=a,this.useIntegerZoom=c,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=n.map(g=>({name:`a_${g}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(t,n,a,c,d){const p=this.expression.evaluate(new ti(this.zoom),n,{},c,[],d),g=this.expression.evaluate(new ti(this.zoom+1),n,{},c,[],d),x=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(x,t,p,g)}updatePaintArray(t,n,a,c){const d=this.expression.evaluate({zoom:this.zoom},a,c),p=this.expression.evaluate({zoom:this.zoom+1},a,c);this._setPaintValue(t,n,d,p)}_setPaintValue(t,n,a,c){if(this.type==="color"){const d=Ln(a),p=Ln(c);for(let g=t;g<n;g++)this.paintVertexArray.emplace(g,d[0],d[1],p[0],p[1])}else{for(let d=t;d<n;d++)this.paintVertexArray.emplace(d,a,c);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(c))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,n){const a=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,c=Ti(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(c)}getBinding(t,n,a){return new ka(t,n)}}class di{constructor(t,n,a,c,d,p){this.expression=t,this.type=n,this.useIntegerZoom=a,this.zoom=c,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(t,n,a){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(c,t,n.patterns&&n.patterns[this.layerId],a)}updatePaintArray(t,n,a,c,d){this._setPaintValues(t,n,a.patterns&&a.patterns[this.layerId],d)}_setPaintValues(t,n,a,c){if(!c||!a)return;const{min:d,mid:p,max:g}=a,x=c[d],w=c[p],M=c[g];if(x&&w&&M)for(let C=t;C<n;C++)this.zoomInPaintVertexArray.emplace(C,w.tl[0],w.tl[1],w.br[0],w.br[1],x.tl[0],x.tl[1],x.br[0],x.br[1],w.pixelRatio,x.pixelRatio),this.zoomOutPaintVertexArray.emplace(C,w.tl[0],w.tl[1],w.br[0],w.br[1],M.tl[0],M.tl[1],M.br[0],M.br[1],w.pixelRatio,M.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Ut.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Ut.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class $h{constructor(t,n,a){this.binders={},this._buffers=[];const c=[];for(const d in t.paint._values){if(!a(d))continue;const p=t.paint.get(d);if(!(p instanceof _n&&rs(p.property.specification)))continue;const g=cp(d,t.type),x=p.value,w=p.property.specification.type,M=p.property.useIntegerZoom,C=p.property.specification["property-type"],A=C==="cross-faded"||C==="cross-faded-data-driven";if(x.kind==="constant")this.binders[d]=A?new mi(x.value,g):new Bn(x.value,g,w),c.push(`/u_${d}`);else if(x.kind==="source"||A){const L=Gh(d,w,"source");this.binders[d]=A?new di(x,w,M,n,L,t.id):new ri(x,g,w,L),c.push(`/a_${d}`)}else{const L=Gh(d,w,"composite");this.binders[d]=new Pi(x,g,w,M,n,L),c.push(`/z_${d}`)}}this.cacheKey=c.sort().join("")}getMaxValue(t){const n=this.binders[t];return n instanceof ri||n instanceof Pi?n.maxValue:0}populatePaintArrays(t,n,a,c,d){for(const p in this.binders){const g=this.binders[p];(g instanceof ri||g instanceof Pi||g instanceof di)&&g.populatePaintArray(t,n,a,c,d)}}setConstantPatternPositions(t,n){for(const a in this.binders){const c=this.binders[a];c instanceof mi&&c.setConstantPatternPositions(t,n)}}updatePaintArrays(t,n,a,c,d){let p=!1;for(const g in t){const x=n.getPositions(g);for(const w of x){const M=a.feature(w.index);for(const C in this.binders){const A=this.binders[C];if((A instanceof ri||A instanceof Pi||A instanceof di)&&A.expression.isStateDependent===!0){const L=c.paint.get(C);A.expression=L.value,A.updatePaintArray(w.start,w.end,M,t[g],d),p=!0}}}}return p}defines(){const t=[];for(const n in this.binders){const a=this.binders[n];(a instanceof Bn||a instanceof mi)&&t.push(...a.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return t}getBinderAttributes(){const t=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof ri||a instanceof Pi)for(let c=0;c<a.paintVertexAttributes.length;c++)t.push(a.paintVertexAttributes[c].name);else if(a instanceof di)for(let c=0;c<Ut.members.length;c++)t.push(Ut.members[c].name)}return t}getBinderUniforms(){const t=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof Bn||a instanceof mi||a instanceof Pi)for(const c of a.uniformNames)t.push(c)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,n){const a=[];for(const c in this.binders){const d=this.binders[c];if(d instanceof Bn||d instanceof mi||d instanceof Pi){for(const p of d.uniformNames)if(n[p]){const g=d.getBinding(t,n[p],p);a.push({name:p,property:c,binding:g})}}}return a}setUniforms(t,n,a,c){for(const{name:d,property:p,binding:g}of n)this.binders[p].setUniform(g,c,a.get(p),d)}updatePaintBuffers(t){this._buffers=[];for(const n in this.binders){const a=this.binders[n];if(t&&a instanceof di){const c=t.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(a instanceof ri||a instanceof Pi)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(t){for(const n in this.binders){const a=this.binders[n];(a instanceof ri||a instanceof Pi||a instanceof di)&&a.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const n=this.binders[t];(n instanceof ri||n instanceof Pi||n instanceof di)&&n.destroy()}}}class Aa{constructor(t,n,a=()=>!0){this.programConfigurations={};for(const c of t)this.programConfigurations[c.id]=new $h(c,n,a);this.needsUpload=!1,this._featureMap=new xn,this._bufferOffset=0}populatePaintArrays(t,n,a,c,d,p){for(const g in this.programConfigurations)this.programConfigurations[g].populatePaintArrays(t,n,c,d,p);n.id!==void 0&&this._featureMap.add(n.id,a,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,n,a,c){for(const d of a)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(t,this._featureMap,n,d,c)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const n in this.programConfigurations)this.programConfigurations[n].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function cp(r,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[r]||[r.replace(`${t}-`,"").replace(/-/g,"_")]}function Gh(r,t,n){const a={color:{source:os,composite:h},number:{source:u,composite:os}},c=function(d){return{"line-pattern":{source:pe,composite:pe},"fill-pattern":{source:pe,composite:pe},"fill-extrusion-pattern":{source:pe,composite:pe}}[d]}(r);return c&&c[n]||a[t][n]}Ue("ConstantBinder",Bn),Ue("CrossFadedConstantBinder",mi),Ue("SourceExpressionBinder",ri),Ue("CrossFadedCompositeBinder",di),Ue("CompositeExpressionBinder",Pi),Ue("ProgramConfiguration",$h,{omit:["_buffers"]}),Ue("ProgramConfigurationSet",Aa);const qc=Math.pow(2,14)-1,qh=-qc-1;function Lr(r){const t=Ft/r.extent,n=r.loadGeometry();for(let a=0;a<n.length;a++){const c=n[a];for(let d=0;d<c.length;d++){const p=c[d],g=Math.round(p.x*t),x=Math.round(p.y*t);p.x=Ti(g,qh,qc),p.y=Ti(x,qh,qc),(g<p.x||g>p.x+1||x<p.y||x>p.y+1)&&Zi("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function na(r,t){return{type:r.type,id:r.id,properties:r.properties,geometry:t?Lr(r):[]}}const Hc=-32768;function Hh(r,t,n,a,c){r.emplaceBack(Hc+8*t+a,Hc+8*n+c)}class Js{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ee,this.indexArray=new Be,this.segments=new st,this.programConfigurations=new Aa(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){const c=this.layers[0],d=[];let p=null,g=!1,x=c.type==="heatmap";if(c.type==="circle"){const M=c;p=M.layout.get("circle-sort-key"),g=!p.isConstant(),x=x||M.paint.get("circle-pitch-alignment")==="map"}const w=x?n.subdivisionGranularity.circle:1;for(const{feature:M,id:C,index:A,sourceLayerIndex:L}of t){const B=this.layers[0]._featureFilter.needGeometry,j=na(M,B);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),j,a))continue;const $=g?p.evaluate(j,{},a):void 0,X={id:C,properties:M.properties,type:M.type,sourceLayerIndex:L,index:A,geometry:B?j.geometry:Lr(M),patterns:{},sortKey:$};d.push(X)}g&&d.sort((M,C)=>M.sortKey-C.sortKey);for(const M of d){const{geometry:C,index:A,sourceLayerIndex:L}=M,B=t[A].feature;this.addFeature(M,C,A,a,w),n.featureIndex.insert(B,C,A,L,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ft),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,n,a,c,d=1){let p;switch(d){case 1:p=[0,7];break;case 3:p=[0,2,5,7];break;case 5:p=[0,1,3,4,6,7];break;case 7:p=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${d}; valid values are 1, 3, 5, 7.`)}const g=p.length;for(const x of n)for(const w of x){const M=w.x,C=w.y;if(M<0||M>=Ft||C<0||C>=Ft)continue;const A=this.segments.prepareSegment(g*g,this.layoutVertexArray,this.indexArray,t.sortKey),L=A.vertexLength;for(let B=0;B<g;B++)for(let j=0;j<g;j++)Hh(this.layoutVertexArray,M,C,p[j],p[B]);for(let B=0;B<g-1;B++)for(let j=0;j<g-1;j++){const $=L+B*g+j,X=L+(B+1)*g+j;this.indexArray.emplaceBack($,X+1,$+1),this.indexArray.emplaceBack($,X,X+1)}A.vertexLength+=g*g,A.primitiveLength+=(g-1)*(g-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,{},c)}}function Wc(r,t){for(let n=0;n<r.length;n++)if(Qs(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(Qs(r,t[n]))return!0;return!!up(r,t)}function Xc(r,t,n){return!!Qs(r,t)||!!hp(t,r,n)}function gm(r,t){if(r.length===1)return ym(t,r[0]);for(let n=0;n<t.length;n++){const a=t[n];for(let c=0;c<a.length;c++)if(Qs(r,a[c]))return!0}for(let n=0;n<r.length;n++)if(ym(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(up(r,t[n]))return!0;return!1}function ev(r,t,n){if(r.length>1){if(up(r,t))return!0;for(let a=0;a<t.length;a++)if(hp(t[a],r,n))return!0}for(let a=0;a<r.length;a++)if(hp(r[a],t,n))return!0;return!1}function up(r,t){if(r.length===0||t.length===0)return!1;for(let n=0;n<r.length-1;n++){const a=r[n],c=r[n+1];for(let d=0;d<t.length-1;d++)if(tv(a,c,t[d],t[d+1]))return!0}return!1}function tv(r,t,n,a){return Wt(r,n,a)!==Wt(t,n,a)&&Wt(r,t,n)!==Wt(r,t,a)}function hp(r,t,n){const a=n*n;if(t.length===1)return r.distSqr(t[0])<a;for(let c=1;c<t.length;c++)if(_m(r,t[c-1],t[c])<a)return!0;return!1}function _m(r,t,n){const a=t.distSqr(n);if(a===0)return r.distSqr(t);const c=((r.x-t.x)*(n.x-t.x)+(r.y-t.y)*(n.y-t.y))/a;return r.distSqr(c<0?t:c>1?n:n.sub(t)._mult(c)._add(t))}function ym(r,t){for(let n=0;n<r.length;n++)if(Qs(r[n],t))return!0;return!1}function Qs(r,t){let n=!1;for(let a=0,c=r.length-1;a<r.length;c=a++){const d=r[a],p=r[c];d.y>t.y!=p.y>t.y&&t.x<(p.x-d.x)*(t.y-d.y)/(p.y-d.y)+d.x&&(n=!n)}return n}function iv(r,t,n){const a=n[0],c=n[2];if(r.x<a.x&&t.x<a.x||r.x>c.x&&t.x>c.x||r.y<a.y&&t.y<a.y||r.y>c.y&&t.y>c.y)return!1;const d=Wt(r,t,n[0]);return d!==Wt(r,t,n[1])||d!==Wt(r,t,n[2])||d!==Wt(r,t,n[3])}function Kc(r,t,n){const a=t.paint.get(r).value;return a.kind==="constant"?a.value:n.programConfigurations.get(t.id).getMaxValue(r)}function Wh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Xh(r,t,n,a,c){if(!t[0]&&!t[1])return r;const d=De.convert(t)._mult(c);n==="viewport"&&d._rotate(-a);const p=[];for(let g=0;g<r.length;g++)p.push(r[g].sub(d));return p}let xm,vm;Ue("CircleBucket",Js,{omit:["layers"]});var rv={get paint(){return vm=vm||new Sr({"circle-radius":new nt(V.paint_circle["circle-radius"]),"circle-color":new nt(V.paint_circle["circle-color"]),"circle-blur":new nt(V.paint_circle["circle-blur"]),"circle-opacity":new nt(V.paint_circle["circle-opacity"]),"circle-translate":new Ye(V.paint_circle["circle-translate"]),"circle-translate-anchor":new Ye(V.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ye(V.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ye(V.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new nt(V.paint_circle["circle-stroke-width"]),"circle-stroke-color":new nt(V.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new nt(V.paint_circle["circle-stroke-opacity"])})},get layout(){return xm=xm||new Sr({"circle-sort-key":new nt(V.layout_circle["circle-sort-key"])})}};class nv extends yn{constructor(t){super(t,rv)}createBucket(t){return new Js(t)}queryRadius(t){const n=t;return Kc("circle-radius",this,n)+Kc("circle-stroke-width",this,n)+Wh(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,unwrappedTileID:g,getElevation:x}){const w=Xh(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,p),M=this.paint.get("circle-radius").evaluate(n,a)+this.paint.get("circle-stroke-width").evaluate(n,a),C=this.paint.get("circle-pitch-alignment")==="map",A=C?w:function(B,j,$,X){return B.map(se=>bm(se,j,$,X))}(w,d,g,x),L=C?M*p:M;for(const B of c)for(const j of B){const $=C?j:bm(j,d,g,x);let X=L;const se=d.projectTileCoordinates(j.x,j.y,g,x).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?X*=se/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(X*=d.cameraToCenterDistance/se),Xc(A,$,X))return!0}return!1}}function bm(r,t,n,a){const c=t.projectTileCoordinates(r.x,r.y,n,a).point;return new De((.5*c.x+.5)*t.width,(.5*-c.y+.5)*t.height)}class wm extends Js{}let Tm;Ue("HeatmapBucket",wm,{omit:["layers"]});var av={get paint(){return Tm=Tm||new Sr({"heatmap-radius":new nt(V.paint_heatmap["heatmap-radius"]),"heatmap-weight":new nt(V.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ye(V.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Nc(V.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ye(V.paint_heatmap["heatmap-opacity"])})}};function dp(r,{width:t,height:n},a,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==t*n*a)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${t*n*a}`)}else c=new Uint8Array(t*n*a);return r.width=t,r.height=n,r.data=c,r}function Mm(r,{width:t,height:n},a){if(t===r.width&&n===r.height)return;const c=dp({},{width:t,height:n},a);pp(r,c,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,t),height:Math.min(r.height,n)},a),r.width=t,r.height=n,r.data=c.data}function pp(r,t,n,a,c,d){if(c.width===0||c.height===0)return t;if(c.width>r.width||c.height>r.height||n.x>r.width-c.width||n.y>r.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>t.width||c.height>t.height||a.x>t.width-c.width||a.y>t.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const p=r.data,g=t.data;if(p===g)throw new Error("srcData equals dstData, so image is already copied");for(let x=0;x<c.height;x++){const w=((n.y+x)*r.width+n.x)*d,M=((a.y+x)*t.width+a.x)*d;for(let C=0;C<c.width*d;C++)g[M+C]=p[w+C]}return t}class Yc{constructor(t,n){dp(this,t,1,n)}resize(t){Mm(this,t,1)}clone(){return new Yc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,c,d){pp(t,n,a,c,d,1)}}class rn{constructor(t,n){dp(this,t,4,n)}resize(t){Mm(this,t,4)}replace(t,n){n?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new rn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,c,d){pp(t,n,a,c,d,4)}}function Sm(r){const t={},n=r.resolution||256,a=r.clips?r.clips.length:1,c=r.image||new rn({width:n,height:a});if(Math.log(n)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${n}`);const d=(p,g,x)=>{t[r.evaluationKey]=x;const w=r.expression.evaluate(t);c.data[p+g+0]=Math.floor(255*w.r/w.a),c.data[p+g+1]=Math.floor(255*w.g/w.a),c.data[p+g+2]=Math.floor(255*w.b/w.a),c.data[p+g+3]=Math.floor(255*w.a)};if(r.clips)for(let p=0,g=0;p<a;++p,g+=4*n)for(let x=0,w=0;x<n;x++,w+=4){const M=x/(n-1),{start:C,end:A}=r.clips[p];d(g,w,C*(1-M)+A*M)}else for(let p=0,g=0;p<n;p++,g+=4)d(0,g,p/(n-1));return c}Ue("AlphaImage",Yc),Ue("RGBAImage",rn);const fp="big-fb";class sv extends yn{createBucket(t){return new wm(t)}constructor(t){super(t,av),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Sm({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(fp)&&this.heatmapFbos.delete(fp)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let Pm;var ov={get paint(){return Pm=Pm||new Sr({"hillshade-illumination-direction":new Ye(V.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ye(V.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ye(V.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ye(V.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ye(V.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ye(V.paint_hillshade["hillshade-accent-color"])})}};class lv extends yn{constructor(t){super(t,ov)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const cv=Ei([{name:"a_pos",components:2,type:"Int16"}],4),{members:uv}=cv;function mp(r,t,n){const a=n.patternDependencies;let c=!1;for(const d of t){const p=d.paint.get(`${r}-pattern`);p.isConstant()||(c=!0);const g=p.constantOr(null);g&&(c=!0,a[g.to]=!0,a[g.from]=!0)}return c}function gp(r,t,n,a,c){const d=c.patternDependencies;for(const p of t){const g=p.paint.get(`${r}-pattern`).value;if(g.kind!=="constant"){let x=g.evaluate({zoom:a-1},n,{},c.availableImages),w=g.evaluate({zoom:a},n,{},c.availableImages),M=g.evaluate({zoom:a+1},n,{},c.availableImages);x=x&&x.name?x.name:x,w=w&&w.name?w.name:w,M=M&&M.name?M.name:M,d[x]=!0,d[w]=!0,d[M]=!0,n.patterns[p.id]={min:x,mid:w,max:M}}}return n}function Cm(r,t,n,a,c){let d;if(c===function(p,g,x,w){let M=0;for(let C=g,A=x-w;C<x;C+=w)M+=(p[A]-p[C])*(p[C+1]+p[A+1]),A=C;return M}(r,t,n,a)>0)for(let p=t;p<n;p+=a)d=zm(p/a|0,r[p],r[p+1],d);else for(let p=n-a;p>=t;p-=a)d=zm(p/a|0,r[p],r[p+1],d);return d&&ul(d,d.next)&&(tu(d),d=d.next),d}function eo(r,t){if(!r)return r;t||(t=r);let n,a=r;do if(n=!1,a.steiner||!ul(a,a.next)&&ki(a.prev,a,a.next)!==0)a=a.next;else{if(tu(a),a=t=a.prev,a===a.next)break;n=!0}while(n||a!==t);return t}function Jc(r,t,n,a,c,d,p){if(!r)return;!p&&d&&function(x,w,M,C){let A=x;do A.z===0&&(A.z=_p(A.x,A.y,w,M,C)),A.prevZ=A.prev,A.nextZ=A.next,A=A.next;while(A!==x);A.prevZ.nextZ=null,A.prevZ=null,function(L){let B,j=1;do{let $,X=L;L=null;let se=null;for(B=0;X;){B++;let Y=X,D=0;for(let Q=0;Q<j&&(D++,Y=Y.nextZ,Y);Q++);let U=j;for(;D>0||U>0&&Y;)D!==0&&(U===0||!Y||X.z<=Y.z)?($=X,X=X.nextZ,D--):($=Y,Y=Y.nextZ,U--),se?se.nextZ=$:L=$,$.prevZ=se,se=$;X=Y}se.nextZ=null,j*=2}while(B>1)}(A)}(r,a,c,d);let g=r;for(;r.prev!==r.next;){const x=r.prev,w=r.next;if(d?dv(r,a,c,d):hv(r))t.push(x.i,r.i,w.i),tu(r),r=w.next,g=w.next;else if((r=w)===g){p?p===1?Jc(r=pv(eo(r),t),t,n,a,c,d,2):p===2&&fv(r,t,n,a,c,d):Jc(eo(r),t,n,a,c,d,1);break}}}function hv(r){const t=r.prev,n=r,a=r.next;if(ki(t,n,a)>=0)return!1;const c=t.x,d=n.x,p=a.x,g=t.y,x=n.y,w=a.y,M=Math.min(c,d,p),C=Math.min(g,x,w),A=Math.max(c,d,p),L=Math.max(g,x,w);let B=a.next;for(;B!==t;){if(B.x>=M&&B.x<=A&&B.y>=C&&B.y<=L&&Qc(c,g,d,x,p,w,B.x,B.y)&&ki(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function dv(r,t,n,a){const c=r.prev,d=r,p=r.next;if(ki(c,d,p)>=0)return!1;const g=c.x,x=d.x,w=p.x,M=c.y,C=d.y,A=p.y,L=Math.min(g,x,w),B=Math.min(M,C,A),j=Math.max(g,x,w),$=Math.max(M,C,A),X=_p(L,B,t,n,a),se=_p(j,$,t,n,a);let Y=r.prevZ,D=r.nextZ;for(;Y&&Y.z>=X&&D&&D.z<=se;){if(Y.x>=L&&Y.x<=j&&Y.y>=B&&Y.y<=$&&Y!==c&&Y!==p&&Qc(g,M,x,C,w,A,Y.x,Y.y)&&ki(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,D.x>=L&&D.x<=j&&D.y>=B&&D.y<=$&&D!==c&&D!==p&&Qc(g,M,x,C,w,A,D.x,D.y)&&ki(D.prev,D,D.next)>=0))return!1;D=D.nextZ}for(;Y&&Y.z>=X;){if(Y.x>=L&&Y.x<=j&&Y.y>=B&&Y.y<=$&&Y!==c&&Y!==p&&Qc(g,M,x,C,w,A,Y.x,Y.y)&&ki(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;D&&D.z<=se;){if(D.x>=L&&D.x<=j&&D.y>=B&&D.y<=$&&D!==c&&D!==p&&Qc(g,M,x,C,w,A,D.x,D.y)&&ki(D.prev,D,D.next)>=0)return!1;D=D.nextZ}return!0}function pv(r,t){let n=r;do{const a=n.prev,c=n.next.next;!ul(a,c)&&Em(a,n,n.next,c)&&eu(a,c)&&eu(c,a)&&(t.push(a.i,n.i,c.i),tu(n),tu(n.next),n=r=c),n=n.next}while(n!==r);return eo(n)}function fv(r,t,n,a,c,d){let p=r;do{let g=p.next.next;for(;g!==p.prev;){if(p.i!==g.i&&xv(p,g)){let x=km(p,g);return p=eo(p,p.next),x=eo(x,x.next),Jc(p,t,n,a,c,d,0),void Jc(x,t,n,a,c,d,0)}g=g.next}p=p.next}while(p!==r)}function mv(r,t){let n=r.x-t.x;return n===0&&(n=r.y-t.y,n===0)&&(n=(r.next.y-r.y)/(r.next.x-r.x)-(t.next.y-t.y)/(t.next.x-t.x)),n}function gv(r,t){const n=function(c,d){let p=d;const g=c.x,x=c.y;let w,M=-1/0;if(ul(c,p))return p;do{if(ul(c,p.next))return p.next;if(x<=p.y&&x>=p.next.y&&p.next.y!==p.y){const j=p.x+(x-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(j<=g&&j>M&&(M=j,w=p.x<p.next.x?p:p.next,j===g))return w}p=p.next}while(p!==d);if(!w)return null;const C=w,A=w.x,L=w.y;let B=1/0;p=w;do{if(g>=p.x&&p.x>=A&&g!==p.x&&Im(x<L?g:M,x,A,L,x<L?M:g,x,p.x,p.y)){const j=Math.abs(x-p.y)/(g-p.x);eu(p,c)&&(j<B||j===B&&(p.x>w.x||p.x===w.x&&_v(w,p)))&&(w=p,B=j)}p=p.next}while(p!==C);return w}(r,t);if(!n)return t;const a=km(n,r);return eo(a,a.next),eo(n,n.next)}function _v(r,t){return ki(r.prev,r,t.prev)<0&&ki(t.next,r,r.next)<0}function _p(r,t,n,a,c){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-n)*c|0)|r<<8))|r<<4))|r<<2))|r<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*c|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function yv(r){let t=r,n=r;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==r);return n}function Im(r,t,n,a,c,d,p,g){return(c-p)*(t-g)>=(r-p)*(d-g)&&(r-p)*(a-g)>=(n-p)*(t-g)&&(n-p)*(d-g)>=(c-p)*(a-g)}function Qc(r,t,n,a,c,d,p,g){return!(r===p&&t===g)&&Im(r,t,n,a,c,d,p,g)}function xv(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!function(n,a){let c=n;do{if(c.i!==n.i&&c.next.i!==n.i&&c.i!==a.i&&c.next.i!==a.i&&Em(c,c.next,n,a))return!0;c=c.next}while(c!==n);return!1}(r,t)&&(eu(r,t)&&eu(t,r)&&function(n,a){let c=n,d=!1;const p=(n.x+a.x)/2,g=(n.y+a.y)/2;do c.y>g!=c.next.y>g&&c.next.y!==c.y&&p<(c.next.x-c.x)*(g-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==n);return d}(r,t)&&(ki(r.prev,r,t.prev)||ki(r,t.prev,t))||ul(r,t)&&ki(r.prev,r,r.next)>0&&ki(t.prev,t,t.next)>0)}function ki(r,t,n){return(t.y-r.y)*(n.x-t.x)-(t.x-r.x)*(n.y-t.y)}function ul(r,t){return r.x===t.x&&r.y===t.y}function Em(r,t,n,a){const c=Yh(ki(r,t,n)),d=Yh(ki(r,t,a)),p=Yh(ki(n,a,r)),g=Yh(ki(n,a,t));return c!==d&&p!==g||!(c!==0||!Kh(r,n,t))||!(d!==0||!Kh(r,a,t))||!(p!==0||!Kh(n,r,a))||!(g!==0||!Kh(n,t,a))}function Kh(r,t,n){return t.x<=Math.max(r.x,n.x)&&t.x>=Math.min(r.x,n.x)&&t.y<=Math.max(r.y,n.y)&&t.y>=Math.min(r.y,n.y)}function Yh(r){return r>0?1:r<0?-1:0}function eu(r,t){return ki(r.prev,r,r.next)<0?ki(r,t,r.next)>=0&&ki(r,r.prev,t)>=0:ki(r,t,r.prev)<0||ki(r,r.next,t)<0}function km(r,t){const n=yp(r.i,r.x,r.y),a=yp(t.i,t.x,t.y),c=r.next,d=t.prev;return r.next=t,t.prev=r,n.next=c,c.prev=n,a.next=n,n.prev=a,d.next=a,a.prev=d,a}function zm(r,t,n,a){const c=yp(r,t,n);return a?(c.next=a.next,c.prev=a,a.next.prev=c,a.next=c):(c.prev=c,c.next=c),c}function tu(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function yp(r,t,n){return{i:r,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class hl{constructor(t,n){if(n>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=n}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class Jh{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}Jh.noSubdivision=new Jh({fill:new hl(0,0),line:new hl(0,0),tile:new hl(0,0),stencil:new hl(0,0),circle:1}),Ue("SubdivisionGranularityExpression",hl),Ue("SubdivisionGranularitySetting",Jh);const dl=-32768,iu=32767;class vv{constructor(t,n){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=Ft/t,this._canonical=n}_getKey(t,n){return(t+=32768)<<16|(n+=32768)<<0}_vertexToIndex(t,n){if(t<-32768||n<-32768||t>32767||n>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const a=0|Math.round(t),c=0|Math.round(n),d=this._getKey(a,c);if(this._vertexDictionary.has(d))return this._vertexDictionary.get(d);const p=this._vertexBuffer.length/2;return this._vertexDictionary.set(d,p),this._vertexBuffer.push(a,c),p}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(c,d){const p=[];for(let g=0;g<d.length;g+=3){const x=d[g],w=d[g+1],M=d[g+2],C=c[2*x],A=c[2*x+1];(c[2*w]-C)*(c[2*M+1]-A)-(c[2*w+1]-A)*(c[2*M]-C)>0?(p.push(x),p.push(M),p.push(w)):(p.push(x),p.push(w),p.push(M))}return p}(this._vertexBuffer,t);const n=[],a=t.length;for(let c=0;c<a;c+=3){const d=[t[c+0],t[c+1],t[c+2]],p=[this._vertexBuffer[2*t[c+0]+0],this._vertexBuffer[2*t[c+0]+1],this._vertexBuffer[2*t[c+1]+0],this._vertexBuffer[2*t[c+1]+1],this._vertexBuffer[2*t[c+2]+0],this._vertexBuffer[2*t[c+2]+1]];let g=1/0,x=1/0,w=-1/0,M=-1/0;for(let j=0;j<3;j++){const $=p[2*j],X=p[2*j+1];g=Math.min(g,$),w=Math.max(w,$),x=Math.min(x,X),M=Math.max(M,X)}if(g===w||x===M)continue;const C=Math.floor(g/this._granularityCellSize),A=Math.ceil(w/this._granularityCellSize),L=Math.floor(x/this._granularityCellSize),B=Math.ceil(M/this._granularityCellSize);if(C!==A||L!==B)for(let j=L;j<B;j++){const $=this._scanlineGenerateVertexRingForCellRow(j,p,d);bv(this._vertexBuffer,$,n)}else n.push(...d)}return n}_scanlineGenerateVertexRingForCellRow(t,n,a){const c=t*this._granularityCellSize,d=c+this._granularityCellSize,p=[];for(let g=0;g<3;g++){const x=n[2*g],w=n[2*g+1],M=n[2*(g+1)%6],C=n[(2*(g+1)+1)%6],A=n[2*(g+2)%6],L=n[(2*(g+2)+1)%6],B=M-x,j=C-w,$=B===0,X=j===0,se=(c-w)/j,Y=(d-w)/j,D=Math.min(se,Y),U=Math.max(se,Y);if(!X&&(D>=1||U<=0)||X&&(w<c||w>d)){C>=c&&C<=d&&p.push(a[(g+1)%3]);continue}!X&&D>0&&p.push(this._vertexToIndex(x+B*D,w+j*D));const Q=x+B*Math.max(D,0),fe=x+B*Math.min(U,1);$||this._generateIntraEdgeVertices(p,x,w,M,C,Q,fe),!X&&U<1&&p.push(this._vertexToIndex(x+B*U,w+j*U)),(X||C>=c&&C<=d)&&p.push(a[(g+1)%3]),!X&&(C<=c||C>=d)&&this._generateInterEdgeVertices(p,x,w,M,C,A,L,fe,c,d)}return p}_generateIntraEdgeVertices(t,n,a,c,d,p,g){const x=c-n,w=d-a,M=w===0,C=M?Math.min(n,c):Math.min(p,g),A=M?Math.max(n,c):Math.max(p,g),L=Math.floor(C/this._granularityCellSize)+1,B=Math.ceil(A/this._granularityCellSize)-1;if(M?n<c:p<g)for(let j=L;j<=B;j++){const $=j*this._granularityCellSize;t.push(this._vertexToIndex($,a+w*($-n)/x))}else for(let j=B;j>=L;j--){const $=j*this._granularityCellSize;t.push(this._vertexToIndex($,a+w*($-n)/x))}}_generateInterEdgeVertices(t,n,a,c,d,p,g,x,w,M){const C=d-a,A=p-c,L=g-d,B=(w-d)/L,j=(M-d)/L,$=Math.min(B,j),X=Math.max(B,j),se=c+A*$;let Y=Math.floor(Math.min(se,x)/this._granularityCellSize)+1,D=Math.ceil(Math.max(se,x)/this._granularityCellSize)-1,U=x<se;const Q=L===0;if(Q&&(g===w||g===M))return;if(Q||$>=1||X<=0){const ze=a-g,xe=p+(n-p)*Math.min((w-g)/ze,(M-g)/ze);Y=Math.floor(Math.min(xe,x)/this._granularityCellSize)+1,D=Math.ceil(Math.max(xe,x)/this._granularityCellSize)-1,U=x<xe}const fe=C>0?M:w;if(U)for(let ze=Y;ze<=D;ze++)t.push(this._vertexToIndex(ze*this._granularityCellSize,fe));else for(let ze=D;ze>=Y;ze--)t.push(this._vertexToIndex(ze*this._granularityCellSize,fe))}_generateOutline(t){const n=[];for(const a of t){const c=to(a,this._granularity,!0),d=this._pointArrayToIndices(c),p=[];for(let g=1;g<d.length;g++)p.push(d[g-1]),p.push(d[g]);n.push(p)}return n}_handlePoles(t){let n=!1,a=!1;this._canonical&&(this._canonical.y===0&&(n=!0),this._canonical.y===(1<<this._canonical.z)-1&&(a=!0)),(n||a)&&this._fillPoles(t,n,a)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let n=0;n<t.length;n+=2){const a=t[n+1];a===dl&&(t[n+1]=-32767),a===iu&&(t[n+1]=32766)}}_generatePoleQuad(t,n,a,c,d,p){c>d!=(p===dl)?(t.push(n),t.push(a),t.push(this._vertexToIndex(c,p)),t.push(a),t.push(this._vertexToIndex(d,p)),t.push(this._vertexToIndex(c,p))):(t.push(a),t.push(n),t.push(this._vertexToIndex(c,p)),t.push(this._vertexToIndex(d,p)),t.push(a),t.push(this._vertexToIndex(c,p)))}_fillPoles(t,n,a){const c=this._vertexBuffer,d=Ft,p=t.length;for(let g=2;g<p;g+=3){const x=t[g-2],w=t[g-1],M=t[g],C=c[2*x],A=c[2*x+1],L=c[2*w],B=c[2*w+1],j=c[2*M],$=c[2*M+1];n&&(A===0&&B===0&&this._generatePoleQuad(t,x,w,C,L,dl),B===0&&$===0&&this._generatePoleQuad(t,w,M,L,j,dl),$===0&&A===0&&this._generatePoleQuad(t,M,x,j,C,dl)),a&&(A===d&&B===d&&this._generatePoleQuad(t,x,w,C,L,iu),B===d&&$===d&&this._generatePoleQuad(t,w,M,L,j,iu),$===d&&A===d&&this._generatePoleQuad(t,M,x,j,C,iu))}}_initializeVertices(t){for(let n=0;n<t.length;n+=2)this._vertexToIndex(t[n],t[n+1])}subdividePolygonInternal(t,n){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:a,holeIndices:c}=function(g){const x=[],w=[];for(const M of g)if(M.length!==0){M!==g[0]&&x.push(w.length/2);for(let C=0;C<M.length;C++)w.push(M[C].x),w.push(M[C].y)}return{flattened:w,holeIndices:x}}(t);let d;this._initializeVertices(a);try{const g=function(w,M,C=2){const A=M&&M.length,L=A?M[0]*C:w.length;let B=Cm(w,0,L,C,!0);const j=[];if(!B||B.next===B.prev)return j;let $,X,se;if(A&&(B=function(Y,D,U,Q){const fe=[];for(let ze=0,xe=D.length;ze<xe;ze++){const we=Cm(Y,D[ze]*Q,ze<xe-1?D[ze+1]*Q:Y.length,Q,!1);we===we.next&&(we.steiner=!0),fe.push(yv(we))}fe.sort(mv);for(let ze=0;ze<fe.length;ze++)U=gv(fe[ze],U);return U}(w,M,B,C)),w.length>80*C){$=1/0,X=1/0;let Y=-1/0,D=-1/0;for(let U=C;U<L;U+=C){const Q=w[U],fe=w[U+1];Q<$&&($=Q),fe<X&&(X=fe),Q>Y&&(Y=Q),fe>D&&(D=fe)}se=Math.max(Y-$,D-X),se=se!==0?32767/se:0}return Jc(B,j,C,$,X,se,0),j}(a,c),x=this._convertIndices(a,g);d=this._subdivideTrianglesScanline(x)}catch(g){console.error(g)}let p=[];return n&&(p=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:p}}_convertIndices(t,n){const a=[];for(let c=0;c<n.length;c++)a.push(this._vertexToIndex(t[2*n[c]],t[2*n[c]+1]));return a}_pointArrayToIndices(t){const n=[];for(let a=0;a<t.length;a++){const c=t[a];n.push(this._vertexToIndex(c.x,c.y))}return n}}function Am(r,t,n,a=!0){return new vv(n,t).subdividePolygonInternal(r,a)}function to(r,t,n=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const a=r[0],c=r[r.length-1],d=n&&(a.x!==c.x||a.y!==c.y);if(t<2)return d?[...r,r[0]]:[...r];const p=Math.floor(Ft/t),g=[];g.push(new De(r[0].x,r[0].y));const x=r.length,w=d?x:x-1;for(let M=0;M<w;M++){const C=r[M],A=M<x-1?r[M+1]:r[0],L=C.x,B=C.y,j=A.x,$=A.y,X=L!==j,se=B!==$;if(!X&&!se)continue;const Y=j-L,D=$-B,U=Math.abs(Y),Q=Math.abs(D);let fe=L,ze=B;for(;;){const we=Y>0?(Math.floor(fe/p)+1)*p:(Math.ceil(fe/p)-1)*p,Le=D>0?(Math.floor(ze/p)+1)*p:(Math.ceil(ze/p)-1)*p,Ae=Math.abs(fe-we),Fe=Math.abs(ze-Le),Pe=Math.abs(fe-j),Ge=Math.abs(ze-$),tt=X?Ae/U:Number.POSITIVE_INFINITY,Je=se?Fe/Q:Number.POSITIVE_INFINITY;if((Pe<=Ae||!X)&&(Ge<=Fe||!se))break;if(tt<Je&&X||!se){fe=we,ze+=D*tt;const We=new De(fe,Math.round(ze));g[g.length-1].x===We.x&&g[g.length-1].y===We.y||g.push(We)}else{fe+=Y*Je,ze=Le;const We=new De(Math.round(fe),ze);g[g.length-1].x===We.x&&g[g.length-1].y===We.y||g.push(We)}}const xe=new De(j,$);g[g.length-1].x===xe.x&&g[g.length-1].y===xe.y||g.push(xe)}return g}function bv(r,t,n){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let a=0,c=r[2*t[0]];for(let x=1;x<t.length;x++){const w=r[2*t[x]];w<c&&(c=w,a=x)}const d=t.length;let p=a,g=(p+1)%d;for(;;){const x=p-1>=0?p-1:d-1,w=(g+1)%d,M=r[2*t[x]],C=r[2*t[w]],A=r[2*t[p]],L=r[2*t[p]+1],B=r[2*t[g]+1];let j=!1;if(M<C)j=!0;else if(M>C)j=!1;else{const $=B-L,X=-(r[2*t[g]]-A),se=L<B?1:-1;((M-A)*$+(r[2*t[x]+1]-L)*X)*se>((C-A)*$+(r[2*t[w]+1]-L)*X)*se&&(j=!0)}if(j){const $=t[x],X=t[p],se=t[g];$!==X&&$!==se&&X!==se&&n.push(se,X,$),p--,p<0&&(p=d-1)}else{const $=t[w],X=t[p],se=t[g];$!==X&&$!==se&&X!==se&&n.push(se,X,$),g++,g>=d&&(g=0)}if(x===w)break}}function Rm(r,t,n,a,c,d,p,g,x){const w=c.length/2,M=p&&g&&x;if(w<st.MAX_VERTEX_ARRAY_LENGTH){const C=t.prepareSegment(w,n,a),A=C.vertexLength;for(let j=0;j<d.length;j+=3)a.emplaceBack(A+d[j],A+d[j+1],A+d[j+2]);let L,B;C.vertexLength+=w,C.primitiveLength+=d.length/3,M&&(B=p.prepareSegment(w,n,g),L=B.vertexLength,B.vertexLength+=w);for(let j=0;j<c.length;j+=2)r(c[j],c[j+1]);if(M)for(let j=0;j<x.length;j++){const $=x[j];for(let X=1;X<$.length;X+=2)g.emplaceBack(L+$[X-1],L+$[X]);B.primitiveLength+=$.length/2}}else(function(C,A,L,B,j,$){const X=[];for(let Q=0;Q<B.length/2;Q++)X.push(-1);const se={count:0};let Y=0,D=C.getOrCreateLatestSegment(A,L),U=D.vertexLength;for(let Q=2;Q<j.length;Q+=3){const fe=j[Q-2],ze=j[Q-1],xe=j[Q];let we=X[fe]<Y,Le=X[ze]<Y,Ae=X[xe]<Y;D.vertexLength+((we?1:0)+(Le?1:0)+(Ae?1:0))>st.MAX_VERTEX_ARRAY_LENGTH&&(D=C.createNewSegment(A,L),Y=se.count,we=!0,Le=!0,Ae=!0,U=0);const Fe=ru(X,B,$,se,fe,we,D),Pe=ru(X,B,$,se,ze,Le,D),Ge=ru(X,B,$,se,xe,Ae,D);L.emplaceBack(U+Fe-Y,U+Pe-Y,U+Ge-Y),D.primitiveLength++}})(t,n,a,c,d,r),M&&function(C,A,L,B,j,$){const X=[];for(let Q=0;Q<B.length/2;Q++)X.push(-1);const se={count:0};let Y=0,D=C.getOrCreateLatestSegment(A,L),U=D.vertexLength;for(let Q=0;Q<j.length;Q++){const fe=j[Q];for(let ze=1;ze<j[Q].length;ze+=2){const xe=fe[ze-1],we=fe[ze];let Le=X[xe]<Y,Ae=X[we]<Y;D.vertexLength+((Le?1:0)+(Ae?1:0))>st.MAX_VERTEX_ARRAY_LENGTH&&(D=C.createNewSegment(A,L),Y=se.count,Le=!0,Ae=!0,U=0);const Fe=ru(X,B,$,se,xe,Le,D),Pe=ru(X,B,$,se,we,Ae,D);L.emplaceBack(U+Fe-Y,U+Pe-Y),D.primitiveLength++}}}(p,n,g,c,x,r),t.forceNewSegmentOnNextPrepare(),p==null||p.forceNewSegmentOnNextPrepare()}function ru(r,t,n,a,c,d,p){if(d){const g=a.count;return n(t[2*c],t[2*c+1]),r[c]=a.count,a.count++,p.vertexLength++,g}return r[c]}class xp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new te,this.indexArray=new Be,this.indexArray2=new Ee,this.programConfigurations=new Aa(t.layers,t.zoom),this.segments=new st,this.segments2=new st,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.hasPattern=mp("fill",this.layers,n);const c=this.layers[0].layout.get("fill-sort-key"),d=!c.isConstant(),p=[];for(const{feature:g,id:x,index:w,sourceLayerIndex:M}of t){const C=this.layers[0]._featureFilter.needGeometry,A=na(g,C);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),A,a))continue;const L=d?c.evaluate(A,{},a,n.availableImages):void 0,B={id:x,properties:g.properties,type:g.type,sourceLayerIndex:M,index:w,geometry:C?A.geometry:Lr(g),patterns:{},sortKey:L};p.push(B)}d&&p.sort((g,x)=>g.sortKey-x.sortKey);for(const g of p){const{geometry:x,index:w,sourceLayerIndex:M}=g;if(this.hasPattern){const C=gp("fill",this.layers,g,this.zoom,n);this.patternFeatures.push(C)}else this.addFeature(g,x,w,a,{},n.subdivisionGranularity);n.featureIndex.insert(t[w].feature,x,w,M,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}addFeatures(t,n,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,n,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,uv),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,n,a,c,d,p){for(const g of Bo(n,500)){const x=Am(g,c,p.fill.getGranularityForZoomLevel(c.z)),w=this.layoutVertexArray;Rm((M,C)=>{w.emplaceBack(M,C)},this.segments,this.layoutVertexArray,this.indexArray,x.verticesFlattened,x.indicesTriangles,this.segments2,this.indexArray2,x.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}}let Dm,Lm;Ue("FillBucket",xp,{omit:["layers","patternFeatures"]});var wv={get paint(){return Lm=Lm||new Sr({"fill-antialias":new Ye(V.paint_fill["fill-antialias"]),"fill-opacity":new nt(V.paint_fill["fill-opacity"]),"fill-color":new nt(V.paint_fill["fill-color"]),"fill-outline-color":new nt(V.paint_fill["fill-outline-color"]),"fill-translate":new Ye(V.paint_fill["fill-translate"]),"fill-translate-anchor":new Ye(V.paint_fill["fill-translate-anchor"]),"fill-pattern":new Hs(V.paint_fill["fill-pattern"])})},get layout(){return Dm=Dm||new Sr({"fill-sort-key":new nt(V.layout_fill["fill-sort-key"])})}};class Tv extends yn{constructor(t){super(t,wv)}recalculate(t,n){super.recalculate(t,n);const a=this.paint._values["fill-outline-color"];a.value.kind==="constant"&&a.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new xp(t)}queryRadius(){return Wh(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:n,transform:a,pixelsToTileUnits:c}){return gm(Xh(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,c),n)}isTileClipped(){return!0}}const Mv=Ei([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Sv=Ei([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Pv}=Mv;var vp,Bm,bp,Fm,wp,Om,jm,Qh={};function Nm(){if(Bm)return vp;Bm=1;var r=Re();function t(c,d,p,g,x){this.properties={},this.extent=p,this.type=0,this._pbf=c,this._geometry=-1,this._keys=g,this._values=x,c.readFields(n,this,d)}function n(c,d,p){c==1?d.id=p.readVarint():c==2?function(g,x){for(var w=g.readVarint()+g.pos;g.pos<w;){var M=x._keys[g.readVarint()],C=x._values[g.readVarint()];x.properties[M]=C}}(p,d):c==3?d.type=p.readVarint():c==4&&(d._geometry=p.pos)}function a(c){for(var d,p,g=0,x=0,w=c.length,M=w-1;x<w;M=x++)g+=((p=c[M]).x-(d=c[x]).x)*(d.y+p.y);return g}return vp=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var c=this._pbf;c.pos=this._geometry;for(var d,p=c.readVarint()+c.pos,g=1,x=0,w=0,M=0,C=[];c.pos<p;){if(x<=0){var A=c.readVarint();g=7&A,x=A>>3}if(x--,g===1||g===2)w+=c.readSVarint(),M+=c.readSVarint(),g===1&&(d&&C.push(d),d=[]),d.push(new r(w,M));else{if(g!==7)throw new Error("unknown command "+g);d&&d.push(d[0].clone())}}return d&&C.push(d),C},t.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var d=c.readVarint()+c.pos,p=1,g=0,x=0,w=0,M=1/0,C=-1/0,A=1/0,L=-1/0;c.pos<d;){if(g<=0){var B=c.readVarint();p=7&B,g=B>>3}if(g--,p===1||p===2)(x+=c.readSVarint())<M&&(M=x),x>C&&(C=x),(w+=c.readSVarint())<A&&(A=w),w>L&&(L=w);else if(p!==7)throw new Error("unknown command "+p)}return[M,A,C,L]},t.prototype.toGeoJSON=function(c,d,p){var g,x,w=this.extent*Math.pow(2,p),M=this.extent*c,C=this.extent*d,A=this.loadGeometry(),L=t.types[this.type];function B(X){for(var se=0;se<X.length;se++){var Y=X[se];X[se]=[360*(Y.x+M)/w-180,360/Math.PI*Math.atan(Math.exp((180-360*(Y.y+C)/w)*Math.PI/180))-90]}}switch(this.type){case 1:var j=[];for(g=0;g<A.length;g++)j[g]=A[g][0];B(A=j);break;case 2:for(g=0;g<A.length;g++)B(A[g]);break;case 3:for(A=function(X){var se=X.length;if(se<=1)return[X];for(var Y,D,U=[],Q=0;Q<se;Q++){var fe=a(X[Q]);fe!==0&&(D===void 0&&(D=fe<0),D===fe<0?(Y&&U.push(Y),Y=[X[Q]]):Y.push(X[Q]))}return Y&&U.push(Y),U}(A),g=0;g<A.length;g++)for(x=0;x<A[g].length;x++)B(A[g][x])}A.length===1?A=A[0]:L="Multi"+L;var $={type:"Feature",geometry:{type:L,coordinates:A},properties:this.properties};return"id"in this&&($.id=this.id),$},vp}function Zm(){if(Fm)return bp;Fm=1;var r=Nm();function t(a,c){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=a,this._keys=[],this._values=[],this._features=[],a.readFields(n,this,c),this.length=this._features.length}function n(a,c,d){a===15?c.version=d.readVarint():a===1?c.name=d.readString():a===5?c.extent=d.readVarint():a===2?c._features.push(d.pos):a===3?c._keys.push(d.readString()):a===4&&c._values.push(function(p){for(var g=null,x=p.readVarint()+p.pos;p.pos<x;){var w=p.readVarint()>>3;g=w===1?p.readString():w===2?p.readFloat():w===3?p.readDouble():w===4?p.readVarint64():w===5?p.readVarint():w===6?p.readSVarint():w===7?p.readBoolean():null}return g}(d))}return bp=t,t.prototype.feature=function(a){if(a<0||a>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[a];var c=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,c,this.extent,this._keys,this._values)},bp}function Vm(){return jm||(jm=1,Qh.VectorTile=function(){if(Om)return wp;Om=1;var r=Zm();function t(n,a,c){if(n===3){var d=new r(c,c.readVarint()+c.pos);d.length&&(a[d.name]=d)}}return wp=function(n,a){this.layers=n.readFields(t,{},a)},wp}(),Qh.VectorTileFeature=Nm(),Qh.VectorTileLayer=Zm()),Qh}var nu=le(Vm());const Cv=nu.VectorTileFeature.types,Tp=Math.pow(2,13);function au(r,t,n,a,c,d,p,g){r.emplaceBack(t,n,2*Math.floor(a*Tp)+p,c*Tp*2,d*Tp*2,Math.round(g))}class Mp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new re,this.centroidVertexArray=new K,this.indexArray=new Be,this.programConfigurations=new Aa(t.layers,t.zoom),this.segments=new st,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.features=[],this.hasPattern=mp("fill-extrusion",this.layers,n);for(const{feature:c,id:d,index:p,sourceLayerIndex:g}of t){const x=this.layers[0]._featureFilter.needGeometry,w=na(c,x);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),w,a))continue;const M={id:d,sourceLayerIndex:g,index:p,geometry:x?w.geometry:Lr(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(gp("fill-extrusion",this.layers,M,this.zoom,n)):this.addFeature(M,M.geometry,p,a,{},n.subdivisionGranularity),n.featureIndex.insert(c,M.geometry,p,g,this.index,!0)}}addFeatures(t,n,a){for(const c of this.features){const{geometry:d}=c;this.addFeature(c,d,c.index,n,a,t.subdivisionGranularity)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Pv),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Sv.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,n,a,c,d,p){for(const g of Bo(n,500)){const x={x:0,y:0,sampleCount:0},w=this.layoutVertexArray.length;this.processPolygon(x,c,t,g,p);const M=this.layoutVertexArray.length-w,C=Math.floor(x.x/x.sampleCount),A=Math.floor(x.y/x.sampleCount);for(let L=0;L<M;L++)this.centroidVertexArray.emplaceBack(C,A)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}processPolygon(t,n,a,c,d){if(c.length<1||Um(c[0]))return;for(const C of c)C.length!==0&&Iv(t,C);const p={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},g=d.fill.getGranularityForZoomLevel(n.z),x=Cv[a.type]==="Polygon";for(const C of c){if(C.length===0||Um(C))continue;const A=to(C,g,x);this._generateSideFaces(A,p)}if(!x)return;const w=Am(c,n,g,!1),M=this.layoutVertexArray;Rm((C,A)=>{au(M,C,A,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,w.verticesFlattened,w.indicesTriangles)}_generateSideFaces(t,n){let a=0;for(let c=1;c<t.length;c++){const d=t[c],p=t[c-1];if(Ev(d,p))continue;n.segment.vertexLength+4>st.MAX_VERTEX_ARRAY_LENGTH&&(n.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const g=d.sub(p)._perp()._unit(),x=p.dist(d);a+x>32768&&(a=0),au(this.layoutVertexArray,d.x,d.y,g.x,g.y,0,0,a),au(this.layoutVertexArray,d.x,d.y,g.x,g.y,0,1,a),a+=x,au(this.layoutVertexArray,p.x,p.y,g.x,g.y,0,0,a),au(this.layoutVertexArray,p.x,p.y,g.x,g.y,0,1,a);const w=n.segment.vertexLength;this.indexArray.emplaceBack(w,w+2,w+1),this.indexArray.emplaceBack(w+1,w+2,w+3),n.segment.vertexLength+=4,n.segment.primitiveLength+=2}}}function Iv(r,t){for(let n=0;n<t.length;n++){const a=t[n];n===t.length-1&&t[0].x===a.x&&t[0].y===a.y||(r.x+=a.x,r.y+=a.y,r.sampleCount++)}}function Ev(r,t){return r.x===t.x&&(r.x<0||r.x>Ft)||r.y===t.y&&(r.y<0||r.y>Ft)}function Um(r){return r.every(t=>t.x<0)||r.every(t=>t.x>Ft)||r.every(t=>t.y<0)||r.every(t=>t.y>Ft)}let $m;Ue("FillExtrusionBucket",Mp,{omit:["layers","features"]});var kv={get paint(){return $m=$m||new Sr({"fill-extrusion-opacity":new Ye(V["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new nt(V["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ye(V["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ye(V["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Hs(V["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new nt(V["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new nt(V["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ye(V["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class zv extends yn{constructor(t){super(t,kv)}createBucket(t){return new Mp(t)}queryRadius(){return Wh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,pixelPosMatrix:g}){const x=Xh(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,p),w=this.paint.get("fill-extrusion-height").evaluate(n,a),M=this.paint.get("fill-extrusion-base").evaluate(n,a),C=function(L,B,j){const $=[];for(const X of L){const se=[X.x,X.y,0,1];li(se,se,B),$.push(new De(se[0]/se[3],se[1]/se[3]))}return $}(x,g),A=function(L,B,j,$){const X=[],se=[],Y=$[8]*B,D=$[9]*B,U=$[10]*B,Q=$[11]*B,fe=$[8]*j,ze=$[9]*j,xe=$[10]*j,we=$[11]*j;for(const Le of L){const Ae=[],Fe=[];for(const Pe of Le){const Ge=Pe.x,tt=Pe.y,Je=$[0]*Ge+$[4]*tt+$[12],We=$[1]*Ge+$[5]*tt+$[13],wt=$[2]*Ge+$[6]*tt+$[14],wi=$[3]*Ge+$[7]*tt+$[15],Oi=wt+U,ur=wi+Q,an=Je+fe,Fr=We+ze,Qi=wt+xe,gi=wi+we,qi=new De((Je+Y)/ur,(We+D)/ur);qi.z=Oi/ur,Ae.push(qi);const er=new De(an/gi,Fr/gi);er.z=Qi/gi,Fe.push(er)}X.push(Ae),se.push(Fe)}return[X,se]}(c,M,w,g);return function(L,B,j){let $=1/0;gm(j,B)&&($=Gm(j,B[0]));for(let X=0;X<B.length;X++){const se=B[X],Y=L[X];for(let D=0;D<se.length-1;D++){const U=se[D],Q=[U,se[D+1],Y[D+1],Y[D],U];Wc(j,Q)&&($=Math.min($,Gm(j,Q)))}}return $!==1/0&&$}(A[0],A[1],C)}}function su(r,t){return r.x*t.x+r.y*t.y}function Gm(r,t){if(r.length===1){let n=0;const a=t[n++];let c;for(;!c||a.equals(c);)if(c=t[n++],!c)return 1/0;for(;n<t.length;n++){const d=t[n],p=r[0],g=c.sub(a),x=d.sub(a),w=p.sub(a),M=su(g,g),C=su(g,x),A=su(x,x),L=su(w,g),B=su(w,x),j=M*A-C*C,$=(A*L-C*B)/j,X=(M*B-C*L)/j,se=a.z*(1-$-X)+c.z*$+d.z*X;if(isFinite(se))return se}return 1/0}{let n=1/0;for(const a of t)n=Math.min(n,a.z);return n}}const Av=Ei([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Rv}=Av,Dv=Ei([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Lv}=Dv,Bv=nu.VectorTileFeature.types,Fv=Math.cos(Math.PI/180*37.5),qm=Math.pow(2,14)/.5;class Sp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(n=>{this.gradients[n.id]={}}),this.layoutVertexArray=new oe,this.layoutVertexArray2=new ae,this.indexArray=new Be,this.programConfigurations=new Aa(t.layers,t.zoom),this.segments=new st,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.hasPattern=mp("line",this.layers,n);const c=this.layers[0].layout.get("line-sort-key"),d=!c.isConstant(),p=[];for(const{feature:g,id:x,index:w,sourceLayerIndex:M}of t){const C=this.layers[0]._featureFilter.needGeometry,A=na(g,C);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),A,a))continue;const L=d?c.evaluate(A,{},a):void 0,B={id:x,properties:g.properties,type:g.type,sourceLayerIndex:M,index:w,geometry:C?A.geometry:Lr(g),patterns:{},sortKey:L};p.push(B)}d&&p.sort((g,x)=>g.sortKey-x.sortKey);for(const g of p){const{geometry:x,index:w,sourceLayerIndex:M}=g;if(this.hasPattern){const C=gp("line",this.layers,g,this.zoom,n);this.patternFeatures.push(C)}else this.addFeature(g,x,w,a,{},n.subdivisionGranularity);n.featureIndex.insert(t[w].feature,x,w,M,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}addFeatures(t,n,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,n,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Lv)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Rv),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,n,a,c,d,p){const g=this.layers[0].layout,x=g.get("line-join").evaluate(t,{}),w=g.get("line-cap"),M=g.get("line-miter-limit"),C=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const A of n)this.addLine(A,t,x,w,M,C,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}addLine(t,n,a,c,d,p,g,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=to(t,g?x.line.getGranularityForZoomLevel(g.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Y=0;Y<t.length-1;Y++)this.totalDistance+=t[Y].dist(t[Y+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const w=Bv[n.type]==="Polygon";let M=t.length;for(;M>=2&&t[M-1].equals(t[M-2]);)M--;let C=0;for(;C<M-1&&t[C].equals(t[C+1]);)C++;if(M<(w?3:2))return;a==="bevel"&&(d=1.05);const A=this.overscaling<=16?15*Ft/(512*this.overscaling):0,L=this.segments.prepareSegment(10*M,this.layoutVertexArray,this.indexArray);let B,j,$,X,se;this.e1=this.e2=-1,w&&(B=t[M-2],se=t[C].sub(B)._unit()._perp());for(let Y=C;Y<M;Y++){if($=Y===M-1?w?t[C+1]:void 0:t[Y+1],$&&t[Y].equals($))continue;se&&(X=se),B&&(j=B),B=t[Y],se=$?$.sub(B)._unit()._perp():X,X=X||se;let D=X.add(se);D.x===0&&D.y===0||D._unit();const U=X.x*se.x+X.y*se.y,Q=D.x*se.x+D.y*se.y,fe=Q!==0?1/Q:1/0,ze=2*Math.sqrt(2-2*Q),xe=Q<Fv&&j&&$,we=X.x*se.y-X.y*se.x>0;if(xe&&Y>C){const Fe=B.dist(j);if(Fe>2*A){const Pe=B.sub(B.sub(j)._mult(A/Fe)._round());this.updateDistance(j,Pe),this.addCurrentVertex(Pe,X,0,0,L),j=Pe}}const Le=j&&$;let Ae=Le?a:w?"butt":c;if(Le&&Ae==="round"&&(fe<p?Ae="miter":fe<=2&&(Ae="fakeround")),Ae==="miter"&&fe>d&&(Ae="bevel"),Ae==="bevel"&&(fe>2&&(Ae="flipbevel"),fe<d&&(Ae="miter")),j&&this.updateDistance(j,B),Ae==="miter")D._mult(fe),this.addCurrentVertex(B,D,0,0,L);else if(Ae==="flipbevel"){if(fe>100)D=se.mult(-1);else{const Fe=fe*X.add(se).mag()/X.sub(se).mag();D._perp()._mult(Fe*(we?-1:1))}this.addCurrentVertex(B,D,0,0,L),this.addCurrentVertex(B,D.mult(-1),0,0,L)}else if(Ae==="bevel"||Ae==="fakeround"){const Fe=-Math.sqrt(fe*fe-1),Pe=we?Fe:0,Ge=we?0:Fe;if(j&&this.addCurrentVertex(B,X,Pe,Ge,L),Ae==="fakeround"){const tt=Math.round(180*ze/Math.PI/20);for(let Je=1;Je<tt;Je++){let We=Je/tt;if(We!==.5){const wi=We-.5;We+=We*wi*(We-1)*((1.0904+U*(U*(3.55645-1.43519*U)-3.2452))*wi*wi+(.848013+U*(.215638*U-1.06021)))}const wt=se.sub(X)._mult(We)._add(X)._unit()._mult(we?-1:1);this.addHalfVertex(B,wt.x,wt.y,!1,we,0,L)}}$&&this.addCurrentVertex(B,se,-Pe,-Ge,L)}else if(Ae==="butt")this.addCurrentVertex(B,D,0,0,L);else if(Ae==="square"){const Fe=j?1:-1;this.addCurrentVertex(B,D,Fe,Fe,L)}else Ae==="round"&&(j&&(this.addCurrentVertex(B,X,0,0,L),this.addCurrentVertex(B,X,1,1,L,!0)),$&&(this.addCurrentVertex(B,se,-1,-1,L,!0),this.addCurrentVertex(B,se,0,0,L)));if(xe&&Y<M-1){const Fe=B.dist($);if(Fe>2*A){const Pe=B.add($.sub(B)._mult(A/Fe)._round());this.updateDistance(B,Pe),this.addCurrentVertex(Pe,se,0,0,L),B=Pe}}}}addCurrentVertex(t,n,a,c,d,p=!1){const g=n.y*c-n.x,x=-n.y-n.x*c;this.addHalfVertex(t,n.x+n.y*a,n.y-n.x*a,p,!1,a,d),this.addHalfVertex(t,g,x,p,!0,-c,d),this.distance>qm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,a,c,d,p))}addHalfVertex({x:t,y:n},a,c,d,p,g,x){const w=.5*(this.lineClips?this.scaledDistance*(qm-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(d?1:0),(n<<1)+(p?1:0),Math.round(63*a)+128,Math.round(63*c)+128,1+(g===0?0:g<0?-1:1)|(63&w)<<2,w>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const M=x.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,M,this.e2),x.primitiveLength++),p?this.e2=M:this.e1=M}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,n){this.distance+=t.dist(n),this.updateScaledDistance()}}let Hm,Wm;Ue("LineBucket",Sp,{omit:["layers","patternFeatures"]});var Xm={get paint(){return Wm=Wm||new Sr({"line-opacity":new nt(V.paint_line["line-opacity"]),"line-color":new nt(V.paint_line["line-color"]),"line-translate":new Ye(V.paint_line["line-translate"]),"line-translate-anchor":new Ye(V.paint_line["line-translate-anchor"]),"line-width":new nt(V.paint_line["line-width"]),"line-gap-width":new nt(V.paint_line["line-gap-width"]),"line-offset":new nt(V.paint_line["line-offset"]),"line-blur":new nt(V.paint_line["line-blur"]),"line-dasharray":new jc(V.paint_line["line-dasharray"]),"line-pattern":new Hs(V.paint_line["line-pattern"]),"line-gradient":new Nc(V.paint_line["line-gradient"])})},get layout(){return Hm=Hm||new Sr({"line-cap":new Ye(V.layout_line["line-cap"]),"line-join":new nt(V.layout_line["line-join"]),"line-miter-limit":new Ye(V.layout_line["line-miter-limit"]),"line-round-limit":new Ye(V.layout_line["line-round-limit"]),"line-sort-key":new nt(V.layout_line["line-sort-key"])})}};class Ov extends nt{possiblyEvaluate(t,n){return n=new ti(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),super.possiblyEvaluate(t,n)}evaluate(t,n,a,c){return n=hr({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(t,n,a,c)}}let ed;class jv extends yn{constructor(t){super(t,Xm),this.gradientVersion=0,ed||(ed=new Ov(Xm.paint.properties["line-width"].specification),ed.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const n=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(n)&&n._styleExpression.expression instanceof ks,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,n){super.recalculate(t,n),this.paint._values["line-floorwidth"]=ed.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Sp(t)}queryRadius(t){const n=t,a=Km(Kc("line-width",this,n),Kc("line-gap-width",this,n)),c=Kc("line-offset",this,n);return a/2+Math.abs(c)+Wh(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p}){const g=Xh(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,p),x=p/2*Km(this.paint.get("line-width").evaluate(n,a),this.paint.get("line-gap-width").evaluate(n,a)),w=this.paint.get("line-offset").evaluate(n,a);return w&&(c=function(M,C){const A=[];for(let L=0;L<M.length;L++){const B=M[L],j=[];for(let $=0;$<B.length;$++){const X=B[$-1],se=B[$],Y=B[$+1],D=$===0?new De(0,0):se.sub(X)._unit()._perp(),U=$===B.length-1?new De(0,0):Y.sub(se)._unit()._perp(),Q=D._add(U)._unit(),fe=Q.x*U.x+Q.y*U.y;fe!==0&&Q._mult(1/fe),j.push(Q._mult(C)._add(se))}A.push(j)}return A}(c,w*p)),function(M,C,A){for(let L=0;L<C.length;L++){const B=C[L];if(M.length>=3){for(let j=0;j<B.length;j++)if(Qs(M,B[j]))return!0}if(ev(M,B,A))return!0}return!1}(g,c,x)}isTileClipped(){return!0}}function Km(r,t){return t>0?t+2*r:r}const Nv=Ei([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Zv=Ei([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ei([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Vv=Ei([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Ei([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Ym=Ei([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Uv=Ei([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function $v(r,t,n){return r.sections.forEach(a=>{a.text=function(c,d,p){const g=d.layout.get("text-transform").evaluate(p,{});return g==="uppercase"?c=c.toLocaleUpperCase():g==="lowercase"&&(c=c.toLocaleLowerCase()),ta.applyArabicShaping&&(c=ta.applyArabicShaping(c)),c}(a.text,t,n)}),r}Ei([{name:"triangle",components:3,type:"Uint16"}]),Ei([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Ei([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Ei([{type:"Float32",name:"offsetX"}]),Ei([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ei([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const ou={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Jm,Pp,Qm,Fi=24,Cp={};function Gv(){return Jm||(Jm=1,Cp.read=function(r,t,n,a,c){var d,p,g=8*c-a-1,x=(1<<g)-1,w=x>>1,M=-7,C=n?c-1:0,A=n?-1:1,L=r[t+C];for(C+=A,d=L&(1<<-M)-1,L>>=-M,M+=g;M>0;d=256*d+r[t+C],C+=A,M-=8);for(p=d&(1<<-M)-1,d>>=-M,M+=a;M>0;p=256*p+r[t+C],C+=A,M-=8);if(d===0)d=1-w;else{if(d===x)return p?NaN:1/0*(L?-1:1);p+=Math.pow(2,a),d-=w}return(L?-1:1)*p*Math.pow(2,d-a)},Cp.write=function(r,t,n,a,c,d){var p,g,x,w=8*d-c-1,M=(1<<w)-1,C=M>>1,A=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,L=a?0:d-1,B=a?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(g=isNaN(t)?1:0,p=M):(p=Math.floor(Math.log(t)/Math.LN2),t*(x=Math.pow(2,-p))<1&&(p--,x*=2),(t+=p+C>=1?A/x:A*Math.pow(2,1-C))*x>=2&&(p++,x/=2),p+C>=M?(g=0,p=M):p+C>=1?(g=(t*x-1)*Math.pow(2,c),p+=C):(g=t*Math.pow(2,C-1)*Math.pow(2,c),p=0));c>=8;r[n+L]=255&g,L+=B,g/=256,c-=8);for(p=p<<c|g,w+=c;w>0;r[n+L]=255&p,L+=B,p/=256,w-=8);r[n+L-B]|=128*j}),Cp}function eg(){if(Qm)return Pp;Qm=1,Pp=t;var r=Gv();function t(D){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(D)?D:new Uint8Array(D||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var n=4294967296,a=1/n,c=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function d(D){return D.type===t.Bytes?D.readVarint()+D.pos:D.pos+1}function p(D,U,Q){return Q?4294967296*U+(D>>>0):4294967296*(U>>>0)+(D>>>0)}function g(D,U,Q){var fe=U<=16383?1:U<=2097151?2:U<=268435455?3:Math.floor(Math.log(U)/(7*Math.LN2));Q.realloc(fe);for(var ze=Q.pos-1;ze>=D;ze--)Q.buf[ze+fe]=Q.buf[ze]}function x(D,U){for(var Q=0;Q<D.length;Q++)U.writeVarint(D[Q])}function w(D,U){for(var Q=0;Q<D.length;Q++)U.writeSVarint(D[Q])}function M(D,U){for(var Q=0;Q<D.length;Q++)U.writeFloat(D[Q])}function C(D,U){for(var Q=0;Q<D.length;Q++)U.writeDouble(D[Q])}function A(D,U){for(var Q=0;Q<D.length;Q++)U.writeBoolean(D[Q])}function L(D,U){for(var Q=0;Q<D.length;Q++)U.writeFixed32(D[Q])}function B(D,U){for(var Q=0;Q<D.length;Q++)U.writeSFixed32(D[Q])}function j(D,U){for(var Q=0;Q<D.length;Q++)U.writeFixed64(D[Q])}function $(D,U){for(var Q=0;Q<D.length;Q++)U.writeSFixed64(D[Q])}function X(D,U){return(D[U]|D[U+1]<<8|D[U+2]<<16)+16777216*D[U+3]}function se(D,U,Q){D[Q]=U,D[Q+1]=U>>>8,D[Q+2]=U>>>16,D[Q+3]=U>>>24}function Y(D,U){return(D[U]|D[U+1]<<8|D[U+2]<<16)+(D[U+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(D,U,Q){for(Q=Q||this.length;this.pos<Q;){var fe=this.readVarint(),ze=fe>>3,xe=this.pos;this.type=7&fe,D(ze,U,this),this.pos===xe&&this.skip(fe)}return U},readMessage:function(D,U){return this.readFields(D,U,this.readVarint()+this.pos)},readFixed32:function(){var D=X(this.buf,this.pos);return this.pos+=4,D},readSFixed32:function(){var D=Y(this.buf,this.pos);return this.pos+=4,D},readFixed64:function(){var D=X(this.buf,this.pos)+X(this.buf,this.pos+4)*n;return this.pos+=8,D},readSFixed64:function(){var D=X(this.buf,this.pos)+Y(this.buf,this.pos+4)*n;return this.pos+=8,D},readFloat:function(){var D=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,D},readDouble:function(){var D=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,D},readVarint:function(D){var U,Q,fe=this.buf;return U=127&(Q=fe[this.pos++]),Q<128?U:(U|=(127&(Q=fe[this.pos++]))<<7,Q<128?U:(U|=(127&(Q=fe[this.pos++]))<<14,Q<128?U:(U|=(127&(Q=fe[this.pos++]))<<21,Q<128?U:function(ze,xe,we){var Le,Ae,Fe=we.buf;if(Le=(112&(Ae=Fe[we.pos++]))>>4,Ae<128||(Le|=(127&(Ae=Fe[we.pos++]))<<3,Ae<128)||(Le|=(127&(Ae=Fe[we.pos++]))<<10,Ae<128)||(Le|=(127&(Ae=Fe[we.pos++]))<<17,Ae<128)||(Le|=(127&(Ae=Fe[we.pos++]))<<24,Ae<128)||(Le|=(1&(Ae=Fe[we.pos++]))<<31,Ae<128))return p(ze,Le,xe);throw new Error("Expected varint not more than 10 bytes")}(U|=(15&(Q=fe[this.pos]))<<28,D,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var D=this.readVarint();return D%2==1?(D+1)/-2:D/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var D=this.readVarint()+this.pos,U=this.pos;return this.pos=D,D-U>=12&&c?function(Q,fe,ze){return c.decode(Q.subarray(fe,ze))}(this.buf,U,D):function(Q,fe,ze){for(var xe="",we=fe;we<ze;){var Le,Ae,Fe,Pe=Q[we],Ge=null,tt=Pe>239?4:Pe>223?3:Pe>191?2:1;if(we+tt>ze)break;tt===1?Pe<128&&(Ge=Pe):tt===2?(192&(Le=Q[we+1]))==128&&(Ge=(31&Pe)<<6|63&Le)<=127&&(Ge=null):tt===3?(Ae=Q[we+2],(192&(Le=Q[we+1]))==128&&(192&Ae)==128&&((Ge=(15&Pe)<<12|(63&Le)<<6|63&Ae)<=2047||Ge>=55296&&Ge<=57343)&&(Ge=null)):tt===4&&(Ae=Q[we+2],Fe=Q[we+3],(192&(Le=Q[we+1]))==128&&(192&Ae)==128&&(192&Fe)==128&&((Ge=(15&Pe)<<18|(63&Le)<<12|(63&Ae)<<6|63&Fe)<=65535||Ge>=1114112)&&(Ge=null)),Ge===null?(Ge=65533,tt=1):Ge>65535&&(Ge-=65536,xe+=String.fromCharCode(Ge>>>10&1023|55296),Ge=56320|1023&Ge),xe+=String.fromCharCode(Ge),we+=tt}return xe}(this.buf,U,D)},readBytes:function(){var D=this.readVarint()+this.pos,U=this.buf.subarray(this.pos,D);return this.pos=D,U},readPackedVarint:function(D,U){if(this.type!==t.Bytes)return D.push(this.readVarint(U));var Q=d(this);for(D=D||[];this.pos<Q;)D.push(this.readVarint(U));return D},readPackedSVarint:function(D){if(this.type!==t.Bytes)return D.push(this.readSVarint());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readSVarint());return D},readPackedBoolean:function(D){if(this.type!==t.Bytes)return D.push(this.readBoolean());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readBoolean());return D},readPackedFloat:function(D){if(this.type!==t.Bytes)return D.push(this.readFloat());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readFloat());return D},readPackedDouble:function(D){if(this.type!==t.Bytes)return D.push(this.readDouble());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readDouble());return D},readPackedFixed32:function(D){if(this.type!==t.Bytes)return D.push(this.readFixed32());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readFixed32());return D},readPackedSFixed32:function(D){if(this.type!==t.Bytes)return D.push(this.readSFixed32());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readSFixed32());return D},readPackedFixed64:function(D){if(this.type!==t.Bytes)return D.push(this.readFixed64());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readFixed64());return D},readPackedSFixed64:function(D){if(this.type!==t.Bytes)return D.push(this.readSFixed64());var U=d(this);for(D=D||[];this.pos<U;)D.push(this.readSFixed64());return D},skip:function(D){var U=7&D;if(U===t.Varint)for(;this.buf[this.pos++]>127;);else if(U===t.Bytes)this.pos=this.readVarint()+this.pos;else if(U===t.Fixed32)this.pos+=4;else{if(U!==t.Fixed64)throw new Error("Unimplemented type: "+U);this.pos+=8}},writeTag:function(D,U){this.writeVarint(D<<3|U)},realloc:function(D){for(var U=this.length||16;U<this.pos+D;)U*=2;if(U!==this.length){var Q=new Uint8Array(U);Q.set(this.buf),this.buf=Q,this.length=U}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(D){this.realloc(4),se(this.buf,D,this.pos),this.pos+=4},writeSFixed32:function(D){this.realloc(4),se(this.buf,D,this.pos),this.pos+=4},writeFixed64:function(D){this.realloc(8),se(this.buf,-1&D,this.pos),se(this.buf,Math.floor(D*a),this.pos+4),this.pos+=8},writeSFixed64:function(D){this.realloc(8),se(this.buf,-1&D,this.pos),se(this.buf,Math.floor(D*a),this.pos+4),this.pos+=8},writeVarint:function(D){(D=+D||0)>268435455||D<0?function(U,Q){var fe,ze;if(U>=0?(fe=U%4294967296|0,ze=U/4294967296|0):(ze=~(-U/4294967296),4294967295^(fe=~(-U%4294967296))?fe=fe+1|0:(fe=0,ze=ze+1|0)),U>=18446744073709552e3||U<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");Q.realloc(10),function(xe,we,Le){Le.buf[Le.pos++]=127&xe|128,xe>>>=7,Le.buf[Le.pos++]=127&xe|128,xe>>>=7,Le.buf[Le.pos++]=127&xe|128,xe>>>=7,Le.buf[Le.pos++]=127&xe|128,Le.buf[Le.pos]=127&(xe>>>=7)}(fe,0,Q),function(xe,we){var Le=(7&xe)<<4;we.buf[we.pos++]|=Le|((xe>>>=3)?128:0),xe&&(we.buf[we.pos++]=127&xe|((xe>>>=7)?128:0),xe&&(we.buf[we.pos++]=127&xe|((xe>>>=7)?128:0),xe&&(we.buf[we.pos++]=127&xe|((xe>>>=7)?128:0),xe&&(we.buf[we.pos++]=127&xe|((xe>>>=7)?128:0),xe&&(we.buf[we.pos++]=127&xe)))))}(ze,Q)}(D,this):(this.realloc(4),this.buf[this.pos++]=127&D|(D>127?128:0),D<=127||(this.buf[this.pos++]=127&(D>>>=7)|(D>127?128:0),D<=127||(this.buf[this.pos++]=127&(D>>>=7)|(D>127?128:0),D<=127||(this.buf[this.pos++]=D>>>7&127))))},writeSVarint:function(D){this.writeVarint(D<0?2*-D-1:2*D)},writeBoolean:function(D){this.writeVarint(!!D)},writeString:function(D){D=String(D),this.realloc(4*D.length),this.pos++;var U=this.pos;this.pos=function(fe,ze,xe){for(var we,Le,Ae=0;Ae<ze.length;Ae++){if((we=ze.charCodeAt(Ae))>55295&&we<57344){if(!Le){we>56319||Ae+1===ze.length?(fe[xe++]=239,fe[xe++]=191,fe[xe++]=189):Le=we;continue}if(we<56320){fe[xe++]=239,fe[xe++]=191,fe[xe++]=189,Le=we;continue}we=Le-55296<<10|we-56320|65536,Le=null}else Le&&(fe[xe++]=239,fe[xe++]=191,fe[xe++]=189,Le=null);we<128?fe[xe++]=we:(we<2048?fe[xe++]=we>>6|192:(we<65536?fe[xe++]=we>>12|224:(fe[xe++]=we>>18|240,fe[xe++]=we>>12&63|128),fe[xe++]=we>>6&63|128),fe[xe++]=63&we|128)}return xe}(this.buf,D,this.pos);var Q=this.pos-U;Q>=128&&g(U,Q,this),this.pos=U-1,this.writeVarint(Q),this.pos+=Q},writeFloat:function(D){this.realloc(4),r.write(this.buf,D,this.pos,!0,23,4),this.pos+=4},writeDouble:function(D){this.realloc(8),r.write(this.buf,D,this.pos,!0,52,8),this.pos+=8},writeBytes:function(D){var U=D.length;this.writeVarint(U),this.realloc(U);for(var Q=0;Q<U;Q++)this.buf[this.pos++]=D[Q]},writeRawMessage:function(D,U){this.pos++;var Q=this.pos;D(U,this);var fe=this.pos-Q;fe>=128&&g(Q,fe,this),this.pos=Q-1,this.writeVarint(fe),this.pos+=fe},writeMessage:function(D,U,Q){this.writeTag(D,t.Bytes),this.writeRawMessage(U,Q)},writePackedVarint:function(D,U){U.length&&this.writeMessage(D,x,U)},writePackedSVarint:function(D,U){U.length&&this.writeMessage(D,w,U)},writePackedBoolean:function(D,U){U.length&&this.writeMessage(D,A,U)},writePackedFloat:function(D,U){U.length&&this.writeMessage(D,M,U)},writePackedDouble:function(D,U){U.length&&this.writeMessage(D,C,U)},writePackedFixed32:function(D,U){U.length&&this.writeMessage(D,L,U)},writePackedSFixed32:function(D,U){U.length&&this.writeMessage(D,B,U)},writePackedFixed64:function(D,U){U.length&&this.writeMessage(D,j,U)},writePackedSFixed64:function(D,U){U.length&&this.writeMessage(D,$,U)},writeBytesField:function(D,U){this.writeTag(D,t.Bytes),this.writeBytes(U)},writeFixed32Field:function(D,U){this.writeTag(D,t.Fixed32),this.writeFixed32(U)},writeSFixed32Field:function(D,U){this.writeTag(D,t.Fixed32),this.writeSFixed32(U)},writeFixed64Field:function(D,U){this.writeTag(D,t.Fixed64),this.writeFixed64(U)},writeSFixed64Field:function(D,U){this.writeTag(D,t.Fixed64),this.writeSFixed64(U)},writeVarintField:function(D,U){this.writeTag(D,t.Varint),this.writeVarint(U)},writeSVarintField:function(D,U){this.writeTag(D,t.Varint),this.writeSVarint(U)},writeStringField:function(D,U){this.writeTag(D,t.Bytes),this.writeString(U)},writeFloatField:function(D,U){this.writeTag(D,t.Fixed32),this.writeFloat(U)},writeDoubleField:function(D,U){this.writeTag(D,t.Fixed64),this.writeDouble(U)},writeBooleanField:function(D,U){this.writeVarintField(D,!!U)}},Pp}var Ip=le(eg());const Ep=3;function qv(r,t,n){r===1&&n.readMessage(Hv,t)}function Hv(r,t,n){if(r===3){const{id:a,bitmap:c,width:d,height:p,left:g,top:x,advance:w}=n.readMessage(Wv,{});t.push({id:a,bitmap:new Yc({width:d+2*Ep,height:p+2*Ep},c),metrics:{width:d,height:p,left:g,top:x,advance:w}})}}function Wv(r,t,n){r===1?t.id=n.readVarint():r===2?t.bitmap=n.readBytes():r===3?t.width=n.readVarint():r===4?t.height=n.readVarint():r===5?t.left=n.readSVarint():r===6?t.top=n.readSVarint():r===7&&(t.advance=n.readVarint())}const Xv=Ep;function tg(r){let t=0,n=0;for(const p of r)t+=p.w*p.h,n=Math.max(n,p.w);r.sort((p,g)=>g.h-p.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}];let c=0,d=0;for(const p of r)for(let g=a.length-1;g>=0;g--){const x=a[g];if(!(p.w>x.w||p.h>x.h)){if(p.x=x.x,p.y=x.y,d=Math.max(d,p.y+p.h),c=Math.max(c,p.x+p.w),p.w===x.w&&p.h===x.h){const w=a.pop();g<a.length&&(a[g]=w)}else p.h===x.h?(x.x+=p.w,x.w-=p.w):p.w===x.w?(x.y+=p.h,x.h-=p.h):(a.push({x:x.x+p.w,y:x.y,w:x.w-p.w,h:p.h}),x.y+=p.h,x.h-=p.h);break}}return{w:c,h:d,fill:t/(c*d)||0}}const Br=1;class kp{constructor(t,{pixelRatio:n,version:a,stretchX:c,stretchY:d,content:p,textFitWidth:g,textFitHeight:x}){this.paddedRect=t,this.pixelRatio=n,this.stretchX=c,this.stretchY=d,this.content=p,this.version=a,this.textFitWidth=g,this.textFitHeight=x}get tl(){return[this.paddedRect.x+Br,this.paddedRect.y+Br]}get br(){return[this.paddedRect.x+this.paddedRect.w-Br,this.paddedRect.y+this.paddedRect.h-Br]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Br)/this.pixelRatio,(this.paddedRect.h-2*Br)/this.pixelRatio]}}class ig{constructor(t,n){const a={},c={};this.haveRenderCallbacks=[];const d=[];this.addImages(t,a,d),this.addImages(n,c,d);const{w:p,h:g}=tg(d),x=new rn({width:p||1,height:g||1});for(const w in t){const M=t[w],C=a[w].paddedRect;rn.copy(M.data,x,{x:0,y:0},{x:C.x+Br,y:C.y+Br},M.data)}for(const w in n){const M=n[w],C=c[w].paddedRect,A=C.x+Br,L=C.y+Br,B=M.data.width,j=M.data.height;rn.copy(M.data,x,{x:0,y:0},{x:A,y:L},M.data),rn.copy(M.data,x,{x:0,y:j-1},{x:A,y:L-1},{width:B,height:1}),rn.copy(M.data,x,{x:0,y:0},{x:A,y:L+j},{width:B,height:1}),rn.copy(M.data,x,{x:B-1,y:0},{x:A-1,y:L},{width:1,height:j}),rn.copy(M.data,x,{x:0,y:0},{x:A+B,y:L},{width:1,height:j})}this.image=x,this.iconPositions=a,this.patternPositions=c}addImages(t,n,a){for(const c in t){const d=t[c],p={x:0,y:0,w:d.data.width+2*Br,h:d.data.height+2*Br};a.push(p),n[c]=new kp(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(t,n){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in t.updatedImages)this.patchUpdatedImage(this.iconPositions[a],t.getImage(a),n),this.patchUpdatedImage(this.patternPositions[a],t.getImage(a),n)}patchUpdatedImage(t,n,a){if(!t||!n||t.version===n.version)return;t.version=n.version;const[c,d]=t.tl;a.update(n.data,void 0,{x:c,y:d})}}var cs;Ue("ImagePosition",kp),Ue("ImageAtlas",ig),S.al=void 0,(cs=S.al||(S.al={}))[cs.none=0]="none",cs[cs.horizontal=1]="horizontal",cs[cs.vertical=2]="vertical",cs[cs.horizontalOnly=3]="horizontalOnly";const td=-17;class lu{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,n,a){const c=new lu;return c.scale=t||1,c.fontStack=n,c.verticalAlign=a||"bottom",c}static forImage(t,n){const a=new lu;return a.imageName=t,a.verticalAlign=n||"bottom",a}}class pl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,n){const a=new pl;for(let c=0;c<t.sections.length;c++){const d=t.sections[c];d.image?a.addImageSection(d):a.addTextSection(d,n)}return a}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let n="";for(let a=0;a<t.length;a++){const c=t.charCodeAt(a+1)||null,d=t.charCodeAt(a-1)||null;n+=c&&jh(c)&&!ou[t[a+1]]||d&&jh(d)&&!ou[t[a-1]]||!ou[t[a]]?t[a]:ou[t[a]]}return n}(this.text)}trim(){let t=0;for(let a=0;a<this.text.length&&rd[this.text.charCodeAt(a)];a++)t++;let n=this.text.length;for(let a=this.text.length-1;a>=0&&a>=t&&rd[this.text.charCodeAt(a)];a--)n--;this.text=this.text.substring(t,n),this.sectionIndex=this.sectionIndex.slice(t,n)}substring(t,n){const a=new pl;return a.text=this.text.substring(t,n),a.sectionIndex=this.sectionIndex.slice(t,n),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,n)=>Math.max(t,this.sections[n].scale),0)}getMaxImageSize(t){let n=0,a=0;for(let c=0;c<this.length();c++){const d=this.getSection(c);if(d.imageName){const p=t[d.imageName];if(!p)continue;const g=p.displaySize;n=Math.max(n,g[0]),a=Math.max(a,g[1])}}return{maxImageWidth:n,maxImageHeight:a}}addTextSection(t,n){this.text+=t.text,this.sections.push(lu.forText(t.scale,t.fontStack||n,t.verticalAlign));const a=this.sections.length-1;for(let c=0;c<t.text.length;++c)this.sectionIndex.push(a)}addImageSection(t){const n=t.image?t.image.name:"";if(n.length===0)return void Zi("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(lu.forImage(n,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):Zi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function id(r,t,n,a,c,d,p,g,x,w,M,C,A,L,B){const j=pl.fromFeature(r,c);let $;C===S.al.vertical&&j.verticalizePunctuation();const{processBidirectionalText:X,processStyledBidirectionalText:se}=ta;if(X&&j.sections.length===1){$=[];const U=X(j.toString(),zp(j,w,d,t,a,L));for(const Q of U){const fe=new pl;fe.text=Q,fe.sections=j.sections;for(let ze=0;ze<Q.length;ze++)fe.sectionIndex.push(0);$.push(fe)}}else if(se){$=[];const U=se(j.text,j.sectionIndex,zp(j,w,d,t,a,L));for(const Q of U){const fe=new pl;fe.text=Q[0],fe.sectionIndex=Q[1],fe.sections=j.sections,$.push(fe)}}else $=function(U,Q){const fe=[],ze=U.text;let xe=0;for(const we of Q)fe.push(U.substring(xe,we)),xe=we;return xe<ze.length&&fe.push(U.substring(xe,ze.length)),fe}(j,zp(j,w,d,t,a,L));const Y=[],D={positionedLines:Y,text:j.toString(),top:M[1],bottom:M[1],left:M[0],right:M[0],writingMode:C,iconsInText:!1,verticalizable:!1};return function(U,Q,fe,ze,xe,we,Le,Ae,Fe,Pe,Ge,tt){let Je=0,We=0,wt=0,wi=0;const Oi=Ae==="right"?1:Ae==="left"?0:.5,ur=Fi/tt;let an=0;for(const gi of xe){gi.trim();const qi=gi.getMaxScale(),er={positionedGlyphs:[],lineOffset:0};U.positionedLines[an]=er;const tr=er.positionedGlyphs;let Pr=0;if(!gi.length()){We+=we,++an;continue}const sn=Qv(ze,gi,ur);for(let Or=0;Or<gi.length();Or++){const ji=gi.getSection(Or),Wi=gi.getSectionIndex(Or),Xi=gi.getCharCode(Or),Ai=e0(Fe,Ge,Xi);let ni;if(ji.imageName){if(U.iconsInText=!0,ji.scale=ji.scale*ur,ni=i0(ji,Ai,qi,sn,ze),!ni)continue;Pr=Math.max(Pr,ni.imageOffset)}else if(ni=t0(ji,Xi,Ai,sn,Q,fe),!ni)continue;const{rect:Fn,metrics:_l,baselineOffset:On}=ni;tr.push({glyph:Xi,imageName:ji.imageName,x:Je,y:We+On+td,vertical:Ai,scale:ji.scale,fontStack:ji.fontStack,sectionIndex:Wi,metrics:_l,rect:Fn}),Ai?(U.verticalizable=!0,Je+=(ji.imageName?_l.advance:Fi)*ji.scale+Pe):Je+=_l.advance*ji.scale+Pe}tr.length!==0&&(wt=Math.max(Je-Pe,wt),r0(tr,0,tr.length-1,Oi)),Je=0,er.lineOffset=Math.max(Pr,(qi-1)*Fi);const Hi=we*qi+Pr;We+=Hi,wi=Math.max(Hi,wi),++an}const{horizontalAlign:Fr,verticalAlign:Qi}=Ap(Le);(function(gi,qi,er,tr,Pr,sn,Hi,Or,ji){const Wi=(qi-er)*Pr;let Xi=0;Xi=sn!==Hi?-Or*tr-td:-tr*ji*Hi+.5*Hi;for(const Ai of gi)for(const ni of Ai.positionedGlyphs)ni.x+=Wi,ni.y+=Xi})(U.positionedLines,Oi,Fr,Qi,wt,wi,we,We,xe.length),U.top+=-Qi*We,U.bottom=U.top+We,U.left+=-Fr*wt,U.right=U.left+wt}(D,t,n,a,$,p,g,x,C,w,A,B),!function(U){for(const Q of U)if(Q.positionedGlyphs.length!==0)return!1;return!0}(Y)&&D}const rd={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Kv={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Yv={40:!0};function rg(r,t,n,a,c,d){if(t.imageName){const p=a[t.imageName];return p?p.displaySize[0]*t.scale*Fi/d+c:0}{const p=n[t.fontStack],g=p&&p[r];return g?g.metrics.advance*t.scale+c:0}}function ng(r,t,n,a){const c=Math.pow(r-t,2);return a?r<t?c/2:2*c:c+Math.abs(n)*n}function Jv(r,t,n){let a=0;return r===10&&(a-=1e4),n&&(a+=150),r!==40&&r!==65288||(a+=50),t!==41&&t!==65289||(a+=50),a}function ag(r,t,n,a,c,d){let p=null,g=ng(t,n,c,d);for(const x of a){const w=ng(t-x.x,n,c,d)+x.badness;w<=g&&(p=x,g=w)}return{index:r,x:t,priorBreak:p,badness:g}}function sg(r){return r?sg(r.priorBreak).concat(r.index):[]}function zp(r,t,n,a,c,d){if(!r)return[];const p=[],g=function(C,A,L,B,j,$){let X=0;for(let se=0;se<C.length();se++){const Y=C.getSection(se);X+=rg(C.getCharCode(se),Y,B,j,A,$)}return X/Math.max(1,Math.ceil(X/L))}(r,t,n,a,c,d),x=r.text.indexOf("​")>=0;let w=0;for(let C=0;C<r.length();C++){const A=r.getSection(C),L=r.getCharCode(C);if(rd[L]||(w+=rg(L,A,a,c,t,d)),C<r.length()-1){const B=!((M=L)<11904)&&(!!vt["CJK Compatibility Forms"](M)||!!vt["CJK Compatibility"](M)||!!vt["CJK Strokes"](M)||!!vt["CJK Symbols and Punctuation"](M)||!!vt["Enclosed CJK Letters and Months"](M)||!!vt["Halfwidth and Fullwidth Forms"](M)||!!vt["Ideographic Description Characters"](M)||!!vt["Vertical Forms"](M)||Oh.test(String.fromCodePoint(M)));(Kv[L]||B||A.imageName||C!==r.length()-2&&Yv[r.getCharCode(C+1)])&&p.push(ag(C+1,w,g,p,Jv(L,r.getCharCode(C+1),B&&x),!1))}}var M;return sg(ag(r.length(),w,g,p,0,!0))}function Ap(r){let t=.5,n=.5;switch(r){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:t,verticalAlign:n}}function Qv(r,t,n){const a=t.getMaxScale()*Fi,{maxImageWidth:c,maxImageHeight:d}=t.getMaxImageSize(r),p=Math.max(a,d*n);return{verticalLineContentWidth:Math.max(a,c*n),horizontalLineContentHeight:p}}function og(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function e0(r,t,n){return!(r===S.al.horizontal||!t&&!il(n)||t&&(rd[n]||(a=n,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(a)))));var a}function t0(r,t,n,a,c,d){const p=d[r.fontStack],g=function(w,M,C,A){if(w&&w.rect)return w;const L=M[C.fontStack],B=L&&L[A];return B?{rect:null,metrics:B.metrics}:null}(p&&p[t],c,r,t);if(g===null)return null;let x;if(n)x=a.verticalLineContentWidth-r.scale*Fi;else{const w=og(r.verticalAlign);x=(a.horizontalLineContentHeight-r.scale*Fi)*w}return{rect:g.rect,metrics:g.metrics,baselineOffset:x}}function i0(r,t,n,a,c){const d=c[r.imageName];if(!d)return null;const p=d.paddedRect,g=d.displaySize,x={width:g[0],height:g[1],left:Br,top:-3,advance:t?g[1]:g[0]};let w;if(t)w=a.verticalLineContentWidth-g[1]*r.scale;else{const M=og(r.verticalAlign);w=(a.horizontalLineContentHeight-g[1]*r.scale)*M}return{rect:p,metrics:x,baselineOffset:w,imageOffset:(t?g[0]:g[1])*r.scale-Fi*n}}function r0(r,t,n,a){if(a===0)return;const c=r[n],d=(r[n].x+c.metrics.advance*c.scale)*a;for(let p=t;p<=n;p++)r[p].x-=d}function n0(r,t,n){const{horizontalAlign:a,verticalAlign:c}=Ap(n),d=t[0]-r.displaySize[0]*a,p=t[1]-r.displaySize[1]*c;return{image:r,top:p,bottom:p+r.displaySize[1],left:d,right:d+r.displaySize[0]}}function lg(r){var t,n;let a=r.left,c=r.top,d=r.right-a,p=r.bottom-c;const g=(t=r.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",x=(n=r.image.textFitHeight)!==null&&n!==void 0?n:"stretchOrShrink",w=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(x==="proportional"){if(g==="stretchOnly"&&d/p<w||g==="proportional"){const M=Math.ceil(p*w);a*=M/d,d=M}}else if(g==="proportional"&&x==="stretchOnly"&&w!==0&&d/p>w){const M=Math.ceil(d/w);c*=M/p,p=M}return{x1:a,y1:c,x2:a+d,y2:c+p}}function cg(r,t,n,a,c,d){const p=r.image;let g;if(p.content){const $=p.content,X=p.pixelRatio||1;g=[$[0]/X,$[1]/X,p.displaySize[0]-$[2]/X,p.displaySize[1]-$[3]/X]}const x=t.left*d,w=t.right*d;let M,C,A,L;n==="width"||n==="both"?(L=c[0]+x-a[3],C=c[0]+w+a[1]):(L=c[0]+(x+w-p.displaySize[0])/2,C=L+p.displaySize[0]);const B=t.top*d,j=t.bottom*d;return n==="height"||n==="both"?(M=c[1]+B-a[0],A=c[1]+j+a[2]):(M=c[1]+(B+j-p.displaySize[1])/2,A=M+p.displaySize[1]),{image:p,top:M,right:C,bottom:A,left:L,collisionPadding:g}}const cu=255,aa=128,us=cu*aa;function ug(r,t){const{expression:n}=t;if(n.kind==="constant")return{kind:"constant",layoutSize:n.evaluate(new ti(r+1))};if(n.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:c}=n;let d=0;for(;d<a.length&&a[d]<=r;)d++;d=Math.max(0,d-1);let p=d;for(;p<a.length&&a[p]<r+1;)p++;p=Math.min(a.length-1,p);const g=a[d],x=a[p];return n.kind==="composite"?{kind:"composite",minZoom:g,maxZoom:x,interpolationType:c}:{kind:"camera",minZoom:g,maxZoom:x,minSize:n.evaluate(new ti(g)),maxSize:n.evaluate(new ti(x)),interpolationType:c}}}function Rp(r,t,n){let a="never";const c=r.get(t);return c?a=c:r.get(n)&&(a="always"),a}const a0=nu.VectorTileFeature.types,s0=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function nd(r,t,n,a,c,d,p,g,x,w,M,C,A){const L=g?Math.min(us,Math.round(g[0])):0,B=g?Math.min(us,Math.round(g[1])):0;r.emplaceBack(t,n,Math.round(32*a),Math.round(32*c),d,p,(L<<1)+(x?1:0),B,16*w,16*M,256*C,256*A)}function Dp(r,t,n){r.emplaceBack(t.x,t.y,n),r.emplaceBack(t.x,t.y,n),r.emplaceBack(t.x,t.y,n),r.emplaceBack(t.x,t.y,n)}function o0(r){for(const t of r.sections)if(lp(t.text))return!0;return!1}class Lp{constructor(t){this.layoutVertexArray=new me,this.indexArray=new Be,this.programConfigurations=t,this.segments=new st,this.dynamicLayoutVertexArray=new Se,this.opacityVertexArray=new Ce,this.hasVisibleVertices=!1,this.placedSymbolArray=new T}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,n,a,c){this.isEmpty()||(a&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Nv.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,n),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Zv.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,s0,!0),this.opacityVertexBuffer.itemSize=1),(a||c)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Ue("SymbolBuffers",Lp);class Bp{constructor(t,n,a){this.layoutVertexArray=new t,this.layoutAttributes=n,this.indexArray=new a,this.segments=new st,this.collisionVertexArray=new je}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Vv.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ue("CollisionBuffers",Bp);class fl{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(p=>p.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ug(this.zoom,n["text-size"]),this.iconSizeData=ug(this.zoom,n["icon-size"]);const a=this.layers[0].layout,c=a.get("symbol-sort-key"),d=a.get("symbol-z-order");this.canOverlap=Rp(a,"text-overlap","text-allow-overlap")!=="never"||Rp(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map(p=>S.al[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=t.sourceID}createArrays(){this.text=new Lp(new Aa(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Lp(new Aa(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new k,this.lineVertexArray=new F,this.symbolInstances=new E,this.textAnchorOffsets=new H}calculateGlyphDependencies(t,n,a,c,d){for(let p=0;p<t.length;p++)if(n[t.charCodeAt(p)]=!0,(a||c)&&d){const g=ou[t.charAt(p)];g&&(n[g.charCodeAt(0)]=!0)}}populate(t,n,a){const c=this.layers[0],d=c.layout,p=d.get("text-font"),g=d.get("text-field"),x=d.get("icon-image"),w=(g.value.kind!=="constant"||g.value.value instanceof wr&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),M=x.value.kind!=="constant"||!!x.value.value||Object.keys(x.parameters).length>0,C=d.get("symbol-sort-key");if(this.features=[],!w&&!M)return;const A=n.iconDependencies,L=n.glyphDependencies,B=n.availableImages,j=new ti(this.zoom);for(const{feature:$,id:X,index:se,sourceLayerIndex:Y}of t){const D=c._featureFilter.needGeometry,U=na($,D);if(!c._featureFilter.filter(j,U,a))continue;let Q,fe;if(D||(U.geometry=Lr($)),w){const xe=c.getValueAndResolveTokens("text-field",U,a,B),we=wr.factory(xe),Le=this.hasRTLText=this.hasRTLText||o0(we);(!Le||ta.getRTLTextPluginStatus()==="unavailable"||Le&&ta.isParsed())&&(Q=$v(we,c,U))}if(M){const xe=c.getValueAndResolveTokens("icon-image",U,a,B);fe=xe instanceof Rr?xe:Rr.fromString(xe)}if(!Q&&!fe)continue;const ze=this.sortFeaturesByKey?C.evaluate(U,{},a):void 0;if(this.features.push({id:X,text:Q,icon:fe,index:se,sourceLayerIndex:Y,geometry:U.geometry,properties:$.properties,type:a0[$.type],sortKey:ze}),fe&&(A[fe.name]=!0),Q){const xe=p.evaluate(U,{},a).join(","),we=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(S.al.vertical)>=0;for(const Le of Q.sections)if(Le.image)A[Le.image.name]=!0;else{const Ae=el(Q.toString()),Fe=Le.fontStack||xe,Pe=L[Fe]=L[Fe]||{};this.calculateGlyphDependencies(Le.text,Pe,we,this.allowVerticalPlacement,Ae)}}}d.get("symbol-placement")==="line"&&(this.features=function($){const X={},se={},Y=[];let D=0;function U(xe){Y.push($[xe]),D++}function Q(xe,we,Le){const Ae=se[xe];return delete se[xe],se[we]=Ae,Y[Ae].geometry[0].pop(),Y[Ae].geometry[0]=Y[Ae].geometry[0].concat(Le[0]),Ae}function fe(xe,we,Le){const Ae=X[we];return delete X[we],X[xe]=Ae,Y[Ae].geometry[0].shift(),Y[Ae].geometry[0]=Le[0].concat(Y[Ae].geometry[0]),Ae}function ze(xe,we,Le){const Ae=Le?we[0][we[0].length-1]:we[0][0];return`${xe}:${Ae.x}:${Ae.y}`}for(let xe=0;xe<$.length;xe++){const we=$[xe],Le=we.geometry,Ae=we.text?we.text.toString():null;if(!Ae){U(xe);continue}const Fe=ze(Ae,Le),Pe=ze(Ae,Le,!0);if(Fe in se&&Pe in X&&se[Fe]!==X[Pe]){const Ge=fe(Fe,Pe,Le),tt=Q(Fe,Pe,Y[Ge].geometry);delete X[Fe],delete se[Pe],se[ze(Ae,Y[tt].geometry,!0)]=tt,Y[Ge].geometry=null}else Fe in se?Q(Fe,Pe,Le):Pe in X?fe(Fe,Pe,Le):(U(xe),X[Fe]=D-1,se[Pe]=D-1)}return Y.filter(xe=>xe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort(($,X)=>$.sortKey-X.sortKey)}update(t,n,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,n,this.layers,a),this.icon.programConfigurations.updatePaintArrays(t,n,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,n){const a=this.lineVertexArray.length;if(t.segment!==void 0){let c=t.dist(n[t.segment+1]),d=t.dist(n[t.segment]);const p={};for(let g=t.segment+1;g<n.length;g++)p[g]={x:n[g].x,y:n[g].y,tileUnitDistanceFromAnchor:c},g<n.length-1&&(c+=n[g+1].dist(n[g]));for(let g=t.segment||0;g>=0;g--)p[g]={x:n[g].x,y:n[g].y,tileUnitDistanceFromAnchor:d},g>0&&(d+=n[g-1].dist(n[g]));for(let g=0;g<n.length;g++){const x=p[g];this.lineVertexArray.emplaceBack(x.x,x.y,x.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(t,n,a,c,d,p,g,x,w,M,C,A){const L=t.indexArray,B=t.layoutVertexArray,j=t.segments.prepareSegment(4*n.length,B,L,this.canOverlap?p.sortKey:void 0),$=this.glyphOffsetArray.length,X=j.vertexLength,se=this.allowVerticalPlacement&&g===S.al.vertical?Math.PI/2:0,Y=p.text&&p.text.sections;for(let D=0;D<n.length;D++){const{tl:U,tr:Q,bl:fe,br:ze,tex:xe,pixelOffsetTL:we,pixelOffsetBR:Le,minFontScaleX:Ae,minFontScaleY:Fe,glyphOffset:Pe,isSDF:Ge,sectionIndex:tt}=n[D],Je=j.vertexLength,We=Pe[1];nd(B,x.x,x.y,U.x,We+U.y,xe.x,xe.y,a,Ge,we.x,we.y,Ae,Fe),nd(B,x.x,x.y,Q.x,We+Q.y,xe.x+xe.w,xe.y,a,Ge,Le.x,we.y,Ae,Fe),nd(B,x.x,x.y,fe.x,We+fe.y,xe.x,xe.y+xe.h,a,Ge,we.x,Le.y,Ae,Fe),nd(B,x.x,x.y,ze.x,We+ze.y,xe.x+xe.w,xe.y+xe.h,a,Ge,Le.x,Le.y,Ae,Fe),Dp(t.dynamicLayoutVertexArray,x,se),L.emplaceBack(Je,Je+2,Je+1),L.emplaceBack(Je+1,Je+2,Je+3),j.vertexLength+=4,j.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Pe[0]),D!==n.length-1&&tt===n[D+1].sectionIndex||t.programConfigurations.populatePaintArrays(B.length,p,p.index,{},A,Y&&Y[tt])}t.placedSymbolArray.emplaceBack(x.x,x.y,$,this.glyphOffsetArray.length-$,X,w,M,x.segment,a?a[0]:0,a?a[1]:0,c[0],c[1],g,0,!1,0,C)}_addCollisionDebugVertex(t,n,a,c,d,p){return n.emplaceBack(0,0),t.emplaceBack(a.x,a.y,c,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(t,n,a,c,d,p,g){const x=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),w=x.vertexLength,M=d.layoutVertexArray,C=d.collisionVertexArray,A=g.anchorX,L=g.anchorY;this._addCollisionDebugVertex(M,C,p,A,L,new De(t,n)),this._addCollisionDebugVertex(M,C,p,A,L,new De(a,n)),this._addCollisionDebugVertex(M,C,p,A,L,new De(a,c)),this._addCollisionDebugVertex(M,C,p,A,L,new De(t,c)),x.vertexLength+=4;const B=d.indexArray;B.emplaceBack(w,w+1),B.emplaceBack(w+1,w+2),B.emplaceBack(w+2,w+3),B.emplaceBack(w+3,w),x.primitiveLength+=4}addDebugCollisionBoxes(t,n,a,c){for(let d=t;d<n;d++){const p=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,c?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Bp(Te,Ym.members,Ee),this.iconCollisionBox=new Bp(Te,Ym.members,Ee);for(let t=0;t<this.symbolInstances.length;t++){const n=this.symbolInstances.get(t);this.addDebugCollisionBoxes(n.textBoxStartIndex,n.textBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.iconBoxStartIndex,n.iconBoxEndIndex,n,!1),this.addDebugCollisionBoxes(n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex,n,!1)}}_deserializeCollisionBoxesForSymbol(t,n,a,c,d,p,g,x,w){const M={};for(let C=n;C<a;C++){const A=t.get(C);M.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},M.textFeatureIndex=A.featureIndex;break}for(let C=c;C<d;C++){const A=t.get(C);M.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},M.verticalTextFeatureIndex=A.featureIndex;break}for(let C=p;C<g;C++){const A=t.get(C);M.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},M.iconFeatureIndex=A.featureIndex;break}for(let C=x;C<w;C++){const A=t.get(C);M.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},M.verticalIconFeatureIndex=A.featureIndex;break}return M}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let n=0;n<this.symbolInstances.length;n++){const a=this.symbolInstances.get(n);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,n){const a=t.placedSymbolArray.get(n),c=a.vertexStartIndex+4*a.numGlyphs;for(let d=a.vertexStartIndex;d<c;d+=4)t.indexArray.emplaceBack(d,d+2,d+1),t.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const n=Math.sin(t),a=Math.cos(t),c=[],d=[],p=[];for(let g=0;g<this.symbolInstances.length;++g){p.push(g);const x=this.symbolInstances.get(g);c.push(0|Math.round(n*x.anchorX+a*x.anchorY)),d.push(x.featureIndex)}return p.sort((g,x)=>c[g]-c[x]||d[x]-d[g]),p}addToSortKeyRanges(t,n){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===n?a.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:n,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const n of this.symbolInstanceIndexes){const a=this.symbolInstances.get(n);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((c,d,p)=>{c>=0&&p.indexOf(c)===d&&this.addIndicesForPlacedSymbol(this.text,c)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let hg,dg;Ue("SymbolBucket",fl,{omit:["layers","collisionBoxArray","features","compareText"]}),fl.MAX_GLYPHS=65535,fl.addDynamicAttributes=Dp;var Fp={get paint(){return dg=dg||new Sr({"icon-opacity":new nt(V.paint_symbol["icon-opacity"]),"icon-color":new nt(V.paint_symbol["icon-color"]),"icon-halo-color":new nt(V.paint_symbol["icon-halo-color"]),"icon-halo-width":new nt(V.paint_symbol["icon-halo-width"]),"icon-halo-blur":new nt(V.paint_symbol["icon-halo-blur"]),"icon-translate":new Ye(V.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ye(V.paint_symbol["icon-translate-anchor"]),"text-opacity":new nt(V.paint_symbol["text-opacity"]),"text-color":new nt(V.paint_symbol["text-color"],{runtimeType:fr,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new nt(V.paint_symbol["text-halo-color"]),"text-halo-width":new nt(V.paint_symbol["text-halo-width"]),"text-halo-blur":new nt(V.paint_symbol["text-halo-blur"]),"text-translate":new Ye(V.paint_symbol["text-translate"]),"text-translate-anchor":new Ye(V.paint_symbol["text-translate-anchor"])})},get layout(){return hg=hg||new Sr({"symbol-placement":new Ye(V.layout_symbol["symbol-placement"]),"symbol-spacing":new Ye(V.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ye(V.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new nt(V.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ye(V.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ye(V.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ye(V.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ye(V.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ye(V.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ye(V.layout_symbol["icon-rotation-alignment"]),"icon-size":new nt(V.layout_symbol["icon-size"]),"icon-text-fit":new Ye(V.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ye(V.layout_symbol["icon-text-fit-padding"]),"icon-image":new nt(V.layout_symbol["icon-image"]),"icon-rotate":new nt(V.layout_symbol["icon-rotate"]),"icon-padding":new nt(V.layout_symbol["icon-padding"]),"icon-keep-upright":new Ye(V.layout_symbol["icon-keep-upright"]),"icon-offset":new nt(V.layout_symbol["icon-offset"]),"icon-anchor":new nt(V.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ye(V.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ye(V.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ye(V.layout_symbol["text-rotation-alignment"]),"text-field":new nt(V.layout_symbol["text-field"]),"text-font":new nt(V.layout_symbol["text-font"]),"text-size":new nt(V.layout_symbol["text-size"]),"text-max-width":new nt(V.layout_symbol["text-max-width"]),"text-line-height":new Ye(V.layout_symbol["text-line-height"]),"text-letter-spacing":new nt(V.layout_symbol["text-letter-spacing"]),"text-justify":new nt(V.layout_symbol["text-justify"]),"text-radial-offset":new nt(V.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ye(V.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new nt(V.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new nt(V.layout_symbol["text-anchor"]),"text-max-angle":new Ye(V.layout_symbol["text-max-angle"]),"text-writing-mode":new Ye(V.layout_symbol["text-writing-mode"]),"text-rotate":new nt(V.layout_symbol["text-rotate"]),"text-padding":new Ye(V.layout_symbol["text-padding"]),"text-keep-upright":new Ye(V.layout_symbol["text-keep-upright"]),"text-transform":new nt(V.layout_symbol["text-transform"]),"text-offset":new nt(V.layout_symbol["text-offset"]),"text-allow-overlap":new Ye(V.layout_symbol["text-allow-overlap"]),"text-overlap":new Ye(V.layout_symbol["text-overlap"]),"text-ignore-placement":new Ye(V.layout_symbol["text-ignore-placement"]),"text-optional":new Ye(V.layout_symbol["text-optional"])})}};class pg{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:It,this.defaultValue=t}evaluate(t){if(t.formattedSection){const n=this.defaultValue.property.overrides;if(n&&n.hasOverride(t.formattedSection))return n.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ue("FormatSectionOverride",pg,{omit:["defaultValue"]});class ad extends yn{constructor(t){super(t,Fp)}recalculate(t,n){if(super.recalculate(t,n),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const a=this.layout.get("text-writing-mode");if(a){const c=[];for(const d of a)c.indexOf(d)<0&&c.push(d);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,n,a,c){const d=this.layout.get(t).evaluate(n,{},a,c),p=this._unevaluatedLayout._values[t];return p.isDataDriven()||Ma(p.value)||!d?d:function(g,x){return x.replace(/{([^{}]+)}/g,(w,M)=>g&&M in g?String(g[M]):"")}(n.properties,d)}createBucket(t){return new fl(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Fp.paint.overridableProperties){if(!ad.hasPaintOverride(this.layout,t))continue;const n=this.paint.get(t),a=new pg(n),c=new yc(a,n.property.specification);let d=null;d=n.value.kind==="constant"||n.value.kind==="source"?new xc("source",c):new vc("composite",c,n.value.zoomStops),this.paint._values[t]=new _n(n.property,d,n.parameters)}}_handleOverridablePaintPropertyUpdate(t,n,a){return!(!this.layout||n.isDataDriven()||a.isDataDriven())&&ad.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,n){const a=t.get("text-field"),c=Fp.paint.properties[n];let d=!1;const p=g=>{for(const x of g)if(c.overrides&&c.overrides.hasOverride(x))return void(d=!0)};if(a.value.kind==="constant"&&a.value.value instanceof wr)p(a.value.value.sections);else if(a.value.kind==="source"){const g=w=>{d||(w instanceof Yn&&vi(w.value)===_a?p(w.value.sections):w instanceof Do?p(w.sections):w.eachChild(g))},x=a.value;x._styleExpression&&g(x._styleExpression.expression)}return d}}let fg;var l0={get paint(){return fg=fg||new Sr({"background-color":new Ye(V.paint_background["background-color"]),"background-pattern":new jc(V.paint_background["background-pattern"]),"background-opacity":new Ye(V.paint_background["background-opacity"])})}};class c0 extends yn{constructor(t){super(t,l0)}}let mg;var u0={get paint(){return mg=mg||new Sr({"raster-opacity":new Ye(V.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ye(V.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ye(V.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ye(V.paint_raster["raster-brightness-max"]),"raster-saturation":new Ye(V.paint_raster["raster-saturation"]),"raster-contrast":new Ye(V.paint_raster["raster-contrast"]),"raster-resampling":new Ye(V.paint_raster["raster-resampling"]),"raster-fade-duration":new Ye(V.paint_raster["raster-fade-duration"])})}};class h0 extends yn{constructor(t){super(t,u0)}}class d0 extends yn{constructor(t){super(t,{}),this.onAdd=n=>{this.implementation.onAdd&&this.implementation.onAdd(n,n.painter.context.gl)},this.onRemove=n=>{this.implementation.onRemove&&this.implementation.onRemove(n,n.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class p0{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const f0={once:!0},Op=63710088e-1;class hs{constructor(t,n){if(isNaN(t)||isNaN(n))throw new Error(`Invalid LngLat object: (${t}, ${n})`);if(this.lng=+t,this.lat=+n,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new hs(hn(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const n=Math.PI/180,a=this.lat*n,c=t.lat*n,d=Math.sin(a)*Math.sin(c)+Math.cos(a)*Math.cos(c)*Math.cos((t.lng-this.lng)*n);return Op*Math.acos(Math.min(d,1))}static convert(t){if(t instanceof hs)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new hs(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new hs(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const gg=2*Math.PI*Op;function _g(r){return gg*Math.cos(r*Math.PI/180)}function yg(r){return(180+r)/360}function xg(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function vg(r,t){return r/_g(t)}function jp(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function bg(r,t){return r*_g(jp(t))}class uu{constructor(t,n,a=0){this.x=+t,this.y=+n,this.z=+a}static fromLngLat(t,n=0){const a=hs.convert(t);return new uu(yg(a.lng),xg(a.lat),vg(n,a.lat))}toLngLat(){return new hs(360*this.x-180,jp(this.y))}toAltitude(){return bg(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/gg*(t=jp(this.y),1/Math.cos(t*Math.PI/180));var t}}function wg(r,t,n){var a=2*Math.PI*6378137/256/Math.pow(2,n);return[r*a-2*Math.PI*6378137/2,t*a-2*Math.PI*6378137/2]}class Np{constructor(t,n,a){if(!function(c,d,p){return!(c<0||c>25||p<0||p>=Math.pow(2,c)||d<0||d>=Math.pow(2,c))}(t,n,a))throw new Error(`x=${n}, y=${a}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=n,this.y=a,this.key=ml(0,t,t,n,a)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,n,a){const c=(p=this.y,g=this.z,x=wg(256*(d=this.x),256*(p=Math.pow(2,g)-p-1),g),w=wg(256*(d+1),256*(p+1),g),x[0]+","+x[1]+","+w[0]+","+w[1]);var d,p,g,x,w;const M=function(C,A,L){let B,j="";for(let $=C;$>0;$--)B=1<<$-1,j+=(A&B?1:0)+(L&B?2:0);return j}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,n>1?"@2x":"").replace(/{quadkey}/g,M).replace(/{bbox-epsg-3857}/g,c)}isChildOf(t){const n=this.z-t.z;return n>0&&t.x===this.x>>n&&t.y===this.y>>n}getTilePoint(t){const n=Math.pow(2,this.z);return new De((t.x*n-this.x)*Ft,(t.y*n-this.y)*Ft)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Tg{constructor(t,n){this.wrap=t,this.canonical=n,this.key=ml(t,n.z,n.z,n.x,n.y)}}class nn{constructor(t,n,a,c,d){if(this.terrainRttPosMatrix32f=null,t<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${a}`);this.overscaledZ=t,this.wrap=n,this.canonical=new Np(a,+c,+d),this.key=ml(n,t,a,c,d)}clone(){return new nn(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const n=this.canonical.z-t;return t>this.canonical.z?new nn(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new nn(t,this.wrap,t,this.canonical.x>>n,this.canonical.y>>n)}calculateScaledKey(t,n){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-t;return t>this.canonical.z?ml(this.wrap*+n,t,this.canonical.z,this.canonical.x,this.canonical.y):ml(this.wrap*+n,t,t,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const n=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>n&&t.canonical.y===this.canonical.y>>n}children(t){if(this.overscaledZ>=t)return[new nn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const n=this.canonical.z+1,a=2*this.canonical.x,c=2*this.canonical.y;return[new nn(n,this.wrap,n,a,c),new nn(n,this.wrap,n,a+1,c),new nn(n,this.wrap,n,a,c+1),new nn(n,this.wrap,n,a+1,c+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new nn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new nn(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Tg(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new uu(t.x-this.wrap,t.y))}}function ml(r,t,n,a,c){(r*=2)<0&&(r=-1*r-1);const d=1<<n;return(d*d*r+d*c+a).toString(36)+n.toString(36)+t.toString(36)}Ue("CanonicalTileID",Np),Ue("OverscaledTileID",nn,{omit:["terrainRttPosMatrix32f"]});class Mg{constructor(t,n,a,c=1,d=1,p=1,g=0){if(this.uid=t,n.height!==n.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void Zi(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=n.height;const x=this.dim=n.height-2;switch(this.data=new Uint32Array(n.data.buffer),a){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=c,this.greenFactor=d,this.blueFactor=p,this.baseShift=g;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let w=0;w<x;w++)this.data[this._idx(-1,w)]=this.data[this._idx(0,w)],this.data[this._idx(x,w)]=this.data[this._idx(x-1,w)],this.data[this._idx(w,-1)]=this.data[this._idx(w,0)],this.data[this._idx(w,x)]=this.data[this._idx(w,x-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(x,-1)]=this.data[this._idx(x-1,0)],this.data[this._idx(-1,x)]=this.data[this._idx(0,x-1)],this.data[this._idx(x,x)]=this.data[this._idx(x-1,x-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let w=0;w<x;w++)for(let M=0;M<x;M++){const C=this.get(w,M);C>this.max&&(this.max=C),C<this.min&&(this.min=C)}}get(t,n){const a=new Uint8Array(this.data.buffer),c=4*this._idx(t,n);return this.unpack(a[c],a[c+1],a[c+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,n){if(t<-1||t>=this.dim+1||n<-1||n>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(n+1)*this.stride+(t+1)}unpack(t,n,a){return t*this.redFactor+n*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new rn({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,n,a){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let c=n*this.dim,d=n*this.dim+this.dim,p=a*this.dim,g=a*this.dim+this.dim;switch(n){case-1:c=d-1;break;case 1:d=c+1}switch(a){case-1:p=g-1;break;case 1:g=p+1}const x=-n*this.dim,w=-a*this.dim;for(let M=p;M<g;M++)for(let C=c;C<d;C++)this.data[this._idx(C,M)]=t.data[this._idx(C+x,M+w)]}}Ue("DEMData",Mg);class Sg{constructor(t){this._stringToNumber={},this._numberToString=[];for(let n=0;n<t.length;n++){const a=t[n];this._stringToNumber[a]=n,this._numberToString[n]=a}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Pg{constructor(t,n,a,c,d){this.type="Feature",this._vectorTileFeature=t,t._z=n,t._x=a,t._y=c,this.properties=t.properties,this.id=d}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const n in this)n!=="_geometry"&&n!=="_vectorTileFeature"&&(t[n]=this[n]);return t}}class Cg{constructor(t,n){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new kn(Ft,16,0),this.grid3D=new kn(Ft,16,0),this.featureIndexArray=new W,this.promoteId=n}insert(t,n,a,c,d,p){const g=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,c,d);const x=p?this.grid3D:this.grid;for(let w=0;w<n.length;w++){const M=n[w],C=[1/0,1/0,-1/0,-1/0];for(let A=0;A<M.length;A++){const L=M[A];C[0]=Math.min(C[0],L.x),C[1]=Math.min(C[1],L.y),C[2]=Math.max(C[2],L.x),C[3]=Math.max(C[3],L.y)}C[0]<Ft&&C[1]<Ft&&C[2]>=0&&C[3]>=0&&x.insert(g,C[0],C[1],C[2],C[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new nu.VectorTile(new Ip(this.rawTileData)).layers,this.sourceLayerCoder=new Sg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,n,a,c){this.loadVTLayers();const d=t.params,p=Ft/t.tileSize/t.scale,g=bc(d.filter),x=t.queryGeometry,w=t.queryPadding*p,M=Eg(x),C=this.grid.query(M.minX-w,M.minY-w,M.maxX+w,M.maxY+w),A=Eg(t.cameraQueryGeometry),L=this.grid3D.query(A.minX-w,A.minY-w,A.maxX+w,A.maxY+w,($,X,se,Y)=>function(D,U,Q,fe,ze){for(const we of D)if(U<=we.x&&Q<=we.y&&fe>=we.x&&ze>=we.y)return!0;const xe=[new De(U,Q),new De(U,ze),new De(fe,ze),new De(fe,Q)];if(D.length>2){for(const we of xe)if(Qs(D,we))return!0}for(let we=0;we<D.length-1;we++)if(iv(D[we],D[we+1],xe))return!0;return!1}(t.cameraQueryGeometry,$-w,X-w,se+w,Y+w));for(const $ of L)C.push($);C.sort(m0);const B={};let j;for(let $=0;$<C.length;$++){const X=C[$];if(X===j)continue;j=X;const se=this.featureIndexArray.get(X);let Y=null;this.loadMatchingFeature(B,se.bucketIndex,se.sourceLayerIndex,se.featureIndex,g,d.layers,d.availableImages,n,a,c,(D,U,Q)=>(Y||(Y=Lr(D)),U.queryIntersectsFeature({queryGeometry:x,feature:D,featureState:Q,geometry:Y,zoom:this.z,transform:t.transform,pixelsToTileUnits:p,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return B}loadMatchingFeature(t,n,a,c,d,p,g,x,w,M,C){const A=this.bucketLayerIDs[n];if(p&&!A.some($=>p.has($)))return;const L=this.sourceLayerCoder.decode(a),B=this.vtLayers[L].feature(c);if(d.needGeometry){const $=na(B,!0);if(!d.filter(new ti(this.tileID.overscaledZ),$,this.tileID.canonical))return}else if(!d.filter(new ti(this.tileID.overscaledZ),B))return;const j=this.getId(B,L);for(let $=0;$<A.length;$++){const X=A[$];if(p&&!p.has(X))continue;const se=x[X];if(!se)continue;let Y={};j&&M&&(Y=M.getState(se.sourceLayer||"_geojsonTileLayer",j));const D=hr({},w[X]);D.paint=Ig(D.paint,se.paint,B,Y,g),D.layout=Ig(D.layout,se.layout,B,Y,g);const U=!C||C(B,se,Y);if(!U)continue;const Q=new Pg(B,this.z,this.x,this.y,j);Q.layer=D;let fe=t[X];fe===void 0&&(fe=t[X]=[]),fe.push({featureIndex:c,feature:Q,intersectionZ:U})}}lookupSymbolFeatures(t,n,a,c,d,p,g,x){const w={};this.loadVTLayers();const M=bc(d);for(const C of t)this.loadMatchingFeature(w,a,c,C,M,p,g,x,n);return w}hasLayer(t){for(const n of this.bucketLayerIDs)for(const a of n)if(t===a)return!0;return!1}getId(t,n){var a;let c=t.id;return this.promoteId&&(c=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[n]],typeof c=="boolean"&&(c=Number(c)),c===void 0&&(!((a=t.properties)===null||a===void 0)&&a.cluster)&&this.promoteId&&(c=Number(t.properties.cluster_id))),c}}function Ig(r,t,n,a,c){return Cn(r,(d,p)=>{const g=t instanceof nl?t.get(p):null;return g&&g.evaluate?g.evaluate(n,a,c):g})}function Eg(r){let t=1/0,n=1/0,a=-1/0,c=-1/0;for(const d of r)t=Math.min(t,d.x),n=Math.min(n,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return{minX:t,minY:n,maxX:a,maxY:c}}function m0(r,t){return t-r}function kg(r,t,n,a,c){const d=[];for(let p=0;p<r.length;p++){const g=r[p];let x;for(let w=0;w<g.length-1;w++){let M=g[w],C=g[w+1];M.x<t&&C.x<t||(M.x<t?M=new De(t,M.y+(t-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x<t&&(C=new De(t,M.y+(t-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y<n&&C.y<n||(M.y<n?M=new De(M.x+(n-M.y)/(C.y-M.y)*(C.x-M.x),n)._round():C.y<n&&(C=new De(M.x+(n-M.y)/(C.y-M.y)*(C.x-M.x),n)._round()),M.x>=a&&C.x>=a||(M.x>=a?M=new De(a,M.y+(a-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x>=a&&(C=new De(a,M.y+(a-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y>=c&&C.y>=c||(M.y>=c?M=new De(M.x+(c-M.y)/(C.y-M.y)*(C.x-M.x),c)._round():C.y>=c&&(C=new De(M.x+(c-M.y)/(C.y-M.y)*(C.x-M.x),c)._round()),x&&M.equals(x[x.length-1])||(x=[M],d.push(x)),x.push(C)))))}}return d}Ue("FeatureIndex",Cg,{omit:["rawTileData","sourceLayerCoder"]});class ds extends De{constructor(t,n,a,c){super(t,n),this.angle=a,c!==void 0&&(this.segment=c)}clone(){return new ds(this.x,this.y,this.angle,this.segment)}}function zg(r,t,n,a,c){if(t.segment===void 0||n===0)return!0;let d=t,p=t.segment+1,g=0;for(;g>-n/2;){if(p--,p<0)return!1;g-=r[p].dist(d),d=r[p]}g+=r[p].dist(r[p+1]),p++;const x=[];let w=0;for(;g<n/2;){const M=r[p],C=r[p+1];if(!C)return!1;let A=r[p-1].angleTo(M)-M.angleTo(C);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),x.push({distance:g,angleDelta:A}),w+=A;g-x[0].distance>a;)w-=x.shift().angleDelta;if(w>c)return!1;p++,g+=M.dist(C)}return!0}function Ag(r){let t=0;for(let n=0;n<r.length-1;n++)t+=r[n].dist(r[n+1]);return t}function Rg(r,t,n){return r?.6*t*n:0}function Dg(r,t){return Math.max(r?r.right-r.left:0,t?t.right-t.left:0)}function g0(r,t,n,a,c,d){const p=Rg(n,c,d),g=Dg(n,a)*d;let x=0;const w=Ag(r)/2;for(let M=0;M<r.length-1;M++){const C=r[M],A=r[M+1],L=C.dist(A);if(x+L>w){const B=(w-x)/L,j=Qt.number(C.x,A.x,B),$=Qt.number(C.y,A.y,B),X=new ds(j,$,A.angleTo(C),M);return X._round(),!p||zg(r,X,g,p,t)?X:void 0}x+=L}}function _0(r,t,n,a,c,d,p,g,x){const w=Rg(a,d,p),M=Dg(a,c),C=M*p,A=r[0].x===0||r[0].x===x||r[0].y===0||r[0].y===x;return t-C<t/4&&(t=C+t/4),Lg(r,A?t/2*g%t:(M/2+2*d)*p*g%t,t,w,n,C,A,!1,x)}function Lg(r,t,n,a,c,d,p,g,x){const w=d/2,M=Ag(r);let C=0,A=t-n,L=[];for(let B=0;B<r.length-1;B++){const j=r[B],$=r[B+1],X=j.dist($),se=$.angleTo(j);for(;A+n<C+X;){A+=n;const Y=(A-C)/X,D=Qt.number(j.x,$.x,Y),U=Qt.number(j.y,$.y,Y);if(D>=0&&D<x&&U>=0&&U<x&&A-w>=0&&A+w<=M){const Q=new ds(D,U,se,B);Q._round(),a&&!zg(r,Q,d,a,c)||L.push(Q)}}C+=X}return g||L.length||p||(L=Lg(r,C/2,n,a,c,d,p,!0,x)),L}Ue("Anchor",ds);const hu=Br;function Bg(r,t,n,a){const c=[],d=r.image,p=d.pixelRatio,g=d.paddedRect.w-2*hu,x=d.paddedRect.h-2*hu;let w={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const M=d.stretchX||[[0,g]],C=d.stretchY||[[0,x]],A=(Pe,Ge)=>Pe+Ge[1]-Ge[0],L=M.reduce(A,0),B=C.reduce(A,0),j=g-L,$=x-B;let X=0,se=L,Y=0,D=B,U=0,Q=j,fe=0,ze=$;if(d.content&&a){const Pe=d.content,Ge=Pe[2]-Pe[0],tt=Pe[3]-Pe[1];(d.textFitWidth||d.textFitHeight)&&(w=lg(r)),X=sd(M,0,Pe[0]),Y=sd(C,0,Pe[1]),se=sd(M,Pe[0],Pe[2]),D=sd(C,Pe[1],Pe[3]),U=Pe[0]-X,fe=Pe[1]-Y,Q=Ge-se,ze=tt-D}const xe=w.x1,we=w.y1,Le=w.x2-xe,Ae=w.y2-we,Fe=(Pe,Ge,tt,Je)=>{const We=od(Pe.stretch-X,se,Le,xe),wt=ld(Pe.fixed-U,Q,Pe.stretch,L),wi=od(Ge.stretch-Y,D,Ae,we),Oi=ld(Ge.fixed-fe,ze,Ge.stretch,B),ur=od(tt.stretch-X,se,Le,xe),an=ld(tt.fixed-U,Q,tt.stretch,L),Fr=od(Je.stretch-Y,D,Ae,we),Qi=ld(Je.fixed-fe,ze,Je.stretch,B),gi=new De(We,wi),qi=new De(ur,wi),er=new De(ur,Fr),tr=new De(We,Fr),Pr=new De(wt/p,Oi/p),sn=new De(an/p,Qi/p),Hi=t*Math.PI/180;if(Hi){const Wi=Math.sin(Hi),Xi=Math.cos(Hi),Ai=[Xi,-Wi,Wi,Xi];gi._matMult(Ai),qi._matMult(Ai),tr._matMult(Ai),er._matMult(Ai)}const Or=Pe.stretch+Pe.fixed,ji=Ge.stretch+Ge.fixed;return{tl:gi,tr:qi,bl:tr,br:er,tex:{x:d.paddedRect.x+hu+Or,y:d.paddedRect.y+hu+ji,w:tt.stretch+tt.fixed-Or,h:Je.stretch+Je.fixed-ji},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Pr,pixelOffsetBR:sn,minFontScaleX:Q/p/Le,minFontScaleY:ze/p/Ae,isSDF:n}};if(a&&(d.stretchX||d.stretchY)){const Pe=Fg(M,j,L),Ge=Fg(C,$,B);for(let tt=0;tt<Pe.length-1;tt++){const Je=Pe[tt],We=Pe[tt+1];for(let wt=0;wt<Ge.length-1;wt++)c.push(Fe(Je,Ge[wt],We,Ge[wt+1]))}}else c.push(Fe({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:g+1},{fixed:0,stretch:x+1}));return c}function sd(r,t,n){let a=0;for(const c of r)a+=Math.max(t,Math.min(n,c[1]))-Math.max(t,Math.min(n,c[0]));return a}function Fg(r,t,n){const a=[{fixed:-1,stretch:0}];for(const[c,d]of r){const p=a[a.length-1];a.push({fixed:c-p.stretch,stretch:p.stretch}),a.push({fixed:c-p.stretch,stretch:p.stretch+(d-c)})}return a.push({fixed:t+hu,stretch:n}),a}function od(r,t,n,a){return r/t*n+a}function ld(r,t,n,a){return r-t*n/a}class cd{constructor(t,n,a,c,d,p,g,x,w,M){var C;if(this.boxStartIndex=t.length,w){let A=p.top,L=p.bottom;const B=p.collisionPadding;B&&(A-=B[1],L+=B[3]);let j=L-A;j>0&&(j=Math.max(10,j),this.circleDiameter=j)}else{const A=!((C=p.image)===null||C===void 0)&&C.content&&(p.image.textFitWidth||p.image.textFitHeight)?lg(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};A.y1=A.y1*g-x[0],A.y2=A.y2*g+x[2],A.x1=A.x1*g-x[3],A.x2=A.x2*g+x[1];const L=p.collisionPadding;if(L&&(A.x1-=L[0]*g,A.y1-=L[1]*g,A.x2+=L[2]*g,A.y2+=L[3]*g),M){const B=new De(A.x1,A.y1),j=new De(A.x2,A.y1),$=new De(A.x1,A.y2),X=new De(A.x2,A.y2),se=M*Math.PI/180;B._rotate(se),j._rotate(se),$._rotate(se),X._rotate(se),A.x1=Math.min(B.x,j.x,$.x,X.x),A.x2=Math.max(B.x,j.x,$.x,X.x),A.y1=Math.min(B.y,j.y,$.y,X.y),A.y2=Math.max(B.y,j.y,$.y,X.y)}t.emplaceBack(n.x,n.y,A.x1,A.y1,A.x2,A.y2,a,c,d)}this.boxEndIndex=t.length}}class y0{constructor(t=[],n=(a,c)=>a<c?-1:a>c?1:0){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:n,compare:a}=this,c=n[t];for(;t>0;){const d=t-1>>1,p=n[d];if(a(c,p)>=0)break;n[t]=p,t=d}n[t]=c}_down(t){const{data:n,compare:a}=this,c=this.length>>1,d=n[t];for(;t<c;){let p=1+(t<<1);const g=p+1;if(g<this.length&&a(n[g],n[p])<0&&(p=g),a(n[p],d)>=0)break;n[t]=n[p],t=p}n[t]=d}}function x0(r,t=1,n=!1){let a=1/0,c=1/0,d=-1/0,p=-1/0;const g=r[0];for(let L=0;L<g.length;L++){const B=g[L];(!L||B.x<a)&&(a=B.x),(!L||B.y<c)&&(c=B.y),(!L||B.x>d)&&(d=B.x),(!L||B.y>p)&&(p=B.y)}const x=Math.min(d-a,p-c);let w=x/2;const M=new y0([],v0);if(x===0)return new De(a,c);for(let L=a;L<d;L+=x)for(let B=c;B<p;B+=x)M.push(new gl(L+w,B+w,w,r));let C=function(L){let B=0,j=0,$=0;const X=L[0];for(let se=0,Y=X.length,D=Y-1;se<Y;D=se++){const U=X[se],Q=X[D],fe=U.x*Q.y-Q.x*U.y;j+=(U.x+Q.x)*fe,$+=(U.y+Q.y)*fe,B+=3*fe}return new gl(j/B,$/B,0,L)}(r),A=M.length;for(;M.length;){const L=M.pop();(L.d>C.d||!C.d)&&(C=L,n&&console.log("found best %d after %d probes",Math.round(1e4*L.d)/1e4,A)),L.max-C.d<=t||(w=L.h/2,M.push(new gl(L.p.x-w,L.p.y-w,w,r)),M.push(new gl(L.p.x+w,L.p.y-w,w,r)),M.push(new gl(L.p.x-w,L.p.y+w,w,r)),M.push(new gl(L.p.x+w,L.p.y+w,w,r)),A+=4)}return n&&(console.log(`num probes: ${A}`),console.log(`best distance: ${C.d}`)),C.p}function v0(r,t){return t.max-r.max}function gl(r,t,n,a){this.p=new De(r,t),this.h=n,this.d=function(c,d){let p=!1,g=1/0;for(let x=0;x<d.length;x++){const w=d[x];for(let M=0,C=w.length,A=C-1;M<C;A=M++){const L=w[M],B=w[A];L.y>c.y!=B.y>c.y&&c.x<(B.x-L.x)*(c.y-L.y)/(B.y-L.y)+L.x&&(p=!p),g=Math.min(g,_m(c,L,B))}}return(p?1:-1)*Math.sqrt(g)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var cr;S.aB=void 0,(cr=S.aB||(S.aB={}))[cr.center=1]="center",cr[cr.left=2]="left",cr[cr.right=3]="right",cr[cr.top=4]="top",cr[cr.bottom=5]="bottom",cr[cr["top-left"]=6]="top-left",cr[cr["top-right"]=7]="top-right",cr[cr["bottom-left"]=8]="bottom-left",cr[cr["bottom-right"]=9]="bottom-right";const ps=7,Zp=Number.POSITIVE_INFINITY;function Og(r,t){return t[1]!==Zp?function(n,a,c){let d=0,p=0;switch(a=Math.abs(a),c=Math.abs(c),n){case"top-right":case"top-left":case"top":p=c-ps;break;case"bottom-right":case"bottom-left":case"bottom":p=-c+ps}switch(n){case"top-right":case"bottom-right":case"right":d=-a;break;case"top-left":case"bottom-left":case"left":d=a}return[d,p]}(r,t[0],t[1]):function(n,a){let c=0,d=0;a<0&&(a=0);const p=a/Math.SQRT2;switch(n){case"top-right":case"top-left":d=p-ps;break;case"bottom-right":case"bottom-left":d=-p+ps;break;case"bottom":d=-a+ps;break;case"top":d=a-ps}switch(n){case"top-right":case"bottom-right":c=-p;break;case"top-left":case"bottom-left":c=p;break;case"left":c=a;break;case"right":c=-a}return[c,d]}(r,t[0])}function jg(r,t,n){var a;const c=r.layout,d=(a=c.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(t,{},n);if(d){const g=d.values,x=[];for(let w=0;w<g.length;w+=2){const M=x[w]=g[w],C=g[w+1].map(A=>A*Fi);M.startsWith("top")?C[1]-=ps:M.startsWith("bottom")&&(C[1]+=ps),x[w+1]=C}return new Yi(x)}const p=c.get("text-variable-anchor");if(p){let g;g=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[c.get("text-radial-offset").evaluate(t,{},n)*Fi,Zp]:c.get("text-offset").evaluate(t,{},n).map(w=>w*Fi);const x=[];for(const w of p)x.push(w,Og(w,g));return new Yi(x)}return null}function Vp(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function b0(r,t,n,a,c,d,p,g,x,w,M,C){let A=d.textMaxSize.evaluate(t,{});A===void 0&&(A=p);const L=r.layers[0].layout,B=L.get("icon-offset").evaluate(t,{},M),j=Zg(n.horizontal),$=p/24,X=r.tilePixelRatio*$,se=r.tilePixelRatio*A/24,Y=r.tilePixelRatio*g,D=r.tilePixelRatio*L.get("symbol-spacing"),U=L.get("text-padding")*r.tilePixelRatio,Q=function(tt,Je,We,wt=1){const wi=tt.get("icon-padding").evaluate(Je,{},We),Oi=wi&&wi.values;return[Oi[0]*wt,Oi[1]*wt,Oi[2]*wt,Oi[3]*wt]}(L,t,M,r.tilePixelRatio),fe=L.get("text-max-angle")/180*Math.PI,ze=L.get("text-rotation-alignment")!=="viewport"&&L.get("symbol-placement")!=="point",xe=L.get("icon-rotation-alignment")==="map"&&L.get("symbol-placement")!=="point",we=L.get("symbol-placement"),Le=D/2,Ae=L.get("icon-text-fit");let Fe;a&&Ae!=="none"&&(r.allowVerticalPlacement&&n.vertical&&(Fe=cg(a,n.vertical,Ae,L.get("icon-text-fit-padding"),B,$)),j&&(a=cg(a,j,Ae,L.get("icon-text-fit-padding"),B,$)));const Pe=M?C.line.getGranularityForZoomLevel(M.z):1,Ge=(tt,Je)=>{Je.x<0||Je.x>=Ft||Je.y<0||Je.y>=Ft||function(We,wt,wi,Oi,ur,an,Fr,Qi,gi,qi,er,tr,Pr,sn,Hi,Or,ji,Wi,Xi,Ai,ni,Fn,_l,On,M0){const yl=We.addToLineVertexArray(wt,wi);let io,xl,vl,bl,Gg=0,qg=0,Hg=0,Wg=0,Kp=-1,Yp=-1;const Ra={};let Xg=lr("");if(We.allowVerticalPlacement&&Oi.vertical){const _r=Qi.layout.get("text-rotate").evaluate(ni,{},On)+90;vl=new cd(gi,wt,qi,er,tr,Oi.vertical,Pr,sn,Hi,_r),Fr&&(bl=new cd(gi,wt,qi,er,tr,Fr,ji,Wi,Hi,_r))}if(ur){const _r=Qi.layout.get("icon-rotate").evaluate(ni,{}),on=Qi.layout.get("icon-text-fit")!=="none",ro=Bg(ur,_r,_l,on),Nn=Fr?Bg(Fr,_r,_l,on):void 0;xl=new cd(gi,wt,qi,er,tr,ur,ji,Wi,!1,_r),Gg=4*ro.length;const no=We.iconSizeData;let sa=null;no.kind==="source"?(sa=[aa*Qi.layout.get("icon-size").evaluate(ni,{})],sa[0]>us&&Zi(`${We.layerIds[0]}: Value for "icon-size" is >= ${cu}. Reduce your "icon-size".`)):no.kind==="composite"&&(sa=[aa*Fn.compositeIconSizes[0].evaluate(ni,{},On),aa*Fn.compositeIconSizes[1].evaluate(ni,{},On)],(sa[0]>us||sa[1]>us)&&Zi(`${We.layerIds[0]}: Value for "icon-size" is >= ${cu}. Reduce your "icon-size".`)),We.addSymbols(We.icon,ro,sa,Ai,Xi,ni,S.al.none,wt,yl.lineStartIndex,yl.lineLength,-1,On),Kp=We.icon.placedSymbolArray.length-1,Nn&&(qg=4*Nn.length,We.addSymbols(We.icon,Nn,sa,Ai,Xi,ni,S.al.vertical,wt,yl.lineStartIndex,yl.lineLength,-1,On),Yp=We.icon.placedSymbolArray.length-1)}const Kg=Object.keys(Oi.horizontal);for(const _r of Kg){const on=Oi.horizontal[_r];if(!io){Xg=lr(on.text);const Nn=Qi.layout.get("text-rotate").evaluate(ni,{},On);io=new cd(gi,wt,qi,er,tr,on,Pr,sn,Hi,Nn)}const ro=on.positionedLines.length===1;if(Hg+=Ng(We,wt,on,an,Qi,Hi,ni,Or,yl,Oi.vertical?S.al.horizontal:S.al.horizontalOnly,ro?Kg:[_r],Ra,Kp,Fn,On),ro)break}Oi.vertical&&(Wg+=Ng(We,wt,Oi.vertical,an,Qi,Hi,ni,Or,yl,S.al.vertical,["vertical"],Ra,Yp,Fn,On));const S0=io?io.boxStartIndex:We.collisionBoxArray.length,P0=io?io.boxEndIndex:We.collisionBoxArray.length,C0=vl?vl.boxStartIndex:We.collisionBoxArray.length,I0=vl?vl.boxEndIndex:We.collisionBoxArray.length,E0=xl?xl.boxStartIndex:We.collisionBoxArray.length,k0=xl?xl.boxEndIndex:We.collisionBoxArray.length,z0=bl?bl.boxStartIndex:We.collisionBoxArray.length,A0=bl?bl.boxEndIndex:We.collisionBoxArray.length;let jn=-1;const hd=(_r,on)=>_r&&_r.circleDiameter?Math.max(_r.circleDiameter,on):on;jn=hd(io,jn),jn=hd(vl,jn),jn=hd(xl,jn),jn=hd(bl,jn);const Yg=jn>-1?1:0;Yg&&(jn*=M0/Fi),We.glyphOffsetArray.length>=fl.MAX_GLYPHS&&Zi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ni.sortKey!==void 0&&We.addToSortKeyRanges(We.symbolInstances.length,ni.sortKey);const R0=jg(Qi,ni,On),[D0,L0]=function(_r,on){const ro=_r.length,Nn=on==null?void 0:on.values;if((Nn==null?void 0:Nn.length)>0)for(let no=0;no<Nn.length;no+=2){const sa=Nn[no+1];_r.emplaceBack(S.aB[Nn[no]],sa[0],sa[1])}return[ro,_r.length]}(We.textAnchorOffsets,R0);We.symbolInstances.emplaceBack(wt.x,wt.y,Ra.right>=0?Ra.right:-1,Ra.center>=0?Ra.center:-1,Ra.left>=0?Ra.left:-1,Ra.vertical||-1,Kp,Yp,Xg,S0,P0,C0,I0,E0,k0,z0,A0,qi,Hg,Wg,Gg,qg,Yg,0,Pr,jn,D0,L0)}(r,Je,tt,n,a,c,Fe,r.layers[0],r.collisionBoxArray,t.index,t.sourceLayerIndex,r.index,X,[U,U,U,U],ze,x,Y,Q,xe,B,t,d,w,M,p)};if(we==="line")for(const tt of kg(t.geometry,0,0,Ft,Ft)){const Je=to(tt,Pe),We=_0(Je,D,fe,n.vertical||j,a,24,se,r.overscaling,Ft);for(const wt of We)j&&w0(r,j.text,Le,wt)||Ge(Je,wt)}else if(we==="line-center"){for(const tt of t.geometry)if(tt.length>1){const Je=to(tt,Pe),We=g0(Je,fe,n.vertical||j,a,24,se);We&&Ge(Je,We)}}else if(t.type==="Polygon")for(const tt of Bo(t.geometry,0)){const Je=x0(tt,16);Ge(to(tt[0],Pe,!0),new ds(Je.x,Je.y,0))}else if(t.type==="LineString")for(const tt of t.geometry){const Je=to(tt,Pe);Ge(Je,new ds(Je[0].x,Je[0].y,0))}else if(t.type==="Point")for(const tt of t.geometry)for(const Je of tt)Ge([Je],new ds(Je.x,Je.y,0))}function Ng(r,t,n,a,c,d,p,g,x,w,M,C,A,L,B){const j=function(se,Y,D,U,Q,fe,ze,xe){const we=U.layout.get("text-rotate").evaluate(fe,{})*Math.PI/180,Le=[];for(const Ae of Y.positionedLines)for(const Fe of Ae.positionedGlyphs){if(!Fe.rect)continue;const Pe=Fe.rect||{};let Ge=Xv+1,tt=!0,Je=1,We=0;const wt=(Q||xe)&&Fe.vertical,wi=Fe.metrics.advance*Fe.scale/2;if(xe&&Y.verticalizable&&(We=Ae.lineOffset/2-(Fe.imageName?-(Fi-Fe.metrics.width*Fe.scale)/2:(Fe.scale-1)*Fi)),Fe.imageName){const Wi=ze[Fe.imageName];tt=Wi.sdf,Je=Wi.pixelRatio,Ge=Br/Je}const Oi=Q?[Fe.x+wi,Fe.y]:[0,0];let ur=Q?[0,0]:[Fe.x+wi+D[0],Fe.y+D[1]-We],an=[0,0];wt&&(an=ur,ur=[0,0]);const Fr=Fe.metrics.isDoubleResolution?2:1,Qi=(Fe.metrics.left-Ge)*Fe.scale-wi+ur[0],gi=(-Fe.metrics.top-Ge)*Fe.scale+ur[1],qi=Qi+Pe.w/Fr*Fe.scale/Je,er=gi+Pe.h/Fr*Fe.scale/Je,tr=new De(Qi,gi),Pr=new De(qi,gi),sn=new De(Qi,er),Hi=new De(qi,er);if(wt){const Wi=new De(-wi,wi-td),Xi=-Math.PI/2,Ai=Fi/2-wi,ni=new De(5-td-Ai,-(Fe.imageName?Ai:0)),Fn=new De(...an);tr._rotateAround(Xi,Wi)._add(ni)._add(Fn),Pr._rotateAround(Xi,Wi)._add(ni)._add(Fn),sn._rotateAround(Xi,Wi)._add(ni)._add(Fn),Hi._rotateAround(Xi,Wi)._add(ni)._add(Fn)}if(we){const Wi=Math.sin(we),Xi=Math.cos(we),Ai=[Xi,-Wi,Wi,Xi];tr._matMult(Ai),Pr._matMult(Ai),sn._matMult(Ai),Hi._matMult(Ai)}const Or=new De(0,0),ji=new De(0,0);Le.push({tl:tr,tr:Pr,bl:sn,br:Hi,tex:Pe,writingMode:Y.writingMode,glyphOffset:Oi,sectionIndex:Fe.sectionIndex,isSDF:tt,pixelOffsetTL:Or,pixelOffsetBR:ji,minFontScaleX:0,minFontScaleY:0})}return Le}(0,n,g,c,d,p,a,r.allowVerticalPlacement),$=r.textSizeData;let X=null;$.kind==="source"?(X=[aa*c.layout.get("text-size").evaluate(p,{})],X[0]>us&&Zi(`${r.layerIds[0]}: Value for "text-size" is >= ${cu}. Reduce your "text-size".`)):$.kind==="composite"&&(X=[aa*L.compositeTextSizes[0].evaluate(p,{},B),aa*L.compositeTextSizes[1].evaluate(p,{},B)],(X[0]>us||X[1]>us)&&Zi(`${r.layerIds[0]}: Value for "text-size" is >= ${cu}. Reduce your "text-size".`)),r.addSymbols(r.text,j,X,g,d,p,w,t,x.lineStartIndex,x.lineLength,A,B);for(const se of M)C[se]=r.text.placedSymbolArray.length-1;return 4*j.length}function Zg(r){for(const t in r)return r[t];return null}function w0(r,t,n,a){const c=r.compareText;if(t in c){const d=c[t];for(let p=d.length-1;p>=0;p--)if(a.dist(d[p])<n)return!0}else c[t]=[];return c[t].push(a),!1}const Vg=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Up{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,a]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const c=a>>4;if(c!==1)throw new Error(`Got v${c} data when expected v1.`);const d=Vg[15&a];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(t,2,1),[g]=new Uint32Array(t,4,1);return new Up(g,p,d,t)}constructor(t,n=64,a=Float64Array,c){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=a,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const d=Vg.indexOf(this.ArrayType),p=2*t*this.ArrayType.BYTES_PER_ELEMENT,g=t*this.IndexArrayType.BYTES_PER_ELEMENT,x=(8-g%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${a}.`);c&&c instanceof ArrayBuffer?(this.data=c,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+g+x,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+p+g+x),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+g+x,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=t,this.coords[this._pos++]=n,a}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return $p(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,a,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:g}=this,x=[0,d.length-1,0],w=[];for(;x.length;){const M=x.pop()||0,C=x.pop()||0,A=x.pop()||0;if(C-A<=g){for(let $=A;$<=C;$++){const X=p[2*$],se=p[2*$+1];X>=t&&X<=a&&se>=n&&se<=c&&w.push(d[$])}continue}const L=A+C>>1,B=p[2*L],j=p[2*L+1];B>=t&&B<=a&&j>=n&&j<=c&&w.push(d[L]),(M===0?t<=B:n<=j)&&(x.push(A),x.push(L-1),x.push(1-M)),(M===0?a>=B:c>=j)&&(x.push(L+1),x.push(C),x.push(1-M))}return w}within(t,n,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:d,nodeSize:p}=this,g=[0,c.length-1,0],x=[],w=a*a;for(;g.length;){const M=g.pop()||0,C=g.pop()||0,A=g.pop()||0;if(C-A<=p){for(let $=A;$<=C;$++)$g(d[2*$],d[2*$+1],t,n)<=w&&x.push(c[$]);continue}const L=A+C>>1,B=d[2*L],j=d[2*L+1];$g(B,j,t,n)<=w&&x.push(c[L]),(M===0?t-a<=B:n-a<=j)&&(g.push(A),g.push(L-1),g.push(1-M)),(M===0?t+a>=B:n+a>=j)&&(g.push(L+1),g.push(C),g.push(1-M))}return x}}function $p(r,t,n,a,c,d){if(c-a<=n)return;const p=a+c>>1;Ug(r,t,p,a,c,d),$p(r,t,n,a,p-1,1-d),$p(r,t,n,p+1,c,1-d)}function Ug(r,t,n,a,c,d){for(;c>a;){if(c-a>600){const w=c-a+1,M=n-a+1,C=Math.log(w),A=.5*Math.exp(2*C/3),L=.5*Math.sqrt(C*A*(w-A)/w)*(M-w/2<0?-1:1);Ug(r,t,n,Math.max(a,Math.floor(n-M*A/w+L)),Math.min(c,Math.floor(n+(w-M)*A/w+L)),d)}const p=t[2*n+d];let g=a,x=c;for(du(r,t,a,n),t[2*c+d]>p&&du(r,t,a,c);g<x;){for(du(r,t,g,x),g++,x--;t[2*g+d]<p;)g++;for(;t[2*x+d]>p;)x--}t[2*a+d]===p?du(r,t,a,x):(x++,du(r,t,x,c)),x<=n&&(a=x+1),n<=x&&(c=x-1)}}function du(r,t,n,a){Gp(r,n,a),Gp(t,2*n,2*a),Gp(t,2*n+1,2*a+1)}function Gp(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function $g(r,t,n,a){const c=r-n,d=t-a;return c*c+d*d}var qp;S.cm=void 0,(qp=S.cm||(S.cm={})).create="create",qp.load="load",qp.fullLoad="fullLoad";let ud=null,pu=[];const Hp=1e3/60,Wp="loadTime",Xp="fullLoadTime",T0={mark(r){performance.mark(r)},frame(r){const t=r;ud!=null&&pu.push(t-ud),ud=t},clearMetrics(){ud=null,pu=[],performance.clearMeasures(Wp),performance.clearMeasures(Xp);for(const r in S.cm)performance.clearMarks(S.cm[r])},getPerformanceMetrics(){performance.measure(Wp,S.cm.create,S.cm.load),performance.measure(Xp,S.cm.create,S.cm.fullLoad);const r=performance.getEntriesByName(Wp)[0].duration,t=performance.getEntriesByName(Xp)[0].duration,n=pu.length,a=1/(pu.reduce((d,p)=>d+p,0)/n/1e3),c=pu.filter(d=>d>Hp).reduce((d,p)=>d+(p-Hp)/Hp,0);return{loadTime:r,fullLoadTime:t,fps:a,percentDroppedFrames:c/(n+c)*100,totalFrames:n}}};S.$=uu,S.A=Bt,S.B=Qt,S.C=ti,S.D=Ye,S.E=J,S.F=Ac,S.G=function(r){if(br==null){const t=r.navigator?r.navigator.userAgent:null;br=!!r.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return br},S.H=class{constructor(r,t){this.target=r,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new p0(()=>this.process()),this.subscription=Ze(this.target,"message",n=>this.receive(n),!1),this.globalScope=rr(self)?r:window}registerMessageHandler(r,t){this.messageHandlers[r]=t}sendAsync(r,t){return new Promise((n,a)=>{const c=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=t?Ze(t.signal,"abort",()=>{d==null||d.unsubscribe(),delete this.resolveRejects[c];const x={id:c,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(x)},f0):null;this.resolveRejects[c]={resolve:x=>{d==null||d.unsubscribe(),n(x)},reject:x=>{d==null||d.unsubscribe(),a(x)}};const p=[],g=Object.assign(Object.assign({},r),{id:c,sourceMapId:this.mapId,origin:location.origin,data:Us(r.data,p)});this.target.postMessage(g,{transfer:p})})}receive(r){const t=r.data,n=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[n];const a=this.abortControllers[n];return delete this.abortControllers[n],void(a&&a.abort())}if(rr(self)||t.mustQueue)return this.tasks[n]=t,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,t)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),t=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(r,t)}processTask(r,t){return o(this,void 0,void 0,function*(){if(t.type==="<response>"){const c=this.resolveRejects[r];return delete this.resolveRejects[r],c?void(t.error?c.reject(Ca(t.error)):c.resolve(Ca(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const n=Ca(t.data),a=new AbortController;this.abortControllers[r]=a;try{const c=yield this.messageHandlers[t.type](t.sourceMapId,n,a);this.completeTask(r,null,c)}catch(c){this.completeTask(r,c)}})}completeTask(r,t,n){const a=[];delete this.abortControllers[r];const c={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Us(t):null,data:Us(n,a)};this.target.postMessage(c,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},S.I=kp,S.J=qt,S.K=function(){var r=new Bt(16);return Bt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},S.L=function(r,t,n){var a,c,d,p,g,x,w,M,C,A,L,B,j=n[0],$=n[1],X=n[2];return t===r?(r[12]=t[0]*j+t[4]*$+t[8]*X+t[12],r[13]=t[1]*j+t[5]*$+t[9]*X+t[13],r[14]=t[2]*j+t[6]*$+t[10]*X+t[14],r[15]=t[3]*j+t[7]*$+t[11]*X+t[15]):(c=t[1],d=t[2],p=t[3],g=t[4],x=t[5],w=t[6],M=t[7],C=t[8],A=t[9],L=t[10],B=t[11],r[0]=a=t[0],r[1]=c,r[2]=d,r[3]=p,r[4]=g,r[5]=x,r[6]=w,r[7]=M,r[8]=C,r[9]=A,r[10]=L,r[11]=B,r[12]=a*j+g*$+C*X+t[12],r[13]=c*j+x*$+A*X+t[13],r[14]=d*j+w*$+L*X+t[14],r[15]=p*j+M*$+B*X+t[15]),r},S.M=function(r,t,n){var a=n[0],c=n[1],d=n[2];return r[0]=t[0]*a,r[1]=t[1]*a,r[2]=t[2]*a,r[3]=t[3]*a,r[4]=t[4]*c,r[5]=t[5]*c,r[6]=t[6]*c,r[7]=t[7]*c,r[8]=t[8]*d,r[9]=t[9]*d,r[10]=t[10]*d,r[11]=t[11]*d,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},S.N=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=t[3],g=t[4],x=t[5],w=t[6],M=t[7],C=t[8],A=t[9],L=t[10],B=t[11],j=t[12],$=t[13],X=t[14],se=t[15],Y=n[0],D=n[1],U=n[2],Q=n[3];return r[0]=Y*a+D*g+U*C+Q*j,r[1]=Y*c+D*x+U*A+Q*$,r[2]=Y*d+D*w+U*L+Q*X,r[3]=Y*p+D*M+U*B+Q*se,r[4]=(Y=n[4])*a+(D=n[5])*g+(U=n[6])*C+(Q=n[7])*j,r[5]=Y*c+D*x+U*A+Q*$,r[6]=Y*d+D*w+U*L+Q*X,r[7]=Y*p+D*M+U*B+Q*se,r[8]=(Y=n[8])*a+(D=n[9])*g+(U=n[10])*C+(Q=n[11])*j,r[9]=Y*c+D*x+U*A+Q*$,r[10]=Y*d+D*w+U*L+Q*X,r[11]=Y*p+D*M+U*B+Q*se,r[12]=(Y=n[12])*a+(D=n[13])*g+(U=n[14])*C+(Q=n[15])*j,r[13]=Y*c+D*x+U*A+Q*$,r[14]=Y*d+D*w+U*L+Q*X,r[15]=Y*p+D*M+U*B+Q*se,r},S.O=function(r,t){const n={};for(let a=0;a<t.length;a++){const c=t[a];c in r&&(n[c]=r[c])}return n},S.P=De,S.Q=hs,S.R=rn,S.S=xg,S.T=Fc,S.U=yg,S.V=Jt,S.W=Xt,S.X=Kr,S.Y=nn,S.Z=Ft,S._=o,S.a=ut,S.a$=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[4],p=t[5],g=t[6],x=t[7],w=t[8],M=t[9],C=t[10],A=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[4]=d*c+w*a,r[5]=p*c+M*a,r[6]=g*c+C*a,r[7]=x*c+A*a,r[8]=w*c-d*a,r[9]=M*c-p*a,r[10]=C*c-g*a,r[11]=A*c-x*a,r},S.a0=25,S.a1=Np,S.a2=r=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(n=>{t.onloadstart=()=>{n(t)};for(const a of r){const c=window.document.createElement("source");pr(a)||(t.crossOrigin="Anonymous"),c.src=a,t.appendChild(c)}})},S.a3=Me,S.a4=function(){return Wn++},S.a5=_,S.a6=fl,S.a7=bc,S.a8=na,S.a9=Pg,S.aA=function(r,t,n,a,c=!1){if(!n[0]&&!n[1])return[0,0];const d=c?a==="map"?-r.bearingInRadians:0:a==="viewport"?r.bearingInRadians:0;if(d){const p=Math.sin(d),g=Math.cos(d);n=[n[0]*g-n[1]*p,n[0]*p+n[1]*g]}return[c?n[0]:zr(t,n[0],r.zoom),c?n[1]:zr(t,n[1],r.zoom)]},S.aC=Rp,S.aD=Vp,S.aE=Ap,S.aF=Up,S.aG=Ei,S.aH=Jh,S.aI=K,S.aJ=st,S.aK=Be,S.aL=hn,S.aM=Xe,S.aN=bg,S.aO=function(r,t,n){return r[0]=t[0]*n,r[1]=t[1]*n,r[2]=t[2]*n,r},S.aP=function(r,t,n){return r[0]=t[0]+n[0],r[1]=t[1]+n[1],r[2]=t[2]+n[2],r},S.aQ=function(r){var t=new Bt(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t},S.aR=function(r,t,n){return r[0]=t[0]*n[0],r[1]=t[1]*n[1],r[2]=t[2]*n[2],r[3]=t[3]*n[3],r},S.aS=function(r,t,n){return r[0]=t[0]-n[0],r[1]=t[1]-n[1],r[2]=t[2]-n[2],r},S.aT=function(r,t){var n=t[0],a=t[1],c=t[2],d=n*n+a*a+c*c;return d>0&&(d=1/Math.sqrt(d)),r[0]=t[0]*d,r[1]=t[1]*d,r[2]=t[2]*d,r},S.aU=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=n[0],g=n[1],x=n[2];return r[0]=c*x-d*g,r[1]=d*p-a*x,r[2]=a*g-c*p,r},S.aV=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]},S.aW=Tg,S.aX=ml,S.aY=function(r,t,n,a,c){var d,p=1/Math.tan(t/2);return r[0]=p/n,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=p,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,c!=null&&c!==1/0?(r[10]=(c+a)*(d=1/(a-c)),r[14]=2*c*a*d):(r[10]=-1,r[14]=-2*a),r},S.aZ=function(r){var t=new Bt(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},S.a_=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[0],p=t[1],g=t[2],x=t[3],w=t[4],M=t[5],C=t[6],A=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=d*c+w*a,r[1]=p*c+M*a,r[2]=g*c+C*a,r[3]=x*c+A*a,r[4]=w*c-d*a,r[5]=M*c-p*a,r[6]=C*c-g*a,r[7]=A*c-x*a,r},S.aa=function(r){const t={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(n,a,c,d)=>{const p=c||d;return t[a]=!p||p.toLowerCase(),""}),t["max-age"]){const n=parseInt(t["max-age"],10);isNaN(n)?delete t["max-age"]:t["max-age"]=n}return t},S.ab=function(r){return r*Math.PI/180},S.ac=function(r){return Math.pow(2,r)},S.ad=jt,S.ae=Ti,S.af=85.051129,S.ag=vg,S.ah=function(r){return Math.log(r)/Math.LN2},S.ai=function(r){var t=r[0],n=r[1];return t*t+n*n},S.aj=function(r,t){const n=[];for(const a in r)a in t||n.push(a);return n},S.ak=function(r,t){let n=0,a=0;if(r.kind==="constant")a=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:c,minZoom:d,maxZoom:p}=r,g=c?Ti(Tr.interpolationFactor(c,t,d,p),0,1):0;r.kind==="camera"?a=Qt.number(r.minSize,r.maxSize,g):n=g}return{uSizeT:n,uSize:a}},S.am=function(r,{uSize:t,uSizeT:n},{lowerSize:a,upperSize:c}){return r.kind==="source"?a/aa:r.kind==="composite"?Qt.number(a/aa,c/aa,n):t},S.an=function(r,t){var n=t[0],a=t[1],c=t[2],d=t[3],p=t[4],g=t[5],x=t[6],w=t[7],M=t[8],C=t[9],A=t[10],L=t[11],B=t[12],j=t[13],$=t[14],X=t[15],se=n*g-a*p,Y=n*x-c*p,D=n*w-d*p,U=a*x-c*g,Q=a*w-d*g,fe=c*w-d*x,ze=M*j-C*B,xe=M*$-A*B,we=M*X-L*B,Le=C*$-A*j,Ae=C*X-L*j,Fe=A*X-L*$,Pe=se*Fe-Y*Ae+D*Le+U*we-Q*xe+fe*ze;return Pe?(r[0]=(g*Fe-x*Ae+w*Le)*(Pe=1/Pe),r[1]=(c*Ae-a*Fe-d*Le)*Pe,r[2]=(j*fe-$*Q+X*U)*Pe,r[3]=(A*Q-C*fe-L*U)*Pe,r[4]=(x*we-p*Fe-w*xe)*Pe,r[5]=(n*Fe-c*we+d*xe)*Pe,r[6]=($*D-B*fe-X*Y)*Pe,r[7]=(M*fe-A*D+L*Y)*Pe,r[8]=(p*Ae-g*we+w*ze)*Pe,r[9]=(a*we-n*Ae-d*ze)*Pe,r[10]=(B*Q-j*D+X*se)*Pe,r[11]=(C*D-M*Q-L*se)*Pe,r[12]=(g*xe-p*Le-x*ze)*Pe,r[13]=(n*Le-a*xe+c*ze)*Pe,r[14]=(j*Y-B*U-$*se)*Pe,r[15]=(M*U-C*Y+A*se)*Pe,r):null},S.ao=vr,S.ap=function(r){return Math.hypot(r[0],r[1])},S.aq=function(r){return r[0]=0,r[1]=0,r},S.ar=function(r,t,n){return r[0]=t[0]*n,r[1]=t[1]*n,r},S.as=Dp,S.at=li,S.au=function(r,t,n,a){const c=t.y-r.y,d=t.x-r.x,p=a.y-n.y,g=a.x-n.x,x=p*d-g*c;if(x===0)return null;const w=(g*(r.y-n.y)-p*(r.x-n.x))/x;return new De(r.x+w*d,r.y+w*c)},S.av=kg,S.aw=Wc,S.ax=function(r){let t=1/0,n=1/0,a=-1/0,c=-1/0;for(const d of r)t=Math.min(t,d.x),n=Math.min(n,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return[t,n,a,c]},S.ay=Fi,S.az=zr,S.b=Vi,S.b$=function(r,t){var n=r[0],a=r[1],c=r[2],d=r[3],p=r[4],g=r[5],x=r[6],w=r[7],M=r[8],C=r[9],A=r[10],L=r[11],B=r[12],j=r[13],$=r[14],X=r[15],se=t[0],Y=t[1],D=t[2],U=t[3],Q=t[4],fe=t[5],ze=t[6],xe=t[7],we=t[8],Le=t[9],Ae=t[10],Fe=t[11],Pe=t[12],Ge=t[13],tt=t[14],Je=t[15];return Math.abs(n-se)<=Et*Math.max(1,Math.abs(n),Math.abs(se))&&Math.abs(a-Y)<=Et*Math.max(1,Math.abs(a),Math.abs(Y))&&Math.abs(c-D)<=Et*Math.max(1,Math.abs(c),Math.abs(D))&&Math.abs(d-U)<=Et*Math.max(1,Math.abs(d),Math.abs(U))&&Math.abs(p-Q)<=Et*Math.max(1,Math.abs(p),Math.abs(Q))&&Math.abs(g-fe)<=Et*Math.max(1,Math.abs(g),Math.abs(fe))&&Math.abs(x-ze)<=Et*Math.max(1,Math.abs(x),Math.abs(ze))&&Math.abs(w-xe)<=Et*Math.max(1,Math.abs(w),Math.abs(xe))&&Math.abs(M-we)<=Et*Math.max(1,Math.abs(M),Math.abs(we))&&Math.abs(C-Le)<=Et*Math.max(1,Math.abs(C),Math.abs(Le))&&Math.abs(A-Ae)<=Et*Math.max(1,Math.abs(A),Math.abs(Ae))&&Math.abs(L-Fe)<=Et*Math.max(1,Math.abs(L),Math.abs(Fe))&&Math.abs(B-Pe)<=Et*Math.max(1,Math.abs(B),Math.abs(Pe))&&Math.abs(j-Ge)<=Et*Math.max(1,Math.abs(j),Math.abs(Ge))&&Math.abs($-tt)<=Et*Math.max(1,Math.abs($),Math.abs(tt))&&Math.abs(X-Je)<=Et*Math.max(1,Math.abs(X),Math.abs(Je))},S.b0=function(){const r=new Float32Array(16);return jt(r),r},S.b1=function(){const r=new Float64Array(16);return jt(r),r},S.b2=function(){return new Float64Array(16)},S.b3=function(r,t,n){const a=new Float64Array(4);return function(c,d,p,g){var x=.5*Math.PI/180;d*=x,p*=x,g*=x;var w=Math.sin(d),M=Math.cos(d),C=Math.sin(p),A=Math.cos(p),L=Math.sin(g),B=Math.cos(g);c[0]=w*A*B-M*C*L,c[1]=M*C*B+w*A*L,c[2]=M*A*L-w*C*B,c[3]=M*A*B+w*C*L}(a,r,t-90,n),a},S.b4=function(r,t,n,a){var c,d,p,g,x,w=t[0],M=t[1],C=t[2],A=t[3],L=n[0],B=n[1],j=n[2],$=n[3];return(d=w*L+M*B+C*j+A*$)<0&&(d=-d,L=-L,B=-B,j=-j,$=-$),1-d>Et?(c=Math.acos(d),p=Math.sin(c),g=Math.sin((1-a)*c)/p,x=Math.sin(a*c)/p):(g=1-a,x=a),r[0]=g*w+x*L,r[1]=g*M+x*B,r[2]=g*C+x*j,r[3]=g*A+x*$,r},S.b5=function(r){const t=new Float64Array(9);var n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X,se,Y;C=(c=(a=r)[0])*(x=c+c),A=(d=a[1])*x,B=(p=a[2])*x,j=p*(w=d+d),X=(g=a[3])*x,se=g*w,Y=g*(M=p+p),(n=t)[0]=1-(L=d*w)-($=p*M),n[3]=A-Y,n[6]=B+se,n[1]=A+Y,n[4]=1-C-$,n[7]=j-X,n[2]=B-se,n[5]=j+X,n[8]=1-C-L;const D=Xe(-Math.asin(Ti(t[2],-1,1)));let U,Q;return Math.hypot(t[5],t[8])<.001?(U=0,Q=-Xe(Math.atan2(t[3],t[4]))):(U=Xe(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),Q=Xe(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:U,pitch:D+90,bearing:Q}},S.b6=function(r,t){return r.roll==t.roll&&r.pitch==t.pitch&&r.bearing==t.bearing},S.b7=gt,S.b8=ka,S.b9=dl,S.bA=function(r){if(r.type==="custom")return new d0(r);switch(r.type){case"background":return new c0(r);case"circle":return new nv(r);case"fill":return new Tv(r);case"fill-extrusion":return new zv(r);case"heatmap":return new sv(r);case"hillshade":return new lv(r);case"line":return new jv(r);case"raster":return new h0(r);case"symbol":return new ad(r)}},S.bB=dr,S.bC=function(r,t){if(!r)return[{command:"setStyle",args:[t]}];let n=[];try{if(!ie(r.version,t.version))return[{command:"setStyle",args:[t]}];ie(r.center,t.center)||n.push({command:"setCenter",args:[t.center]}),ie(r.centerAltitude,t.centerAltitude)||n.push({command:"setCenterAltitude",args:[t.centerAltitude]}),ie(r.zoom,t.zoom)||n.push({command:"setZoom",args:[t.zoom]}),ie(r.bearing,t.bearing)||n.push({command:"setBearing",args:[t.bearing]}),ie(r.pitch,t.pitch)||n.push({command:"setPitch",args:[t.pitch]}),ie(r.roll,t.roll)||n.push({command:"setRoll",args:[t.roll]}),ie(r.sprite,t.sprite)||n.push({command:"setSprite",args:[t.sprite]}),ie(r.glyphs,t.glyphs)||n.push({command:"setGlyphs",args:[t.glyphs]}),ie(r.transition,t.transition)||n.push({command:"setTransition",args:[t.transition]}),ie(r.light,t.light)||n.push({command:"setLight",args:[t.light]}),ie(r.terrain,t.terrain)||n.push({command:"setTerrain",args:[t.terrain]}),ie(r.sky,t.sky)||n.push({command:"setSky",args:[t.sky]}),ie(r.projection,t.projection)||n.push({command:"setProjection",args:[t.projection]});const a={},c=[];(function(p,g,x,w){let M;for(M in g=g||{},p=p||{})Object.prototype.hasOwnProperty.call(p,M)&&(Object.prototype.hasOwnProperty.call(g,M)||de(M,x,w));for(M in g)Object.prototype.hasOwnProperty.call(g,M)&&(Object.prototype.hasOwnProperty.call(p,M)?ie(p[M],g[M])||(p[M].type==="geojson"&&g[M].type==="geojson"&&Ne(p,g,M)?ye(x,{command:"setGeoJSONSourceData",args:[M,g[M].data]}):ke(M,g,x,w)):be(M,g,x))})(r.sources,t.sources,c,a);const d=[];r.layers&&r.layers.forEach(p=>{"source"in p&&a[p.source]?n.push({command:"removeLayer",args:[p.id]}):d.push(p)}),n=n.concat(c),function(p,g,x){g=g||[];const w=(p=p||[]).map(rt),M=g.map(rt),C=p.reduce(dt,{}),A=g.reduce(dt,{}),L=w.slice(),B=Object.create(null);let j,$,X,se,Y;for(let D=0,U=0;D<w.length;D++)j=w[D],Object.prototype.hasOwnProperty.call(A,j)?U++:(ye(x,{command:"removeLayer",args:[j]}),L.splice(L.indexOf(j,U),1));for(let D=0,U=0;D<M.length;D++)j=M[M.length-1-D],L[L.length-1-D]!==j&&(Object.prototype.hasOwnProperty.call(C,j)?(ye(x,{command:"removeLayer",args:[j]}),L.splice(L.lastIndexOf(j,L.length-U),1)):U++,se=L[L.length-D],ye(x,{command:"addLayer",args:[A[j],se]}),L.splice(L.length-D,0,j),B[j]=!0);for(let D=0;D<M.length;D++)if(j=M[D],$=C[j],X=A[j],!B[j]&&!ie($,X))if(ie($.source,X.source)&&ie($["source-layer"],X["source-layer"])&&ie($.type,X.type)){for(Y in Ve($.layout,X.layout,x,j,null,"setLayoutProperty"),Ve($.paint,X.paint,x,j,null,"setPaintProperty"),ie($.filter,X.filter)||ye(x,{command:"setFilter",args:[j,X.filter]}),ie($.minzoom,X.minzoom)&&ie($.maxzoom,X.maxzoom)||ye(x,{command:"setLayerZoomRange",args:[j,X.minzoom,X.maxzoom]}),$)Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Ve($[Y],X[Y],x,j,Y.slice(6),"setPaintProperty"):ie($[Y],X[Y])||ye(x,{command:"setLayerProperty",args:[j,Y,X[Y]]}));for(Y in X)Object.prototype.hasOwnProperty.call(X,Y)&&!Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Ve($[Y],X[Y],x,j,Y.slice(6),"setPaintProperty"):ie($[Y],X[Y])||ye(x,{command:"setLayerProperty",args:[j,Y,X[Y]]}))}else ye(x,{command:"removeLayer",args:[j]}),se=L[L.lastIndexOf(j)+1],ye(x,{command:"addLayer",args:[X,se]})}(d,t.layers,n)}catch(a){console.warn("Unable to compute style diff:",a),n=[{command:"setStyle",args:[t]}]}return n},S.bD=function(r){const t=[],n=r.id;return n===void 0&&t.push({message:`layers.${n}: missing required property "id"`}),r.render===void 0&&t.push({message:`layers.${n}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},S.bE=function r(t,n){if(Array.isArray(t)){if(!Array.isArray(n)||t.length!==n.length)return!1;for(let a=0;a<t.length;a++)if(!r(t[a],n[a]))return!1;return!0}if(typeof t=="object"&&t!==null&&n!==null){if(typeof n!="object"||Object.keys(t).length!==Object.keys(n).length)return!1;for(const a in t)if(!r(t[a],n[a]))return!1;return!0}return t===n},S.bF=Cn,S.bG=ga,S.bH=class extends vn{constructor(r,t){super(r,t),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},S.bI=Dr,S.bJ=class extends vn{constructor(r,t){super(r,t),this.current=ra}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},S.bK=za,S.bL=class extends vn{constructor(r,t){super(r,t),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},S.bM=class extends vn{constructor(r,t){super(r,t),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},S.bN=Ri,S.bO=function(r,t){var n=Math.sin(t),a=Math.cos(t);return r[0]=a,r[1]=n,r[2]=0,r[3]=-n,r[4]=a,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},S.bP=function(r,t,n){var a=t[0],c=t[1],d=t[2];return r[0]=a*n[0]+c*n[3]+d*n[6],r[1]=a*n[1]+c*n[4]+d*n[7],r[2]=a*n[2]+c*n[5]+d*n[8],r},S.bQ=function(r,t,n,a,c,d,p){var g=1/(t-n),x=1/(a-c),w=1/(d-p);return r[0]=-2*g,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*x,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*w,r[11]=0,r[12]=(t+n)*g,r[13]=(c+a)*x,r[14]=(p+d)*w,r[15]=1,r},S.bR=class extends Ea{},S.bS=Uv,S.bT=class extends ll{},S.bU=fp,S.bV=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},S.bW=Sm,S.bX=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=n[3]*a+n[7]*c+n[11]*d+n[15];return r[0]=(n[0]*a+n[4]*c+n[8]*d+n[12])/(p=p||1),r[1]=(n[1]*a+n[5]*c+n[9]*d+n[13])/p,r[2]=(n[2]*a+n[6]*c+n[10]*d+n[14])/p,r},S.bY=class extends An{},S.bZ=class extends l{},S.b_=function(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]},S.ba=iu,S.bb=hl,S.bc=Hn,S.bd=yi,S.be=mr,S.bf=function(r,t,n,a,c){return Hn(a,c,Ti((r-t)/(n-t),0,1))},S.bg=Ar,S.bh=function(){return new Float64Array(3)},S.bi=function(r,t,n,a){return r[0]=t[0]+n[0]*a,r[1]=t[1]+n[1]*a,r[2]=t[2]+n[2]*a,r},S.bj=_i,S.bk=function(){return new Float64Array(4)},S.bl=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[2],d[0]=c[0]*Math.cos(a)-c[1]*Math.sin(a),d[1]=c[0]*Math.sin(a)+c[1]*Math.cos(a),d[2]=c[2],r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},S.bm=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[2],d[0]=c[0],d[1]=c[1]*Math.cos(a)-c[2]*Math.sin(a),d[2]=c[1]*Math.sin(a)+c[2]*Math.cos(a),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},S.bn=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[2],d[0]=c[2]*Math.sin(a)+c[0]*Math.cos(a),d[1]=c[1],d[2]=c[2]*Math.cos(a)-c[0]*Math.sin(a),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},S.bo=cn,S.bp=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[0],p=t[1],g=t[2],x=t[3],w=t[8],M=t[9],C=t[10],A=t[11];return t!==r&&(r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=d*c-w*a,r[1]=p*c-M*a,r[2]=g*c-C*a,r[3]=x*c-A*a,r[8]=d*a+w*c,r[9]=p*a+M*c,r[10]=g*a+C*c,r[11]=x*a+A*c,r},S.bq=function(r,t){const n=Ar(r,360),a=Ar(t,360),c=a-n,d=a>n?c-360:c+360;return Math.abs(c)<Math.abs(d)?c:d},S.br=function(r){return r[0]=0,r[1]=0,r[2]=0,r},S.bs=function(r,t,n,a){const c=Math.sqrt(r*r+t*t),d=Math.sqrt(n*n+a*a);r/=c,t/=c,n/=d,a/=d;const p=Math.acos(r*n+t*a);return-t*n+r*a>0?p:-p},S.bt=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]},S.bu=Op,S.bv=function(r,t){const n=Ar(r,2*Math.PI),a=Ar(t,2*Math.PI);return Math.min(Math.abs(n-a),Math.abs(n-a+2*Math.PI),Math.abs(n-a-2*Math.PI))},S.bw=function(){const r={},t=V.$version;for(const n in V.$root){const a=V.$root[n];if(a.required){let c=null;c=n==="version"?t:a.type==="array"?[]:{},c!=null&&(r[n]=c)}}return r},S.bx=$s,S.by=Yt,S.bz=function(r){r=r.slice();const t=Object.create(null);for(let n=0;n<r.length;n++)t[r[n].id]=r[n];for(let n=0;n<r.length;n++)"ref"in r[n]&&(r[n]=ge(r[n],t[r[n].ref]));return r},S.c=kt,S.c0=function(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},S.c1=r=>r.type==="symbol",S.c2=r=>r.type==="circle",S.c3=r=>r.type==="heatmap",S.c4=r=>r.type==="line",S.c5=r=>r.type==="fill",S.c6=r=>r.type==="fill-extrusion",S.c7=r=>r.type==="hillshade",S.c8=r=>r.type==="raster",S.c9=r=>r.type==="background",S.cA=nu,S.cB=Ip,S.cC=class{constructor(r){this._marks={start:[r.url,"start"].join("#"),end:[r.url,"end"].join("#"),measure:r.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let r=performance.getEntriesByName(this._marks.measure);return r.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),r=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),r}},S.cD=function(r,t,n,a,c){return o(this,void 0,void 0,function*(){if(Xt())try{return yield Kr(r,t,n,a,c)}catch{}return function(d,p,g,x,w){const M=d.width,C=d.height;Di&&nr||(Di=new OffscreenCanvas(M,C),nr=Di.getContext("2d",{willReadFrequently:!0})),Di.width=M,Di.height=C,nr.drawImage(d,0,0,M,C);const A=nr.getImageData(p,g,x,w);return nr.clearRect(0,0,M,C),A.data}(r,t,n,a,c)})},S.cE=Mg,S.cF=le,S.cG=Re,S.cH=Vm,S.cI=eg,S.cJ=js,S.cK=ta,S.ca=r=>r.type==="custom",S.cb=Pn,S.cc=function(r,t,n){const a=un(t.x-n.x,t.y-n.y),c=un(r.x-n.x,r.y-n.y);var d,p;return Xe(Math.atan2(a[0]*c[1]-a[1]*c[0],(d=a)[0]*(p=c)[0]+d[1]*p[1]))},S.cd=ir,S.ce=function(r,t){return Kt[t]&&(r instanceof MouseEvent||r instanceof WheelEvent)},S.cf=function(r,t){return bt[t]&&"touches"in r},S.cg=function(r){return bt[r]||Kt[r]},S.ch=function(r,t,n){var a=t[0],c=t[1];return r[0]=n[0]*a+n[4]*c+n[12],r[1]=n[1]*a+n[5]*c+n[13],r},S.ci=function(r,t){const{x:n,y:a}=uu.fromLngLat(t);return!(r<0||r>25||a<0||a>=1||n<0||n>=1)},S.cj=function(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},S.ck=class extends al{},S.cl=T0,S.cn=function(r){return r.message===fi},S.co=Li,S.cp=function(r,t){ut.REGISTERED_PROTOCOLS[r]=t},S.cq=function(r){delete ut.REGISTERED_PROTOCOLS[r]},S.cr=function(r,t){const n={};for(let c=0;c<r.length;c++){const d=t&&t[r[c].id]||Qo(r[c]);t&&(t[r[c].id]=d);let p=n[d];p||(p=n[d]=[]),p.push(r[c])}const a=[];for(const c in n)a.push(n[c]);return a},S.cs=Ue,S.ct=Sg,S.cu=Cg,S.cv=ig,S.cw=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=Ft/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const t=r.bucket.layers[0],n=t.layout,a=t._unevaluatedLayout._values,c={layoutIconSize:a["icon-size"].possiblyEvaluate(new ti(r.bucket.zoom+1),r.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new ti(r.bucket.zoom+1),r.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new ti(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=r.bucket.textSizeData;c.compositeTextSizes=[a["text-size"].possiblyEvaluate(new ti(w),r.canonical),a["text-size"].possiblyEvaluate(new ti(M),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=r.bucket.iconSizeData;c.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new ti(w),r.canonical),a["icon-size"].possiblyEvaluate(new ti(M),r.canonical)]}const d=n.get("text-line-height")*Fi,p=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point",g=n.get("text-keep-upright"),x=n.get("text-size");for(const w of r.bucket.features){const M=n.get("text-font").evaluate(w,{},r.canonical).join(","),C=x.evaluate(w,{},r.canonical),A=c.layoutTextSize.evaluate(w,{},r.canonical),L=c.layoutIconSize.evaluate(w,{},r.canonical),B={horizontal:{},vertical:void 0},j=w.text;let $,X=[0,0];if(j){const D=j.toString(),U=n.get("text-letter-spacing").evaluate(w,{},r.canonical)*Fi,Q=Bh(D)?U:0,fe=n.get("text-anchor").evaluate(w,{},r.canonical),ze=jg(t,w,r.canonical);if(!ze){const Ae=n.get("text-radial-offset").evaluate(w,{},r.canonical);X=Ae?Og(fe,[Ae*Fi,Zp]):n.get("text-offset").evaluate(w,{},r.canonical).map(Fe=>Fe*Fi)}let xe=p?"center":n.get("text-justify").evaluate(w,{},r.canonical);const we=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(w,{},r.canonical)*Fi:1/0,Le=()=>{r.bucket.allowVerticalPlacement&&el(D)&&(B.vertical=id(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,we,d,fe,"left",Q,X,S.al.vertical,!0,A,C))};if(!p&&ze){const Ae=new Set;if(xe==="auto")for(let Pe=0;Pe<ze.values.length;Pe+=2)Ae.add(Vp(ze.values[Pe]));else Ae.add(xe);let Fe=!1;for(const Pe of Ae)if(!B.horizontal[Pe])if(Fe)B.horizontal[Pe]=B.horizontal[0];else{const Ge=id(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,we,d,"center",Pe,Q,X,S.al.horizontal,!1,A,C);Ge&&(B.horizontal[Pe]=Ge,Fe=Ge.positionedLines.length===1)}Le()}else{xe==="auto"&&(xe=Vp(fe));const Ae=id(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,we,d,fe,xe,Q,X,S.al.horizontal,!1,A,C);Ae&&(B.horizontal[xe]=Ae),Le(),el(D)&&p&&g&&(B.vertical=id(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,we,d,fe,xe,Q,X,S.al.vertical,!1,A,C))}}let se=!1;if(w.icon&&w.icon.name){const D=r.imageMap[w.icon.name];D&&($=n0(r.imagePositions[w.icon.name],n.get("icon-offset").evaluate(w,{},r.canonical),n.get("icon-anchor").evaluate(w,{},r.canonical)),se=!!D.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=se:r.bucket.sdfIcons!==se&&Zi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(D.pixelRatio!==r.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const Y=Zg(B.horizontal)||B.vertical;r.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||$)&&b0(r.bucket,w,B,$,r.imageMap,c,A,L,X,se,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},S.cx=Sp,S.cy=xp,S.cz=Mp,S.d=pr,S.e=hr,S.f=r=>o(void 0,void 0,void 0,function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(t)}catch(n){throw new Error(`Could not load image because of ${n.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),S.g=Gt,S.h=r=>new Promise((t,n)=>{const a=new Image;a.onload=()=>{t(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=Xr})},a.onerror=()=>n(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const c=new Blob([new Uint8Array(r)],{type:"image/png"});a.src=r.byteLength?URL.createObjectURL(c):Xr}),S.i=rr,S.j=(r,t)=>Mi(hr(r,{type:"json"}),t),S.k=G,S.l=Z,S.m=Mi,S.n=(r,t)=>Mi(hr(r,{type:"arrayBuffer"}),t),S.o=function(r){return new Ip(r).readFields(qv,[])},S.p=tg,S.q=Yc,S.r=Sr,S.s=Ze,S.t=Rh,S.u=vt,S.v=V,S.w=Zi,S.x=Dh,S.y=gn,S.z=function([r,t,n]){return t+=90,t*=Math.PI/180,n*=Math.PI/180,{x:r*Math.cos(t)*Math.sin(n),y:r*Math.sin(t)*Math.sin(n),z:r*Math.cos(n)}}}),z("worker",["./shared"],function(S){class o{constructor(N){this.keyCache={},N&&this.replace(N)}replace(N){this._layerConfigs={},this._layers={},this.update(N,[])}update(N,Z){for(const J of N){this._layerConfigs[J.id]=J;const V=this._layers[J.id]=S.bA(J);V._featureFilter=S.a7(V.filter),this.keyCache[J.id]&&delete this.keyCache[J.id]}for(const J of Z)delete this.keyCache[J],delete this._layerConfigs[J],delete this._layers[J];this.familiesBySource={};const G=S.cr(Object.values(this._layerConfigs),this.keyCache);for(const J of G){const V=J.map(de=>this._layers[de.id]),ce=V[0];if(ce.visibility==="none")continue;const ge=ce.source||"";let ie=this.familiesBySource[ge];ie||(ie=this.familiesBySource[ge]={});const ye=ce.sourceLayer||"_geojsonTileLayer";let be=ie[ye];be||(be=ie[ye]=[]),be.push(V)}}}class le{constructor(N){const Z={},G=[];for(const ge in N){const ie=N[ge],ye=Z[ge]={};for(const be in ie){const de=ie[+be];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;const ke={x:0,y:0,w:de.bitmap.width+2,h:de.bitmap.height+2};G.push(ke),ye[be]={rect:ke,metrics:de.metrics}}}const{w:J,h:V}=S.p(G),ce=new S.q({width:J||1,height:V||1});for(const ge in N){const ie=N[ge];for(const ye in ie){const be=ie[+ye];if(!be||be.bitmap.width===0||be.bitmap.height===0)continue;const de=Z[ge][ye].rect;S.q.copy(be.bitmap,ce,{x:0,y:0},{x:de.x+1,y:de.y+1},be.bitmap)}}this.image=ce,this.positions=Z}}S.cs("GlyphAtlas",le);class he{constructor(N){this.tileID=new S.Y(N.tileID.overscaledZ,N.tileID.wrap,N.tileID.canonical.z,N.tileID.canonical.x,N.tileID.canonical.y),this.uid=N.uid,this.zoom=N.zoom,this.pixelRatio=N.pixelRatio,this.tileSize=N.tileSize,this.source=N.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=N.showCollisionBoxes,this.collectResourceTiming=!!N.collectResourceTiming,this.returnDependencies=!!N.returnDependencies,this.promoteId=N.promoteId,this.inFlightDependencies=[]}parse(N,Z,G,J,V){return S._(this,void 0,void 0,function*(){this.status="parsing",this.data=N,this.collisionBoxArray=new S.a5;const ce=new S.ct(Object.keys(N.layers).sort()),ge=new S.cu(this.tileID,this.promoteId);ge.bucketLayerIDs=[];const ie={},ye={featureIndex:ge,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:G,subdivisionGranularity:V},be=Z.familiesBySource[this.source];for(const Ie in be){const $e=N.layers[Ie];if(!$e)continue;$e.version===1&&S.w(`Vector tile source "${this.source}" layer "${Ie}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const et=ce.encode(Ie),fr=[];for(let ar=0;ar<$e.length;ar++){const ci=$e.feature(ar),lt=ge.getId(ci,Ie);fr.push({feature:ci,id:lt,index:ar,sourceLayerIndex:et})}for(const ar of be[Ie]){const ci=ar[0];ci.source!==this.source&&S.w(`layer.source = ${ci.source} does not equal this.source = ${this.source}`),ci.minzoom&&this.zoom<Math.floor(ci.minzoom)||ci.maxzoom&&this.zoom>=ci.maxzoom||ci.visibility!=="none"&&(_e(ar,this.zoom,G),(ie[ci.id]=ci.createBucket({index:ge.bucketLayerIDs.length,layers:ar,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:et,sourceID:this.source})).populate(fr,ye,this.tileID.canonical),ge.bucketLayerIDs.push(ar.map(lt=>lt.id)))}}const de=S.bF(ye.glyphDependencies,Ie=>Object.keys(Ie).map(Number));this.inFlightDependencies.forEach(Ie=>Ie==null?void 0:Ie.abort()),this.inFlightDependencies=[];let ke=Promise.resolve({});if(Object.keys(de).length){const Ie=new AbortController;this.inFlightDependencies.push(Ie),ke=J.sendAsync({type:"GG",data:{stacks:de,source:this.source,tileID:this.tileID,type:"glyphs"}},Ie)}const Ne=Object.keys(ye.iconDependencies);let Ve=Promise.resolve({});if(Ne.length){const Ie=new AbortController;this.inFlightDependencies.push(Ie),Ve=J.sendAsync({type:"GI",data:{icons:Ne,source:this.source,tileID:this.tileID,type:"icons"}},Ie)}const rt=Object.keys(ye.patternDependencies);let dt=Promise.resolve({});if(rt.length){const Ie=new AbortController;this.inFlightDependencies.push(Ie),dt=J.sendAsync({type:"GI",data:{icons:rt,source:this.source,tileID:this.tileID,type:"patterns"}},Ie)}const[Me,at,Ct]=yield Promise.all([ke,Ve,dt]),Vt=new le(Me),It=new S.cv(at,Ct);for(const Ie in ie){const $e=ie[Ie];$e instanceof S.a6?(_e($e.layers,this.zoom,G),S.cw({bucket:$e,glyphMap:Me,glyphPositions:Vt.positions,imageMap:at,imagePositions:It.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:ye.subdivisionGranularity})):$e.hasPattern&&($e instanceof S.cx||$e instanceof S.cy||$e instanceof S.cz)&&(_e($e.layers,this.zoom,G),$e.addFeatures(ye,this.tileID.canonical,It.patternPositions))}return this.status="done",{buckets:Object.values(ie).filter(Ie=>!Ie.isEmpty()),featureIndex:ge,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Vt.image,imageAtlas:It,glyphMap:this.returnDependencies?Me:null,iconMap:this.returnDependencies?at:null,glyphPositions:this.returnDependencies?Vt.positions:null}})}}function _e(ue,N,Z){const G=new S.C(N);for(const J of ue)J.recalculate(G,Z)}class Re{constructor(N,Z,G){this.actor=N,this.layerIndex=Z,this.availableImages=G,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(N,Z){return S._(this,void 0,void 0,function*(){const G=yield S.n(N.request,Z);try{return{vectorTile:new S.cA.VectorTile(new S.cB(G.data)),rawData:G.data,cacheControl:G.cacheControl,expires:G.expires}}catch(J){const V=new Uint8Array(G.data);let ce=`Unable to parse the tile at ${N.request.url}, `;throw ce+=V[0]===31&&V[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${J.message}`,new Error(ce)}})}loadTile(N){return S._(this,void 0,void 0,function*(){const Z=N.uid,G=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cC(N.request),J=new he(N);this.loading[Z]=J;const V=new AbortController;J.abort=V;try{const ce=yield this.loadVectorTile(N,V);if(delete this.loading[Z],!ce)return null;const ge=ce.rawData,ie={};ce.expires&&(ie.expires=ce.expires),ce.cacheControl&&(ie.cacheControl=ce.cacheControl);const ye={};if(G){const de=G.finish();de&&(ye.resourceTiming=JSON.parse(JSON.stringify(de)))}J.vectorTile=ce.vectorTile;const be=J.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);this.loaded[Z]=J,this.fetching[Z]={rawTileData:ge,cacheControl:ie,resourceTiming:ye};try{const de=yield be;return S.e({rawTileData:ge.slice(0)},de,ie,ye)}finally{delete this.fetching[Z]}}catch(ce){throw delete this.loading[Z],J.status="done",this.loaded[Z]=J,ce}})}reloadTile(N){return S._(this,void 0,void 0,function*(){const Z=N.uid;if(!this.loaded||!this.loaded[Z])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const G=this.loaded[Z];if(G.showCollisionBoxes=N.showCollisionBoxes,G.status==="parsing"){const J=yield G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);let V;if(this.fetching[Z]){const{rawTileData:ce,cacheControl:ge,resourceTiming:ie}=this.fetching[Z];delete this.fetching[Z],V=S.e({rawTileData:ce.slice(0)},J,ge,ie)}else V=J;return V}if(G.status==="done"&&G.vectorTile)return G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity)})}abortTile(N){return S._(this,void 0,void 0,function*(){const Z=this.loading,G=N.uid;Z&&Z[G]&&Z[G].abort&&(Z[G].abort.abort(),delete Z[G])})}removeTile(N){return S._(this,void 0,void 0,function*(){this.loaded&&this.loaded[N.uid]&&delete this.loaded[N.uid]})}}class ve{constructor(){this.loaded={}}loadTile(N){return S._(this,void 0,void 0,function*(){const{uid:Z,encoding:G,rawImageData:J,redFactor:V,greenFactor:ce,blueFactor:ge,baseShift:ie}=N,ye=J.width+2,be=J.height+2,de=S.b(J)?new S.R({width:ye,height:be},yield S.cD(J,-1,-1,ye,be)):J,ke=new S.cE(Z,de,G,V,ce,ge,ie);return this.loaded=this.loaded||{},this.loaded[Z]=ke,ke})}removeTile(N){const Z=this.loaded,G=N.uid;Z&&Z[G]&&delete Z[G]}}var ne,De,_t=function(){if(De)return ne;function ue(Z,G){if(Z.length!==0){N(Z[0],G);for(var J=1;J<Z.length;J++)N(Z[J],!G)}}function N(Z,G){for(var J=0,V=0,ce=0,ge=Z.length,ie=ge-1;ce<ge;ie=ce++){var ye=(Z[ce][0]-Z[ie][0])*(Z[ie][1]+Z[ce][1]),be=J+ye;V+=Math.abs(J)>=Math.abs(ye)?J-be+ye:ye-be+J,J=be}J+V>=0!=!!G&&Z.reverse()}return De=1,ne=function Z(G,J){var V,ce=G&&G.type;if(ce==="FeatureCollection")for(V=0;V<G.features.length;V++)Z(G.features[V],J);else if(ce==="GeometryCollection")for(V=0;V<G.geometries.length;V++)Z(G.geometries[V],J);else if(ce==="Feature")Z(G.geometry,J);else if(ce==="Polygon")ue(G.coordinates,J);else if(ce==="MultiPolygon")for(V=0;V<G.coordinates.length;V++)ue(G.coordinates[V],J);return G}}(),Rt=S.cF(_t);const yt=S.cA.VectorTileFeature.prototype.toGeoJSON;class Dt{constructor(N){this._feature=N,this.extent=S.Z,this.type=N.type,this.properties=N.tags,"id"in N&&!isNaN(N.id)&&(this.id=parseInt(N.id,10))}loadGeometry(){if(this._feature.type===1){const N=[];for(const Z of this._feature.geometry)N.push([new S.P(Z[0],Z[1])]);return N}{const N=[];for(const Z of this._feature.geometry){const G=[];for(const J of Z)G.push(new S.P(J[0],J[1]));N.push(G)}return N}}toGeoJSON(N,Z,G){return yt.call(this,N,Z,G)}}class Jt{constructor(N){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=S.Z,this.length=N.length,this._features=N}feature(N){return new Dt(this._features[N])}}var Xt,Et,Bt,Ri={exports:{}},jt=function(){if(Bt)return Ri.exports;Bt=1;var ue=S.cI(),N=function(){if(Et)return Xt;Et=1;var be=S.cG(),de=S.cH().VectorTileFeature;function ke(Ve,rt){this.options=rt||{},this.features=Ve,this.length=Ve.length}function Ne(Ve,rt){this.id=typeof Ve.id=="number"?Ve.id:void 0,this.type=Ve.type,this.rawGeometry=Ve.type===1?[Ve.geometry]:Ve.geometry,this.properties=Ve.tags,this.extent=rt||4096}return Xt=ke,ke.prototype.feature=function(Ve){return new Ne(this.features[Ve],this.options.extent)},Ne.prototype.loadGeometry=function(){var Ve=this.rawGeometry;this.geometry=[];for(var rt=0;rt<Ve.length;rt++){for(var dt=Ve[rt],Me=[],at=0;at<dt.length;at++)Me.push(new be(dt[at][0],dt[at][1]));this.geometry.push(Me)}return this.geometry},Ne.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Ve=this.geometry,rt=1/0,dt=-1/0,Me=1/0,at=-1/0,Ct=0;Ct<Ve.length;Ct++)for(var Vt=Ve[Ct],It=0;It<Vt.length;It++){var Ie=Vt[It];rt=Math.min(rt,Ie.x),dt=Math.max(dt,Ie.x),Me=Math.min(Me,Ie.y),at=Math.max(at,Ie.y)}return[rt,Me,dt,at]},Ne.prototype.toGeoJSON=de.prototype.toGeoJSON,Xt}();function Z(be){var de=new ue;return function(ke,Ne){for(var Ve in ke.layers)Ne.writeMessage(3,G,ke.layers[Ve])}(be,de),de.finish()}function G(be,de){var ke;de.writeVarintField(15,be.version||1),de.writeStringField(1,be.name||""),de.writeVarintField(5,be.extent||4096);var Ne={keys:[],values:[],keycache:{},valuecache:{}};for(ke=0;ke<be.length;ke++)Ne.feature=be.feature(ke),de.writeMessage(2,J,Ne);var Ve=Ne.keys;for(ke=0;ke<Ve.length;ke++)de.writeStringField(3,Ve[ke]);var rt=Ne.values;for(ke=0;ke<rt.length;ke++)de.writeMessage(4,ye,rt[ke])}function J(be,de){var ke=be.feature;ke.id!==void 0&&de.writeVarintField(1,ke.id),de.writeMessage(2,V,be),de.writeVarintField(3,ke.type),de.writeMessage(4,ie,ke)}function V(be,de){var ke=be.feature,Ne=be.keys,Ve=be.values,rt=be.keycache,dt=be.valuecache;for(var Me in ke.properties){var at=ke.properties[Me],Ct=rt[Me];if(at!==null){Ct===void 0&&(Ne.push(Me),rt[Me]=Ct=Ne.length-1),de.writeVarint(Ct);var Vt=typeof at;Vt!=="string"&&Vt!=="boolean"&&Vt!=="number"&&(at=JSON.stringify(at));var It=Vt+":"+at,Ie=dt[It];Ie===void 0&&(Ve.push(at),dt[It]=Ie=Ve.length-1),de.writeVarint(Ie)}}}function ce(be,de){return(de<<3)+(7&be)}function ge(be){return be<<1^be>>31}function ie(be,de){for(var ke=be.loadGeometry(),Ne=be.type,Ve=0,rt=0,dt=ke.length,Me=0;Me<dt;Me++){var at=ke[Me],Ct=1;Ne===1&&(Ct=at.length),de.writeVarint(ce(1,Ct));for(var Vt=Ne===3?at.length-1:at.length,It=0;It<Vt;It++){It===1&&Ne!==1&&de.writeVarint(ce(2,Vt-1));var Ie=at[It].x-Ve,$e=at[It].y-rt;de.writeVarint(ge(Ie)),de.writeVarint(ge($e)),Ve+=Ie,rt+=$e}Ne===3&&de.writeVarint(ce(7,1))}}function ye(be,de){var ke=typeof be;ke==="string"?de.writeStringField(1,be):ke==="boolean"?de.writeBooleanField(7,be):ke==="number"&&(be%1!=0?de.writeDoubleField(3,be):be<0?de.writeSVarintField(6,be):de.writeVarintField(5,be))}return Ri.exports=Z,Ri.exports.fromVectorTileJs=Z,Ri.exports.fromGeojsonVt=function(be,de){de=de||{};var ke={};for(var Ne in be)ke[Ne]=new N(be[Ne].features,de),ke[Ne].name=Ne,ke[Ne].version=de.version,ke[Ne].extent=de.extent;return Z({layers:ke})},Ri.exports.GeoJSONWrapper=N,Ri.exports}(),xr=S.cF(jt);const cn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ue=>ue},Vr=Math.fround||(mt=new Float32Array(1),ue=>(mt[0]=+ue,mt[0]));var mt;const _i=3,li=5,Ni=6;class vr{constructor(N){this.options=Object.assign(Object.create(cn),N),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(N){const{log:Z,minZoom:G,maxZoom:J}=this.options;Z&&console.time("total time");const V=`prepare ${N.length} points`;Z&&console.time(V),this.points=N;const ce=[];for(let ie=0;ie<N.length;ie++){const ye=N[ie];if(!ye.geometry)continue;const[be,de]=ye.geometry.coordinates,ke=Vr(zr(be)),Ne=Vr(Ar(de));ce.push(ke,Ne,1/0,ie,-1,1),this.options.reduce&&ce.push(0)}let ge=this.trees[J+1]=this._createTree(ce);Z&&console.timeEnd(V);for(let ie=J;ie>=G;ie--){const ye=+Date.now();ge=this.trees[ie]=this._createTree(this._cluster(ge,ie)),Z&&console.log("z%d: %d clusters in %dms",ie,ge.numItems,+Date.now()-ye)}return Z&&console.timeEnd("total time"),this}getClusters(N,Z){let G=((N[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,N[1]));let V=N[2]===180?180:((N[2]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,N[3]));if(N[2]-N[0]>=360)G=-180,V=180;else if(G>V){const de=this.getClusters([G,J,180,ce],Z),ke=this.getClusters([-180,J,V,ce],Z);return de.concat(ke)}const ge=this.trees[this._limitZoom(Z)],ie=ge.range(zr(G),Ar(ce),zr(V),Ar(J)),ye=ge.data,be=[];for(const de of ie){const ke=this.stride*de;be.push(ye[ke+li]>1?un(ye,ke,this.clusterProps):this.points[ye[ke+_i]])}return be}getChildren(N){const Z=this._getOriginId(N),G=this._getOriginZoom(N),J="No cluster with the specified id.",V=this.trees[G];if(!V)throw new Error(J);const ce=V.data;if(Z*this.stride>=ce.length)throw new Error(J);const ge=this.options.radius/(this.options.extent*Math.pow(2,G-1)),ie=V.within(ce[Z*this.stride],ce[Z*this.stride+1],ge),ye=[];for(const be of ie){const de=be*this.stride;ce[de+4]===N&&ye.push(ce[de+li]>1?un(ce,de,this.clusterProps):this.points[ce[de+_i]])}if(ye.length===0)throw new Error(J);return ye}getLeaves(N,Z,G){const J=[];return this._appendLeaves(J,N,Z=Z||10,G=G||0,0),J}getTile(N,Z,G){const J=this.trees[this._limitZoom(N)],V=Math.pow(2,N),{extent:ce,radius:ge}=this.options,ie=ge/ce,ye=(G-ie)/V,be=(G+1+ie)/V,de={features:[]};return this._addTileFeatures(J.range((Z-ie)/V,ye,(Z+1+ie)/V,be),J.data,Z,G,V,de),Z===0&&this._addTileFeatures(J.range(1-ie/V,ye,1,be),J.data,V,G,V,de),Z===V-1&&this._addTileFeatures(J.range(0,ye,ie/V,be),J.data,-1,G,V,de),de.features.length?de:null}getClusterExpansionZoom(N){let Z=this._getOriginZoom(N)-1;for(;Z<=this.options.maxZoom;){const G=this.getChildren(N);if(Z++,G.length!==1)break;N=G[0].properties.cluster_id}return Z}_appendLeaves(N,Z,G,J,V){const ce=this.getChildren(Z);for(const ge of ce){const ie=ge.properties;if(ie&&ie.cluster?V+ie.point_count<=J?V+=ie.point_count:V=this._appendLeaves(N,ie.cluster_id,G,J,V):V<J?V++:N.push(ge),N.length===G)break}return V}_createTree(N){const Z=new S.aF(N.length/this.stride|0,this.options.nodeSize,Float32Array);for(let G=0;G<N.length;G+=this.stride)Z.add(N[G],N[G+1]);return Z.finish(),Z.data=N,Z}_addTileFeatures(N,Z,G,J,V,ce){for(const ge of N){const ie=ge*this.stride,ye=Z[ie+li]>1;let be,de,ke;if(ye)be=Ft(Z,ie,this.clusterProps),de=Z[ie],ke=Z[ie+1];else{const rt=this.points[Z[ie+_i]];be=rt.properties;const[dt,Me]=rt.geometry.coordinates;de=zr(dt),ke=Ar(Me)}const Ne={type:1,geometry:[[Math.round(this.options.extent*(de*V-G)),Math.round(this.options.extent*(ke*V-J))]],tags:be};let Ve;Ve=ye||this.options.generateId?Z[ie+_i]:this.points[Z[ie+_i]].id,Ve!==void 0&&(Ne.id=Ve),ce.features.push(Ne)}}_limitZoom(N){return Math.max(this.options.minZoom,Math.min(Math.floor(+N),this.options.maxZoom+1))}_cluster(N,Z){const{radius:G,extent:J,reduce:V,minPoints:ce}=this.options,ge=G/(J*Math.pow(2,Z)),ie=N.data,ye=[],be=this.stride;for(let de=0;de<ie.length;de+=be){if(ie[de+2]<=Z)continue;ie[de+2]=Z;const ke=ie[de],Ne=ie[de+1],Ve=N.within(ie[de],ie[de+1],ge),rt=ie[de+li];let dt=rt;for(const Me of Ve){const at=Me*be;ie[at+2]>Z&&(dt+=ie[at+li])}if(dt>rt&&dt>=ce){let Me,at=ke*rt,Ct=Ne*rt,Vt=-1;const It=((de/be|0)<<5)+(Z+1)+this.points.length;for(const Ie of Ve){const $e=Ie*be;if(ie[$e+2]<=Z)continue;ie[$e+2]=Z;const et=ie[$e+li];at+=ie[$e]*et,Ct+=ie[$e+1]*et,ie[$e+4]=It,V&&(Me||(Me=this._map(ie,de,!0),Vt=this.clusterProps.length,this.clusterProps.push(Me)),V(Me,this._map(ie,$e)))}ie[de+4]=It,ye.push(at/dt,Ct/dt,1/0,It,-1,dt),V&&ye.push(Vt)}else{for(let Me=0;Me<be;Me++)ye.push(ie[de+Me]);if(dt>1)for(const Me of Ve){const at=Me*be;if(!(ie[at+2]<=Z)){ie[at+2]=Z;for(let Ct=0;Ct<be;Ct++)ye.push(ie[at+Ct])}}}}return ye}_getOriginId(N){return N-this.points.length>>5}_getOriginZoom(N){return(N-this.points.length)%32}_map(N,Z,G){if(N[Z+li]>1){const ce=this.clusterProps[N[Z+Ni]];return G?Object.assign({},ce):ce}const J=this.points[N[Z+_i]].properties,V=this.options.map(J);return G&&V===J?Object.assign({},V):V}}function un(ue,N,Z){return{type:"Feature",id:ue[N+_i],properties:Ft(ue,N,Z),geometry:{type:"Point",coordinates:[(G=ue[N],360*(G-.5)),Hn(ue[N+1])]}};var G}function Ft(ue,N,Z){const G=ue[N+li],J=G>=1e4?`${Math.round(G/1e3)}k`:G>=1e3?Math.round(G/100)/10+"k":G,V=ue[N+Ni],ce=V===-1?{}:Object.assign({},Z[V]);return Object.assign(ce,{cluster:!0,cluster_id:ue[N+_i],point_count:G,point_count_abbreviated:J})}function zr(ue){return ue/360+.5}function Ar(ue){const N=Math.sin(ue*Math.PI/180),Z=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return Z<0?0:Z>1?1:Z}function Hn(ue){const N=(180-360*ue)*Math.PI/180;return 360*Math.atan(Math.exp(N))/Math.PI-90}function yi(ue,N,Z,G){let J=G;const V=N+(Z-N>>1);let ce,ge=Z-N;const ie=ue[N],ye=ue[N+1],be=ue[Z],de=ue[Z+1];for(let ke=N+3;ke<Z;ke+=3){const Ne=Pn(ue[ke],ue[ke+1],ie,ye,be,de);if(Ne>J)ce=ke,J=Ne;else if(Ne===J){const Ve=Math.abs(ke-V);Ve<ge&&(ce=ke,ge=Ve)}}J>G&&(ce-N>3&&yi(ue,N,ce,G),ue[ce+2]=J,Z-ce>3&&yi(ue,ce,Z,G))}function Pn(ue,N,Z,G,J,V){let ce=J-Z,ge=V-G;if(ce!==0||ge!==0){const ie=((ue-Z)*ce+(N-G)*ge)/(ce*ce+ge*ge);ie>1?(Z=J,G=V):ie>0&&(Z+=ce*ie,G+=ge*ie)}return ce=ue-Z,ge=N-G,ce*ce+ge*ge}function ir(ue,N,Z,G){const J={id:ue??null,type:N,geometry:Z,tags:G,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(N==="Point"||N==="MultiPoint"||N==="LineString")Ti(J,Z);else if(N==="Polygon")Ti(J,Z[0]);else if(N==="MultiLineString")for(const V of Z)Ti(J,V);else if(N==="MultiPolygon")for(const V of Z)Ti(J,V[0]);return J}function Ti(ue,N){for(let Z=0;Z<N.length;Z+=3)ue.minX=Math.min(ue.minX,N[Z]),ue.minY=Math.min(ue.minY,N[Z+1]),ue.maxX=Math.max(ue.maxX,N[Z]),ue.maxY=Math.max(ue.maxY,N[Z+1])}function hn(ue,N,Z,G){if(!N.geometry)return;const J=N.geometry.coordinates;if(J&&J.length===0)return;const V=N.geometry.type,ce=Math.pow(Z.tolerance/((1<<Z.maxZoom)*Z.extent),2);let ge=[],ie=N.id;if(Z.promoteId?ie=N.properties[Z.promoteId]:Z.generateId&&(ie=G||0),V==="Point")hr(J,ge);else if(V==="MultiPoint")for(const ye of J)hr(ye,ge);else if(V==="LineString")Wn(J,ge,ce,!1);else if(V==="MultiLineString"){if(Z.lineMetrics){for(const ye of J)ge=[],Wn(ye,ge,ce,!1),ue.push(ir(ie,"LineString",ge,N.properties));return}Cn(J,ge,ce,!1)}else if(V==="Polygon")Cn(J,ge,ce,!0);else{if(V!=="MultiPolygon"){if(V==="GeometryCollection"){for(const ye of N.geometry.geometries)hn(ue,{id:ie,geometry:ye,properties:N.properties},Z,G);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ye of J){const be=[];Cn(ye,be,ce,!0),ge.push(be)}}ue.push(ir(ie,V,ge,N.properties))}function hr(ue,N){N.push(ga(ue[0]),dr(ue[1]),0)}function Wn(ue,N,Z,G){let J,V,ce=0;for(let ie=0;ie<ue.length;ie++){const ye=ga(ue[ie][0]),be=dr(ue[ie][1]);N.push(ye,be,0),ie>0&&(ce+=G?(J*be-ye*V)/2:Math.sqrt(Math.pow(ye-J,2)+Math.pow(be-V,2))),J=ye,V=be}const ge=N.length-3;N[2]=1,yi(N,0,ge,Z),N[ge+2]=1,N.size=Math.abs(ce),N.start=0,N.end=N.size}function Cn(ue,N,Z,G){for(let J=0;J<ue.length;J++){const V=[];Wn(ue[J],V,Z,G),N.push(V)}}function ga(ue){return ue/360+.5}function dr(ue){const N=Math.sin(ue*Math.PI/180),Z=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return Z<0?0:Z>1?1:Z}function Ki(ue,N,Z,G,J,V,ce,ge){if(G/=N,V>=(Z/=N)&&ce<G)return ue;if(ce<Z||V>=G)return null;const ie=[];for(const ye of ue){const be=ye.geometry;let de=ye.type;const ke=J===0?ye.minX:ye.minY,Ne=J===0?ye.maxX:ye.maxY;if(ke>=Z&&Ne<G){ie.push(ye);continue}if(Ne<Z||ke>=G)continue;let Ve=[];if(de==="Point"||de==="MultiPoint")Zi(be,Ve,Z,G,J);else if(de==="LineString")Wt(be,Ve,Z,G,J,!1,ge.lineMetrics);else if(de==="MultiLineString")br(be,Ve,Z,G,J,!1);else if(de==="Polygon")br(be,Ve,Z,G,J,!0);else if(de==="MultiPolygon")for(const rt of be){const dt=[];br(rt,dt,Z,G,J,!0),dt.length&&Ve.push(dt)}if(Ve.length){if(ge.lineMetrics&&de==="LineString"){for(const rt of Ve)ie.push(ir(ye.id,de,rt,ye.tags));continue}de!=="LineString"&&de!=="MultiLineString"||(Ve.length===1?(de="LineString",Ve=Ve[0]):de="MultiLineString"),de!=="Point"&&de!=="MultiPoint"||(de=Ve.length===3?"Point":"MultiPoint"),ie.push(ir(ye.id,de,Ve,ye.tags))}}return ie.length?ie:null}function Zi(ue,N,Z,G,J){for(let V=0;V<ue.length;V+=3){const ce=ue[V+J];ce>=Z&&ce<=G&&Vi(N,ue[V],ue[V+1],ue[V+2])}}function Wt(ue,N,Z,G,J,V,ce){let ge=rr(ue);const ie=J===0?Xr:Kr;let ye,be,de=ue.start;for(let dt=0;dt<ue.length-3;dt+=3){const Me=ue[dt],at=ue[dt+1],Ct=ue[dt+2],Vt=ue[dt+3],It=ue[dt+4],Ie=J===0?Me:at,$e=J===0?Vt:It;let et=!1;ce&&(ye=Math.sqrt(Math.pow(Me-Vt,2)+Math.pow(at-It,2))),Ie<Z?$e>Z&&(be=ie(ge,Me,at,Vt,It,Z),ce&&(ge.start=de+ye*be)):Ie>G?$e<G&&(be=ie(ge,Me,at,Vt,It,G),ce&&(ge.start=de+ye*be)):Vi(ge,Me,at,Ct),$e<Z&&Ie>=Z&&(be=ie(ge,Me,at,Vt,It,Z),et=!0),$e>G&&Ie<=G&&(be=ie(ge,Me,at,Vt,It,G),et=!0),!V&&et&&(ce&&(ge.end=de+ye*be),N.push(ge),ge=rr(ue)),ce&&(de+=ye)}let ke=ue.length-3;const Ne=ue[ke],Ve=ue[ke+1],rt=J===0?Ne:Ve;rt>=Z&&rt<=G&&Vi(ge,Ne,Ve,ue[ke+2]),ke=ge.length-3,V&&ke>=3&&(ge[ke]!==ge[0]||ge[ke+1]!==ge[1])&&Vi(ge,ge[0],ge[1],ge[2]),ge.length&&N.push(ge)}function rr(ue){const N=[];return N.size=ue.size,N.start=ue.start,N.end=ue.end,N}function br(ue,N,Z,G,J,V){for(const ce of ue)Wt(ce,N,Z,G,J,V,!1)}function Vi(ue,N,Z,G){ue.push(N,Z,G)}function Xr(ue,N,Z,G,J,V){const ce=(V-N)/(G-N);return Vi(ue,V,Z+(J-Z)*ce,1),ce}function Kr(ue,N,Z,G,J,V){const ce=(V-Z)/(J-Z);return Vi(ue,N+(G-N)*ce,V,1),ce}function Di(ue,N){const Z=[];for(let G=0;G<ue.length;G++){const J=ue[G],V=J.type;let ce;if(V==="Point"||V==="MultiPoint"||V==="LineString")ce=nr(J.geometry,N);else if(V==="MultiLineString"||V==="Polygon"){ce=[];for(const ge of J.geometry)ce.push(nr(ge,N))}else if(V==="MultiPolygon"){ce=[];for(const ge of J.geometry){const ie=[];for(const ye of ge)ie.push(nr(ye,N));ce.push(ie)}}Z.push(ir(J.id,V,ce,J.tags))}return Z}function nr(ue,N){const Z=[];Z.size=ue.size,ue.start!==void 0&&(Z.start=ue.start,Z.end=ue.end);for(let G=0;G<ue.length;G+=3)Z.push(ue[G]+N,ue[G+1],ue[G+2]);return Z}function Ze(ue,N){if(ue.transformed)return ue;const Z=1<<ue.z,G=ue.x,J=ue.y;for(const V of ue.features){const ce=V.geometry,ge=V.type;if(V.geometry=[],ge===1)for(let ie=0;ie<ce.length;ie+=2)V.geometry.push(Xe(ce[ie],ce[ie+1],N,Z,G,J));else for(let ie=0;ie<ce.length;ie++){const ye=[];for(let be=0;be<ce[ie].length;be+=2)ye.push(Xe(ce[ie][be],ce[ie][be+1],N,Z,G,J));V.geometry.push(ye)}}return ue.transformed=!0,ue}function Xe(ue,N,Z,G,J,V){return[Math.round(Z*(ue*G-J)),Math.round(Z*(N*G-V))]}function bt(ue,N,Z,G,J){const V=N===J.maxZoom?0:J.tolerance/((1<<N)*J.extent),ce={features:[],numPoints:0,numSimplified:0,numFeatures:ue.length,source:null,x:Z,y:G,z:N,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ge of ue)Kt(ce,ge,V,J);return ce}function Kt(ue,N,Z,G){const J=N.geometry,V=N.type,ce=[];if(ue.minX=Math.min(ue.minX,N.minX),ue.minY=Math.min(ue.minY,N.minY),ue.maxX=Math.max(ue.maxX,N.maxX),ue.maxY=Math.max(ue.maxY,N.maxY),V==="Point"||V==="MultiPoint")for(let ge=0;ge<J.length;ge+=3)ce.push(J[ge],J[ge+1]),ue.numPoints++,ue.numSimplified++;else if(V==="LineString")fi(ce,J,ue,Z,!1,!1);else if(V==="MultiLineString"||V==="Polygon")for(let ge=0;ge<J.length;ge++)fi(ce,J[ge],ue,Z,V==="Polygon",ge===0);else if(V==="MultiPolygon")for(let ge=0;ge<J.length;ge++){const ie=J[ge];for(let ye=0;ye<ie.length;ye++)fi(ce,ie[ye],ue,Z,!0,ye===0)}if(ce.length){let ge=N.tags||null;if(V==="LineString"&&G.lineMetrics){ge={};for(const ye in N.tags)ge[ye]=N.tags[ye];ge.mapbox_clip_start=J.start/J.size,ge.mapbox_clip_end=J.end/J.size}const ie={geometry:ce,type:V==="Polygon"||V==="MultiPolygon"?3:V==="LineString"||V==="MultiLineString"?2:1,tags:ge};N.id!==null&&(ie.id=N.id),ue.features.push(ie)}}function fi(ue,N,Z,G,J,V){const ce=G*G;if(G>0&&N.size<(J?ce:G))return void(Z.numPoints+=N.length/3);const ge=[];for(let ie=0;ie<N.length;ie+=3)(G===0||N[ie+2]>ce)&&(Z.numSimplified++,ge.push(N[ie],N[ie+1])),Z.numPoints++;J&&function(ie,ye){let be=0;for(let de=0,ke=ie.length,Ne=ke-2;de<ke;Ne=de,de+=2)be+=(ie[de]-ie[Ne])*(ie[de+1]+ie[Ne+1]);if(be>0===ye)for(let de=0,ke=ie.length;de<ke/2;de+=2){const Ne=ie[de],Ve=ie[de+1];ie[de]=ie[ke-2-de],ie[de+1]=ie[ke-1-de],ie[ke-2-de]=Ne,ie[ke-1-de]=Ve}}(ge,V),ue.push(ge)}const kt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ut{constructor(N,Z){const G=(Z=this.options=function(V,ce){for(const ge in ce)V[ge]=ce[ge];return V}(Object.create(kt),Z)).debug;if(G&&console.time("preprocess data"),Z.maxZoom<0||Z.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Z.promoteId&&Z.generateId)throw new Error("promoteId and generateId cannot be used together.");let J=function(V,ce){const ge=[];if(V.type==="FeatureCollection")for(let ie=0;ie<V.features.length;ie++)hn(ge,V.features[ie],ce,ie);else hn(ge,V.type==="Feature"?V:{geometry:V},ce);return ge}(N,Z);this.tiles={},this.tileCoords=[],G&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Z.indexMaxZoom,Z.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function(V,ce){const ge=ce.buffer/ce.extent;let ie=V;const ye=Ki(V,1,-1-ge,ge,0,-1,2,ce),be=Ki(V,1,1-ge,2+ge,0,-1,2,ce);return(ye||be)&&(ie=Ki(V,1,-ge,1+ge,0,-1,2,ce)||[],ye&&(ie=Di(ye,1).concat(ie)),be&&(ie=ie.concat(Di(be,-1)))),ie}(J,Z),J.length&&this.splitTile(J,0,0,0),G&&(J.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(N,Z,G,J,V,ce,ge){const ie=[N,Z,G,J],ye=this.options,be=ye.debug;for(;ie.length;){J=ie.pop(),G=ie.pop(),Z=ie.pop(),N=ie.pop();const de=1<<Z,ke=Gt(Z,G,J);let Ne=this.tiles[ke];if(!Ne&&(be>1&&console.time("creation"),Ne=this.tiles[ke]=bt(N,Z,G,J,ye),this.tileCoords.push({z:Z,x:G,y:J}),be)){be>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Z,G,J,Ne.numFeatures,Ne.numPoints,Ne.numSimplified),console.timeEnd("creation"));const et=`z${Z}`;this.stats[et]=(this.stats[et]||0)+1,this.total++}if(Ne.source=N,V==null){if(Z===ye.indexMaxZoom||Ne.numPoints<=ye.indexMaxPoints)continue}else{if(Z===ye.maxZoom||Z===V)continue;if(V!=null){const et=V-Z;if(G!==ce>>et||J!==ge>>et)continue}}if(Ne.source=null,N.length===0)continue;be>1&&console.time("clipping");const Ve=.5*ye.buffer/ye.extent,rt=.5-Ve,dt=.5+Ve,Me=1+Ve;let at=null,Ct=null,Vt=null,It=null,Ie=Ki(N,de,G-Ve,G+dt,0,Ne.minX,Ne.maxX,ye),$e=Ki(N,de,G+rt,G+Me,0,Ne.minX,Ne.maxX,ye);N=null,Ie&&(at=Ki(Ie,de,J-Ve,J+dt,1,Ne.minY,Ne.maxY,ye),Ct=Ki(Ie,de,J+rt,J+Me,1,Ne.minY,Ne.maxY,ye),Ie=null),$e&&(Vt=Ki($e,de,J-Ve,J+dt,1,Ne.minY,Ne.maxY,ye),It=Ki($e,de,J+rt,J+Me,1,Ne.minY,Ne.maxY,ye),$e=null),be>1&&console.timeEnd("clipping"),ie.push(at||[],Z+1,2*G,2*J),ie.push(Ct||[],Z+1,2*G,2*J+1),ie.push(Vt||[],Z+1,2*G+1,2*J),ie.push(It||[],Z+1,2*G+1,2*J+1)}}getTile(N,Z,G){N=+N,Z=+Z,G=+G;const J=this.options,{extent:V,debug:ce}=J;if(N<0||N>24)return null;const ge=1<<N,ie=Gt(N,Z=Z+ge&ge-1,G);if(this.tiles[ie])return Ze(this.tiles[ie],V);ce>1&&console.log("drilling down to z%d-%d-%d",N,Z,G);let ye,be=N,de=Z,ke=G;for(;!ye&&be>0;)be--,de>>=1,ke>>=1,ye=this.tiles[Gt(be,de,ke)];return ye&&ye.source?(ce>1&&(console.log("found parent tile z%d-%d-%d",be,de,ke),console.time("drilling down")),this.splitTile(ye.source,be,de,ke,N,Z,G),ce>1&&console.timeEnd("drilling down"),this.tiles[ie]?Ze(this.tiles[ie],V):null):null}}function Gt(ue,N,Z){return 32*((1<<ue)*Z+N)+ue}function qt(ue,N){return N?ue.properties[N]:ue.id}function Li(ue,N){if(ue==null)return!0;if(ue.type==="Feature")return qt(ue,N)!=null;if(ue.type==="FeatureCollection"){const Z=new Set;for(const G of ue.features){const J=qt(G,N);if(J==null||Z.has(J))return!1;Z.add(J)}return!0}return!1}function Yt(ue,N){const Z=new Map;if(ue!=null)if(ue.type==="Feature")Z.set(qt(ue,N),ue);else for(const G of ue.features)Z.set(qt(G,N),G);return Z}class Mi extends Re{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(N,Z){return S._(this,void 0,void 0,function*(){const G=N.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const J=this._geoJSONIndex.getTile(G.z,G.x,G.y);if(!J)return null;const V=new Jt(J.features);let ce=xr(V);return ce.byteOffset===0&&ce.byteLength===ce.buffer.byteLength||(ce=new Uint8Array(ce)),{vectorTile:V,rawData:ce.buffer}})}loadData(N){return S._(this,void 0,void 0,function*(){var Z;(Z=this._pendingRequest)===null||Z===void 0||Z.abort();const G=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cC(N.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(N,this._pendingRequest),this._geoJSONIndex=N.cluster?new vr(function({superclusterOptions:ce,clusterProperties:ge}){if(!ge||!ce)return ce;const ie={},ye={},be={accumulated:null,zoom:0},de={properties:null},ke=Object.keys(ge);for(const Ne of ke){const[Ve,rt]=ge[Ne],dt=S.cJ(rt),Me=S.cJ(typeof Ve=="string"?[Ve,["accumulated"],["get",Ne]]:Ve);ie[Ne]=dt.value,ye[Ne]=Me.value}return ce.map=Ne=>{de.properties=Ne;const Ve={};for(const rt of ke)Ve[rt]=ie[rt].evaluate(be,de);return Ve},ce.reduce=(Ne,Ve)=>{de.properties=Ve;for(const rt of ke)be.accumulated=Ne[rt],Ne[rt]=ye[rt].evaluate(be,de)},ce}(N)).load((yield this._pendingData).features):(J=yield this._pendingData,new ut(J,N.geojsonVtOptions)),this.loaded={};const V={};if(G){const ce=G.finish();ce&&(V.resourceTiming={},V.resourceTiming[N.source]=JSON.parse(JSON.stringify(ce)))}return V}catch(V){if(delete this._pendingRequest,S.cn(V))return{abandoned:!0};throw V}var J})}getData(){return S._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(N){const Z=this.loaded;return Z&&Z[N.uid]?super.reloadTile(N):this.loadTile(N)}loadAndProcessGeoJSON(N,Z){return S._(this,void 0,void 0,function*(){let G=yield this.loadGeoJSON(N,Z);if(delete this._pendingRequest,typeof G!="object")throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(Rt(G,!0),N.filter){const J=S.cJ(N.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map(ce=>`${ce.key}: ${ce.message}`).join(", "));G={type:"FeatureCollection",features:G.features.filter(ce=>J.value.evaluate({zoom:0},ce))}}return G})}loadGeoJSON(N,Z){return S._(this,void 0,void 0,function*(){const{promoteId:G}=N;if(N.request){const J=yield S.j(N.request,Z);return this._dataUpdateable=Li(J.data,G)?Yt(J.data,G):void 0,J.data}if(typeof N.data=="string")try{const J=JSON.parse(N.data);return this._dataUpdateable=Li(J,G)?Yt(J,G):void 0,J}catch{throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`)}if(!N.dataDiff)throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${N.source}`);return function(J,V,ce){var ge,ie,ye,be;if(V.removeAll&&J.clear(),V.remove)for(const de of V.remove)J.delete(de);if(V.add)for(const de of V.add){const ke=qt(de,ce);ke!=null&&J.set(ke,de)}if(V.update)for(const de of V.update){let ke=J.get(de.id);if(ke==null)continue;const Ne=!de.removeAllProperties&&(((ge=de.removeProperties)===null||ge===void 0?void 0:ge.length)>0||((ie=de.addOrUpdateProperties)===null||ie===void 0?void 0:ie.length)>0);if((de.newGeometry||de.removeAllProperties||Ne)&&(ke=Object.assign({},ke),J.set(de.id,ke),Ne&&(ke.properties=Object.assign({},ke.properties))),de.newGeometry&&(ke.geometry=de.newGeometry),de.removeAllProperties)ke.properties={};else if(((ye=de.removeProperties)===null||ye===void 0?void 0:ye.length)>0)for(const Ve of de.removeProperties)Object.prototype.hasOwnProperty.call(ke.properties,Ve)&&delete ke.properties[Ve];if(((be=de.addOrUpdateProperties)===null||be===void 0?void 0:be.length)>0)for(const{key:Ve,value:rt}of de.addOrUpdateProperties)ke.properties[Ve]=rt}}(this._dataUpdateable,N.dataDiff,G),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(N){return S._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(N){return this._geoJSONIndex.getClusterExpansionZoom(N.clusterId)}getClusterChildren(N){return this._geoJSONIndex.getChildren(N.clusterId)}getClusterLeaves(N){return this._geoJSONIndex.getLeaves(N.clusterId,N.limit,N.offset)}}class pr{constructor(N){this.self=N,this.actor=new S.H(N),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(Z,G)=>{if(this.externalWorkerSourceTypes[Z])throw new Error(`Worker source with name "${Z}" already registered.`);this.externalWorkerSourceTypes[Z]=G},this.self.addProtocol=S.cp,this.self.removeProtocol=S.cq,this.self.registerRTLTextPlugin=Z=>{S.cK.setMethods(Z)},this.actor.registerMessageHandler("LDT",(Z,G)=>this._getDEMWorkerSource(Z,G.source).loadTile(G)),this.actor.registerMessageHandler("RDT",(Z,G)=>S._(this,void 0,void 0,function*(){this._getDEMWorkerSource(Z,G.source).removeTile(G)})),this.actor.registerMessageHandler("GCEZ",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterExpansionZoom(G)})),this.actor.registerMessageHandler("GCC",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterChildren(G)})),this.actor.registerMessageHandler("GCL",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterLeaves(G)})),this.actor.registerMessageHandler("LD",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).loadData(G)),this.actor.registerMessageHandler("GD",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).getData()),this.actor.registerMessageHandler("LT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).loadTile(G)),this.actor.registerMessageHandler("RT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).reloadTile(G)),this.actor.registerMessageHandler("AT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).abortTile(G)),this.actor.registerMessageHandler("RMT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).removeTile(G)),this.actor.registerMessageHandler("RS",(Z,G)=>S._(this,void 0,void 0,function*(){if(!this.workerSources[Z]||!this.workerSources[Z][G.type]||!this.workerSources[Z][G.type][G.source])return;const J=this.workerSources[Z][G.type][G.source];delete this.workerSources[Z][G.type][G.source],J.removeSource!==void 0&&J.removeSource(G)})),this.actor.registerMessageHandler("RM",Z=>S._(this,void 0,void 0,function*(){delete this.layerIndexes[Z],delete this.availableImages[Z],delete this.workerSources[Z],delete this.demWorkerSources[Z]})),this.actor.registerMessageHandler("SR",(Z,G)=>S._(this,void 0,void 0,function*(){this.referrer=G})),this.actor.registerMessageHandler("SRPS",(Z,G)=>this._syncRTLPluginState(Z,G)),this.actor.registerMessageHandler("IS",(Z,G)=>S._(this,void 0,void 0,function*(){this.self.importScripts(G)})),this.actor.registerMessageHandler("SI",(Z,G)=>this._setImages(Z,G)),this.actor.registerMessageHandler("UL",(Z,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(Z).update(G.layers,G.removedIds)})),this.actor.registerMessageHandler("SL",(Z,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(Z).replace(G)}))}_setImages(N,Z){return S._(this,void 0,void 0,function*(){this.availableImages[N]=Z;for(const G in this.workerSources[N]){const J=this.workerSources[N][G];for(const V in J)J[V].availableImages=Z}})}_syncRTLPluginState(N,Z){return S._(this,void 0,void 0,function*(){return yield S.cK.syncState(Z,this.self.importScripts)})}_getAvailableImages(N){let Z=this.availableImages[N];return Z||(Z=[]),Z}_getLayerIndex(N){let Z=this.layerIndexes[N];return Z||(Z=this.layerIndexes[N]=new o),Z}_getWorkerSource(N,Z,G){if(this.workerSources[N]||(this.workerSources[N]={}),this.workerSources[N][Z]||(this.workerSources[N][Z]={}),!this.workerSources[N][Z][G]){const J={sendAsync:(V,ce)=>(V.targetMapId=N,this.actor.sendAsync(V,ce))};switch(Z){case"vector":this.workerSources[N][Z][G]=new Re(J,this._getLayerIndex(N),this._getAvailableImages(N));break;case"geojson":this.workerSources[N][Z][G]=new Mi(J,this._getLayerIndex(N),this._getAvailableImages(N));break;default:this.workerSources[N][Z][G]=new this.externalWorkerSourceTypes[Z](J,this._getLayerIndex(N),this._getAvailableImages(N))}}return this.workerSources[N][Z][G]}_getDEMWorkerSource(N,Z){return this.demWorkerSources[N]||(this.demWorkerSources[N]={}),this.demWorkerSources[N][Z]||(this.demWorkerSources[N][Z]=new ve),this.demWorkerSources[N][Z]}}return S.i(self)&&(self.worker=new pr(self)),pr}),z("index",["exports","./shared"],function(S,o){var le="5.4.0";function he(){var u=new o.A(4);return o.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}let _e,Re;const ve={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(u,e,i){const s=requestAnimationFrame(h=>{l(),e(h)}),{unsubscribe:l}=o.s(u.signal,"abort",()=>{l(),cancelAnimationFrame(s),i(o.c())},!1)},frameAsync(u){return new Promise((e,i)=>{this.frame(u,e,i)})},getImageData(u,e=0){return this.getImageCanvasContext(u).getImageData(-e,-e,u.width+2*e,u.height+2*e)},getImageCanvasContext(u){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=u.width,e.height=u.height,i.drawImage(u,0,0,u.width,u.height),i},resolveURL:u=>(_e||(_e=document.createElement("a")),_e.href=u,_e.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Re==null&&(Re=matchMedia("(prefers-reduced-motion: reduce)")),Re.matches)}};class ne{static testProp(e){if(!ne.docStyle)return e[0];for(let i=0;i<e.length;i++)if(e[i]in ne.docStyle)return e[i];return e[0]}static create(e,i,s){const l=window.document.createElement(e);return i!==void 0&&(l.className=i),s&&s.appendChild(l),l}static createNS(e,i){return window.document.createElementNS(e,i)}static disableDrag(){ne.docStyle&&ne.selectProp&&(ne.userSelect=ne.docStyle[ne.selectProp],ne.docStyle[ne.selectProp]="none")}static enableDrag(){ne.docStyle&&ne.selectProp&&(ne.docStyle[ne.selectProp]=ne.userSelect)}static setTransform(e,i){e.style[ne.transformProp]=i}static addEventListener(e,i,s,l={}){e.addEventListener(i,s,"passive"in l?l:l.capture)}static removeEventListener(e,i,s,l={}){e.removeEventListener(i,s,"passive"in l?l:l.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",ne.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ne.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ne.suppressClickInternal,!0)},0)}static getScale(e){const i=e.getBoundingClientRect();return{x:i.width/e.offsetWidth||1,y:i.height/e.offsetHeight||1,boundingClientRect:i}}static getPoint(e,i,s){const l=i.boundingClientRect;return new o.P((s.clientX-l.left)/i.x-e.clientLeft,(s.clientY-l.top)/i.y-e.clientTop)}static mousePos(e,i){const s=ne.getScale(e);return ne.getPoint(e,s,i)}static touchPos(e,i){const s=[],l=ne.getScale(e);for(let h=0;h<i.length;h++)s.push(ne.getPoint(e,l,i[h]));return s}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const i=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),s=i.querySelectorAll("script");for(const l of s)l.remove();return ne.clean(i),i.innerHTML}static isPossiblyDangerous(e,i){const s=i.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!s.includes("javascript:")&&!s.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const i=e.children;for(const s of i)ne.removeAttributes(s),ne.clean(s)}static removeAttributes(e){for(const{name:i,value:s}of e.attributes)ne.isPossiblyDangerous(i,s)&&e.removeAttribute(i)}}ne.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,ne.selectProp=ne.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ne.transformProp=ne.testProp(["transform","WebkitTransform"]);const De={supported:!1,testSupport:function(u){!yt&&Rt&&(Dt?Jt(u):_t=u)}};let _t,Rt,yt=!1,Dt=!1;function Jt(u){const e=u.createTexture();u.bindTexture(u.TEXTURE_2D,e);try{if(u.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,Rt),u.isContextLost())return;De.supported=!0}catch{}u.deleteTexture(e),yt=!0}var Xt;typeof document<"u"&&(Rt=document.createElement("img"),Rt.onload=()=>{_t&&Jt(_t),_t=null,Dt=!0},Rt.onerror=()=>{yt=!0,_t=null},Rt.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let e,i,s,l;u.resetRequestQueue=()=>{e=[],i=0,s=0,l={}},u.addThrottleControl=v=>{const T=s++;return l[T]=v,T},u.removeThrottleControl=v=>{delete l[v],f()},u.getImage=(v,T,P=!0)=>new Promise((E,k)=>{De.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*"),o.e(v,{type:"image"}),e.push({abortController:T,requestParameters:v,supportImageRefresh:P,state:"queued",onError:F=>{k(F)},onSuccess:F=>{E(F)}}),f()});const h=v=>o._(this,void 0,void 0,function*(){v.state="running";const{requestParameters:T,supportImageRefresh:P,onError:E,onSuccess:k,abortController:F}=v,O=P===!1&&!o.i(self)&&!o.g(T.url)&&(!T.headers||Object.keys(T.headers).reduce((W,K)=>W&&K==="accept",!0));i++;const H=O?_(T,F):o.m(T,F);try{const W=yield H;delete v.abortController,v.state="completed",W.data instanceof HTMLImageElement||o.b(W.data)?k(W):W.data&&k({data:yield(q=W.data,typeof createImageBitmap=="function"?o.f(q):o.h(q)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete v.abortController,E(W)}finally{i--,f()}var q}),f=()=>{const v=(()=>{for(const T of Object.keys(l))if(l[T]())return!0;return!1})()?o.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:o.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let T=i;T<v&&e.length>0;T++){const P=e.shift();P.abortController.signal.aborted?T--:h(P)}},_=(v,T)=>new Promise((P,E)=>{const k=new Image,F=v.url,O=v.credentials;O&&O==="include"?k.crossOrigin="use-credentials":(O&&O==="same-origin"||!o.d(F))&&(k.crossOrigin="anonymous"),T.signal.addEventListener("abort",()=>{k.src="",E(o.c())}),k.fetchPriority="high",k.onload=()=>{k.onerror=k.onload=null,P({data:k})},k.onerror=()=>{k.onerror=k.onload=null,T.signal.aborted||E(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},k.src=F})}(Xt||(Xt={})),Xt.resetRequestQueue();class Et{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Bt(u){const e=[];if(typeof u=="string")e.push({id:"default",url:u});else if(u&&u.length>0){const i=[];for(const{id:s,url:l}of u){const h=`${s}${l}`;i.indexOf(h)===-1&&(i.push(h),e.push({id:s,url:l}))}}return e}function Ri(u,e,i){try{const s=new URL(u);return s.pathname+=`${e}${i}`,s.toString()}catch{throw new Error(`Invalid sprite URL "${u}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class jt{constructor(e,i,s,l){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this.update(i,l)}update(e,i,s){const{width:l,height:h}=e,f=!(this.size&&this.size[0]===l&&this.size[1]===h||s),{context:_}=this,{gl:v}=_;if(this.useMipmap=!!(i&&i.useMipmap),v.bindTexture(v.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===v.RGBA&&(!i||i.premultiply!==!1)),f)this.size=[l,h],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||o.b(e)?v.texImage2D(v.TEXTURE_2D,0,this.format,this.format,v.UNSIGNED_BYTE,e):v.texImage2D(v.TEXTURE_2D,0,this.format,l,h,0,this.format,v.UNSIGNED_BYTE,e.data);else{const{x:T,y:P}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||o.b(e)?v.texSubImage2D(v.TEXTURE_2D,0,T,P,v.RGBA,v.UNSIGNED_BYTE,e):v.texSubImage2D(v.TEXTURE_2D,0,T,P,l,h,v.RGBA,v.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&v.generateMipmap(v.TEXTURE_2D),_.pixelStoreUnpackFlipY.setDefault(),_.pixelStoreUnpack.setDefault(),_.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,i,s){const{context:l}=this,{gl:h}=l;h.bindTexture(h.TEXTURE_2D,this.texture),s!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=h.LINEAR),e!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,e),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,s||e),this.filter=e),i!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,i),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function xr(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class cn extends o.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new o.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:i,promiseResolve:s}of this.requestors)s(this._getImagesForIds(i));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const s=i.spriteData;i.data=new o.R({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),i.spriteData=null}return i}addImage(e,i){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,i)&&(this.images[e]=i)}_validate(e,i){let s=!0;const l=i.data||i.spriteData;return this._validateStretch(i.stretchX,l&&l.width)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchX" value`))),s=!1),this._validateStretch(i.stretchY,l&&l.height)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchY" value`))),s=!1),this._validateContent(i.content,i)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "content" value`))),s=!1),s}_validateStretch(e,i){if(!e)return!0;let s=0;for(const l of e){if(l[0]<s||l[1]<l[0]||i<l[1])return!1;s=l[1]}return!0}_validateContent(e,i){if(!e)return!0;if(e.length!==4)return!1;const s=i.spriteData,l=s&&s.width||i.data.width,h=s&&s.height||i.data.height;return!(e[0]<0||l<e[0]||e[1]<0||h<e[1]||e[2]<0||l<e[2]||e[3]<0||h<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,i,s=!0){const l=this.getImage(e);if(s&&(l.data.width!==i.data.width||l.data.height!==i.data.height))throw new Error(`size mismatch between old image (${l.data.width}x${l.data.height}) and new image (${i.data.width}x${i.data.height}).`);i.version=l.version+1,this.images[e]=i,this.updatedImages[e]=!0}removeImage(e){const i=this.images[e];delete this.images[e],delete this.patterns[e],i.userImage&&i.userImage.onRemove&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((i,s)=>{let l=!0;if(!this.isLoaded())for(const h of e)this.images[h]||(l=!1);this.isLoaded()||l?i(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:i})})}_getImagesForIds(e){const i={};for(const s of e){let l=this.getImage(s);l||(this.fire(new o.l("styleimagemissing",{id:s})),l=this.getImage(s)),l?i[s]={data:l.data.clone(),pixelRatio:l.pixelRatio,sdf:l.sdf,version:l.version,stretchX:l.stretchX,stretchY:l.stretchY,content:l.content,textFitWidth:l.textFitWidth,textFitHeight:l.textFitHeight,hasRenderCallback:!!(l.userImage&&l.userImage.render)}:o.w(`Image "${s}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return i}getPixelSize(){const{width:e,height:i}=this.atlasImage;return{width:e,height:i}}getPattern(e){const i=this.patterns[e],s=this.getImage(e);if(!s)return null;if(i&&i.position.version===s.version)return i.position;if(i)i.position.version=s.version;else{const l={w:s.data.width+2,h:s.data.height+2,x:0,y:0},h=new o.I(l,s);this.patterns[e]={bin:l,position:h}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new jt(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const h in this.patterns)e.push(this.patterns[h].bin);const{w:i,h:s}=o.p(e),l=this.atlasImage;l.resize({width:i||1,height:s||1});for(const h in this.patterns){const{bin:f}=this.patterns[h],_=f.x+1,v=f.y+1,T=this.getImage(h).data,P=T.width,E=T.height;o.R.copy(T,l,{x:0,y:0},{x:_,y:v},{width:P,height:E}),o.R.copy(T,l,{x:0,y:E-1},{x:_,y:v-1},{width:P,height:1}),o.R.copy(T,l,{x:0,y:0},{x:_,y:v+E},{width:P,height:1}),o.R.copy(T,l,{x:P-1,y:0},{x:_-1,y:v},{width:1,height:E}),o.R.copy(T,l,{x:0,y:0},{x:_+P,y:v},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const s=this.getImage(i);s||o.w(`Image with ID: "${i}" was not found`),xr(s)&&this.updateImage(i,s)}}}const Vr=1e20;function mt(u,e,i,s,l,h,f,_,v){for(let T=e;T<e+s;T++)_i(u,i*h+T,h,l,f,_,v);for(let T=i;T<i+l;T++)_i(u,T*h+e,1,s,f,_,v)}function _i(u,e,i,s,l,h,f){h[0]=0,f[0]=-1e20,f[1]=Vr,l[0]=u[e];for(let _=1,v=0,T=0;_<s;_++){l[_]=u[e+_*i];const P=_*_;do{const E=h[v];T=(l[_]-l[E]+P-E*E)/(_-E)/2}while(T<=f[v]&&--v>-1);v++,h[v]=_,f[v]=T,f[v+1]=Vr}for(let _=0,v=0;_<s;_++){for(;f[v+1]<_;)v++;const T=h[v],P=_-T;u[e+_*i]=l[T]+P*P}}class li{constructor(e,i){this.requestManager=e,this.localIdeographFontFamily=i,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return o._(this,void 0,void 0,function*(){const i=[];for(const h in e)for(const f of e[h])i.push(this._getAndCacheGlyphsPromise(h,f));const s=yield Promise.all(i),l={};for(const{stack:h,id:f,glyph:_}of s)l[h]||(l[h]={}),l[h][f]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return l})}_getAndCacheGlyphsPromise(e,i){return o._(this,void 0,void 0,function*(){let s=this.entries[e];s||(s=this.entries[e]={glyphs:{},requests:{},ranges:{}});let l=s.glyphs[i];if(l!==void 0)return{stack:e,id:i,glyph:l};if(l=this._tinySDF(s,e,i),l)return s.glyphs[i]=l,{stack:e,id:i,glyph:l};const h=Math.floor(i/256);if(256*h>65535)throw new Error("glyphs > 65535 not supported");if(s.ranges[h])return{stack:e,id:i,glyph:l};if(!this.url)throw new Error("glyphsUrl is not set");if(!s.requests[h]){const _=li.loadGlyphRange(e,h,this.url,this.requestManager);s.requests[h]=_}const f=yield s.requests[h];for(const _ in f)this._doesCharSupportLocalGlyph(+_)||(s.glyphs[+_]=f[+_]);return s.ranges[h]=!0,{stack:e,id:i,glyph:f[i]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))||o.u["CJK Unified Ideographs"](e)||o.u["Hangul Syllables"](e)||o.u.Hiragana(e)||o.u.Katakana(e)||o.u["CJK Symbols and Punctuation"](e)||o.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,s){const l=this.localIdeographFontFamily;if(!l||!this._doesCharSupportLocalGlyph(s))return;let h=e.tinySDF;if(!h){let _="400";/bold/i.test(i)?_="900":/medium/i.test(i)?_="500":/light/i.test(i)&&(_="200"),h=e.tinySDF=new li.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:l,fontWeight:_})}const f=h.draw(String.fromCharCode(s));return{id:s,bitmap:new o.q({width:f.width||60,height:f.height||60},f.data),metrics:{width:f.glyphWidth/2||24,height:f.glyphHeight/2||24,left:f.glyphLeft/2+.5||0,top:f.glyphTop/2-27.5||-8,advance:f.glyphAdvance/2||24,isDoubleResolution:!0}}}}li.loadGlyphRange=function(u,e,i,s){return o._(this,void 0,void 0,function*(){const l=256*e,h=l+255,f=s.transformRequest(i.replace("{fontstack}",u).replace("{range}",`${l}-${h}`),"Glyphs"),_=yield o.n(f,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${l}-${h}`);const v={};for(const T of o.o(_.data))v[T.id]=T;return v})},li.TinySDF=class{constructor({fontSize:u=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:l="sans-serif",fontWeight:h="normal",fontStyle:f="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const _=this.size=u+4*e,v=this._createCanvas(_),T=this.ctx=v.getContext("2d",{willReadFrequently:!0});T.font=`${f} ${h} ${u}px ${l}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(u){const e=document.createElement("canvas");return e.width=e.height=u,e}draw(u){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:l,actualBoundingBoxRight:h}=this.ctx.measureText(u),f=Math.ceil(i),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-l))),v=Math.min(this.size-this.buffer,f+Math.ceil(s)),T=_+2*this.buffer,P=v+2*this.buffer,E=Math.max(T*P,0),k=new Uint8ClampedArray(E),F={data:k,width:T,height:P,glyphWidth:_,glyphHeight:v,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(_===0||v===0)return F;const{ctx:O,buffer:H,gridInner:q,gridOuter:W}=this;O.clearRect(H,H,_,v),O.fillText(u,H,H+f);const K=O.getImageData(H,H,_,v);W.fill(Vr,0,E),q.fill(0,0,E);for(let ee=0;ee<v;ee++)for(let te=0;te<_;te++){const re=K.data[4*(ee*_+te)+3]/255;if(re===0)continue;const oe=(ee+H)*T+te+H;if(re===1)W[oe]=0,q[oe]=Vr;else{const ae=.5-re;W[oe]=ae>0?ae*ae:0,q[oe]=ae<0?ae*ae:0}}mt(W,0,0,T,P,T,this.f,this.v,this.z),mt(q,H,H,_,v,T,this.f,this.v,this.z);for(let ee=0;ee<E;ee++){const te=Math.sqrt(W[ee])-Math.sqrt(q[ee]);k[ee]=Math.round(255-255*(te/this.radius+this.cutoff))}return F}};class Ni{constructor(){this.specification=o.v.light.position}possiblyEvaluate(e,i){return o.z(e.expression.evaluate(i))}interpolate(e,i,s){return{x:o.B.number(e.x,i.x,s),y:o.B.number(e.y,i.y,s),z:o.B.number(e.z,i.z,s)}}}let vr;class un extends o.E{constructor(e){super(),vr=vr||new o.r({anchor:new o.D(o.v.light.anchor),position:new Ni,color:new o.D(o.v.light.color),intensity:new o.D(o.v.light.intensity)}),this._transitionable=new o.T(vr),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(o.t,e,i))for(const s in e){const l=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),l):this._transitionable.setValue(s,l)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,s){return(!s||s.validate!==!1)&&o.x(this,e.call(o.y,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v}))}}const Ft=new o.r({"sky-color":new o.D(o.v.sky["sky-color"]),"horizon-color":new o.D(o.v.sky["horizon-color"]),"fog-color":new o.D(o.v.sky["fog-color"]),"fog-ground-blend":new o.D(o.v.sky["fog-ground-blend"]),"horizon-fog-blend":new o.D(o.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new o.D(o.v.sky["sky-horizon-blend"]),"atmosphere-blend":new o.D(o.v.sky["atmosphere-blend"])});class zr extends o.E{constructor(e){super(),this._transitionable=new o.T(Ft),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new o.C(0))}setSky(e,i={}){if(!this._validate(o.F,e,i)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const s in e){const l=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),l):this._transitionable.setValue(s,l)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,s={}){return(s==null?void 0:s.validate)!==!1&&o.x(this,e.call(o.y,o.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class Ar{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,i){const s=e.join(",")+String(i);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(e,i)),this.dashEntry[s]}getDashRanges(e,i,s){const l=[];let h=e.length%2==1?-e[e.length-1]*s:0,f=e[0]*s,_=!0;l.push({left:h,right:f,isDash:_,zeroLength:e[0]===0});let v=e[0];for(let T=1;T<e.length;T++){_=!_;const P=e[T];h=v*s,v+=P,f=v*s,l.push({left:h,right:f,isDash:_,zeroLength:P===0})}return l}addRoundDash(e,i,s){const l=i/2;for(let h=-s;h<=s;h++){const f=this.width*(this.nextRow+s+h);let _=0,v=e[_];for(let T=0;T<this.width;T++){T/v.right>1&&(v=e[++_]);const P=Math.abs(T-v.left),E=Math.abs(T-v.right),k=Math.min(P,E);let F;const O=h/s*(l+1);if(v.isDash){const H=l-Math.abs(O);F=Math.sqrt(k*k+H*H)}else F=l-Math.sqrt(k*k+O*O);this.data[f+T]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const v=e[_],T=e[_+1];v.zeroLength?e.splice(_,1):T&&T.isDash===v.isDash&&(T.left=v.left,e.splice(_,1))}const i=e[0],s=e[e.length-1];i.isDash===s.isDash&&(i.left=s.left-this.width,s.right=i.right+this.width);const l=this.width*this.nextRow;let h=0,f=e[h];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++h]);const v=Math.abs(_-f.left),T=Math.abs(_-f.right),P=Math.min(v,T);this.data[l+_]=Math.max(0,Math.min(255,(f.isDash?P:-P)+128))}}addDash(e,i){const s=i?7:0,l=2*s+1;if(this.nextRow+l>this.height)return o.w("LineAtlas out of space"),null;let h=0;for(let _=0;_<e.length;_++)h+=e[_];if(h!==0){const _=this.width/h,v=this.getDashRanges(e,this.width,_);i?this.addRoundDash(v,_,s):this.addRegularDash(v)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:h};return this.nextRow+=l,this.dirty=!0,f}bind(e){const i=e.gl;this.texture?(i.bindTexture(i.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.width,this.height,i.ALPHA,i.UNSIGNED_BYTE,this.data))):(this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.ALPHA,this.width,this.height,0,i.ALPHA,i.UNSIGNED_BYTE,this.data))}}const Hn="maplibre_preloaded_worker_pool";class yi{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<yi.workerCount;)this.workers.push(new Worker(o.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Hn]}numActive(){return Object.keys(this.active).length}}const Pn=Math.floor(ve.hardwareConcurrency/2);let ir,Ti;function hn(){return ir||(ir=new yi),ir}yi.workerCount=o.G(globalThis)?Math.max(Math.min(Pn,3),1):1;class hr{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const s=this.workerPool.acquire(i);for(let l=0;l<s.length;l++){const h=new o.H(s[l],i);h.name=`Worker ${l}`,this.actors.push(h)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i){const s=[];for(const l of this.actors)s.push(l.sendAsync({type:e,data:i}));return Promise.all(s)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(i=>{i.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,i){for(const s of this.actors)s.registerMessageHandler(e,i)}}function Wn(){return Ti||(Ti=new hr(hn(),o.J),Ti.registerMessageHandler("GR",(u,e,i)=>o.m(e,i))),Ti}function Cn(u,e){const i=o.K();return o.L(i,i,[1,1,0]),o.M(i,i,[.5*u.width,.5*u.height,1]),u.calculatePosMatrix?o.N(i,i,u.calculatePosMatrix(e.toUnwrapped())):i}function ga(u,e,i,s,l,h,f){var _;const v=function(k,F,O){if(k)for(const H of k){const q=F[H];if(q&&q.source===O&&q.type==="fill-extrusion")return!0}else for(const H in F){const q=F[H];if(q.source===O&&q.type==="fill-extrusion")return!0}return!1}((_=l==null?void 0:l.layers)!==null&&_!==void 0?_:null,e,u.id),T=h.maxPitchScaleFactor(),P=u.tilesIn(s,T,v);P.sort(dr);const E=[];for(const k of P)E.push({wrappedTileID:k.tileID.wrapped().key,queryResults:k.tile.queryRenderedFeatures(e,i,u._state,k.queryGeometry,k.cameraQueryGeometry,k.scale,l,h,T,Cn(u.transform,k.tileID),f?(F,O)=>f(k.tileID,F,O):void 0)});return function(k,F){for(const O in k)for(const H of k[O])Ki(H,F);return k}(function(k){const F={},O={};for(const H of k){const q=H.queryResults,W=H.wrappedTileID,K=O[W]=O[W]||{};for(const ee in q){const te=q[ee],re=K[ee]=K[ee]||{},oe=F[ee]=F[ee]||[];for(const ae of te)re[ae.featureIndex]||(re[ae.featureIndex]=!0,oe.push(ae))}}return F}(E),u)}function dr(u,e){const i=u.tileID,s=e.tileID;return i.overscaledZ-s.overscaledZ||i.canonical.y-s.canonical.y||i.wrap-s.wrap||i.canonical.x-s.canonical.x}function Ki(u,e){const i=u.feature,s=e.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=s}function Zi(u,e,i){return o._(this,void 0,void 0,function*(){let s=u;if(u.url?s=(yield o.j(e.transformRequest(u.url,"Source"),i)).data:yield ve.frameAsync(i),!s)return null;const l=o.O(o.e(s,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(l.vectorLayerIds=s.vector_layers.map(h=>h.id)),l})}class Wt{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof o.Q?new o.Q(e.lng,e.lat):o.Q.convert(e),this}setSouthWest(e){return this._sw=e instanceof o.Q?new o.Q(e.lng,e.lat):o.Q.convert(e),this}extend(e){const i=this._sw,s=this._ne;let l,h;if(e instanceof o.Q)l=e,h=e;else{if(!(e instanceof Wt))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Wt.convert(e)):this.extend(o.Q.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(o.Q.convert(e)):this;if(l=e._sw,h=e._ne,!l||!h)return this}return i||s?(i.lng=Math.min(l.lng,i.lng),i.lat=Math.min(l.lat,i.lat),s.lng=Math.max(h.lng,s.lng),s.lat=Math.max(h.lat,s.lat)):(this._sw=new o.Q(l.lng,l.lat),this._ne=new o.Q(h.lng,h.lat)),this}getCenter(){return new o.Q((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new o.Q(this.getWest(),this.getNorth())}getSouthEast(){return new o.Q(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:s}=o.Q.convert(e);let l=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&l}static convert(e){return e instanceof Wt?e:e&&new Wt(e)}static fromLngLat(e,i=0){const s=360*i/40075017,l=s/Math.cos(Math.PI/180*e.lat);return new Wt(new o.Q(e.lng-l,e.lat-s),new o.Q(e.lng+l,e.lat+s))}adjustAntiMeridian(){const e=new o.Q(this._sw.lng,this._sw.lat),i=new o.Q(this._ne.lng,this._ne.lat);return new Wt(e,e.lng>i.lng?new o.Q(i.lng+360,i.lat):i)}}class rr{constructor(e,i,s){this.bounds=Wt.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=s||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),s=Math.floor(o.U(this.bounds.getWest())*i),l=Math.floor(o.S(this.bounds.getNorth())*i),h=Math.ceil(o.U(this.bounds.getEast())*i),f=Math.ceil(o.S(this.bounds.getSouth())*i);return e.x>=s&&e.x<h&&e.y>=l&&e.y<f}}class br extends o.E{constructor(e,i,s,l){if(super(),this.id=e,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,o.e(this,o.O(i,["url","scheme","tileSize","promoteId"])),this._options=o.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(l)}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield Zi(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(o.e(this,e),e.bounds&&(this.tileBounds=new rr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new o.k(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return o.e({},this._options)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(i,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};s.request.collectResourceTiming=this._collectResourceTiming;let l="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((h,f)=>{e.reloadPromise={resolve:h,reject:f}})}else e.actor=this.dispatcher.getActor(),l="LT";e.abortController=new AbortController;try{const h=yield e.actor.sendAsync({type:l,data:s},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,h)}catch(h){if(delete e.abortController,e.aborted)return;if(h&&h.status!==404)throw h;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,i){if(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),e.reloadPromise){const s=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(s.resolve).catch(s.reject)}}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Vi extends o.E{constructor(e,i,s,l){super(),this.id=e,this.dispatcher=s,this.setEventedParent(l),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.e({type:"raster"},i),o.e(this,o.O(i,["url","scheme","tileSize"]))}load(){return o._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield Zi(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(o.e(this,i),i.bounds&&(this.tileBounds=new rr(i.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(i){this._tileJSONRequest=null,this.fire(new o.k(i))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return o.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const s=yield Xt.getImage(this.map._requestManager.transformRequest(i,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(s&&s.data){this.map._refreshExpiredTiles&&s.cacheControl&&s.expires&&e.setExpiryData({cacheControl:s.cacheControl,expires:s.expires});const l=this.map.painter.context,h=l.gl,f=s.data;e.texture=this.map.painter.getTileTexture(f.width),e.texture?e.texture.update(f,{useMipmap:!0}):(e.texture=new jt(l,f,h.RGBA,{useMipmap:!0}),e.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(s){if(delete e.abortController,e.aborted)e.state="unloaded";else if(s)throw e.state="errored",s}})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class Xr extends Vi{constructor(e,i,s,l){super(e,i,s,l),this.type="raster-dem",this.maxzoom=22,this._options=o.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const l=yield Xt.getImage(s,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(l&&l.data){const h=l.data;this.map._refreshExpiredTiles&&l.cacheControl&&l.expires&&e.setExpiryData({cacheControl:l.cacheControl,expires:l.expires});const f=o.b(h)&&o.V()?h:yield this.readImageNow(h),_={type:this.type,uid:e.uid,source:this.id,rawImageData:f,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const v=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=v,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(l){if(delete e.abortController,e.aborted)e.state="unloaded";else if(l)throw e.state="errored",l}})}readImageNow(e){return o._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&o.W()){const i=e.width+2,s=e.height+2;try{return new o.R({width:i,height:s},yield o.X(e,-1,-1,i,s))}catch{}}return ve.getImageData(e,1)})}_getNeighboringTiles(e){const i=e.canonical,s=Math.pow(2,i.z),l=(i.x-1+s)%s,h=i.x===0?e.wrap-1:e.wrap,f=(i.x+1+s)%s,_=i.x+1===s?e.wrap+1:e.wrap,v={};return v[new o.Y(e.overscaledZ,h,i.z,l,i.y).key]={backfilled:!1},v[new o.Y(e.overscaledZ,_,i.z,f,i.y).key]={backfilled:!1},i.y>0&&(v[new o.Y(e.overscaledZ,h,i.z,l,i.y-1).key]={backfilled:!1},v[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},v[new o.Y(e.overscaledZ,_,i.z,f,i.y-1).key]={backfilled:!1}),i.y+1<s&&(v[new o.Y(e.overscaledZ,h,i.z,l,i.y+1).key]={backfilled:!1},v[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},v[new o.Y(e.overscaledZ,_,i.z,f,i.y+1).key]={backfilled:!1}),v}unloadTile(e){return o._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}class Kr extends o.E{constructor(e,i,s,l){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(l),this._data=i.data,this._options=o.e({},i),this._collectResourceTiming=i.collectResourceTiming,i.maxzoom!==void 0&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,i.clusterMaxZoom!==void 0&&this.maxzoom<=i.clusterMaxZoom&&o.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=o.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(i.buffer!==void 0?i.buffer:128),tolerance:this._pixelsToTileUnits(i.tolerance!==void 0?i.tolerance:.375),extent:o.Z,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:i.clusterMaxZoom!==void 0?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:o.Z,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(o.Z/this.tileSize)}load(){return o._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return o._(this,void 0,void 0,function*(){const e=o.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(i=>i.coordinates).flat(1/0):e.coordinates.flat(1/0)}getBounds(){return o._(this,void 0,void 0,function*(){const e=new Wt,i=yield this.getData();let s;switch(i.type){case"FeatureCollection":s=i.features.map(l=>this.getCoordinatesFromGeometry(l.geometry)).flat(1/0);break;case"Feature":s=this.getCoordinatesFromGeometry(i.geometry);break;default:s=this.getCoordinatesFromGeometry(i)}if(s.length==0)return e;for(let l=0;l<s.length-1;l+=2)e.extend([s[l],s[l+1]]);return e})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,i,s){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:i,offset:s}})}_updateWorkerData(e){return o._(this,void 0,void 0,function*(){const i=o.e({type:this.type},this.workerOptions);e?i.dataDiff=e:typeof this._data=="string"?(i.request=this.map._requestManager.transformRequest(ve.resolveURL(this._data),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new o.l("dataloading",{dataType:"source"}));try{const s=yield this.actor.sendAsync({type:"LD",data:i});if(this._pendingLoads--,this._removed||s.abandoned)return void this.fire(new o.l("dataabort",{dataType:"source"}));let l=null;s.resourceTiming&&s.resourceTiming[this.id]&&(l=s.resourceTiming[this.id].slice(0));const h={dataType:"source"};this._collectResourceTiming&&l&&l.length>0&&o.e(h,{resourceTiming:l}),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(s){if(this._pendingLoads--,this._removed)return void this.fire(new o.l("dataabort",{dataType:"source"}));this.fire(new o.k(s))}})}loaded(){return this._pendingLoads===0}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.actor?"RT":"LT";e.actor=this.actor;const s={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const l=yield this.actor.sendAsync({type:i,data:s},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(l,this.map.painter,i==="RT")})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return o.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class Di extends o.E{constructor(e,i,s,l){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=s,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(l),this.options=i}load(e){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const i=yield Xt.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,i&&i.data&&(this.image=i.data,e&&(this.coordinates=e),this._finishLoading())}catch(i){this._request=null,this._loaded=!0,this.fire(new o.k(i))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(o.$.fromLngLat);var s;return this.tileID=function(l){let h=1/0,f=1/0,_=-1/0,v=-1/0;for(const k of l)h=Math.min(h,k.x),f=Math.min(f,k.y),_=Math.max(_,k.x),v=Math.max(v,k.y);const T=Math.max(_-h,v-f),P=Math.max(0,Math.floor(-Math.log(T)/Math.LN2)),E=Math.pow(2,P);return new o.a1(P,Math.floor((h+_)/2*E),Math.floor((f+v)/2*E))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map(l=>this.tileID.getTilePoint(l)._round()),this.flippedWindingOrder=((s=this.tileCoords)[1].x-s[0].x)*(s[2].y-s[0].y)-(s[1].y-s[0].y)*(s[2].x-s[0].x)<0,this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new jt(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return o._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let i=1/0,s=1/0,l=-1/0,h=-1/0;for(const _ of e)i=Math.min(i,_.x),s=Math.min(s,_.y),l=Math.max(l,_.x),h=Math.max(h,_.y);const f={};for(let _=0;_<=o.a0;_++){const v=Math.pow(2,_),T=Math.floor(i*v),P=Math.floor(s*v),E=Math.floor(l*v),k=Math.floor(h*v);f[_]={minTileX:T,minTileY:P,maxTileX:E,maxTileY:k}}return f}}class nr extends Di{constructor(e,i,s,l){super(e,i,s,l),this.roundZoom=!0,this.type="video",this.options=i}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,"Source").url);try{const i=yield o.a2(this.urls);if(this._loaded=!0,!i)return;this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(i){this.fire(new o.k(i))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new o.k(new o.a3(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new jt(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Ze extends Di{constructor(e,i,s,l){super(e,i,s,l),i.coordinates?Array.isArray(i.coordinates)&&i.coordinates.length===4&&!i.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(f=>typeof f!="number"))||this.fire(new o.k(new o.a3(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.k(new o.a3(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new o.k(new o.a3(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?typeof i.canvas=="string"||i.canvas instanceof HTMLCanvasElement||this.fire(new o.k(new o.a3(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new o.k(new o.a3(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=i.animate===void 0||i.animate}load(){return o._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new o.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const i=this.map.painter.context,s=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new jt(i,this.canvas,s.RGBA,{premultiply:!0});let l=!1;for(const h in this.tiles){const f=this.tiles[h];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,l=!0)}l&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const Xe={},bt=u=>{switch(u){case"geojson":return Kr;case"image":return Di;case"raster":return Vi;case"raster-dem":return Xr;case"vector":return br;case"video":return nr;case"canvas":return Ze}return Xe[u]},Kt="RTLPluginLoaded";class fi extends o.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Wn()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(i=>{throw this.status="error",i})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return o._(this,arguments,void 0,function*(i,s=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=ve.resolveURL(i),!this.url)throw new Error(`requested url ${i} is invalid`);if(this.status==="unavailable"){if(!s)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return o._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new o.l(Kt))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let kt=null;function ut(){return kt||(kt=new fi),kt}class Gt{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=o.a4(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const i=e+this.timeAdded;i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(l,h){const f={};if(!h)return f;for(const _ of l){const v=_.layerIds.map(T=>h.getLayer(T)).filter(Boolean);if(v.length!==0){_.layers=v,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(T=>v.filter(P=>P.id===T)[0]));for(const T of v)f[T.id]=_}}return f}(e.buckets,i==null?void 0:i.style),this.hasSymbolBuckets=!1;for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a6){if(this.hasSymbolBuckets=!0,!s)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a6&&h.hasRTLText){this.hasRTLText=!0,ut().lazyLoad();break}}this.queryPadding=0;for(const l in this.buckets){const h=this.buckets[l];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(l).queryRadius(h))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new o.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const s in this.buckets){const l=this.buckets[s];l.uploadPending()&&l.upload(e)}const i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new jt(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new jt(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,i,s,l,h,f,_,v,T,P,E){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:h,scale:f,tileSize:this.tileSize,pixelPosMatrix:P,transform:v,params:_,queryPadding:this.queryPadding*T,getElevation:E},e,i,s):{}}querySourceFeatures(e,i){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const l=s.loadVTLayers(),h=i&&i.sourceLayer?i.sourceLayer:"",f=l._geojsonTileLayer||l[h];if(!f)return;const _=o.a7(i&&i.filter),{z:v,x:T,y:P}=this.tileID.canonical,E={z:v,x:T,y:P};for(let k=0;k<f.length;k++){const F=f.feature(k);if(_.needGeometry){const q=o.a8(F,!0);if(!_.filter(new o.C(this.tileID.overscaledZ),q,this.tileID.canonical))continue}else if(!_.filter(new o.C(this.tileID.overscaledZ),F))continue;const O=s.getId(F,h),H=new o.a9(F,v,T,P,O);H.tile=E,e.push(H)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const s=o.aa(e.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const s=Date.now();let l=!1;if(this.expirationTime>s)l=!1;else if(i)if(this.expirationTime<i)l=!0;else{const h=this.expirationTime-i;h?this.expirationTime=s+Math.max(h,3e4):l=!0}else l=!0;l?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,i){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const l in this.buckets){if(!i.style.hasLayer(l))continue;const h=this.buckets[l],f=h.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],v=e[f];if(!_||!v||Object.keys(v).length===0)continue;h.update(v,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const T=i&&i.style&&i.style.getLayer(l);T&&(this.queryPadding=Math.max(this.queryPadding,T.queryRadius(h)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ve.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=ve.now()+e}setDependencies(e,i){const s={};for(const l of i)s[l]=!0;this.dependencies[e]=s}hasDependency(e,i){for(const s of e){const l=this.dependencies[s];if(l){for(const h of i)if(l[h])return!0}}return!1}}class qt{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(const e in this.data)for(const i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,s){const l=e.wrapped().key;this.data[l]===void 0&&(this.data[l]=[]);const h={value:i,timeout:void 0};if(s!==void 0&&(h.timeout=setTimeout(()=>{this.remove(e,h)},s)),this.data[l].push(h),this.order.push(l),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){const i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;const s=e.wrapped().key,l=i===void 0?0:this.data[s].indexOf(i),h=this.data[s][l];return this.data[s].splice(l,1),h.timeout&&clearTimeout(h.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(h.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(e){const i=[];for(const s in this.data)for(const l of this.data[s])e(l.value)||i.push(l);for(const s of i)this.remove(s.value.tileID,s)}}class Li{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,s){const l=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][l]=this.stateChanges[e][l]||{},o.e(this.stateChanges[e][l],s),this.deletedStates[e]===null){this.deletedStates[e]={};for(const h in this.state[e])h!==l&&(this.deletedStates[e][h]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][l]===null){this.deletedStates[e][l]={};for(const h in this.state[e][l])s[h]||(this.deletedStates[e][l][h]=null)}else for(const h in s)this.deletedStates[e]&&this.deletedStates[e][l]&&this.deletedStates[e][l][h]===null&&delete this.deletedStates[e][l][h]}removeFeatureState(e,i,s){if(this.deletedStates[e]===null)return;const l=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},s&&i!==void 0)this.deletedStates[e][l]!==null&&(this.deletedStates[e][l]=this.deletedStates[e][l]||{},this.deletedStates[e][l][s]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][l])for(s in this.deletedStates[e][l]={},this.stateChanges[e][l])this.deletedStates[e][l][s]=null;else this.deletedStates[e][l]=null;else this.deletedStates[e]=null}getState(e,i){const s=String(i),l=o.e({},(this.state[e]||{})[s],(this.stateChanges[e]||{})[s]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const h=this.deletedStates[e][i];if(h===null)return{};for(const f in h)delete l[f]}return l}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const s={};for(const l in this.stateChanges){this.state[l]=this.state[l]||{};const h={};for(const f in this.stateChanges[l])this.state[l][f]||(this.state[l][f]={}),o.e(this.state[l][f],this.stateChanges[l][f]),h[f]=this.state[l][f];s[l]=h}for(const l in this.deletedStates){this.state[l]=this.state[l]||{};const h={};if(this.deletedStates[l]===null)for(const f in this.state[l])h[f]={},this.state[l][f]={};else for(const f in this.deletedStates[l]){if(this.deletedStates[l][f]===null)this.state[l][f]={};else for(const _ of Object.keys(this.deletedStates[l][f]))delete this.state[l][f][_];h[f]=this.state[l][f]}s[l]=s[l]||{},o.e(s[l],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const l in e)e[l].setFeatureState(s,i)}}const Yt=89.25;function Mi(u,e){const i=o.ae(e.lat,-85.051129,o.af);return new o.P(o.U(e.lng)*u,o.S(i)*u)}function pr(u,e){return new o.$(e.x/u,e.y/u).toLngLat()}function ue(u){return u.cameraToCenterDistance*Math.min(.85*Math.tan(o.ab(90-u.pitch)),Math.tan(o.ab(Yt-u.pitch)))}function N(u,e){const i=u.canonical,s=e/o.ac(i.z),l=i.x+Math.pow(2,i.z)*u.wrap,h=o.ad(new Float64Array(16));return o.L(h,h,[l*s,i.y*s,0]),o.M(h,h,[s/o.Z,s/o.Z,1]),h}function Z(u,e,i,s,l){const h=o.$.fromLngLat(u,e),f=l*o.ag(1,u.lat),_=f*Math.cos(o.ab(i)),v=Math.sqrt(f*f-_*_),T=v*Math.sin(o.ab(-s)),P=v*Math.cos(o.ab(-s));return new o.$(h.x+T,h.y+P,h.z+_)}function G(u,e,i){const s=e.intersectsFrustum(u);if(!i)return s;const l=e.intersectsPlane(i);return s===0||l===0?0:s===2&&l===2?2:1}function J(u,e,i){let s=0;const l=(i-e)/10;for(let h=0;h<10;h++)s+=l*Math.pow(Math.cos(e+(h+.5)/10*(i-e)),u);return s}function V(u,e){return function(i,s,l,h,f){const _=2*((u-1)/o.ah(Math.cos(o.ab(Yt-f))/Math.cos(o.ab(Yt)))-1),v=Math.acos(l/h),T=2*J(_-1,0,o.ab(f/2)),P=Math.min(o.ab(Yt),v+o.ab(f/2)),E=J(_-1,Math.min(P,v-o.ab(f/2)),P),k=Math.atan(s/l),F=Math.hypot(s,l);let O=i;return O+=o.ah(h/F/Math.max(.5,Math.cos(o.ab(f/2)))),O+=_*o.ah(Math.cos(k))/2,O-=o.ah(Math.max(1,E/T/e))/2,O}}const ce=V(9.314,3);function ge(u,e){const i=(e.roundZoom?Math.round:Math.floor)(u.zoom+o.ah(u.tileSize/e.tileSize));return Math.max(0,i)}function ie(u,e){const i=u.getCameraFrustum(),s=u.getClippingPlane(),l=u.screenPointToMercatorCoordinate(u.getCameraPoint()),h=o.$.fromLngLat(u.center,u.elevation);l.z=h.z+Math.cos(u.pitchInRadians)*u.cameraToCenterDistance/u.worldSize;const f=u.getCoveringTilesDetailsProvider(),_=f.allowVariableZoom(u,e),v=ge(u,e),T=e.minzoom||0,P=e.maxzoom!==void 0?e.maxzoom:u.maxZoom,E=Math.min(Math.max(0,v),P),k=Math.pow(2,E),F=[k*l.x,k*l.y,0],O=[k*h.x,k*h.y,0],H=Math.hypot(h.x-l.x,h.y-l.y),q=Math.abs(h.z-l.z),W=Math.hypot(H,q),K=re=>({zoom:0,x:0,y:0,wrap:re,fullyVisible:!1}),ee=[],te=[];if(u.renderWorldCopies&&f.allowWorldCopies())for(let re=1;re<=3;re++)ee.push(K(-re)),ee.push(K(re));for(ee.push(K(0));ee.length>0;){const re=ee.pop(),oe=re.x,ae=re.y;let pe=re.fullyVisible;const me={x:oe,y:ae,z:re.zoom},Se=f.getTileAABB(me,re.wrap,u.elevation,e);if(!pe){const Be=G(i,Se,s);if(Be===0)continue;pe=Be===2}const Ce=f.distanceToTile2d(l.x,l.y,me,Se);let Te=v;_&&(Te=(e.calculateTileZoom||ce)(u.zoom+o.ah(u.tileSize/e.tileSize),Ce,q,W,u.fov)),Te=(e.roundZoom?Math.round:Math.floor)(Te),Te=Math.max(0,Te);const je=Math.min(Te,P);if(re.wrap=f.getWrap(h,me,re.wrap),re.zoom>=je){if(re.zoom<T)continue;const Be=E-re.zoom,Ee=F[0]-.5-(oe<<Be),He=F[1]-.5-(ae<<Be),ft=e.reparseOverscaled?Math.max(re.zoom,Te):re.zoom;te.push({tileID:new o.Y(re.zoom===P?ft:re.zoom,re.wrap,re.zoom,oe,ae),distanceSq:o.ai([O[0]-.5-oe,O[1]-.5-ae]),tileDistanceToCamera:Math.sqrt(Ee*Ee+He*He)})}else for(let Be=0;Be<4;Be++)ee.push({zoom:re.zoom+1,x:(oe<<1)+Be%2,y:(ae<<1)+(Be>>1),wrap:re.wrap,fullyVisible:pe})}return te.sort((re,oe)=>re.distanceSq-oe.distanceSq).map(re=>re.tileID)}class ye extends o.E{constructor(e,i,s){super(),this.id=e,this.dispatcher=s,this.on("data",l=>this._dataHandler(l)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((l,h,f,_)=>{const v=new(bt(h.type))(l,h,f,_);if(v.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${v.id}`);return v})(e,i,s,this),this._tiles={},this._cache=new qt(0,l=>this._unloadTile(l)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Li,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e in this._tiles){const i=this._tiles[e];if(i.state!=="loaded"&&i.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,s){return o._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,s)}catch(l){e.state="errored",l.status!==404?this._source.fire(new o.k(l,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new o.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const i in this._tiles){const s=this._tiles[i];s.upload(e),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(be).map(e=>e.key)}getRenderableIds(e){const i=[];for(const s in this._tiles)this._isIdRenderable(s,e)&&i.push(this._tiles[s]);return e?i.sort((s,l)=>{const h=s.tileID,f=l.tileID,_=new o.P(h.canonical.x,h.canonical.y)._rotate(-this.transform.bearingInRadians),v=new o.P(f.canonical.x,f.canonical.y)._rotate(-this.transform.bearingInRadians);return h.overscaledZ-f.overscaledZ||v.y-_.y||v.x-_.x}).map(s=>s.tileID.key):i.map(s=>s.tileID).sort(be).map(s=>s.key)}hasRenderableParent(e){const i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)(e||this._tiles[i].state!=="errored")&&this._reloadTile(i,"reloading")}}_reloadTile(e,i){return o._(this,void 0,void 0,function*(){const s=this._tiles[e];s&&(s.state!=="loading"&&(s.state=i),yield this._loadTile(s,e,i))})}_tileLoaded(e,i,s){e.timeAdded=ve.now(),s==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new o.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const i=this.getRenderableIds();for(let l=0;l<i.length;l++){const h=i[l];if(e.neighboringTiles&&e.neighboringTiles[h]){const f=this.getTileByID(h);s(e,f),s(f,e)}}function s(l,h){l.needsHillshadePrepare=!0,l.needsTerrainPrepare=!0;let f=h.tileID.canonical.x-l.tileID.canonical.x;const _=h.tileID.canonical.y-l.tileID.canonical.y,v=Math.pow(2,l.tileID.canonical.z),T=h.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+v)===1?f+=v:Math.abs(f-v)===1&&(f-=v)),h.dem&&l.dem&&(l.dem.backfillBorder(h.dem,f,_),l.neighboringTiles&&l.neighboringTiles[T]&&(l.neighboringTiles[T].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,s,l){for(const h in this._tiles){let f=this._tiles[h];if(l[h]||!f.hasData()||f.tileID.overscaledZ<=i||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>i+1;){const T=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[T.key],f&&f.hasData()&&(_=T)}let v=_;for(;v.overscaledZ>i;)if(v=v.scaledTo(v.overscaledZ-1),e[v.key]||e[v.canonical.key]){l[_.key]=_;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){const s=this._loadedParentTiles[e.key];return s&&s.tileID.overscaledZ>=i?s:null}for(let s=e.overscaledZ-1;s>=i;s--){const l=e.scaledTo(s),h=this._getLoadedTile(l);if(h)return h}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,s=Math.ceil(e.height/this._source.tileSize)+1,l=Math.floor(i*s*(this._maxTileCacheZoomLevels===null?o.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,l):l;this._cache.setMaxSize(h)}handleWrapJump(e){const i=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,i){const s={};for(const l in this._tiles){const h=this._tiles[l];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+i),s[h.tileID.key]=h}this._tiles=s;for(const l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(const l in this._tiles)this._setTileReloadTimer(l,this._tiles[l])}}_updateCoveredAndRetainedTiles(e,i,s,l,h,f){const _={},v={},T=Object.keys(e),P=ve.now();for(const E of T){const k=e[E],F=this._tiles[E];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=P)continue;const O=this.findLoadedParent(k,i),H=this.findLoadedSibling(k),q=O||H||null;q&&(this._addTile(q.tileID),_[q.tileID.key]=q.tileID),v[E]=k}this._retainLoadedChildren(v,l,s,e);for(const E in _)e[E]||(this._coveredTiles[E]=!0,e[E]=_[E]);if(f){const E={},k={};for(const F of h)this._tiles[F.key].hasData()?E[F.key]=F:k[F.key]=F;for(const F in k){const O=k[F].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(E[O[0].key]=e[O[0].key]=O[0],E[O[1].key]=e[O[1].key]=O[1],E[O[2].key]=e[O[2].key]=O[2],E[O[3].key]=e[O[3].key]=O[3],delete k[F])}for(const F in k){const O=k[F],H=this.findLoadedParent(O,this._source.minzoom),q=this.findLoadedSibling(O),W=H||q||null;if(W){E[W.tileID.key]=e[W.tileID.key]=W.tileID;for(const K in E)E[K].isChildOf(W.tileID)&&delete E[K]}}for(const F in this._tiles)E[F]||(this._coveredTiles[F]=!0)}}update(e,i){if(!this._sourceLoaded||this._paused)return;let s;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(P=>new o.Y(P.canonical.z,P.wrap,P.canonical.z,P.canonical.x,P.canonical.y)):(s=ie(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(s=s.filter(P=>this._source.hasTile(P)))):s=[];const l=ge(e,this._source),h=Math.max(l-ye.maxOverzooming,this._source.minzoom),f=Math.max(l+ye.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const P={};for(const E of s)if(E.canonical.z>this._source.minzoom){const k=E.scaledTo(E.canonical.z-1);P[k.key]=k;const F=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));P[F.key]=F}s=s.concat(Object.values(P))}const _=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new o.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const v=this._updateRetainedTiles(s,l);de(this._source.type)&&this._updateCoveredAndRetainedTiles(v,h,f,l,s,i);for(const P in v)this._tiles[P].clearFadeHold();const T=o.aj(this._tiles,v);for(const P of T){const E=this._tiles[P];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(P)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,i){var s;const l={},h={},f=Math.max(i-ye.maxOverzooming,this._source.minzoom),_=Math.max(i+ye.maxUnderzooming,this._source.minzoom),v={};for(const T of e){const P=this._addTile(T);l[T.key]=T,P.hasData()||i<this._source.maxzoom&&(v[T.key]=T)}this._retainLoadedChildren(v,i,_,l);for(const T of e){let P=this._tiles[T.key];if(P.hasData())continue;if(i+1>this._source.maxzoom){const k=T.children(this._source.maxzoom)[0],F=this.getTile(k);if(F&&F.hasData()){l[k.key]=k;continue}}else{const k=T.children(this._source.maxzoom);if(l[k[0].key]&&l[k[1].key]&&l[k[2].key]&&l[k[3].key])continue}let E=P.wasRequested();for(let k=T.overscaledZ-1;k>=f;--k){const F=T.scaledTo(k);if(h[F.key])break;if(h[F.key]=!0,P=this.getTile(F),!P&&E&&(P=this._addTile(F)),P){const O=P.hasData();if((O||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||E)&&(l[F.key]=F),E=P.wasRequested(),O)break}}}return l}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let s,l=this._tiles[e].tileID;for(;l.overscaledZ>0;){if(l.key in this._loadedParentTiles){s=this._loadedParentTiles[l.key];break}i.push(l.key);const h=l.scaledTo(l.overscaledZ-1);if(s=this._getLoadedTile(h),s)break;l=h}for(const h of i)this._loadedParentTiles[h]=s}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const i=this._tiles[e].tileID,s=this._getLoadedTile(i);this._loadedSiblingTiles[i.key]=s}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const s=i;return i||(i=new Gt(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,s||this._source.fire(new o.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const s=i.getExpiryTimeout();s&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},s))}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(e){const i=e.sourceDataType;e.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&i==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,s){const l=[],h=this.transform;if(!h)return l;const f=s?h.getCameraQueryGeometry(e):e,_=e.map(O=>h.screenPointToMercatorCoordinate(O,this.terrain)),v=f.map(O=>h.screenPointToMercatorCoordinate(O,this.terrain)),T=this.getIds();let P=1/0,E=1/0,k=-1/0,F=-1/0;for(const O of v)P=Math.min(P,O.x),E=Math.min(E,O.y),k=Math.max(k,O.x),F=Math.max(F,O.y);for(let O=0;O<T.length;O++){const H=this._tiles[T[O]];if(H.holdingForFade())continue;const q=h.getCoveringTilesDetailsProvider().allowWorldCopies()?H.tileID:H.tileID.unwrapTo(0),W=Math.pow(2,h.zoom-H.tileID.overscaledZ),K=i*H.queryPadding*o.Z/H.tileSize/W,ee=[q.getTilePoint(new o.$(P,E)),q.getTilePoint(new o.$(k,F))];if(ee[0].x-K<o.Z&&ee[0].y-K<o.Z&&ee[1].x+K>=0&&ee[1].y+K>=0){const te=_.map(oe=>q.getTilePoint(oe)),re=v.map(oe=>q.getTilePoint(oe));l.push({tile:H,tileID:q,queryGeometry:te,cameraQueryGeometry:re,scale:W})}}return l}getVisibleCoordinates(e){const i=this.getRenderableIds(e).map(s=>this._tiles[s].tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){if(this._source.hasTransition())return!0;if(de(this._source.type)){const e=ve.now();for(const i in this._tiles)if(this._tiles[i].fadeEndTime>=e)return!0}return!1}setFeatureState(e,i,s){this._state.updateState(e=e||"_geojsonTileLayer",i,s)}removeFeatureState(e,i,s){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,s)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,s){const l=this._tiles[e];l&&l.setDependencies(i,s)}reloadTilesForDependencies(e,i){for(const s in this._tiles)this._tiles[s].hasDependency(e,i)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(e,i))}}function be(u,e){const i=Math.abs(2*u.wrap)-+(u.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return u.overscaledZ-e.overscaledZ||s-i||e.canonical.y-u.canonical.y||e.canonical.x-u.canonical.x}function de(u){return u==="raster"||u==="image"||u==="video"}ye.maxOverzooming=10,ye.maxUnderzooming=3;class ke{constructor(e,i){this.reset(e,i)}reset(e,i){this.points=e||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=o.ae(e,0,1);let i=1,s=this._distances[i];const l=e*this.paddedLength+this.padding;for(;s<l&&i<this._distances.length;)s=this._distances[++i];const h=i-1,f=this._distances[h],_=s-f,v=_>0?(l-f)/_:0;return this.points[h].mult(1-v).add(this.points[i].mult(v))}}function Ne(u,e){let i=!0;return u==="always"||u!=="never"&&e!=="never"||(i=!1),i}class Ve{constructor(e,i,s){const l=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(e/s),this.yCellCount=Math.ceil(i/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)l.push([]),h.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=i,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,s,l,h){this._forEachCell(i,s,l,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(h)}insertCircle(e,i,s,l){this._forEachCell(i-l,s-l,i+l,s+l,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(s),this.circles.push(l)}_insertBoxCell(e,i,s,l,h,f){this.boxCells[h].push(f)}_insertCircleCell(e,i,s,l,h,f){this.circleCells[h].push(f)}_query(e,i,s,l,h,f,_){if(s<0||e>this.width||l<0||i>this.height)return[];const v=[];if(e<=0&&i<=0&&this.width<=s&&this.height<=l){if(h)return[{key:null,x1:e,y1:i,x2:s,y2:l}];for(let T=0;T<this.boxKeys.length;T++)v.push({key:this.boxKeys[T],x1:this.bboxes[4*T],y1:this.bboxes[4*T+1],x2:this.bboxes[4*T+2],y2:this.bboxes[4*T+3]});for(let T=0;T<this.circleKeys.length;T++){const P=this.circles[3*T],E=this.circles[3*T+1],k=this.circles[3*T+2];v.push({key:this.circleKeys[T],x1:P-k,y1:E-k,x2:P+k,y2:E+k})}}else this._forEachCell(e,i,s,l,this._queryCell,v,{hitTest:h,overlapMode:f,seenUids:{box:{},circle:{}}},_);return v}query(e,i,s,l){return this._query(e,i,s,l,!1,null)}hitTest(e,i,s,l,h,f){return this._query(e,i,s,l,!0,h,f).length>0}hitTestCircle(e,i,s,l,h){const f=e-s,_=e+s,v=i-s,T=i+s;if(_<0||f>this.width||T<0||v>this.height)return!1;const P=[];return this._forEachCell(f,v,_,T,this._queryCellCircle,P,{hitTest:!0,overlapMode:l,circle:{x:e,y:i,radius:s},seenUids:{box:{},circle:{}}},h),P.length>0}_queryCell(e,i,s,l,h,f,_,v){const{seenUids:T,hitTest:P,overlapMode:E}=_,k=this.boxCells[h];if(k!==null){const O=this.bboxes;for(const H of k)if(!T.box[H]){T.box[H]=!0;const q=4*H,W=this.boxKeys[H];if(e<=O[q+2]&&i<=O[q+3]&&s>=O[q+0]&&l>=O[q+1]&&(!v||v(W))&&(!P||!Ne(E,W.overlapMode))&&(f.push({key:W,x1:O[q],y1:O[q+1],x2:O[q+2],y2:O[q+3]}),P))return!0}}const F=this.circleCells[h];if(F!==null){const O=this.circles;for(const H of F)if(!T.circle[H]){T.circle[H]=!0;const q=3*H,W=this.circleKeys[H];if(this._circleAndRectCollide(O[q],O[q+1],O[q+2],e,i,s,l)&&(!v||v(W))&&(!P||!Ne(E,W.overlapMode))){const K=O[q],ee=O[q+1],te=O[q+2];if(f.push({key:W,x1:K-te,y1:ee-te,x2:K+te,y2:ee+te}),P)return!0}}}return!1}_queryCellCircle(e,i,s,l,h,f,_,v){const{circle:T,seenUids:P,overlapMode:E}=_,k=this.boxCells[h];if(k!==null){const O=this.bboxes;for(const H of k)if(!P.box[H]){P.box[H]=!0;const q=4*H,W=this.boxKeys[H];if(this._circleAndRectCollide(T.x,T.y,T.radius,O[q+0],O[q+1],O[q+2],O[q+3])&&(!v||v(W))&&!Ne(E,W.overlapMode))return f.push(!0),!0}}const F=this.circleCells[h];if(F!==null){const O=this.circles;for(const H of F)if(!P.circle[H]){P.circle[H]=!0;const q=3*H,W=this.circleKeys[H];if(this._circlesCollide(O[q],O[q+1],O[q+2],T.x,T.y,T.radius)&&(!v||v(W))&&!Ne(E,W.overlapMode))return f.push(!0),!0}}}_forEachCell(e,i,s,l,h,f,_,v){const T=this._convertToXCellCoord(e),P=this._convertToYCellCoord(i),E=this._convertToXCellCoord(s),k=this._convertToYCellCoord(l);for(let F=T;F<=E;F++)for(let O=P;O<=k;O++)if(h.call(this,e,i,s,l,this.xCellCount*O+F,f,_,v))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,i,s,l,h,f){const _=l-e,v=h-i,T=s+f;return T*T>_*_+v*v}_circleAndRectCollide(e,i,s,l,h,f,_){const v=(f-l)/2,T=Math.abs(e-(l+v));if(T>v+s)return!1;const P=(_-h)/2,E=Math.abs(i-(h+P));if(E>P+s)return!1;if(T<=v||E<=P)return!0;const k=T-v,F=E-P;return k*k+F*F<=s*s}}function rt(u,e,i){const s=o.K();if(!u){const{vecSouth:E,vecEast:k}=Me(e),F=he();F[0]=k[0],F[1]=k[1],F[2]=E[0],F[3]=E[1],l=F,(P=(f=(h=F)[0])*(T=h[3])-(v=h[2])*(_=h[1]))&&(l[0]=T*(P=1/P),l[1]=-_*P,l[2]=-v*P,l[3]=f*P),s[0]=F[0],s[1]=F[1],s[4]=F[2],s[5]=F[3]}var l,h,f,_,v,T,P;return o.M(s,s,[1/i,1/i,1]),s}function dt(u,e,i,s){if(u){const l=o.K();if(!e){const{vecSouth:h,vecEast:f}=Me(i);l[0]=f[0],l[1]=f[1],l[4]=h[0],l[5]=h[1]}return o.M(l,l,[s,s,1]),l}return i.pixelsToClipSpaceMatrix}function Me(u){const e=Math.cos(u.rollInRadians),i=Math.sin(u.rollInRadians),s=Math.cos(u.pitchInRadians),l=Math.cos(u.bearingInRadians),h=Math.sin(u.bearingInRadians),f=o.ao();f[0]=-l*s*i-h*e,f[1]=-h*s*i+l*e;const _=o.ap(f);_<1e-9?o.aq(f):o.ar(f,f,1/_);const v=o.ao();v[0]=l*s*e-h*i,v[1]=h*s*e+l*i;const T=o.ap(v);return T<1e-9?o.aq(v):o.ar(v,v,1/T),{vecEast:v,vecSouth:f}}function at(u,e,i,s){let l;s?(l=[u,e,s(u,e),1],o.at(l,l,i)):(l=[u,e,0,1],ei(l,l,i));const h=l[3];return{point:new o.P(l[0]/h,l[1]/h),signedDistanceFromCamera:h,isOccluded:!1}}function Ct(u,e){return .5+u/e*.5}function Vt(u,e){return u.x>=-e[0]&&u.x<=e[0]&&u.y>=-e[1]&&u.y<=e[1]}function It(u,e,i,s,l,h,f,_,v,T,P,E,k){const F=i?u.textSizeData:u.iconSizeData,O=o.ak(F,e.transform.zoom),H=[256/e.width*2+1,256/e.height*2+1],q=i?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;q.clear();const W=u.lineVertexArray,K=i?u.text.placedSymbolArray:u.icon.placedSymbolArray,ee=e.transform.width/e.transform.height;let te=!1;for(let re=0;re<K.length;re++){const oe=K.get(re);if(oe.hidden||oe.writingMode===o.al.vertical&&!te){Ui(oe.numGlyphs,q);continue}te=!1;const ae=new o.P(oe.anchorX,oe.anchorY),pe={getElevation:k,pitchedLabelPlaneMatrix:s,lineVertexArray:W,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:ae,unwrappedTileID:v,width:T,height:P,translation:E},me=ws(oe.anchorX,oe.anchorY,pe);if(!Vt(me.point,H)){Ui(oe.numGlyphs,q);continue}const Se=Ct(e.transform.cameraToCenterDistance,me.signedDistanceFromCamera),Ce=o.am(F,O,oe),Te=h?Ce*e.transform.getPitchedTextCorrection(oe.anchorX,oe.anchorY,v)/Se:Ce*Se,je=et({projectionContext:pe,pitchedLabelPlaneMatrixInverse:l,symbol:oe,fontSize:Te,flip:!1,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:_});te=je.useVertical,(je.notEnoughRoom||te||je.needsFlipping&&et({projectionContext:pe,pitchedLabelPlaneMatrixInverse:l,symbol:oe,fontSize:Te,flip:!0,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:_}).notEnoughRoom)&&Ui(oe.numGlyphs,q)}i?u.text.dynamicLayoutVertexBuffer.updateData(q):u.icon.dynamicLayoutVertexBuffer.updateData(q)}function Ie(u,e,i,s,l,h,f,_){const v=h.glyphStartIndex+h.numGlyphs,T=h.lineStartIndex,P=h.lineStartIndex+h.lineLength,E=e.getoffsetX(h.glyphStartIndex),k=e.getoffsetX(v-1),F=Xn(u*E,i,s,l,h.segment,T,P,_,f);if(!F)return null;const O=Xn(u*k,i,s,l,h.segment,T,P,_,f);return O?_.projectionCache.anyProjectionOccluded?null:{first:F,last:O}:null}function $e(u,e,i,s){return u===o.al.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*s?{useVertical:!0}:(u===o.al.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function et(u){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:s,fontSize:l,flip:h,keepUpright:f,glyphOffsetArray:_,dynamicLayoutVertexArray:v,aspectRatio:T,rotateToLine:P}=u,E=l/24,k=s.lineOffsetX*E,F=s.lineOffsetY*E;let O;if(s.numGlyphs>1){const H=s.glyphStartIndex+s.numGlyphs,q=s.lineStartIndex,W=s.lineStartIndex+s.lineLength,K=Ie(E,_,k,F,h,s,P,e);if(!K)return{notEnoughRoom:!0};const ee=lt(K.first.point.x,K.first.point.y,e,i),te=lt(K.last.point.x,K.last.point.y,e,i);if(f&&!h){const re=$e(s.writingMode,ee,te,T);if(re)return re}O=[K.first];for(let re=s.glyphStartIndex+1;re<H-1;re++)O.push(Xn(E*_.getoffsetX(re),k,F,h,s.segment,q,W,e,P));O.push(K.last)}else{if(f&&!h){const q=ci(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,W=s.lineStartIndex+s.segment+1,K=new o.P(e.lineVertexArray.getx(W),e.lineVertexArray.gety(W)),ee=ci(K.x,K.y,e),te=ee.signedDistanceFromCamera>0?ee.point:fr(e.tileAnchorPoint,K,q,1,e),re=lt(q.x,q.y,e,i),oe=lt(te.x,te.y,e,i),ae=$e(s.writingMode,re,oe,T);if(ae)return ae}const H=Xn(E*_.getoffsetX(s.glyphStartIndex),k,F,h,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,e,P);if(!H||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};O=[H]}for(const H of O)o.as(v,H.point,H.angle);return{}}function fr(u,e,i,s,l){const h=u.add(u.sub(e)._unit()),f=ci(h.x,h.y,l).point,_=i.sub(f);return i.add(_._mult(s/_.mag()))}function ar(u,e,i){const s=e.projectionCache;if(s.projections[u])return s.projections[u];const l=new o.P(e.lineVertexArray.getx(u),e.lineVertexArray.gety(u)),h=ci(l.x,l.y,e);if(h.signedDistanceFromCamera>0)return s.projections[u]=h.point,s.anyProjectionOccluded=s.anyProjectionOccluded||h.isOccluded,h.point;const f=u-i.direction;return fr(i.distanceFromAnchor===0?e.tileAnchorPoint:new o.P(e.lineVertexArray.getx(f),e.lineVertexArray.gety(f)),l,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,e)}function ci(u,e,i){const s=u+i.translation[0],l=e+i.translation[1];let h;return i.pitchWithMap?(h=at(s,l,i.pitchedLabelPlaneMatrix,i.getElevation),h.isOccluded=!1):(h=i.transform.projectTileCoordinates(s,l,i.unwrappedTileID,i.getElevation),h.point.x=(.5*h.point.x+.5)*i.width,h.point.y=(.5*-h.point.y+.5)*i.height),h}function lt(u,e,i,s){if(i.pitchWithMap){const l=[u,e,0,1];return o.at(l,l,s),i.transform.projectTileCoordinates(l[0]/l[3],l[1]/l[3],i.unwrappedTileID,i.getElevation).point}return{x:u/i.width*2-1,y:e/i.height*2-1}}function ws(u,e,i){return i.transform.projectTileCoordinates(u,e,i.unwrappedTileID,i.getElevation)}function _a(u,e,i){return u._unit()._perp()._mult(e*i)}function wo(u,e,i,s,l,h,f,_,v){if(_.projectionCache.offsets[u])return _.projectionCache.offsets[u];const T=i.add(e);if(u+v.direction<s||u+v.direction>=l)return _.projectionCache.offsets[u]=T,T;const P=ar(u+v.direction,_,v),E=_a(P.sub(i),f,v.direction),k=i.add(E),F=P.add(E);return _.projectionCache.offsets[u]=o.au(h,T,k,F)||T,_.projectionCache.offsets[u]}function Xn(u,e,i,s,l,h,f,_,v){const T=s?u-e:u+e;let P=T>0?1:-1,E=0;s&&(P*=-1,E=Math.PI),P<0&&(E+=Math.PI);let k,F=P>0?h+l:h+l+1;_.projectionCache.cachedAnchorPoint?k=_.projectionCache.cachedAnchorPoint:(k=ci(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=k);let O,H,q=k,W=k,K=0,ee=0;const te=Math.abs(T),re=[];let oe;for(;K+ee<=te;){if(F+=P,F<h||F>=f)return null;K+=ee,W=q,H=O;const me={absOffsetX:te,direction:P,distanceFromAnchor:K,previousVertex:W};if(q=ar(F,_,me),i===0)re.push(W),oe=q.sub(W);else{let Se;const Ce=q.sub(W);Se=Ce.mag()===0?_a(ar(F+P,_,me).sub(q),i,P):_a(Ce,i,P),H||(H=W.add(Se)),O=wo(F,Se,q,h,f,H,i,_,me),re.push(H),oe=O.sub(H)}ee=oe.mag()}const ae=oe._mult((te-K)/ee)._add(H||W),pe=E+Math.atan2(q.y-W.y,q.x-W.x);return re.push(ae),{point:ae,angle:v?pe:0,path:re}}const To=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ui(u,e){for(let i=0;i<u;i++){const s=e.length;e.resize(s+4),e.float32.set(To,3*s)}}function ei(u,e,i){const s=e[0],l=e[1];return u[0]=i[0]*s+i[4]*l+i[12],u[1]=i[1]*s+i[5]*l+i[13],u[3]=i[3]*s+i[7]*l+i[15],u}const $i=100;class Ts{constructor(e,i=new Ve(e.width+200,e.height+200,25),s=new Ve(e.width+200,e.height+200,25)){this.transform=e,this.grid=i,this.ignoredGrid=s,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+$i,this.screenBottomBoundary=e.height+$i,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,i,s,l,h,f,_,v,T,P,E,k){const F=this.projectAndGetPerspectiveRatio(e.anchorPointX+v[0],e.anchorPointY+v[1],h,P,k),O=s*F.perspectiveRatio;let H;if(f||_)H=this._projectCollisionBox(e,O,l,h,f,_,v,F,P,E,k);else{const oe=F.x+(E?E.x*O:0),ae=F.y+(E?E.y*O:0);H={allPointsOccluded:!1,box:[oe+e.x1*O,ae+e.y1*O,oe+e.x2*O,ae+e.y2*O]}}const[q,W,K,ee]=H.box,te=f?H.allPointsOccluded:F.isOccluded;let re=te;return re||(re=F.perspectiveRatio<this.perspectiveRatioCutoff),re||(re=!this.isInsideGrid(q,W,K,ee)),re||i!=="always"&&this.grid.hitTest(q,W,K,ee,i,T)?{box:[q,W,K,ee],placeable:!1,offscreen:!1,occluded:te}:{box:[q,W,K,ee],placeable:!0,offscreen:this.isOffscreen(q,W,K,ee),occluded:te}}placeCollisionCircles(e,i,s,l,h,f,_,v,T,P,E,k,F,O){const H=[],q=new o.P(i.anchorX,i.anchorY),W=this.getPerspectiveRatio(q.x,q.y,f,O),K=(T?h*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,f)/W:h*W)/o.ay,ee={getElevation:O,pitchedLabelPlaneMatrix:_,lineVertexArray:s,pitchWithMap:T,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:q,unwrappedTileID:f,width:this.transform.width,height:this.transform.height,translation:F},te=Ie(K,l,i.lineOffsetX*K,i.lineOffsetY*K,!1,i,!1,ee);let re=!1,oe=!1,ae=!0;if(te){const pe=.5*E*W+k,me=new o.P(-100,-100),Se=new o.P(this.screenRightBoundary,this.screenBottomBoundary),Ce=new ke,Te=te.first,je=te.last;let Be=[];for(let ft=Te.path.length-1;ft>=1;ft--)Be.push(Te.path[ft]);for(let ft=1;ft<je.path.length;ft++)Be.push(je.path[ft]);const Ee=2.5*pe;if(T){const ft=this.projectPathToScreenSpace(Be,ee);Be=ft.some(st=>st.signedDistanceFromCamera<=0)?[]:ft.map(st=>st.point)}let He=[];if(Be.length>0){const ft=Be[0].clone(),st=Be[0].clone();for(let ui=1;ui<Be.length;ui++)ft.x=Math.min(ft.x,Be[ui].x),ft.y=Math.min(ft.y,Be[ui].y),st.x=Math.max(st.x,Be[ui].x),st.y=Math.max(st.y,Be[ui].y);He=ft.x>=me.x&&st.x<=Se.x&&ft.y>=me.y&&st.y<=Se.y?[Be]:st.x<me.x||ft.x>Se.x||st.y<me.y||ft.y>Se.y?[]:o.av([Be],me.x,me.y,Se.x,Se.y)}for(const ft of He){Ce.reset(ft,.25*pe);let st=0;st=Ce.length<=.5*pe?1:Math.ceil(Ce.paddedLength/Ee)+1;for(let ui=0;ui<st;ui++){const Ut=ui/Math.max(st-1,1),hi=Ce.lerp(Ut),ii=hi.x+$i,Ht=hi.y+$i;H.push(ii,Ht,pe,0);const Zt=ii-pe,Gi=Ht-pe,Bi=ii+pe,Ji=Ht+pe;if(ae=ae&&this.isOffscreen(Zt,Gi,Bi,Ji),oe=oe||this.isInsideGrid(Zt,Gi,Bi,Ji),e!=="always"&&this.grid.hitTestCircle(ii,Ht,pe,e,P)&&(re=!0,!v))return{circles:[],offscreen:!1,collisionDetected:re}}}}return{circles:!v&&re||!oe||W<this.perspectiveRatioCutoff?[]:H,offscreen:ae,collisionDetected:re}}projectPathToScreenSpace(e,i){const s=function(l,h){const f=o.K();return o.an(f,h.pitchedLabelPlaneMatrix),l.map(_=>{const v=at(_.x,_.y,f,h.getElevation),T=h.transform.projectTileCoordinates(v.point.x,v.point.y,h.unwrappedTileID,h.getElevation);return T.point.x=(.5*T.point.x+.5)*h.width,T.point.y=(.5*-T.point.y+.5)*h.height,T})}(e,i);return function(l){let h=0,f=0,_=0,v=0;for(let T=0;T<l.length;T++)l[T].isOccluded?(_=T+1,v=0):(v++,v>f&&(f=v,h=_));return l.slice(h,h+f)}(s)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const i=[];let s=1/0,l=1/0,h=-1/0,f=-1/0;for(const P of e){const E=new o.P(P.x+$i,P.y+$i);s=Math.min(s,E.x),l=Math.min(l,E.y),h=Math.max(h,E.x),f=Math.max(f,E.y),i.push(E)}const _=this.grid.query(s,l,h,f).concat(this.ignoredGrid.query(s,l,h,f)),v={},T={};for(const P of _){const E=P.key;if(v[E.bucketInstanceId]===void 0&&(v[E.bucketInstanceId]={}),v[E.bucketInstanceId][E.featureIndex])continue;const k=[new o.P(P.x1,P.y1),new o.P(P.x2,P.y1),new o.P(P.x2,P.y2),new o.P(P.x1,P.y2)];o.aw(i,k)&&(v[E.bucketInstanceId][E.featureIndex]=!0,T[E.bucketInstanceId]===void 0&&(T[E.bucketInstanceId]=[]),T[E.bucketInstanceId].push(E.featureIndex))}return T}insertCollisionBox(e,i,s,l,h,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,s,l,h,f){const _=s?this.ignoredGrid:this.grid,v={bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i};for(let T=0;T<e.length;T+=4)_.insertCircle(v,e[T],e[T+1],e[T+2])}projectAndGetPerspectiveRatio(e,i,s,l,h){if(h){let f;l?(f=[e,i,l(e,i),1],o.at(f,f,h)):(f=[e,i,0,1],ei(f,f,h));const _=f[3];return{x:(f[0]/_+1)/2*this.transform.width+$i,y:(-f[1]/_+1)/2*this.transform.height+$i,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const f=this.transform.projectTileCoordinates(e,i,s,l);return{x:(f.point.x+1)/2*this.transform.width+$i,y:(1-f.point.y)/2*this.transform.height+$i,perspectiveRatio:.5+this.transform.cameraToCenterDistance/f.signedDistanceFromCamera*.5,isOccluded:f.isOccluded,signedDistanceFromCamera:f.signedDistanceFromCamera}}}getPerspectiveRatio(e,i,s,l){const h=this.transform.projectTileCoordinates(e,i,s,l);return .5+this.transform.cameraToCenterDistance/h.signedDistanceFromCamera*.5}isOffscreen(e,i,s,l){return s<$i||e>=this.screenRightBoundary||l<$i||i>this.screenBottomBoundary}isInsideGrid(e,i,s,l){return s>=0&&e<this.gridRightBoundary&&l>=0&&i<this.gridBottomBoundary}getViewportMatrix(){const e=o.ad([]);return o.L(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,s,l,h,f,_,v,T,P,E){let k=1,F=0,O=0,H=1;const q=e.anchorPointX+_[0],W=e.anchorPointY+_[1];if(f&&!h){const Be=this.projectAndGetPerspectiveRatio(q+1,W,l,T,E),Ee=Be.x-v.x,He=Math.atan((Be.y-v.y)/Ee)+(Ee<0?Math.PI:0),ft=Math.sin(He),st=Math.cos(He);k=st,F=ft,O=-ft,H=st}else if(!f&&h){const Be=Me(this.transform);k=Be.vecEast[0],F=Be.vecEast[1],O=Be.vecSouth[0],H=Be.vecSouth[1]}let K=v.x,ee=v.y,te=i;h&&(K=q,ee=W,te=Math.pow(2,-(this.transform.zoom-s.overscaledZ)),te*=this.transform.getPitchedTextCorrection(q,W,l),P||(te*=o.ae(.5+v.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),P&&(K+=k*P.x*te+O*P.y*te,ee+=F*P.x*te+H*P.y*te);const re=e.x1*te,oe=e.x2*te,ae=(re+oe)/2,pe=e.y1*te,me=e.y2*te,Se=(pe+me)/2,Ce=[{offsetX:re,offsetY:pe},{offsetX:ae,offsetY:pe},{offsetX:oe,offsetY:pe},{offsetX:oe,offsetY:Se},{offsetX:oe,offsetY:me},{offsetX:ae,offsetY:me},{offsetX:re,offsetY:me},{offsetX:re,offsetY:Se}];let Te=[];for(const{offsetX:Be,offsetY:Ee}of Ce)Te.push(new o.P(K+k*Be+O*Ee,ee+F*Be+H*Ee));let je=!1;if(h){const Be=Te.map(Ee=>this.projectAndGetPerspectiveRatio(Ee.x,Ee.y,l,T,E));je=Be.some(Ee=>!Ee.isOccluded),Te=Be.map(Ee=>new o.P(Ee.x,Ee.y))}else je=!0;return{box:o.ax(Te),allPointsOccluded:!je}}}class Mo{constructor(e,i,s,l){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):l&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class Yr{constructor(e,i,s,l,h){this.text=new Mo(e?e.text:null,i,s,h),this.icon=new Mo(e?e.icon:null,i,l,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ya{constructor(e,i,s){this.text=e,this.icon=i,this.skipFade=s}}class Qu{constructor(e,i,s,l,h){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=s,this.bucketIndex=l,this.tileID=h}}class eh{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const i=++this.maxGroupID;this.collisionGroups[e]={ID:i,predicate:s=>s.collisionGroupID===i}}return this.collisionGroups[e]}}function Wl(u,e,i,s,l){const{horizontalAlign:h,verticalAlign:f}=o.aE(u);return new o.P(-(h-.5)*e+s[0]*l,-(f-.5)*i+s[1]*l)}class Ua{constructor(e,i,s,l,h){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new Ts(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new eh(l),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=h,h&&(h.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const i=this.terrain;return i?(s,l)=>i.getElevation(e,s,l):null}getBucketParts(e,i,s,l){const h=s.getBucket(i),f=s.latestFeatureIndex;if(!h||!f||i.id!==h.layerIds[0])return;const _=s.collisionBoxArray,v=h.layers[0].layout,T=h.layers[0].paint,P=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),E=s.tileSize/o.Z,k=s.tileID.toUnwrapped(),F=v.get("text-rotation-alignment")==="map",O=o.az(s,1,this.transform.zoom),H=o.aA(this.collisionIndex.transform,s,T.get("text-translate"),T.get("text-translate-anchor")),q=o.aA(this.collisionIndex.transform,s,T.get("icon-translate"),T.get("icon-translate-anchor")),W=rt(F,this.transform,O);this.retainedQueryData[h.bucketInstanceId]=new Qu(h.bucketInstanceId,f,h.sourceLayerIndex,h.index,s.tileID);const K={bucket:h,layout:v,translationText:H,translationIcon:q,unwrappedTileID:k,pitchedLabelPlaneMatrix:W,scale:P,textPixelRatio:E,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:o.ak(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(l)for(const ee of h.sortKeyRanges){const{sortKey:te,symbolInstanceStart:re,symbolInstanceEnd:oe}=ee;e.push({sortKey:te,symbolInstanceStart:re,symbolInstanceEnd:oe,parameters:K})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:K})}attemptAnchorPlacement(e,i,s,l,h,f,_,v,T,P,E,k,F,O,H,q,W,K,ee,te){const re=o.aB[e.textAnchor],oe=[e.textOffset0,e.textOffset1],ae=Wl(re,s,l,oe,h),pe=this.collisionIndex.placeCollisionBox(i,k,v,T,P,_,f,q,E.predicate,ee,ae,te);if((!K||this.collisionIndex.placeCollisionBox(K,k,v,T,P,_,f,W,E.predicate,ee,ae,te).placeable)&&pe.placeable){let me;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(me=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:oe,width:s,height:l,anchor:re,textBoxScale:h,prevAnchor:me},this.markUsedJustification(O,re,F,H),O.allowVerticalPlacement&&(this.markUsedOrientation(O,H,F),this.placedOrientations[F.crossTileID]=H),{shift:ae,placedGlyphBoxes:pe}}}placeLayerBucketPart(e,i,s){const{bucket:l,layout:h,translationText:f,translationIcon:_,unwrappedTileID:v,pitchedLabelPlaneMatrix:T,textPixelRatio:P,holdingForFade:E,collisionBoxArray:k,partiallyEvaluatedTextSize:F,collisionGroup:O}=e.parameters,H=h.get("text-optional"),q=h.get("icon-optional"),W=o.aC(h,"text-overlap","text-allow-overlap"),K=W==="always",ee=o.aC(h,"icon-overlap","icon-allow-overlap"),te=ee==="always",re=h.get("text-rotation-alignment")==="map",oe=h.get("text-pitch-alignment")==="map",ae=h.get("icon-text-fit")!=="none",pe=h.get("symbol-z-order")==="viewport-y",me=K&&(te||!l.hasIconData()||q),Se=te&&(K||!l.hasTextData()||H);!l.collisionArrays&&k&&l.deserializeCollisionBoxes(k);const Ce=this.retainedQueryData[l.bucketInstanceId].tileID,Te=this._getTerrainElevationFunc(Ce),je=this.transform.getFastPathSimpleProjectionMatrix(Ce),Be=(Ee,He,ft)=>{var st,ui;if(i[Ee.crossTileID])return;if(E)return void(this.placements[Ee.crossTileID]=new ya(!1,!1,!1));let Ut=!1,hi=!1,ii=!0,Ht=null,Zt={box:null,placeable:!1,offscreen:null,occluded:!1},Gi={placeable:!1},Bi=null,Ji=null,lr=null,xn=0,ia=0,Rn=0;He.textFeatureIndex?xn=He.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(xn=Ee.featureIndex),He.verticalTextFeatureIndex&&(ia=He.verticalTextFeatureIndex);const Dn=He.textBox;if(Dn){const Dr=mi=>{let ri=o.al.horizontal;if(l.allowVerticalPlacement&&!mi&&this.prevPlacement){const Pi=this.prevPlacement.placedOrientations[Ee.crossTileID];Pi&&(this.placedOrientations[Ee.crossTileID]=Pi,ri=Pi,this.markUsedOrientation(l,ri,Ee))}return ri},ra=(mi,ri)=>{if(l.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&He.verticalTextBox){for(const Pi of l.writingModes)if(Pi===o.al.vertical?(Zt=ri(),Gi=Zt):Zt=mi(),Zt&&Zt.placeable)break}else Zt=mi()},Ln=Ee.textAnchorOffsetStartIndex,Bn=Ee.textAnchorOffsetEndIndex;if(Bn===Ln){const mi=(ri,Pi)=>{const di=this.collisionIndex.placeCollisionBox(ri,W,P,Ce,v,oe,re,f,O.predicate,Te,void 0,je);return di&&di.placeable&&(this.markUsedOrientation(l,Pi,Ee),this.placedOrientations[Ee.crossTileID]=Pi),di};ra(()=>mi(Dn,o.al.horizontal),()=>{const ri=He.verticalTextBox;return l.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&ri?mi(ri,o.al.vertical):{box:null,offscreen:null}}),Dr(Zt&&Zt.placeable)}else{let mi=o.aB[(ui=(st=this.prevPlacement)===null||st===void 0?void 0:st.variableOffsets[Ee.crossTileID])===null||ui===void 0?void 0:ui.anchor];const ri=(di,$h,Aa)=>{const cp=di.x2-di.x1,Gh=di.y2-di.y1,qc=Ee.textBoxScale,qh=ae&&ee==="never"?$h:null;let Lr=null,na=W==="never"?1:2,Hc="never";mi&&na++;for(let Hh=0;Hh<na;Hh++){for(let Js=Ln;Js<Bn;Js++){const Wc=l.textAnchorOffsets.get(Js);if(mi&&Wc.textAnchor!==mi)continue;const Xc=this.attemptAnchorPlacement(Wc,di,cp,Gh,qc,re,oe,P,Ce,v,O,Hc,Ee,l,Aa,f,_,qh,Te);if(Xc&&(Lr=Xc.placedGlyphBoxes,Lr&&Lr.placeable))return Ut=!0,Ht=Xc.shift,Lr}mi?mi=null:Hc=W}return s&&!Lr&&(Lr={box:this.collisionIndex.placeCollisionBox(Dn,"always",P,Ce,v,oe,re,f,O.predicate,Te,void 0,je).box,offscreen:!1,placeable:!1,occluded:!1}),Lr};ra(()=>ri(Dn,He.iconBox,o.al.horizontal),()=>{const di=He.verticalTextBox;return l.allowVerticalPlacement&&(!Zt||!Zt.placeable)&&Ee.numVerticalGlyphVertices>0&&di?ri(di,He.verticalIconBox,o.al.vertical):{box:null,occluded:!0,offscreen:null}}),Zt&&(Ut=Zt.placeable,ii=Zt.offscreen);const Pi=Dr(Zt&&Zt.placeable);if(!Ut&&this.prevPlacement){const di=this.prevPlacement.variableOffsets[Ee.crossTileID];di&&(this.variableOffsets[Ee.crossTileID]=di,this.markUsedJustification(l,di.anchor,Ee,Pi))}}}if(Bi=Zt,Ut=Bi&&Bi.placeable,ii=Bi&&Bi.offscreen,Ee.useRuntimeCollisionCircles){const Dr=l.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),ra=o.am(l.textSizeData,F,Dr),Ln=h.get("text-padding");Ji=this.collisionIndex.placeCollisionCircles(W,Dr,l.lineVertexArray,l.glyphOffsetArray,ra,v,T,s,oe,O.predicate,Ee.collisionCircleDiameter,Ln,f,Te),Ji.circles.length&&Ji.collisionDetected&&!s&&o.w("Collisions detected, but collision boxes are not shown"),Ut=K||Ji.circles.length>0&&!Ji.collisionDetected,ii=ii&&Ji.offscreen}if(He.iconFeatureIndex&&(Rn=He.iconFeatureIndex),He.iconBox){const Dr=ra=>this.collisionIndex.placeCollisionBox(ra,ee,P,Ce,v,oe,re,_,O.predicate,Te,ae&&Ht?Ht:void 0,je);Gi&&Gi.placeable&&He.verticalIconBox?(lr=Dr(He.verticalIconBox),hi=lr.placeable):(lr=Dr(He.iconBox),hi=lr.placeable),ii=ii&&lr.offscreen}const vn=H||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,ka=q||Ee.numIconVertices===0;vn||ka?ka?vn||(hi=hi&&Ut):Ut=hi&&Ut:hi=Ut=hi&&Ut;const za=hi&&lr.placeable;if(Ut&&Bi.placeable&&this.collisionIndex.insertCollisionBox(Bi.box,W,h.get("text-ignore-placement"),l.bucketInstanceId,Gi&&Gi.placeable&&ia?ia:xn,O.ID),za&&this.collisionIndex.insertCollisionBox(lr.box,ee,h.get("icon-ignore-placement"),l.bucketInstanceId,Rn,O.ID),Ji&&Ut&&this.collisionIndex.insertCollisionCircles(Ji.circles,W,h.get("text-ignore-placement"),l.bucketInstanceId,xn,O.ID),s&&this.storeCollisionData(l.bucketInstanceId,ft,He,Bi,lr,Ji),Ee.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(l.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ee.crossTileID]=new ya((Ut||me)&&!(Bi!=null&&Bi.occluded),(hi||Se)&&!(lr!=null&&lr.occluded),ii||l.justReloaded),i[Ee.crossTileID]=!0};if(pe){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ee=l.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let He=Ee.length-1;He>=0;--He){const ft=Ee[He];Be(l.symbolInstances.get(ft),l.collisionArrays[ft],ft)}}else for(let Ee=e.symbolInstanceStart;Ee<e.symbolInstanceEnd;Ee++)Be(l.symbolInstances.get(Ee),l.collisionArrays[Ee],Ee);l.justReloaded=!1}storeCollisionData(e,i,s,l,h,f){if(s.textBox||s.iconBox){let _,v;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(i)?v=_.get(i):(v={text:null,icon:null},_.set(i,v)),s.textBox&&(v.text=l.box),s.iconBox&&(v.icon=h.box)}if(f){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=[]);for(let v=0;v<f.circles.length;v+=4)_.push(f.circles[v+0]-$i),_.push(f.circles[v+1]-$i),_.push(f.circles[v+2]),_.push(f.collisionDetected?1:0)}}markUsedJustification(e,i,s,l){let h;h=l===o.al.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[o.aD(i)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=h>=0&&_!==h?0:s.crossTileID)}markUsedOrientation(e,i,s){const l=i===o.al.horizontal||i===o.al.horizontalOnly?i:0,h=i===o.al.vertical?i:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)e.text.placedSymbolArray.get(_).placedOrientation=l;s.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const i=this.prevPlacement;let s=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;const l=i?i.symbolFadeChange(e):1,h=i?i.opacities:{},f=i?i.variableOffsets:{},_=i?i.placedOrientations:{};for(const v in this.placements){const T=this.placements[v],P=h[v];P?(this.opacities[v]=new Yr(P,l,T.text,T.icon),s=s||T.text!==P.text.placed||T.icon!==P.icon.placed):(this.opacities[v]=new Yr(null,l,T.text,T.icon,T.skipFade),s=s||T.text||T.icon)}for(const v in h){const T=h[v];if(!this.opacities[v]){const P=new Yr(T,l,!1,!1);P.isHidden()||(this.opacities[v]=P,s=s||T.text.placed||T.icon.placed)}}for(const v in f)this.variableOffsets[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.variableOffsets[v]=f[v]);for(const v in _)this.placedOrientations[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.placedOrientations[v]=_[v]);if(i&&i.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i){const s={};for(const l of i){const h=l.getBucket(e);h&&l.latestFeatureIndex&&e.id===h.layerIds[0]&&this.updateBucketOpacities(h,l.tileID,s,l.collisionBoxArray)}}updateBucketOpacities(e,i,s,l){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const h=e.layers[0],f=h.layout,_=new Yr(null,0,!1,!1,!0),v=f.get("text-allow-overlap"),T=f.get("icon-allow-overlap"),P=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=f.get("text-rotation-alignment")==="map",k=f.get("text-pitch-alignment")==="map",F=f.get("icon-text-fit")!=="none",O=new Yr(null,0,v&&(T||!e.hasIconData()||f.get("icon-optional")),T&&(v||!e.hasTextData()||f.get("text-optional")),!0);!e.collisionArrays&&l&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(l);const H=(W,K,ee)=>{for(let te=0;te<K/4;te++)W.opacityVertexArray.emplaceBack(ee);W.hasVisibleVertices=W.hasVisibleVertices||ee!==xa},q=this.collisionBoxArrays.get(e.bucketInstanceId);for(let W=0;W<e.symbolInstances.length;W++){const K=e.symbolInstances.get(W),{numHorizontalGlyphVertices:ee,numVerticalGlyphVertices:te,crossTileID:re}=K;let oe=this.opacities[re];s[re]?oe=_:oe||(oe=O,this.opacities[re]=oe),s[re]=!0;const ae=K.numIconVertices>0,pe=this.placedOrientations[K.crossTileID],me=pe===o.al.vertical,Se=pe===o.al.horizontal||pe===o.al.horizontalOnly;if(ee>0||te>0){const Te=Jl(oe.text);H(e.text,ee,me?xa:Te),H(e.text,te,Se?xa:Te);const je=oe.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach(He=>{He>=0&&(e.text.placedSymbolArray.get(He).hidden=je||me?1:0)}),K.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=je||Se?1:0);const Be=this.variableOffsets[K.crossTileID];Be&&this.markUsedJustification(e,Be.anchor,K,pe);const Ee=this.placedOrientations[K.crossTileID];Ee&&(this.markUsedJustification(e,"left",K,Ee),this.markUsedOrientation(e,Ee,K))}if(ae){const Te=Jl(oe.icon),je=!(F&&K.verticalPlacedIconSymbolIndex&&me);K.placedIconSymbolIndex>=0&&(H(e.icon,K.numIconVertices,je?Te:xa),e.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=oe.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(H(e.icon,K.numVerticalIconVertices,je?xa:Te),e.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=oe.icon.isHidden())}const Ce=q&&q.has(W)?q.get(W):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const Te=e.collisionArrays[W];if(Te){let je=new o.P(0,0);if(Te.textBox||Te.verticalTextBox){let Be=!0;if(P){const Ee=this.variableOffsets[re];Ee?(je=Wl(Ee.anchor,Ee.width,Ee.height,Ee.textOffset,Ee.textBoxScale),E&&je._rotate(k?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Be=!1}if(Te.textBox||Te.verticalTextBox){let Ee;Te.textBox&&(Ee=me),Te.verticalTextBox&&(Ee=Se),Xl(e.textCollisionBox.collisionVertexArray,oe.text.placed,!Be||Ee,Ce.text,je.x,je.y)}}if(Te.iconBox||Te.verticalIconBox){const Be=!!(!Se&&Te.verticalIconBox);let Ee;Te.iconBox&&(Ee=Be),Te.verticalIconBox&&(Ee=!Be),Xl(e.iconCollisionBox.collisionVertexArray,oe.icon.placed,Ee,Ce.icon,F?je.x:0,F?je.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,i){const s=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*s>e}setStale(){this.stale=!0}}function Xl(u,e,i,s,l,h){s&&s.length!==0||(s=[0,0,0,0]);const f=s[0]-$i,_=s[1]-$i,v=s[2]-$i,T=s[3]-$i;u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,v,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,v,T),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,T)}const Zd=Math.pow(2,25),Vd=Math.pow(2,24),Ud=Math.pow(2,17),th=Math.pow(2,16),ih=Math.pow(2,9),Kl=Math.pow(2,8),Yl=Math.pow(2,1);function Jl(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const e=u.placed?1:0,i=Math.floor(127*u.opacity);return i*Zd+e*Vd+i*Ud+e*th+i*ih+e*Kl+i*Yl+e}const xa=0;class Ql{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,i,s,l,h){const f=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(f,l,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,h())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,v)=>_.sortKey-v.sortKey));this._currentPartIndex<f.length;)if(i.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,h())return!0;return!1}}class So{constructor(e,i,s,l,h,f,_,v){this.placement=new Ua(e,i,f,_,v),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(e,i,s){const l=ve.now(),h=()=>!this._forceFullPlacement&&ve.now()-l>2;for(;this._currentPlacementIndex>=0;){const f=i[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new Ql(f)),this._inProgressLayer.continuePlacement(s[f.source],this.placement,this._showCollisionBoxes,f,h))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const $a=512/o.Z/2;class Ga{constructor(e,i,s){this.tileID=e,this.bucketInstanceId=s,this._symbolsByKey={};const l=new Map;for(let h=0;h<i.length;h++){const f=i.get(h),_=f.key,v=l.get(_);v?v.push(f):l.set(_,[f])}for(const[h,f]of l){const _={positions:f.map(v=>({x:Math.floor(v.anchorX*$a),y:Math.floor(v.anchorY*$a)})),crossTileIDs:f.map(v=>v.crossTileID)};if(_.positions.length>128){const v=new o.aF(_.positions.length,16,Uint16Array);for(const{x:T,y:P}of _.positions)v.add(T,P);v.finish(),delete _.positions,_.index=v}this._symbolsByKey[h]=_}}getScaledCoordinates(e,i){const{x:s,y:l,z:h}=this.tileID.canonical,{x:f,y:_,z:v}=i.canonical,T=$a/Math.pow(2,v-h),P=(_*o.Z+e.anchorY)*T,E=l*o.Z*$a;return{x:Math.floor((f*o.Z+e.anchorX)*T-s*o.Z*$a),y:Math.floor(P-E)}}findMatches(e,i,s){const l=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z);for(let h=0;h<e.length;h++){const f=e.get(h);if(f.crossTileID)continue;const _=this._symbolsByKey[f.key];if(!_)continue;const v=this.getScaledCoordinates(f,i);if(_.index){const T=_.index.range(v.x-l,v.y-l,v.x+l,v.y+l).sort();for(const P of T){const E=_.crossTileIDs[P];if(!s[E]){s[E]=!0,f.crossTileID=E;break}}}else if(_.positions)for(let T=0;T<_.positions.length;T++){const P=_.positions[T],E=_.crossTileIDs[T];if(Math.abs(P.x-v.x)<=l&&Math.abs(P.y-v.y)<=l&&!s[E]){s[E]=!0,f.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class rh{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class $d{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const i=Math.round((e-this.lng)/360);if(i!==0)for(const s in this.indexes){const l=this.indexes[s],h={};for(const f in l){const _=l[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+i),h[_.tileID.key]=_}this.indexes[s]=h}this.lng=e}addBucket(e,i,s){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let h=0;h<i.symbolInstances.length;h++)i.symbolInstances.get(h).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const l=this.usedCrossTileIDs[e.overscaledZ];for(const h in this.indexes){const f=this.indexes[h];if(Number(h)>e.overscaledZ)for(const _ in f){const v=f[_];v.tileID.isChildOf(e)&&v.findMatches(i.symbolInstances,e,l)}else{const _=f[e.scaledTo(Number(h)).key];_&&_.findMatches(i.symbolInstances,e,l)}}for(let h=0;h<i.symbolInstances.length;h++){const f=i.symbolInstances.get(h);f.crossTileID||(f.crossTileID=s.generate(),l[f.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Ga(e,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(e,i){for(const s of i.getCrossTileIDsLists())for(const l of s)delete this.usedCrossTileIDs[e][l]}removeStaleBuckets(e){let i=!1;for(const s in this.indexes){const l=this.indexes[s];for(const h in l)e[l[h].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,l[h]),delete l[h],i=!0)}return i}}class In{constructor(){this.layerIndexes={},this.crossTileIDs=new rh,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,s){let l=this.layerIndexes[e.id];l===void 0&&(l=this.layerIndexes[e.id]=new $d);let h=!1;const f={};l.handleWrapJump(s);for(const _ of i){const v=_.getBucket(e);v&&e.id===v.layerIds[0]&&(v.bucketInstanceId||(v.bucketInstanceId=++this.maxBucketInstanceId),l.addBucket(_.tileID,v,this.crossTileIDs)&&(h=!0),f[v.bucketInstanceId]=!0)}return l.removeStaleBuckets(f)&&(h=!0),h}pruneUnusedLayers(e){const i={};e.forEach(s=>{i[s]=!0});for(const s in this.layerIndexes)i[s]||delete this.layerIndexes[s]}}var qa="void main() {fragColor=vec4(1.0);}";const gt={prelude:St(`#ifdef GL_ES
5
+ */var Cy=Vu.exports,Yf;function Iy(){return Yf||(Yf=1,function(y,m){(function(b,I){y.exports=I()})(Cy,function(){var b={},I={};function z(S,o,le){if(I[S]=le,S==="index"){var he="var sharedModule = {}; ("+I.shared+")(sharedModule); ("+I.worker+")(sharedModule);",_e={};return I.shared(_e),I.index(b,_e),typeof window<"u"&&b.setWorkerUrl(window.URL.createObjectURL(new Blob([he],{type:"text/javascript"}))),b}}z("shared",["exports"],function(S){function o(r,t,n,a){return new(n||(n=Promise))(function(c,d){function p(w){try{x(a.next(w))}catch(M){d(M)}}function g(w){try{x(a.throw(w))}catch(M){d(M)}}function x(w){var M;w.done?c(w.value):(M=w.value,M instanceof n?M:new n(function(C){C(M)})).then(p,g)}x((a=a.apply(r,t||[])).next())})}function le(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var he,_e;function Re(){if(_e)return he;function r(t,n){this.x=t,this.y=n}return _e=1,he=r,r.prototype={clone:function(){return new r(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,n){return this.clone()._rotateAround(t,n)},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 n=t.x-this.x,a=t.y-this.y;return n*n+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,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},_matMult:function(t){var n=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=n,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 n=Math.cos(t),a=Math.sin(t),c=a*this.x+n*this.y;return this.x=n*this.x-a*this.y,this.y=c,this},_rotateAround:function(t,n){var a=Math.cos(t),c=Math.sin(t),d=n.y+c*(this.x-n.x)+a*(this.y-n.y);return this.x=n.x+a*(this.x-n.x)-c*(this.y-n.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t},he}typeof SuppressedError=="function"&&SuppressedError;var ve,ne,De=le(Re()),_t=function(){if(ne)return ve;function r(t,n,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=a,this.p2y=c}return ne=1,ve=r,r.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,n){if(n===void 0&&(n=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)<n)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var g=0,x=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<n));c++)t>d?g=a:x=a,a=.5*(x-g)+g;return a},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}},ve}(),Rt=le(_t);let yt,Dt;function Jt(){return yt==null&&(yt=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),yt}function Xt(){if(Dt==null&&(Dt=!1,Jt())){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 n=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&n[a]!==a){Dt=!0;break}}}return Dt||!1}var Et=1e-6,Bt=typeof Float32Array<"u"?Float32Array:Array;function Ri(){var r=new Bt(9);return Bt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function jt(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function xr(){var r=new Bt(3);return Bt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function cn(r){return Math.hypot(r[0],r[1],r[2])}function Vr(r,t,n){var a=new Bt(3);return a[0]=r,a[1]=t,a[2]=n,a}Math.hypot||(Math.hypot=function(){for(var r=0,t=arguments.length;t--;)r+=arguments[t]*arguments[t];return Math.sqrt(r)});var mt,_i=cn;function li(r,t,n){var a=t[0],c=t[1],d=t[2],p=t[3];return r[0]=n[0]*a+n[4]*c+n[8]*d+n[12]*p,r[1]=n[1]*a+n[5]*c+n[9]*d+n[13]*p,r[2]=n[2]*a+n[6]*c+n[10]*d+n[14]*p,r[3]=n[3]*a+n[7]*c+n[11]*d+n[15]*p,r}function Ni(){var r=new Bt(4);return Bt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function vr(){var r=new Bt(2);return Bt!=Float32Array&&(r[0]=0,r[1]=0),r}function un(r,t){var n=new Bt(2);return n[0]=r,n[1]=t,n}xr(),mt=new Bt(4),Bt!=Float32Array&&(mt[0]=0,mt[1]=0,mt[2]=0,mt[3]=0),xr(),Vr(1,0,0),Vr(0,1,0),Ni(),Ni(),Ri(),vr();const Ft=8192;function zr(r,t,n){return t*(Ft/(r.tileSize*Math.pow(2,n-r.tileID.overscaledZ)))}function Ar(r,t){return(r%t+t)%t}function Hn(r,t,n){return r*(1-n)+t*n}function yi(r){if(r<=0)return 0;if(r>=1)return 1;const t=r*r,n=t*r;return 4*(r<.5?n:3*(r-t)+n-.75)}function Pn(r,t,n,a){const c=new Rt(r,t,n,a);return d=>c.solve(d)}const ir=Pn(.25,.1,.25,1);function Ti(r,t,n){return Math.min(n,Math.max(t,r))}function hn(r,t,n){const a=n-t,c=((r-t)%a+a)%a+t;return c===t?n:c}function hr(r,...t){for(const n of t)for(const a in n)r[a]=n[a];return r}let Wn=1;function Cn(r,t,n){const a={};for(const c in r)a[c]=t.call(this,r[c],c,r);return a}function ga(r,t,n){const a={};for(const c in r)t.call(this,r[c],c,r)&&(a[c]=r[c]);return a}function dr(r){return Array.isArray(r)?r.map(dr):typeof r=="object"&&r?Cn(r,dr):r}const Ki={};function Zi(r){Ki[r]||(typeof console<"u"&&console.warn(r),Ki[r]=!0)}function Wt(r,t,n){return(n.y-r.y)*(t.x-r.x)>(t.y-r.y)*(n.x-r.x)}function rr(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let br=null;function Vi(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const Xr="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function Kr(r,t,n,a,c){return o(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(r,{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 g=p.startsWith("BGR"),x=new Uint8ClampedArray(a*c*4);if(yield d.copyTo(x,function(w,M,C,A,L){const B=4*Math.max(1,0),j=(Math.max(0,C)-C)*A*4+B,$=4*A,X=Math.max(0,M),se=Math.max(0,C);return{rect:{x:X,y:se,width:Math.min(w.width,M+A)-X,height:Math.min(w.height,C+L)-se},layout:[{offset:j,stride:$}]}}(r,t,n,a,c)),g)for(let w=0;w<x.length;w+=4){const M=x[w];x[w]=x[w+2],x[w+2]=M}return x}finally{d.close()}})}let Di,nr;function Ze(r,t,n,a){return r.addEventListener(t,n,a),{unsubscribe:()=>{r.removeEventListener(t,n,a)}}}function Xe(r){return r/Math.PI*180}const bt={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Kt={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},fi="AbortError";function kt(){return new Error(fi)}const ut={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Gt(r){return ut.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const qt="global-dispatcher";class Li extends Error{constructor(t,n,a,c){super(`AJAXError: ${n} (${t}): ${a}`),this.status=t,this.statusText=n,this.url=a,this.body=c}}const Yt=()=>rr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Mi=function(r,t){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const a=Gt(r.url);if(a)return a(r,t);if(rr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:qt},t)}if(!(/^file:/.test(n=r.url)||/^file:/.test(Yt())&&!/^\w+:/.test(n))){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:Yt(),signal:c.signal});let p,g;a.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{p=yield fetch(d)}catch(w){throw new Li(0,w.message,a.url,new Blob)}if(!p.ok){const w=yield p.blob();throw new Li(p.status,p.statusText,a.url,w)}g=a.type==="arrayBuffer"||a.type==="image"?p.arrayBuffer():a.type==="json"?p.json():p.text();const x=yield g;if(c.signal.aborted)throw kt();return{data:x,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(r,t);if(rr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:qt},t)}var n;return function(a,c){return new Promise((d,p)=>{var g;const x=new XMLHttpRequest;x.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(x.responseType="arraybuffer");for(const w in a.headers)x.setRequestHeader(w,a.headers[w]);a.type==="json"&&(x.responseType="text",!((g=a.headers)===null||g===void 0)&&g.Accept||x.setRequestHeader("Accept","application/json")),x.withCredentials=a.credentials==="include",x.onerror=()=>{p(new Error(x.statusText))},x.onload=()=>{if(!c.signal.aborted)if((x.status>=200&&x.status<300||x.status===0)&&x.response!==null){let w=x.response;if(a.type==="json")try{w=JSON.parse(x.response)}catch(M){return void p(M)}d({data:w,cacheControl:x.getResponseHeader("Cache-Control"),expires:x.getResponseHeader("Expires")})}else{const w=new Blob([x.response],{type:x.getResponseHeader("Content-Type")});p(new Li(x.status,x.statusText,a.url,w))}},c.signal.addEventListener("abort",()=>{x.abort(),p(kt())}),x.send(a.body)})}(r,t)};function pr(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const t=new URL(r),n=window.location;return t.protocol===n.protocol&&t.host===n.host}function ue(r,t,n){n[r]&&n[r].indexOf(t)!==-1||(n[r]=n[r]||[],n[r].push(t))}function N(r,t,n){if(n&&n[r]){const a=n[r].indexOf(t);a!==-1&&n[r].splice(a,1)}}class Z{constructor(t,n={}){hr(this,n),this.type=t}}class G extends Z{constructor(t,n={}){super("error",hr({error:t},n))}}class J{on(t,n){return this._listeners=this._listeners||{},ue(t,n,this._listeners),{unsubscribe:()=>{this.off(t,n)}}}off(t,n){return N(t,n,this._listeners),N(t,n,this._oneTimeListeners),this}once(t,n){return n?(this._oneTimeListeners=this._oneTimeListeners||{},ue(t,n,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,n){typeof t=="string"&&(t=new Z(t,n||{}));const a=t.type;if(this.listens(a)){t.target=this;const c=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const g of c)g.call(this,t);const d=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const g of d)N(a,g,this._oneTimeListeners),g.call(this,t);const p=this._eventedParent;p&&(hr(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof G&&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,n){return this._eventedParent=t,this._eventedParentData=n,this}}var V={$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"},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:"number",default:335,minimum:0,maximum:359,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:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",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"}},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 ce=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ge(r,t){const n={};for(const a in r)a!=="ref"&&(n[a]=r[a]);return ce.forEach(a=>{a in t&&(n[a]=t[a])}),n}function ie(r,t){if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!ie(r[n],t[n]))return!1;return!0}if(typeof r=="object"&&r!==null&&t!==null){if(typeof t!="object"||Object.keys(r).length!==Object.keys(t).length)return!1;for(const n in r)if(!ie(r[n],t[n]))return!1;return!0}return r===t}function ye(r,t){r.push(t)}function be(r,t,n){ye(n,{command:"addSource",args:[r,t[r]]})}function de(r,t,n){ye(t,{command:"removeSource",args:[r]}),n[r]=!0}function ke(r,t,n,a){de(r,n,a),be(r,t,n)}function Ne(r,t,n){let a;for(a in r[n])if(Object.prototype.hasOwnProperty.call(r[n],a)&&a!=="data"&&!ie(r[n][a],t[n][a]))return!1;for(a in t[n])if(Object.prototype.hasOwnProperty.call(t[n],a)&&a!=="data"&&!ie(r[n][a],t[n][a]))return!1;return!0}function Ve(r,t,n,a,c,d){r=r||{},t=t||{};for(const p in r)Object.prototype.hasOwnProperty.call(r,p)&&(ie(r[p],t[p])||n.push({command:d,args:[a,p,t[p],c]}));for(const p in t)Object.prototype.hasOwnProperty.call(t,p)&&!Object.prototype.hasOwnProperty.call(r,p)&&(ie(r[p],t[p])||n.push({command:d,args:[a,p,t[p],c]}))}function rt(r){return r.id}function dt(r,t){return r[t.id]=t,r}class Me{constructor(t,n,a,c){this.message=(t?`${t}: `:"")+a,c&&(this.identifier=c),n!=null&&n.__line__&&(this.line=n.__line__)}}function at(r,...t){for(const n of t)for(const a in n)r[a]=n[a];return r}class Ct extends Error{constructor(t,n){super(n),this.message=n,this.key=t}}class Vt{constructor(t,n=[]){this.parent=t,this.bindings={};for(const[a,c]of n)this.bindings[a]=c}concat(t){return new Vt(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 It={kind:"null"},Ie={kind:"number"},$e={kind:"string"},et={kind:"boolean"},fr={kind:"color"},ar={kind:"projectionDefinition"},ci={kind:"object"},lt={kind:"value"},ws={kind:"collator"},_a={kind:"formatted"},wo={kind:"padding"},Xn={kind:"resolvedImage"},To={kind:"variableAnchorOffsetCollection"};function Ui(r,t){return{kind:"array",itemType:r,N:t}}function ei(r){if(r.kind==="array"){const t=ei(r.itemType);return typeof r.N=="number"?`array<${t}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${t}>`}return r.kind}const $i=[It,Ie,$e,et,fr,ar,_a,ci,Ui(lt),wo,Xn,To];function Ts(r,t){if(t.kind==="error")return null;if(r.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Ts(r.itemType,t.itemType))&&(typeof r.N!="number"||r.N===t.N))return null}else{if(r.kind===t.kind)return null;if(r.kind==="value"){for(const n of $i)if(!Ts(n,t))return null}}return`Expected ${ei(r)} but found ${ei(t)} instead.`}function Mo(r,t){return t.some(n=>n.kind===r.kind)}function Yr(r,t){return t.some(n=>n==="null"?r===null:n==="array"?Array.isArray(r):n==="object"?r&&!Array.isArray(r)&&typeof r=="object":n===typeof r)}function ya(r,t){return r.kind==="array"&&t.kind==="array"?r.itemType.kind===t.itemType.kind&&typeof r.N=="number":r.kind===t.kind}const Qu=.96422,eh=.82521,Wl=4/29,Ua=6/29,Xl=3*Ua*Ua,Zd=Ua*Ua*Ua,Vd=Math.PI/180,Ud=180/Math.PI;function th(r){return(r%=360)<0&&(r+=360),r}function ih([r,t,n,a]){let c,d;const p=Yl((.2225045*(r=Kl(r))+.7168786*(t=Kl(t))+.0606169*(n=Kl(n)))/1);r===t&&t===n?c=d=p:(c=Yl((.4360747*r+.3850649*t+.1430804*n)/Qu),d=Yl((.0139322*r+.0971045*t+.7141733*n)/eh));const g=116*p-16;return[g<0?0:g,500*(c-p),200*(p-d),a]}function Kl(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Yl(r){return r>Zd?Math.pow(r,1/3):r/Xl+Wl}function Jl([r,t,n,a]){let c=(r+16)/116,d=isNaN(t)?c:c+t/500,p=isNaN(n)?c:c-n/200;return c=1*Ql(c),d=Qu*Ql(d),p=eh*Ql(p),[xa(3.1338561*d-1.6168667*c-.4906146*p),xa(-.9787684*d+1.9161415*c+.033454*p),xa(.0719453*d-.2289914*c+1.4052427*p),a]}function xa(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function Ql(r){return r>Ua?r*r*r:Xl*(r-Wl)}function So(r){return parseInt(r.padEnd(2,r),16)/255}function $a(r,t){return Ga(t?r/100:r,0,1)}function Ga(r,t,n){return Math.min(Math.max(t,r),n)}function rh(r){return!r.some(Number.isNaN)}const $d={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 In(r,t,n){return r+n*(t-r)}function qa(r,t,n){return r.map((a,c)=>In(a,t[c],n))}class gt{constructor(t,n,a,c=1,d=!0){this.r=t,this.g=n,this.b=a,this.a=c,d||(this.r*=c,this.g*=c,this.b*=c,c||this.overwriteGetter("rgb",[t,n,a,c]))}static parse(t){if(t instanceof gt)return t;if(typeof t!="string")return;const n=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const c=$d[a];if(c){const[p,g,x]=c;return[p/255,g/255,x/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 g=1;return[So(a.slice(g,g+=p)),So(a.slice(g,g+=p)),So(a.slice(g,g+=p)),So(a.slice(g,g+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[g,x,w,M,C,A,L,B,j,$,X,se]=p,Y=[M||" ",L||" ",$].join("");if(Y===" "||Y===" /"||Y===",,"||Y===",,,"){const R=[w,A,j].join(""),U=R==="%%%"?100:R===""?255:0;if(U){const Q=[Ga(+x/U,0,1),Ga(+C/U,0,1),Ga(+B/U,0,1),X?$a(+X,se):1];if(rh(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,g,x,w,M,C,A,L,B]=d,j=[x||" ",M||" ",A].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const $=[+g,Ga(+w,0,100),Ga(+C,0,100),L?$a(+L,B):1];if(rh($))return function([X,se,Y,R]){function U(Q){const fe=(Q+X/30)%12,ze=se*Math.min(Y,1-Y);return Y-ze*Math.max(-1,Math.min(fe-3,9-fe,1))}return X=th(X),se/=100,Y/=100,[U(0),U(8),U(4),R]}($)}}}(t);return n?new gt(...n,!1):void 0}get rgb(){const{r:t,g:n,b:a,a:c}=this,d=c||1/0;return this.overwriteGetter("rgb",[t/d,n/d,a/d,c])}get hcl(){return this.overwriteGetter("hcl",function(t){const[n,a,c,d]=ih(t),p=Math.sqrt(a*a+c*c);return[Math.round(1e4*p)?th(Math.atan2(c,a)*Ud):NaN,p,n,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",ih(this.rgb))}overwriteGetter(t,n){return Object.defineProperty(this,t,{value:n}),n}toString(){const[t,n,a,c]=this.rgb;return`rgba(${[t,n,a].map(d=>Math.round(255*d)).join(",")},${c})`}static interpolate(t,n,a,c="rgb"){switch(c){case"rgb":{const[d,p,g,x]=qa(t.rgb,n.rgb,a);return new gt(d,p,g,x,!1)}case"hcl":{const[d,p,g,x]=t.hcl,[w,M,C,A]=n.hcl;let L,B;if(isNaN(d)||isNaN(w))isNaN(d)?isNaN(w)?L=NaN:(L=w,g!==1&&g!==0||(B=M)):(L=d,C!==1&&C!==0||(B=p));else{let Y=w-d;w>d&&Y>180?Y-=360:w<d&&d-w>180&&(Y+=360),L=d+a*Y}const[j,$,X,se]=function([Y,R,U,Q]){return Y=isNaN(Y)?0:Y*Vd,Jl([U,Math.cos(Y)*R,Math.sin(Y)*R,Q])}([L,B??In(p,M,a),In(g,C,a),In(x,A,a)]);return new gt(j,$,X,se,!1)}case"lab":{const[d,p,g,x]=Jl(qa(t.lab,n.lab,a));return new gt(d,p,g,x,!1)}}}}gt.black=new gt(0,0,0,1),gt.white=new gt(1,1,1,1),gt.transparent=new gt(0,0,0,0),gt.red=new gt(1,0,0,1);class St{constructor(t,n,a){this.sensitivity=t?n?"variant":"case":n?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,n){return this.collator.compare(t,n)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const Ha=["bottom","center","top"];class dn{constructor(t,n,a,c,d,p){this.text=t,this.image=n,this.scale=a,this.fontStack=c,this.textColor=d,this.verticalAlign=p}}class wr{constructor(t){this.sections=t}static fromString(t){return new wr([new dn(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 wr?t:wr.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class sr{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof sr)return t;if(typeof t=="number")return new sr([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const n of t)if(typeof n!="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 sr(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,a){return new sr(qa(t.values,n.values,a))}}class xi{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const Ms=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Yi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Yi)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let n=0;n<t.length;n+=2){const a=t[n],c=t[n+1];if(typeof a!="string"||!Ms.has(a)||!Array.isArray(c)||c.length!==2||typeof c[0]!="number"||typeof c[1]!="number")return}return new Yi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,a){const c=t.values,d=n.values;if(c.length!==d.length)throw new xi(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${n.toString()}`);const p=[];for(let g=0;g<c.length;g+=2){if(c[g]!==d[g])throw new xi(`Cannot interpolate values containing mismatched anchors. from[${g}]: ${c[g]}, to[${g}]: ${d[g]}`);p.push(c[g]);const[x,w]=c[g+1],[M,C]=d[g+1];p.push([In(x,M,a),In(w,C,a)])}return new Yi(p)}}class Rr{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Rr({name:t,available:!1}):null}}class mr{constructor(t,n,a){this.from=t,this.to=n,this.transition=a}static interpolate(t,n,a){return new mr(t,n,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 Kn(r,t,n,a){return typeof r=="number"&&r>=0&&r<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof n=="number"&&n>=0&&n<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[r,t,n,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[r,t,n,a]:[r,t,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function Ss(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof mr||r instanceof gt||r instanceof St||r instanceof wr||r instanceof sr||r instanceof Yi||r instanceof Rr)return!0;if(Array.isArray(r)){for(const t of r)if(!Ss(t))return!1;return!0}if(typeof r=="object"){for(const t in r)if(!Ss(r[t]))return!1;return!0}return!1}function vi(r){if(r===null)return It;if(typeof r=="string")return $e;if(typeof r=="boolean")return et;if(typeof r=="number")return Ie;if(r instanceof gt)return fr;if(r instanceof mr)return ar;if(r instanceof St)return ws;if(r instanceof wr)return _a;if(r instanceof sr)return wo;if(r instanceof Yi)return To;if(r instanceof Rr)return Xn;if(Array.isArray(r)){const t=r.length;let n;for(const a of r){const c=vi(a);if(n){if(n===c)continue;n=lt;break}n=c}return Ui(n||lt,t)}return ci}function pn(r){const t=typeof r;return r===null?"":t==="string"||t==="number"||t==="boolean"?String(r):r instanceof gt||r instanceof mr||r instanceof wr||r instanceof sr||r instanceof Yi||r instanceof Rr?r.toString():JSON.stringify(r)}class Yn{constructor(t,n){this.type=t,this.value=n}static parse(t,n){if(t.length!==2)return n.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!Ss(t[1]))return n.error("invalid value");const a=t[1];let c=vi(a);const d=n.expectedType;return c.kind!=="array"||c.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(c=d),new Yn(c,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Ps={string:$e,number:Ie,boolean:et,object:ci};class Ur{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let a,c=1;const d=t[0];if(d==="array"){let g,x;if(t.length>2){const w=t[1];if(typeof w!="string"||!(w in Ps)||w==="object")return n.error('The item type argument of "array" must be one of string, number, boolean',1);g=Ps[w],c++}else g=lt;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return n.error('The length argument to "array" must be a positive integer literal',2);x=t[2],c++}a=Ui(g,x)}else{if(!Ps[d])throw new Error(`Types doesn't contain name = ${d}`);a=Ps[d]}const p=[];for(;c<t.length;c++){const g=n.parse(t[c],c,lt);if(!g)return null;p.push(g)}return new Ur(a,p)}evaluate(t){for(let n=0;n<this.args.length;n++){const a=this.args[n].evaluate(t);if(!Ts(this.type,vi(a)))return a;if(n===this.args.length-1)throw new xi(`Expected value to be of type ${ei(this.type)}, but found ${ei(vi(a))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Cs={"to-boolean":et,"to-color":fr,"to-number":Ie,"to-string":$e};class Nt{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const a=t[0];if(!Cs[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 n.error("Expected one argument.");const c=Cs[a],d=[];for(let p=1;p<t.length;p++){const g=n.parse(t[p],p,lt);if(!g)return null;d.push(g)}return new Nt(c,d)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let n,a;for(const c of this.args){if(n=c.evaluate(t),a=null,n instanceof gt)return n;if(typeof n=="string"){const d=t.parseColor(n);if(d)return d}else if(Array.isArray(n)&&(a=n.length<3||n.length>4?`Invalid rgba value ${JSON.stringify(n)}: expected an array containing either three or four numeric values.`:Kn(n[0],n[1],n[2],n[3]),!a))return new gt(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new xi(a||`Could not parse color from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"padding":{let n;for(const a of this.args){n=a.evaluate(t);const c=sr.parse(n);if(c)return c}throw new xi(`Could not parse padding from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"variableAnchorOffsetCollection":{let n;for(const a of this.args){n=a.evaluate(t);const c=Yi.parse(n);if(c)return c}throw new xi(`Could not parse variableAnchorOffsetCollection from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"number":{let n=null;for(const a of this.args){if(n=a.evaluate(t),n===null)return 0;const c=Number(n);if(!isNaN(c))return c}throw new xi(`Could not convert ${JSON.stringify(n)} to number.`)}case"formatted":return wr.fromString(pn(this.args[0].evaluate(t)));case"resolvedImage":return Rr.fromString(pn(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return pn(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const ec=["Unknown","Point","LineString","Polygon"];class zt{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},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"?ec[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 n=this._parseColorCache[t];return n||(n=this._parseColorCache[t]=gt.parse(t)),n}}class pt{constructor(t,n,a=[],c,d=new Vt,p=[]){this.registry=t,this.path=a,this.key=a.map(g=>`[${g}]`).join(""),this.scope=d,this.errors=p,this.expectedType=c,this._isConstant=n}parse(t,n,a,c,d={}){return n?this.concat(n,a,c)._parse(t,d):this._parse(t,d)}_parse(t,n){function a(c,d,p){return p==="assert"?new Ur(d,[c]):p==="coerce"?new Nt(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 g=this.expectedType,x=p.type;if(g.kind!=="string"&&g.kind!=="number"&&g.kind!=="boolean"&&g.kind!=="object"&&g.kind!=="array"||x.kind!=="value")if(g.kind!=="projectionDefinition"||x.kind!=="string"&&x.kind!=="array")if(g.kind!=="color"&&g.kind!=="formatted"&&g.kind!=="resolvedImage"||x.kind!=="value"&&x.kind!=="string")if(g.kind!=="padding"||x.kind!=="value"&&x.kind!=="number"&&x.kind!=="array")if(g.kind!=="variableAnchorOffsetCollection"||x.kind!=="value"&&x.kind!=="array"){if(this.checkSubtype(g,x))return null}else p=a(p,g,n.typeAnnotation||"coerce");else p=a(p,g,n.typeAnnotation||"coerce");else p=a(p,g,n.typeAnnotation||"coerce");else p=a(p,g,n.typeAnnotation||"coerce");else p=a(p,g,n.typeAnnotation||"assert")}if(!(p instanceof Yn)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const g=new zt;try{p=new Yn(p.type,p.evaluate(g))}catch(x){return this.error(x.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,n,a){const c=typeof t=="number"?this.path.concat(t):this.path,d=a?this.scope.concat(a):this.scope;return new pt(this.registry,this._isConstant,c,n||null,d,this.errors)}error(t,...n){const a=`${this.key}${n.map(c=>`[${c}]`).join("")}`;this.errors.push(new Ct(a,t))}checkSubtype(t,n){const a=Ts(t,n);return a&&this.error(a),a}}class Wa{constructor(t,n){this.type=n.type,this.bindings=[].concat(t),this.result=n}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const n of this.bindings)t(n[1]);t(this.result)}static parse(t,n){if(t.length<4)return n.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 n.error(`Expected string, but found ${typeof p} instead.`,d);if(/[^a-zA-Z0-9_]/.test(p))return n.error("Variable names must contain only alphanumeric characters or '_'.",d);const g=n.parse(t[d+1],d+1);if(!g)return null;a.push([p,g])}const c=n.parse(t[t.length-1],t.length-1,n.expectedType,a);return c?new Wa(a,c):null}outputDefined(){return this.result.outputDefined()}}class Pt{constructor(t,n){this.type=n.type,this.name=t,this.boundExpression=n}static parse(t,n){if(t.length!==2||typeof t[1]!="string")return n.error("'var' expression requires exactly one string literal argument.");const a=t[1];return n.scope.has(a)?new Pt(a,n.scope.get(a)):n.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 Is{constructor(t,n,a){this.type=t,this.index=n,this.input=a}static parse(t,n){if(t.length!==3)return n.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,Ie),c=n.parse(t[2],2,Ui(n.expectedType||lt));return a&&c?new Is(c.type.itemType,a,c):null}evaluate(t){const n=this.index.evaluate(t),a=this.input.evaluate(t);if(n<0)throw new xi(`Array index out of bounds: ${n} < 0.`);if(n>=a.length)throw new xi(`Array index out of bounds: ${n} > ${a.length-1}.`);if(n!==Math.floor(n))throw new xi(`Array index must be an integer, but found ${n} instead.`);return a[n]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Jr{constructor(t,n){this.type=et,this.needle=t,this.haystack=n}static parse(t,n){if(t.length!==3)return n.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,lt),c=n.parse(t[2],2,lt);return a&&c?Mo(a.type,[et,$e,Ie,It,lt])?new Jr(a,c):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${ei(a.type)} instead`):null}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!Yr(n,["boolean","string","number","null"]))throw new xi(`Expected first argument to be of type boolean, string, number or null, but found ${ei(vi(n))} instead.`);if(!Yr(a,["string","array"]))throw new xi(`Expected second argument to be of type array or string, but found ${ei(vi(a))} instead.`);return a.indexOf(n)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Xa{constructor(t,n,a){this.type=Ie,this.needle=t,this.haystack=n,this.fromIndex=a}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,lt),c=n.parse(t[2],2,lt);if(!a||!c)return null;if(!Mo(a.type,[et,$e,Ie,It,lt]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${ei(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,Ie);return d?new Xa(a,c,d):null}return new Xa(a,c)}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!Yr(n,["boolean","string","number","null"]))throw new xi(`Expected first argument to be of type boolean, string, number or null, but found ${ei(vi(n))} instead.`);let c;if(this.fromIndex&&(c=this.fromIndex.evaluate(t)),Yr(a,["string"])){const d=a.indexOf(n,c);return d===-1?-1:[...a.slice(0,d)].length}if(Yr(a,["array"]))return a.indexOf(n,c);throw new xi(`Expected second argument to be of type array or string, but found ${ei(vi(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Po{constructor(t,n,a,c,d,p){this.inputType=t,this.type=n,this.input=a,this.cases=c,this.outputs=d,this.otherwise=p}static parse(t,n){if(t.length<5)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return n.error("Expected an even number of arguments.");let a,c;n.expectedType&&n.expectedType.kind!=="value"&&(c=n.expectedType);const d={},p=[];for(let w=2;w<t.length-1;w+=2){let M=t[w];const C=t[w+1];Array.isArray(M)||(M=[M]);const A=n.concat(w);if(M.length===0)return A.error("Expected at least one branch label.");for(const B of M){if(typeof B!="number"&&typeof B!="string")return A.error("Branch labels must be numbers or strings.");if(typeof B=="number"&&Math.abs(B)>Number.MAX_SAFE_INTEGER)return A.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof B=="number"&&Math.floor(B)!==B)return A.error("Numeric branch labels must be integer values.");if(a){if(A.checkSubtype(a,vi(B)))return null}else a=vi(B);if(d[String(B)]!==void 0)return A.error("Branch labels must be unique.");d[String(B)]=p.length}const L=n.parse(C,w,c);if(!L)return null;c=c||L.type,p.push(L)}const g=n.parse(t[1],1,lt);if(!g)return null;const x=n.parse(t[t.length-1],t.length-1,c);return x?g.type.kind!=="value"&&n.concat(1).checkSubtype(a,g.type)?null:new Po(a,c,g,d,p,x):null}evaluate(t){const n=this.input.evaluate(t);return(vi(n)===this.inputType&&this.outputs[this.cases[n]]||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 Co{constructor(t,n,a){this.type=t,this.branches=n,this.otherwise=a}static parse(t,n){if(t.length<4)return n.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return n.error("Expected an odd number of arguments.");let a;n.expectedType&&n.expectedType.kind!=="value"&&(a=n.expectedType);const c=[];for(let p=1;p<t.length-1;p+=2){const g=n.parse(t[p],p,et);if(!g)return null;const x=n.parse(t[p+1],p+1,a);if(!x)return null;c.push([g,x]),a=a||x.type}const d=n.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 Co(a,c,d)}evaluate(t){for(const[n,a]of this.branches)if(n.evaluate(t))return a.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[n,a]of this.branches)t(n),t(a);t(this.otherwise)}outputDefined(){return this.branches.every(([t,n])=>n.outputDefined())&&this.otherwise.outputDefined()}}class Ka{constructor(t,n,a,c){this.type=t,this.input=n,this.beginIndex=a,this.endIndex=c}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,lt),c=n.parse(t[2],2,Ie);if(!a||!c)return null;if(!Mo(a.type,[Ui(lt),$e,lt]))return n.error(`Expected first argument to be of type array or string, but found ${ei(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,Ie);return d?new Ka(a.type,a,c,d):null}return new Ka(a.type,a,c)}evaluate(t){const n=this.input.evaluate(t),a=this.beginIndex.evaluate(t);let c;if(this.endIndex&&(c=this.endIndex.evaluate(t)),Yr(n,["string"]))return[...n].slice(a,c).join("");if(Yr(n,["array"]))return n.slice(a,c);throw new xi(`Expected first argument to be of type array or string, but found ${ei(vi(n))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function Es(r,t){const n=r.length-1;let a,c,d=0,p=n,g=0;for(;d<=p;)if(g=Math.floor((d+p)/2),a=r[g],c=r[g+1],a<=t){if(g===n||t<c)return g;d=g+1}else{if(!(a>t))throw new xi("Input is not a number.");p=g-1}return 0}class ks{constructor(t,n,a){this.type=t,this.input=n,this.labels=[],this.outputs=[];for(const[c,d]of a)this.labels.push(c),this.outputs.push(d)}static parse(t,n){if(t.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");const a=n.parse(t[1],1,Ie);if(!a)return null;const c=[];let d=null;n.expectedType&&n.expectedType.kind!=="value"&&(d=n.expectedType);for(let p=1;p<t.length;p+=2){const g=p===1?-1/0:t[p],x=t[p+1],w=p,M=p+1;if(typeof g!="number")return n.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',w);if(c.length&&c[c.length-1][0]>=g)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',w);const C=n.parse(x,M,d);if(!C)return null;d=d||C.type,c.push([g,C])}return new ks(d,a,c)}evaluate(t){const n=this.labels,a=this.outputs;if(n.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=n[0])return a[0].evaluate(t);const d=n.length;return c>=n[d-1]?a[d-1].evaluate(t):a[Es(n,c)].evaluate(t)}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function nh(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Io,Ya,or=function(){if(Ya)return Io;function r(t,n,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(c-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=a,this.p2y=c}return Ya=1,Io=r,r.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,n){if(n===void 0&&(n=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)<n)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var g=0,x=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<n));c++)t>d?g=a:x=a,a=.5*(x-g)+g;return a},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}},Io}(),Eo=nh(or);class Tr{constructor(t,n,a,c,d){this.type=t,this.operator=n,this.interpolation=a,this.input=c,this.labels=[],this.outputs=[];for(const[p,g]of d)this.labels.push(p),this.outputs.push(g)}static interpolationFactor(t,n,a,c){let d=0;if(t.name==="exponential")d=Ja(n,t.base,a,c);else if(t.name==="linear")d=Ja(n,1,a,c);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new Eo(p[0],p[1],p[2],p[3]).solve(Ja(n,1,a,c))}return d}static parse(t,n){let[a,c,d,...p]=t;if(!Array.isArray(c)||c.length===0)return n.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const w=c[1];if(typeof w!="number")return n.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:w}}else{if(c[0]!=="cubic-bezier")return n.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const w=c.slice(1);if(w.length!==4||w.some(M=>typeof M!="number"||M<0||M>1))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:w}}}if(t.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(d=n.parse(d,2,Ie),!d)return null;const g=[];let x=null;a==="interpolate-hcl"||a==="interpolate-lab"?x=fr:n.expectedType&&n.expectedType.kind!=="value"&&(x=n.expectedType);for(let w=0;w<p.length;w+=2){const M=p[w],C=p[w+1],A=w+3,L=w+4;if(typeof M!="number")return n.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',A);if(g.length&&g[g.length-1][0]>=M)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',A);const B=n.parse(C,L,x);if(!B)return null;x=x||B.type,g.push([M,B])}return ya(x,Ie)||ya(x,ar)||ya(x,fr)||ya(x,wo)||ya(x,To)||ya(x,Ui(Ie))?new Tr(x,a,c,d,g):n.error(`Type ${ei(x)} is not interpolatable.`)}evaluate(t){const n=this.labels,a=this.outputs;if(n.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=n[0])return a[0].evaluate(t);const d=n.length;if(c>=n[d-1])return a[d-1].evaluate(t);const p=Es(n,c),g=Tr.interpolationFactor(this.interpolation,c,n[p],n[p+1]),x=a[p].evaluate(t),w=a[p+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return In(x,w,g);case"color":return gt.interpolate(x,w,g);case"padding":return sr.interpolate(x,w,g);case"variableAnchorOffsetCollection":return Yi.interpolate(x,w,g);case"array":return qa(x,w,g);case"projectionDefinition":return mr.interpolate(x,w,g)}case"interpolate-hcl":return gt.interpolate(x,w,g,"hcl");case"interpolate-lab":return gt.interpolate(x,w,g,"lab")}}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Ja(r,t,n,a){const c=a-n,d=r-n;return c===0?0:t===1?d/c:(Math.pow(t,d)-1)/(Math.pow(t,c)-1)}const Qt={color:gt.interpolate,number:In,padding:sr.interpolate,variableAnchorOffsetCollection:Yi.interpolate,array:qa};class zs{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let a=null;const c=n.expectedType;c&&c.kind!=="value"&&(a=c);const d=[];for(const g of t.slice(1)){const x=n.parse(g,1+d.length,a,void 0,{typeAnnotation:"omit"});if(!x)return null;a=a||x.type,d.push(x)}if(!a)throw new Error("No output type");const p=c&&d.some(g=>Ts(c,g.type));return new zs(p?lt:a,d)}evaluate(t){let n,a=null,c=0;for(const d of this.args)if(c++,a=d.evaluate(t),a&&a instanceof Rr&&!a.available&&(n||(n=a.name),a=null,c===this.args.length&&(a=n)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function ko(r,t){return r==="=="||r==="!="?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 tc(r,t,n,a){return a.compare(t,n)===0}function Qa(r,t,n){const a=r!=="=="&&r!=="!=";return class t_{constructor(d,p,g){this.type=et,this.lhs=d,this.rhs=p,this.collator=g,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 g=d[0];let x=p.parse(d[1],1,lt);if(!x)return null;if(!ko(g,x.type))return p.concat(1).error(`"${g}" comparisons are not supported for type '${ei(x.type)}'.`);let w=p.parse(d[2],2,lt);if(!w)return null;if(!ko(g,w.type))return p.concat(2).error(`"${g}" comparisons are not supported for type '${ei(w.type)}'.`);if(x.type.kind!==w.type.kind&&x.type.kind!=="value"&&w.type.kind!=="value")return p.error(`Cannot compare types '${ei(x.type)}' and '${ei(w.type)}'.`);a&&(x.type.kind==="value"&&w.type.kind!=="value"?x=new Ur(w.type,[x]):x.type.kind!=="value"&&w.type.kind==="value"&&(w=new Ur(x.type,[w])));let M=null;if(d.length===4){if(x.type.kind!=="string"&&w.type.kind!=="string"&&x.type.kind!=="value"&&w.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(M=p.parse(d[3],3,ws),!M)return null}return new t_(x,w,M)}evaluate(d){const p=this.lhs.evaluate(d),g=this.rhs.evaluate(d);if(a&&this.hasUntypedArgument){const x=vi(p),w=vi(g);if(x.kind!==w.kind||x.kind!=="string"&&x.kind!=="number")throw new xi(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${x.kind}, ${w.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const x=vi(p),w=vi(g);if(x.kind!=="string"||w.kind!=="string")return t(d,p,g)}return this.collator?n(d,p,g,this.collator.evaluate(d)):t(d,p,g)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const zo=Qa("==",function(r,t,n){return t===n},tc),ic=Qa("!=",function(r,t,n){return t!==n},function(r,t,n,a){return!tc(0,t,n,a)}),Gd=Qa("<",function(r,t,n){return t<n},function(r,t,n,a){return a.compare(t,n)<0}),Ao=Qa(">",function(r,t,n){return t>n},function(r,t,n,a){return a.compare(t,n)>0}),Ro=Qa("<=",function(r,t,n){return t<=n},function(r,t,n,a){return a.compare(t,n)<=0}),Qr=Qa(">=",function(r,t,n){return t>=n},function(r,t,n,a){return a.compare(t,n)>=0});class As{constructor(t,n,a){this.type=ws,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=n}static parse(t,n){if(t.length!==2)return n.error("Expected one argument.");const a=t[1];if(typeof a!="object"||Array.isArray(a))return n.error("Collator options argument must be an object.");const c=n.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,et);if(!c)return null;const d=n.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,et);if(!d)return null;let p=null;return a.locale&&(p=n.parse(a.locale,1,$e),!p)?null:new As(c,d,p)}evaluate(t){return new St(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 es{constructor(t,n,a,c,d){this.type=$e,this.number=t,this.locale=n,this.currency=a,this.minFractionDigits=c,this.maxFractionDigits=d}static parse(t,n){if(t.length!==3)return n.error("Expected two arguments.");const a=n.parse(t[1],1,Ie);if(!a)return null;const c=t[2];if(typeof c!="object"||Array.isArray(c))return n.error("NumberFormat options argument must be an object.");let d=null;if(c.locale&&(d=n.parse(c.locale,1,$e),!d))return null;let p=null;if(c.currency&&(p=n.parse(c.currency,1,$e),!p))return null;let g=null;if(c["min-fraction-digits"]&&(g=n.parse(c["min-fraction-digits"],1,Ie),!g))return null;let x=null;return c["max-fraction-digits"]&&(x=n.parse(c["max-fraction-digits"],1,Ie),!x)?null:new es(a,d,p,g,x)}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 Do{constructor(t){this.type=_a,this.sections=t}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const a=t[1];if(!Array.isArray(a)&&typeof a=="object")return n.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 g=t[p];if(d&&typeof g=="object"&&!Array.isArray(g)){d=!1;let x=null;if(g["font-scale"]&&(x=n.parse(g["font-scale"],1,Ie),!x))return null;let w=null;if(g["text-font"]&&(w=n.parse(g["text-font"],1,Ui($e)),!w))return null;let M=null;if(g["text-color"]&&(M=n.parse(g["text-color"],1,fr),!M))return null;let C=null;if(g["vertical-align"]){if(typeof g["vertical-align"]=="string"&&!Ha.includes(g["vertical-align"]))return n.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${g["vertical-align"]}' instead.`);if(C=n.parse(g["vertical-align"],1,$e),!C)return null}const A=c[c.length-1];A.scale=x,A.font=w,A.textColor=M,A.verticalAlign=C}else{const x=n.parse(t[p],1,lt);if(!x)return null;const w=x.type.kind;if(w!=="string"&&w!=="value"&&w!=="null"&&w!=="resolvedImage")return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,c.push({content:x,scale:null,font:null,textColor:null,verticalAlign:null})}}return new Do(c)}evaluate(t){return new wr(this.sections.map(n=>{const a=n.content.evaluate(t);return vi(a)===Xn?new dn("",a,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(t):null):new dn(pn(a),null,n.scale?n.scale.evaluate(t):null,n.font?n.font.evaluate(t).join(","):null,n.textColor?n.textColor.evaluate(t):null,n.verticalAlign?n.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const n of this.sections)t(n.content),n.scale&&t(n.scale),n.font&&t(n.font),n.textColor&&t(n.textColor),n.verticalAlign&&t(n.verticalAlign)}outputDefined(){return!1}}class Rs{constructor(t){this.type=Xn,this.input=t}static parse(t,n){if(t.length!==2)return n.error("Expected two arguments.");const a=n.parse(t[1],1,$e);return a?new Rs(a):n.error("No image name provided.")}evaluate(t){const n=this.input.evaluate(t),a=Rr.fromString(n);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(n)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class rc{constructor(t){this.type=Ie,this.input=t}static parse(t,n){if(t.length!==2)return n.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=n.parse(t[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?n.error(`Expected argument of type string or array, but found ${ei(a.type)} instead.`):new rc(a):null}evaluate(t){const n=this.input.evaluate(t);if(typeof n=="string")return[...n].length;if(Array.isArray(n))return n.length;throw new xi(`Expected value to be of type string or array, but found ${ei(vi(n))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const fn=8192;function qd(r,t){const n=(180+r[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,c=Math.pow(2,t.z);return[Math.round(n*c*fn),Math.round(a*c*fn)]}function nc(r,t){const n=Math.pow(2,t.z);return[(c=(r[0]/fn+t.x)/n,360*c-180),(a=(r[1]/fn+t.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,c}function Jn(r,t){r[0]=Math.min(r[0],t[0]),r[1]=Math.min(r[1],t[1]),r[2]=Math.max(r[2],t[0]),r[3]=Math.max(r[3],t[1])}function Ds(r,t){return!(r[0]<=t[0]||r[2]>=t[2]||r[1]<=t[1]||r[3]>=t[3])}function ah(r,t,n){const a=r[0]-t[0],c=r[1]-t[1],d=r[0]-n[0],p=r[1]-n[1];return a*p-d*c==0&&a*d<=0&&c*p<=0}function Ls(r,t,n,a){return(c=[a[0]-n[0],a[1]-n[1]])[0]*(d=[t[0]-r[0],t[1]-r[1]])[1]-c[1]*d[0]!=0&&!(!oh(r,t,n,a)||!oh(n,a,r,t));var c,d}function Hd(r,t,n){for(const a of n)for(let c=0;c<a.length-1;++c)if(Ls(r,t,a[c],a[c+1]))return!0;return!1}function va(r,t,n=!1){let a=!1;for(const g of t)for(let x=0;x<g.length-1;x++){if(ah(r,g[x],g[x+1]))return n;(d=g[x])[1]>(c=r)[1]!=(p=g[x+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 Wd(r,t){for(const n of t)if(va(r,n))return!0;return!1}function sh(r,t){for(const n of r)if(!va(n,t))return!1;for(let n=0;n<r.length-1;++n)if(Hd(r[n],r[n+1],t))return!1;return!0}function Xd(r,t){for(const n of t)if(sh(r,n))return!0;return!1}function oh(r,t,n,a){const c=a[0]-n[0],d=a[1]-n[1],p=(r[0]-n[0])*d-c*(r[1]-n[1]),g=(t[0]-n[0])*d-c*(t[1]-n[1]);return p>0&&g<0||p<0&&g>0}function ac(r,t,n){const a=[];for(let c=0;c<r.length;c++){const d=[];for(let p=0;p<r[c].length;p++){const g=qd(r[c][p],n);Jn(t,g),d.push(g)}a.push(d)}return a}function sc(r,t,n){const a=[];for(let c=0;c<r.length;c++){const d=ac(r[c],t,n);a.push(d)}return a}function oc(r,t,n,a){if(r[0]<n[0]||r[0]>n[2]){const c=.5*a;let d=r[0]-n[0]>c?-a:n[0]-r[0]>c?a:0;d===0&&(d=r[0]-n[2]>c?-a:n[2]-r[0]>c?a:0),r[0]+=d}Jn(t,r)}function lc(r,t,n,a){const c=Math.pow(2,a.z)*fn,d=[a.x*fn,a.y*fn],p=[];for(const g of r)for(const x of g){const w=[x.x+d[0],x.y+d[1]];oc(w,t,n,c),p.push(w)}return p}function lh(r,t,n,a){const c=Math.pow(2,a.z)*fn,d=[a.x*fn,a.y*fn],p=[];for(const x of r){const w=[];for(const M of x){const C=[M.x+d[0],M.y+d[1]];Jn(t,C),w.push(C)}p.push(w)}if(t[2]-t[0]<=c/2){(g=t)[0]=g[1]=1/0,g[2]=g[3]=-1/0;for(const x of p)for(const w of x)oc(w,t,n,c)}var g;return p}class ba{constructor(t,n){this.type=et,this.geojson=t,this.geometries=n}static parse(t,n){if(t.length!==2)return n.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ss(t[1])){const a=t[1];if(a.type==="FeatureCollection"){const c=[];for(const d of a.features){const{type:p,coordinates:g}=d.geometry;p==="Polygon"&&c.push(g),p==="MultiPolygon"&&c.push(...g)}if(c.length)return new ba(a,{type:"MultiPolygon",coordinates:c})}else if(a.type==="Feature"){const c=a.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new ba(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new ba(a,a)}return n.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(n,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=n.canonicalID();if(a.type==="Polygon"){const g=ac(a.coordinates,d,p),x=lc(n.geometry(),c,d,p);if(!Ds(c,d))return!1;for(const w of x)if(!va(w,g))return!1}if(a.type==="MultiPolygon"){const g=sc(a.coordinates,d,p),x=lc(n.geometry(),c,d,p);if(!Ds(c,d))return!1;for(const w of x)if(!Wd(w,g))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(n,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=n.canonicalID();if(a.type==="Polygon"){const g=ac(a.coordinates,d,p),x=lh(n.geometry(),c,d,p);if(!Ds(c,d))return!1;for(const w of x)if(!sh(w,g))return!1}if(a.type==="MultiPolygon"){const g=sc(a.coordinates,d,p),x=lh(n.geometry(),c,d,p);if(!Ds(c,d))return!1;for(const w of x)if(!Xd(w,g))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let ch=class{constructor(r=[],t=(n,a)=>n<a?-1:n>a?1:0){if(this.data=r,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:t,compare:n}=this,a=t[r];for(;r>0;){const c=r-1>>1,d=t[c];if(n(a,d)>=0)break;t[r]=d,r=c}t[r]=a}_down(r){const{data:t,compare:n}=this,a=this.length>>1,c=t[r];for(;r<a;){let d=1+(r<<1);const p=d+1;if(p<this.length&&n(t[p],t[d])<0&&(d=p),n(t[d],c)>=0)break;t[r]=t[d],r=d}t[r]=c}};function Lo(r,t,n=0,a=r.length-1,c=Kd){for(;a>n;){if(a-n>600){const x=a-n+1,w=t-n+1,M=Math.log(x),C=.5*Math.exp(2*M/3),A=.5*Math.sqrt(M*C*(x-C)/x)*(w-x/2<0?-1:1);Lo(r,t,Math.max(n,Math.floor(t-w*C/x+A)),Math.min(a,Math.floor(t+(x-w)*C/x+A)),c)}const d=r[t];let p=n,g=a;for(Bs(r,n,t),c(r[a],d)>0&&Bs(r,n,a);p<g;){for(Bs(r,p,g),p++,g--;c(r[p],d)<0;)p++;for(;c(r[g],d)>0;)g--}c(r[n],d)===0?Bs(r,n,g):(g++,Bs(r,g,a)),g<=t&&(n=g+1),t<=g&&(a=g-1)}}function Bs(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function Kd(r,t){return r<t?-1:r>t?1:0}function Bo(r,t){if(r.length<=1)return[r];const n=[];let a,c;for(const d of r){const p=hh(d);p!==0&&(d.area=Math.abs(p),c===void 0&&(c=p<0),c===p<0?(a&&n.push(a),a=[d]):a.push(d))}if(a&&n.push(a),t>1)for(let d=0;d<n.length;d++)n[d].length<=t||(Lo(n[d],t,1,n[d].length-1,uh),n[d]=n[d].slice(0,t));return n}function uh(r,t){return t.area-r.area}function hh(r){let t=0;for(let n,a,c=0,d=r.length,p=d-1;c<d;p=c++)n=r[c],a=r[p],t+=(a.x-n.x)*(n.y+a.y);return t}const dh=1/298.257223563,ph=dh*(2-dh),cc=Math.PI/180;class Fo{constructor(t){const n=6378.137*cc*1e3,a=Math.cos(t*cc),c=1/(1-ph*(1-a*a)),d=Math.sqrt(c);this.kx=n*d*a,this.ky=n*d*c*(1-ph)}distance(t,n){const a=this.wrap(t[0]-n[0])*this.kx,c=(t[1]-n[1])*this.ky;return Math.sqrt(a*a+c*c)}pointOnLine(t,n){let a,c,d,p,g=1/0;for(let x=0;x<t.length-1;x++){let w=t[x][0],M=t[x][1],C=this.wrap(t[x+1][0]-w)*this.kx,A=(t[x+1][1]-M)*this.ky,L=0;C===0&&A===0||(L=(this.wrap(n[0]-w)*this.kx*C+(n[1]-M)*this.ky*A)/(C*C+A*A),L>1?(w=t[x+1][0],M=t[x+1][1]):L>0&&(w+=C/this.kx*L,M+=A/this.ky*L)),C=this.wrap(n[0]-w)*this.kx,A=(n[1]-M)*this.ky;const B=C*C+A*A;B<g&&(g=B,a=w,c=M,d=x,p=L)}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 fh(r,t){return t[0]-r[0]}function Oo(r){return r[1]-r[0]+1}function En(r,t){return r[1]>=r[0]&&r[1]<t}function jo(r,t){if(r[0]>r[1])return[null,null];const n=Oo(r);if(t){if(n===2)return[r,null];const c=Math.floor(n/2);return[[r[0],r[0]+c],[r[0]+c,r[1]]]}if(n===1)return[r,null];const a=Math.floor(n/2)-1;return[[r[0],r[0]+a],[r[0]+a+1,r[1]]]}function uc(r,t){if(!En(t,r.length))return[1/0,1/0,-1/0,-1/0];const n=[1/0,1/0,-1/0,-1/0];for(let a=t[0];a<=t[1];++a)Jn(n,r[a]);return n}function hc(r){const t=[1/0,1/0,-1/0,-1/0];for(const n of r)for(const a of n)Jn(t,a);return t}function mh(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function dc(r,t,n){if(!mh(r)||!mh(t))return NaN;let a=0,c=0;return r[2]<t[0]&&(a=t[0]-r[2]),r[0]>t[2]&&(a=r[0]-t[2]),r[1]>t[3]&&(c=r[1]-t[3]),r[3]<t[1]&&(c=t[1]-r[3]),n.distance([0,0],[a,c])}function Mt(r,t,n){const a=n.pointOnLine(t,r);return n.distance(r,a.point)}function pc(r,t,n,a,c){const d=Math.min(Mt(r,[n,a],c),Mt(t,[n,a],c)),p=Math.min(Mt(n,[r,t],c),Mt(a,[r,t],c));return Math.min(d,p)}function Yd(r,t,n,a,c){if(!En(t,r.length)||!En(a,n.length))return 1/0;let d=1/0;for(let p=t[0];p<t[1];++p){const g=r[p],x=r[p+1];for(let w=a[0];w<a[1];++w){const M=n[w],C=n[w+1];if(Ls(g,x,M,C))return 0;d=Math.min(d,pc(g,x,M,C,c))}}return d}function Jd(r,t,n,a,c){if(!En(t,r.length)||!En(a,n.length))return NaN;let d=1/0;for(let p=t[0];p<=t[1];++p)for(let g=a[0];g<=a[1];++g)if(d=Math.min(d,c.distance(r[p],n[g])),d===0)return d;return d}function Qd(r,t,n){if(va(r,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,Mt(r,[p,d],n)),a===0))return a;const g=n.pointOnLine(c,r);if(a=Math.min(a,n.distance(r,g.point)),a===0)return a}return a}function ep(r,t,n,a){if(!En(t,r.length))return NaN;for(let d=t[0];d<=t[1];++d)if(va(r[d],n,!0))return 0;let c=1/0;for(let d=t[0];d<t[1];++d){const p=r[d],g=r[d+1];for(const x of n)for(let w=0,M=x.length,C=M-1;w<M;C=w++){const A=x[C],L=x[w];if(Ls(p,g,A,L))return 0;c=Math.min(c,pc(p,g,A,L,a))}}return c}function gh(r,t){for(const n of r)for(const a of n)if(va(a,t,!0))return!0;return!1}function tp(r,t,n,a=1/0){const c=hc(r),d=hc(t);if(a!==1/0&&dc(c,d,n)>=a)return a;if(Ds(c,d)){if(gh(r,t))return 0}else if(gh(t,r))return 0;let p=1/0;for(const g of r)for(let x=0,w=g.length,M=w-1;x<w;M=x++){const C=g[M],A=g[x];for(const L of t)for(let B=0,j=L.length,$=j-1;B<j;$=B++){const X=L[$],se=L[B];if(Ls(C,A,X,se))return 0;p=Math.min(p,pc(C,A,X,se,n))}}return p}function _h(r,t,n,a,c,d){if(!d)return;const p=dc(uc(a,d),c,n);p<t&&r.push([p,d,[0,0]])}function No(r,t,n,a,c,d,p){if(!d||!p)return;const g=dc(uc(a,d),uc(c,p),n);g<t&&r.push([g,d,p])}function Zo(r,t,n,a,c=1/0){let d=Math.min(a.distance(r[0],n[0][0]),c);if(d===0)return d;const p=new ch([[0,[0,r.length-1],[0,0]]],fh),g=hc(n);for(;p.length>0;){const x=p.pop();if(x[0]>=d)continue;const w=x[1],M=t?50:100;if(Oo(w)<=M){if(!En(w,r.length))return NaN;if(t){const C=ep(r,w,n,a);if(isNaN(C)||C===0)return C;d=Math.min(d,C)}else for(let C=w[0];C<=w[1];++C){const A=Qd(r[C],n,a);if(d=Math.min(d,A),d===0)return 0}}else{const C=jo(w,t);_h(p,d,a,r,g,C[0]),_h(p,d,a,r,g,C[1])}}return d}function Vo(r,t,n,a,c,d=1/0){let p=Math.min(d,c.distance(r[0],n[0]));if(p===0)return p;const g=new ch([[0,[0,r.length-1],[0,n.length-1]]],fh);for(;g.length>0;){const x=g.pop();if(x[0]>=p)continue;const w=x[1],M=x[2],C=t?50:100,A=a?50:100;if(Oo(w)<=C&&Oo(M)<=A){if(!En(w,r.length)&&En(M,n.length))return NaN;let L;if(t&&a)L=Yd(r,w,n,M,c),p=Math.min(p,L);else if(t&&!a){const B=r.slice(w[0],w[1]+1);for(let j=M[0];j<=M[1];++j)if(L=Mt(n[j],B,c),p=Math.min(p,L),p===0)return p}else if(!t&&a){const B=n.slice(M[0],M[1]+1);for(let j=w[0];j<=w[1];++j)if(L=Mt(r[j],B,c),p=Math.min(p,L),p===0)return p}else L=Jd(r,w,n,M,c),p=Math.min(p,L)}else{const L=jo(w,t),B=jo(M,a);No(g,p,c,r,n,L[0],B[0]),No(g,p,c,r,n,L[0],B[1]),No(g,p,c,r,n,L[1],B[0]),No(g,p,c,r,n,L[1],B[1])}}return p}function fc(r){return r.type==="MultiPolygon"?r.coordinates.map(t=>({type:"Polygon",coordinates:t})):r.type==="MultiLineString"?r.coordinates.map(t=>({type:"LineString",coordinates:t})):r.type==="MultiPoint"?r.coordinates.map(t=>({type:"Point",coordinates:t})):[r]}class wa{constructor(t,n){this.type=Ie,this.geojson=t,this.geometries=n}static parse(t,n){if(t.length!==2)return n.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(Ss(t[1])){const a=t[1];if(a.type==="FeatureCollection")return new wa(a,a.features.map(c=>fc(c.geometry)).flat());if(a.type==="Feature")return new wa(a,fc(a.geometry));if("type"in a&&"coordinates"in a)return new wa(a,fc(a))}return n.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(n,a){const c=n.geometry(),d=c.flat().map(x=>nc([x.x,x.y],n.canonical));if(c.length===0)return NaN;const p=new Fo(d[0][1]);let g=1/0;for(const x of a){switch(x.type){case"Point":g=Math.min(g,Vo(d,!1,[x.coordinates],!1,p,g));break;case"LineString":g=Math.min(g,Vo(d,!1,x.coordinates,!0,p,g));break;case"Polygon":g=Math.min(g,Zo(d,!1,x.coordinates,p,g))}if(g===0)return g}return g}(t,this.geometries);if(t.geometryType()==="LineString")return function(n,a){const c=n.geometry(),d=c.flat().map(x=>nc([x.x,x.y],n.canonical));if(c.length===0)return NaN;const p=new Fo(d[0][1]);let g=1/0;for(const x of a){switch(x.type){case"Point":g=Math.min(g,Vo(d,!0,[x.coordinates],!1,p,g));break;case"LineString":g=Math.min(g,Vo(d,!0,x.coordinates,!0,p,g));break;case"Polygon":g=Math.min(g,Zo(d,!0,x.coordinates,p,g))}if(g===0)return g}return g}(t,this.geometries);if(t.geometryType()==="Polygon")return function(n,a){const c=n.geometry();if(c.length===0||c[0].length===0)return NaN;const d=Bo(c,0).map(x=>x.map(w=>w.map(M=>nc([M.x,M.y],n.canonical)))),p=new Fo(d[0][0][0][1]);let g=1/0;for(const x of a)for(const w of d){switch(x.type){case"Point":g=Math.min(g,Zo([x.coordinates],!1,w,p,g));break;case"LineString":g=Math.min(g,Zo(x.coordinates,!0,w,p,g));break;case"Polygon":g=Math.min(g,tp(w,x.coordinates,p,g))}if(g===0)return g}return g}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const ts={"==":zo,"!=":ic,">":Ao,"<":Gd,">=":Qr,"<=":Ro,array:Ur,at:Is,boolean:Ur,case:Co,coalesce:zs,collator:As,format:Do,image:Rs,in:Jr,"index-of":Xa,interpolate:Tr,"interpolate-hcl":Tr,"interpolate-lab":Tr,length:rc,let:Wa,literal:Yn,match:Po,number:Ur,"number-format":es,object:Ur,slice:Ka,step:ks,string:Ur,"to-boolean":Nt,"to-color":Nt,"to-number":Nt,"to-string":Nt,var:Pt,within:ba,distance:wa};class $r{constructor(t,n,a,c){this.name=t,this.type=n,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,n){const a=t[0],c=$r.definitions[a];if(!c)return n.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,g=p.filter(([w])=>!Array.isArray(w)||w.length===t.length-1);let x=null;for(const[w,M]of g){x=new pt(n.registry,Uo,n.path,null,n.scope);const C=[];let A=!1;for(let L=1;L<t.length;L++){const B=t[L],j=Array.isArray(w)?w[L-1]:w.type,$=x.parse(B,1+C.length,j);if(!$){A=!0;break}C.push($)}if(!A)if(Array.isArray(w)&&w.length!==C.length)x.error(`Expected ${w.length} arguments, but found ${C.length} instead.`);else{for(let L=0;L<C.length;L++){const B=Array.isArray(w)?w[L]:w.type,j=C[L];x.concat(L+1).checkSubtype(B,j.type)}if(x.errors.length===0)return new $r(a,d,M,C)}}if(g.length===1)n.errors.push(...x.errors);else{const w=(g.length?g:p).map(([C])=>{return A=C,Array.isArray(A)?`(${A.map(ei).join(", ")})`:`(${ei(A.type)}...)`;var A}).join(" | "),M=[];for(let C=1;C<t.length;C++){const A=n.parse(t[C],1+M.length);if(!A)return null;M.push(ei(A.type))}n.error(`Expected arguments of type ${w}, but found (${M.join(", ")}) instead.`)}return null}static register(t,n){$r.definitions=n;for(const a in n)t[a]=$r}}function yh(r,[t,n,a,c]){t=t.evaluate(r),n=n.evaluate(r),a=a.evaluate(r);const d=c?c.evaluate(r):1,p=Kn(t,n,a,d);if(p)throw new xi(p);return new gt(t/255,n/255,a/255,d,!1)}function xh(r,t){return r in t}function mc(r,t){const n=t[r];return n===void 0?null:n}function Ta(r){return{type:r}}function Uo(r){if(r instanceof Pt)return Uo(r.boundExpression);if(r instanceof $r&&r.name==="error"||r instanceof As||r instanceof ba||r instanceof wa)return!1;const t=r instanceof Nt||r instanceof Ur;let n=!0;return r.eachChild(a=>{n=t?n&&Uo(a):n&&a instanceof Yn}),!!n&&$o(r)&&Go(r,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function $o(r){if(r instanceof $r&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof ba||r instanceof wa)return!1;let t=!0;return r.eachChild(n=>{t&&!$o(n)&&(t=!1)}),t}function Fs(r){if(r instanceof $r&&r.name==="feature-state")return!1;let t=!0;return r.eachChild(n=>{t&&!Fs(n)&&(t=!1)}),t}function Go(r,t){if(r instanceof $r&&t.indexOf(r.name)>=0)return!1;let n=!0;return r.eachChild(a=>{n&&!Go(a,t)&&(n=!1)}),n}function vh(r){return{result:"success",value:r}}function is(r){return{result:"error",value:r}}function rs(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function bh(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function gc(r){return!!r.expression&&r.expression.interpolated}function At(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function qo(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function ip(r){return r}function Ho(r,t){const n=t.type==="color",a=r.stops&&typeof r.stops[0][0]=="object",c=a||!(a||r.property!==void 0),d=r.type||(gc(t)?"exponential":"interval");if(n||t.type==="padding"){const M=n?gt.parse:sr.parse;(r=at({},r)).stops&&(r.stops=r.stops.map(C=>[C[0],M(C[1])])),r.default=M(r.default?r.default:t.default)}if(r.colorSpace&&(p=r.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var p;let g,x,w;if(d==="exponential")g=_c;else if(d==="interval")g=np;else if(d==="categorical"){g=rp,x=Object.create(null);for(const M of r.stops)x[M[0]]=M[1];w=typeof r.stops[0][0]}else{if(d!=="identity")throw new Error(`Unknown function type "${d}"`);g=ap}if(a){const M={},C=[];for(let B=0;B<r.stops.length;B++){const j=r.stops[B],$=j[0].zoom;M[$]===void 0&&(M[$]={zoom:$,type:r.type,property:r.property,default:r.default,stops:[]},C.push($)),M[$].stops.push([j[0].value,j[1]])}const A=[];for(const B of C)A.push([M[B].zoom,Ho(M[B],t)]);const L={name:"linear"};return{kind:"composite",interpolationType:L,interpolationFactor:Tr.interpolationFactor.bind(void 0,L),zoomStops:A.map(B=>B[0]),evaluate:({zoom:B},j)=>_c({stops:A,base:r.base},t,B).evaluate(B,j)}}if(c){const M=d==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:M,interpolationFactor:Tr.interpolationFactor.bind(void 0,M),zoomStops:r.stops.map(C=>C[0]),evaluate:({zoom:C})=>g(r,t,C,x,w)}}return{kind:"source",evaluate(M,C){const A=C&&C.properties?C.properties[r.property]:void 0;return A===void 0?Os(r.default,t.default):g(r,t,A,x,w)}}}function Os(r,t,n){return r!==void 0?r:t!==void 0?t:n!==void 0?n:void 0}function rp(r,t,n,a,c){return Os(typeof n===c?a[n]:void 0,r.default,t.default)}function np(r,t,n){if(At(n)!=="number")return Os(r.default,t.default);const a=r.stops.length;if(a===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[a-1][0])return r.stops[a-1][1];const c=Es(r.stops.map(d=>d[0]),n);return r.stops[c][1]}function _c(r,t,n){const a=r.base!==void 0?r.base:1;if(At(n)!=="number")return Os(r.default,t.default);const c=r.stops.length;if(c===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[c-1][0])return r.stops[c-1][1];const d=Es(r.stops.map(M=>M[0]),n),p=function(M,C,A,L){const B=L-A,j=M-A;return B===0?0:C===1?j/B:(Math.pow(C,j)-1)/(Math.pow(C,B)-1)}(n,a,r.stops[d][0],r.stops[d+1][0]),g=r.stops[d][1],x=r.stops[d+1][1],w=Qt[t.type]||ip;return typeof g.evaluate=="function"?{evaluate(...M){const C=g.evaluate.apply(void 0,M),A=x.evaluate.apply(void 0,M);if(C!==void 0&&A!==void 0)return w(C,A,p,r.colorSpace)}}:w(g,x,p,r.colorSpace)}function ap(r,t,n){switch(t.type){case"color":n=gt.parse(n);break;case"formatted":n=wr.fromString(n.toString());break;case"resolvedImage":n=Rr.fromString(n.toString());break;case"padding":n=sr.parse(n);break;default:At(n)===t.type||t.type==="enum"&&t.values[n]||(n=void 0)}return Os(n,r.default,t.default)}$r.register(ts,{error:[{kind:"error"},[$e],(r,[t])=>{throw new xi(t.evaluate(r))}],typeof:[$e,[lt],(r,[t])=>ei(vi(t.evaluate(r)))],"to-rgba":[Ui(Ie,4),[fr],(r,[t])=>{const[n,a,c,d]=t.evaluate(r).rgb;return[255*n,255*a,255*c,d]}],rgb:[fr,[Ie,Ie,Ie],yh],rgba:[fr,[Ie,Ie,Ie,Ie],yh],has:{type:et,overloads:[[[$e],(r,[t])=>xh(t.evaluate(r),r.properties())],[[$e,ci],(r,[t,n])=>xh(t.evaluate(r),n.evaluate(r))]]},get:{type:lt,overloads:[[[$e],(r,[t])=>mc(t.evaluate(r),r.properties())],[[$e,ci],(r,[t,n])=>mc(t.evaluate(r),n.evaluate(r))]]},"feature-state":[lt,[$e],(r,[t])=>mc(t.evaluate(r),r.featureState||{})],properties:[ci,[],r=>r.properties()],"geometry-type":[$e,[],r=>r.geometryType()],id:[lt,[],r=>r.id()],zoom:[Ie,[],r=>r.globals.zoom],"heatmap-density":[Ie,[],r=>r.globals.heatmapDensity||0],"line-progress":[Ie,[],r=>r.globals.lineProgress||0],accumulated:[lt,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[Ie,Ta(Ie),(r,t)=>{let n=0;for(const a of t)n+=a.evaluate(r);return n}],"*":[Ie,Ta(Ie),(r,t)=>{let n=1;for(const a of t)n*=a.evaluate(r);return n}],"-":{type:Ie,overloads:[[[Ie,Ie],(r,[t,n])=>t.evaluate(r)-n.evaluate(r)],[[Ie],(r,[t])=>-t.evaluate(r)]]},"/":[Ie,[Ie,Ie],(r,[t,n])=>t.evaluate(r)/n.evaluate(r)],"%":[Ie,[Ie,Ie],(r,[t,n])=>t.evaluate(r)%n.evaluate(r)],ln2:[Ie,[],()=>Math.LN2],pi:[Ie,[],()=>Math.PI],e:[Ie,[],()=>Math.E],"^":[Ie,[Ie,Ie],(r,[t,n])=>Math.pow(t.evaluate(r),n.evaluate(r))],sqrt:[Ie,[Ie],(r,[t])=>Math.sqrt(t.evaluate(r))],log10:[Ie,[Ie],(r,[t])=>Math.log(t.evaluate(r))/Math.LN10],ln:[Ie,[Ie],(r,[t])=>Math.log(t.evaluate(r))],log2:[Ie,[Ie],(r,[t])=>Math.log(t.evaluate(r))/Math.LN2],sin:[Ie,[Ie],(r,[t])=>Math.sin(t.evaluate(r))],cos:[Ie,[Ie],(r,[t])=>Math.cos(t.evaluate(r))],tan:[Ie,[Ie],(r,[t])=>Math.tan(t.evaluate(r))],asin:[Ie,[Ie],(r,[t])=>Math.asin(t.evaluate(r))],acos:[Ie,[Ie],(r,[t])=>Math.acos(t.evaluate(r))],atan:[Ie,[Ie],(r,[t])=>Math.atan(t.evaluate(r))],min:[Ie,Ta(Ie),(r,t)=>Math.min(...t.map(n=>n.evaluate(r)))],max:[Ie,Ta(Ie),(r,t)=>Math.max(...t.map(n=>n.evaluate(r)))],abs:[Ie,[Ie],(r,[t])=>Math.abs(t.evaluate(r))],round:[Ie,[Ie],(r,[t])=>{const n=t.evaluate(r);return n<0?-Math.round(-n):Math.round(n)}],floor:[Ie,[Ie],(r,[t])=>Math.floor(t.evaluate(r))],ceil:[Ie,[Ie],(r,[t])=>Math.ceil(t.evaluate(r))],"filter-==":[et,[$e,lt],(r,[t,n])=>r.properties()[t.value]===n.value],"filter-id-==":[et,[lt],(r,[t])=>r.id()===t.value],"filter-type-==":[et,[$e],(r,[t])=>r.geometryType()===t.value],"filter-<":[et,[$e,lt],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a<c}],"filter-id-<":[et,[lt],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n<a}],"filter->":[et,[$e,lt],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a>c}],"filter-id->":[et,[lt],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n>a}],"filter-<=":[et,[$e,lt],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a<=c}],"filter-id-<=":[et,[lt],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n<=a}],"filter->=":[et,[$e,lt],(r,[t,n])=>{const a=r.properties()[t.value],c=n.value;return typeof a==typeof c&&a>=c}],"filter-id->=":[et,[lt],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n>=a}],"filter-has":[et,[lt],(r,[t])=>t.value in r.properties()],"filter-has-id":[et,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[et,[Ui($e)],(r,[t])=>t.value.indexOf(r.geometryType())>=0],"filter-id-in":[et,[Ui(lt)],(r,[t])=>t.value.indexOf(r.id())>=0],"filter-in-small":[et,[$e,Ui(lt)],(r,[t,n])=>n.value.indexOf(r.properties()[t.value])>=0],"filter-in-large":[et,[$e,Ui(lt)],(r,[t,n])=>function(a,c,d,p){for(;d<=p;){const g=d+p>>1;if(c[g]===a)return!0;c[g]>a?p=g-1:d=g+1}return!1}(r.properties()[t.value],n.value,0,n.value.length-1)],all:{type:et,overloads:[[[et,et],(r,[t,n])=>t.evaluate(r)&&n.evaluate(r)],[Ta(et),(r,t)=>{for(const n of t)if(!n.evaluate(r))return!1;return!0}]]},any:{type:et,overloads:[[[et,et],(r,[t,n])=>t.evaluate(r)||n.evaluate(r)],[Ta(et),(r,t)=>{for(const n of t)if(n.evaluate(r))return!0;return!1}]]},"!":[et,[et],(r,[t])=>!t.evaluate(r)],"is-supported-script":[et,[$e],(r,[t])=>{const n=r.globals&&r.globals.isSupportedScript;return!n||n(t.evaluate(r))}],upcase:[$e,[$e],(r,[t])=>t.evaluate(r).toUpperCase()],downcase:[$e,[$e],(r,[t])=>t.evaluate(r).toLowerCase()],concat:[$e,Ta(lt),(r,t)=>t.map(n=>pn(n.evaluate(r))).join("")],"resolved-locale":[$e,[ws],(r,[t])=>t.evaluate(r).resolvedLocale()]});class yc{constructor(t,n){var a;this.expression=t,this._warningHistory={},this._evaluator=new zt,this._defaultValue=n?(a=n).type==="color"&&qo(a.default)?new gt(0,0,0,0):a.type==="color"?gt.parse(a.default)||null:a.type==="padding"?sr.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?Yi.parse(a.default)||null:a.type==="projectionDefinition"?mr.parse(a.default)||null:a.default===void 0?null:a.default:null,this._enumValues=n&&n.type==="enum"?n.values:null}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._evaluator.globals=t,this._evaluator.feature=n,this._evaluator.featureState=a,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,n,a,c,d,p){this._evaluator.globals=t,this._evaluator.feature=n||null,this._evaluator.featureState=a||null,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||null;try{const g=this.expression.evaluate(this._evaluator);if(g==null||typeof g=="number"&&g!=g)return this._defaultValue;if(this._enumValues&&!(g in this._enumValues))throw new xi(`Expected value to be one of ${Object.keys(this._enumValues).map(x=>JSON.stringify(x)).join(", ")}, but found ${JSON.stringify(g)} instead.`);return g}catch(g){return this._warningHistory[g.message]||(this._warningHistory[g.message]=!0,typeof console<"u"&&console.warn(g.message)),this._defaultValue}}}function Ma(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in ts}function js(r,t){const n=new pt(ts,Uo,[],t?function(c){const d={color:fr,string:$e,number:Ie,enum:$e,boolean:et,formatted:_a,padding:wo,projectionDefinition:ar,resolvedImage:Xn,variableAnchorOffsetCollection:To};return c.type==="array"?Ui(d[c.value]||lt,c.length):d[c.type]}(t):void 0),a=n.parse(r,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?vh(new yc(a,t)):is(n.errors)}class xc{constructor(t,n){this.kind=t,this._styleExpression=n,this.isStateDependent=t!=="constant"&&!Fs(n.expression)}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,n,a,c,d,p)}evaluate(t,n,a,c,d,p){return this._styleExpression.evaluate(t,n,a,c,d,p)}}class vc{constructor(t,n,a,c){this.kind=t,this.zoomStops=a,this._styleExpression=n,this.isStateDependent=t!=="camera"&&!Fs(n.expression),this.interpolationType=c}evaluateWithoutErrorHandling(t,n,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,n,a,c,d,p)}evaluate(t,n,a,c,d,p){return this._styleExpression.evaluate(t,n,a,c,d,p)}interpolationFactor(t,n,a){return this.interpolationType?Tr.interpolationFactor(this.interpolationType,t,n,a):0}}function wh(r,t){const n=js(r,t);if(n.result==="error")return n;const a=n.value.expression,c=$o(a);if(!c&&!rs(t))return is([new Ct("","data expressions not supported")]);const d=Go(a,["zoom"]);if(!d&&!bh(t))return is([new Ct("","zoom expressions not supported")]);const p=Xo(a);return p||d?p instanceof Ct?is([p]):p instanceof Tr&&!gc(t)?is([new Ct("",'"interpolate" expressions cannot be used with this property')]):vh(p?new vc(c?"camera":"composite",n.value,p.labels,p instanceof Tr?p.interpolation:void 0):new xc(c?"constant":"source",n.value)):is([new Ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Wo{constructor(t,n){this._parameters=t,this._specification=n,at(this,Ho(this._parameters,this._specification))}static deserialize(t){return new Wo(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Xo(r){let t=null;if(r instanceof Wa)t=Xo(r.result);else if(r instanceof zs){for(const n of r.args)if(t=Xo(n),t)break}else(r instanceof ks||r instanceof Tr)&&r.input instanceof $r&&r.input.name==="zoom"&&(t=r);return t instanceof Ct||r.eachChild(n=>{const a=Xo(n);a instanceof Ct?t=a:!t&&a?t=new Ct("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new Ct("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Ko(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const t of r.slice(1))if(!Ko(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const Th={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function bc(r){if(r==null)return{filter:()=>!0,needGeometry:!1};Ko(r)||(r=Ns(r));const t=js(r,Th);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,a,c)=>t.value.evaluate(n,a,{},c),needGeometry:wc(r)}}function sp(r,t){return r<t?-1:r>t?1:0}function wc(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let t=1;t<r.length;t++)if(wc(r[t]))return!0;return!1}function Ns(r){if(!r)return!0;const t=r[0];return r.length<=1?t!=="any":t==="=="?Yo(r[1],r[2],"=="):t==="!="?ns(Yo(r[1],r[2],"==")):t==="<"||t===">"||t==="<="||t===">="?Yo(r[1],r[2],t):t==="any"?(n=r.slice(1),["any"].concat(n.map(Ns))):t==="all"?["all"].concat(r.slice(1).map(Ns)):t==="none"?["all"].concat(r.slice(1).map(Ns).map(ns)):t==="in"?Tc(r[1],r.slice(2)):t==="!in"?ns(Tc(r[1],r.slice(2))):t==="has"?Jo(r[1]):t!=="!has"||ns(Jo(r[1]));var n}function Yo(r,t,n){switch(r){case"$type":return[`filter-type-${n}`,t];case"$id":return[`filter-id-${n}`,t];default:return[`filter-${n}`,r,t]}}function Tc(r,t){if(t.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(n=>typeof n!=typeof t[0])?["filter-in-large",r,["literal",t.sort(sp)]]:["filter-in-small",r,["literal",t]]}}function Jo(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function ns(r){return["!",r]}function Zs(r){const t=typeof r;if(t==="number"||t==="boolean"||t==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let c="[";for(const d of r)c+=`${Zs(d)},`;return`${c}]`}const n=Object.keys(r).sort();let a="{";for(let c=0;c<n.length;c++)a+=`${JSON.stringify(n[c])}:${Zs(r[n[c]])},`;return`${a}}`}function Qo(r){let t="";for(const n of ce)t+=`/${Zs(r[n])}`;return t}function Mh(r){const t=r.value;return t?[new Me(r.key,t,"constants have been deprecated as of v8")]:[]}function Si(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function Sa(r){if(Array.isArray(r))return r.map(Sa);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const t={};for(const n in r)t[n]=Sa(r[n]);return t}return Si(r)}function Gr(r){const t=r.key,n=r.value,a=r.valueSpec||{},c=r.objectElementValidators||{},d=r.style,p=r.styleSpec,g=r.validateSpec;let x=[];const w=At(n);if(w!=="object")return[new Me(t,n,`object expected, ${w} found`)];for(const M in n){const C=M.split(".")[0],A=a[C]||a["*"];let L;if(c[C])L=c[C];else if(a[C])L=g;else if(c["*"])L=c["*"];else{if(!a["*"]){x.push(new Me(t,n[M],`unknown property "${M}"`));continue}L=g}x=x.concat(L({key:(t&&`${t}.`)+M,value:n[M],valueSpec:A,style:d,styleSpec:p,object:n,objectKey:M,validateSpec:g},n))}for(const M in a)c[M]||a[M].required&&a[M].default===void 0&&n[M]===void 0&&x.push(new Me(t,n,`missing required property "${M}"`));return x}function Mc(r){const t=r.value,n=r.valueSpec,a=r.style,c=r.styleSpec,d=r.key,p=r.arrayElementValidator||r.validateSpec;if(At(t)!=="array")return[new Me(d,t,`array expected, ${At(t)} found`)];if(n.length&&t.length!==n.length)return[new Me(d,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new Me(d,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let g={type:n.value,values:n.values};c.$version<7&&(g.function=n.function),At(n.value)==="object"&&(g=n.value);let x=[];for(let w=0;w<t.length;w++)x=x.concat(p({array:t,arrayIndex:w,value:t[w],valueSpec:g,validateSpec:r.validateSpec,style:a,styleSpec:c,key:`${d}[${w}]`}));return x}function Sc(r){const t=r.key,n=r.value,a=r.valueSpec;let c=At(n);return c==="number"&&n!=n&&(c="NaN"),c!=="number"?[new Me(t,n,`number expected, ${c} found`)]:"minimum"in a&&n<a.minimum?[new Me(t,n,`${n} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&n>a.maximum?[new Me(t,n,`${n} is greater than the maximum value ${a.maximum}`)]:[]}function Pc(r){const t=r.valueSpec,n=Si(r.value.type);let a,c,d,p={};const g=n!=="categorical"&&r.value.property===void 0,x=!g,w=At(r.value.stops)==="array"&&At(r.value.stops[0])==="array"&&At(r.value.stops[0][0])==="object",M=Gr({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(L){if(n==="identity")return[new Me(L.key,L.value,'identity function may not have a "stops" property')];let B=[];const j=L.value;return B=B.concat(Mc({key:L.key,value:j,valueSpec:L.valueSpec,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec,arrayElementValidator:C})),At(j)==="array"&&j.length===0&&B.push(new Me(L.key,j,"array must have at least one stop")),B},default:function(L){return L.validateSpec({key:L.key,value:L.value,valueSpec:t,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec})}}});return n==="identity"&&g&&M.push(new Me(r.key,r.value,'missing required property "property"')),n==="identity"||r.value.stops||M.push(new Me(r.key,r.value,'missing required property "stops"')),n==="exponential"&&r.valueSpec.expression&&!gc(r.valueSpec)&&M.push(new Me(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(x&&!rs(r.valueSpec)?M.push(new Me(r.key,r.value,"property functions not supported")):g&&!bh(r.valueSpec)&&M.push(new Me(r.key,r.value,"zoom functions not supported"))),n!=="categorical"&&!w||r.value.property!==void 0||M.push(new Me(r.key,r.value,'"property" property is required')),M;function C(L){let B=[];const j=L.value,$=L.key;if(At(j)!=="array")return[new Me($,j,`array expected, ${At(j)} found`)];if(j.length!==2)return[new Me($,j,`array length 2 expected, length ${j.length} found`)];if(w){if(At(j[0])!=="object")return[new Me($,j,`object expected, ${At(j[0])} found`)];if(j[0].zoom===void 0)return[new Me($,j,"object stop key must have zoom")];if(j[0].value===void 0)return[new Me($,j,"object stop key must have value")];if(d&&d>Si(j[0].zoom))return[new Me($,j[0].zoom,"stop zoom values must appear in ascending order")];Si(j[0].zoom)!==d&&(d=Si(j[0].zoom),c=void 0,p={}),B=B.concat(Gr({key:`${$}[0]`,value:j[0],valueSpec:{zoom:{}},validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec,objectElementValidators:{zoom:Sc,value:A}}))}else B=B.concat(A({key:`${$}[0]`,value:j[0],validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec},j));return Ma(Sa(j[1]))?B.concat([new Me(`${$}[1]`,j[1],"expressions are not allowed in function stops.")]):B.concat(L.validateSpec({key:`${$}[1]`,value:j[1],valueSpec:t,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec}))}function A(L,B){const j=At(L.value),$=Si(L.value),X=L.value!==null?L.value:B;if(a){if(j!==a)return[new Me(L.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 Me(L.key,X,"stop domain value must be a number, string, or boolean")];if(j!=="number"&&n!=="categorical"){let se=`number expected, ${j} found`;return rs(t)&&n===void 0&&(se+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new Me(L.key,X,se)]}return n!=="categorical"||j!=="number"||isFinite($)&&Math.floor($)===$?n!=="categorical"&&j==="number"&&c!==void 0&&$<c?[new Me(L.key,X,"stop domain values must appear in ascending order")]:(c=$,n==="categorical"&&$ in p?[new Me(L.key,X,"stop domain values must be unique")]:(p[$]=!0,[])):[new Me(L.key,X,`integer expected, found ${$}`)]}}function Pa(r){const t=(r.expressionContext==="property"?wh:js)(Sa(r.value),r.valueSpec);if(t.result==="error")return t.value.map(a=>new Me(`${r.key}${a.key}`,r.value,a.message));const n=t.value.expression||t.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!n.outputDefined())return[new Me(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!Fs(n))return[new Me(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!Fs(n))return[new Me(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Go(n,["zoom","feature-state"]))return[new Me(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!$o(n))return[new Me(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Qn(r){const t=r.key,n=r.value,a=r.valueSpec,c=[];return Array.isArray(a.values)?a.values.indexOf(Si(n))===-1&&c.push(new Me(t,n,`expected one of [${a.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(a.values).indexOf(Si(n))===-1&&c.push(new Me(t,n,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(n)} found`)),c}function Cc(r){return Ko(Sa(r.value))?Pa(at({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ic(r)}function Ic(r){const t=r.value,n=r.key;if(At(t)!=="array")return[new Me(n,t,`array expected, ${At(t)} found`)];const a=r.styleSpec;let c,d=[];if(t.length<1)return[new Me(n,t,"filter array must have at least 1 element")];switch(d=d.concat(Qn({key:`${n}[0]`,value:t[0],valueSpec:a.filter_operator,style:r.style,styleSpec:r.styleSpec})),Si(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Si(t[1])==="$type"&&d.push(new Me(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new Me(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(c=At(t[1]),c!=="string"&&d.push(new Me(`${n}[1]`,t[1],`string expected, ${c} found`)));for(let p=2;p<t.length;p++)c=At(t[p]),Si(t[1])==="$type"?d=d.concat(Qn({key:`${n}[${p}]`,value:t[p],valueSpec:a.geometry_type,style:r.style,styleSpec:r.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&d.push(new Me(`${n}[${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(Ic({key:`${n}[${p}]`,value:t[p],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":c=At(t[1]),t.length!==2?d.push(new Me(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):c!=="string"&&d.push(new Me(`${n}[1]`,t[1],`string expected, ${c} found`))}return d}function Ec(r,t){const n=r.key,a=r.validateSpec,c=r.style,d=r.styleSpec,p=r.value,g=r.objectKey,x=d[`${t}_${r.layerType}`];if(!x)return[];const w=g.match(/^(.*)-transition$/);if(t==="paint"&&w&&x[w[1]]&&x[w[1]].transition)return a({key:n,value:p,valueSpec:d.transition,style:c,styleSpec:d});const M=r.valueSpec||x[g];if(!M)return[new Me(n,p,`unknown property "${g}"`)];let C;if(At(p)==="string"&&rs(M)&&!M.tokens&&(C=/^{([^}]+)}$/.exec(p)))return[new Me(n,p,`"${g}" does not support interpolation syntax
6
+ Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(C[1])} }\`.`)];const A=[];return r.layerType==="symbol"&&(g==="text-field"&&c&&!c.glyphs&&A.push(new Me(n,p,'use of "text-field" requires a style "glyphs" property')),g==="text-font"&&qo(Sa(p))&&Si(p.type)==="identity"&&A.push(new Me(n,p,'"text-font" does not support identity functions'))),A.concat(a({key:r.key,value:p,valueSpec:M,style:c,styleSpec:d,expressionContext:"property",propertyType:t,propertyKey:g}))}function Sh(r){return Ec(r,"paint")}function kc(r){return Ec(r,"layout")}function zc(r){let t=[];const n=r.value,a=r.key,c=r.style,d=r.styleSpec;n.type||n.ref||t.push(new Me(a,n,'either "type" or "ref" is required'));let p=Si(n.type);const g=Si(n.ref);if(n.id){const x=Si(n.id);for(let w=0;w<r.arrayIndex;w++){const M=c.layers[w];Si(M.id)===x&&t.push(new Me(a,n.id,`duplicate layer id "${n.id}", previously used at line ${M.id.__line__}`))}}if("ref"in n){let x;["type","source","source-layer","filter","layout"].forEach(w=>{w in n&&t.push(new Me(a,n[w],`"${w}" is prohibited for ref layers`))}),c.layers.forEach(w=>{Si(w.id)===g&&(x=w)}),x?x.ref?t.push(new Me(a,n.ref,"ref cannot reference another ref layer")):p=Si(x.type):t.push(new Me(a,n.ref,`ref layer "${g}" not found`))}else if(p!=="background")if(n.source){const x=c.sources&&c.sources[n.source],w=x&&Si(x.type);x?w==="vector"&&p==="raster"?t.push(new Me(a,n.source,`layer "${n.id}" requires a raster source`)):w!=="raster-dem"&&p==="hillshade"?t.push(new Me(a,n.source,`layer "${n.id}" requires a raster-dem source`)):w==="raster"&&p!=="raster"?t.push(new Me(a,n.source,`layer "${n.id}" requires a vector source`)):w!=="vector"||n["source-layer"]?w==="raster-dem"&&p!=="hillshade"?t.push(new Me(a,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!n.paint||!n.paint["line-gradient"]||w==="geojson"&&x.lineMetrics||t.push(new Me(a,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new Me(a,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new Me(a,n.source,`source "${n.source}" not found`))}else t.push(new Me(a,n,'missing required property "source"'));return t=t.concat(Gr({key:a,value:n,valueSpec:d.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${a}.type`,value:n.type,valueSpec:d.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:n,objectKey:"type"}),filter:Cc,layout:x=>Gr({layer:n,key:x.key,value:x.value,style:x.style,styleSpec:x.styleSpec,validateSpec:x.validateSpec,objectElementValidators:{"*":w=>kc(at({layerType:p},w))}}),paint:x=>Gr({layer:n,key:x.key,value:x.value,style:x.style,styleSpec:x.styleSpec,validateSpec:x.validateSpec,objectElementValidators:{"*":w=>Sh(at({layerType:p},w))}})}})),t}function en(r){const t=r.value,n=r.key,a=At(t);return a!=="string"?[new Me(n,t,`string expected, ${a} found`)]:[]}const Ph={promoteId:function({key:r,value:t}){if(At(t)==="string")return en({key:r,value:t});{const n=[];for(const a in t)n.push(...en({key:`${r}.${a}`,value:t[a]}));return n}}};function Ch(r){const t=r.value,n=r.key,a=r.styleSpec,c=r.style,d=r.validateSpec;if(!t.type)return[new Me(n,t,'"type" is required')];const p=Si(t.type);let g;switch(p){case"vector":case"raster":return g=Gr({key:n,value:t,valueSpec:a[`source_${p.replace("-","_")}`],style:r.style,styleSpec:a,objectElementValidators:Ph,validateSpec:d}),g;case"raster-dem":return g=function(x){var w;const M=(w=x.sourceName)!==null&&w!==void 0?w:"",C=x.value,A=x.styleSpec,L=A.source_raster_dem,B=x.style;let j=[];const $=At(C);if(C===void 0)return j;if($!=="object")return j.push(new Me("source_raster_dem",C,`object expected, ${$} found`)),j;const X=Si(C.encoding)==="custom",se=["redFactor","greenFactor","blueFactor","baseShift"],Y=x.value.encoding?`"${x.value.encoding}"`:"Default";for(const R in C)!X&&se.includes(R)?j.push(new Me(R,C[R],`In "${M}": "${R}" is only valid when "encoding" is set to "custom". ${Y} encoding found`)):L[R]?j=j.concat(x.validateSpec({key:R,value:C[R],valueSpec:L[R],validateSpec:x.validateSpec,style:B,styleSpec:A})):j.push(new Me(R,C[R],`unknown property "${R}"`));return j}({sourceName:n,value:t,style:r.style,styleSpec:a,validateSpec:d}),g;case"geojson":if(g=Gr({key:n,value:t,valueSpec:a.source_geojson,style:c,styleSpec:a,validateSpec:d,objectElementValidators:Ph}),t.cluster)for(const x in t.clusterProperties){const[w,M]=t.clusterProperties[x],C=typeof w=="string"?[w,["accumulated"],["get",x]]:w;g.push(...Pa({key:`${n}.${x}.map`,value:M,expressionContext:"cluster-map"})),g.push(...Pa({key:`${n}.${x}.reduce`,value:C,expressionContext:"cluster-reduce"}))}return g;case"video":return Gr({key:n,value:t,valueSpec:a.source_video,style:c,validateSpec:d,styleSpec:a});case"image":return Gr({key:n,value:t,valueSpec:a.source_image,style:c,validateSpec:d,styleSpec:a});case"canvas":return[new Me(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Qn({key:`${n}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function Ih(r){const t=r.value,n=r.styleSpec,a=n.light,c=r.style;let d=[];const p=At(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new Me("light",t,`object expected, ${p} found`)]),d;for(const g in t){const x=g.match(/^(.*)-transition$/);d=d.concat(x&&a[x[1]]&&a[x[1]].transition?r.validateSpec({key:g,value:t[g],valueSpec:n.transition,validateSpec:r.validateSpec,style:c,styleSpec:n}):a[g]?r.validateSpec({key:g,value:t[g],valueSpec:a[g],validateSpec:r.validateSpec,style:c,styleSpec:n}):[new Me(g,t[g],`unknown property "${g}"`)])}return d}function Eh(r){const t=r.value,n=r.styleSpec,a=n.sky,c=r.style,d=At(t);if(t===void 0)return[];if(d!=="object")return[new Me("sky",t,`object expected, ${d} found`)];let p=[];for(const g in t)p=p.concat(a[g]?r.validateSpec({key:g,value:t[g],valueSpec:a[g],style:c,styleSpec:n}):[new Me(g,t[g],`unknown property "${g}"`)]);return p}function kh(r){const t=r.value,n=r.styleSpec,a=n.terrain,c=r.style;let d=[];const p=At(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new Me("terrain",t,`object expected, ${p} found`)]),d;for(const g in t)d=d.concat(a[g]?r.validateSpec({key:g,value:t[g],valueSpec:a[g],validateSpec:r.validateSpec,style:c,styleSpec:n}):[new Me(g,t[g],`unknown property "${g}"`)]);return d}function zh(r){let t=[];const n=r.value,a=r.key;if(Array.isArray(n)){const c=[],d=[];for(const p in n)n[p].id&&c.includes(n[p].id)&&t.push(new Me(a,n,`all the sprites' ids must be unique, but ${n[p].id} is duplicated`)),c.push(n[p].id),n[p].url&&d.includes(n[p].url)&&t.push(new Me(a,n,`all the sprites' URLs must be unique, but ${n[p].url} is duplicated`)),d.push(n[p].url),t=t.concat(Gr({key:`${a}[${p}]`,value:n[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return t}return en({key:a,value:n})}const as={"*":()=>[],array:Mc,boolean:function(r){const t=r.value,n=r.key,a=At(t);return a!=="boolean"?[new Me(n,t,`boolean expected, ${a} found`)]:[]},number:Sc,color:function(r){const t=r.key,n=r.value,a=At(n);return a!=="string"?[new Me(t,n,`color expected, ${a} found`)]:gt.parse(String(n))?[]:[new Me(t,n,`color expected, "${n}" found`)]},constants:Mh,enum:Qn,filter:Cc,function:Pc,layer:zc,object:Gr,source:Ch,light:Ih,sky:Eh,terrain:kh,projection:function(r){const t=r.value,n=r.styleSpec,a=n.projection,c=r.style,d=At(t);if(t===void 0)return[];if(d!=="object")return[new Me("projection",t,`object expected, ${d} found`)];let p=[];for(const g in t)p=p.concat(a[g]?r.validateSpec({key:g,value:t[g],valueSpec:a[g],style:c,styleSpec:n}):[new Me(g,t[g],`unknown property "${g}"`)]);return p},projectionDefinition:function(r){const t=r.key;let n=r.value;n=n instanceof String?n.valueOf():n;const a=At(n);return a!=="array"||function(c){return Array.isArray(c)&&c.length===3&&typeof c[0]=="string"&&typeof c[1]=="string"&&typeof c[2]=="number"}(n)||function(c){return!!["interpolate","step","literal"].includes(c[0])}(n)?["array","string"].includes(a)?[]:[new Me(t,n,`projection expected, invalid type "${a}" found`)]:[new Me(t,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:en,formatted:function(r){return en(r).length===0?[]:Pa(r)},resolvedImage:function(r){return en(r).length===0?[]:Pa(r)},padding:function(r){const t=r.key,n=r.value;if(At(n)==="array"){if(n.length<1||n.length>4)return[new Me(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];const a={type:"number"};let c=[];for(let d=0;d<n.length;d++)c=c.concat(r.validateSpec({key:`${t}[${d}]`,value:n[d],validateSpec:r.validateSpec,valueSpec:a}));return c}return Sc({key:t,value:n,valueSpec:{}})},variableAnchorOffsetCollection:function(r){const t=r.key,n=r.value,a=At(n),c=r.styleSpec;if(a!=="array"||n.length<1||n.length%2!=0)return[new Me(t,n,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let p=0;p<n.length;p+=2)d=d.concat(Qn({key:`${t}[${p}]`,value:n[p],valueSpec:c.layout_symbol["text-anchor"]})),d=d.concat(Mc({key:`${t}[${p+1}]`,value:n[p+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:c}));return d},sprite:zh};function ea(r){const t=r.value,n=r.valueSpec,a=r.styleSpec;return r.validateSpec=ea,n.expression&&qo(Si(t))?Pc(r):n.expression&&Ma(Sa(t))?Pa(r):n.type&&as[n.type]?as[n.type](r):Gr(at({},r,{valueSpec:n.type?a[n.type]:n}))}function Mr(r){const t=r.value,n=r.key,a=en(r);return a.length||(t.indexOf("{fontstack}")===-1&&a.push(new Me(n,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&a.push(new Me(n,t,'"glyphs" url must include a "{range}" token'))),a}function gr(r,t=V){let n=[];return n=n.concat(ea({key:"",value:r,valueSpec:t.$root,styleSpec:t,style:r,validateSpec:ea,objectElementValidators:{glyphs:Mr,"*":()=>[]}})),r.constants&&(n=n.concat(Mh({key:"constants",value:r.constants}))),Ah(n)}function tn(r){return function(t){return r({...t,validateSpec:ea})}}function Ah(r){return[].concat(r).sort((t,n)=>t.line-n.line)}function mn(r){return function(...t){return Ah(r.apply(this,t))}}gr.source=mn(tn(Ch)),gr.sprite=mn(tn(zh)),gr.glyphs=mn(tn(Mr)),gr.light=mn(tn(Ih)),gr.sky=mn(tn(Eh)),gr.terrain=mn(tn(kh)),gr.layer=mn(tn(zc)),gr.filter=mn(tn(Cc)),gr.paintProperty=mn(tn(Sh)),gr.layoutProperty=mn(tn(kc));const gn=gr,Rh=gn.light,Ac=gn.sky,op=gn.paintProperty,Rc=gn.layoutProperty;function Dh(r,t){let n=!1;if(t&&t.length)for(const a of t)r.fire(new G(new Error(a.message))),n=!0;return n}class kn{constructor(t,n,a){const c=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const p=new Int32Array(this.arrayBuffer);t=p[0],this.d=(n=p[1])+2*(a=p[2]);for(let x=0;x<this.d*this.d;x++){const w=p[3+x],M=p[3+x+1];c.push(w===M?null:p.subarray(w,M))}const g=p[3+c.length+1];this.keys=p.subarray(p[3+c.length],g),this.bboxes=p.subarray(g),this.insert=this._insertReadonly}else{this.d=n+2*a;for(let p=0;p<this.d*this.d;p++)c.push([]);this.keys=[],this.bboxes=[]}this.n=n,this.extent=t,this.padding=a,this.scale=n/t,this.uid=0;const d=a/n*t;this.min=-d,this.max=t+d}insert(t,n,a,c,d){this._forEachCell(n,a,c,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(c),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,n,a,c,d,p){this.cells[d].push(p)}query(t,n,a,c,d){const p=this.min,g=this.max;if(t<=p&&n<=p&&g<=a&&g<=c&&!d)return Array.prototype.slice.call(this.keys);{const x=[];return this._forEachCell(t,n,a,c,this._queryCell,x,{},d),x}}_queryCell(t,n,a,c,d,p,g,x){const w=this.cells[d];if(w!==null){const M=this.keys,C=this.bboxes;for(let A=0;A<w.length;A++){const L=w[A];if(g[L]===void 0){const B=4*L;(x?x(C[B+0],C[B+1],C[B+2],C[B+3]):t<=C[B+2]&&n<=C[B+3]&&a>=C[B+0]&&c>=C[B+1])?(g[L]=!0,p.push(M[L])):g[L]=!1}}}}_forEachCell(t,n,a,c,d,p,g,x){const w=this._convertToCellCoord(t),M=this._convertToCellCoord(n),C=this._convertToCellCoord(a),A=this._convertToCellCoord(c);for(let L=w;L<=C;L++)for(let B=M;B<=A;B++){const j=this.d*B+L;if((!x||x(this._convertFromCellCoord(L),this._convertFromCellCoord(B),this._convertFromCellCoord(L+1),this._convertFromCellCoord(B+1)))&&d.call(this,t,n,a,c,j,p,g,x))return}}_convertFromCellCoord(t){return(t-this.padding)/this.scale}_convertToCellCoord(t){return Math.max(0,Math.min(this.d-1,Math.floor(t*this.scale)+this.padding))}toArrayBuffer(){if(this.arrayBuffer)return this.arrayBuffer;const t=this.cells,n=3+this.cells.length+1+1;let a=0;for(let p=0;p<this.cells.length;p++)a+=this.cells[p].length;const c=new Int32Array(n+a+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let d=n;for(let p=0;p<t.length;p++){const g=t[p];c[3+p]=d,c.set(g,d),d+=g.length}return c[3+t.length]=d,c.set(this.keys,d),d+=this.keys.length,c[3+t.length+1]=d,c.set(this.bboxes,d),d+=this.bboxes.length,c.buffer}static serialize(t,n){const a=t.toArrayBuffer();return n&&n.push(a),{buffer:a}}static deserialize(t){return new kn(t.buffer)}}const zn={};function Ue(r,t,n={}){if(zn[r])throw new Error(`${r} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:r,writeable:!1}),zn[r]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}Ue("Object",Object),Ue("TransferableGridIndex",kn),Ue("Color",gt),Ue("Error",Error),Ue("AJAXError",Li),Ue("ResolvedImage",Rr),Ue("StylePropertyFunction",Wo),Ue("StyleExpression",yc,{omit:["_evaluator"]}),Ue("ZoomDependentExpression",vc),Ue("ZoomConstantExpression",xc),Ue("CompoundExpression",$r,{omit:["_evaluate"]});for(const r in ts)ts[r]._classRegistryKey||Ue(`Expression_${r}`,ts[r]);function Lh(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function Dc(r){return r.$name||r.constructor._classRegistryKey}function Vs(r){return!function(t){if(t===null||typeof t!="object")return!1;const n=Dc(t);return!(!n||n==="Object")}(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||Lh(r)||Vi(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function Us(r,t){if(Vs(r))return(Lh(r)||Vi(r))&&t&&t.push(r),ArrayBuffer.isView(r)&&t&&t.push(r.buffer),r instanceof ImageData&&t&&t.push(r.data.buffer),r;if(Array.isArray(r)){const d=[];for(const p of r)d.push(Us(p,t));return d}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const n=Dc(r);if(!n)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!zn[n])throw new Error(`${n} is not registered.`);const{klass:a}=zn[n],c=a.serialize?a.serialize(r,t):{};if(a.serialize){if(t&&c===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in r){if(!r.hasOwnProperty(d)||zn[n].omit.indexOf(d)>=0)continue;const p=r[d];c[d]=zn[n].shallow.indexOf(d)>=0?p:Us(p,t)}r instanceof Error&&(c.message=r.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(c.$name=n),c}function Ca(r){if(Vs(r))return r;if(Array.isArray(r))return r.map(Ca);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const t=Dc(r)||"Object";if(!zn[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:n}=zn[t];if(!n)throw new Error(`can't deserialize unregistered class ${t}`);if(n.deserialize)return n.deserialize(r);const a=Object.create(n.prototype);for(const c of Object.keys(r)){if(c==="$name")continue;const d=r[c];a[c]=zn[t].shallow.indexOf(c)>=0?d:Ca(d)}return a}class $s{constructor(){this.first=!0}update(t,n){const a=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=n):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=n),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=a,!0))}}const vt={"Latin-1 Supplement":r=>r>=128&&r<=255,"Hangul Jamo":r=>r>=4352&&r<=4607,Khmer:r=>r>=6016&&r<=6143,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Kanbun:r=>r>=12688&&r<=12703,"CJK Strokes":r=>r>=12736&&r<=12783,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Hangul Syllables":r=>r>=44032&&r<=55215,"Private Use Area":r=>r>=57344&&r<=63743,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519};function el(r){for(const t of r)if(il(t.charCodeAt(0)))return!0;return!1}function Bh(r){for(const t of r)if(!Fh(t.charCodeAt(0)))return!1;return!0}function tl(r){const t=r.map(n=>{try{return new RegExp(`\\p{sc=${n}}`,"u").source}catch{return null}}).filter(n=>n);return new RegExp(t.join("|"),"u")}const Lc=tl(["Arab","Dupl","Mong","Ougr","Syrc"]);function Fh(r){return!Lc.test(String.fromCodePoint(r))}const Oh=tl(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function il(r){return!(r!==746&&r!==747&&(r<4352||!(vt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||vt["CJK Compatibility"](r)||vt["CJK Strokes"](r)||!(!vt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||vt["Enclosed CJK Letters and Months"](r)||vt["Ideographic Description Characters"](r)||vt.Kanbun(r)||vt.Katakana(r)&&r!==12540||!(!vt["Halfwidth and Fullwidth Forms"](r)||r===65288||r===65289||r===65293||r>=65306&&r<=65310||r===65339||r===65341||r===65343||r>=65371&&r<=65503||r===65507||r>=65512&&r<=65519)||!(!vt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||vt["Vertical Forms"](r)||vt["Yijing Hexagram Symbols"](r)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(r))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(r))||Oh.test(String.fromCodePoint(r)))))}function jh(r){return!(il(r)||function(t){return!!(vt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||vt["General Punctuation"](t)&&(t===8214||t===8224||t===8225||t===8240||t===8241||t===8251||t===8252||t===8258||t===8263||t===8264||t===8265||t===8273)||vt["Letterlike Symbols"](t)||vt["Number Forms"](t)||vt["Miscellaneous Technical"](t)&&(t>=8960&&t<=8967||t>=8972&&t<=8991||t>=8996&&t<=9e3||t===9003||t>=9085&&t<=9114||t>=9150&&t<=9165||t===9167||t>=9169&&t<=9179||t>=9186&&t<=9215)||vt["Control Pictures"](t)&&t!==9251||vt["Optical Character Recognition"](t)||vt["Enclosed Alphanumerics"](t)||vt["Geometric Shapes"](t)||vt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||vt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||vt["CJK Symbols and Punctuation"](t)||vt.Katakana(t)||vt["Private Use Area"](t)||vt["CJK Compatibility Forms"](t)||vt["Small Form Variants"](t)||vt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(r))}const Nh=tl(["Adlm","Arab","Armi","Avst","Chrs","Cprt","Egyp","Elym","Gara","Hatr","Hebr","Hung","Khar","Lydi","Mand","Mani","Mend","Merc","Mero","Narb","Nbat","Nkoo","Orkh","Palm","Phli","Phlp","Phnx","Prti","Rohg","Samr","Sarb","Sogo","Syrc","Thaa","Todr","Yezi"]);function Bc(r){return Nh.test(String.fromCodePoint(r))}function Zh(r,t){return!(!t&&Bc(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||vt.Khmer(r))}function lp(r){for(const t of r)if(Bc(t.charCodeAt(0)))return!0;return!1}const ta=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(ta.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,t){return o(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const n=r.pluginURL,a=new Promise(d=>{this.loadScriptResolve=d});t(n);const c=new Promise(d=>setTimeout(()=>d(),this.TIMEOUT));if(yield Promise.race([a,c]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:n};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)})}};class ti{constructor(t,n){this.zoom=t,n?(this.now=n.now,this.fadeDuration=n.fadeDuration,this.zoomHistory=n.zoomHistory,this.transition=n.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new $s,this.transition={})}isSupportedScript(t){return function(n,a){for(const c of n)if(!Zh(c.charCodeAt(0),a))return!1;return!0}(t,ta.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,n=t-Math.floor(t),a=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:n+(1-n)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*n}}}class Gs{constructor(t,n){this.property=t,this.value=n,this.expression=function(a,c){if(qo(a))return new Wo(a,c);if(Ma(a)){const d=wh(a,c);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=a;return c.type==="color"&&typeof a=="string"?d=gt.parse(a):c.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?c.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?d=Yi.parse(a):c.type==="projectionDefinition"&&typeof a=="string"&&(d=mr.parse(a)):d=sr.parse(a),{kind:"constant",evaluate:()=>d}}}(n===void 0?t.specification.default:n,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,n,a){return this.property.possiblyEvaluate(this,t,n,a)}}class rl{constructor(t){this.property=t,this.value=new Gs(t,void 0)}transitioned(t,n){return new qs(this.property,this.value,n,hr({},t.transition,this.transition),t.now)}untransitioned(){return new qs(this.property,this.value,null,{},0)}}class Fc{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return dr(this._values[t].value.value)}setValue(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new rl(this._values[t].property)),this._values[t].value=new Gs(this._values[t].property,n===null?void 0:dr(n))}getTransition(t){return dr(this._values[t].transition)}setTransition(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new rl(this._values[t].property)),this._values[t].transition=dr(n)||void 0}serialize(){const t={};for(const n of Object.keys(this._values)){const a=this.getValue(n);a!==void 0&&(t[n]=a);const c=this.getTransition(n);c!==void 0&&(t[`${n}-transition`]=c)}return t}transitioned(t,n){const a=new Vh(this._properties);for(const c of Object.keys(this._values))a._values[c]=this._values[c].transitioned(t,n._values[c]);return a}untransitioned(){const t=new Vh(this._properties);for(const n of Object.keys(this._values))t._values[n]=this._values[n].untransitioned();return t}}class qs{constructor(t,n,a,c,d){this.property=t,this.value=n,this.begin=d+c.delay||0,this.end=this.begin+c.duration||0,t.specification.transition&&(c.delay||c.duration)&&(this.prior=a)}possiblyEvaluate(t,n,a){const c=t.now||0,d=this.value.possiblyEvaluate(t,n,a),p=this.prior;if(p){if(c>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(c<this.begin)return p.possiblyEvaluate(t,n,a);{const g=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(t,n,a),d,yi(g))}}return d}}class Vh{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,n,a){const c=new nl(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,n,a);return c}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Oc{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return dr(this._values[t].value)}setValue(t,n){this._values[t]=new Gs(this._values[t].property,n===null?void 0:dr(n))}serialize(){const t={};for(const n of Object.keys(this._values)){const a=this.getValue(n);a!==void 0&&(t[n]=a)}return t}possiblyEvaluate(t,n,a){const c=new nl(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,n,a);return c}}class _n{constructor(t,n,a){this.property=t,this.value=n,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,n,a,c){return this.property.evaluate(this.value,this.parameters,t,n,a,c)}}class nl{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Ye{constructor(t){this.specification=t}possiblyEvaluate(t,n){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(n)}interpolate(t,n,a){const c=Qt[this.specification.type];return c?c(t,n,a):t}}class nt{constructor(t,n){this.specification=t,this.overrides=n}possiblyEvaluate(t,n,a,c){return new _n(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(n,null,{},a,c)}:t.expression,n)}interpolate(t,n,a){if(t.value.kind!=="constant"||n.value.kind!=="constant")return t;if(t.value.value===void 0||n.value.value===void 0)return new _n(this,{kind:"constant",value:void 0},t.parameters);const c=Qt[this.specification.type];if(c){const d=c(t.value.value,n.value.value,a);return new _n(this,{kind:"constant",value:d},t.parameters)}return t}evaluate(t,n,a,c,d,p){return t.kind==="constant"?t.value:t.evaluate(n,a,c,d,p)}}class Hs extends nt{possiblyEvaluate(t,n,a,c){if(t.value===void 0)return new _n(this,{kind:"constant",value:void 0},n);if(t.expression.kind==="constant"){const d=t.expression.evaluate(n,null,{},a,c),p=t.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,g=this._calculate(p,p,p,n);return new _n(this,{kind:"constant",value:g},n)}if(t.expression.kind==="camera"){const d=this._calculate(t.expression.evaluate({zoom:n.zoom-1}),t.expression.evaluate({zoom:n.zoom}),t.expression.evaluate({zoom:n.zoom+1}),n);return new _n(this,{kind:"constant",value:d},n)}return new _n(this,t.expression,n)}evaluate(t,n,a,c,d,p){if(t.kind==="source"){const g=t.evaluate(n,a,c,d,p);return this._calculate(g,g,g,n)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(n.zoom)-1},a,c),t.evaluate({zoom:Math.floor(n.zoom)},a,c),t.evaluate({zoom:Math.floor(n.zoom)+1},a,c),n):t.value}_calculate(t,n,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:n}:{from:a,to:n}}interpolate(t){return t}}class jc{constructor(t){this.specification=t}possiblyEvaluate(t,n,a,c){if(t.value!==void 0){if(t.expression.kind==="constant"){const d=t.expression.evaluate(n,null,{},a,c);return this._calculate(d,d,d,n)}return this._calculate(t.expression.evaluate(new ti(Math.floor(n.zoom-1),n)),t.expression.evaluate(new ti(Math.floor(n.zoom),n)),t.expression.evaluate(new ti(Math.floor(n.zoom+1),n)),n)}}_calculate(t,n,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:n}:{from:a,to:n}}interpolate(t){return t}}class Nc{constructor(t){this.specification=t}possiblyEvaluate(t,n,a,c){return!!t.expression.evaluate(n,null,{},a,c)}interpolate(){return!1}}class Sr{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const n in t){const a=t[n];a.specification.overridable&&this.overridableProperties.push(n);const c=this.defaultPropertyValues[n]=new Gs(a,void 0),d=this.defaultTransitionablePropertyValues[n]=new rl(a);this.defaultTransitioningPropertyValues[n]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=c.possiblyEvaluate({})}}}Ue("DataDrivenProperty",nt),Ue("DataConstantProperty",Ye),Ue("CrossFadedDataDrivenProperty",Hs),Ue("CrossFadedProperty",jc),Ue("ColorRampProperty",Nc);const Uh="-transition";class yn extends J{constructor(t,n){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),n.layout&&(this._unevaluatedLayout=new Oc(n.layout)),n.paint)){this._transitionablePaint=new Fc(n.paint);for(const a in t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(const a in t.layout)this.setLayoutProperty(a,t.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new nl(n.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,n,a={}){n!=null&&this._validate(Rc,`layers.${this.id}.layout.${t}`,t,n,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,n):this.visibility=n)}getPaintProperty(t){return t.endsWith(Uh)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,n,a={}){if(n!=null&&this._validate(op,`layers.${this.id}.paint.${t}`,t,n,a))return!1;if(t.endsWith(Uh))return this._transitionablePaint.setTransition(t.slice(0,-11),n||void 0),!1;{const c=this._transitionablePaint._values[t],d=c.property.specification["property-type"]==="cross-faded-data-driven",p=c.value.isDataDriven(),g=c.value;this._transitionablePaint.setValue(t,n),this._handleSpecialPaintPropertyUpdate(t);const x=this._transitionablePaint._values[t].value;return x.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(t,g,x)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,n,a){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,n){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,n)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,n)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),ga(t,(n,a)=>!(n===void 0||a==="layout"&&!Object.keys(n).length||a==="paint"&&!Object.keys(n).length))}_validate(t,n,a,c,d={}){return(!d||d.validate!==!1)&&Dh(this,t.call(gn,{key:n,layerType:this.type,objectKey:a,value:c,styleSpec:V,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const n=this.paint.get(t);if(n instanceof _n&&rs(n.property.specification)&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}}const ss={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Ws{constructor(t,n){this._structArray=t,this._pos1=n*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class bi{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,n){return t._trim(),n&&(t.isTransferred=!0,n.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const n=Object.create(this.prototype);return n.arrayBuffer=t.arrayBuffer,n.length=t.length,n.capacity=t.arrayBuffer.byteLength/n.bytesPerElement,n._refreshViews(),n}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const n=this.uint8;this._refreshViews(),n&&this.uint8.set(n)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Ei(r,t=1){let n=0,a=0;return{members:r.map(c=>{const d=ss[c.type].BYTES_PER_ELEMENT,p=n=Zc(n,Math.max(t,d)),g=c.components||1;return a=Math.max(a,d),n+=d*g,{name:c.name,type:c.type,components:g,offset:p}}),size:Zc(n,Math.max(a,t)),alignment:t}}function Zc(r,t){return Math.ceil(r/t)*t}class Xs extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.int16[c+0]=n,this.int16[c+1]=a,t}}Xs.prototype.bytesPerElement=4,Ue("StructArrayLayout2i4",Xs);class al extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.int16[d+0]=n,this.int16[d+1]=a,this.int16[d+2]=c,t}}al.prototype.bytesPerElement=6,Ue("StructArrayLayout3i6",al);class An extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,n,a,c)}emplace(t,n,a,c,d){const p=4*t;return this.int16[p+0]=n,this.int16[p+1]=a,this.int16[p+2]=c,this.int16[p+3]=d,t}}An.prototype.bytesPerElement=8,Ue("StructArrayLayout4i8",An);class sl extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const g=this.length;return this.resize(g+1),this.emplace(g,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,g){const x=6*t;return this.int16[x+0]=n,this.int16[x+1]=a,this.int16[x+2]=c,this.int16[x+3]=d,this.int16[x+4]=p,this.int16[x+5]=g,t}}sl.prototype.bytesPerElement=12,Ue("StructArrayLayout2i4i12",sl);class Ks extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const g=this.length;return this.resize(g+1),this.emplace(g,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,g){const x=4*t,w=8*t;return this.int16[x+0]=n,this.int16[x+1]=a,this.uint8[w+4]=c,this.uint8[w+5]=d,this.uint8[w+6]=p,this.uint8[w+7]=g,t}}Ks.prototype.bytesPerElement=8,Ue("StructArrayLayout2i4ub8",Ks);class os extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.float32[c+0]=n,this.float32[c+1]=a,t}}os.prototype.bytesPerElement=8,Ue("StructArrayLayout2f8",os);class Ys extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,g,x,w,M){const C=this.length;return this.resize(C+1),this.emplace(C,t,n,a,c,d,p,g,x,w,M)}emplace(t,n,a,c,d,p,g,x,w,M,C){const A=10*t;return this.uint16[A+0]=n,this.uint16[A+1]=a,this.uint16[A+2]=c,this.uint16[A+3]=d,this.uint16[A+4]=p,this.uint16[A+5]=g,this.uint16[A+6]=x,this.uint16[A+7]=w,this.uint16[A+8]=M,this.uint16[A+9]=C,t}}Ys.prototype.bytesPerElement=20,Ue("StructArrayLayout10ui20",Ys);class Vc extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,g,x,w,M,C,A){const L=this.length;return this.resize(L+1),this.emplace(L,t,n,a,c,d,p,g,x,w,M,C,A)}emplace(t,n,a,c,d,p,g,x,w,M,C,A,L){const B=12*t;return this.int16[B+0]=n,this.int16[B+1]=a,this.int16[B+2]=c,this.int16[B+3]=d,this.uint16[B+4]=p,this.uint16[B+5]=g,this.uint16[B+6]=x,this.uint16[B+7]=w,this.int16[B+8]=M,this.int16[B+9]=C,this.int16[B+10]=A,this.int16[B+11]=L,t}}Vc.prototype.bytesPerElement=24,Ue("StructArrayLayout4i4ui4i24",Vc);class ls extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.float32[d+0]=n,this.float32[d+1]=a,this.float32[d+2]=c,t}}ls.prototype.bytesPerElement=12,Ue("StructArrayLayout3f12",ls);class Ia extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.uint32[1*t+0]=n,t}}Ia.prototype.bytesPerElement=4,Ue("StructArrayLayout1ul4",Ia);class Uc extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,g,x,w){const M=this.length;return this.resize(M+1),this.emplace(M,t,n,a,c,d,p,g,x,w)}emplace(t,n,a,c,d,p,g,x,w,M){const C=10*t,A=5*t;return this.int16[C+0]=n,this.int16[C+1]=a,this.int16[C+2]=c,this.int16[C+3]=d,this.int16[C+4]=p,this.int16[C+5]=g,this.uint32[A+3]=x,this.uint16[C+8]=w,this.uint16[C+9]=M,t}}Uc.prototype.bytesPerElement=20,Ue("StructArrayLayout6i1ul2ui20",Uc);class ol extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const g=this.length;return this.resize(g+1),this.emplace(g,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,g){const x=6*t;return this.int16[x+0]=n,this.int16[x+1]=a,this.int16[x+2]=c,this.int16[x+3]=d,this.int16[x+4]=p,this.int16[x+5]=g,t}}ol.prototype.bytesPerElement=12,Ue("StructArrayLayout2i2i2i12",ol);class Ea extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d){const p=this.length;return this.resize(p+1),this.emplace(p,t,n,a,c,d)}emplace(t,n,a,c,d,p){const g=4*t,x=8*t;return this.float32[g+0]=n,this.float32[g+1]=a,this.float32[g+2]=c,this.int16[x+6]=d,this.int16[x+7]=p,t}}Ea.prototype.bytesPerElement=16,Ue("StructArrayLayout2f1f2i16",Ea);class $c extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p){const g=this.length;return this.resize(g+1),this.emplace(g,t,n,a,c,d,p)}emplace(t,n,a,c,d,p,g){const x=16*t,w=4*t,M=8*t;return this.uint8[x+0]=n,this.uint8[x+1]=a,this.float32[w+1]=c,this.float32[w+2]=d,this.int16[M+6]=p,this.int16[M+7]=g,t}}$c.prototype.bytesPerElement=16,Ue("StructArrayLayout2ub2f2i16",$c);class ll extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.uint16[d+0]=n,this.uint16[d+1]=a,this.uint16[d+2]=c,t}}ll.prototype.bytesPerElement=6,Ue("StructArrayLayout3ui6",ll);class cl extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X){const se=this.length;return this.resize(se+1),this.emplace(se,t,n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X)}emplace(t,n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X,se){const Y=24*t,R=12*t,U=48*t;return this.int16[Y+0]=n,this.int16[Y+1]=a,this.uint16[Y+2]=c,this.uint16[Y+3]=d,this.uint32[R+2]=p,this.uint32[R+3]=g,this.uint32[R+4]=x,this.uint16[Y+10]=w,this.uint16[Y+11]=M,this.uint16[Y+12]=C,this.float32[R+7]=A,this.float32[R+8]=L,this.uint8[U+36]=B,this.uint8[U+37]=j,this.uint8[U+38]=$,this.uint32[R+10]=X,this.int16[Y+22]=se,t}}cl.prototype.bytesPerElement=48,Ue("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",cl);class Gc extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X,se,Y,R,U,Q,fe,ze,xe,we,Le,Ae){const Fe=this.length;return this.resize(Fe+1),this.emplace(Fe,t,n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X,se,Y,R,U,Q,fe,ze,xe,we,Le,Ae)}emplace(t,n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X,se,Y,R,U,Q,fe,ze,xe,we,Le,Ae,Fe){const Pe=32*t,Ge=16*t;return this.int16[Pe+0]=n,this.int16[Pe+1]=a,this.int16[Pe+2]=c,this.int16[Pe+3]=d,this.int16[Pe+4]=p,this.int16[Pe+5]=g,this.int16[Pe+6]=x,this.int16[Pe+7]=w,this.uint16[Pe+8]=M,this.uint16[Pe+9]=C,this.uint16[Pe+10]=A,this.uint16[Pe+11]=L,this.uint16[Pe+12]=B,this.uint16[Pe+13]=j,this.uint16[Pe+14]=$,this.uint16[Pe+15]=X,this.uint16[Pe+16]=se,this.uint16[Pe+17]=Y,this.uint16[Pe+18]=R,this.uint16[Pe+19]=U,this.uint16[Pe+20]=Q,this.uint16[Pe+21]=fe,this.uint16[Pe+22]=ze,this.uint32[Ge+12]=xe,this.float32[Ge+13]=we,this.float32[Ge+14]=Le,this.uint16[Pe+30]=Ae,this.uint16[Pe+31]=Fe,t}}Gc.prototype.bytesPerElement=64,Ue("StructArrayLayout8i15ui1ul2f2ui64",Gc);class u extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.float32[1*t+0]=n,t}}u.prototype.bytesPerElement=4,Ue("StructArrayLayout1f4",u);class e extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=3*t;return this.uint16[6*t+0]=n,this.float32[d+1]=a,this.float32[d+2]=c,t}}e.prototype.bytesPerElement=12,Ue("StructArrayLayout1ui2f12",e);class i extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,n,a)}emplace(t,n,a,c){const d=4*t;return this.uint32[2*t+0]=n,this.uint16[d+2]=a,this.uint16[d+3]=c,t}}i.prototype.bytesPerElement=8,Ue("StructArrayLayout1ul2ui8",i);class s extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const c=2*t;return this.uint16[c+0]=n,this.uint16[c+1]=a,t}}s.prototype.bytesPerElement=4,Ue("StructArrayLayout2ui4",s);class l extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.uint16[1*t+0]=n,t}}l.prototype.bytesPerElement=2,Ue("StructArrayLayout1ui2",l);class h extends bi{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,n,a,c)}emplace(t,n,a,c,d){const p=4*t;return this.float32[p+0]=n,this.float32[p+1]=a,this.float32[p+2]=c,this.float32[p+3]=d,t}}h.prototype.bytesPerElement=16,Ue("StructArrayLayout4f16",h);class f extends Ws{get anchorPointX(){return this._structArray.int16[this._pos2+0]}get anchorPointY(){return this._structArray.int16[this._pos2+1]}get x1(){return this._structArray.int16[this._pos2+2]}get y1(){return this._structArray.int16[this._pos2+3]}get x2(){return this._structArray.int16[this._pos2+4]}get y2(){return this._structArray.int16[this._pos2+5]}get featureIndex(){return this._structArray.uint32[this._pos4+3]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+8]}get bucketIndex(){return this._structArray.uint16[this._pos2+9]}get anchorPoint(){return new De(this.anchorPointX,this.anchorPointY)}}f.prototype.size=20;class _ extends Uc{get(t){return new f(this,t)}}Ue("CollisionBoxArray",_);class v extends Ws{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get glyphStartIndex(){return this._structArray.uint16[this._pos2+2]}get numGlyphs(){return this._structArray.uint16[this._pos2+3]}get vertexStartIndex(){return this._structArray.uint32[this._pos4+2]}get lineStartIndex(){return this._structArray.uint32[this._pos4+3]}get lineLength(){return this._structArray.uint32[this._pos4+4]}get segment(){return this._structArray.uint16[this._pos2+10]}get lowerSize(){return this._structArray.uint16[this._pos2+11]}get upperSize(){return this._structArray.uint16[this._pos2+12]}get lineOffsetX(){return this._structArray.float32[this._pos4+7]}get lineOffsetY(){return this._structArray.float32[this._pos4+8]}get writingMode(){return this._structArray.uint8[this._pos1+36]}get placedOrientation(){return this._structArray.uint8[this._pos1+37]}set placedOrientation(t){this._structArray.uint8[this._pos1+37]=t}get hidden(){return this._structArray.uint8[this._pos1+38]}set hidden(t){this._structArray.uint8[this._pos1+38]=t}get crossTileID(){return this._structArray.uint32[this._pos4+10]}set crossTileID(t){this._structArray.uint32[this._pos4+10]=t}get associatedIconIndex(){return this._structArray.int16[this._pos2+22]}}v.prototype.size=48;class T extends cl{get(t){return new v(this,t)}}Ue("PlacedSymbolArray",T);class P extends Ws{get anchorX(){return this._structArray.int16[this._pos2+0]}get anchorY(){return this._structArray.int16[this._pos2+1]}get rightJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+2]}get centerJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+3]}get leftJustifiedTextSymbolIndex(){return this._structArray.int16[this._pos2+4]}get verticalPlacedTextSymbolIndex(){return this._structArray.int16[this._pos2+5]}get placedIconSymbolIndex(){return this._structArray.int16[this._pos2+6]}get verticalPlacedIconSymbolIndex(){return this._structArray.int16[this._pos2+7]}get key(){return this._structArray.uint16[this._pos2+8]}get textBoxStartIndex(){return this._structArray.uint16[this._pos2+9]}get textBoxEndIndex(){return this._structArray.uint16[this._pos2+10]}get verticalTextBoxStartIndex(){return this._structArray.uint16[this._pos2+11]}get verticalTextBoxEndIndex(){return this._structArray.uint16[this._pos2+12]}get iconBoxStartIndex(){return this._structArray.uint16[this._pos2+13]}get iconBoxEndIndex(){return this._structArray.uint16[this._pos2+14]}get verticalIconBoxStartIndex(){return this._structArray.uint16[this._pos2+15]}get verticalIconBoxEndIndex(){return this._structArray.uint16[this._pos2+16]}get featureIndex(){return this._structArray.uint16[this._pos2+17]}get numHorizontalGlyphVertices(){return this._structArray.uint16[this._pos2+18]}get numVerticalGlyphVertices(){return this._structArray.uint16[this._pos2+19]}get numIconVertices(){return this._structArray.uint16[this._pos2+20]}get numVerticalIconVertices(){return this._structArray.uint16[this._pos2+21]}get useRuntimeCollisionCircles(){return this._structArray.uint16[this._pos2+22]}get crossTileID(){return this._structArray.uint32[this._pos4+12]}set crossTileID(t){this._structArray.uint32[this._pos4+12]=t}get textBoxScale(){return this._structArray.float32[this._pos4+13]}get collisionCircleDiameter(){return this._structArray.float32[this._pos4+14]}get textAnchorOffsetStartIndex(){return this._structArray.uint16[this._pos2+30]}get textAnchorOffsetEndIndex(){return this._structArray.uint16[this._pos2+31]}}P.prototype.size=64;class E extends Gc{get(t){return new P(this,t)}}Ue("SymbolInstanceArray",E);class k extends u{getoffsetX(t){return this.float32[1*t+0]}}Ue("GlyphOffsetArray",k);class F extends al{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ue("SymbolLineVertexArray",F);class O extends Ws{get textAnchor(){return this._structArray.uint16[this._pos2+0]}get textOffset0(){return this._structArray.float32[this._pos4+1]}get textOffset1(){return this._structArray.float32[this._pos4+2]}}O.prototype.size=12;class H extends e{get(t){return new O(this,t)}}Ue("TextAnchorOffsetArray",H);class q extends Ws{get featureIndex(){return this._structArray.uint32[this._pos4+0]}get sourceLayerIndex(){return this._structArray.uint16[this._pos2+2]}get bucketIndex(){return this._structArray.uint16[this._pos2+3]}}q.prototype.size=8;class W extends i{get(t){return new q(this,t)}}Ue("FeatureIndexArray",W);class K extends Xs{}class ee extends Xs{}class te extends Xs{}class re extends sl{}class oe extends Ks{}class ae extends os{}class pe extends Ys{}class me extends Vc{}class Se extends ls{}class Ce extends Ia{}class Te extends ol{}class je extends $c{}class Be extends ll{}class Ee extends s{}const He=Ei([{name:"a_pos",components:2,type:"Int16"}],4),{members:ft}=He;class st{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,n,a,c){const d=this.segments[this.segments.length-1];return t>st.MAX_VERTEX_ARRAY_LENGTH&&Zi(`Max vertices per segment is ${st.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${st.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+t>st.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==c?this.createNewSegment(n,a,c):d}createNewSegment(t,n,a){const c={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0,vaos:{}};return a!==void 0&&(c.sortKey=a),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(c),c}getOrCreateLatestSegment(t,n,a){return this.prepareSegment(0,t,n,a)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const n in t.vaos)t.vaos[n].destroy()}static simpleSegment(t,n,a,c){return new st([{vertexOffset:t,primitiveOffset:n,vertexLength:a,primitiveLength:c,vaos:{},sortKey:0}])}}function ui(r,t){return 256*(r=Ti(Math.floor(r),0,255))+Ti(Math.floor(t),0,255)}st.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ue("SegmentVector",st);const Ut=Ei([{name:"a_pattern_from",components:4,type:"Uint16"},{name:"a_pattern_to",components:4,type:"Uint16"},{name:"a_pixel_ratio_from",components:1,type:"Uint16"},{name:"a_pixel_ratio_to",components:1,type:"Uint16"}]);var hi,ii,Ht,Zt={exports:{}},Gi={exports:{}},Bi={exports:{}},Ji=function(){if(Ht)return Zt.exports;Ht=1;var r=(hi||(hi=1,Gi.exports=function(n,a){var c,d,p,g,x,w,M,C;for(d=n.length-(c=3&n.length),p=a,x=3432918353,w=461845907,C=0;C<d;)M=255&n.charCodeAt(C)|(255&n.charCodeAt(++C))<<8|(255&n.charCodeAt(++C))<<16|(255&n.charCodeAt(++C))<<24,++C,p=27492+(65535&(g=5*(65535&(p=(p^=M=(65535&(M=(M=(65535&M)*x+(((M>>>16)*x&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(g>>>16)&65535)<<16);switch(M=0,c){case 3:M^=(255&n.charCodeAt(C+2))<<16;case 2:M^=(255&n.charCodeAt(C+1))<<8;case 1:p^=M=(65535&(M=(M=(65535&(M^=255&n.charCodeAt(C)))*x+(((M>>>16)*x&65535)<<16)&4294967295)<<15|M>>>17))*w+(((M>>>16)*w&65535)<<16)&4294967295}return p^=n.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0}),Gi.exports),t=(ii||(ii=1,Bi.exports=function(n,a){for(var c,d=n.length,p=a^d,g=0;d>=4;)c=1540483477*(65535&(c=255&n.charCodeAt(g)|(255&n.charCodeAt(++g))<<8|(255&n.charCodeAt(++g))<<16|(255&n.charCodeAt(++g))<<24))+((1540483477*(c>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(c=1540483477*(65535&(c^=c>>>24))+((1540483477*(c>>>16)&65535)<<16)),d-=4,++g;switch(d){case 3:p^=(255&n.charCodeAt(g+2))<<16;case 2:p^=(255&n.charCodeAt(g+1))<<8;case 1:p=1540483477*(65535&(p^=255&n.charCodeAt(g)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0}),Bi.exports);return Zt.exports=r,Zt.exports.murmur3=r,Zt.exports.murmur2=t,Zt.exports}(),lr=le(Ji);class xn{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,n,a,c){this.ids.push(ia(t)),this.positions.push(n,a,c)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const n=ia(t);let a=0,c=this.ids.length-1;for(;a<c;){const p=a+c>>1;this.ids[p]>=n?c=p:a=p+1}const d=[];for(;this.ids[a]===n;)d.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return d}static serialize(t,n){const a=new Float64Array(t.ids),c=new Uint32Array(t.positions);return Rn(a,c,0,a.length-1),n&&n.push(a.buffer,c.buffer),{ids:a,positions:c}}static deserialize(t){const n=new xn;return n.ids=t.ids,n.positions=t.positions,n.indexed=!0,n}}function ia(r){const t=+r;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:lr(String(r))}function Rn(r,t,n,a){for(;n<a;){const c=r[n+a>>1];let d=n-1,p=a+1;for(;;){do d++;while(r[d]<c);do p--;while(r[p]>c);if(d>=p)break;Dn(r,d,p),Dn(t,3*d,3*p),Dn(t,3*d+1,3*p+1),Dn(t,3*d+2,3*p+2)}p-n<a-p?(Rn(r,t,n,p),n=p+1):(Rn(r,t,p+1,a),a=p)}}function Dn(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}Ue("FeaturePositionMap",xn);class vn{constructor(t,n){this.gl=t.gl,this.location=n}}class ka extends vn{constructor(t,n){super(t,n),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class za extends vn{constructor(t,n){super(t,n),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class Dr extends vn{constructor(t,n){super(t,n),this.current=gt.transparent}set(t){t.r===this.current.r&&t.g===this.current.g&&t.b===this.current.b&&t.a===this.current.a||(this.current=t,this.gl.uniform4f(this.location,t.r,t.g,t.b,t.a))}}const ra=new Float32Array(16);function Ln(r){return[ui(255*r.r,255*r.g),ui(255*r.b,255*r.a)]}class Bn{constructor(t,n,a){this.value=t,this.uniformNames=n.map(c=>`u_${c}`),this.type=a}setUniform(t,n,a){t.set(a.constantOr(this.value))}getBinding(t,n,a){return this.type==="color"?new Dr(t,n):new ka(t,n)}}class mi{constructor(t,n){this.uniformNames=n.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,n){this.pixelRatioFrom=n.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=n.tlbr,this.patternTo=t.tlbr}setUniform(t,n,a,c){const d=c==="u_pattern_to"?this.patternTo:c==="u_pattern_from"?this.patternFrom:c==="u_pixel_ratio_to"?this.pixelRatioTo:c==="u_pixel_ratio_from"?this.pixelRatioFrom:null;d&&t.set(d)}getBinding(t,n,a){return a.substr(0,9)==="u_pattern"?new za(t,n):new ka(t,n)}}class ri{constructor(t,n,a,c){this.expression=t,this.type=a,this.maxValue=0,this.paintVertexAttributes=n.map(d=>({name:`a_${d}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(t,n,a,c,d){const p=this.paintVertexArray.length,g=this.expression.evaluate(new ti(0),n,{},c,[],d);this.paintVertexArray.resize(t),this._setPaintValue(p,t,g)}updatePaintArray(t,n,a,c){const d=this.expression.evaluate({zoom:0},a,c);this._setPaintValue(t,n,d)}_setPaintValue(t,n,a){if(this.type==="color"){const c=Ln(a);for(let d=t;d<n;d++)this.paintVertexArray.emplace(d,c[0],c[1])}else{for(let c=t;c<n;c++)this.paintVertexArray.emplace(c,a);this.maxValue=Math.max(this.maxValue,Math.abs(a))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}}class Pi{constructor(t,n,a,c,d,p){this.expression=t,this.uniformNames=n.map(g=>`u_${g}_t`),this.type=a,this.useIntegerZoom=c,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=n.map(g=>({name:`a_${g}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(t,n,a,c,d){const p=this.expression.evaluate(new ti(this.zoom),n,{},c,[],d),g=this.expression.evaluate(new ti(this.zoom+1),n,{},c,[],d),x=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(x,t,p,g)}updatePaintArray(t,n,a,c){const d=this.expression.evaluate({zoom:this.zoom},a,c),p=this.expression.evaluate({zoom:this.zoom+1},a,c);this._setPaintValue(t,n,d,p)}_setPaintValue(t,n,a,c){if(this.type==="color"){const d=Ln(a),p=Ln(c);for(let g=t;g<n;g++)this.paintVertexArray.emplace(g,d[0],d[1],p[0],p[1])}else{for(let d=t;d<n;d++)this.paintVertexArray.emplace(d,a,c);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(c))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,n){const a=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,c=Ti(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(c)}getBinding(t,n,a){return new ka(t,n)}}class di{constructor(t,n,a,c,d,p){this.expression=t,this.type=n,this.useIntegerZoom=a,this.zoom=c,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(t,n,a){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(c,t,n.patterns&&n.patterns[this.layerId],a)}updatePaintArray(t,n,a,c,d){this._setPaintValues(t,n,a.patterns&&a.patterns[this.layerId],d)}_setPaintValues(t,n,a,c){if(!c||!a)return;const{min:d,mid:p,max:g}=a,x=c[d],w=c[p],M=c[g];if(x&&w&&M)for(let C=t;C<n;C++)this.zoomInPaintVertexArray.emplace(C,w.tl[0],w.tl[1],w.br[0],w.br[1],x.tl[0],x.tl[1],x.br[0],x.br[1],w.pixelRatio,x.pixelRatio),this.zoomOutPaintVertexArray.emplace(C,w.tl[0],w.tl[1],w.br[0],w.br[1],M.tl[0],M.tl[1],M.br[0],M.br[1],w.pixelRatio,M.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Ut.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Ut.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class $h{constructor(t,n,a){this.binders={},this._buffers=[];const c=[];for(const d in t.paint._values){if(!a(d))continue;const p=t.paint.get(d);if(!(p instanceof _n&&rs(p.property.specification)))continue;const g=cp(d,t.type),x=p.value,w=p.property.specification.type,M=p.property.useIntegerZoom,C=p.property.specification["property-type"],A=C==="cross-faded"||C==="cross-faded-data-driven";if(x.kind==="constant")this.binders[d]=A?new mi(x.value,g):new Bn(x.value,g,w),c.push(`/u_${d}`);else if(x.kind==="source"||A){const L=Gh(d,w,"source");this.binders[d]=A?new di(x,w,M,n,L,t.id):new ri(x,g,w,L),c.push(`/a_${d}`)}else{const L=Gh(d,w,"composite");this.binders[d]=new Pi(x,g,w,M,n,L),c.push(`/z_${d}`)}}this.cacheKey=c.sort().join("")}getMaxValue(t){const n=this.binders[t];return n instanceof ri||n instanceof Pi?n.maxValue:0}populatePaintArrays(t,n,a,c,d){for(const p in this.binders){const g=this.binders[p];(g instanceof ri||g instanceof Pi||g instanceof di)&&g.populatePaintArray(t,n,a,c,d)}}setConstantPatternPositions(t,n){for(const a in this.binders){const c=this.binders[a];c instanceof mi&&c.setConstantPatternPositions(t,n)}}updatePaintArrays(t,n,a,c,d){let p=!1;for(const g in t){const x=n.getPositions(g);for(const w of x){const M=a.feature(w.index);for(const C in this.binders){const A=this.binders[C];if((A instanceof ri||A instanceof Pi||A instanceof di)&&A.expression.isStateDependent===!0){const L=c.paint.get(C);A.expression=L.value,A.updatePaintArray(w.start,w.end,M,t[g],d),p=!0}}}}return p}defines(){const t=[];for(const n in this.binders){const a=this.binders[n];(a instanceof Bn||a instanceof mi)&&t.push(...a.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return t}getBinderAttributes(){const t=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof ri||a instanceof Pi)for(let c=0;c<a.paintVertexAttributes.length;c++)t.push(a.paintVertexAttributes[c].name);else if(a instanceof di)for(let c=0;c<Ut.members.length;c++)t.push(Ut.members[c].name)}return t}getBinderUniforms(){const t=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof Bn||a instanceof mi||a instanceof Pi)for(const c of a.uniformNames)t.push(c)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,n){const a=[];for(const c in this.binders){const d=this.binders[c];if(d instanceof Bn||d instanceof mi||d instanceof Pi){for(const p of d.uniformNames)if(n[p]){const g=d.getBinding(t,n[p],p);a.push({name:p,property:c,binding:g})}}}return a}setUniforms(t,n,a,c){for(const{name:d,property:p,binding:g}of n)this.binders[p].setUniform(g,c,a.get(p),d)}updatePaintBuffers(t){this._buffers=[];for(const n in this.binders){const a=this.binders[n];if(t&&a instanceof di){const c=t.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(a instanceof ri||a instanceof Pi)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(t){for(const n in this.binders){const a=this.binders[n];(a instanceof ri||a instanceof Pi||a instanceof di)&&a.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const n=this.binders[t];(n instanceof ri||n instanceof Pi||n instanceof di)&&n.destroy()}}}class Aa{constructor(t,n,a=()=>!0){this.programConfigurations={};for(const c of t)this.programConfigurations[c.id]=new $h(c,n,a);this.needsUpload=!1,this._featureMap=new xn,this._bufferOffset=0}populatePaintArrays(t,n,a,c,d,p){for(const g in this.programConfigurations)this.programConfigurations[g].populatePaintArrays(t,n,c,d,p);n.id!==void 0&&this._featureMap.add(n.id,a,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,n,a,c){for(const d of a)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(t,this._featureMap,n,d,c)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const n in this.programConfigurations)this.programConfigurations[n].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function cp(r,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[r]||[r.replace(`${t}-`,"").replace(/-/g,"_")]}function Gh(r,t,n){const a={color:{source:os,composite:h},number:{source:u,composite:os}},c=function(d){return{"line-pattern":{source:pe,composite:pe},"fill-pattern":{source:pe,composite:pe},"fill-extrusion-pattern":{source:pe,composite:pe}}[d]}(r);return c&&c[n]||a[t][n]}Ue("ConstantBinder",Bn),Ue("CrossFadedConstantBinder",mi),Ue("SourceExpressionBinder",ri),Ue("CrossFadedCompositeBinder",di),Ue("CompositeExpressionBinder",Pi),Ue("ProgramConfiguration",$h,{omit:["_buffers"]}),Ue("ProgramConfigurationSet",Aa);const qc=Math.pow(2,14)-1,qh=-qc-1;function Lr(r){const t=Ft/r.extent,n=r.loadGeometry();for(let a=0;a<n.length;a++){const c=n[a];for(let d=0;d<c.length;d++){const p=c[d],g=Math.round(p.x*t),x=Math.round(p.y*t);p.x=Ti(g,qh,qc),p.y=Ti(x,qh,qc),(g<p.x||g>p.x+1||x<p.y||x>p.y+1)&&Zi("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function na(r,t){return{type:r.type,id:r.id,properties:r.properties,geometry:t?Lr(r):[]}}const Hc=-32768;function Hh(r,t,n,a,c){r.emplaceBack(Hc+8*t+a,Hc+8*n+c)}class Js{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ee,this.indexArray=new Be,this.segments=new st,this.programConfigurations=new Aa(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){const c=this.layers[0],d=[];let p=null,g=!1,x=c.type==="heatmap";if(c.type==="circle"){const M=c;p=M.layout.get("circle-sort-key"),g=!p.isConstant(),x=x||M.paint.get("circle-pitch-alignment")==="map"}const w=x?n.subdivisionGranularity.circle:1;for(const{feature:M,id:C,index:A,sourceLayerIndex:L}of t){const B=this.layers[0]._featureFilter.needGeometry,j=na(M,B);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),j,a))continue;const $=g?p.evaluate(j,{},a):void 0,X={id:C,properties:M.properties,type:M.type,sourceLayerIndex:L,index:A,geometry:B?j.geometry:Lr(M),patterns:{},sortKey:$};d.push(X)}g&&d.sort((M,C)=>M.sortKey-C.sortKey);for(const M of d){const{geometry:C,index:A,sourceLayerIndex:L}=M,B=t[A].feature;this.addFeature(M,C,A,a,w),n.featureIndex.insert(B,C,A,L,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,ft),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,n,a,c,d=1){let p;switch(d){case 1:p=[0,7];break;case 3:p=[0,2,5,7];break;case 5:p=[0,1,3,4,6,7];break;case 7:p=[0,1,2,3,4,5,6,7];break;default:throw new Error(`Invalid circle bucket granularity: ${d}; valid values are 1, 3, 5, 7.`)}const g=p.length;for(const x of n)for(const w of x){const M=w.x,C=w.y;if(M<0||M>=Ft||C<0||C>=Ft)continue;const A=this.segments.prepareSegment(g*g,this.layoutVertexArray,this.indexArray,t.sortKey),L=A.vertexLength;for(let B=0;B<g;B++)for(let j=0;j<g;j++)Hh(this.layoutVertexArray,M,C,p[j],p[B]);for(let B=0;B<g-1;B++)for(let j=0;j<g-1;j++){const $=L+B*g+j,X=L+(B+1)*g+j;this.indexArray.emplaceBack($,X+1,$+1),this.indexArray.emplaceBack($,X,X+1)}A.vertexLength+=g*g,A.primitiveLength+=(g-1)*(g-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,{},c)}}function Wc(r,t){for(let n=0;n<r.length;n++)if(Qs(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(Qs(r,t[n]))return!0;return!!up(r,t)}function Xc(r,t,n){return!!Qs(r,t)||!!hp(t,r,n)}function gm(r,t){if(r.length===1)return ym(t,r[0]);for(let n=0;n<t.length;n++){const a=t[n];for(let c=0;c<a.length;c++)if(Qs(r,a[c]))return!0}for(let n=0;n<r.length;n++)if(ym(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(up(r,t[n]))return!0;return!1}function ev(r,t,n){if(r.length>1){if(up(r,t))return!0;for(let a=0;a<t.length;a++)if(hp(t[a],r,n))return!0}for(let a=0;a<r.length;a++)if(hp(r[a],t,n))return!0;return!1}function up(r,t){if(r.length===0||t.length===0)return!1;for(let n=0;n<r.length-1;n++){const a=r[n],c=r[n+1];for(let d=0;d<t.length-1;d++)if(tv(a,c,t[d],t[d+1]))return!0}return!1}function tv(r,t,n,a){return Wt(r,n,a)!==Wt(t,n,a)&&Wt(r,t,n)!==Wt(r,t,a)}function hp(r,t,n){const a=n*n;if(t.length===1)return r.distSqr(t[0])<a;for(let c=1;c<t.length;c++)if(_m(r,t[c-1],t[c])<a)return!0;return!1}function _m(r,t,n){const a=t.distSqr(n);if(a===0)return r.distSqr(t);const c=((r.x-t.x)*(n.x-t.x)+(r.y-t.y)*(n.y-t.y))/a;return r.distSqr(c<0?t:c>1?n:n.sub(t)._mult(c)._add(t))}function ym(r,t){for(let n=0;n<r.length;n++)if(Qs(r[n],t))return!0;return!1}function Qs(r,t){let n=!1;for(let a=0,c=r.length-1;a<r.length;c=a++){const d=r[a],p=r[c];d.y>t.y!=p.y>t.y&&t.x<(p.x-d.x)*(t.y-d.y)/(p.y-d.y)+d.x&&(n=!n)}return n}function iv(r,t,n){const a=n[0],c=n[2];if(r.x<a.x&&t.x<a.x||r.x>c.x&&t.x>c.x||r.y<a.y&&t.y<a.y||r.y>c.y&&t.y>c.y)return!1;const d=Wt(r,t,n[0]);return d!==Wt(r,t,n[1])||d!==Wt(r,t,n[2])||d!==Wt(r,t,n[3])}function Kc(r,t,n){const a=t.paint.get(r).value;return a.kind==="constant"?a.value:n.programConfigurations.get(t.id).getMaxValue(r)}function Wh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function Xh(r,t,n,a,c){if(!t[0]&&!t[1])return r;const d=De.convert(t)._mult(c);n==="viewport"&&d._rotate(-a);const p=[];for(let g=0;g<r.length;g++)p.push(r[g].sub(d));return p}let xm,vm;Ue("CircleBucket",Js,{omit:["layers"]});var rv={get paint(){return vm=vm||new Sr({"circle-radius":new nt(V.paint_circle["circle-radius"]),"circle-color":new nt(V.paint_circle["circle-color"]),"circle-blur":new nt(V.paint_circle["circle-blur"]),"circle-opacity":new nt(V.paint_circle["circle-opacity"]),"circle-translate":new Ye(V.paint_circle["circle-translate"]),"circle-translate-anchor":new Ye(V.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Ye(V.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Ye(V.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new nt(V.paint_circle["circle-stroke-width"]),"circle-stroke-color":new nt(V.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new nt(V.paint_circle["circle-stroke-opacity"])})},get layout(){return xm=xm||new Sr({"circle-sort-key":new nt(V.layout_circle["circle-sort-key"])})}};class nv extends yn{constructor(t){super(t,rv)}createBucket(t){return new Js(t)}queryRadius(t){const n=t;return Kc("circle-radius",this,n)+Kc("circle-stroke-width",this,n)+Wh(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,unwrappedTileID:g,getElevation:x}){const w=Xh(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,p),M=this.paint.get("circle-radius").evaluate(n,a)+this.paint.get("circle-stroke-width").evaluate(n,a),C=this.paint.get("circle-pitch-alignment")==="map",A=C?w:function(B,j,$,X){return B.map(se=>bm(se,j,$,X))}(w,d,g,x),L=C?M*p:M;for(const B of c)for(const j of B){const $=C?j:bm(j,d,g,x);let X=L;const se=d.projectTileCoordinates(j.x,j.y,g,x).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?X*=se/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(X*=d.cameraToCenterDistance/se),Xc(A,$,X))return!0}return!1}}function bm(r,t,n,a){const c=t.projectTileCoordinates(r.x,r.y,n,a).point;return new De((.5*c.x+.5)*t.width,(.5*-c.y+.5)*t.height)}class wm extends Js{}let Tm;Ue("HeatmapBucket",wm,{omit:["layers"]});var av={get paint(){return Tm=Tm||new Sr({"heatmap-radius":new nt(V.paint_heatmap["heatmap-radius"]),"heatmap-weight":new nt(V.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Ye(V.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Nc(V.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Ye(V.paint_heatmap["heatmap-opacity"])})}};function dp(r,{width:t,height:n},a,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==t*n*a)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${t*n*a}`)}else c=new Uint8Array(t*n*a);return r.width=t,r.height=n,r.data=c,r}function Mm(r,{width:t,height:n},a){if(t===r.width&&n===r.height)return;const c=dp({},{width:t,height:n},a);pp(r,c,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,t),height:Math.min(r.height,n)},a),r.width=t,r.height=n,r.data=c.data}function pp(r,t,n,a,c,d){if(c.width===0||c.height===0)return t;if(c.width>r.width||c.height>r.height||n.x>r.width-c.width||n.y>r.height-c.height)throw new RangeError("out of range source coordinates for image copy");if(c.width>t.width||c.height>t.height||a.x>t.width-c.width||a.y>t.height-c.height)throw new RangeError("out of range destination coordinates for image copy");const p=r.data,g=t.data;if(p===g)throw new Error("srcData equals dstData, so image is already copied");for(let x=0;x<c.height;x++){const w=((n.y+x)*r.width+n.x)*d,M=((a.y+x)*t.width+a.x)*d;for(let C=0;C<c.width*d;C++)g[M+C]=p[w+C]}return t}class Yc{constructor(t,n){dp(this,t,1,n)}resize(t){Mm(this,t,1)}clone(){return new Yc({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,c,d){pp(t,n,a,c,d,1)}}class rn{constructor(t,n){dp(this,t,4,n)}resize(t){Mm(this,t,4)}replace(t,n){n?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new rn({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,c,d){pp(t,n,a,c,d,4)}}function Sm(r){const t={},n=r.resolution||256,a=r.clips?r.clips.length:1,c=r.image||new rn({width:n,height:a});if(Math.log(n)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${n}`);const d=(p,g,x)=>{t[r.evaluationKey]=x;const w=r.expression.evaluate(t);c.data[p+g+0]=Math.floor(255*w.r/w.a),c.data[p+g+1]=Math.floor(255*w.g/w.a),c.data[p+g+2]=Math.floor(255*w.b/w.a),c.data[p+g+3]=Math.floor(255*w.a)};if(r.clips)for(let p=0,g=0;p<a;++p,g+=4*n)for(let x=0,w=0;x<n;x++,w+=4){const M=x/(n-1),{start:C,end:A}=r.clips[p];d(g,w,C*(1-M)+A*M)}else for(let p=0,g=0;p<n;p++,g+=4)d(0,g,p/(n-1));return c}Ue("AlphaImage",Yc),Ue("RGBAImage",rn);const fp="big-fb";class sv extends yn{createBucket(t){return new wm(t)}constructor(t){super(t,av),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Sm({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(fp)&&this.heatmapFbos.delete(fp)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let Pm;var ov={get paint(){return Pm=Pm||new Sr({"hillshade-illumination-direction":new Ye(V.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Ye(V.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Ye(V.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Ye(V.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Ye(V.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Ye(V.paint_hillshade["hillshade-accent-color"])})}};class lv extends yn{constructor(t){super(t,ov)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const cv=Ei([{name:"a_pos",components:2,type:"Int16"}],4),{members:uv}=cv;function mp(r,t,n){const a=n.patternDependencies;let c=!1;for(const d of t){const p=d.paint.get(`${r}-pattern`);p.isConstant()||(c=!0);const g=p.constantOr(null);g&&(c=!0,a[g.to]=!0,a[g.from]=!0)}return c}function gp(r,t,n,a,c){const d=c.patternDependencies;for(const p of t){const g=p.paint.get(`${r}-pattern`).value;if(g.kind!=="constant"){let x=g.evaluate({zoom:a-1},n,{},c.availableImages),w=g.evaluate({zoom:a},n,{},c.availableImages),M=g.evaluate({zoom:a+1},n,{},c.availableImages);x=x&&x.name?x.name:x,w=w&&w.name?w.name:w,M=M&&M.name?M.name:M,d[x]=!0,d[w]=!0,d[M]=!0,n.patterns[p.id]={min:x,mid:w,max:M}}}return n}function Cm(r,t,n,a,c){let d;if(c===function(p,g,x,w){let M=0;for(let C=g,A=x-w;C<x;C+=w)M+=(p[A]-p[C])*(p[C+1]+p[A+1]),A=C;return M}(r,t,n,a)>0)for(let p=t;p<n;p+=a)d=zm(p/a|0,r[p],r[p+1],d);else for(let p=n-a;p>=t;p-=a)d=zm(p/a|0,r[p],r[p+1],d);return d&&ul(d,d.next)&&(tu(d),d=d.next),d}function eo(r,t){if(!r)return r;t||(t=r);let n,a=r;do if(n=!1,a.steiner||!ul(a,a.next)&&ki(a.prev,a,a.next)!==0)a=a.next;else{if(tu(a),a=t=a.prev,a===a.next)break;n=!0}while(n||a!==t);return t}function Jc(r,t,n,a,c,d,p){if(!r)return;!p&&d&&function(x,w,M,C){let A=x;do A.z===0&&(A.z=_p(A.x,A.y,w,M,C)),A.prevZ=A.prev,A.nextZ=A.next,A=A.next;while(A!==x);A.prevZ.nextZ=null,A.prevZ=null,function(L){let B,j=1;do{let $,X=L;L=null;let se=null;for(B=0;X;){B++;let Y=X,R=0;for(let Q=0;Q<j&&(R++,Y=Y.nextZ,Y);Q++);let U=j;for(;R>0||U>0&&Y;)R!==0&&(U===0||!Y||X.z<=Y.z)?($=X,X=X.nextZ,R--):($=Y,Y=Y.nextZ,U--),se?se.nextZ=$:L=$,$.prevZ=se,se=$;X=Y}se.nextZ=null,j*=2}while(B>1)}(A)}(r,a,c,d);let g=r;for(;r.prev!==r.next;){const x=r.prev,w=r.next;if(d?dv(r,a,c,d):hv(r))t.push(x.i,r.i,w.i),tu(r),r=w.next,g=w.next;else if((r=w)===g){p?p===1?Jc(r=pv(eo(r),t),t,n,a,c,d,2):p===2&&fv(r,t,n,a,c,d):Jc(eo(r),t,n,a,c,d,1);break}}}function hv(r){const t=r.prev,n=r,a=r.next;if(ki(t,n,a)>=0)return!1;const c=t.x,d=n.x,p=a.x,g=t.y,x=n.y,w=a.y,M=Math.min(c,d,p),C=Math.min(g,x,w),A=Math.max(c,d,p),L=Math.max(g,x,w);let B=a.next;for(;B!==t;){if(B.x>=M&&B.x<=A&&B.y>=C&&B.y<=L&&Qc(c,g,d,x,p,w,B.x,B.y)&&ki(B.prev,B,B.next)>=0)return!1;B=B.next}return!0}function dv(r,t,n,a){const c=r.prev,d=r,p=r.next;if(ki(c,d,p)>=0)return!1;const g=c.x,x=d.x,w=p.x,M=c.y,C=d.y,A=p.y,L=Math.min(g,x,w),B=Math.min(M,C,A),j=Math.max(g,x,w),$=Math.max(M,C,A),X=_p(L,B,t,n,a),se=_p(j,$,t,n,a);let Y=r.prevZ,R=r.nextZ;for(;Y&&Y.z>=X&&R&&R.z<=se;){if(Y.x>=L&&Y.x<=j&&Y.y>=B&&Y.y<=$&&Y!==c&&Y!==p&&Qc(g,M,x,C,w,A,Y.x,Y.y)&&ki(Y.prev,Y,Y.next)>=0||(Y=Y.prevZ,R.x>=L&&R.x<=j&&R.y>=B&&R.y<=$&&R!==c&&R!==p&&Qc(g,M,x,C,w,A,R.x,R.y)&&ki(R.prev,R,R.next)>=0))return!1;R=R.nextZ}for(;Y&&Y.z>=X;){if(Y.x>=L&&Y.x<=j&&Y.y>=B&&Y.y<=$&&Y!==c&&Y!==p&&Qc(g,M,x,C,w,A,Y.x,Y.y)&&ki(Y.prev,Y,Y.next)>=0)return!1;Y=Y.prevZ}for(;R&&R.z<=se;){if(R.x>=L&&R.x<=j&&R.y>=B&&R.y<=$&&R!==c&&R!==p&&Qc(g,M,x,C,w,A,R.x,R.y)&&ki(R.prev,R,R.next)>=0)return!1;R=R.nextZ}return!0}function pv(r,t){let n=r;do{const a=n.prev,c=n.next.next;!ul(a,c)&&Em(a,n,n.next,c)&&eu(a,c)&&eu(c,a)&&(t.push(a.i,n.i,c.i),tu(n),tu(n.next),n=r=c),n=n.next}while(n!==r);return eo(n)}function fv(r,t,n,a,c,d){let p=r;do{let g=p.next.next;for(;g!==p.prev;){if(p.i!==g.i&&xv(p,g)){let x=km(p,g);return p=eo(p,p.next),x=eo(x,x.next),Jc(p,t,n,a,c,d,0),void Jc(x,t,n,a,c,d,0)}g=g.next}p=p.next}while(p!==r)}function mv(r,t){let n=r.x-t.x;return n===0&&(n=r.y-t.y,n===0)&&(n=(r.next.y-r.y)/(r.next.x-r.x)-(t.next.y-t.y)/(t.next.x-t.x)),n}function gv(r,t){const n=function(c,d){let p=d;const g=c.x,x=c.y;let w,M=-1/0;if(ul(c,p))return p;do{if(ul(c,p.next))return p.next;if(x<=p.y&&x>=p.next.y&&p.next.y!==p.y){const j=p.x+(x-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(j<=g&&j>M&&(M=j,w=p.x<p.next.x?p:p.next,j===g))return w}p=p.next}while(p!==d);if(!w)return null;const C=w,A=w.x,L=w.y;let B=1/0;p=w;do{if(g>=p.x&&p.x>=A&&g!==p.x&&Im(x<L?g:M,x,A,L,x<L?M:g,x,p.x,p.y)){const j=Math.abs(x-p.y)/(g-p.x);eu(p,c)&&(j<B||j===B&&(p.x>w.x||p.x===w.x&&_v(w,p)))&&(w=p,B=j)}p=p.next}while(p!==C);return w}(r,t);if(!n)return t;const a=km(n,r);return eo(a,a.next),eo(n,n.next)}function _v(r,t){return ki(r.prev,r,t.prev)<0&&ki(t.next,r,r.next)<0}function _p(r,t,n,a,c){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-n)*c|0)|r<<8))|r<<4))|r<<2))|r<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*c|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function yv(r){let t=r,n=r;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==r);return n}function Im(r,t,n,a,c,d,p,g){return(c-p)*(t-g)>=(r-p)*(d-g)&&(r-p)*(a-g)>=(n-p)*(t-g)&&(n-p)*(d-g)>=(c-p)*(a-g)}function Qc(r,t,n,a,c,d,p,g){return!(r===p&&t===g)&&Im(r,t,n,a,c,d,p,g)}function xv(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!function(n,a){let c=n;do{if(c.i!==n.i&&c.next.i!==n.i&&c.i!==a.i&&c.next.i!==a.i&&Em(c,c.next,n,a))return!0;c=c.next}while(c!==n);return!1}(r,t)&&(eu(r,t)&&eu(t,r)&&function(n,a){let c=n,d=!1;const p=(n.x+a.x)/2,g=(n.y+a.y)/2;do c.y>g!=c.next.y>g&&c.next.y!==c.y&&p<(c.next.x-c.x)*(g-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==n);return d}(r,t)&&(ki(r.prev,r,t.prev)||ki(r,t.prev,t))||ul(r,t)&&ki(r.prev,r,r.next)>0&&ki(t.prev,t,t.next)>0)}function ki(r,t,n){return(t.y-r.y)*(n.x-t.x)-(t.x-r.x)*(n.y-t.y)}function ul(r,t){return r.x===t.x&&r.y===t.y}function Em(r,t,n,a){const c=Yh(ki(r,t,n)),d=Yh(ki(r,t,a)),p=Yh(ki(n,a,r)),g=Yh(ki(n,a,t));return c!==d&&p!==g||!(c!==0||!Kh(r,n,t))||!(d!==0||!Kh(r,a,t))||!(p!==0||!Kh(n,r,a))||!(g!==0||!Kh(n,t,a))}function Kh(r,t,n){return t.x<=Math.max(r.x,n.x)&&t.x>=Math.min(r.x,n.x)&&t.y<=Math.max(r.y,n.y)&&t.y>=Math.min(r.y,n.y)}function Yh(r){return r>0?1:r<0?-1:0}function eu(r,t){return ki(r.prev,r,r.next)<0?ki(r,t,r.next)>=0&&ki(r,r.prev,t)>=0:ki(r,t,r.prev)<0||ki(r,r.next,t)<0}function km(r,t){const n=yp(r.i,r.x,r.y),a=yp(t.i,t.x,t.y),c=r.next,d=t.prev;return r.next=t,t.prev=r,n.next=c,c.prev=n,a.next=n,n.prev=a,d.next=a,a.prev=d,a}function zm(r,t,n,a){const c=yp(r,t,n);return a?(c.next=a.next,c.prev=a,a.next.prev=c,a.next=c):(c.prev=c,c.next=c),c}function tu(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function yp(r,t,n){return{i:r,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class hl{constructor(t,n){if(n>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=n}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class Jh{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}Jh.noSubdivision=new Jh({fill:new hl(0,0),line:new hl(0,0),tile:new hl(0,0),stencil:new hl(0,0),circle:1}),Ue("SubdivisionGranularityExpression",hl),Ue("SubdivisionGranularitySetting",Jh);const dl=-32768,iu=32767;class vv{constructor(t,n){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=Ft/t,this._canonical=n}_getKey(t,n){return(t+=32768)<<16|(n+=32768)<<0}_vertexToIndex(t,n){if(t<-32768||n<-32768||t>32767||n>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const a=0|Math.round(t),c=0|Math.round(n),d=this._getKey(a,c);if(this._vertexDictionary.has(d))return this._vertexDictionary.get(d);const p=this._vertexBuffer.length/2;return this._vertexDictionary.set(d,p),this._vertexBuffer.push(a,c),p}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(c,d){const p=[];for(let g=0;g<d.length;g+=3){const x=d[g],w=d[g+1],M=d[g+2],C=c[2*x],A=c[2*x+1];(c[2*w]-C)*(c[2*M+1]-A)-(c[2*w+1]-A)*(c[2*M]-C)>0?(p.push(x),p.push(M),p.push(w)):(p.push(x),p.push(w),p.push(M))}return p}(this._vertexBuffer,t);const n=[],a=t.length;for(let c=0;c<a;c+=3){const d=[t[c+0],t[c+1],t[c+2]],p=[this._vertexBuffer[2*t[c+0]+0],this._vertexBuffer[2*t[c+0]+1],this._vertexBuffer[2*t[c+1]+0],this._vertexBuffer[2*t[c+1]+1],this._vertexBuffer[2*t[c+2]+0],this._vertexBuffer[2*t[c+2]+1]];let g=1/0,x=1/0,w=-1/0,M=-1/0;for(let j=0;j<3;j++){const $=p[2*j],X=p[2*j+1];g=Math.min(g,$),w=Math.max(w,$),x=Math.min(x,X),M=Math.max(M,X)}if(g===w||x===M)continue;const C=Math.floor(g/this._granularityCellSize),A=Math.ceil(w/this._granularityCellSize),L=Math.floor(x/this._granularityCellSize),B=Math.ceil(M/this._granularityCellSize);if(C!==A||L!==B)for(let j=L;j<B;j++){const $=this._scanlineGenerateVertexRingForCellRow(j,p,d);bv(this._vertexBuffer,$,n)}else n.push(...d)}return n}_scanlineGenerateVertexRingForCellRow(t,n,a){const c=t*this._granularityCellSize,d=c+this._granularityCellSize,p=[];for(let g=0;g<3;g++){const x=n[2*g],w=n[2*g+1],M=n[2*(g+1)%6],C=n[(2*(g+1)+1)%6],A=n[2*(g+2)%6],L=n[(2*(g+2)+1)%6],B=M-x,j=C-w,$=B===0,X=j===0,se=(c-w)/j,Y=(d-w)/j,R=Math.min(se,Y),U=Math.max(se,Y);if(!X&&(R>=1||U<=0)||X&&(w<c||w>d)){C>=c&&C<=d&&p.push(a[(g+1)%3]);continue}!X&&R>0&&p.push(this._vertexToIndex(x+B*R,w+j*R));const Q=x+B*Math.max(R,0),fe=x+B*Math.min(U,1);$||this._generateIntraEdgeVertices(p,x,w,M,C,Q,fe),!X&&U<1&&p.push(this._vertexToIndex(x+B*U,w+j*U)),(X||C>=c&&C<=d)&&p.push(a[(g+1)%3]),!X&&(C<=c||C>=d)&&this._generateInterEdgeVertices(p,x,w,M,C,A,L,fe,c,d)}return p}_generateIntraEdgeVertices(t,n,a,c,d,p,g){const x=c-n,w=d-a,M=w===0,C=M?Math.min(n,c):Math.min(p,g),A=M?Math.max(n,c):Math.max(p,g),L=Math.floor(C/this._granularityCellSize)+1,B=Math.ceil(A/this._granularityCellSize)-1;if(M?n<c:p<g)for(let j=L;j<=B;j++){const $=j*this._granularityCellSize;t.push(this._vertexToIndex($,a+w*($-n)/x))}else for(let j=B;j>=L;j--){const $=j*this._granularityCellSize;t.push(this._vertexToIndex($,a+w*($-n)/x))}}_generateInterEdgeVertices(t,n,a,c,d,p,g,x,w,M){const C=d-a,A=p-c,L=g-d,B=(w-d)/L,j=(M-d)/L,$=Math.min(B,j),X=Math.max(B,j),se=c+A*$;let Y=Math.floor(Math.min(se,x)/this._granularityCellSize)+1,R=Math.ceil(Math.max(se,x)/this._granularityCellSize)-1,U=x<se;const Q=L===0;if(Q&&(g===w||g===M))return;if(Q||$>=1||X<=0){const ze=a-g,xe=p+(n-p)*Math.min((w-g)/ze,(M-g)/ze);Y=Math.floor(Math.min(xe,x)/this._granularityCellSize)+1,R=Math.ceil(Math.max(xe,x)/this._granularityCellSize)-1,U=x<xe}const fe=C>0?M:w;if(U)for(let ze=Y;ze<=R;ze++)t.push(this._vertexToIndex(ze*this._granularityCellSize,fe));else for(let ze=R;ze>=Y;ze--)t.push(this._vertexToIndex(ze*this._granularityCellSize,fe))}_generateOutline(t){const n=[];for(const a of t){const c=to(a,this._granularity,!0),d=this._pointArrayToIndices(c),p=[];for(let g=1;g<d.length;g++)p.push(d[g-1]),p.push(d[g]);n.push(p)}return n}_handlePoles(t){let n=!1,a=!1;this._canonical&&(this._canonical.y===0&&(n=!0),this._canonical.y===(1<<this._canonical.z)-1&&(a=!0)),(n||a)&&this._fillPoles(t,n,a)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let n=0;n<t.length;n+=2){const a=t[n+1];a===dl&&(t[n+1]=-32767),a===iu&&(t[n+1]=32766)}}_generatePoleQuad(t,n,a,c,d,p){c>d!=(p===dl)?(t.push(n),t.push(a),t.push(this._vertexToIndex(c,p)),t.push(a),t.push(this._vertexToIndex(d,p)),t.push(this._vertexToIndex(c,p))):(t.push(a),t.push(n),t.push(this._vertexToIndex(c,p)),t.push(this._vertexToIndex(d,p)),t.push(a),t.push(this._vertexToIndex(c,p)))}_fillPoles(t,n,a){const c=this._vertexBuffer,d=Ft,p=t.length;for(let g=2;g<p;g+=3){const x=t[g-2],w=t[g-1],M=t[g],C=c[2*x],A=c[2*x+1],L=c[2*w],B=c[2*w+1],j=c[2*M],$=c[2*M+1];n&&(A===0&&B===0&&this._generatePoleQuad(t,x,w,C,L,dl),B===0&&$===0&&this._generatePoleQuad(t,w,M,L,j,dl),$===0&&A===0&&this._generatePoleQuad(t,M,x,j,C,dl)),a&&(A===d&&B===d&&this._generatePoleQuad(t,x,w,C,L,iu),B===d&&$===d&&this._generatePoleQuad(t,w,M,L,j,iu),$===d&&A===d&&this._generatePoleQuad(t,M,x,j,C,iu))}}_initializeVertices(t){for(let n=0;n<t.length;n+=2)this._vertexToIndex(t[n],t[n+1])}subdividePolygonInternal(t,n){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:a,holeIndices:c}=function(g){const x=[],w=[];for(const M of g)if(M.length!==0){M!==g[0]&&x.push(w.length/2);for(let C=0;C<M.length;C++)w.push(M[C].x),w.push(M[C].y)}return{flattened:w,holeIndices:x}}(t);let d;this._initializeVertices(a);try{const g=function(w,M,C=2){const A=M&&M.length,L=A?M[0]*C:w.length;let B=Cm(w,0,L,C,!0);const j=[];if(!B||B.next===B.prev)return j;let $,X,se;if(A&&(B=function(Y,R,U,Q){const fe=[];for(let ze=0,xe=R.length;ze<xe;ze++){const we=Cm(Y,R[ze]*Q,ze<xe-1?R[ze+1]*Q:Y.length,Q,!1);we===we.next&&(we.steiner=!0),fe.push(yv(we))}fe.sort(mv);for(let ze=0;ze<fe.length;ze++)U=gv(fe[ze],U);return U}(w,M,B,C)),w.length>80*C){$=1/0,X=1/0;let Y=-1/0,R=-1/0;for(let U=C;U<L;U+=C){const Q=w[U],fe=w[U+1];Q<$&&($=Q),fe<X&&(X=fe),Q>Y&&(Y=Q),fe>R&&(R=fe)}se=Math.max(Y-$,R-X),se=se!==0?32767/se:0}return Jc(B,j,C,$,X,se,0),j}(a,c),x=this._convertIndices(a,g);d=this._subdivideTrianglesScanline(x)}catch(g){console.error(g)}let p=[];return n&&(p=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:p}}_convertIndices(t,n){const a=[];for(let c=0;c<n.length;c++)a.push(this._vertexToIndex(t[2*n[c]],t[2*n[c]+1]));return a}_pointArrayToIndices(t){const n=[];for(let a=0;a<t.length;a++){const c=t[a];n.push(this._vertexToIndex(c.x,c.y))}return n}}function Am(r,t,n,a=!0){return new vv(n,t).subdividePolygonInternal(r,a)}function to(r,t,n=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const a=r[0],c=r[r.length-1],d=n&&(a.x!==c.x||a.y!==c.y);if(t<2)return d?[...r,r[0]]:[...r];const p=Math.floor(Ft/t),g=[];g.push(new De(r[0].x,r[0].y));const x=r.length,w=d?x:x-1;for(let M=0;M<w;M++){const C=r[M],A=M<x-1?r[M+1]:r[0],L=C.x,B=C.y,j=A.x,$=A.y,X=L!==j,se=B!==$;if(!X&&!se)continue;const Y=j-L,R=$-B,U=Math.abs(Y),Q=Math.abs(R);let fe=L,ze=B;for(;;){const we=Y>0?(Math.floor(fe/p)+1)*p:(Math.ceil(fe/p)-1)*p,Le=R>0?(Math.floor(ze/p)+1)*p:(Math.ceil(ze/p)-1)*p,Ae=Math.abs(fe-we),Fe=Math.abs(ze-Le),Pe=Math.abs(fe-j),Ge=Math.abs(ze-$),tt=X?Ae/U:Number.POSITIVE_INFINITY,Je=se?Fe/Q:Number.POSITIVE_INFINITY;if((Pe<=Ae||!X)&&(Ge<=Fe||!se))break;if(tt<Je&&X||!se){fe=we,ze+=R*tt;const We=new De(fe,Math.round(ze));g[g.length-1].x===We.x&&g[g.length-1].y===We.y||g.push(We)}else{fe+=Y*Je,ze=Le;const We=new De(Math.round(fe),ze);g[g.length-1].x===We.x&&g[g.length-1].y===We.y||g.push(We)}}const xe=new De(j,$);g[g.length-1].x===xe.x&&g[g.length-1].y===xe.y||g.push(xe)}return g}function bv(r,t,n){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let a=0,c=r[2*t[0]];for(let x=1;x<t.length;x++){const w=r[2*t[x]];w<c&&(c=w,a=x)}const d=t.length;let p=a,g=(p+1)%d;for(;;){const x=p-1>=0?p-1:d-1,w=(g+1)%d,M=r[2*t[x]],C=r[2*t[w]],A=r[2*t[p]],L=r[2*t[p]+1],B=r[2*t[g]+1];let j=!1;if(M<C)j=!0;else if(M>C)j=!1;else{const $=B-L,X=-(r[2*t[g]]-A),se=L<B?1:-1;((M-A)*$+(r[2*t[x]+1]-L)*X)*se>((C-A)*$+(r[2*t[w]+1]-L)*X)*se&&(j=!0)}if(j){const $=t[x],X=t[p],se=t[g];$!==X&&$!==se&&X!==se&&n.push(se,X,$),p--,p<0&&(p=d-1)}else{const $=t[w],X=t[p],se=t[g];$!==X&&$!==se&&X!==se&&n.push(se,X,$),g++,g>=d&&(g=0)}if(x===w)break}}function Rm(r,t,n,a,c,d,p,g,x){const w=c.length/2,M=p&&g&&x;if(w<st.MAX_VERTEX_ARRAY_LENGTH){const C=t.prepareSegment(w,n,a),A=C.vertexLength;for(let j=0;j<d.length;j+=3)a.emplaceBack(A+d[j],A+d[j+1],A+d[j+2]);let L,B;C.vertexLength+=w,C.primitiveLength+=d.length/3,M&&(B=p.prepareSegment(w,n,g),L=B.vertexLength,B.vertexLength+=w);for(let j=0;j<c.length;j+=2)r(c[j],c[j+1]);if(M)for(let j=0;j<x.length;j++){const $=x[j];for(let X=1;X<$.length;X+=2)g.emplaceBack(L+$[X-1],L+$[X]);B.primitiveLength+=$.length/2}}else(function(C,A,L,B,j,$){const X=[];for(let Q=0;Q<B.length/2;Q++)X.push(-1);const se={count:0};let Y=0,R=C.getOrCreateLatestSegment(A,L),U=R.vertexLength;for(let Q=2;Q<j.length;Q+=3){const fe=j[Q-2],ze=j[Q-1],xe=j[Q];let we=X[fe]<Y,Le=X[ze]<Y,Ae=X[xe]<Y;R.vertexLength+((we?1:0)+(Le?1:0)+(Ae?1:0))>st.MAX_VERTEX_ARRAY_LENGTH&&(R=C.createNewSegment(A,L),Y=se.count,we=!0,Le=!0,Ae=!0,U=0);const Fe=ru(X,B,$,se,fe,we,R),Pe=ru(X,B,$,se,ze,Le,R),Ge=ru(X,B,$,se,xe,Ae,R);L.emplaceBack(U+Fe-Y,U+Pe-Y,U+Ge-Y),R.primitiveLength++}})(t,n,a,c,d,r),M&&function(C,A,L,B,j,$){const X=[];for(let Q=0;Q<B.length/2;Q++)X.push(-1);const se={count:0};let Y=0,R=C.getOrCreateLatestSegment(A,L),U=R.vertexLength;for(let Q=0;Q<j.length;Q++){const fe=j[Q];for(let ze=1;ze<j[Q].length;ze+=2){const xe=fe[ze-1],we=fe[ze];let Le=X[xe]<Y,Ae=X[we]<Y;R.vertexLength+((Le?1:0)+(Ae?1:0))>st.MAX_VERTEX_ARRAY_LENGTH&&(R=C.createNewSegment(A,L),Y=se.count,Le=!0,Ae=!0,U=0);const Fe=ru(X,B,$,se,xe,Le,R),Pe=ru(X,B,$,se,we,Ae,R);L.emplaceBack(U+Fe-Y,U+Pe-Y),R.primitiveLength++}}}(p,n,g,c,x,r),t.forceNewSegmentOnNextPrepare(),p==null||p.forceNewSegmentOnNextPrepare()}function ru(r,t,n,a,c,d,p){if(d){const g=a.count;return n(t[2*c],t[2*c+1]),r[c]=a.count,a.count++,p.vertexLength++,g}return r[c]}class xp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new te,this.indexArray=new Be,this.indexArray2=new Ee,this.programConfigurations=new Aa(t.layers,t.zoom),this.segments=new st,this.segments2=new st,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.hasPattern=mp("fill",this.layers,n);const c=this.layers[0].layout.get("fill-sort-key"),d=!c.isConstant(),p=[];for(const{feature:g,id:x,index:w,sourceLayerIndex:M}of t){const C=this.layers[0]._featureFilter.needGeometry,A=na(g,C);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),A,a))continue;const L=d?c.evaluate(A,{},a,n.availableImages):void 0,B={id:x,properties:g.properties,type:g.type,sourceLayerIndex:M,index:w,geometry:C?A.geometry:Lr(g),patterns:{},sortKey:L};p.push(B)}d&&p.sort((g,x)=>g.sortKey-x.sortKey);for(const g of p){const{geometry:x,index:w,sourceLayerIndex:M}=g;if(this.hasPattern){const C=gp("fill",this.layers,g,this.zoom,n);this.patternFeatures.push(C)}else this.addFeature(g,x,w,a,{},n.subdivisionGranularity);n.featureIndex.insert(t[w].feature,x,w,M,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}addFeatures(t,n,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,n,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,uv),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,n,a,c,d,p){for(const g of Bo(n,500)){const x=Am(g,c,p.fill.getGranularityForZoomLevel(c.z)),w=this.layoutVertexArray;Rm((M,C)=>{w.emplaceBack(M,C)},this.segments,this.layoutVertexArray,this.indexArray,x.verticesFlattened,x.indicesTriangles,this.segments2,this.indexArray2,x.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}}let Dm,Lm;Ue("FillBucket",xp,{omit:["layers","patternFeatures"]});var wv={get paint(){return Lm=Lm||new Sr({"fill-antialias":new Ye(V.paint_fill["fill-antialias"]),"fill-opacity":new nt(V.paint_fill["fill-opacity"]),"fill-color":new nt(V.paint_fill["fill-color"]),"fill-outline-color":new nt(V.paint_fill["fill-outline-color"]),"fill-translate":new Ye(V.paint_fill["fill-translate"]),"fill-translate-anchor":new Ye(V.paint_fill["fill-translate-anchor"]),"fill-pattern":new Hs(V.paint_fill["fill-pattern"])})},get layout(){return Dm=Dm||new Sr({"fill-sort-key":new nt(V.layout_fill["fill-sort-key"])})}};class Tv extends yn{constructor(t){super(t,wv)}recalculate(t,n){super.recalculate(t,n);const a=this.paint._values["fill-outline-color"];a.value.kind==="constant"&&a.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new xp(t)}queryRadius(){return Wh(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:n,transform:a,pixelsToTileUnits:c}){return gm(Xh(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,c),n)}isTileClipped(){return!0}}const Mv=Ei([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Sv=Ei([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Pv}=Mv;var vp,Bm,bp,Fm,wp,Om,jm,Qh={};function Nm(){if(Bm)return vp;Bm=1;var r=Re();function t(c,d,p,g,x){this.properties={},this.extent=p,this.type=0,this._pbf=c,this._geometry=-1,this._keys=g,this._values=x,c.readFields(n,this,d)}function n(c,d,p){c==1?d.id=p.readVarint():c==2?function(g,x){for(var w=g.readVarint()+g.pos;g.pos<w;){var M=x._keys[g.readVarint()],C=x._values[g.readVarint()];x.properties[M]=C}}(p,d):c==3?d.type=p.readVarint():c==4&&(d._geometry=p.pos)}function a(c){for(var d,p,g=0,x=0,w=c.length,M=w-1;x<w;M=x++)g+=((p=c[M]).x-(d=c[x]).x)*(d.y+p.y);return g}return vp=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var c=this._pbf;c.pos=this._geometry;for(var d,p=c.readVarint()+c.pos,g=1,x=0,w=0,M=0,C=[];c.pos<p;){if(x<=0){var A=c.readVarint();g=7&A,x=A>>3}if(x--,g===1||g===2)w+=c.readSVarint(),M+=c.readSVarint(),g===1&&(d&&C.push(d),d=[]),d.push(new r(w,M));else{if(g!==7)throw new Error("unknown command "+g);d&&d.push(d[0].clone())}}return d&&C.push(d),C},t.prototype.bbox=function(){var c=this._pbf;c.pos=this._geometry;for(var d=c.readVarint()+c.pos,p=1,g=0,x=0,w=0,M=1/0,C=-1/0,A=1/0,L=-1/0;c.pos<d;){if(g<=0){var B=c.readVarint();p=7&B,g=B>>3}if(g--,p===1||p===2)(x+=c.readSVarint())<M&&(M=x),x>C&&(C=x),(w+=c.readSVarint())<A&&(A=w),w>L&&(L=w);else if(p!==7)throw new Error("unknown command "+p)}return[M,A,C,L]},t.prototype.toGeoJSON=function(c,d,p){var g,x,w=this.extent*Math.pow(2,p),M=this.extent*c,C=this.extent*d,A=this.loadGeometry(),L=t.types[this.type];function B(X){for(var se=0;se<X.length;se++){var Y=X[se];X[se]=[360*(Y.x+M)/w-180,360/Math.PI*Math.atan(Math.exp((180-360*(Y.y+C)/w)*Math.PI/180))-90]}}switch(this.type){case 1:var j=[];for(g=0;g<A.length;g++)j[g]=A[g][0];B(A=j);break;case 2:for(g=0;g<A.length;g++)B(A[g]);break;case 3:for(A=function(X){var se=X.length;if(se<=1)return[X];for(var Y,R,U=[],Q=0;Q<se;Q++){var fe=a(X[Q]);fe!==0&&(R===void 0&&(R=fe<0),R===fe<0?(Y&&U.push(Y),Y=[X[Q]]):Y.push(X[Q]))}return Y&&U.push(Y),U}(A),g=0;g<A.length;g++)for(x=0;x<A[g].length;x++)B(A[g][x])}A.length===1?A=A[0]:L="Multi"+L;var $={type:"Feature",geometry:{type:L,coordinates:A},properties:this.properties};return"id"in this&&($.id=this.id),$},vp}function Zm(){if(Fm)return bp;Fm=1;var r=Nm();function t(a,c){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=a,this._keys=[],this._values=[],this._features=[],a.readFields(n,this,c),this.length=this._features.length}function n(a,c,d){a===15?c.version=d.readVarint():a===1?c.name=d.readString():a===5?c.extent=d.readVarint():a===2?c._features.push(d.pos):a===3?c._keys.push(d.readString()):a===4&&c._values.push(function(p){for(var g=null,x=p.readVarint()+p.pos;p.pos<x;){var w=p.readVarint()>>3;g=w===1?p.readString():w===2?p.readFloat():w===3?p.readDouble():w===4?p.readVarint64():w===5?p.readVarint():w===6?p.readSVarint():w===7?p.readBoolean():null}return g}(d))}return bp=t,t.prototype.feature=function(a){if(a<0||a>=this._features.length)throw new Error("feature index out of bounds");this._pbf.pos=this._features[a];var c=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,c,this.extent,this._keys,this._values)},bp}function Vm(){return jm||(jm=1,Qh.VectorTile=function(){if(Om)return wp;Om=1;var r=Zm();function t(n,a,c){if(n===3){var d=new r(c,c.readVarint()+c.pos);d.length&&(a[d.name]=d)}}return wp=function(n,a){this.layers=n.readFields(t,{},a)},wp}(),Qh.VectorTileFeature=Nm(),Qh.VectorTileLayer=Zm()),Qh}var nu=le(Vm());const Cv=nu.VectorTileFeature.types,Tp=Math.pow(2,13);function au(r,t,n,a,c,d,p,g){r.emplaceBack(t,n,2*Math.floor(a*Tp)+p,c*Tp*2,d*Tp*2,Math.round(g))}class Mp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new re,this.centroidVertexArray=new K,this.indexArray=new Be,this.programConfigurations=new Aa(t.layers,t.zoom),this.segments=new st,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.features=[],this.hasPattern=mp("fill-extrusion",this.layers,n);for(const{feature:c,id:d,index:p,sourceLayerIndex:g}of t){const x=this.layers[0]._featureFilter.needGeometry,w=na(c,x);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),w,a))continue;const M={id:d,sourceLayerIndex:g,index:p,geometry:x?w.geometry:Lr(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(gp("fill-extrusion",this.layers,M,this.zoom,n)):this.addFeature(M,M.geometry,p,a,{},n.subdivisionGranularity),n.featureIndex.insert(c,M.geometry,p,g,this.index,!0)}}addFeatures(t,n,a){for(const c of this.features){const{geometry:d}=c;this.addFeature(c,d,c.index,n,a,t.subdivisionGranularity)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Pv),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Sv.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,n,a,c,d,p){for(const g of Bo(n,500)){const x={x:0,y:0,sampleCount:0},w=this.layoutVertexArray.length;this.processPolygon(x,c,t,g,p);const M=this.layoutVertexArray.length-w,C=Math.floor(x.x/x.sampleCount),A=Math.floor(x.y/x.sampleCount);for(let L=0;L<M;L++)this.centroidVertexArray.emplaceBack(C,A)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}processPolygon(t,n,a,c,d){if(c.length<1||Um(c[0]))return;for(const C of c)C.length!==0&&Iv(t,C);const p={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},g=d.fill.getGranularityForZoomLevel(n.z),x=Cv[a.type]==="Polygon";for(const C of c){if(C.length===0||Um(C))continue;const A=to(C,g,x);this._generateSideFaces(A,p)}if(!x)return;const w=Am(c,n,g,!1),M=this.layoutVertexArray;Rm((C,A)=>{au(M,C,A,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,w.verticesFlattened,w.indicesTriangles)}_generateSideFaces(t,n){let a=0;for(let c=1;c<t.length;c++){const d=t[c],p=t[c-1];if(Ev(d,p))continue;n.segment.vertexLength+4>st.MAX_VERTEX_ARRAY_LENGTH&&(n.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const g=d.sub(p)._perp()._unit(),x=p.dist(d);a+x>32768&&(a=0),au(this.layoutVertexArray,d.x,d.y,g.x,g.y,0,0,a),au(this.layoutVertexArray,d.x,d.y,g.x,g.y,0,1,a),a+=x,au(this.layoutVertexArray,p.x,p.y,g.x,g.y,0,0,a),au(this.layoutVertexArray,p.x,p.y,g.x,g.y,0,1,a);const w=n.segment.vertexLength;this.indexArray.emplaceBack(w,w+2,w+1),this.indexArray.emplaceBack(w+1,w+2,w+3),n.segment.vertexLength+=4,n.segment.primitiveLength+=2}}}function Iv(r,t){for(let n=0;n<t.length;n++){const a=t[n];n===t.length-1&&t[0].x===a.x&&t[0].y===a.y||(r.x+=a.x,r.y+=a.y,r.sampleCount++)}}function Ev(r,t){return r.x===t.x&&(r.x<0||r.x>Ft)||r.y===t.y&&(r.y<0||r.y>Ft)}function Um(r){return r.every(t=>t.x<0)||r.every(t=>t.x>Ft)||r.every(t=>t.y<0)||r.every(t=>t.y>Ft)}let $m;Ue("FillExtrusionBucket",Mp,{omit:["layers","features"]});var kv={get paint(){return $m=$m||new Sr({"fill-extrusion-opacity":new Ye(V["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new nt(V["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Ye(V["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Ye(V["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new Hs(V["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new nt(V["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new nt(V["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Ye(V["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class zv extends yn{constructor(t){super(t,kv)}createBucket(t){return new Mp(t)}queryRadius(){return Wh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,pixelPosMatrix:g}){const x=Xh(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,p),w=this.paint.get("fill-extrusion-height").evaluate(n,a),M=this.paint.get("fill-extrusion-base").evaluate(n,a),C=function(L,B,j){const $=[];for(const X of L){const se=[X.x,X.y,0,1];li(se,se,B),$.push(new De(se[0]/se[3],se[1]/se[3]))}return $}(x,g),A=function(L,B,j,$){const X=[],se=[],Y=$[8]*B,R=$[9]*B,U=$[10]*B,Q=$[11]*B,fe=$[8]*j,ze=$[9]*j,xe=$[10]*j,we=$[11]*j;for(const Le of L){const Ae=[],Fe=[];for(const Pe of Le){const Ge=Pe.x,tt=Pe.y,Je=$[0]*Ge+$[4]*tt+$[12],We=$[1]*Ge+$[5]*tt+$[13],wt=$[2]*Ge+$[6]*tt+$[14],wi=$[3]*Ge+$[7]*tt+$[15],Oi=wt+U,ur=wi+Q,an=Je+fe,Fr=We+ze,Qi=wt+xe,gi=wi+we,qi=new De((Je+Y)/ur,(We+R)/ur);qi.z=Oi/ur,Ae.push(qi);const er=new De(an/gi,Fr/gi);er.z=Qi/gi,Fe.push(er)}X.push(Ae),se.push(Fe)}return[X,se]}(c,M,w,g);return function(L,B,j){let $=1/0;gm(j,B)&&($=Gm(j,B[0]));for(let X=0;X<B.length;X++){const se=B[X],Y=L[X];for(let R=0;R<se.length-1;R++){const U=se[R],Q=[U,se[R+1],Y[R+1],Y[R],U];Wc(j,Q)&&($=Math.min($,Gm(j,Q)))}}return $!==1/0&&$}(A[0],A[1],C)}}function su(r,t){return r.x*t.x+r.y*t.y}function Gm(r,t){if(r.length===1){let n=0;const a=t[n++];let c;for(;!c||a.equals(c);)if(c=t[n++],!c)return 1/0;for(;n<t.length;n++){const d=t[n],p=r[0],g=c.sub(a),x=d.sub(a),w=p.sub(a),M=su(g,g),C=su(g,x),A=su(x,x),L=su(w,g),B=su(w,x),j=M*A-C*C,$=(A*L-C*B)/j,X=(M*B-C*L)/j,se=a.z*(1-$-X)+c.z*$+d.z*X;if(isFinite(se))return se}return 1/0}{let n=1/0;for(const a of t)n=Math.min(n,a.z);return n}}const Av=Ei([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Rv}=Av,Dv=Ei([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Lv}=Dv,Bv=nu.VectorTileFeature.types,Fv=Math.cos(Math.PI/180*37.5),qm=Math.pow(2,14)/.5;class Sp{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(n=>{this.gradients[n.id]={}}),this.layoutVertexArray=new oe,this.layoutVertexArray2=new ae,this.indexArray=new Be,this.programConfigurations=new Aa(t.layers,t.zoom),this.segments=new st,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.hasPattern=mp("line",this.layers,n);const c=this.layers[0].layout.get("line-sort-key"),d=!c.isConstant(),p=[];for(const{feature:g,id:x,index:w,sourceLayerIndex:M}of t){const C=this.layers[0]._featureFilter.needGeometry,A=na(g,C);if(!this.layers[0]._featureFilter.filter(new ti(this.zoom),A,a))continue;const L=d?c.evaluate(A,{},a):void 0,B={id:x,properties:g.properties,type:g.type,sourceLayerIndex:M,index:w,geometry:C?A.geometry:Lr(g),patterns:{},sortKey:L};p.push(B)}d&&p.sort((g,x)=>g.sortKey-x.sortKey);for(const g of p){const{geometry:x,index:w,sourceLayerIndex:M}=g;if(this.hasPattern){const C=gp("line",this.layers,g,this.zoom,n);this.patternFeatures.push(C)}else this.addFeature(g,x,w,a,{},n.subdivisionGranularity);n.featureIndex.insert(t[w].feature,x,w,M,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}addFeatures(t,n,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,n,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Lv)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Rv),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,n,a,c,d,p){const g=this.layers[0].layout,x=g.get("line-join").evaluate(t,{}),w=g.get("line-cap"),M=g.get("line-miter-limit"),C=g.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const A of n)this.addLine(A,t,x,w,M,C,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}addLine(t,n,a,c,d,p,g,x){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=to(t,g?x.line.getGranularityForZoomLevel(g.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let Y=0;Y<t.length-1;Y++)this.totalDistance+=t[Y].dist(t[Y+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const w=Bv[n.type]==="Polygon";let M=t.length;for(;M>=2&&t[M-1].equals(t[M-2]);)M--;let C=0;for(;C<M-1&&t[C].equals(t[C+1]);)C++;if(M<(w?3:2))return;a==="bevel"&&(d=1.05);const A=this.overscaling<=16?15*Ft/(512*this.overscaling):0,L=this.segments.prepareSegment(10*M,this.layoutVertexArray,this.indexArray);let B,j,$,X,se;this.e1=this.e2=-1,w&&(B=t[M-2],se=t[C].sub(B)._unit()._perp());for(let Y=C;Y<M;Y++){if($=Y===M-1?w?t[C+1]:void 0:t[Y+1],$&&t[Y].equals($))continue;se&&(X=se),B&&(j=B),B=t[Y],se=$?$.sub(B)._unit()._perp():X,X=X||se;let R=X.add(se);R.x===0&&R.y===0||R._unit();const U=X.x*se.x+X.y*se.y,Q=R.x*se.x+R.y*se.y,fe=Q!==0?1/Q:1/0,ze=2*Math.sqrt(2-2*Q),xe=Q<Fv&&j&&$,we=X.x*se.y-X.y*se.x>0;if(xe&&Y>C){const Fe=B.dist(j);if(Fe>2*A){const Pe=B.sub(B.sub(j)._mult(A/Fe)._round());this.updateDistance(j,Pe),this.addCurrentVertex(Pe,X,0,0,L),j=Pe}}const Le=j&&$;let Ae=Le?a:w?"butt":c;if(Le&&Ae==="round"&&(fe<p?Ae="miter":fe<=2&&(Ae="fakeround")),Ae==="miter"&&fe>d&&(Ae="bevel"),Ae==="bevel"&&(fe>2&&(Ae="flipbevel"),fe<d&&(Ae="miter")),j&&this.updateDistance(j,B),Ae==="miter")R._mult(fe),this.addCurrentVertex(B,R,0,0,L);else if(Ae==="flipbevel"){if(fe>100)R=se.mult(-1);else{const Fe=fe*X.add(se).mag()/X.sub(se).mag();R._perp()._mult(Fe*(we?-1:1))}this.addCurrentVertex(B,R,0,0,L),this.addCurrentVertex(B,R.mult(-1),0,0,L)}else if(Ae==="bevel"||Ae==="fakeround"){const Fe=-Math.sqrt(fe*fe-1),Pe=we?Fe:0,Ge=we?0:Fe;if(j&&this.addCurrentVertex(B,X,Pe,Ge,L),Ae==="fakeround"){const tt=Math.round(180*ze/Math.PI/20);for(let Je=1;Je<tt;Je++){let We=Je/tt;if(We!==.5){const wi=We-.5;We+=We*wi*(We-1)*((1.0904+U*(U*(3.55645-1.43519*U)-3.2452))*wi*wi+(.848013+U*(.215638*U-1.06021)))}const wt=se.sub(X)._mult(We)._add(X)._unit()._mult(we?-1:1);this.addHalfVertex(B,wt.x,wt.y,!1,we,0,L)}}$&&this.addCurrentVertex(B,se,-Pe,-Ge,L)}else if(Ae==="butt")this.addCurrentVertex(B,R,0,0,L);else if(Ae==="square"){const Fe=j?1:-1;this.addCurrentVertex(B,R,Fe,Fe,L)}else Ae==="round"&&(j&&(this.addCurrentVertex(B,X,0,0,L),this.addCurrentVertex(B,X,1,1,L,!0)),$&&(this.addCurrentVertex(B,se,-1,-1,L,!0),this.addCurrentVertex(B,se,0,0,L)));if(xe&&Y<M-1){const Fe=B.dist($);if(Fe>2*A){const Pe=B.add($.sub(B)._mult(A/Fe)._round());this.updateDistance(B,Pe),this.addCurrentVertex(Pe,se,0,0,L),B=Pe}}}}addCurrentVertex(t,n,a,c,d,p=!1){const g=n.y*c-n.x,x=-n.y-n.x*c;this.addHalfVertex(t,n.x+n.y*a,n.y-n.x*a,p,!1,a,d),this.addHalfVertex(t,g,x,p,!0,-c,d),this.distance>qm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,a,c,d,p))}addHalfVertex({x:t,y:n},a,c,d,p,g,x){const w=.5*(this.lineClips?this.scaledDistance*(qm-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(d?1:0),(n<<1)+(p?1:0),Math.round(63*a)+128,Math.round(63*c)+128,1+(g===0?0:g<0?-1:1)|(63&w)<<2,w>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const M=x.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,M,this.e2),x.primitiveLength++),p?this.e2=M:this.e1=M}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,n){this.distance+=t.dist(n),this.updateScaledDistance()}}let Hm,Wm;Ue("LineBucket",Sp,{omit:["layers","patternFeatures"]});var Xm={get paint(){return Wm=Wm||new Sr({"line-opacity":new nt(V.paint_line["line-opacity"]),"line-color":new nt(V.paint_line["line-color"]),"line-translate":new Ye(V.paint_line["line-translate"]),"line-translate-anchor":new Ye(V.paint_line["line-translate-anchor"]),"line-width":new nt(V.paint_line["line-width"]),"line-gap-width":new nt(V.paint_line["line-gap-width"]),"line-offset":new nt(V.paint_line["line-offset"]),"line-blur":new nt(V.paint_line["line-blur"]),"line-dasharray":new jc(V.paint_line["line-dasharray"]),"line-pattern":new Hs(V.paint_line["line-pattern"]),"line-gradient":new Nc(V.paint_line["line-gradient"])})},get layout(){return Hm=Hm||new Sr({"line-cap":new Ye(V.layout_line["line-cap"]),"line-join":new nt(V.layout_line["line-join"]),"line-miter-limit":new Ye(V.layout_line["line-miter-limit"]),"line-round-limit":new Ye(V.layout_line["line-round-limit"]),"line-sort-key":new nt(V.layout_line["line-sort-key"])})}};class Ov extends nt{possiblyEvaluate(t,n){return n=new ti(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),super.possiblyEvaluate(t,n)}evaluate(t,n,a,c){return n=hr({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(t,n,a,c)}}let ed;class jv extends yn{constructor(t){super(t,Xm),this.gradientVersion=0,ed||(ed=new Ov(Xm.paint.properties["line-width"].specification),ed.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const n=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(n)&&n._styleExpression.expression instanceof ks,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,n){super.recalculate(t,n),this.paint._values["line-floorwidth"]=ed.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Sp(t)}queryRadius(t){const n=t,a=Km(Kc("line-width",this,n),Kc("line-gap-width",this,n)),c=Kc("line-offset",this,n);return a/2+Math.abs(c)+Wh(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p}){const g=Xh(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,p),x=p/2*Km(this.paint.get("line-width").evaluate(n,a),this.paint.get("line-gap-width").evaluate(n,a)),w=this.paint.get("line-offset").evaluate(n,a);return w&&(c=function(M,C){const A=[];for(let L=0;L<M.length;L++){const B=M[L],j=[];for(let $=0;$<B.length;$++){const X=B[$-1],se=B[$],Y=B[$+1],R=$===0?new De(0,0):se.sub(X)._unit()._perp(),U=$===B.length-1?new De(0,0):Y.sub(se)._unit()._perp(),Q=R._add(U)._unit(),fe=Q.x*U.x+Q.y*U.y;fe!==0&&Q._mult(1/fe),j.push(Q._mult(C)._add(se))}A.push(j)}return A}(c,w*p)),function(M,C,A){for(let L=0;L<C.length;L++){const B=C[L];if(M.length>=3){for(let j=0;j<B.length;j++)if(Qs(M,B[j]))return!0}if(ev(M,B,A))return!0}return!1}(g,c,x)}isTileClipped(){return!0}}function Km(r,t){return t>0?t+2*r:r}const Nv=Ei([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Zv=Ei([{name:"a_projected_pos",components:3,type:"Float32"}],4);Ei([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Vv=Ei([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Ei([{type:"Int16",name:"anchorPointX"},{type:"Int16",name:"anchorPointY"},{type:"Int16",name:"x1"},{type:"Int16",name:"y1"},{type:"Int16",name:"x2"},{type:"Int16",name:"y2"},{type:"Uint32",name:"featureIndex"},{type:"Uint16",name:"sourceLayerIndex"},{type:"Uint16",name:"bucketIndex"}]);const Ym=Ei([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Uv=Ei([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function $v(r,t,n){return r.sections.forEach(a=>{a.text=function(c,d,p){const g=d.layout.get("text-transform").evaluate(p,{});return g==="uppercase"?c=c.toLocaleUpperCase():g==="lowercase"&&(c=c.toLocaleLowerCase()),ta.applyArabicShaping&&(c=ta.applyArabicShaping(c)),c}(a.text,t,n)}),r}Ei([{name:"triangle",components:3,type:"Uint16"}]),Ei([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Uint16",name:"glyphStartIndex"},{type:"Uint16",name:"numGlyphs"},{type:"Uint32",name:"vertexStartIndex"},{type:"Uint32",name:"lineStartIndex"},{type:"Uint32",name:"lineLength"},{type:"Uint16",name:"segment"},{type:"Uint16",name:"lowerSize"},{type:"Uint16",name:"upperSize"},{type:"Float32",name:"lineOffsetX"},{type:"Float32",name:"lineOffsetY"},{type:"Uint8",name:"writingMode"},{type:"Uint8",name:"placedOrientation"},{type:"Uint8",name:"hidden"},{type:"Uint32",name:"crossTileID"},{type:"Int16",name:"associatedIconIndex"}]),Ei([{type:"Int16",name:"anchorX"},{type:"Int16",name:"anchorY"},{type:"Int16",name:"rightJustifiedTextSymbolIndex"},{type:"Int16",name:"centerJustifiedTextSymbolIndex"},{type:"Int16",name:"leftJustifiedTextSymbolIndex"},{type:"Int16",name:"verticalPlacedTextSymbolIndex"},{type:"Int16",name:"placedIconSymbolIndex"},{type:"Int16",name:"verticalPlacedIconSymbolIndex"},{type:"Uint16",name:"key"},{type:"Uint16",name:"textBoxStartIndex"},{type:"Uint16",name:"textBoxEndIndex"},{type:"Uint16",name:"verticalTextBoxStartIndex"},{type:"Uint16",name:"verticalTextBoxEndIndex"},{type:"Uint16",name:"iconBoxStartIndex"},{type:"Uint16",name:"iconBoxEndIndex"},{type:"Uint16",name:"verticalIconBoxStartIndex"},{type:"Uint16",name:"verticalIconBoxEndIndex"},{type:"Uint16",name:"featureIndex"},{type:"Uint16",name:"numHorizontalGlyphVertices"},{type:"Uint16",name:"numVerticalGlyphVertices"},{type:"Uint16",name:"numIconVertices"},{type:"Uint16",name:"numVerticalIconVertices"},{type:"Uint16",name:"useRuntimeCollisionCircles"},{type:"Uint32",name:"crossTileID"},{type:"Float32",name:"textBoxScale"},{type:"Float32",name:"collisionCircleDiameter"},{type:"Uint16",name:"textAnchorOffsetStartIndex"},{type:"Uint16",name:"textAnchorOffsetEndIndex"}]),Ei([{type:"Float32",name:"offsetX"}]),Ei([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Ei([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const ou={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Jm,Pp,Qm,Fi=24,Cp={};function Gv(){return Jm||(Jm=1,Cp.read=function(r,t,n,a,c){var d,p,g=8*c-a-1,x=(1<<g)-1,w=x>>1,M=-7,C=n?c-1:0,A=n?-1:1,L=r[t+C];for(C+=A,d=L&(1<<-M)-1,L>>=-M,M+=g;M>0;d=256*d+r[t+C],C+=A,M-=8);for(p=d&(1<<-M)-1,d>>=-M,M+=a;M>0;p=256*p+r[t+C],C+=A,M-=8);if(d===0)d=1-w;else{if(d===x)return p?NaN:1/0*(L?-1:1);p+=Math.pow(2,a),d-=w}return(L?-1:1)*p*Math.pow(2,d-a)},Cp.write=function(r,t,n,a,c,d){var p,g,x,w=8*d-c-1,M=(1<<w)-1,C=M>>1,A=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,L=a?0:d-1,B=a?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(g=isNaN(t)?1:0,p=M):(p=Math.floor(Math.log(t)/Math.LN2),t*(x=Math.pow(2,-p))<1&&(p--,x*=2),(t+=p+C>=1?A/x:A*Math.pow(2,1-C))*x>=2&&(p++,x/=2),p+C>=M?(g=0,p=M):p+C>=1?(g=(t*x-1)*Math.pow(2,c),p+=C):(g=t*Math.pow(2,C-1)*Math.pow(2,c),p=0));c>=8;r[n+L]=255&g,L+=B,g/=256,c-=8);for(p=p<<c|g,w+=c;w>0;r[n+L]=255&p,L+=B,p/=256,w-=8);r[n+L-B]|=128*j}),Cp}function eg(){if(Qm)return Pp;Qm=1,Pp=t;var r=Gv();function t(R){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(R)?R:new Uint8Array(R||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var n=4294967296,a=1/n,c=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function d(R){return R.type===t.Bytes?R.readVarint()+R.pos:R.pos+1}function p(R,U,Q){return Q?4294967296*U+(R>>>0):4294967296*(U>>>0)+(R>>>0)}function g(R,U,Q){var fe=U<=16383?1:U<=2097151?2:U<=268435455?3:Math.floor(Math.log(U)/(7*Math.LN2));Q.realloc(fe);for(var ze=Q.pos-1;ze>=R;ze--)Q.buf[ze+fe]=Q.buf[ze]}function x(R,U){for(var Q=0;Q<R.length;Q++)U.writeVarint(R[Q])}function w(R,U){for(var Q=0;Q<R.length;Q++)U.writeSVarint(R[Q])}function M(R,U){for(var Q=0;Q<R.length;Q++)U.writeFloat(R[Q])}function C(R,U){for(var Q=0;Q<R.length;Q++)U.writeDouble(R[Q])}function A(R,U){for(var Q=0;Q<R.length;Q++)U.writeBoolean(R[Q])}function L(R,U){for(var Q=0;Q<R.length;Q++)U.writeFixed32(R[Q])}function B(R,U){for(var Q=0;Q<R.length;Q++)U.writeSFixed32(R[Q])}function j(R,U){for(var Q=0;Q<R.length;Q++)U.writeFixed64(R[Q])}function $(R,U){for(var Q=0;Q<R.length;Q++)U.writeSFixed64(R[Q])}function X(R,U){return(R[U]|R[U+1]<<8|R[U+2]<<16)+16777216*R[U+3]}function se(R,U,Q){R[Q]=U,R[Q+1]=U>>>8,R[Q+2]=U>>>16,R[Q+3]=U>>>24}function Y(R,U){return(R[U]|R[U+1]<<8|R[U+2]<<16)+(R[U+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(R,U,Q){for(Q=Q||this.length;this.pos<Q;){var fe=this.readVarint(),ze=fe>>3,xe=this.pos;this.type=7&fe,R(ze,U,this),this.pos===xe&&this.skip(fe)}return U},readMessage:function(R,U){return this.readFields(R,U,this.readVarint()+this.pos)},readFixed32:function(){var R=X(this.buf,this.pos);return this.pos+=4,R},readSFixed32:function(){var R=Y(this.buf,this.pos);return this.pos+=4,R},readFixed64:function(){var R=X(this.buf,this.pos)+X(this.buf,this.pos+4)*n;return this.pos+=8,R},readSFixed64:function(){var R=X(this.buf,this.pos)+Y(this.buf,this.pos+4)*n;return this.pos+=8,R},readFloat:function(){var R=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,R},readDouble:function(){var R=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,R},readVarint:function(R){var U,Q,fe=this.buf;return U=127&(Q=fe[this.pos++]),Q<128?U:(U|=(127&(Q=fe[this.pos++]))<<7,Q<128?U:(U|=(127&(Q=fe[this.pos++]))<<14,Q<128?U:(U|=(127&(Q=fe[this.pos++]))<<21,Q<128?U:function(ze,xe,we){var Le,Ae,Fe=we.buf;if(Le=(112&(Ae=Fe[we.pos++]))>>4,Ae<128||(Le|=(127&(Ae=Fe[we.pos++]))<<3,Ae<128)||(Le|=(127&(Ae=Fe[we.pos++]))<<10,Ae<128)||(Le|=(127&(Ae=Fe[we.pos++]))<<17,Ae<128)||(Le|=(127&(Ae=Fe[we.pos++]))<<24,Ae<128)||(Le|=(1&(Ae=Fe[we.pos++]))<<31,Ae<128))return p(ze,Le,xe);throw new Error("Expected varint not more than 10 bytes")}(U|=(15&(Q=fe[this.pos]))<<28,R,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var R=this.readVarint();return R%2==1?(R+1)/-2:R/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var R=this.readVarint()+this.pos,U=this.pos;return this.pos=R,R-U>=12&&c?function(Q,fe,ze){return c.decode(Q.subarray(fe,ze))}(this.buf,U,R):function(Q,fe,ze){for(var xe="",we=fe;we<ze;){var Le,Ae,Fe,Pe=Q[we],Ge=null,tt=Pe>239?4:Pe>223?3:Pe>191?2:1;if(we+tt>ze)break;tt===1?Pe<128&&(Ge=Pe):tt===2?(192&(Le=Q[we+1]))==128&&(Ge=(31&Pe)<<6|63&Le)<=127&&(Ge=null):tt===3?(Ae=Q[we+2],(192&(Le=Q[we+1]))==128&&(192&Ae)==128&&((Ge=(15&Pe)<<12|(63&Le)<<6|63&Ae)<=2047||Ge>=55296&&Ge<=57343)&&(Ge=null)):tt===4&&(Ae=Q[we+2],Fe=Q[we+3],(192&(Le=Q[we+1]))==128&&(192&Ae)==128&&(192&Fe)==128&&((Ge=(15&Pe)<<18|(63&Le)<<12|(63&Ae)<<6|63&Fe)<=65535||Ge>=1114112)&&(Ge=null)),Ge===null?(Ge=65533,tt=1):Ge>65535&&(Ge-=65536,xe+=String.fromCharCode(Ge>>>10&1023|55296),Ge=56320|1023&Ge),xe+=String.fromCharCode(Ge),we+=tt}return xe}(this.buf,U,R)},readBytes:function(){var R=this.readVarint()+this.pos,U=this.buf.subarray(this.pos,R);return this.pos=R,U},readPackedVarint:function(R,U){if(this.type!==t.Bytes)return R.push(this.readVarint(U));var Q=d(this);for(R=R||[];this.pos<Q;)R.push(this.readVarint(U));return R},readPackedSVarint:function(R){if(this.type!==t.Bytes)return R.push(this.readSVarint());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readSVarint());return R},readPackedBoolean:function(R){if(this.type!==t.Bytes)return R.push(this.readBoolean());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readBoolean());return R},readPackedFloat:function(R){if(this.type!==t.Bytes)return R.push(this.readFloat());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readFloat());return R},readPackedDouble:function(R){if(this.type!==t.Bytes)return R.push(this.readDouble());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readDouble());return R},readPackedFixed32:function(R){if(this.type!==t.Bytes)return R.push(this.readFixed32());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readFixed32());return R},readPackedSFixed32:function(R){if(this.type!==t.Bytes)return R.push(this.readSFixed32());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readSFixed32());return R},readPackedFixed64:function(R){if(this.type!==t.Bytes)return R.push(this.readFixed64());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readFixed64());return R},readPackedSFixed64:function(R){if(this.type!==t.Bytes)return R.push(this.readSFixed64());var U=d(this);for(R=R||[];this.pos<U;)R.push(this.readSFixed64());return R},skip:function(R){var U=7&R;if(U===t.Varint)for(;this.buf[this.pos++]>127;);else if(U===t.Bytes)this.pos=this.readVarint()+this.pos;else if(U===t.Fixed32)this.pos+=4;else{if(U!==t.Fixed64)throw new Error("Unimplemented type: "+U);this.pos+=8}},writeTag:function(R,U){this.writeVarint(R<<3|U)},realloc:function(R){for(var U=this.length||16;U<this.pos+R;)U*=2;if(U!==this.length){var Q=new Uint8Array(U);Q.set(this.buf),this.buf=Q,this.length=U}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(R){this.realloc(4),se(this.buf,R,this.pos),this.pos+=4},writeSFixed32:function(R){this.realloc(4),se(this.buf,R,this.pos),this.pos+=4},writeFixed64:function(R){this.realloc(8),se(this.buf,-1&R,this.pos),se(this.buf,Math.floor(R*a),this.pos+4),this.pos+=8},writeSFixed64:function(R){this.realloc(8),se(this.buf,-1&R,this.pos),se(this.buf,Math.floor(R*a),this.pos+4),this.pos+=8},writeVarint:function(R){(R=+R||0)>268435455||R<0?function(U,Q){var fe,ze;if(U>=0?(fe=U%4294967296|0,ze=U/4294967296|0):(ze=~(-U/4294967296),4294967295^(fe=~(-U%4294967296))?fe=fe+1|0:(fe=0,ze=ze+1|0)),U>=18446744073709552e3||U<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");Q.realloc(10),function(xe,we,Le){Le.buf[Le.pos++]=127&xe|128,xe>>>=7,Le.buf[Le.pos++]=127&xe|128,xe>>>=7,Le.buf[Le.pos++]=127&xe|128,xe>>>=7,Le.buf[Le.pos++]=127&xe|128,Le.buf[Le.pos]=127&(xe>>>=7)}(fe,0,Q),function(xe,we){var Le=(7&xe)<<4;we.buf[we.pos++]|=Le|((xe>>>=3)?128:0),xe&&(we.buf[we.pos++]=127&xe|((xe>>>=7)?128:0),xe&&(we.buf[we.pos++]=127&xe|((xe>>>=7)?128:0),xe&&(we.buf[we.pos++]=127&xe|((xe>>>=7)?128:0),xe&&(we.buf[we.pos++]=127&xe|((xe>>>=7)?128:0),xe&&(we.buf[we.pos++]=127&xe)))))}(ze,Q)}(R,this):(this.realloc(4),this.buf[this.pos++]=127&R|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=127&(R>>>=7)|(R>127?128:0),R<=127||(this.buf[this.pos++]=R>>>7&127))))},writeSVarint:function(R){this.writeVarint(R<0?2*-R-1:2*R)},writeBoolean:function(R){this.writeVarint(!!R)},writeString:function(R){R=String(R),this.realloc(4*R.length),this.pos++;var U=this.pos;this.pos=function(fe,ze,xe){for(var we,Le,Ae=0;Ae<ze.length;Ae++){if((we=ze.charCodeAt(Ae))>55295&&we<57344){if(!Le){we>56319||Ae+1===ze.length?(fe[xe++]=239,fe[xe++]=191,fe[xe++]=189):Le=we;continue}if(we<56320){fe[xe++]=239,fe[xe++]=191,fe[xe++]=189,Le=we;continue}we=Le-55296<<10|we-56320|65536,Le=null}else Le&&(fe[xe++]=239,fe[xe++]=191,fe[xe++]=189,Le=null);we<128?fe[xe++]=we:(we<2048?fe[xe++]=we>>6|192:(we<65536?fe[xe++]=we>>12|224:(fe[xe++]=we>>18|240,fe[xe++]=we>>12&63|128),fe[xe++]=we>>6&63|128),fe[xe++]=63&we|128)}return xe}(this.buf,R,this.pos);var Q=this.pos-U;Q>=128&&g(U,Q,this),this.pos=U-1,this.writeVarint(Q),this.pos+=Q},writeFloat:function(R){this.realloc(4),r.write(this.buf,R,this.pos,!0,23,4),this.pos+=4},writeDouble:function(R){this.realloc(8),r.write(this.buf,R,this.pos,!0,52,8),this.pos+=8},writeBytes:function(R){var U=R.length;this.writeVarint(U),this.realloc(U);for(var Q=0;Q<U;Q++)this.buf[this.pos++]=R[Q]},writeRawMessage:function(R,U){this.pos++;var Q=this.pos;R(U,this);var fe=this.pos-Q;fe>=128&&g(Q,fe,this),this.pos=Q-1,this.writeVarint(fe),this.pos+=fe},writeMessage:function(R,U,Q){this.writeTag(R,t.Bytes),this.writeRawMessage(U,Q)},writePackedVarint:function(R,U){U.length&&this.writeMessage(R,x,U)},writePackedSVarint:function(R,U){U.length&&this.writeMessage(R,w,U)},writePackedBoolean:function(R,U){U.length&&this.writeMessage(R,A,U)},writePackedFloat:function(R,U){U.length&&this.writeMessage(R,M,U)},writePackedDouble:function(R,U){U.length&&this.writeMessage(R,C,U)},writePackedFixed32:function(R,U){U.length&&this.writeMessage(R,L,U)},writePackedSFixed32:function(R,U){U.length&&this.writeMessage(R,B,U)},writePackedFixed64:function(R,U){U.length&&this.writeMessage(R,j,U)},writePackedSFixed64:function(R,U){U.length&&this.writeMessage(R,$,U)},writeBytesField:function(R,U){this.writeTag(R,t.Bytes),this.writeBytes(U)},writeFixed32Field:function(R,U){this.writeTag(R,t.Fixed32),this.writeFixed32(U)},writeSFixed32Field:function(R,U){this.writeTag(R,t.Fixed32),this.writeSFixed32(U)},writeFixed64Field:function(R,U){this.writeTag(R,t.Fixed64),this.writeFixed64(U)},writeSFixed64Field:function(R,U){this.writeTag(R,t.Fixed64),this.writeSFixed64(U)},writeVarintField:function(R,U){this.writeTag(R,t.Varint),this.writeVarint(U)},writeSVarintField:function(R,U){this.writeTag(R,t.Varint),this.writeSVarint(U)},writeStringField:function(R,U){this.writeTag(R,t.Bytes),this.writeString(U)},writeFloatField:function(R,U){this.writeTag(R,t.Fixed32),this.writeFloat(U)},writeDoubleField:function(R,U){this.writeTag(R,t.Fixed64),this.writeDouble(U)},writeBooleanField:function(R,U){this.writeVarintField(R,!!U)}},Pp}var Ip=le(eg());const Ep=3;function qv(r,t,n){r===1&&n.readMessage(Hv,t)}function Hv(r,t,n){if(r===3){const{id:a,bitmap:c,width:d,height:p,left:g,top:x,advance:w}=n.readMessage(Wv,{});t.push({id:a,bitmap:new Yc({width:d+2*Ep,height:p+2*Ep},c),metrics:{width:d,height:p,left:g,top:x,advance:w}})}}function Wv(r,t,n){r===1?t.id=n.readVarint():r===2?t.bitmap=n.readBytes():r===3?t.width=n.readVarint():r===4?t.height=n.readVarint():r===5?t.left=n.readSVarint():r===6?t.top=n.readSVarint():r===7&&(t.advance=n.readVarint())}const Xv=Ep;function tg(r){let t=0,n=0;for(const p of r)t+=p.w*p.h,n=Math.max(n,p.w);r.sort((p,g)=>g.h-p.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}];let c=0,d=0;for(const p of r)for(let g=a.length-1;g>=0;g--){const x=a[g];if(!(p.w>x.w||p.h>x.h)){if(p.x=x.x,p.y=x.y,d=Math.max(d,p.y+p.h),c=Math.max(c,p.x+p.w),p.w===x.w&&p.h===x.h){const w=a.pop();g<a.length&&(a[g]=w)}else p.h===x.h?(x.x+=p.w,x.w-=p.w):p.w===x.w?(x.y+=p.h,x.h-=p.h):(a.push({x:x.x+p.w,y:x.y,w:x.w-p.w,h:p.h}),x.y+=p.h,x.h-=p.h);break}}return{w:c,h:d,fill:t/(c*d)||0}}const Br=1;class kp{constructor(t,{pixelRatio:n,version:a,stretchX:c,stretchY:d,content:p,textFitWidth:g,textFitHeight:x}){this.paddedRect=t,this.pixelRatio=n,this.stretchX=c,this.stretchY=d,this.content=p,this.version=a,this.textFitWidth=g,this.textFitHeight=x}get tl(){return[this.paddedRect.x+Br,this.paddedRect.y+Br]}get br(){return[this.paddedRect.x+this.paddedRect.w-Br,this.paddedRect.y+this.paddedRect.h-Br]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Br)/this.pixelRatio,(this.paddedRect.h-2*Br)/this.pixelRatio]}}class ig{constructor(t,n){const a={},c={};this.haveRenderCallbacks=[];const d=[];this.addImages(t,a,d),this.addImages(n,c,d);const{w:p,h:g}=tg(d),x=new rn({width:p||1,height:g||1});for(const w in t){const M=t[w],C=a[w].paddedRect;rn.copy(M.data,x,{x:0,y:0},{x:C.x+Br,y:C.y+Br},M.data)}for(const w in n){const M=n[w],C=c[w].paddedRect,A=C.x+Br,L=C.y+Br,B=M.data.width,j=M.data.height;rn.copy(M.data,x,{x:0,y:0},{x:A,y:L},M.data),rn.copy(M.data,x,{x:0,y:j-1},{x:A,y:L-1},{width:B,height:1}),rn.copy(M.data,x,{x:0,y:0},{x:A,y:L+j},{width:B,height:1}),rn.copy(M.data,x,{x:B-1,y:0},{x:A-1,y:L},{width:1,height:j}),rn.copy(M.data,x,{x:0,y:0},{x:A+B,y:L},{width:1,height:j})}this.image=x,this.iconPositions=a,this.patternPositions=c}addImages(t,n,a){for(const c in t){const d=t[c],p={x:0,y:0,w:d.data.width+2*Br,h:d.data.height+2*Br};a.push(p),n[c]=new kp(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(t,n){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in t.updatedImages)this.patchUpdatedImage(this.iconPositions[a],t.getImage(a),n),this.patchUpdatedImage(this.patternPositions[a],t.getImage(a),n)}patchUpdatedImage(t,n,a){if(!t||!n||t.version===n.version)return;t.version=n.version;const[c,d]=t.tl;a.update(n.data,void 0,{x:c,y:d})}}var cs;Ue("ImagePosition",kp),Ue("ImageAtlas",ig),S.al=void 0,(cs=S.al||(S.al={}))[cs.none=0]="none",cs[cs.horizontal=1]="horizontal",cs[cs.vertical=2]="vertical",cs[cs.horizontalOnly=3]="horizontalOnly";const td=-17;class lu{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,n,a){const c=new lu;return c.scale=t||1,c.fontStack=n,c.verticalAlign=a||"bottom",c}static forImage(t,n){const a=new lu;return a.imageName=t,a.verticalAlign=n||"bottom",a}}class pl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,n){const a=new pl;for(let c=0;c<t.sections.length;c++){const d=t.sections[c];d.image?a.addImageSection(d):a.addTextSection(d,n)}return a}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let n="";for(let a=0;a<t.length;a++){const c=t.charCodeAt(a+1)||null,d=t.charCodeAt(a-1)||null;n+=c&&jh(c)&&!ou[t[a+1]]||d&&jh(d)&&!ou[t[a-1]]||!ou[t[a]]?t[a]:ou[t[a]]}return n}(this.text)}trim(){let t=0;for(let a=0;a<this.text.length&&rd[this.text.charCodeAt(a)];a++)t++;let n=this.text.length;for(let a=this.text.length-1;a>=0&&a>=t&&rd[this.text.charCodeAt(a)];a--)n--;this.text=this.text.substring(t,n),this.sectionIndex=this.sectionIndex.slice(t,n)}substring(t,n){const a=new pl;return a.text=this.text.substring(t,n),a.sectionIndex=this.sectionIndex.slice(t,n),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,n)=>Math.max(t,this.sections[n].scale),0)}getMaxImageSize(t){let n=0,a=0;for(let c=0;c<this.length();c++){const d=this.getSection(c);if(d.imageName){const p=t[d.imageName];if(!p)continue;const g=p.displaySize;n=Math.max(n,g[0]),a=Math.max(a,g[1])}}return{maxImageWidth:n,maxImageHeight:a}}addTextSection(t,n){this.text+=t.text,this.sections.push(lu.forText(t.scale,t.fontStack||n,t.verticalAlign));const a=this.sections.length-1;for(let c=0;c<t.text.length;++c)this.sectionIndex.push(a)}addImageSection(t){const n=t.image?t.image.name:"";if(n.length===0)return void Zi("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(lu.forImage(n,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):Zi("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function id(r,t,n,a,c,d,p,g,x,w,M,C,A,L,B){const j=pl.fromFeature(r,c);let $;C===S.al.vertical&&j.verticalizePunctuation();const{processBidirectionalText:X,processStyledBidirectionalText:se}=ta;if(X&&j.sections.length===1){$=[];const U=X(j.toString(),zp(j,w,d,t,a,L));for(const Q of U){const fe=new pl;fe.text=Q,fe.sections=j.sections;for(let ze=0;ze<Q.length;ze++)fe.sectionIndex.push(0);$.push(fe)}}else if(se){$=[];const U=se(j.text,j.sectionIndex,zp(j,w,d,t,a,L));for(const Q of U){const fe=new pl;fe.text=Q[0],fe.sectionIndex=Q[1],fe.sections=j.sections,$.push(fe)}}else $=function(U,Q){const fe=[],ze=U.text;let xe=0;for(const we of Q)fe.push(U.substring(xe,we)),xe=we;return xe<ze.length&&fe.push(U.substring(xe,ze.length)),fe}(j,zp(j,w,d,t,a,L));const Y=[],R={positionedLines:Y,text:j.toString(),top:M[1],bottom:M[1],left:M[0],right:M[0],writingMode:C,iconsInText:!1,verticalizable:!1};return function(U,Q,fe,ze,xe,we,Le,Ae,Fe,Pe,Ge,tt){let Je=0,We=0,wt=0,wi=0;const Oi=Ae==="right"?1:Ae==="left"?0:.5,ur=Fi/tt;let an=0;for(const gi of xe){gi.trim();const qi=gi.getMaxScale(),er={positionedGlyphs:[],lineOffset:0};U.positionedLines[an]=er;const tr=er.positionedGlyphs;let Pr=0;if(!gi.length()){We+=we,++an;continue}const sn=Qv(ze,gi,ur);for(let Or=0;Or<gi.length();Or++){const ji=gi.getSection(Or),Wi=gi.getSectionIndex(Or),Xi=gi.getCharCode(Or),Ai=e0(Fe,Ge,Xi);let ni;if(ji.imageName){if(U.iconsInText=!0,ji.scale=ji.scale*ur,ni=i0(ji,Ai,qi,sn,ze),!ni)continue;Pr=Math.max(Pr,ni.imageOffset)}else if(ni=t0(ji,Xi,Ai,sn,Q,fe),!ni)continue;const{rect:Fn,metrics:_l,baselineOffset:On}=ni;tr.push({glyph:Xi,imageName:ji.imageName,x:Je,y:We+On+td,vertical:Ai,scale:ji.scale,fontStack:ji.fontStack,sectionIndex:Wi,metrics:_l,rect:Fn}),Ai?(U.verticalizable=!0,Je+=(ji.imageName?_l.advance:Fi)*ji.scale+Pe):Je+=_l.advance*ji.scale+Pe}tr.length!==0&&(wt=Math.max(Je-Pe,wt),r0(tr,0,tr.length-1,Oi)),Je=0,er.lineOffset=Math.max(Pr,(qi-1)*Fi);const Hi=we*qi+Pr;We+=Hi,wi=Math.max(Hi,wi),++an}const{horizontalAlign:Fr,verticalAlign:Qi}=Ap(Le);(function(gi,qi,er,tr,Pr,sn,Hi,Or,ji){const Wi=(qi-er)*Pr;let Xi=0;Xi=sn!==Hi?-Or*tr-td:-tr*ji*Hi+.5*Hi;for(const Ai of gi)for(const ni of Ai.positionedGlyphs)ni.x+=Wi,ni.y+=Xi})(U.positionedLines,Oi,Fr,Qi,wt,wi,we,We,xe.length),U.top+=-Qi*We,U.bottom=U.top+We,U.left+=-Fr*wt,U.right=U.left+wt}(R,t,n,a,$,p,g,x,C,w,A,B),!function(U){for(const Q of U)if(Q.positionedGlyphs.length!==0)return!1;return!0}(Y)&&R}const rd={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Kv={10:!0,32:!0,38:!0,41:!0,43:!0,45:!0,47:!0,173:!0,183:!0,8203:!0,8208:!0,8211:!0,8231:!0},Yv={40:!0};function rg(r,t,n,a,c,d){if(t.imageName){const p=a[t.imageName];return p?p.displaySize[0]*t.scale*Fi/d+c:0}{const p=n[t.fontStack],g=p&&p[r];return g?g.metrics.advance*t.scale+c:0}}function ng(r,t,n,a){const c=Math.pow(r-t,2);return a?r<t?c/2:2*c:c+Math.abs(n)*n}function Jv(r,t,n){let a=0;return r===10&&(a-=1e4),n&&(a+=150),r!==40&&r!==65288||(a+=50),t!==41&&t!==65289||(a+=50),a}function ag(r,t,n,a,c,d){let p=null,g=ng(t,n,c,d);for(const x of a){const w=ng(t-x.x,n,c,d)+x.badness;w<=g&&(p=x,g=w)}return{index:r,x:t,priorBreak:p,badness:g}}function sg(r){return r?sg(r.priorBreak).concat(r.index):[]}function zp(r,t,n,a,c,d){if(!r)return[];const p=[],g=function(C,A,L,B,j,$){let X=0;for(let se=0;se<C.length();se++){const Y=C.getSection(se);X+=rg(C.getCharCode(se),Y,B,j,A,$)}return X/Math.max(1,Math.ceil(X/L))}(r,t,n,a,c,d),x=r.text.indexOf("​")>=0;let w=0;for(let C=0;C<r.length();C++){const A=r.getSection(C),L=r.getCharCode(C);if(rd[L]||(w+=rg(L,A,a,c,t,d)),C<r.length()-1){const B=!((M=L)<11904)&&(!!vt["CJK Compatibility Forms"](M)||!!vt["CJK Compatibility"](M)||!!vt["CJK Strokes"](M)||!!vt["CJK Symbols and Punctuation"](M)||!!vt["Enclosed CJK Letters and Months"](M)||!!vt["Halfwidth and Fullwidth Forms"](M)||!!vt["Ideographic Description Characters"](M)||!!vt["Vertical Forms"](M)||Oh.test(String.fromCodePoint(M)));(Kv[L]||B||A.imageName||C!==r.length()-2&&Yv[r.getCharCode(C+1)])&&p.push(ag(C+1,w,g,p,Jv(L,r.getCharCode(C+1),B&&x),!1))}}var M;return sg(ag(r.length(),w,g,p,0,!0))}function Ap(r){let t=.5,n=.5;switch(r){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:t,verticalAlign:n}}function Qv(r,t,n){const a=t.getMaxScale()*Fi,{maxImageWidth:c,maxImageHeight:d}=t.getMaxImageSize(r),p=Math.max(a,d*n);return{verticalLineContentWidth:Math.max(a,c*n),horizontalLineContentHeight:p}}function og(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function e0(r,t,n){return!(r===S.al.horizontal||!t&&!il(n)||t&&(rd[n]||(a=n,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(a)))));var a}function t0(r,t,n,a,c,d){const p=d[r.fontStack],g=function(w,M,C,A){if(w&&w.rect)return w;const L=M[C.fontStack],B=L&&L[A];return B?{rect:null,metrics:B.metrics}:null}(p&&p[t],c,r,t);if(g===null)return null;let x;if(n)x=a.verticalLineContentWidth-r.scale*Fi;else{const w=og(r.verticalAlign);x=(a.horizontalLineContentHeight-r.scale*Fi)*w}return{rect:g.rect,metrics:g.metrics,baselineOffset:x}}function i0(r,t,n,a,c){const d=c[r.imageName];if(!d)return null;const p=d.paddedRect,g=d.displaySize,x={width:g[0],height:g[1],left:Br,top:-3,advance:t?g[1]:g[0]};let w;if(t)w=a.verticalLineContentWidth-g[1]*r.scale;else{const M=og(r.verticalAlign);w=(a.horizontalLineContentHeight-g[1]*r.scale)*M}return{rect:p,metrics:x,baselineOffset:w,imageOffset:(t?g[0]:g[1])*r.scale-Fi*n}}function r0(r,t,n,a){if(a===0)return;const c=r[n],d=(r[n].x+c.metrics.advance*c.scale)*a;for(let p=t;p<=n;p++)r[p].x-=d}function n0(r,t,n){const{horizontalAlign:a,verticalAlign:c}=Ap(n),d=t[0]-r.displaySize[0]*a,p=t[1]-r.displaySize[1]*c;return{image:r,top:p,bottom:p+r.displaySize[1],left:d,right:d+r.displaySize[0]}}function lg(r){var t,n;let a=r.left,c=r.top,d=r.right-a,p=r.bottom-c;const g=(t=r.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",x=(n=r.image.textFitHeight)!==null&&n!==void 0?n:"stretchOrShrink",w=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(x==="proportional"){if(g==="stretchOnly"&&d/p<w||g==="proportional"){const M=Math.ceil(p*w);a*=M/d,d=M}}else if(g==="proportional"&&x==="stretchOnly"&&w!==0&&d/p>w){const M=Math.ceil(d/w);c*=M/p,p=M}return{x1:a,y1:c,x2:a+d,y2:c+p}}function cg(r,t,n,a,c,d){const p=r.image;let g;if(p.content){const $=p.content,X=p.pixelRatio||1;g=[$[0]/X,$[1]/X,p.displaySize[0]-$[2]/X,p.displaySize[1]-$[3]/X]}const x=t.left*d,w=t.right*d;let M,C,A,L;n==="width"||n==="both"?(L=c[0]+x-a[3],C=c[0]+w+a[1]):(L=c[0]+(x+w-p.displaySize[0])/2,C=L+p.displaySize[0]);const B=t.top*d,j=t.bottom*d;return n==="height"||n==="both"?(M=c[1]+B-a[0],A=c[1]+j+a[2]):(M=c[1]+(B+j-p.displaySize[1])/2,A=M+p.displaySize[1]),{image:p,top:M,right:C,bottom:A,left:L,collisionPadding:g}}const cu=255,aa=128,us=cu*aa;function ug(r,t){const{expression:n}=t;if(n.kind==="constant")return{kind:"constant",layoutSize:n.evaluate(new ti(r+1))};if(n.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:c}=n;let d=0;for(;d<a.length&&a[d]<=r;)d++;d=Math.max(0,d-1);let p=d;for(;p<a.length&&a[p]<r+1;)p++;p=Math.min(a.length-1,p);const g=a[d],x=a[p];return n.kind==="composite"?{kind:"composite",minZoom:g,maxZoom:x,interpolationType:c}:{kind:"camera",minZoom:g,maxZoom:x,minSize:n.evaluate(new ti(g)),maxSize:n.evaluate(new ti(x)),interpolationType:c}}}function Rp(r,t,n){let a="never";const c=r.get(t);return c?a=c:r.get(n)&&(a="always"),a}const a0=nu.VectorTileFeature.types,s0=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function nd(r,t,n,a,c,d,p,g,x,w,M,C,A){const L=g?Math.min(us,Math.round(g[0])):0,B=g?Math.min(us,Math.round(g[1])):0;r.emplaceBack(t,n,Math.round(32*a),Math.round(32*c),d,p,(L<<1)+(x?1:0),B,16*w,16*M,256*C,256*A)}function Dp(r,t,n){r.emplaceBack(t.x,t.y,n),r.emplaceBack(t.x,t.y,n),r.emplaceBack(t.x,t.y,n),r.emplaceBack(t.x,t.y,n)}function o0(r){for(const t of r.sections)if(lp(t.text))return!0;return!1}class Lp{constructor(t){this.layoutVertexArray=new me,this.indexArray=new Be,this.programConfigurations=t,this.segments=new st,this.dynamicLayoutVertexArray=new Se,this.opacityVertexArray=new Ce,this.hasVisibleVertices=!1,this.placedSymbolArray=new T}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,n,a,c){this.isEmpty()||(a&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Nv.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,n),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Zv.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,s0,!0),this.opacityVertexBuffer.itemSize=1),(a||c)&&this.programConfigurations.upload(t))}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.dynamicLayoutVertexBuffer.destroy(),this.opacityVertexBuffer.destroy())}}Ue("SymbolBuffers",Lp);class Bp{constructor(t,n,a){this.layoutVertexArray=new t,this.layoutAttributes=n,this.indexArray=new a,this.segments=new st,this.collisionVertexArray=new je}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Vv.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ue("CollisionBuffers",Bp);class fl{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(p=>p.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=ug(this.zoom,n["text-size"]),this.iconSizeData=ug(this.zoom,n["icon-size"]);const a=this.layers[0].layout,c=a.get("symbol-sort-key"),d=a.get("symbol-z-order");this.canOverlap=Rp(a,"text-overlap","text-allow-overlap")!=="never"||Rp(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!c.isConstant(),this.sortFeaturesByY=(d==="viewport-y"||d==="auto"&&!this.sortFeaturesByKey)&&this.canOverlap,a.get("symbol-placement")==="point"&&(this.writingModes=a.get("text-writing-mode").map(p=>S.al[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=t.sourceID}createArrays(){this.text=new Lp(new Aa(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Lp(new Aa(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new k,this.lineVertexArray=new F,this.symbolInstances=new E,this.textAnchorOffsets=new H}calculateGlyphDependencies(t,n,a,c,d){for(let p=0;p<t.length;p++)if(n[t.charCodeAt(p)]=!0,(a||c)&&d){const g=ou[t.charAt(p)];g&&(n[g.charCodeAt(0)]=!0)}}populate(t,n,a){const c=this.layers[0],d=c.layout,p=d.get("text-font"),g=d.get("text-field"),x=d.get("icon-image"),w=(g.value.kind!=="constant"||g.value.value instanceof wr&&!g.value.value.isEmpty()||g.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),M=x.value.kind!=="constant"||!!x.value.value||Object.keys(x.parameters).length>0,C=d.get("symbol-sort-key");if(this.features=[],!w&&!M)return;const A=n.iconDependencies,L=n.glyphDependencies,B=n.availableImages,j=new ti(this.zoom);for(const{feature:$,id:X,index:se,sourceLayerIndex:Y}of t){const R=c._featureFilter.needGeometry,U=na($,R);if(!c._featureFilter.filter(j,U,a))continue;let Q,fe;if(R||(U.geometry=Lr($)),w){const xe=c.getValueAndResolveTokens("text-field",U,a,B),we=wr.factory(xe),Le=this.hasRTLText=this.hasRTLText||o0(we);(!Le||ta.getRTLTextPluginStatus()==="unavailable"||Le&&ta.isParsed())&&(Q=$v(we,c,U))}if(M){const xe=c.getValueAndResolveTokens("icon-image",U,a,B);fe=xe instanceof Rr?xe:Rr.fromString(xe)}if(!Q&&!fe)continue;const ze=this.sortFeaturesByKey?C.evaluate(U,{},a):void 0;if(this.features.push({id:X,text:Q,icon:fe,index:se,sourceLayerIndex:Y,geometry:U.geometry,properties:$.properties,type:a0[$.type],sortKey:ze}),fe&&(A[fe.name]=!0),Q){const xe=p.evaluate(U,{},a).join(","),we=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(S.al.vertical)>=0;for(const Le of Q.sections)if(Le.image)A[Le.image.name]=!0;else{const Ae=el(Q.toString()),Fe=Le.fontStack||xe,Pe=L[Fe]=L[Fe]||{};this.calculateGlyphDependencies(Le.text,Pe,we,this.allowVerticalPlacement,Ae)}}}d.get("symbol-placement")==="line"&&(this.features=function($){const X={},se={},Y=[];let R=0;function U(xe){Y.push($[xe]),R++}function Q(xe,we,Le){const Ae=se[xe];return delete se[xe],se[we]=Ae,Y[Ae].geometry[0].pop(),Y[Ae].geometry[0]=Y[Ae].geometry[0].concat(Le[0]),Ae}function fe(xe,we,Le){const Ae=X[we];return delete X[we],X[xe]=Ae,Y[Ae].geometry[0].shift(),Y[Ae].geometry[0]=Le[0].concat(Y[Ae].geometry[0]),Ae}function ze(xe,we,Le){const Ae=Le?we[0][we[0].length-1]:we[0][0];return`${xe}:${Ae.x}:${Ae.y}`}for(let xe=0;xe<$.length;xe++){const we=$[xe],Le=we.geometry,Ae=we.text?we.text.toString():null;if(!Ae){U(xe);continue}const Fe=ze(Ae,Le),Pe=ze(Ae,Le,!0);if(Fe in se&&Pe in X&&se[Fe]!==X[Pe]){const Ge=fe(Fe,Pe,Le),tt=Q(Fe,Pe,Y[Ge].geometry);delete X[Fe],delete se[Pe],se[ze(Ae,Y[tt].geometry,!0)]=tt,Y[Ge].geometry=null}else Fe in se?Q(Fe,Pe,Le):Pe in X?fe(Fe,Pe,Le):(U(xe),X[Fe]=R-1,se[Pe]=R-1)}return Y.filter(xe=>xe.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort(($,X)=>$.sortKey-X.sortKey)}update(t,n,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,n,this.layers,a),this.icon.programConfigurations.updatePaintArrays(t,n,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,n){const a=this.lineVertexArray.length;if(t.segment!==void 0){let c=t.dist(n[t.segment+1]),d=t.dist(n[t.segment]);const p={};for(let g=t.segment+1;g<n.length;g++)p[g]={x:n[g].x,y:n[g].y,tileUnitDistanceFromAnchor:c},g<n.length-1&&(c+=n[g+1].dist(n[g]));for(let g=t.segment||0;g>=0;g--)p[g]={x:n[g].x,y:n[g].y,tileUnitDistanceFromAnchor:d},g>0&&(d+=n[g-1].dist(n[g]));for(let g=0;g<n.length;g++){const x=p[g];this.lineVertexArray.emplaceBack(x.x,x.y,x.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(t,n,a,c,d,p,g,x,w,M,C,A){const L=t.indexArray,B=t.layoutVertexArray,j=t.segments.prepareSegment(4*n.length,B,L,this.canOverlap?p.sortKey:void 0),$=this.glyphOffsetArray.length,X=j.vertexLength,se=this.allowVerticalPlacement&&g===S.al.vertical?Math.PI/2:0,Y=p.text&&p.text.sections;for(let R=0;R<n.length;R++){const{tl:U,tr:Q,bl:fe,br:ze,tex:xe,pixelOffsetTL:we,pixelOffsetBR:Le,minFontScaleX:Ae,minFontScaleY:Fe,glyphOffset:Pe,isSDF:Ge,sectionIndex:tt}=n[R],Je=j.vertexLength,We=Pe[1];nd(B,x.x,x.y,U.x,We+U.y,xe.x,xe.y,a,Ge,we.x,we.y,Ae,Fe),nd(B,x.x,x.y,Q.x,We+Q.y,xe.x+xe.w,xe.y,a,Ge,Le.x,we.y,Ae,Fe),nd(B,x.x,x.y,fe.x,We+fe.y,xe.x,xe.y+xe.h,a,Ge,we.x,Le.y,Ae,Fe),nd(B,x.x,x.y,ze.x,We+ze.y,xe.x+xe.w,xe.y+xe.h,a,Ge,Le.x,Le.y,Ae,Fe),Dp(t.dynamicLayoutVertexArray,x,se),L.emplaceBack(Je,Je+2,Je+1),L.emplaceBack(Je+1,Je+2,Je+3),j.vertexLength+=4,j.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Pe[0]),R!==n.length-1&&tt===n[R+1].sectionIndex||t.programConfigurations.populatePaintArrays(B.length,p,p.index,{},A,Y&&Y[tt])}t.placedSymbolArray.emplaceBack(x.x,x.y,$,this.glyphOffsetArray.length-$,X,w,M,x.segment,a?a[0]:0,a?a[1]:0,c[0],c[1],g,0,!1,0,C)}_addCollisionDebugVertex(t,n,a,c,d,p){return n.emplaceBack(0,0),t.emplaceBack(a.x,a.y,c,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(t,n,a,c,d,p,g){const x=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),w=x.vertexLength,M=d.layoutVertexArray,C=d.collisionVertexArray,A=g.anchorX,L=g.anchorY;this._addCollisionDebugVertex(M,C,p,A,L,new De(t,n)),this._addCollisionDebugVertex(M,C,p,A,L,new De(a,n)),this._addCollisionDebugVertex(M,C,p,A,L,new De(a,c)),this._addCollisionDebugVertex(M,C,p,A,L,new De(t,c)),x.vertexLength+=4;const B=d.indexArray;B.emplaceBack(w,w+1),B.emplaceBack(w+1,w+2),B.emplaceBack(w+2,w+3),B.emplaceBack(w+3,w),x.primitiveLength+=4}addDebugCollisionBoxes(t,n,a,c){for(let d=t;d<n;d++){const p=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,c?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Bp(Te,Ym.members,Ee),this.iconCollisionBox=new Bp(Te,Ym.members,Ee);for(let t=0;t<this.symbolInstances.length;t++){const n=this.symbolInstances.get(t);this.addDebugCollisionBoxes(n.textBoxStartIndex,n.textBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.iconBoxStartIndex,n.iconBoxEndIndex,n,!1),this.addDebugCollisionBoxes(n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex,n,!1)}}_deserializeCollisionBoxesForSymbol(t,n,a,c,d,p,g,x,w){const M={};for(let C=n;C<a;C++){const A=t.get(C);M.textBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},M.textFeatureIndex=A.featureIndex;break}for(let C=c;C<d;C++){const A=t.get(C);M.verticalTextBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},M.verticalTextFeatureIndex=A.featureIndex;break}for(let C=p;C<g;C++){const A=t.get(C);M.iconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},M.iconFeatureIndex=A.featureIndex;break}for(let C=x;C<w;C++){const A=t.get(C);M.verticalIconBox={x1:A.x1,y1:A.y1,x2:A.x2,y2:A.y2,anchorPointX:A.anchorPointX,anchorPointY:A.anchorPointY},M.verticalIconFeatureIndex=A.featureIndex;break}return M}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let n=0;n<this.symbolInstances.length;n++){const a=this.symbolInstances.get(n);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,n){const a=t.placedSymbolArray.get(n),c=a.vertexStartIndex+4*a.numGlyphs;for(let d=a.vertexStartIndex;d<c;d+=4)t.indexArray.emplaceBack(d,d+2,d+1),t.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const n=Math.sin(t),a=Math.cos(t),c=[],d=[],p=[];for(let g=0;g<this.symbolInstances.length;++g){p.push(g);const x=this.symbolInstances.get(g);c.push(0|Math.round(n*x.anchorX+a*x.anchorY)),d.push(x.featureIndex)}return p.sort((g,x)=>c[g]-c[x]||d[x]-d[g]),p}addToSortKeyRanges(t,n){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===n?a.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:n,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const n of this.symbolInstanceIndexes){const a=this.symbolInstances.get(n);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((c,d,p)=>{c>=0&&p.indexOf(c)===d&&this.addIndicesForPlacedSymbol(this.text,c)}),a.verticalPlacedTextSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.text,a.verticalPlacedTextSymbolIndex),a.placedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.placedIconSymbolIndex),a.verticalPlacedIconSymbolIndex>=0&&this.addIndicesForPlacedSymbol(this.icon,a.verticalPlacedIconSymbolIndex)}this.text.indexBuffer&&this.text.indexBuffer.updateData(this.text.indexArray),this.icon.indexBuffer&&this.icon.indexBuffer.updateData(this.icon.indexArray)}}}let hg,dg;Ue("SymbolBucket",fl,{omit:["layers","collisionBoxArray","features","compareText"]}),fl.MAX_GLYPHS=65535,fl.addDynamicAttributes=Dp;var Fp={get paint(){return dg=dg||new Sr({"icon-opacity":new nt(V.paint_symbol["icon-opacity"]),"icon-color":new nt(V.paint_symbol["icon-color"]),"icon-halo-color":new nt(V.paint_symbol["icon-halo-color"]),"icon-halo-width":new nt(V.paint_symbol["icon-halo-width"]),"icon-halo-blur":new nt(V.paint_symbol["icon-halo-blur"]),"icon-translate":new Ye(V.paint_symbol["icon-translate"]),"icon-translate-anchor":new Ye(V.paint_symbol["icon-translate-anchor"]),"text-opacity":new nt(V.paint_symbol["text-opacity"]),"text-color":new nt(V.paint_symbol["text-color"],{runtimeType:fr,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new nt(V.paint_symbol["text-halo-color"]),"text-halo-width":new nt(V.paint_symbol["text-halo-width"]),"text-halo-blur":new nt(V.paint_symbol["text-halo-blur"]),"text-translate":new Ye(V.paint_symbol["text-translate"]),"text-translate-anchor":new Ye(V.paint_symbol["text-translate-anchor"])})},get layout(){return hg=hg||new Sr({"symbol-placement":new Ye(V.layout_symbol["symbol-placement"]),"symbol-spacing":new Ye(V.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Ye(V.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new nt(V.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Ye(V.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Ye(V.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Ye(V.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Ye(V.layout_symbol["icon-ignore-placement"]),"icon-optional":new Ye(V.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Ye(V.layout_symbol["icon-rotation-alignment"]),"icon-size":new nt(V.layout_symbol["icon-size"]),"icon-text-fit":new Ye(V.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Ye(V.layout_symbol["icon-text-fit-padding"]),"icon-image":new nt(V.layout_symbol["icon-image"]),"icon-rotate":new nt(V.layout_symbol["icon-rotate"]),"icon-padding":new nt(V.layout_symbol["icon-padding"]),"icon-keep-upright":new Ye(V.layout_symbol["icon-keep-upright"]),"icon-offset":new nt(V.layout_symbol["icon-offset"]),"icon-anchor":new nt(V.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Ye(V.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Ye(V.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Ye(V.layout_symbol["text-rotation-alignment"]),"text-field":new nt(V.layout_symbol["text-field"]),"text-font":new nt(V.layout_symbol["text-font"]),"text-size":new nt(V.layout_symbol["text-size"]),"text-max-width":new nt(V.layout_symbol["text-max-width"]),"text-line-height":new Ye(V.layout_symbol["text-line-height"]),"text-letter-spacing":new nt(V.layout_symbol["text-letter-spacing"]),"text-justify":new nt(V.layout_symbol["text-justify"]),"text-radial-offset":new nt(V.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Ye(V.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new nt(V.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new nt(V.layout_symbol["text-anchor"]),"text-max-angle":new Ye(V.layout_symbol["text-max-angle"]),"text-writing-mode":new Ye(V.layout_symbol["text-writing-mode"]),"text-rotate":new nt(V.layout_symbol["text-rotate"]),"text-padding":new Ye(V.layout_symbol["text-padding"]),"text-keep-upright":new Ye(V.layout_symbol["text-keep-upright"]),"text-transform":new nt(V.layout_symbol["text-transform"]),"text-offset":new nt(V.layout_symbol["text-offset"]),"text-allow-overlap":new Ye(V.layout_symbol["text-allow-overlap"]),"text-overlap":new Ye(V.layout_symbol["text-overlap"]),"text-ignore-placement":new Ye(V.layout_symbol["text-ignore-placement"]),"text-optional":new Ye(V.layout_symbol["text-optional"])})}};class pg{constructor(t){if(t.property.overrides===void 0)throw new Error("overrides must be provided to instantiate FormatSectionOverride class");this.type=t.property.overrides?t.property.overrides.runtimeType:It,this.defaultValue=t}evaluate(t){if(t.formattedSection){const n=this.defaultValue.property.overrides;if(n&&n.hasOverride(t.formattedSection))return n.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ue("FormatSectionOverride",pg,{omit:["defaultValue"]});class ad extends yn{constructor(t){super(t,Fp)}recalculate(t,n){if(super.recalculate(t,n),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const a=this.layout.get("text-writing-mode");if(a){const c=[];for(const d of a)c.indexOf(d)<0&&c.push(d);this.layout._values["text-writing-mode"]=c}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,n,a,c){const d=this.layout.get(t).evaluate(n,{},a,c),p=this._unevaluatedLayout._values[t];return p.isDataDriven()||Ma(p.value)||!d?d:function(g,x){return x.replace(/{([^{}]+)}/g,(w,M)=>g&&M in g?String(g[M]):"")}(n.properties,d)}createBucket(t){return new fl(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Fp.paint.overridableProperties){if(!ad.hasPaintOverride(this.layout,t))continue;const n=this.paint.get(t),a=new pg(n),c=new yc(a,n.property.specification);let d=null;d=n.value.kind==="constant"||n.value.kind==="source"?new xc("source",c):new vc("composite",c,n.value.zoomStops),this.paint._values[t]=new _n(n.property,d,n.parameters)}}_handleOverridablePaintPropertyUpdate(t,n,a){return!(!this.layout||n.isDataDriven()||a.isDataDriven())&&ad.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,n){const a=t.get("text-field"),c=Fp.paint.properties[n];let d=!1;const p=g=>{for(const x of g)if(c.overrides&&c.overrides.hasOverride(x))return void(d=!0)};if(a.value.kind==="constant"&&a.value.value instanceof wr)p(a.value.value.sections);else if(a.value.kind==="source"){const g=w=>{d||(w instanceof Yn&&vi(w.value)===_a?p(w.value.sections):w instanceof Do?p(w.sections):w.eachChild(g))},x=a.value;x._styleExpression&&g(x._styleExpression.expression)}return d}}let fg;var l0={get paint(){return fg=fg||new Sr({"background-color":new Ye(V.paint_background["background-color"]),"background-pattern":new jc(V.paint_background["background-pattern"]),"background-opacity":new Ye(V.paint_background["background-opacity"])})}};class c0 extends yn{constructor(t){super(t,l0)}}let mg;var u0={get paint(){return mg=mg||new Sr({"raster-opacity":new Ye(V.paint_raster["raster-opacity"]),"raster-hue-rotate":new Ye(V.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Ye(V.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Ye(V.paint_raster["raster-brightness-max"]),"raster-saturation":new Ye(V.paint_raster["raster-saturation"]),"raster-contrast":new Ye(V.paint_raster["raster-contrast"]),"raster-resampling":new Ye(V.paint_raster["raster-resampling"]),"raster-fade-duration":new Ye(V.paint_raster["raster-fade-duration"])})}};class h0 extends yn{constructor(t){super(t,u0)}}class d0 extends yn{constructor(t){super(t,{}),this.onAdd=n=>{this.implementation.onAdd&&this.implementation.onAdd(n,n.painter.context.gl)},this.onRemove=n=>{this.implementation.onRemove&&this.implementation.onRemove(n,n.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class p0{constructor(t){this._methodToThrottle=t,this._triggered=!1,typeof MessageChannel<"u"&&(this._channel=new MessageChannel,this._channel.port2.onmessage=()=>{this._triggered=!1,this._methodToThrottle()})}trigger(){this._triggered||(this._triggered=!0,this._channel?this._channel.port1.postMessage(!0):setTimeout(()=>{this._triggered=!1,this._methodToThrottle()},0))}remove(){delete this._channel,this._methodToThrottle=()=>{}}}const f0={once:!0},Op=63710088e-1;class hs{constructor(t,n){if(isNaN(t)||isNaN(n))throw new Error(`Invalid LngLat object: (${t}, ${n})`);if(this.lng=+t,this.lat=+n,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new hs(hn(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const n=Math.PI/180,a=this.lat*n,c=t.lat*n,d=Math.sin(a)*Math.sin(c)+Math.cos(a)*Math.cos(c)*Math.cos((t.lng-this.lng)*n);return Op*Math.acos(Math.min(d,1))}static convert(t){if(t instanceof hs)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new hs(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new hs(Number("lng"in t?t.lng:t.lon),Number(t.lat));throw new Error("`LngLatLike` argument must be specified as a LngLat instance, an object {lng: <lng>, lat: <lat>}, an object {lon: <lng>, lat: <lat>}, or an array of [<lng>, <lat>]")}}const gg=2*Math.PI*Op;function _g(r){return gg*Math.cos(r*Math.PI/180)}function yg(r){return(180+r)/360}function xg(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function vg(r,t){return r/_g(t)}function jp(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function bg(r,t){return r*_g(jp(t))}class uu{constructor(t,n,a=0){this.x=+t,this.y=+n,this.z=+a}static fromLngLat(t,n=0){const a=hs.convert(t);return new uu(yg(a.lng),xg(a.lat),vg(n,a.lat))}toLngLat(){return new hs(360*this.x-180,jp(this.y))}toAltitude(){return bg(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/gg*(t=jp(this.y),1/Math.cos(t*Math.PI/180));var t}}function wg(r,t,n){var a=2*Math.PI*6378137/256/Math.pow(2,n);return[r*a-2*Math.PI*6378137/2,t*a-2*Math.PI*6378137/2]}class Np{constructor(t,n,a){if(!function(c,d,p){return!(c<0||c>25||p<0||p>=Math.pow(2,c)||d<0||d>=Math.pow(2,c))}(t,n,a))throw new Error(`x=${n}, y=${a}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=n,this.y=a,this.key=ml(0,t,t,n,a)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,n,a){const c=(p=this.y,g=this.z,x=wg(256*(d=this.x),256*(p=Math.pow(2,g)-p-1),g),w=wg(256*(d+1),256*(p+1),g),x[0]+","+x[1]+","+w[0]+","+w[1]);var d,p,g,x,w;const M=function(C,A,L){let B,j="";for(let $=C;$>0;$--)B=1<<$-1,j+=(A&B?1:0)+(L&B?2:0);return j}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,n>1?"@2x":"").replace(/{quadkey}/g,M).replace(/{bbox-epsg-3857}/g,c)}isChildOf(t){const n=this.z-t.z;return n>0&&t.x===this.x>>n&&t.y===this.y>>n}getTilePoint(t){const n=Math.pow(2,this.z);return new De((t.x*n-this.x)*Ft,(t.y*n-this.y)*Ft)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Tg{constructor(t,n){this.wrap=t,this.canonical=n,this.key=ml(t,n.z,n.z,n.x,n.y)}}class nn{constructor(t,n,a,c,d){if(this.terrainRttPosMatrix32f=null,t<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${a}`);this.overscaledZ=t,this.wrap=n,this.canonical=new Np(a,+c,+d),this.key=ml(n,t,a,c,d)}clone(){return new nn(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const n=this.canonical.z-t;return t>this.canonical.z?new nn(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new nn(t,this.wrap,t,this.canonical.x>>n,this.canonical.y>>n)}calculateScaledKey(t,n){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-t;return t>this.canonical.z?ml(this.wrap*+n,t,this.canonical.z,this.canonical.x,this.canonical.y):ml(this.wrap*+n,t,t,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const n=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>n&&t.canonical.y===this.canonical.y>>n}children(t){if(this.overscaledZ>=t)return[new nn(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const n=this.canonical.z+1,a=2*this.canonical.x,c=2*this.canonical.y;return[new nn(n,this.wrap,n,a,c),new nn(n,this.wrap,n,a+1,c),new nn(n,this.wrap,n,a,c+1),new nn(n,this.wrap,n,a+1,c+1)]}isLessThan(t){return this.wrap<t.wrap||!(this.wrap>t.wrap)&&(this.overscaledZ<t.overscaledZ||!(this.overscaledZ>t.overscaledZ)&&(this.canonical.x<t.canonical.x||!(this.canonical.x>t.canonical.x)&&this.canonical.y<t.canonical.y))}wrapped(){return new nn(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new nn(this.overscaledZ,t,this.canonical.z,this.canonical.x,this.canonical.y)}overscaleFactor(){return Math.pow(2,this.overscaledZ-this.canonical.z)}toUnwrapped(){return new Tg(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new uu(t.x-this.wrap,t.y))}}function ml(r,t,n,a,c){(r*=2)<0&&(r=-1*r-1);const d=1<<n;return(d*d*r+d*c+a).toString(36)+n.toString(36)+t.toString(36)}Ue("CanonicalTileID",Np),Ue("OverscaledTileID",nn,{omit:["terrainRttPosMatrix32f"]});class Mg{constructor(t,n,a,c=1,d=1,p=1,g=0){if(this.uid=t,n.height!==n.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void Zi(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=n.height;const x=this.dim=n.height-2;switch(this.data=new Uint32Array(n.data.buffer),a){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=c,this.greenFactor=d,this.blueFactor=p,this.baseShift=g;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let w=0;w<x;w++)this.data[this._idx(-1,w)]=this.data[this._idx(0,w)],this.data[this._idx(x,w)]=this.data[this._idx(x-1,w)],this.data[this._idx(w,-1)]=this.data[this._idx(w,0)],this.data[this._idx(w,x)]=this.data[this._idx(w,x-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(x,-1)]=this.data[this._idx(x-1,0)],this.data[this._idx(-1,x)]=this.data[this._idx(0,x-1)],this.data[this._idx(x,x)]=this.data[this._idx(x-1,x-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let w=0;w<x;w++)for(let M=0;M<x;M++){const C=this.get(w,M);C>this.max&&(this.max=C),C<this.min&&(this.min=C)}}get(t,n){const a=new Uint8Array(this.data.buffer),c=4*this._idx(t,n);return this.unpack(a[c],a[c+1],a[c+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,n){if(t<-1||t>=this.dim+1||n<-1||n>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(n+1)*this.stride+(t+1)}unpack(t,n,a){return t*this.redFactor+n*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new rn({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,n,a){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let c=n*this.dim,d=n*this.dim+this.dim,p=a*this.dim,g=a*this.dim+this.dim;switch(n){case-1:c=d-1;break;case 1:d=c+1}switch(a){case-1:p=g-1;break;case 1:g=p+1}const x=-n*this.dim,w=-a*this.dim;for(let M=p;M<g;M++)for(let C=c;C<d;C++)this.data[this._idx(C,M)]=t.data[this._idx(C+x,M+w)]}}Ue("DEMData",Mg);class Sg{constructor(t){this._stringToNumber={},this._numberToString=[];for(let n=0;n<t.length;n++){const a=t[n];this._stringToNumber[a]=n,this._numberToString[n]=a}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class Pg{constructor(t,n,a,c,d){this.type="Feature",this._vectorTileFeature=t,t._z=n,t._x=a,t._y=c,this.properties=t.properties,this.id=d}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const n in this)n!=="_geometry"&&n!=="_vectorTileFeature"&&(t[n]=this[n]);return t}}class Cg{constructor(t,n){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new kn(Ft,16,0),this.grid3D=new kn(Ft,16,0),this.featureIndexArray=new W,this.promoteId=n}insert(t,n,a,c,d,p){const g=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,c,d);const x=p?this.grid3D:this.grid;for(let w=0;w<n.length;w++){const M=n[w],C=[1/0,1/0,-1/0,-1/0];for(let A=0;A<M.length;A++){const L=M[A];C[0]=Math.min(C[0],L.x),C[1]=Math.min(C[1],L.y),C[2]=Math.max(C[2],L.x),C[3]=Math.max(C[3],L.y)}C[0]<Ft&&C[1]<Ft&&C[2]>=0&&C[3]>=0&&x.insert(g,C[0],C[1],C[2],C[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new nu.VectorTile(new Ip(this.rawTileData)).layers,this.sourceLayerCoder=new Sg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,n,a,c){this.loadVTLayers();const d=t.params,p=Ft/t.tileSize/t.scale,g=bc(d.filter),x=t.queryGeometry,w=t.queryPadding*p,M=Eg(x),C=this.grid.query(M.minX-w,M.minY-w,M.maxX+w,M.maxY+w),A=Eg(t.cameraQueryGeometry),L=this.grid3D.query(A.minX-w,A.minY-w,A.maxX+w,A.maxY+w,($,X,se,Y)=>function(R,U,Q,fe,ze){for(const we of R)if(U<=we.x&&Q<=we.y&&fe>=we.x&&ze>=we.y)return!0;const xe=[new De(U,Q),new De(U,ze),new De(fe,ze),new De(fe,Q)];if(R.length>2){for(const we of xe)if(Qs(R,we))return!0}for(let we=0;we<R.length-1;we++)if(iv(R[we],R[we+1],xe))return!0;return!1}(t.cameraQueryGeometry,$-w,X-w,se+w,Y+w));for(const $ of L)C.push($);C.sort(m0);const B={};let j;for(let $=0;$<C.length;$++){const X=C[$];if(X===j)continue;j=X;const se=this.featureIndexArray.get(X);let Y=null;this.loadMatchingFeature(B,se.bucketIndex,se.sourceLayerIndex,se.featureIndex,g,d.layers,d.availableImages,n,a,c,(R,U,Q)=>(Y||(Y=Lr(R)),U.queryIntersectsFeature({queryGeometry:x,feature:R,featureState:Q,geometry:Y,zoom:this.z,transform:t.transform,pixelsToTileUnits:p,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return B}loadMatchingFeature(t,n,a,c,d,p,g,x,w,M,C){const A=this.bucketLayerIDs[n];if(p&&!A.some($=>p.has($)))return;const L=this.sourceLayerCoder.decode(a),B=this.vtLayers[L].feature(c);if(d.needGeometry){const $=na(B,!0);if(!d.filter(new ti(this.tileID.overscaledZ),$,this.tileID.canonical))return}else if(!d.filter(new ti(this.tileID.overscaledZ),B))return;const j=this.getId(B,L);for(let $=0;$<A.length;$++){const X=A[$];if(p&&!p.has(X))continue;const se=x[X];if(!se)continue;let Y={};j&&M&&(Y=M.getState(se.sourceLayer||"_geojsonTileLayer",j));const R=hr({},w[X]);R.paint=Ig(R.paint,se.paint,B,Y,g),R.layout=Ig(R.layout,se.layout,B,Y,g);const U=!C||C(B,se,Y);if(!U)continue;const Q=new Pg(B,this.z,this.x,this.y,j);Q.layer=R;let fe=t[X];fe===void 0&&(fe=t[X]=[]),fe.push({featureIndex:c,feature:Q,intersectionZ:U})}}lookupSymbolFeatures(t,n,a,c,d,p,g,x){const w={};this.loadVTLayers();const M=bc(d);for(const C of t)this.loadMatchingFeature(w,a,c,C,M,p,g,x,n);return w}hasLayer(t){for(const n of this.bucketLayerIDs)for(const a of n)if(t===a)return!0;return!1}getId(t,n){var a;let c=t.id;return this.promoteId&&(c=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[n]],typeof c=="boolean"&&(c=Number(c)),c===void 0&&(!((a=t.properties)===null||a===void 0)&&a.cluster)&&this.promoteId&&(c=Number(t.properties.cluster_id))),c}}function Ig(r,t,n,a,c){return Cn(r,(d,p)=>{const g=t instanceof nl?t.get(p):null;return g&&g.evaluate?g.evaluate(n,a,c):g})}function Eg(r){let t=1/0,n=1/0,a=-1/0,c=-1/0;for(const d of r)t=Math.min(t,d.x),n=Math.min(n,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return{minX:t,minY:n,maxX:a,maxY:c}}function m0(r,t){return t-r}function kg(r,t,n,a,c){const d=[];for(let p=0;p<r.length;p++){const g=r[p];let x;for(let w=0;w<g.length-1;w++){let M=g[w],C=g[w+1];M.x<t&&C.x<t||(M.x<t?M=new De(t,M.y+(t-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x<t&&(C=new De(t,M.y+(t-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y<n&&C.y<n||(M.y<n?M=new De(M.x+(n-M.y)/(C.y-M.y)*(C.x-M.x),n)._round():C.y<n&&(C=new De(M.x+(n-M.y)/(C.y-M.y)*(C.x-M.x),n)._round()),M.x>=a&&C.x>=a||(M.x>=a?M=new De(a,M.y+(a-M.x)/(C.x-M.x)*(C.y-M.y))._round():C.x>=a&&(C=new De(a,M.y+(a-M.x)/(C.x-M.x)*(C.y-M.y))._round()),M.y>=c&&C.y>=c||(M.y>=c?M=new De(M.x+(c-M.y)/(C.y-M.y)*(C.x-M.x),c)._round():C.y>=c&&(C=new De(M.x+(c-M.y)/(C.y-M.y)*(C.x-M.x),c)._round()),x&&M.equals(x[x.length-1])||(x=[M],d.push(x)),x.push(C)))))}}return d}Ue("FeatureIndex",Cg,{omit:["rawTileData","sourceLayerCoder"]});class ds extends De{constructor(t,n,a,c){super(t,n),this.angle=a,c!==void 0&&(this.segment=c)}clone(){return new ds(this.x,this.y,this.angle,this.segment)}}function zg(r,t,n,a,c){if(t.segment===void 0||n===0)return!0;let d=t,p=t.segment+1,g=0;for(;g>-n/2;){if(p--,p<0)return!1;g-=r[p].dist(d),d=r[p]}g+=r[p].dist(r[p+1]),p++;const x=[];let w=0;for(;g<n/2;){const M=r[p],C=r[p+1];if(!C)return!1;let A=r[p-1].angleTo(M)-M.angleTo(C);for(A=Math.abs((A+3*Math.PI)%(2*Math.PI)-Math.PI),x.push({distance:g,angleDelta:A}),w+=A;g-x[0].distance>a;)w-=x.shift().angleDelta;if(w>c)return!1;p++,g+=M.dist(C)}return!0}function Ag(r){let t=0;for(let n=0;n<r.length-1;n++)t+=r[n].dist(r[n+1]);return t}function Rg(r,t,n){return r?.6*t*n:0}function Dg(r,t){return Math.max(r?r.right-r.left:0,t?t.right-t.left:0)}function g0(r,t,n,a,c,d){const p=Rg(n,c,d),g=Dg(n,a)*d;let x=0;const w=Ag(r)/2;for(let M=0;M<r.length-1;M++){const C=r[M],A=r[M+1],L=C.dist(A);if(x+L>w){const B=(w-x)/L,j=Qt.number(C.x,A.x,B),$=Qt.number(C.y,A.y,B),X=new ds(j,$,A.angleTo(C),M);return X._round(),!p||zg(r,X,g,p,t)?X:void 0}x+=L}}function _0(r,t,n,a,c,d,p,g,x){const w=Rg(a,d,p),M=Dg(a,c),C=M*p,A=r[0].x===0||r[0].x===x||r[0].y===0||r[0].y===x;return t-C<t/4&&(t=C+t/4),Lg(r,A?t/2*g%t:(M/2+2*d)*p*g%t,t,w,n,C,A,!1,x)}function Lg(r,t,n,a,c,d,p,g,x){const w=d/2,M=Ag(r);let C=0,A=t-n,L=[];for(let B=0;B<r.length-1;B++){const j=r[B],$=r[B+1],X=j.dist($),se=$.angleTo(j);for(;A+n<C+X;){A+=n;const Y=(A-C)/X,R=Qt.number(j.x,$.x,Y),U=Qt.number(j.y,$.y,Y);if(R>=0&&R<x&&U>=0&&U<x&&A-w>=0&&A+w<=M){const Q=new ds(R,U,se,B);Q._round(),a&&!zg(r,Q,d,a,c)||L.push(Q)}}C+=X}return g||L.length||p||(L=Lg(r,C/2,n,a,c,d,p,!0,x)),L}Ue("Anchor",ds);const hu=Br;function Bg(r,t,n,a){const c=[],d=r.image,p=d.pixelRatio,g=d.paddedRect.w-2*hu,x=d.paddedRect.h-2*hu;let w={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const M=d.stretchX||[[0,g]],C=d.stretchY||[[0,x]],A=(Pe,Ge)=>Pe+Ge[1]-Ge[0],L=M.reduce(A,0),B=C.reduce(A,0),j=g-L,$=x-B;let X=0,se=L,Y=0,R=B,U=0,Q=j,fe=0,ze=$;if(d.content&&a){const Pe=d.content,Ge=Pe[2]-Pe[0],tt=Pe[3]-Pe[1];(d.textFitWidth||d.textFitHeight)&&(w=lg(r)),X=sd(M,0,Pe[0]),Y=sd(C,0,Pe[1]),se=sd(M,Pe[0],Pe[2]),R=sd(C,Pe[1],Pe[3]),U=Pe[0]-X,fe=Pe[1]-Y,Q=Ge-se,ze=tt-R}const xe=w.x1,we=w.y1,Le=w.x2-xe,Ae=w.y2-we,Fe=(Pe,Ge,tt,Je)=>{const We=od(Pe.stretch-X,se,Le,xe),wt=ld(Pe.fixed-U,Q,Pe.stretch,L),wi=od(Ge.stretch-Y,R,Ae,we),Oi=ld(Ge.fixed-fe,ze,Ge.stretch,B),ur=od(tt.stretch-X,se,Le,xe),an=ld(tt.fixed-U,Q,tt.stretch,L),Fr=od(Je.stretch-Y,R,Ae,we),Qi=ld(Je.fixed-fe,ze,Je.stretch,B),gi=new De(We,wi),qi=new De(ur,wi),er=new De(ur,Fr),tr=new De(We,Fr),Pr=new De(wt/p,Oi/p),sn=new De(an/p,Qi/p),Hi=t*Math.PI/180;if(Hi){const Wi=Math.sin(Hi),Xi=Math.cos(Hi),Ai=[Xi,-Wi,Wi,Xi];gi._matMult(Ai),qi._matMult(Ai),tr._matMult(Ai),er._matMult(Ai)}const Or=Pe.stretch+Pe.fixed,ji=Ge.stretch+Ge.fixed;return{tl:gi,tr:qi,bl:tr,br:er,tex:{x:d.paddedRect.x+hu+Or,y:d.paddedRect.y+hu+ji,w:tt.stretch+tt.fixed-Or,h:Je.stretch+Je.fixed-ji},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:Pr,pixelOffsetBR:sn,minFontScaleX:Q/p/Le,minFontScaleY:ze/p/Ae,isSDF:n}};if(a&&(d.stretchX||d.stretchY)){const Pe=Fg(M,j,L),Ge=Fg(C,$,B);for(let tt=0;tt<Pe.length-1;tt++){const Je=Pe[tt],We=Pe[tt+1];for(let wt=0;wt<Ge.length-1;wt++)c.push(Fe(Je,Ge[wt],We,Ge[wt+1]))}}else c.push(Fe({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:g+1},{fixed:0,stretch:x+1}));return c}function sd(r,t,n){let a=0;for(const c of r)a+=Math.max(t,Math.min(n,c[1]))-Math.max(t,Math.min(n,c[0]));return a}function Fg(r,t,n){const a=[{fixed:-1,stretch:0}];for(const[c,d]of r){const p=a[a.length-1];a.push({fixed:c-p.stretch,stretch:p.stretch}),a.push({fixed:c-p.stretch,stretch:p.stretch+(d-c)})}return a.push({fixed:t+hu,stretch:n}),a}function od(r,t,n,a){return r/t*n+a}function ld(r,t,n,a){return r-t*n/a}class cd{constructor(t,n,a,c,d,p,g,x,w,M){var C;if(this.boxStartIndex=t.length,w){let A=p.top,L=p.bottom;const B=p.collisionPadding;B&&(A-=B[1],L+=B[3]);let j=L-A;j>0&&(j=Math.max(10,j),this.circleDiameter=j)}else{const A=!((C=p.image)===null||C===void 0)&&C.content&&(p.image.textFitWidth||p.image.textFitHeight)?lg(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};A.y1=A.y1*g-x[0],A.y2=A.y2*g+x[2],A.x1=A.x1*g-x[3],A.x2=A.x2*g+x[1];const L=p.collisionPadding;if(L&&(A.x1-=L[0]*g,A.y1-=L[1]*g,A.x2+=L[2]*g,A.y2+=L[3]*g),M){const B=new De(A.x1,A.y1),j=new De(A.x2,A.y1),$=new De(A.x1,A.y2),X=new De(A.x2,A.y2),se=M*Math.PI/180;B._rotate(se),j._rotate(se),$._rotate(se),X._rotate(se),A.x1=Math.min(B.x,j.x,$.x,X.x),A.x2=Math.max(B.x,j.x,$.x,X.x),A.y1=Math.min(B.y,j.y,$.y,X.y),A.y2=Math.max(B.y,j.y,$.y,X.y)}t.emplaceBack(n.x,n.y,A.x1,A.y1,A.x2,A.y2,a,c,d)}this.boxEndIndex=t.length}}class y0{constructor(t=[],n=(a,c)=>a<c?-1:a>c?1:0){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:n,compare:a}=this,c=n[t];for(;t>0;){const d=t-1>>1,p=n[d];if(a(c,p)>=0)break;n[t]=p,t=d}n[t]=c}_down(t){const{data:n,compare:a}=this,c=this.length>>1,d=n[t];for(;t<c;){let p=1+(t<<1);const g=p+1;if(g<this.length&&a(n[g],n[p])<0&&(p=g),a(n[p],d)>=0)break;n[t]=n[p],t=p}n[t]=d}}function x0(r,t=1,n=!1){let a=1/0,c=1/0,d=-1/0,p=-1/0;const g=r[0];for(let L=0;L<g.length;L++){const B=g[L];(!L||B.x<a)&&(a=B.x),(!L||B.y<c)&&(c=B.y),(!L||B.x>d)&&(d=B.x),(!L||B.y>p)&&(p=B.y)}const x=Math.min(d-a,p-c);let w=x/2;const M=new y0([],v0);if(x===0)return new De(a,c);for(let L=a;L<d;L+=x)for(let B=c;B<p;B+=x)M.push(new gl(L+w,B+w,w,r));let C=function(L){let B=0,j=0,$=0;const X=L[0];for(let se=0,Y=X.length,R=Y-1;se<Y;R=se++){const U=X[se],Q=X[R],fe=U.x*Q.y-Q.x*U.y;j+=(U.x+Q.x)*fe,$+=(U.y+Q.y)*fe,B+=3*fe}return new gl(j/B,$/B,0,L)}(r),A=M.length;for(;M.length;){const L=M.pop();(L.d>C.d||!C.d)&&(C=L,n&&console.log("found best %d after %d probes",Math.round(1e4*L.d)/1e4,A)),L.max-C.d<=t||(w=L.h/2,M.push(new gl(L.p.x-w,L.p.y-w,w,r)),M.push(new gl(L.p.x+w,L.p.y-w,w,r)),M.push(new gl(L.p.x-w,L.p.y+w,w,r)),M.push(new gl(L.p.x+w,L.p.y+w,w,r)),A+=4)}return n&&(console.log(`num probes: ${A}`),console.log(`best distance: ${C.d}`)),C.p}function v0(r,t){return t.max-r.max}function gl(r,t,n,a){this.p=new De(r,t),this.h=n,this.d=function(c,d){let p=!1,g=1/0;for(let x=0;x<d.length;x++){const w=d[x];for(let M=0,C=w.length,A=C-1;M<C;A=M++){const L=w[M],B=w[A];L.y>c.y!=B.y>c.y&&c.x<(B.x-L.x)*(c.y-L.y)/(B.y-L.y)+L.x&&(p=!p),g=Math.min(g,_m(c,L,B))}}return(p?1:-1)*Math.sqrt(g)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var cr;S.aB=void 0,(cr=S.aB||(S.aB={}))[cr.center=1]="center",cr[cr.left=2]="left",cr[cr.right=3]="right",cr[cr.top=4]="top",cr[cr.bottom=5]="bottom",cr[cr["top-left"]=6]="top-left",cr[cr["top-right"]=7]="top-right",cr[cr["bottom-left"]=8]="bottom-left",cr[cr["bottom-right"]=9]="bottom-right";const ps=7,Zp=Number.POSITIVE_INFINITY;function Og(r,t){return t[1]!==Zp?function(n,a,c){let d=0,p=0;switch(a=Math.abs(a),c=Math.abs(c),n){case"top-right":case"top-left":case"top":p=c-ps;break;case"bottom-right":case"bottom-left":case"bottom":p=-c+ps}switch(n){case"top-right":case"bottom-right":case"right":d=-a;break;case"top-left":case"bottom-left":case"left":d=a}return[d,p]}(r,t[0],t[1]):function(n,a){let c=0,d=0;a<0&&(a=0);const p=a/Math.SQRT2;switch(n){case"top-right":case"top-left":d=p-ps;break;case"bottom-right":case"bottom-left":d=-p+ps;break;case"bottom":d=-a+ps;break;case"top":d=a-ps}switch(n){case"top-right":case"bottom-right":c=-p;break;case"top-left":case"bottom-left":c=p;break;case"left":c=a;break;case"right":c=-a}return[c,d]}(r,t[0])}function jg(r,t,n){var a;const c=r.layout,d=(a=c.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(t,{},n);if(d){const g=d.values,x=[];for(let w=0;w<g.length;w+=2){const M=x[w]=g[w],C=g[w+1].map(A=>A*Fi);M.startsWith("top")?C[1]-=ps:M.startsWith("bottom")&&(C[1]+=ps),x[w+1]=C}return new Yi(x)}const p=c.get("text-variable-anchor");if(p){let g;g=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[c.get("text-radial-offset").evaluate(t,{},n)*Fi,Zp]:c.get("text-offset").evaluate(t,{},n).map(w=>w*Fi);const x=[];for(const w of p)x.push(w,Og(w,g));return new Yi(x)}return null}function Vp(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function b0(r,t,n,a,c,d,p,g,x,w,M,C){let A=d.textMaxSize.evaluate(t,{});A===void 0&&(A=p);const L=r.layers[0].layout,B=L.get("icon-offset").evaluate(t,{},M),j=Zg(n.horizontal),$=p/24,X=r.tilePixelRatio*$,se=r.tilePixelRatio*A/24,Y=r.tilePixelRatio*g,R=r.tilePixelRatio*L.get("symbol-spacing"),U=L.get("text-padding")*r.tilePixelRatio,Q=function(tt,Je,We,wt=1){const wi=tt.get("icon-padding").evaluate(Je,{},We),Oi=wi&&wi.values;return[Oi[0]*wt,Oi[1]*wt,Oi[2]*wt,Oi[3]*wt]}(L,t,M,r.tilePixelRatio),fe=L.get("text-max-angle")/180*Math.PI,ze=L.get("text-rotation-alignment")!=="viewport"&&L.get("symbol-placement")!=="point",xe=L.get("icon-rotation-alignment")==="map"&&L.get("symbol-placement")!=="point",we=L.get("symbol-placement"),Le=R/2,Ae=L.get("icon-text-fit");let Fe;a&&Ae!=="none"&&(r.allowVerticalPlacement&&n.vertical&&(Fe=cg(a,n.vertical,Ae,L.get("icon-text-fit-padding"),B,$)),j&&(a=cg(a,j,Ae,L.get("icon-text-fit-padding"),B,$)));const Pe=M?C.line.getGranularityForZoomLevel(M.z):1,Ge=(tt,Je)=>{Je.x<0||Je.x>=Ft||Je.y<0||Je.y>=Ft||function(We,wt,wi,Oi,ur,an,Fr,Qi,gi,qi,er,tr,Pr,sn,Hi,Or,ji,Wi,Xi,Ai,ni,Fn,_l,On,M0){const yl=We.addToLineVertexArray(wt,wi);let io,xl,vl,bl,Gg=0,qg=0,Hg=0,Wg=0,Kp=-1,Yp=-1;const Ra={};let Xg=lr("");if(We.allowVerticalPlacement&&Oi.vertical){const _r=Qi.layout.get("text-rotate").evaluate(ni,{},On)+90;vl=new cd(gi,wt,qi,er,tr,Oi.vertical,Pr,sn,Hi,_r),Fr&&(bl=new cd(gi,wt,qi,er,tr,Fr,ji,Wi,Hi,_r))}if(ur){const _r=Qi.layout.get("icon-rotate").evaluate(ni,{}),on=Qi.layout.get("icon-text-fit")!=="none",ro=Bg(ur,_r,_l,on),Nn=Fr?Bg(Fr,_r,_l,on):void 0;xl=new cd(gi,wt,qi,er,tr,ur,ji,Wi,!1,_r),Gg=4*ro.length;const no=We.iconSizeData;let sa=null;no.kind==="source"?(sa=[aa*Qi.layout.get("icon-size").evaluate(ni,{})],sa[0]>us&&Zi(`${We.layerIds[0]}: Value for "icon-size" is >= ${cu}. Reduce your "icon-size".`)):no.kind==="composite"&&(sa=[aa*Fn.compositeIconSizes[0].evaluate(ni,{},On),aa*Fn.compositeIconSizes[1].evaluate(ni,{},On)],(sa[0]>us||sa[1]>us)&&Zi(`${We.layerIds[0]}: Value for "icon-size" is >= ${cu}. Reduce your "icon-size".`)),We.addSymbols(We.icon,ro,sa,Ai,Xi,ni,S.al.none,wt,yl.lineStartIndex,yl.lineLength,-1,On),Kp=We.icon.placedSymbolArray.length-1,Nn&&(qg=4*Nn.length,We.addSymbols(We.icon,Nn,sa,Ai,Xi,ni,S.al.vertical,wt,yl.lineStartIndex,yl.lineLength,-1,On),Yp=We.icon.placedSymbolArray.length-1)}const Kg=Object.keys(Oi.horizontal);for(const _r of Kg){const on=Oi.horizontal[_r];if(!io){Xg=lr(on.text);const Nn=Qi.layout.get("text-rotate").evaluate(ni,{},On);io=new cd(gi,wt,qi,er,tr,on,Pr,sn,Hi,Nn)}const ro=on.positionedLines.length===1;if(Hg+=Ng(We,wt,on,an,Qi,Hi,ni,Or,yl,Oi.vertical?S.al.horizontal:S.al.horizontalOnly,ro?Kg:[_r],Ra,Kp,Fn,On),ro)break}Oi.vertical&&(Wg+=Ng(We,wt,Oi.vertical,an,Qi,Hi,ni,Or,yl,S.al.vertical,["vertical"],Ra,Yp,Fn,On));const S0=io?io.boxStartIndex:We.collisionBoxArray.length,P0=io?io.boxEndIndex:We.collisionBoxArray.length,C0=vl?vl.boxStartIndex:We.collisionBoxArray.length,I0=vl?vl.boxEndIndex:We.collisionBoxArray.length,E0=xl?xl.boxStartIndex:We.collisionBoxArray.length,k0=xl?xl.boxEndIndex:We.collisionBoxArray.length,z0=bl?bl.boxStartIndex:We.collisionBoxArray.length,A0=bl?bl.boxEndIndex:We.collisionBoxArray.length;let jn=-1;const hd=(_r,on)=>_r&&_r.circleDiameter?Math.max(_r.circleDiameter,on):on;jn=hd(io,jn),jn=hd(vl,jn),jn=hd(xl,jn),jn=hd(bl,jn);const Yg=jn>-1?1:0;Yg&&(jn*=M0/Fi),We.glyphOffsetArray.length>=fl.MAX_GLYPHS&&Zi("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),ni.sortKey!==void 0&&We.addToSortKeyRanges(We.symbolInstances.length,ni.sortKey);const R0=jg(Qi,ni,On),[D0,L0]=function(_r,on){const ro=_r.length,Nn=on==null?void 0:on.values;if((Nn==null?void 0:Nn.length)>0)for(let no=0;no<Nn.length;no+=2){const sa=Nn[no+1];_r.emplaceBack(S.aB[Nn[no]],sa[0],sa[1])}return[ro,_r.length]}(We.textAnchorOffsets,R0);We.symbolInstances.emplaceBack(wt.x,wt.y,Ra.right>=0?Ra.right:-1,Ra.center>=0?Ra.center:-1,Ra.left>=0?Ra.left:-1,Ra.vertical||-1,Kp,Yp,Xg,S0,P0,C0,I0,E0,k0,z0,A0,qi,Hg,Wg,Gg,qg,Yg,0,Pr,jn,D0,L0)}(r,Je,tt,n,a,c,Fe,r.layers[0],r.collisionBoxArray,t.index,t.sourceLayerIndex,r.index,X,[U,U,U,U],ze,x,Y,Q,xe,B,t,d,w,M,p)};if(we==="line")for(const tt of kg(t.geometry,0,0,Ft,Ft)){const Je=to(tt,Pe),We=_0(Je,R,fe,n.vertical||j,a,24,se,r.overscaling,Ft);for(const wt of We)j&&w0(r,j.text,Le,wt)||Ge(Je,wt)}else if(we==="line-center"){for(const tt of t.geometry)if(tt.length>1){const Je=to(tt,Pe),We=g0(Je,fe,n.vertical||j,a,24,se);We&&Ge(Je,We)}}else if(t.type==="Polygon")for(const tt of Bo(t.geometry,0)){const Je=x0(tt,16);Ge(to(tt[0],Pe,!0),new ds(Je.x,Je.y,0))}else if(t.type==="LineString")for(const tt of t.geometry){const Je=to(tt,Pe);Ge(Je,new ds(Je[0].x,Je[0].y,0))}else if(t.type==="Point")for(const tt of t.geometry)for(const Je of tt)Ge([Je],new ds(Je.x,Je.y,0))}function Ng(r,t,n,a,c,d,p,g,x,w,M,C,A,L,B){const j=function(se,Y,R,U,Q,fe,ze,xe){const we=U.layout.get("text-rotate").evaluate(fe,{})*Math.PI/180,Le=[];for(const Ae of Y.positionedLines)for(const Fe of Ae.positionedGlyphs){if(!Fe.rect)continue;const Pe=Fe.rect||{};let Ge=Xv+1,tt=!0,Je=1,We=0;const wt=(Q||xe)&&Fe.vertical,wi=Fe.metrics.advance*Fe.scale/2;if(xe&&Y.verticalizable&&(We=Ae.lineOffset/2-(Fe.imageName?-(Fi-Fe.metrics.width*Fe.scale)/2:(Fe.scale-1)*Fi)),Fe.imageName){const Wi=ze[Fe.imageName];tt=Wi.sdf,Je=Wi.pixelRatio,Ge=Br/Je}const Oi=Q?[Fe.x+wi,Fe.y]:[0,0];let ur=Q?[0,0]:[Fe.x+wi+R[0],Fe.y+R[1]-We],an=[0,0];wt&&(an=ur,ur=[0,0]);const Fr=Fe.metrics.isDoubleResolution?2:1,Qi=(Fe.metrics.left-Ge)*Fe.scale-wi+ur[0],gi=(-Fe.metrics.top-Ge)*Fe.scale+ur[1],qi=Qi+Pe.w/Fr*Fe.scale/Je,er=gi+Pe.h/Fr*Fe.scale/Je,tr=new De(Qi,gi),Pr=new De(qi,gi),sn=new De(Qi,er),Hi=new De(qi,er);if(wt){const Wi=new De(-wi,wi-td),Xi=-Math.PI/2,Ai=Fi/2-wi,ni=new De(5-td-Ai,-(Fe.imageName?Ai:0)),Fn=new De(...an);tr._rotateAround(Xi,Wi)._add(ni)._add(Fn),Pr._rotateAround(Xi,Wi)._add(ni)._add(Fn),sn._rotateAround(Xi,Wi)._add(ni)._add(Fn),Hi._rotateAround(Xi,Wi)._add(ni)._add(Fn)}if(we){const Wi=Math.sin(we),Xi=Math.cos(we),Ai=[Xi,-Wi,Wi,Xi];tr._matMult(Ai),Pr._matMult(Ai),sn._matMult(Ai),Hi._matMult(Ai)}const Or=new De(0,0),ji=new De(0,0);Le.push({tl:tr,tr:Pr,bl:sn,br:Hi,tex:Pe,writingMode:Y.writingMode,glyphOffset:Oi,sectionIndex:Fe.sectionIndex,isSDF:tt,pixelOffsetTL:Or,pixelOffsetBR:ji,minFontScaleX:0,minFontScaleY:0})}return Le}(0,n,g,c,d,p,a,r.allowVerticalPlacement),$=r.textSizeData;let X=null;$.kind==="source"?(X=[aa*c.layout.get("text-size").evaluate(p,{})],X[0]>us&&Zi(`${r.layerIds[0]}: Value for "text-size" is >= ${cu}. Reduce your "text-size".`)):$.kind==="composite"&&(X=[aa*L.compositeTextSizes[0].evaluate(p,{},B),aa*L.compositeTextSizes[1].evaluate(p,{},B)],(X[0]>us||X[1]>us)&&Zi(`${r.layerIds[0]}: Value for "text-size" is >= ${cu}. Reduce your "text-size".`)),r.addSymbols(r.text,j,X,g,d,p,w,t,x.lineStartIndex,x.lineLength,A,B);for(const se of M)C[se]=r.text.placedSymbolArray.length-1;return 4*j.length}function Zg(r){for(const t in r)return r[t];return null}function w0(r,t,n,a){const c=r.compareText;if(t in c){const d=c[t];for(let p=d.length-1;p>=0;p--)if(a.dist(d[p])<n)return!0}else c[t]=[];return c[t].push(a),!1}const Vg=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Up{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,a]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const c=a>>4;if(c!==1)throw new Error(`Got v${c} data when expected v1.`);const d=Vg[15&a];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(t,2,1),[g]=new Uint32Array(t,4,1);return new Up(g,p,d,t)}constructor(t,n=64,a=Float64Array,c){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=a,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const d=Vg.indexOf(this.ArrayType),p=2*t*this.ArrayType.BYTES_PER_ELEMENT,g=t*this.IndexArrayType.BYTES_PER_ELEMENT,x=(8-g%8)%8;if(d<0)throw new Error(`Unexpected typed array class: ${a}.`);c&&c instanceof ArrayBuffer?(this.data=c,this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+g+x,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+p+g+x),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+g+x,2*t),this._pos=0,this._finished=!1,new Uint8Array(this.data,0,2).set([219,16+d]),new Uint16Array(this.data,2,1)[0]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=t,this.coords[this._pos++]=n,a}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return $p(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,a,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:g}=this,x=[0,d.length-1,0],w=[];for(;x.length;){const M=x.pop()||0,C=x.pop()||0,A=x.pop()||0;if(C-A<=g){for(let $=A;$<=C;$++){const X=p[2*$],se=p[2*$+1];X>=t&&X<=a&&se>=n&&se<=c&&w.push(d[$])}continue}const L=A+C>>1,B=p[2*L],j=p[2*L+1];B>=t&&B<=a&&j>=n&&j<=c&&w.push(d[L]),(M===0?t<=B:n<=j)&&(x.push(A),x.push(L-1),x.push(1-M)),(M===0?a>=B:c>=j)&&(x.push(L+1),x.push(C),x.push(1-M))}return w}within(t,n,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:d,nodeSize:p}=this,g=[0,c.length-1,0],x=[],w=a*a;for(;g.length;){const M=g.pop()||0,C=g.pop()||0,A=g.pop()||0;if(C-A<=p){for(let $=A;$<=C;$++)$g(d[2*$],d[2*$+1],t,n)<=w&&x.push(c[$]);continue}const L=A+C>>1,B=d[2*L],j=d[2*L+1];$g(B,j,t,n)<=w&&x.push(c[L]),(M===0?t-a<=B:n-a<=j)&&(g.push(A),g.push(L-1),g.push(1-M)),(M===0?t+a>=B:n+a>=j)&&(g.push(L+1),g.push(C),g.push(1-M))}return x}}function $p(r,t,n,a,c,d){if(c-a<=n)return;const p=a+c>>1;Ug(r,t,p,a,c,d),$p(r,t,n,a,p-1,1-d),$p(r,t,n,p+1,c,1-d)}function Ug(r,t,n,a,c,d){for(;c>a;){if(c-a>600){const w=c-a+1,M=n-a+1,C=Math.log(w),A=.5*Math.exp(2*C/3),L=.5*Math.sqrt(C*A*(w-A)/w)*(M-w/2<0?-1:1);Ug(r,t,n,Math.max(a,Math.floor(n-M*A/w+L)),Math.min(c,Math.floor(n+(w-M)*A/w+L)),d)}const p=t[2*n+d];let g=a,x=c;for(du(r,t,a,n),t[2*c+d]>p&&du(r,t,a,c);g<x;){for(du(r,t,g,x),g++,x--;t[2*g+d]<p;)g++;for(;t[2*x+d]>p;)x--}t[2*a+d]===p?du(r,t,a,x):(x++,du(r,t,x,c)),x<=n&&(a=x+1),n<=x&&(c=x-1)}}function du(r,t,n,a){Gp(r,n,a),Gp(t,2*n,2*a),Gp(t,2*n+1,2*a+1)}function Gp(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function $g(r,t,n,a){const c=r-n,d=t-a;return c*c+d*d}var qp;S.cm=void 0,(qp=S.cm||(S.cm={})).create="create",qp.load="load",qp.fullLoad="fullLoad";let ud=null,pu=[];const Hp=1e3/60,Wp="loadTime",Xp="fullLoadTime",T0={mark(r){performance.mark(r)},frame(r){const t=r;ud!=null&&pu.push(t-ud),ud=t},clearMetrics(){ud=null,pu=[],performance.clearMeasures(Wp),performance.clearMeasures(Xp);for(const r in S.cm)performance.clearMarks(S.cm[r])},getPerformanceMetrics(){performance.measure(Wp,S.cm.create,S.cm.load),performance.measure(Xp,S.cm.create,S.cm.fullLoad);const r=performance.getEntriesByName(Wp)[0].duration,t=performance.getEntriesByName(Xp)[0].duration,n=pu.length,a=1/(pu.reduce((d,p)=>d+p,0)/n/1e3),c=pu.filter(d=>d>Hp).reduce((d,p)=>d+(p-Hp)/Hp,0);return{loadTime:r,fullLoadTime:t,fps:a,percentDroppedFrames:c/(n+c)*100,totalFrames:n}}};S.$=uu,S.A=Bt,S.B=Qt,S.C=ti,S.D=Ye,S.E=J,S.F=Ac,S.G=function(r){if(br==null){const t=r.navigator?r.navigator.userAgent:null;br=!!r.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return br},S.H=class{constructor(r,t){this.target=r,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new p0(()=>this.process()),this.subscription=Ze(this.target,"message",n=>this.receive(n),!1),this.globalScope=rr(self)?r:window}registerMessageHandler(r,t){this.messageHandlers[r]=t}sendAsync(r,t){return new Promise((n,a)=>{const c=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=t?Ze(t.signal,"abort",()=>{d==null||d.unsubscribe(),delete this.resolveRejects[c];const x={id:c,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(x)},f0):null;this.resolveRejects[c]={resolve:x=>{d==null||d.unsubscribe(),n(x)},reject:x=>{d==null||d.unsubscribe(),a(x)}};const p=[],g=Object.assign(Object.assign({},r),{id:c,sourceMapId:this.mapId,origin:location.origin,data:Us(r.data,p)});this.target.postMessage(g,{transfer:p})})}receive(r){const t=r.data,n=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[n];const a=this.abortControllers[n];return delete this.abortControllers[n],void(a&&a.abort())}if(rr(self)||t.mustQueue)return this.tasks[n]=t,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,t)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),t=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(r,t)}processTask(r,t){return o(this,void 0,void 0,function*(){if(t.type==="<response>"){const c=this.resolveRejects[r];return delete this.resolveRejects[r],c?void(t.error?c.reject(Ca(t.error)):c.resolve(Ca(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const n=Ca(t.data),a=new AbortController;this.abortControllers[r]=a;try{const c=yield this.messageHandlers[t.type](t.sourceMapId,n,a);this.completeTask(r,null,c)}catch(c){this.completeTask(r,c)}})}completeTask(r,t,n){const a=[];delete this.abortControllers[r];const c={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?Us(t):null,data:Us(n,a)};this.target.postMessage(c,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},S.I=kp,S.J=qt,S.K=function(){var r=new Bt(16);return Bt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},S.L=function(r,t,n){var a,c,d,p,g,x,w,M,C,A,L,B,j=n[0],$=n[1],X=n[2];return t===r?(r[12]=t[0]*j+t[4]*$+t[8]*X+t[12],r[13]=t[1]*j+t[5]*$+t[9]*X+t[13],r[14]=t[2]*j+t[6]*$+t[10]*X+t[14],r[15]=t[3]*j+t[7]*$+t[11]*X+t[15]):(c=t[1],d=t[2],p=t[3],g=t[4],x=t[5],w=t[6],M=t[7],C=t[8],A=t[9],L=t[10],B=t[11],r[0]=a=t[0],r[1]=c,r[2]=d,r[3]=p,r[4]=g,r[5]=x,r[6]=w,r[7]=M,r[8]=C,r[9]=A,r[10]=L,r[11]=B,r[12]=a*j+g*$+C*X+t[12],r[13]=c*j+x*$+A*X+t[13],r[14]=d*j+w*$+L*X+t[14],r[15]=p*j+M*$+B*X+t[15]),r},S.M=function(r,t,n){var a=n[0],c=n[1],d=n[2];return r[0]=t[0]*a,r[1]=t[1]*a,r[2]=t[2]*a,r[3]=t[3]*a,r[4]=t[4]*c,r[5]=t[5]*c,r[6]=t[6]*c,r[7]=t[7]*c,r[8]=t[8]*d,r[9]=t[9]*d,r[10]=t[10]*d,r[11]=t[11]*d,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},S.N=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=t[3],g=t[4],x=t[5],w=t[6],M=t[7],C=t[8],A=t[9],L=t[10],B=t[11],j=t[12],$=t[13],X=t[14],se=t[15],Y=n[0],R=n[1],U=n[2],Q=n[3];return r[0]=Y*a+R*g+U*C+Q*j,r[1]=Y*c+R*x+U*A+Q*$,r[2]=Y*d+R*w+U*L+Q*X,r[3]=Y*p+R*M+U*B+Q*se,r[4]=(Y=n[4])*a+(R=n[5])*g+(U=n[6])*C+(Q=n[7])*j,r[5]=Y*c+R*x+U*A+Q*$,r[6]=Y*d+R*w+U*L+Q*X,r[7]=Y*p+R*M+U*B+Q*se,r[8]=(Y=n[8])*a+(R=n[9])*g+(U=n[10])*C+(Q=n[11])*j,r[9]=Y*c+R*x+U*A+Q*$,r[10]=Y*d+R*w+U*L+Q*X,r[11]=Y*p+R*M+U*B+Q*se,r[12]=(Y=n[12])*a+(R=n[13])*g+(U=n[14])*C+(Q=n[15])*j,r[13]=Y*c+R*x+U*A+Q*$,r[14]=Y*d+R*w+U*L+Q*X,r[15]=Y*p+R*M+U*B+Q*se,r},S.O=function(r,t){const n={};for(let a=0;a<t.length;a++){const c=t[a];c in r&&(n[c]=r[c])}return n},S.P=De,S.Q=hs,S.R=rn,S.S=xg,S.T=Fc,S.U=yg,S.V=Jt,S.W=Xt,S.X=Kr,S.Y=nn,S.Z=Ft,S._=o,S.a=ut,S.a$=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[4],p=t[5],g=t[6],x=t[7],w=t[8],M=t[9],C=t[10],A=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[4]=d*c+w*a,r[5]=p*c+M*a,r[6]=g*c+C*a,r[7]=x*c+A*a,r[8]=w*c-d*a,r[9]=M*c-p*a,r[10]=C*c-g*a,r[11]=A*c-x*a,r},S.a0=25,S.a1=Np,S.a2=r=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(n=>{t.onloadstart=()=>{n(t)};for(const a of r){const c=window.document.createElement("source");pr(a)||(t.crossOrigin="Anonymous"),c.src=a,t.appendChild(c)}})},S.a3=Me,S.a4=function(){return Wn++},S.a5=_,S.a6=fl,S.a7=bc,S.a8=na,S.a9=Pg,S.aA=function(r,t,n,a,c=!1){if(!n[0]&&!n[1])return[0,0];const d=c?a==="map"?-r.bearingInRadians:0:a==="viewport"?r.bearingInRadians:0;if(d){const p=Math.sin(d),g=Math.cos(d);n=[n[0]*g-n[1]*p,n[0]*p+n[1]*g]}return[c?n[0]:zr(t,n[0],r.zoom),c?n[1]:zr(t,n[1],r.zoom)]},S.aC=Rp,S.aD=Vp,S.aE=Ap,S.aF=Up,S.aG=Ei,S.aH=Jh,S.aI=K,S.aJ=st,S.aK=Be,S.aL=hn,S.aM=Xe,S.aN=bg,S.aO=function(r,t,n){return r[0]=t[0]*n,r[1]=t[1]*n,r[2]=t[2]*n,r},S.aP=function(r,t,n){return r[0]=t[0]+n[0],r[1]=t[1]+n[1],r[2]=t[2]+n[2],r},S.aQ=function(r){var t=new Bt(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t},S.aR=function(r,t,n){return r[0]=t[0]*n[0],r[1]=t[1]*n[1],r[2]=t[2]*n[2],r[3]=t[3]*n[3],r},S.aS=function(r,t,n){return r[0]=t[0]-n[0],r[1]=t[1]-n[1],r[2]=t[2]-n[2],r},S.aT=function(r,t){var n=t[0],a=t[1],c=t[2],d=n*n+a*a+c*c;return d>0&&(d=1/Math.sqrt(d)),r[0]=t[0]*d,r[1]=t[1]*d,r[2]=t[2]*d,r},S.aU=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=n[0],g=n[1],x=n[2];return r[0]=c*x-d*g,r[1]=d*p-a*x,r[2]=a*g-c*p,r},S.aV=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]},S.aW=Tg,S.aX=ml,S.aY=function(r,t,n,a,c){var d,p=1/Math.tan(t/2);return r[0]=p/n,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=p,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,c!=null&&c!==1/0?(r[10]=(c+a)*(d=1/(a-c)),r[14]=2*c*a*d):(r[10]=-1,r[14]=-2*a),r},S.aZ=function(r){var t=new Bt(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},S.a_=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[0],p=t[1],g=t[2],x=t[3],w=t[4],M=t[5],C=t[6],A=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=d*c+w*a,r[1]=p*c+M*a,r[2]=g*c+C*a,r[3]=x*c+A*a,r[4]=w*c-d*a,r[5]=M*c-p*a,r[6]=C*c-g*a,r[7]=A*c-x*a,r},S.aa=function(r){const t={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(n,a,c,d)=>{const p=c||d;return t[a]=!p||p.toLowerCase(),""}),t["max-age"]){const n=parseInt(t["max-age"],10);isNaN(n)?delete t["max-age"]:t["max-age"]=n}return t},S.ab=function(r){return r*Math.PI/180},S.ac=function(r){return Math.pow(2,r)},S.ad=jt,S.ae=Ti,S.af=85.051129,S.ag=vg,S.ah=function(r){return Math.log(r)/Math.LN2},S.ai=function(r){var t=r[0],n=r[1];return t*t+n*n},S.aj=function(r,t){const n=[];for(const a in r)a in t||n.push(a);return n},S.ak=function(r,t){let n=0,a=0;if(r.kind==="constant")a=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:c,minZoom:d,maxZoom:p}=r,g=c?Ti(Tr.interpolationFactor(c,t,d,p),0,1):0;r.kind==="camera"?a=Qt.number(r.minSize,r.maxSize,g):n=g}return{uSizeT:n,uSize:a}},S.am=function(r,{uSize:t,uSizeT:n},{lowerSize:a,upperSize:c}){return r.kind==="source"?a/aa:r.kind==="composite"?Qt.number(a/aa,c/aa,n):t},S.an=function(r,t){var n=t[0],a=t[1],c=t[2],d=t[3],p=t[4],g=t[5],x=t[6],w=t[7],M=t[8],C=t[9],A=t[10],L=t[11],B=t[12],j=t[13],$=t[14],X=t[15],se=n*g-a*p,Y=n*x-c*p,R=n*w-d*p,U=a*x-c*g,Q=a*w-d*g,fe=c*w-d*x,ze=M*j-C*B,xe=M*$-A*B,we=M*X-L*B,Le=C*$-A*j,Ae=C*X-L*j,Fe=A*X-L*$,Pe=se*Fe-Y*Ae+R*Le+U*we-Q*xe+fe*ze;return Pe?(r[0]=(g*Fe-x*Ae+w*Le)*(Pe=1/Pe),r[1]=(c*Ae-a*Fe-d*Le)*Pe,r[2]=(j*fe-$*Q+X*U)*Pe,r[3]=(A*Q-C*fe-L*U)*Pe,r[4]=(x*we-p*Fe-w*xe)*Pe,r[5]=(n*Fe-c*we+d*xe)*Pe,r[6]=($*R-B*fe-X*Y)*Pe,r[7]=(M*fe-A*R+L*Y)*Pe,r[8]=(p*Ae-g*we+w*ze)*Pe,r[9]=(a*we-n*Ae-d*ze)*Pe,r[10]=(B*Q-j*R+X*se)*Pe,r[11]=(C*R-M*Q-L*se)*Pe,r[12]=(g*xe-p*Le-x*ze)*Pe,r[13]=(n*Le-a*xe+c*ze)*Pe,r[14]=(j*Y-B*U-$*se)*Pe,r[15]=(M*U-C*Y+A*se)*Pe,r):null},S.ao=vr,S.ap=function(r){return Math.hypot(r[0],r[1])},S.aq=function(r){return r[0]=0,r[1]=0,r},S.ar=function(r,t,n){return r[0]=t[0]*n,r[1]=t[1]*n,r},S.as=Dp,S.at=li,S.au=function(r,t,n,a){const c=t.y-r.y,d=t.x-r.x,p=a.y-n.y,g=a.x-n.x,x=p*d-g*c;if(x===0)return null;const w=(g*(r.y-n.y)-p*(r.x-n.x))/x;return new De(r.x+w*d,r.y+w*c)},S.av=kg,S.aw=Wc,S.ax=function(r){let t=1/0,n=1/0,a=-1/0,c=-1/0;for(const d of r)t=Math.min(t,d.x),n=Math.min(n,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return[t,n,a,c]},S.ay=Fi,S.az=zr,S.b=Vi,S.b$=function(r,t){var n=r[0],a=r[1],c=r[2],d=r[3],p=r[4],g=r[5],x=r[6],w=r[7],M=r[8],C=r[9],A=r[10],L=r[11],B=r[12],j=r[13],$=r[14],X=r[15],se=t[0],Y=t[1],R=t[2],U=t[3],Q=t[4],fe=t[5],ze=t[6],xe=t[7],we=t[8],Le=t[9],Ae=t[10],Fe=t[11],Pe=t[12],Ge=t[13],tt=t[14],Je=t[15];return Math.abs(n-se)<=Et*Math.max(1,Math.abs(n),Math.abs(se))&&Math.abs(a-Y)<=Et*Math.max(1,Math.abs(a),Math.abs(Y))&&Math.abs(c-R)<=Et*Math.max(1,Math.abs(c),Math.abs(R))&&Math.abs(d-U)<=Et*Math.max(1,Math.abs(d),Math.abs(U))&&Math.abs(p-Q)<=Et*Math.max(1,Math.abs(p),Math.abs(Q))&&Math.abs(g-fe)<=Et*Math.max(1,Math.abs(g),Math.abs(fe))&&Math.abs(x-ze)<=Et*Math.max(1,Math.abs(x),Math.abs(ze))&&Math.abs(w-xe)<=Et*Math.max(1,Math.abs(w),Math.abs(xe))&&Math.abs(M-we)<=Et*Math.max(1,Math.abs(M),Math.abs(we))&&Math.abs(C-Le)<=Et*Math.max(1,Math.abs(C),Math.abs(Le))&&Math.abs(A-Ae)<=Et*Math.max(1,Math.abs(A),Math.abs(Ae))&&Math.abs(L-Fe)<=Et*Math.max(1,Math.abs(L),Math.abs(Fe))&&Math.abs(B-Pe)<=Et*Math.max(1,Math.abs(B),Math.abs(Pe))&&Math.abs(j-Ge)<=Et*Math.max(1,Math.abs(j),Math.abs(Ge))&&Math.abs($-tt)<=Et*Math.max(1,Math.abs($),Math.abs(tt))&&Math.abs(X-Je)<=Et*Math.max(1,Math.abs(X),Math.abs(Je))},S.b0=function(){const r=new Float32Array(16);return jt(r),r},S.b1=function(){const r=new Float64Array(16);return jt(r),r},S.b2=function(){return new Float64Array(16)},S.b3=function(r,t,n){const a=new Float64Array(4);return function(c,d,p,g){var x=.5*Math.PI/180;d*=x,p*=x,g*=x;var w=Math.sin(d),M=Math.cos(d),C=Math.sin(p),A=Math.cos(p),L=Math.sin(g),B=Math.cos(g);c[0]=w*A*B-M*C*L,c[1]=M*C*B+w*A*L,c[2]=M*A*L-w*C*B,c[3]=M*A*B+w*C*L}(a,r,t-90,n),a},S.b4=function(r,t,n,a){var c,d,p,g,x,w=t[0],M=t[1],C=t[2],A=t[3],L=n[0],B=n[1],j=n[2],$=n[3];return(d=w*L+M*B+C*j+A*$)<0&&(d=-d,L=-L,B=-B,j=-j,$=-$),1-d>Et?(c=Math.acos(d),p=Math.sin(c),g=Math.sin((1-a)*c)/p,x=Math.sin(a*c)/p):(g=1-a,x=a),r[0]=g*w+x*L,r[1]=g*M+x*B,r[2]=g*C+x*j,r[3]=g*A+x*$,r},S.b5=function(r){const t=new Float64Array(9);var n,a,c,d,p,g,x,w,M,C,A,L,B,j,$,X,se,Y;C=(c=(a=r)[0])*(x=c+c),A=(d=a[1])*x,B=(p=a[2])*x,j=p*(w=d+d),X=(g=a[3])*x,se=g*w,Y=g*(M=p+p),(n=t)[0]=1-(L=d*w)-($=p*M),n[3]=A-Y,n[6]=B+se,n[1]=A+Y,n[4]=1-C-$,n[7]=j-X,n[2]=B-se,n[5]=j+X,n[8]=1-C-L;const R=Xe(-Math.asin(Ti(t[2],-1,1)));let U,Q;return Math.hypot(t[5],t[8])<.001?(U=0,Q=-Xe(Math.atan2(t[3],t[4]))):(U=Xe(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),Q=Xe(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:U,pitch:R+90,bearing:Q}},S.b6=function(r,t){return r.roll==t.roll&&r.pitch==t.pitch&&r.bearing==t.bearing},S.b7=gt,S.b8=ka,S.b9=dl,S.bA=function(r){if(r.type==="custom")return new d0(r);switch(r.type){case"background":return new c0(r);case"circle":return new nv(r);case"fill":return new Tv(r);case"fill-extrusion":return new zv(r);case"heatmap":return new sv(r);case"hillshade":return new lv(r);case"line":return new jv(r);case"raster":return new h0(r);case"symbol":return new ad(r)}},S.bB=dr,S.bC=function(r,t){if(!r)return[{command:"setStyle",args:[t]}];let n=[];try{if(!ie(r.version,t.version))return[{command:"setStyle",args:[t]}];ie(r.center,t.center)||n.push({command:"setCenter",args:[t.center]}),ie(r.centerAltitude,t.centerAltitude)||n.push({command:"setCenterAltitude",args:[t.centerAltitude]}),ie(r.zoom,t.zoom)||n.push({command:"setZoom",args:[t.zoom]}),ie(r.bearing,t.bearing)||n.push({command:"setBearing",args:[t.bearing]}),ie(r.pitch,t.pitch)||n.push({command:"setPitch",args:[t.pitch]}),ie(r.roll,t.roll)||n.push({command:"setRoll",args:[t.roll]}),ie(r.sprite,t.sprite)||n.push({command:"setSprite",args:[t.sprite]}),ie(r.glyphs,t.glyphs)||n.push({command:"setGlyphs",args:[t.glyphs]}),ie(r.transition,t.transition)||n.push({command:"setTransition",args:[t.transition]}),ie(r.light,t.light)||n.push({command:"setLight",args:[t.light]}),ie(r.terrain,t.terrain)||n.push({command:"setTerrain",args:[t.terrain]}),ie(r.sky,t.sky)||n.push({command:"setSky",args:[t.sky]}),ie(r.projection,t.projection)||n.push({command:"setProjection",args:[t.projection]});const a={},c=[];(function(p,g,x,w){let M;for(M in g=g||{},p=p||{})Object.prototype.hasOwnProperty.call(p,M)&&(Object.prototype.hasOwnProperty.call(g,M)||de(M,x,w));for(M in g)Object.prototype.hasOwnProperty.call(g,M)&&(Object.prototype.hasOwnProperty.call(p,M)?ie(p[M],g[M])||(p[M].type==="geojson"&&g[M].type==="geojson"&&Ne(p,g,M)?ye(x,{command:"setGeoJSONSourceData",args:[M,g[M].data]}):ke(M,g,x,w)):be(M,g,x))})(r.sources,t.sources,c,a);const d=[];r.layers&&r.layers.forEach(p=>{"source"in p&&a[p.source]?n.push({command:"removeLayer",args:[p.id]}):d.push(p)}),n=n.concat(c),function(p,g,x){g=g||[];const w=(p=p||[]).map(rt),M=g.map(rt),C=p.reduce(dt,{}),A=g.reduce(dt,{}),L=w.slice(),B=Object.create(null);let j,$,X,se,Y;for(let R=0,U=0;R<w.length;R++)j=w[R],Object.prototype.hasOwnProperty.call(A,j)?U++:(ye(x,{command:"removeLayer",args:[j]}),L.splice(L.indexOf(j,U),1));for(let R=0,U=0;R<M.length;R++)j=M[M.length-1-R],L[L.length-1-R]!==j&&(Object.prototype.hasOwnProperty.call(C,j)?(ye(x,{command:"removeLayer",args:[j]}),L.splice(L.lastIndexOf(j,L.length-U),1)):U++,se=L[L.length-R],ye(x,{command:"addLayer",args:[A[j],se]}),L.splice(L.length-R,0,j),B[j]=!0);for(let R=0;R<M.length;R++)if(j=M[R],$=C[j],X=A[j],!B[j]&&!ie($,X))if(ie($.source,X.source)&&ie($["source-layer"],X["source-layer"])&&ie($.type,X.type)){for(Y in Ve($.layout,X.layout,x,j,null,"setLayoutProperty"),Ve($.paint,X.paint,x,j,null,"setPaintProperty"),ie($.filter,X.filter)||ye(x,{command:"setFilter",args:[j,X.filter]}),ie($.minzoom,X.minzoom)&&ie($.maxzoom,X.maxzoom)||ye(x,{command:"setLayerZoomRange",args:[j,X.minzoom,X.maxzoom]}),$)Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Ve($[Y],X[Y],x,j,Y.slice(6),"setPaintProperty"):ie($[Y],X[Y])||ye(x,{command:"setLayerProperty",args:[j,Y,X[Y]]}));for(Y in X)Object.prototype.hasOwnProperty.call(X,Y)&&!Object.prototype.hasOwnProperty.call($,Y)&&Y!=="layout"&&Y!=="paint"&&Y!=="filter"&&Y!=="metadata"&&Y!=="minzoom"&&Y!=="maxzoom"&&(Y.indexOf("paint.")===0?Ve($[Y],X[Y],x,j,Y.slice(6),"setPaintProperty"):ie($[Y],X[Y])||ye(x,{command:"setLayerProperty",args:[j,Y,X[Y]]}))}else ye(x,{command:"removeLayer",args:[j]}),se=L[L.lastIndexOf(j)+1],ye(x,{command:"addLayer",args:[X,se]})}(d,t.layers,n)}catch(a){console.warn("Unable to compute style diff:",a),n=[{command:"setStyle",args:[t]}]}return n},S.bD=function(r){const t=[],n=r.id;return n===void 0&&t.push({message:`layers.${n}: missing required property "id"`}),r.render===void 0&&t.push({message:`layers.${n}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},S.bE=function r(t,n){if(Array.isArray(t)){if(!Array.isArray(n)||t.length!==n.length)return!1;for(let a=0;a<t.length;a++)if(!r(t[a],n[a]))return!1;return!0}if(typeof t=="object"&&t!==null&&n!==null){if(typeof n!="object"||Object.keys(t).length!==Object.keys(n).length)return!1;for(const a in t)if(!r(t[a],n[a]))return!1;return!0}return t===n},S.bF=Cn,S.bG=ga,S.bH=class extends vn{constructor(r,t){super(r,t),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},S.bI=Dr,S.bJ=class extends vn{constructor(r,t){super(r,t),this.current=ra}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},S.bK=za,S.bL=class extends vn{constructor(r,t){super(r,t),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},S.bM=class extends vn{constructor(r,t){super(r,t),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},S.bN=Ri,S.bO=function(r,t){var n=Math.sin(t),a=Math.cos(t);return r[0]=a,r[1]=n,r[2]=0,r[3]=-n,r[4]=a,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},S.bP=function(r,t,n){var a=t[0],c=t[1],d=t[2];return r[0]=a*n[0]+c*n[3]+d*n[6],r[1]=a*n[1]+c*n[4]+d*n[7],r[2]=a*n[2]+c*n[5]+d*n[8],r},S.bQ=function(r,t,n,a,c,d,p){var g=1/(t-n),x=1/(a-c),w=1/(d-p);return r[0]=-2*g,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*x,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*w,r[11]=0,r[12]=(t+n)*g,r[13]=(c+a)*x,r[14]=(p+d)*w,r[15]=1,r},S.bR=class extends Ea{},S.bS=Uv,S.bT=class extends ll{},S.bU=fp,S.bV=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},S.bW=Sm,S.bX=function(r,t,n){var a=t[0],c=t[1],d=t[2],p=n[3]*a+n[7]*c+n[11]*d+n[15];return r[0]=(n[0]*a+n[4]*c+n[8]*d+n[12])/(p=p||1),r[1]=(n[1]*a+n[5]*c+n[9]*d+n[13])/p,r[2]=(n[2]*a+n[6]*c+n[10]*d+n[14])/p,r},S.bY=class extends An{},S.bZ=class extends l{},S.b_=function(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]},S.ba=iu,S.bb=hl,S.bc=Hn,S.bd=yi,S.be=mr,S.bf=function(r,t,n,a,c){return Hn(a,c,Ti((r-t)/(n-t),0,1))},S.bg=Ar,S.bh=function(){return new Float64Array(3)},S.bi=function(r,t,n,a){return r[0]=t[0]+n[0]*a,r[1]=t[1]+n[1]*a,r[2]=t[2]+n[2]*a,r},S.bj=_i,S.bk=function(){return new Float64Array(4)},S.bl=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[2],d[0]=c[0]*Math.cos(a)-c[1]*Math.sin(a),d[1]=c[0]*Math.sin(a)+c[1]*Math.cos(a),d[2]=c[2],r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},S.bm=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[2],d[0]=c[0],d[1]=c[1]*Math.cos(a)-c[2]*Math.sin(a),d[2]=c[1]*Math.sin(a)+c[2]*Math.cos(a),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},S.bn=function(r,t,n,a){var c=[],d=[];return c[0]=t[0]-n[0],c[1]=t[1]-n[1],c[2]=t[2]-n[2],d[0]=c[2]*Math.sin(a)+c[0]*Math.cos(a),d[1]=c[1],d[2]=c[2]*Math.cos(a)-c[0]*Math.sin(a),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},S.bo=cn,S.bp=function(r,t,n){var a=Math.sin(n),c=Math.cos(n),d=t[0],p=t[1],g=t[2],x=t[3],w=t[8],M=t[9],C=t[10],A=t[11];return t!==r&&(r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=d*c-w*a,r[1]=p*c-M*a,r[2]=g*c-C*a,r[3]=x*c-A*a,r[8]=d*a+w*c,r[9]=p*a+M*c,r[10]=g*a+C*c,r[11]=x*a+A*c,r},S.bq=function(r,t){const n=Ar(r,360),a=Ar(t,360),c=a-n,d=a>n?c-360:c+360;return Math.abs(c)<Math.abs(d)?c:d},S.br=function(r){return r[0]=0,r[1]=0,r[2]=0,r},S.bs=function(r,t,n,a){const c=Math.sqrt(r*r+t*t),d=Math.sqrt(n*n+a*a);r/=c,t/=c,n/=d,a/=d;const p=Math.acos(r*n+t*a);return-t*n+r*a>0?p:-p},S.bt=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]},S.bu=Op,S.bv=function(r,t){const n=Ar(r,2*Math.PI),a=Ar(t,2*Math.PI);return Math.min(Math.abs(n-a),Math.abs(n-a+2*Math.PI),Math.abs(n-a-2*Math.PI))},S.bw=function(){const r={},t=V.$version;for(const n in V.$root){const a=V.$root[n];if(a.required){let c=null;c=n==="version"?t:a.type==="array"?[]:{},c!=null&&(r[n]=c)}}return r},S.bx=$s,S.by=Yt,S.bz=function(r){r=r.slice();const t=Object.create(null);for(let n=0;n<r.length;n++)t[r[n].id]=r[n];for(let n=0;n<r.length;n++)"ref"in r[n]&&(r[n]=ge(r[n],t[r[n].ref]));return r},S.c=kt,S.c0=function(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},S.c1=r=>r.type==="symbol",S.c2=r=>r.type==="circle",S.c3=r=>r.type==="heatmap",S.c4=r=>r.type==="line",S.c5=r=>r.type==="fill",S.c6=r=>r.type==="fill-extrusion",S.c7=r=>r.type==="hillshade",S.c8=r=>r.type==="raster",S.c9=r=>r.type==="background",S.cA=nu,S.cB=Ip,S.cC=class{constructor(r){this._marks={start:[r.url,"start"].join("#"),end:[r.url,"end"].join("#"),measure:r.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let r=performance.getEntriesByName(this._marks.measure);return r.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),r=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),r}},S.cD=function(r,t,n,a,c){return o(this,void 0,void 0,function*(){if(Xt())try{return yield Kr(r,t,n,a,c)}catch{}return function(d,p,g,x,w){const M=d.width,C=d.height;Di&&nr||(Di=new OffscreenCanvas(M,C),nr=Di.getContext("2d",{willReadFrequently:!0})),Di.width=M,Di.height=C,nr.drawImage(d,0,0,M,C);const A=nr.getImageData(p,g,x,w);return nr.clearRect(0,0,M,C),A.data}(r,t,n,a,c)})},S.cE=Mg,S.cF=le,S.cG=Re,S.cH=Vm,S.cI=eg,S.cJ=js,S.cK=ta,S.ca=r=>r.type==="custom",S.cb=Pn,S.cc=function(r,t,n){const a=un(t.x-n.x,t.y-n.y),c=un(r.x-n.x,r.y-n.y);var d,p;return Xe(Math.atan2(a[0]*c[1]-a[1]*c[0],(d=a)[0]*(p=c)[0]+d[1]*p[1]))},S.cd=ir,S.ce=function(r,t){return Kt[t]&&(r instanceof MouseEvent||r instanceof WheelEvent)},S.cf=function(r,t){return bt[t]&&"touches"in r},S.cg=function(r){return bt[r]||Kt[r]},S.ch=function(r,t,n){var a=t[0],c=t[1];return r[0]=n[0]*a+n[4]*c+n[12],r[1]=n[1]*a+n[5]*c+n[13],r},S.ci=function(r,t){const{x:n,y:a}=uu.fromLngLat(t);return!(r<0||r>25||a<0||a>=1||n<0||n>=1)},S.cj=function(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},S.ck=class extends al{},S.cl=T0,S.cn=function(r){return r.message===fi},S.co=Li,S.cp=function(r,t){ut.REGISTERED_PROTOCOLS[r]=t},S.cq=function(r){delete ut.REGISTERED_PROTOCOLS[r]},S.cr=function(r,t){const n={};for(let c=0;c<r.length;c++){const d=t&&t[r[c].id]||Qo(r[c]);t&&(t[r[c].id]=d);let p=n[d];p||(p=n[d]=[]),p.push(r[c])}const a=[];for(const c in n)a.push(n[c]);return a},S.cs=Ue,S.ct=Sg,S.cu=Cg,S.cv=ig,S.cw=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=Ft/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const t=r.bucket.layers[0],n=t.layout,a=t._unevaluatedLayout._values,c={layoutIconSize:a["icon-size"].possiblyEvaluate(new ti(r.bucket.zoom+1),r.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new ti(r.bucket.zoom+1),r.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new ti(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=r.bucket.textSizeData;c.compositeTextSizes=[a["text-size"].possiblyEvaluate(new ti(w),r.canonical),a["text-size"].possiblyEvaluate(new ti(M),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:w,maxZoom:M}=r.bucket.iconSizeData;c.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new ti(w),r.canonical),a["icon-size"].possiblyEvaluate(new ti(M),r.canonical)]}const d=n.get("text-line-height")*Fi,p=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point",g=n.get("text-keep-upright"),x=n.get("text-size");for(const w of r.bucket.features){const M=n.get("text-font").evaluate(w,{},r.canonical).join(","),C=x.evaluate(w,{},r.canonical),A=c.layoutTextSize.evaluate(w,{},r.canonical),L=c.layoutIconSize.evaluate(w,{},r.canonical),B={horizontal:{},vertical:void 0},j=w.text;let $,X=[0,0];if(j){const R=j.toString(),U=n.get("text-letter-spacing").evaluate(w,{},r.canonical)*Fi,Q=Bh(R)?U:0,fe=n.get("text-anchor").evaluate(w,{},r.canonical),ze=jg(t,w,r.canonical);if(!ze){const Ae=n.get("text-radial-offset").evaluate(w,{},r.canonical);X=Ae?Og(fe,[Ae*Fi,Zp]):n.get("text-offset").evaluate(w,{},r.canonical).map(Fe=>Fe*Fi)}let xe=p?"center":n.get("text-justify").evaluate(w,{},r.canonical);const we=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(w,{},r.canonical)*Fi:1/0,Le=()=>{r.bucket.allowVerticalPlacement&&el(R)&&(B.vertical=id(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,we,d,fe,"left",Q,X,S.al.vertical,!0,A,C))};if(!p&&ze){const Ae=new Set;if(xe==="auto")for(let Pe=0;Pe<ze.values.length;Pe+=2)Ae.add(Vp(ze.values[Pe]));else Ae.add(xe);let Fe=!1;for(const Pe of Ae)if(!B.horizontal[Pe])if(Fe)B.horizontal[Pe]=B.horizontal[0];else{const Ge=id(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,we,d,"center",Pe,Q,X,S.al.horizontal,!1,A,C);Ge&&(B.horizontal[Pe]=Ge,Fe=Ge.positionedLines.length===1)}Le()}else{xe==="auto"&&(xe=Vp(fe));const Ae=id(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,we,d,fe,xe,Q,X,S.al.horizontal,!1,A,C);Ae&&(B.horizontal[xe]=Ae),Le(),el(R)&&p&&g&&(B.vertical=id(j,r.glyphMap,r.glyphPositions,r.imagePositions,M,we,d,fe,xe,Q,X,S.al.vertical,!1,A,C))}}let se=!1;if(w.icon&&w.icon.name){const R=r.imageMap[w.icon.name];R&&($=n0(r.imagePositions[w.icon.name],n.get("icon-offset").evaluate(w,{},r.canonical),n.get("icon-anchor").evaluate(w,{},r.canonical)),se=!!R.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=se:r.bucket.sdfIcons!==se&&Zi("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(R.pixelRatio!==r.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const Y=Zg(B.horizontal)||B.vertical;r.bucket.iconsInText=!!Y&&Y.iconsInText,(Y||$)&&b0(r.bucket,w,B,$,r.imageMap,c,A,L,X,se,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},S.cx=Sp,S.cy=xp,S.cz=Mp,S.d=pr,S.e=hr,S.f=r=>o(void 0,void 0,void 0,function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(t)}catch(n){throw new Error(`Could not load image because of ${n.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),S.g=Gt,S.h=r=>new Promise((t,n)=>{const a=new Image;a.onload=()=>{t(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=Xr})},a.onerror=()=>n(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const c=new Blob([new Uint8Array(r)],{type:"image/png"});a.src=r.byteLength?URL.createObjectURL(c):Xr}),S.i=rr,S.j=(r,t)=>Mi(hr(r,{type:"json"}),t),S.k=G,S.l=Z,S.m=Mi,S.n=(r,t)=>Mi(hr(r,{type:"arrayBuffer"}),t),S.o=function(r){return new Ip(r).readFields(qv,[])},S.p=tg,S.q=Yc,S.r=Sr,S.s=Ze,S.t=Rh,S.u=vt,S.v=V,S.w=Zi,S.x=Dh,S.y=gn,S.z=function([r,t,n]){return t+=90,t*=Math.PI/180,n*=Math.PI/180,{x:r*Math.cos(t)*Math.sin(n),y:r*Math.sin(t)*Math.sin(n),z:r*Math.cos(n)}}}),z("worker",["./shared"],function(S){class o{constructor(N){this.keyCache={},N&&this.replace(N)}replace(N){this._layerConfigs={},this._layers={},this.update(N,[])}update(N,Z){for(const J of N){this._layerConfigs[J.id]=J;const V=this._layers[J.id]=S.bA(J);V._featureFilter=S.a7(V.filter),this.keyCache[J.id]&&delete this.keyCache[J.id]}for(const J of Z)delete this.keyCache[J],delete this._layerConfigs[J],delete this._layers[J];this.familiesBySource={};const G=S.cr(Object.values(this._layerConfigs),this.keyCache);for(const J of G){const V=J.map(de=>this._layers[de.id]),ce=V[0];if(ce.visibility==="none")continue;const ge=ce.source||"";let ie=this.familiesBySource[ge];ie||(ie=this.familiesBySource[ge]={});const ye=ce.sourceLayer||"_geojsonTileLayer";let be=ie[ye];be||(be=ie[ye]=[]),be.push(V)}}}class le{constructor(N){const Z={},G=[];for(const ge in N){const ie=N[ge],ye=Z[ge]={};for(const be in ie){const de=ie[+be];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;const ke={x:0,y:0,w:de.bitmap.width+2,h:de.bitmap.height+2};G.push(ke),ye[be]={rect:ke,metrics:de.metrics}}}const{w:J,h:V}=S.p(G),ce=new S.q({width:J||1,height:V||1});for(const ge in N){const ie=N[ge];for(const ye in ie){const be=ie[+ye];if(!be||be.bitmap.width===0||be.bitmap.height===0)continue;const de=Z[ge][ye].rect;S.q.copy(be.bitmap,ce,{x:0,y:0},{x:de.x+1,y:de.y+1},be.bitmap)}}this.image=ce,this.positions=Z}}S.cs("GlyphAtlas",le);class he{constructor(N){this.tileID=new S.Y(N.tileID.overscaledZ,N.tileID.wrap,N.tileID.canonical.z,N.tileID.canonical.x,N.tileID.canonical.y),this.uid=N.uid,this.zoom=N.zoom,this.pixelRatio=N.pixelRatio,this.tileSize=N.tileSize,this.source=N.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=N.showCollisionBoxes,this.collectResourceTiming=!!N.collectResourceTiming,this.returnDependencies=!!N.returnDependencies,this.promoteId=N.promoteId,this.inFlightDependencies=[]}parse(N,Z,G,J,V){return S._(this,void 0,void 0,function*(){this.status="parsing",this.data=N,this.collisionBoxArray=new S.a5;const ce=new S.ct(Object.keys(N.layers).sort()),ge=new S.cu(this.tileID,this.promoteId);ge.bucketLayerIDs=[];const ie={},ye={featureIndex:ge,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:G,subdivisionGranularity:V},be=Z.familiesBySource[this.source];for(const Ie in be){const $e=N.layers[Ie];if(!$e)continue;$e.version===1&&S.w(`Vector tile source "${this.source}" layer "${Ie}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const et=ce.encode(Ie),fr=[];for(let ar=0;ar<$e.length;ar++){const ci=$e.feature(ar),lt=ge.getId(ci,Ie);fr.push({feature:ci,id:lt,index:ar,sourceLayerIndex:et})}for(const ar of be[Ie]){const ci=ar[0];ci.source!==this.source&&S.w(`layer.source = ${ci.source} does not equal this.source = ${this.source}`),ci.minzoom&&this.zoom<Math.floor(ci.minzoom)||ci.maxzoom&&this.zoom>=ci.maxzoom||ci.visibility!=="none"&&(_e(ar,this.zoom,G),(ie[ci.id]=ci.createBucket({index:ge.bucketLayerIDs.length,layers:ar,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:et,sourceID:this.source})).populate(fr,ye,this.tileID.canonical),ge.bucketLayerIDs.push(ar.map(lt=>lt.id)))}}const de=S.bF(ye.glyphDependencies,Ie=>Object.keys(Ie).map(Number));this.inFlightDependencies.forEach(Ie=>Ie==null?void 0:Ie.abort()),this.inFlightDependencies=[];let ke=Promise.resolve({});if(Object.keys(de).length){const Ie=new AbortController;this.inFlightDependencies.push(Ie),ke=J.sendAsync({type:"GG",data:{stacks:de,source:this.source,tileID:this.tileID,type:"glyphs"}},Ie)}const Ne=Object.keys(ye.iconDependencies);let Ve=Promise.resolve({});if(Ne.length){const Ie=new AbortController;this.inFlightDependencies.push(Ie),Ve=J.sendAsync({type:"GI",data:{icons:Ne,source:this.source,tileID:this.tileID,type:"icons"}},Ie)}const rt=Object.keys(ye.patternDependencies);let dt=Promise.resolve({});if(rt.length){const Ie=new AbortController;this.inFlightDependencies.push(Ie),dt=J.sendAsync({type:"GI",data:{icons:rt,source:this.source,tileID:this.tileID,type:"patterns"}},Ie)}const[Me,at,Ct]=yield Promise.all([ke,Ve,dt]),Vt=new le(Me),It=new S.cv(at,Ct);for(const Ie in ie){const $e=ie[Ie];$e instanceof S.a6?(_e($e.layers,this.zoom,G),S.cw({bucket:$e,glyphMap:Me,glyphPositions:Vt.positions,imageMap:at,imagePositions:It.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:ye.subdivisionGranularity})):$e.hasPattern&&($e instanceof S.cx||$e instanceof S.cy||$e instanceof S.cz)&&(_e($e.layers,this.zoom,G),$e.addFeatures(ye,this.tileID.canonical,It.patternPositions))}return this.status="done",{buckets:Object.values(ie).filter(Ie=>!Ie.isEmpty()),featureIndex:ge,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:Vt.image,imageAtlas:It,glyphMap:this.returnDependencies?Me:null,iconMap:this.returnDependencies?at:null,glyphPositions:this.returnDependencies?Vt.positions:null}})}}function _e(ue,N,Z){const G=new S.C(N);for(const J of ue)J.recalculate(G,Z)}class Re{constructor(N,Z,G){this.actor=N,this.layerIndex=Z,this.availableImages=G,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(N,Z){return S._(this,void 0,void 0,function*(){const G=yield S.n(N.request,Z);try{return{vectorTile:new S.cA.VectorTile(new S.cB(G.data)),rawData:G.data,cacheControl:G.cacheControl,expires:G.expires}}catch(J){const V=new Uint8Array(G.data);let ce=`Unable to parse the tile at ${N.request.url}, `;throw ce+=V[0]===31&&V[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${J.message}`,new Error(ce)}})}loadTile(N){return S._(this,void 0,void 0,function*(){const Z=N.uid,G=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cC(N.request),J=new he(N);this.loading[Z]=J;const V=new AbortController;J.abort=V;try{const ce=yield this.loadVectorTile(N,V);if(delete this.loading[Z],!ce)return null;const ge=ce.rawData,ie={};ce.expires&&(ie.expires=ce.expires),ce.cacheControl&&(ie.cacheControl=ce.cacheControl);const ye={};if(G){const de=G.finish();de&&(ye.resourceTiming=JSON.parse(JSON.stringify(de)))}J.vectorTile=ce.vectorTile;const be=J.parse(ce.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);this.loaded[Z]=J,this.fetching[Z]={rawTileData:ge,cacheControl:ie,resourceTiming:ye};try{const de=yield be;return S.e({rawTileData:ge.slice(0)},de,ie,ye)}finally{delete this.fetching[Z]}}catch(ce){throw delete this.loading[Z],J.status="done",this.loaded[Z]=J,ce}})}reloadTile(N){return S._(this,void 0,void 0,function*(){const Z=N.uid;if(!this.loaded||!this.loaded[Z])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const G=this.loaded[Z];if(G.showCollisionBoxes=N.showCollisionBoxes,G.status==="parsing"){const J=yield G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);let V;if(this.fetching[Z]){const{rawTileData:ce,cacheControl:ge,resourceTiming:ie}=this.fetching[Z];delete this.fetching[Z],V=S.e({rawTileData:ce.slice(0)},J,ge,ie)}else V=J;return V}if(G.status==="done"&&G.vectorTile)return G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity)})}abortTile(N){return S._(this,void 0,void 0,function*(){const Z=this.loading,G=N.uid;Z&&Z[G]&&Z[G].abort&&(Z[G].abort.abort(),delete Z[G])})}removeTile(N){return S._(this,void 0,void 0,function*(){this.loaded&&this.loaded[N.uid]&&delete this.loaded[N.uid]})}}class ve{constructor(){this.loaded={}}loadTile(N){return S._(this,void 0,void 0,function*(){const{uid:Z,encoding:G,rawImageData:J,redFactor:V,greenFactor:ce,blueFactor:ge,baseShift:ie}=N,ye=J.width+2,be=J.height+2,de=S.b(J)?new S.R({width:ye,height:be},yield S.cD(J,-1,-1,ye,be)):J,ke=new S.cE(Z,de,G,V,ce,ge,ie);return this.loaded=this.loaded||{},this.loaded[Z]=ke,ke})}removeTile(N){const Z=this.loaded,G=N.uid;Z&&Z[G]&&delete Z[G]}}var ne,De,_t=function(){if(De)return ne;function ue(Z,G){if(Z.length!==0){N(Z[0],G);for(var J=1;J<Z.length;J++)N(Z[J],!G)}}function N(Z,G){for(var J=0,V=0,ce=0,ge=Z.length,ie=ge-1;ce<ge;ie=ce++){var ye=(Z[ce][0]-Z[ie][0])*(Z[ie][1]+Z[ce][1]),be=J+ye;V+=Math.abs(J)>=Math.abs(ye)?J-be+ye:ye-be+J,J=be}J+V>=0!=!!G&&Z.reverse()}return De=1,ne=function Z(G,J){var V,ce=G&&G.type;if(ce==="FeatureCollection")for(V=0;V<G.features.length;V++)Z(G.features[V],J);else if(ce==="GeometryCollection")for(V=0;V<G.geometries.length;V++)Z(G.geometries[V],J);else if(ce==="Feature")Z(G.geometry,J);else if(ce==="Polygon")ue(G.coordinates,J);else if(ce==="MultiPolygon")for(V=0;V<G.coordinates.length;V++)ue(G.coordinates[V],J);return G}}(),Rt=S.cF(_t);const yt=S.cA.VectorTileFeature.prototype.toGeoJSON;class Dt{constructor(N){this._feature=N,this.extent=S.Z,this.type=N.type,this.properties=N.tags,"id"in N&&!isNaN(N.id)&&(this.id=parseInt(N.id,10))}loadGeometry(){if(this._feature.type===1){const N=[];for(const Z of this._feature.geometry)N.push([new S.P(Z[0],Z[1])]);return N}{const N=[];for(const Z of this._feature.geometry){const G=[];for(const J of Z)G.push(new S.P(J[0],J[1]));N.push(G)}return N}}toGeoJSON(N,Z,G){return yt.call(this,N,Z,G)}}class Jt{constructor(N){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=S.Z,this.length=N.length,this._features=N}feature(N){return new Dt(this._features[N])}}var Xt,Et,Bt,Ri={exports:{}},jt=function(){if(Bt)return Ri.exports;Bt=1;var ue=S.cI(),N=function(){if(Et)return Xt;Et=1;var be=S.cG(),de=S.cH().VectorTileFeature;function ke(Ve,rt){this.options=rt||{},this.features=Ve,this.length=Ve.length}function Ne(Ve,rt){this.id=typeof Ve.id=="number"?Ve.id:void 0,this.type=Ve.type,this.rawGeometry=Ve.type===1?[Ve.geometry]:Ve.geometry,this.properties=Ve.tags,this.extent=rt||4096}return Xt=ke,ke.prototype.feature=function(Ve){return new Ne(this.features[Ve],this.options.extent)},Ne.prototype.loadGeometry=function(){var Ve=this.rawGeometry;this.geometry=[];for(var rt=0;rt<Ve.length;rt++){for(var dt=Ve[rt],Me=[],at=0;at<dt.length;at++)Me.push(new be(dt[at][0],dt[at][1]));this.geometry.push(Me)}return this.geometry},Ne.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Ve=this.geometry,rt=1/0,dt=-1/0,Me=1/0,at=-1/0,Ct=0;Ct<Ve.length;Ct++)for(var Vt=Ve[Ct],It=0;It<Vt.length;It++){var Ie=Vt[It];rt=Math.min(rt,Ie.x),dt=Math.max(dt,Ie.x),Me=Math.min(Me,Ie.y),at=Math.max(at,Ie.y)}return[rt,Me,dt,at]},Ne.prototype.toGeoJSON=de.prototype.toGeoJSON,Xt}();function Z(be){var de=new ue;return function(ke,Ne){for(var Ve in ke.layers)Ne.writeMessage(3,G,ke.layers[Ve])}(be,de),de.finish()}function G(be,de){var ke;de.writeVarintField(15,be.version||1),de.writeStringField(1,be.name||""),de.writeVarintField(5,be.extent||4096);var Ne={keys:[],values:[],keycache:{},valuecache:{}};for(ke=0;ke<be.length;ke++)Ne.feature=be.feature(ke),de.writeMessage(2,J,Ne);var Ve=Ne.keys;for(ke=0;ke<Ve.length;ke++)de.writeStringField(3,Ve[ke]);var rt=Ne.values;for(ke=0;ke<rt.length;ke++)de.writeMessage(4,ye,rt[ke])}function J(be,de){var ke=be.feature;ke.id!==void 0&&de.writeVarintField(1,ke.id),de.writeMessage(2,V,be),de.writeVarintField(3,ke.type),de.writeMessage(4,ie,ke)}function V(be,de){var ke=be.feature,Ne=be.keys,Ve=be.values,rt=be.keycache,dt=be.valuecache;for(var Me in ke.properties){var at=ke.properties[Me],Ct=rt[Me];if(at!==null){Ct===void 0&&(Ne.push(Me),rt[Me]=Ct=Ne.length-1),de.writeVarint(Ct);var Vt=typeof at;Vt!=="string"&&Vt!=="boolean"&&Vt!=="number"&&(at=JSON.stringify(at));var It=Vt+":"+at,Ie=dt[It];Ie===void 0&&(Ve.push(at),dt[It]=Ie=Ve.length-1),de.writeVarint(Ie)}}}function ce(be,de){return(de<<3)+(7&be)}function ge(be){return be<<1^be>>31}function ie(be,de){for(var ke=be.loadGeometry(),Ne=be.type,Ve=0,rt=0,dt=ke.length,Me=0;Me<dt;Me++){var at=ke[Me],Ct=1;Ne===1&&(Ct=at.length),de.writeVarint(ce(1,Ct));for(var Vt=Ne===3?at.length-1:at.length,It=0;It<Vt;It++){It===1&&Ne!==1&&de.writeVarint(ce(2,Vt-1));var Ie=at[It].x-Ve,$e=at[It].y-rt;de.writeVarint(ge(Ie)),de.writeVarint(ge($e)),Ve+=Ie,rt+=$e}Ne===3&&de.writeVarint(ce(7,1))}}function ye(be,de){var ke=typeof be;ke==="string"?de.writeStringField(1,be):ke==="boolean"?de.writeBooleanField(7,be):ke==="number"&&(be%1!=0?de.writeDoubleField(3,be):be<0?de.writeSVarintField(6,be):de.writeVarintField(5,be))}return Ri.exports=Z,Ri.exports.fromVectorTileJs=Z,Ri.exports.fromGeojsonVt=function(be,de){de=de||{};var ke={};for(var Ne in be)ke[Ne]=new N(be[Ne].features,de),ke[Ne].name=Ne,ke[Ne].version=de.version,ke[Ne].extent=de.extent;return Z({layers:ke})},Ri.exports.GeoJSONWrapper=N,Ri.exports}(),xr=S.cF(jt);const cn={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ue=>ue},Vr=Math.fround||(mt=new Float32Array(1),ue=>(mt[0]=+ue,mt[0]));var mt;const _i=3,li=5,Ni=6;class vr{constructor(N){this.options=Object.assign(Object.create(cn),N),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(N){const{log:Z,minZoom:G,maxZoom:J}=this.options;Z&&console.time("total time");const V=`prepare ${N.length} points`;Z&&console.time(V),this.points=N;const ce=[];for(let ie=0;ie<N.length;ie++){const ye=N[ie];if(!ye.geometry)continue;const[be,de]=ye.geometry.coordinates,ke=Vr(zr(be)),Ne=Vr(Ar(de));ce.push(ke,Ne,1/0,ie,-1,1),this.options.reduce&&ce.push(0)}let ge=this.trees[J+1]=this._createTree(ce);Z&&console.timeEnd(V);for(let ie=J;ie>=G;ie--){const ye=+Date.now();ge=this.trees[ie]=this._createTree(this._cluster(ge,ie)),Z&&console.log("z%d: %d clusters in %dms",ie,ge.numItems,+Date.now()-ye)}return Z&&console.timeEnd("total time"),this}getClusters(N,Z){let G=((N[0]+180)%360+360)%360-180;const J=Math.max(-90,Math.min(90,N[1]));let V=N[2]===180?180:((N[2]+180)%360+360)%360-180;const ce=Math.max(-90,Math.min(90,N[3]));if(N[2]-N[0]>=360)G=-180,V=180;else if(G>V){const de=this.getClusters([G,J,180,ce],Z),ke=this.getClusters([-180,J,V,ce],Z);return de.concat(ke)}const ge=this.trees[this._limitZoom(Z)],ie=ge.range(zr(G),Ar(ce),zr(V),Ar(J)),ye=ge.data,be=[];for(const de of ie){const ke=this.stride*de;be.push(ye[ke+li]>1?un(ye,ke,this.clusterProps):this.points[ye[ke+_i]])}return be}getChildren(N){const Z=this._getOriginId(N),G=this._getOriginZoom(N),J="No cluster with the specified id.",V=this.trees[G];if(!V)throw new Error(J);const ce=V.data;if(Z*this.stride>=ce.length)throw new Error(J);const ge=this.options.radius/(this.options.extent*Math.pow(2,G-1)),ie=V.within(ce[Z*this.stride],ce[Z*this.stride+1],ge),ye=[];for(const be of ie){const de=be*this.stride;ce[de+4]===N&&ye.push(ce[de+li]>1?un(ce,de,this.clusterProps):this.points[ce[de+_i]])}if(ye.length===0)throw new Error(J);return ye}getLeaves(N,Z,G){const J=[];return this._appendLeaves(J,N,Z=Z||10,G=G||0,0),J}getTile(N,Z,G){const J=this.trees[this._limitZoom(N)],V=Math.pow(2,N),{extent:ce,radius:ge}=this.options,ie=ge/ce,ye=(G-ie)/V,be=(G+1+ie)/V,de={features:[]};return this._addTileFeatures(J.range((Z-ie)/V,ye,(Z+1+ie)/V,be),J.data,Z,G,V,de),Z===0&&this._addTileFeatures(J.range(1-ie/V,ye,1,be),J.data,V,G,V,de),Z===V-1&&this._addTileFeatures(J.range(0,ye,ie/V,be),J.data,-1,G,V,de),de.features.length?de:null}getClusterExpansionZoom(N){let Z=this._getOriginZoom(N)-1;for(;Z<=this.options.maxZoom;){const G=this.getChildren(N);if(Z++,G.length!==1)break;N=G[0].properties.cluster_id}return Z}_appendLeaves(N,Z,G,J,V){const ce=this.getChildren(Z);for(const ge of ce){const ie=ge.properties;if(ie&&ie.cluster?V+ie.point_count<=J?V+=ie.point_count:V=this._appendLeaves(N,ie.cluster_id,G,J,V):V<J?V++:N.push(ge),N.length===G)break}return V}_createTree(N){const Z=new S.aF(N.length/this.stride|0,this.options.nodeSize,Float32Array);for(let G=0;G<N.length;G+=this.stride)Z.add(N[G],N[G+1]);return Z.finish(),Z.data=N,Z}_addTileFeatures(N,Z,G,J,V,ce){for(const ge of N){const ie=ge*this.stride,ye=Z[ie+li]>1;let be,de,ke;if(ye)be=Ft(Z,ie,this.clusterProps),de=Z[ie],ke=Z[ie+1];else{const rt=this.points[Z[ie+_i]];be=rt.properties;const[dt,Me]=rt.geometry.coordinates;de=zr(dt),ke=Ar(Me)}const Ne={type:1,geometry:[[Math.round(this.options.extent*(de*V-G)),Math.round(this.options.extent*(ke*V-J))]],tags:be};let Ve;Ve=ye||this.options.generateId?Z[ie+_i]:this.points[Z[ie+_i]].id,Ve!==void 0&&(Ne.id=Ve),ce.features.push(Ne)}}_limitZoom(N){return Math.max(this.options.minZoom,Math.min(Math.floor(+N),this.options.maxZoom+1))}_cluster(N,Z){const{radius:G,extent:J,reduce:V,minPoints:ce}=this.options,ge=G/(J*Math.pow(2,Z)),ie=N.data,ye=[],be=this.stride;for(let de=0;de<ie.length;de+=be){if(ie[de+2]<=Z)continue;ie[de+2]=Z;const ke=ie[de],Ne=ie[de+1],Ve=N.within(ie[de],ie[de+1],ge),rt=ie[de+li];let dt=rt;for(const Me of Ve){const at=Me*be;ie[at+2]>Z&&(dt+=ie[at+li])}if(dt>rt&&dt>=ce){let Me,at=ke*rt,Ct=Ne*rt,Vt=-1;const It=((de/be|0)<<5)+(Z+1)+this.points.length;for(const Ie of Ve){const $e=Ie*be;if(ie[$e+2]<=Z)continue;ie[$e+2]=Z;const et=ie[$e+li];at+=ie[$e]*et,Ct+=ie[$e+1]*et,ie[$e+4]=It,V&&(Me||(Me=this._map(ie,de,!0),Vt=this.clusterProps.length,this.clusterProps.push(Me)),V(Me,this._map(ie,$e)))}ie[de+4]=It,ye.push(at/dt,Ct/dt,1/0,It,-1,dt),V&&ye.push(Vt)}else{for(let Me=0;Me<be;Me++)ye.push(ie[de+Me]);if(dt>1)for(const Me of Ve){const at=Me*be;if(!(ie[at+2]<=Z)){ie[at+2]=Z;for(let Ct=0;Ct<be;Ct++)ye.push(ie[at+Ct])}}}}return ye}_getOriginId(N){return N-this.points.length>>5}_getOriginZoom(N){return(N-this.points.length)%32}_map(N,Z,G){if(N[Z+li]>1){const ce=this.clusterProps[N[Z+Ni]];return G?Object.assign({},ce):ce}const J=this.points[N[Z+_i]].properties,V=this.options.map(J);return G&&V===J?Object.assign({},V):V}}function un(ue,N,Z){return{type:"Feature",id:ue[N+_i],properties:Ft(ue,N,Z),geometry:{type:"Point",coordinates:[(G=ue[N],360*(G-.5)),Hn(ue[N+1])]}};var G}function Ft(ue,N,Z){const G=ue[N+li],J=G>=1e4?`${Math.round(G/1e3)}k`:G>=1e3?Math.round(G/100)/10+"k":G,V=ue[N+Ni],ce=V===-1?{}:Object.assign({},Z[V]);return Object.assign(ce,{cluster:!0,cluster_id:ue[N+_i],point_count:G,point_count_abbreviated:J})}function zr(ue){return ue/360+.5}function Ar(ue){const N=Math.sin(ue*Math.PI/180),Z=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return Z<0?0:Z>1?1:Z}function Hn(ue){const N=(180-360*ue)*Math.PI/180;return 360*Math.atan(Math.exp(N))/Math.PI-90}function yi(ue,N,Z,G){let J=G;const V=N+(Z-N>>1);let ce,ge=Z-N;const ie=ue[N],ye=ue[N+1],be=ue[Z],de=ue[Z+1];for(let ke=N+3;ke<Z;ke+=3){const Ne=Pn(ue[ke],ue[ke+1],ie,ye,be,de);if(Ne>J)ce=ke,J=Ne;else if(Ne===J){const Ve=Math.abs(ke-V);Ve<ge&&(ce=ke,ge=Ve)}}J>G&&(ce-N>3&&yi(ue,N,ce,G),ue[ce+2]=J,Z-ce>3&&yi(ue,ce,Z,G))}function Pn(ue,N,Z,G,J,V){let ce=J-Z,ge=V-G;if(ce!==0||ge!==0){const ie=((ue-Z)*ce+(N-G)*ge)/(ce*ce+ge*ge);ie>1?(Z=J,G=V):ie>0&&(Z+=ce*ie,G+=ge*ie)}return ce=ue-Z,ge=N-G,ce*ce+ge*ge}function ir(ue,N,Z,G){const J={id:ue??null,type:N,geometry:Z,tags:G,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(N==="Point"||N==="MultiPoint"||N==="LineString")Ti(J,Z);else if(N==="Polygon")Ti(J,Z[0]);else if(N==="MultiLineString")for(const V of Z)Ti(J,V);else if(N==="MultiPolygon")for(const V of Z)Ti(J,V[0]);return J}function Ti(ue,N){for(let Z=0;Z<N.length;Z+=3)ue.minX=Math.min(ue.minX,N[Z]),ue.minY=Math.min(ue.minY,N[Z+1]),ue.maxX=Math.max(ue.maxX,N[Z]),ue.maxY=Math.max(ue.maxY,N[Z+1])}function hn(ue,N,Z,G){if(!N.geometry)return;const J=N.geometry.coordinates;if(J&&J.length===0)return;const V=N.geometry.type,ce=Math.pow(Z.tolerance/((1<<Z.maxZoom)*Z.extent),2);let ge=[],ie=N.id;if(Z.promoteId?ie=N.properties[Z.promoteId]:Z.generateId&&(ie=G||0),V==="Point")hr(J,ge);else if(V==="MultiPoint")for(const ye of J)hr(ye,ge);else if(V==="LineString")Wn(J,ge,ce,!1);else if(V==="MultiLineString"){if(Z.lineMetrics){for(const ye of J)ge=[],Wn(ye,ge,ce,!1),ue.push(ir(ie,"LineString",ge,N.properties));return}Cn(J,ge,ce,!1)}else if(V==="Polygon")Cn(J,ge,ce,!0);else{if(V!=="MultiPolygon"){if(V==="GeometryCollection"){for(const ye of N.geometry.geometries)hn(ue,{id:ie,geometry:ye,properties:N.properties},Z,G);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const ye of J){const be=[];Cn(ye,be,ce,!0),ge.push(be)}}ue.push(ir(ie,V,ge,N.properties))}function hr(ue,N){N.push(ga(ue[0]),dr(ue[1]),0)}function Wn(ue,N,Z,G){let J,V,ce=0;for(let ie=0;ie<ue.length;ie++){const ye=ga(ue[ie][0]),be=dr(ue[ie][1]);N.push(ye,be,0),ie>0&&(ce+=G?(J*be-ye*V)/2:Math.sqrt(Math.pow(ye-J,2)+Math.pow(be-V,2))),J=ye,V=be}const ge=N.length-3;N[2]=1,yi(N,0,ge,Z),N[ge+2]=1,N.size=Math.abs(ce),N.start=0,N.end=N.size}function Cn(ue,N,Z,G){for(let J=0;J<ue.length;J++){const V=[];Wn(ue[J],V,Z,G),N.push(V)}}function ga(ue){return ue/360+.5}function dr(ue){const N=Math.sin(ue*Math.PI/180),Z=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return Z<0?0:Z>1?1:Z}function Ki(ue,N,Z,G,J,V,ce,ge){if(G/=N,V>=(Z/=N)&&ce<G)return ue;if(ce<Z||V>=G)return null;const ie=[];for(const ye of ue){const be=ye.geometry;let de=ye.type;const ke=J===0?ye.minX:ye.minY,Ne=J===0?ye.maxX:ye.maxY;if(ke>=Z&&Ne<G){ie.push(ye);continue}if(Ne<Z||ke>=G)continue;let Ve=[];if(de==="Point"||de==="MultiPoint")Zi(be,Ve,Z,G,J);else if(de==="LineString")Wt(be,Ve,Z,G,J,!1,ge.lineMetrics);else if(de==="MultiLineString")br(be,Ve,Z,G,J,!1);else if(de==="Polygon")br(be,Ve,Z,G,J,!0);else if(de==="MultiPolygon")for(const rt of be){const dt=[];br(rt,dt,Z,G,J,!0),dt.length&&Ve.push(dt)}if(Ve.length){if(ge.lineMetrics&&de==="LineString"){for(const rt of Ve)ie.push(ir(ye.id,de,rt,ye.tags));continue}de!=="LineString"&&de!=="MultiLineString"||(Ve.length===1?(de="LineString",Ve=Ve[0]):de="MultiLineString"),de!=="Point"&&de!=="MultiPoint"||(de=Ve.length===3?"Point":"MultiPoint"),ie.push(ir(ye.id,de,Ve,ye.tags))}}return ie.length?ie:null}function Zi(ue,N,Z,G,J){for(let V=0;V<ue.length;V+=3){const ce=ue[V+J];ce>=Z&&ce<=G&&Vi(N,ue[V],ue[V+1],ue[V+2])}}function Wt(ue,N,Z,G,J,V,ce){let ge=rr(ue);const ie=J===0?Xr:Kr;let ye,be,de=ue.start;for(let dt=0;dt<ue.length-3;dt+=3){const Me=ue[dt],at=ue[dt+1],Ct=ue[dt+2],Vt=ue[dt+3],It=ue[dt+4],Ie=J===0?Me:at,$e=J===0?Vt:It;let et=!1;ce&&(ye=Math.sqrt(Math.pow(Me-Vt,2)+Math.pow(at-It,2))),Ie<Z?$e>Z&&(be=ie(ge,Me,at,Vt,It,Z),ce&&(ge.start=de+ye*be)):Ie>G?$e<G&&(be=ie(ge,Me,at,Vt,It,G),ce&&(ge.start=de+ye*be)):Vi(ge,Me,at,Ct),$e<Z&&Ie>=Z&&(be=ie(ge,Me,at,Vt,It,Z),et=!0),$e>G&&Ie<=G&&(be=ie(ge,Me,at,Vt,It,G),et=!0),!V&&et&&(ce&&(ge.end=de+ye*be),N.push(ge),ge=rr(ue)),ce&&(de+=ye)}let ke=ue.length-3;const Ne=ue[ke],Ve=ue[ke+1],rt=J===0?Ne:Ve;rt>=Z&&rt<=G&&Vi(ge,Ne,Ve,ue[ke+2]),ke=ge.length-3,V&&ke>=3&&(ge[ke]!==ge[0]||ge[ke+1]!==ge[1])&&Vi(ge,ge[0],ge[1],ge[2]),ge.length&&N.push(ge)}function rr(ue){const N=[];return N.size=ue.size,N.start=ue.start,N.end=ue.end,N}function br(ue,N,Z,G,J,V){for(const ce of ue)Wt(ce,N,Z,G,J,V,!1)}function Vi(ue,N,Z,G){ue.push(N,Z,G)}function Xr(ue,N,Z,G,J,V){const ce=(V-N)/(G-N);return Vi(ue,V,Z+(J-Z)*ce,1),ce}function Kr(ue,N,Z,G,J,V){const ce=(V-Z)/(J-Z);return Vi(ue,N+(G-N)*ce,V,1),ce}function Di(ue,N){const Z=[];for(let G=0;G<ue.length;G++){const J=ue[G],V=J.type;let ce;if(V==="Point"||V==="MultiPoint"||V==="LineString")ce=nr(J.geometry,N);else if(V==="MultiLineString"||V==="Polygon"){ce=[];for(const ge of J.geometry)ce.push(nr(ge,N))}else if(V==="MultiPolygon"){ce=[];for(const ge of J.geometry){const ie=[];for(const ye of ge)ie.push(nr(ye,N));ce.push(ie)}}Z.push(ir(J.id,V,ce,J.tags))}return Z}function nr(ue,N){const Z=[];Z.size=ue.size,ue.start!==void 0&&(Z.start=ue.start,Z.end=ue.end);for(let G=0;G<ue.length;G+=3)Z.push(ue[G]+N,ue[G+1],ue[G+2]);return Z}function Ze(ue,N){if(ue.transformed)return ue;const Z=1<<ue.z,G=ue.x,J=ue.y;for(const V of ue.features){const ce=V.geometry,ge=V.type;if(V.geometry=[],ge===1)for(let ie=0;ie<ce.length;ie+=2)V.geometry.push(Xe(ce[ie],ce[ie+1],N,Z,G,J));else for(let ie=0;ie<ce.length;ie++){const ye=[];for(let be=0;be<ce[ie].length;be+=2)ye.push(Xe(ce[ie][be],ce[ie][be+1],N,Z,G,J));V.geometry.push(ye)}}return ue.transformed=!0,ue}function Xe(ue,N,Z,G,J,V){return[Math.round(Z*(ue*G-J)),Math.round(Z*(N*G-V))]}function bt(ue,N,Z,G,J){const V=N===J.maxZoom?0:J.tolerance/((1<<N)*J.extent),ce={features:[],numPoints:0,numSimplified:0,numFeatures:ue.length,source:null,x:Z,y:G,z:N,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ge of ue)Kt(ce,ge,V,J);return ce}function Kt(ue,N,Z,G){const J=N.geometry,V=N.type,ce=[];if(ue.minX=Math.min(ue.minX,N.minX),ue.minY=Math.min(ue.minY,N.minY),ue.maxX=Math.max(ue.maxX,N.maxX),ue.maxY=Math.max(ue.maxY,N.maxY),V==="Point"||V==="MultiPoint")for(let ge=0;ge<J.length;ge+=3)ce.push(J[ge],J[ge+1]),ue.numPoints++,ue.numSimplified++;else if(V==="LineString")fi(ce,J,ue,Z,!1,!1);else if(V==="MultiLineString"||V==="Polygon")for(let ge=0;ge<J.length;ge++)fi(ce,J[ge],ue,Z,V==="Polygon",ge===0);else if(V==="MultiPolygon")for(let ge=0;ge<J.length;ge++){const ie=J[ge];for(let ye=0;ye<ie.length;ye++)fi(ce,ie[ye],ue,Z,!0,ye===0)}if(ce.length){let ge=N.tags||null;if(V==="LineString"&&G.lineMetrics){ge={};for(const ye in N.tags)ge[ye]=N.tags[ye];ge.mapbox_clip_start=J.start/J.size,ge.mapbox_clip_end=J.end/J.size}const ie={geometry:ce,type:V==="Polygon"||V==="MultiPolygon"?3:V==="LineString"||V==="MultiLineString"?2:1,tags:ge};N.id!==null&&(ie.id=N.id),ue.features.push(ie)}}function fi(ue,N,Z,G,J,V){const ce=G*G;if(G>0&&N.size<(J?ce:G))return void(Z.numPoints+=N.length/3);const ge=[];for(let ie=0;ie<N.length;ie+=3)(G===0||N[ie+2]>ce)&&(Z.numSimplified++,ge.push(N[ie],N[ie+1])),Z.numPoints++;J&&function(ie,ye){let be=0;for(let de=0,ke=ie.length,Ne=ke-2;de<ke;Ne=de,de+=2)be+=(ie[de]-ie[Ne])*(ie[de+1]+ie[Ne+1]);if(be>0===ye)for(let de=0,ke=ie.length;de<ke/2;de+=2){const Ne=ie[de],Ve=ie[de+1];ie[de]=ie[ke-2-de],ie[de+1]=ie[ke-1-de],ie[ke-2-de]=Ne,ie[ke-1-de]=Ve}}(ge,V),ue.push(ge)}const kt={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ut{constructor(N,Z){const G=(Z=this.options=function(V,ce){for(const ge in ce)V[ge]=ce[ge];return V}(Object.create(kt),Z)).debug;if(G&&console.time("preprocess data"),Z.maxZoom<0||Z.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(Z.promoteId&&Z.generateId)throw new Error("promoteId and generateId cannot be used together.");let J=function(V,ce){const ge=[];if(V.type==="FeatureCollection")for(let ie=0;ie<V.features.length;ie++)hn(ge,V.features[ie],ce,ie);else hn(ge,V.type==="Feature"?V:{geometry:V},ce);return ge}(N,Z);this.tiles={},this.tileCoords=[],G&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",Z.indexMaxZoom,Z.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),J=function(V,ce){const ge=ce.buffer/ce.extent;let ie=V;const ye=Ki(V,1,-1-ge,ge,0,-1,2,ce),be=Ki(V,1,1-ge,2+ge,0,-1,2,ce);return(ye||be)&&(ie=Ki(V,1,-ge,1+ge,0,-1,2,ce)||[],ye&&(ie=Di(ye,1).concat(ie)),be&&(ie=ie.concat(Di(be,-1)))),ie}(J,Z),J.length&&this.splitTile(J,0,0,0),G&&(J.length&&console.log("features: %d, points: %d",this.tiles[0].numFeatures,this.tiles[0].numPoints),console.timeEnd("generate tiles"),console.log("tiles generated:",this.total,JSON.stringify(this.stats)))}splitTile(N,Z,G,J,V,ce,ge){const ie=[N,Z,G,J],ye=this.options,be=ye.debug;for(;ie.length;){J=ie.pop(),G=ie.pop(),Z=ie.pop(),N=ie.pop();const de=1<<Z,ke=Gt(Z,G,J);let Ne=this.tiles[ke];if(!Ne&&(be>1&&console.time("creation"),Ne=this.tiles[ke]=bt(N,Z,G,J,ye),this.tileCoords.push({z:Z,x:G,y:J}),be)){be>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",Z,G,J,Ne.numFeatures,Ne.numPoints,Ne.numSimplified),console.timeEnd("creation"));const et=`z${Z}`;this.stats[et]=(this.stats[et]||0)+1,this.total++}if(Ne.source=N,V==null){if(Z===ye.indexMaxZoom||Ne.numPoints<=ye.indexMaxPoints)continue}else{if(Z===ye.maxZoom||Z===V)continue;if(V!=null){const et=V-Z;if(G!==ce>>et||J!==ge>>et)continue}}if(Ne.source=null,N.length===0)continue;be>1&&console.time("clipping");const Ve=.5*ye.buffer/ye.extent,rt=.5-Ve,dt=.5+Ve,Me=1+Ve;let at=null,Ct=null,Vt=null,It=null,Ie=Ki(N,de,G-Ve,G+dt,0,Ne.minX,Ne.maxX,ye),$e=Ki(N,de,G+rt,G+Me,0,Ne.minX,Ne.maxX,ye);N=null,Ie&&(at=Ki(Ie,de,J-Ve,J+dt,1,Ne.minY,Ne.maxY,ye),Ct=Ki(Ie,de,J+rt,J+Me,1,Ne.minY,Ne.maxY,ye),Ie=null),$e&&(Vt=Ki($e,de,J-Ve,J+dt,1,Ne.minY,Ne.maxY,ye),It=Ki($e,de,J+rt,J+Me,1,Ne.minY,Ne.maxY,ye),$e=null),be>1&&console.timeEnd("clipping"),ie.push(at||[],Z+1,2*G,2*J),ie.push(Ct||[],Z+1,2*G,2*J+1),ie.push(Vt||[],Z+1,2*G+1,2*J),ie.push(It||[],Z+1,2*G+1,2*J+1)}}getTile(N,Z,G){N=+N,Z=+Z,G=+G;const J=this.options,{extent:V,debug:ce}=J;if(N<0||N>24)return null;const ge=1<<N,ie=Gt(N,Z=Z+ge&ge-1,G);if(this.tiles[ie])return Ze(this.tiles[ie],V);ce>1&&console.log("drilling down to z%d-%d-%d",N,Z,G);let ye,be=N,de=Z,ke=G;for(;!ye&&be>0;)be--,de>>=1,ke>>=1,ye=this.tiles[Gt(be,de,ke)];return ye&&ye.source?(ce>1&&(console.log("found parent tile z%d-%d-%d",be,de,ke),console.time("drilling down")),this.splitTile(ye.source,be,de,ke,N,Z,G),ce>1&&console.timeEnd("drilling down"),this.tiles[ie]?Ze(this.tiles[ie],V):null):null}}function Gt(ue,N,Z){return 32*((1<<ue)*Z+N)+ue}function qt(ue,N){return N?ue.properties[N]:ue.id}function Li(ue,N){if(ue==null)return!0;if(ue.type==="Feature")return qt(ue,N)!=null;if(ue.type==="FeatureCollection"){const Z=new Set;for(const G of ue.features){const J=qt(G,N);if(J==null||Z.has(J))return!1;Z.add(J)}return!0}return!1}function Yt(ue,N){const Z=new Map;if(ue!=null)if(ue.type==="Feature")Z.set(qt(ue,N),ue);else for(const G of ue.features)Z.set(qt(G,N),G);return Z}class Mi extends Re{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(N,Z){return S._(this,void 0,void 0,function*(){const G=N.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const J=this._geoJSONIndex.getTile(G.z,G.x,G.y);if(!J)return null;const V=new Jt(J.features);let ce=xr(V);return ce.byteOffset===0&&ce.byteLength===ce.buffer.byteLength||(ce=new Uint8Array(ce)),{vectorTile:V,rawData:ce.buffer}})}loadData(N){return S._(this,void 0,void 0,function*(){var Z;(Z=this._pendingRequest)===null||Z===void 0||Z.abort();const G=!!(N&&N.request&&N.request.collectResourceTiming)&&new S.cC(N.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(N,this._pendingRequest),this._geoJSONIndex=N.cluster?new vr(function({superclusterOptions:ce,clusterProperties:ge}){if(!ge||!ce)return ce;const ie={},ye={},be={accumulated:null,zoom:0},de={properties:null},ke=Object.keys(ge);for(const Ne of ke){const[Ve,rt]=ge[Ne],dt=S.cJ(rt),Me=S.cJ(typeof Ve=="string"?[Ve,["accumulated"],["get",Ne]]:Ve);ie[Ne]=dt.value,ye[Ne]=Me.value}return ce.map=Ne=>{de.properties=Ne;const Ve={};for(const rt of ke)Ve[rt]=ie[rt].evaluate(be,de);return Ve},ce.reduce=(Ne,Ve)=>{de.properties=Ve;for(const rt of ke)be.accumulated=Ne[rt],Ne[rt]=ye[rt].evaluate(be,de)},ce}(N)).load((yield this._pendingData).features):(J=yield this._pendingData,new ut(J,N.geojsonVtOptions)),this.loaded={};const V={};if(G){const ce=G.finish();ce&&(V.resourceTiming={},V.resourceTiming[N.source]=JSON.parse(JSON.stringify(ce)))}return V}catch(V){if(delete this._pendingRequest,S.cn(V))return{abandoned:!0};throw V}var J})}getData(){return S._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(N){const Z=this.loaded;return Z&&Z[N.uid]?super.reloadTile(N):this.loadTile(N)}loadAndProcessGeoJSON(N,Z){return S._(this,void 0,void 0,function*(){let G=yield this.loadGeoJSON(N,Z);if(delete this._pendingRequest,typeof G!="object")throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(Rt(G,!0),N.filter){const J=S.cJ(N.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(J.result==="error")throw new Error(J.value.map(ce=>`${ce.key}: ${ce.message}`).join(", "));G={type:"FeatureCollection",features:G.features.filter(ce=>J.value.evaluate({zoom:0},ce))}}return G})}loadGeoJSON(N,Z){return S._(this,void 0,void 0,function*(){const{promoteId:G}=N;if(N.request){const J=yield S.j(N.request,Z);return this._dataUpdateable=Li(J.data,G)?Yt(J.data,G):void 0,J.data}if(typeof N.data=="string")try{const J=JSON.parse(N.data);return this._dataUpdateable=Li(J,G)?Yt(J,G):void 0,J}catch{throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`)}if(!N.dataDiff)throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${N.source}`);return function(J,V,ce){var ge,ie,ye,be;if(V.removeAll&&J.clear(),V.remove)for(const de of V.remove)J.delete(de);if(V.add)for(const de of V.add){const ke=qt(de,ce);ke!=null&&J.set(ke,de)}if(V.update)for(const de of V.update){let ke=J.get(de.id);if(ke==null)continue;const Ne=!de.removeAllProperties&&(((ge=de.removeProperties)===null||ge===void 0?void 0:ge.length)>0||((ie=de.addOrUpdateProperties)===null||ie===void 0?void 0:ie.length)>0);if((de.newGeometry||de.removeAllProperties||Ne)&&(ke=Object.assign({},ke),J.set(de.id,ke),Ne&&(ke.properties=Object.assign({},ke.properties))),de.newGeometry&&(ke.geometry=de.newGeometry),de.removeAllProperties)ke.properties={};else if(((ye=de.removeProperties)===null||ye===void 0?void 0:ye.length)>0)for(const Ve of de.removeProperties)Object.prototype.hasOwnProperty.call(ke.properties,Ve)&&delete ke.properties[Ve];if(((be=de.addOrUpdateProperties)===null||be===void 0?void 0:be.length)>0)for(const{key:Ve,value:rt}of de.addOrUpdateProperties)ke.properties[Ve]=rt}}(this._dataUpdateable,N.dataDiff,G),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(N){return S._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(N){return this._geoJSONIndex.getClusterExpansionZoom(N.clusterId)}getClusterChildren(N){return this._geoJSONIndex.getChildren(N.clusterId)}getClusterLeaves(N){return this._geoJSONIndex.getLeaves(N.clusterId,N.limit,N.offset)}}class pr{constructor(N){this.self=N,this.actor=new S.H(N),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(Z,G)=>{if(this.externalWorkerSourceTypes[Z])throw new Error(`Worker source with name "${Z}" already registered.`);this.externalWorkerSourceTypes[Z]=G},this.self.addProtocol=S.cp,this.self.removeProtocol=S.cq,this.self.registerRTLTextPlugin=Z=>{S.cK.setMethods(Z)},this.actor.registerMessageHandler("LDT",(Z,G)=>this._getDEMWorkerSource(Z,G.source).loadTile(G)),this.actor.registerMessageHandler("RDT",(Z,G)=>S._(this,void 0,void 0,function*(){this._getDEMWorkerSource(Z,G.source).removeTile(G)})),this.actor.registerMessageHandler("GCEZ",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterExpansionZoom(G)})),this.actor.registerMessageHandler("GCC",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterChildren(G)})),this.actor.registerMessageHandler("GCL",(Z,G)=>S._(this,void 0,void 0,function*(){return this._getWorkerSource(Z,G.type,G.source).getClusterLeaves(G)})),this.actor.registerMessageHandler("LD",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).loadData(G)),this.actor.registerMessageHandler("GD",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).getData()),this.actor.registerMessageHandler("LT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).loadTile(G)),this.actor.registerMessageHandler("RT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).reloadTile(G)),this.actor.registerMessageHandler("AT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).abortTile(G)),this.actor.registerMessageHandler("RMT",(Z,G)=>this._getWorkerSource(Z,G.type,G.source).removeTile(G)),this.actor.registerMessageHandler("RS",(Z,G)=>S._(this,void 0,void 0,function*(){if(!this.workerSources[Z]||!this.workerSources[Z][G.type]||!this.workerSources[Z][G.type][G.source])return;const J=this.workerSources[Z][G.type][G.source];delete this.workerSources[Z][G.type][G.source],J.removeSource!==void 0&&J.removeSource(G)})),this.actor.registerMessageHandler("RM",Z=>S._(this,void 0,void 0,function*(){delete this.layerIndexes[Z],delete this.availableImages[Z],delete this.workerSources[Z],delete this.demWorkerSources[Z]})),this.actor.registerMessageHandler("SR",(Z,G)=>S._(this,void 0,void 0,function*(){this.referrer=G})),this.actor.registerMessageHandler("SRPS",(Z,G)=>this._syncRTLPluginState(Z,G)),this.actor.registerMessageHandler("IS",(Z,G)=>S._(this,void 0,void 0,function*(){this.self.importScripts(G)})),this.actor.registerMessageHandler("SI",(Z,G)=>this._setImages(Z,G)),this.actor.registerMessageHandler("UL",(Z,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(Z).update(G.layers,G.removedIds)})),this.actor.registerMessageHandler("SL",(Z,G)=>S._(this,void 0,void 0,function*(){this._getLayerIndex(Z).replace(G)}))}_setImages(N,Z){return S._(this,void 0,void 0,function*(){this.availableImages[N]=Z;for(const G in this.workerSources[N]){const J=this.workerSources[N][G];for(const V in J)J[V].availableImages=Z}})}_syncRTLPluginState(N,Z){return S._(this,void 0,void 0,function*(){return yield S.cK.syncState(Z,this.self.importScripts)})}_getAvailableImages(N){let Z=this.availableImages[N];return Z||(Z=[]),Z}_getLayerIndex(N){let Z=this.layerIndexes[N];return Z||(Z=this.layerIndexes[N]=new o),Z}_getWorkerSource(N,Z,G){if(this.workerSources[N]||(this.workerSources[N]={}),this.workerSources[N][Z]||(this.workerSources[N][Z]={}),!this.workerSources[N][Z][G]){const J={sendAsync:(V,ce)=>(V.targetMapId=N,this.actor.sendAsync(V,ce))};switch(Z){case"vector":this.workerSources[N][Z][G]=new Re(J,this._getLayerIndex(N),this._getAvailableImages(N));break;case"geojson":this.workerSources[N][Z][G]=new Mi(J,this._getLayerIndex(N),this._getAvailableImages(N));break;default:this.workerSources[N][Z][G]=new this.externalWorkerSourceTypes[Z](J,this._getLayerIndex(N),this._getAvailableImages(N))}}return this.workerSources[N][Z][G]}_getDEMWorkerSource(N,Z){return this.demWorkerSources[N]||(this.demWorkerSources[N]={}),this.demWorkerSources[N][Z]||(this.demWorkerSources[N][Z]=new ve),this.demWorkerSources[N][Z]}}return S.i(self)&&(self.worker=new pr(self)),pr}),z("index",["exports","./shared"],function(S,o){var le="5.4.0";function he(){var u=new o.A(4);return o.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}let _e,Re;const ve={now:typeof performance<"u"&&performance&&performance.now?performance.now.bind(performance):Date.now.bind(Date),frame(u,e,i){const s=requestAnimationFrame(h=>{l(),e(h)}),{unsubscribe:l}=o.s(u.signal,"abort",()=>{l(),cancelAnimationFrame(s),i(o.c())},!1)},frameAsync(u){return new Promise((e,i)=>{this.frame(u,e,i)})},getImageData(u,e=0){return this.getImageCanvasContext(u).getImageData(-e,-e,u.width+2*e,u.height+2*e)},getImageCanvasContext(u){const e=window.document.createElement("canvas"),i=e.getContext("2d",{willReadFrequently:!0});if(!i)throw new Error("failed to create canvas 2d context");return e.width=u.width,e.height=u.height,i.drawImage(u,0,0,u.width,u.height),i},resolveURL:u=>(_e||(_e=document.createElement("a")),_e.href=u,_e.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Re==null&&(Re=matchMedia("(prefers-reduced-motion: reduce)")),Re.matches)}};class ne{static testProp(e){if(!ne.docStyle)return e[0];for(let i=0;i<e.length;i++)if(e[i]in ne.docStyle)return e[i];return e[0]}static create(e,i,s){const l=window.document.createElement(e);return i!==void 0&&(l.className=i),s&&s.appendChild(l),l}static createNS(e,i){return window.document.createElementNS(e,i)}static disableDrag(){ne.docStyle&&ne.selectProp&&(ne.userSelect=ne.docStyle[ne.selectProp],ne.docStyle[ne.selectProp]="none")}static enableDrag(){ne.docStyle&&ne.selectProp&&(ne.docStyle[ne.selectProp]=ne.userSelect)}static setTransform(e,i){e.style[ne.transformProp]=i}static addEventListener(e,i,s,l={}){e.addEventListener(i,s,"passive"in l?l:l.capture)}static removeEventListener(e,i,s,l={}){e.removeEventListener(i,s,"passive"in l?l:l.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",ne.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ne.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ne.suppressClickInternal,!0)},0)}static getScale(e){const i=e.getBoundingClientRect();return{x:i.width/e.offsetWidth||1,y:i.height/e.offsetHeight||1,boundingClientRect:i}}static getPoint(e,i,s){const l=i.boundingClientRect;return new o.P((s.clientX-l.left)/i.x-e.clientLeft,(s.clientY-l.top)/i.y-e.clientTop)}static mousePos(e,i){const s=ne.getScale(e);return ne.getPoint(e,s,i)}static touchPos(e,i){const s=[],l=ne.getScale(e);for(let h=0;h<i.length;h++)s.push(ne.getPoint(e,l,i[h]));return s}static mouseButton(e){return e.button}static remove(e){e.parentNode&&e.parentNode.removeChild(e)}static sanitize(e){const i=new DOMParser().parseFromString(e,"text/html").body||document.createElement("body"),s=i.querySelectorAll("script");for(const l of s)l.remove();return ne.clean(i),i.innerHTML}static isPossiblyDangerous(e,i){const s=i.replace(/\s+/g,"").toLowerCase();return!(!["src","href","xlink:href"].includes(e)||!s.includes("javascript:")&&!s.includes("data:"))||!!e.startsWith("on")||void 0}static clean(e){const i=e.children;for(const s of i)ne.removeAttributes(s),ne.clean(s)}static removeAttributes(e){for(const{name:i,value:s}of e.attributes)ne.isPossiblyDangerous(i,s)&&e.removeAttribute(i)}}ne.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,ne.selectProp=ne.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ne.transformProp=ne.testProp(["transform","WebkitTransform"]);const De={supported:!1,testSupport:function(u){!yt&&Rt&&(Dt?Jt(u):_t=u)}};let _t,Rt,yt=!1,Dt=!1;function Jt(u){const e=u.createTexture();u.bindTexture(u.TEXTURE_2D,e);try{if(u.texImage2D(u.TEXTURE_2D,0,u.RGBA,u.RGBA,u.UNSIGNED_BYTE,Rt),u.isContextLost())return;De.supported=!0}catch{}u.deleteTexture(e),yt=!0}var Xt;typeof document<"u"&&(Rt=document.createElement("img"),Rt.onload=()=>{_t&&Jt(_t),_t=null,Dt=!0},Rt.onerror=()=>{yt=!0,_t=null},Rt.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let e,i,s,l;u.resetRequestQueue=()=>{e=[],i=0,s=0,l={}},u.addThrottleControl=v=>{const T=s++;return l[T]=v,T},u.removeThrottleControl=v=>{delete l[v],f()},u.getImage=(v,T,P=!0)=>new Promise((E,k)=>{De.supported&&(v.headers||(v.headers={}),v.headers.accept="image/webp,*/*"),o.e(v,{type:"image"}),e.push({abortController:T,requestParameters:v,supportImageRefresh:P,state:"queued",onError:F=>{k(F)},onSuccess:F=>{E(F)}}),f()});const h=v=>o._(this,void 0,void 0,function*(){v.state="running";const{requestParameters:T,supportImageRefresh:P,onError:E,onSuccess:k,abortController:F}=v,O=P===!1&&!o.i(self)&&!o.g(T.url)&&(!T.headers||Object.keys(T.headers).reduce((W,K)=>W&&K==="accept",!0));i++;const H=O?_(T,F):o.m(T,F);try{const W=yield H;delete v.abortController,v.state="completed",W.data instanceof HTMLImageElement||o.b(W.data)?k(W):W.data&&k({data:yield(q=W.data,typeof createImageBitmap=="function"?o.f(q):o.h(q)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete v.abortController,E(W)}finally{i--,f()}var q}),f=()=>{const v=(()=>{for(const T of Object.keys(l))if(l[T]())return!0;return!1})()?o.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:o.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let T=i;T<v&&e.length>0;T++){const P=e.shift();P.abortController.signal.aborted?T--:h(P)}},_=(v,T)=>new Promise((P,E)=>{const k=new Image,F=v.url,O=v.credentials;O&&O==="include"?k.crossOrigin="use-credentials":(O&&O==="same-origin"||!o.d(F))&&(k.crossOrigin="anonymous"),T.signal.addEventListener("abort",()=>{k.src="",E(o.c())}),k.fetchPriority="high",k.onload=()=>{k.onerror=k.onload=null,P({data:k})},k.onerror=()=>{k.onerror=k.onload=null,T.signal.aborted||E(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."))},k.src=F})}(Xt||(Xt={})),Xt.resetRequestQueue();class Et{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Bt(u){const e=[];if(typeof u=="string")e.push({id:"default",url:u});else if(u&&u.length>0){const i=[];for(const{id:s,url:l}of u){const h=`${s}${l}`;i.indexOf(h)===-1&&(i.push(h),e.push({id:s,url:l}))}}return e}function Ri(u,e,i){try{const s=new URL(u);return s.pathname+=`${e}${i}`,s.toString()}catch{throw new Error(`Invalid sprite URL "${u}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class jt{constructor(e,i,s,l){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this.update(i,l)}update(e,i,s){const{width:l,height:h}=e,f=!(this.size&&this.size[0]===l&&this.size[1]===h||s),{context:_}=this,{gl:v}=_;if(this.useMipmap=!!(i&&i.useMipmap),v.bindTexture(v.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===v.RGBA&&(!i||i.premultiply!==!1)),f)this.size=[l,h],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||o.b(e)?v.texImage2D(v.TEXTURE_2D,0,this.format,this.format,v.UNSIGNED_BYTE,e):v.texImage2D(v.TEXTURE_2D,0,this.format,l,h,0,this.format,v.UNSIGNED_BYTE,e.data);else{const{x:T,y:P}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||o.b(e)?v.texSubImage2D(v.TEXTURE_2D,0,T,P,v.RGBA,v.UNSIGNED_BYTE,e):v.texSubImage2D(v.TEXTURE_2D,0,T,P,l,h,v.RGBA,v.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&v.generateMipmap(v.TEXTURE_2D),_.pixelStoreUnpackFlipY.setDefault(),_.pixelStoreUnpack.setDefault(),_.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(e,i,s){const{context:l}=this,{gl:h}=l;h.bindTexture(h.TEXTURE_2D,this.texture),s!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=h.LINEAR),e!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,e),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,s||e),this.filter=e),i!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,i),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function xr(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class cn extends o.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new o.R({width:1,height:1}),this.dirty=!0}isLoaded(){return this.loaded}setLoaded(e){if(this.loaded!==e&&(this.loaded=e,e)){for(const{ids:i,promiseResolve:s}of this.requestors)s(this._getImagesForIds(i));this.requestors=[]}}getImage(e){const i=this.images[e];if(i&&!i.data&&i.spriteData){const s=i.spriteData;i.data=new o.R({width:s.width,height:s.height},s.context.getImageData(s.x,s.y,s.width,s.height).data),i.spriteData=null}return i}addImage(e,i){if(this.images[e])throw new Error(`Image id ${e} already exist, use updateImage instead`);this._validate(e,i)&&(this.images[e]=i)}_validate(e,i){let s=!0;const l=i.data||i.spriteData;return this._validateStretch(i.stretchX,l&&l.width)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchX" value`))),s=!1),this._validateStretch(i.stretchY,l&&l.height)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "stretchY" value`))),s=!1),this._validateContent(i.content,i)||(this.fire(new o.k(new Error(`Image "${e}" has invalid "content" value`))),s=!1),s}_validateStretch(e,i){if(!e)return!0;let s=0;for(const l of e){if(l[0]<s||l[1]<l[0]||i<l[1])return!1;s=l[1]}return!0}_validateContent(e,i){if(!e)return!0;if(e.length!==4)return!1;const s=i.spriteData,l=s&&s.width||i.data.width,h=s&&s.height||i.data.height;return!(e[0]<0||l<e[0]||e[1]<0||h<e[1]||e[2]<0||l<e[2]||e[3]<0||h<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,i,s=!0){const l=this.getImage(e);if(s&&(l.data.width!==i.data.width||l.data.height!==i.data.height))throw new Error(`size mismatch between old image (${l.data.width}x${l.data.height}) and new image (${i.data.width}x${i.data.height}).`);i.version=l.version+1,this.images[e]=i,this.updatedImages[e]=!0}removeImage(e){const i=this.images[e];delete this.images[e],delete this.patterns[e],i.userImage&&i.userImage.onRemove&&i.userImage.onRemove()}listImages(){return Object.keys(this.images)}getImages(e){return new Promise((i,s)=>{let l=!0;if(!this.isLoaded())for(const h of e)this.images[h]||(l=!1);this.isLoaded()||l?i(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:i})})}_getImagesForIds(e){const i={};for(const s of e){let l=this.getImage(s);l||(this.fire(new o.l("styleimagemissing",{id:s})),l=this.getImage(s)),l?i[s]={data:l.data.clone(),pixelRatio:l.pixelRatio,sdf:l.sdf,version:l.version,stretchX:l.stretchX,stretchY:l.stretchY,content:l.content,textFitWidth:l.textFitWidth,textFitHeight:l.textFitHeight,hasRenderCallback:!!(l.userImage&&l.userImage.render)}:o.w(`Image "${s}" could not be loaded. Please make sure you have added the image with map.addImage() or a "sprite" property in your style. You can provide missing images by listening for the "styleimagemissing" map event.`)}return i}getPixelSize(){const{width:e,height:i}=this.atlasImage;return{width:e,height:i}}getPattern(e){const i=this.patterns[e],s=this.getImage(e);if(!s)return null;if(i&&i.position.version===s.version)return i.position;if(i)i.position.version=s.version;else{const l={w:s.data.width+2,h:s.data.height+2,x:0,y:0},h=new o.I(l,s);this.patterns[e]={bin:l,position:h}}return this._updatePatternAtlas(),this.patterns[e].position}bind(e){const i=e.gl;this.atlasTexture?this.dirty&&(this.atlasTexture.update(this.atlasImage),this.dirty=!1):this.atlasTexture=new jt(e,this.atlasImage,i.RGBA),this.atlasTexture.bind(i.LINEAR,i.CLAMP_TO_EDGE)}_updatePatternAtlas(){const e=[];for(const h in this.patterns)e.push(this.patterns[h].bin);const{w:i,h:s}=o.p(e),l=this.atlasImage;l.resize({width:i||1,height:s||1});for(const h in this.patterns){const{bin:f}=this.patterns[h],_=f.x+1,v=f.y+1,T=this.getImage(h).data,P=T.width,E=T.height;o.R.copy(T,l,{x:0,y:0},{x:_,y:v},{width:P,height:E}),o.R.copy(T,l,{x:0,y:E-1},{x:_,y:v-1},{width:P,height:1}),o.R.copy(T,l,{x:0,y:0},{x:_,y:v+E},{width:P,height:1}),o.R.copy(T,l,{x:P-1,y:0},{x:_-1,y:v},{width:1,height:E}),o.R.copy(T,l,{x:0,y:0},{x:_+P,y:v},{width:1,height:E})}this.dirty=!0}beginFrame(){this.callbackDispatchedThisFrame={}}dispatchRenderCallbacks(e){for(const i of e){if(this.callbackDispatchedThisFrame[i])continue;this.callbackDispatchedThisFrame[i]=!0;const s=this.getImage(i);s||o.w(`Image with ID: "${i}" was not found`),xr(s)&&this.updateImage(i,s)}}}const Vr=1e20;function mt(u,e,i,s,l,h,f,_,v){for(let T=e;T<e+s;T++)_i(u,i*h+T,h,l,f,_,v);for(let T=i;T<i+l;T++)_i(u,T*h+e,1,s,f,_,v)}function _i(u,e,i,s,l,h,f){h[0]=0,f[0]=-1e20,f[1]=Vr,l[0]=u[e];for(let _=1,v=0,T=0;_<s;_++){l[_]=u[e+_*i];const P=_*_;do{const E=h[v];T=(l[_]-l[E]+P-E*E)/(_-E)/2}while(T<=f[v]&&--v>-1);v++,h[v]=_,f[v]=T,f[v+1]=Vr}for(let _=0,v=0;_<s;_++){for(;f[v+1]<_;)v++;const T=h[v],P=_-T;u[e+_*i]=l[T]+P*P}}class li{constructor(e,i){this.requestManager=e,this.localIdeographFontFamily=i,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return o._(this,void 0,void 0,function*(){const i=[];for(const h in e)for(const f of e[h])i.push(this._getAndCacheGlyphsPromise(h,f));const s=yield Promise.all(i),l={};for(const{stack:h,id:f,glyph:_}of s)l[h]||(l[h]={}),l[h][f]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return l})}_getAndCacheGlyphsPromise(e,i){return o._(this,void 0,void 0,function*(){let s=this.entries[e];s||(s=this.entries[e]={glyphs:{},requests:{},ranges:{}});let l=s.glyphs[i];if(l!==void 0)return{stack:e,id:i,glyph:l};if(l=this._tinySDF(s,e,i),l)return s.glyphs[i]=l,{stack:e,id:i,glyph:l};const h=Math.floor(i/256);if(256*h>65535)throw new Error("glyphs > 65535 not supported");if(s.ranges[h])return{stack:e,id:i,glyph:l};if(!this.url)throw new Error("glyphsUrl is not set");if(!s.requests[h]){const _=li.loadGlyphRange(e,h,this.url,this.requestManager);s.requests[h]=_}const f=yield s.requests[h];for(const _ in f)this._doesCharSupportLocalGlyph(+_)||(s.glyphs[+_]=f[+_]);return s.ranges[h]=!0,{stack:e,id:i,glyph:f[i]||null}})}_doesCharSupportLocalGlyph(e){return!!this.localIdeographFontFamily&&(new RegExp("\\p{Ideo}|\\p{sc=Hang}|\\p{sc=Hira}|\\p{sc=Kana}","u").test(String.fromCodePoint(e))||o.u["CJK Unified Ideographs"](e)||o.u["Hangul Syllables"](e)||o.u.Hiragana(e)||o.u.Katakana(e)||o.u["CJK Symbols and Punctuation"](e)||o.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,s){const l=this.localIdeographFontFamily;if(!l||!this._doesCharSupportLocalGlyph(s))return;let h=e.tinySDF;if(!h){let _="400";/bold/i.test(i)?_="900":/medium/i.test(i)?_="500":/light/i.test(i)&&(_="200"),h=e.tinySDF=new li.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:l,fontWeight:_})}const f=h.draw(String.fromCharCode(s));return{id:s,bitmap:new o.q({width:f.width||60,height:f.height||60},f.data),metrics:{width:f.glyphWidth/2||24,height:f.glyphHeight/2||24,left:f.glyphLeft/2+.5||0,top:f.glyphTop/2-27.5||-8,advance:f.glyphAdvance/2||24,isDoubleResolution:!0}}}}li.loadGlyphRange=function(u,e,i,s){return o._(this,void 0,void 0,function*(){const l=256*e,h=l+255,f=s.transformRequest(i.replace("{fontstack}",u).replace("{range}",`${l}-${h}`),"Glyphs"),_=yield o.n(f,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${l}-${h}`);const v={};for(const T of o.o(_.data))v[T.id]=T;return v})},li.TinySDF=class{constructor({fontSize:u=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:l="sans-serif",fontWeight:h="normal",fontStyle:f="normal"}={}){this.buffer=e,this.cutoff=s,this.radius=i;const _=this.size=u+4*e,v=this._createCanvas(_),T=this.ctx=v.getContext("2d",{willReadFrequently:!0});T.font=`${f} ${h} ${u}px ${l}`,T.textBaseline="alphabetic",T.textAlign="left",T.fillStyle="black",this.gridOuter=new Float64Array(_*_),this.gridInner=new Float64Array(_*_),this.f=new Float64Array(_),this.z=new Float64Array(_+1),this.v=new Uint16Array(_)}_createCanvas(u){const e=document.createElement("canvas");return e.width=e.height=u,e}draw(u){const{width:e,actualBoundingBoxAscent:i,actualBoundingBoxDescent:s,actualBoundingBoxLeft:l,actualBoundingBoxRight:h}=this.ctx.measureText(u),f=Math.ceil(i),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-l))),v=Math.min(this.size-this.buffer,f+Math.ceil(s)),T=_+2*this.buffer,P=v+2*this.buffer,E=Math.max(T*P,0),k=new Uint8ClampedArray(E),F={data:k,width:T,height:P,glyphWidth:_,glyphHeight:v,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(_===0||v===0)return F;const{ctx:O,buffer:H,gridInner:q,gridOuter:W}=this;O.clearRect(H,H,_,v),O.fillText(u,H,H+f);const K=O.getImageData(H,H,_,v);W.fill(Vr,0,E),q.fill(0,0,E);for(let ee=0;ee<v;ee++)for(let te=0;te<_;te++){const re=K.data[4*(ee*_+te)+3]/255;if(re===0)continue;const oe=(ee+H)*T+te+H;if(re===1)W[oe]=0,q[oe]=Vr;else{const ae=.5-re;W[oe]=ae>0?ae*ae:0,q[oe]=ae<0?ae*ae:0}}mt(W,0,0,T,P,T,this.f,this.v,this.z),mt(q,H,H,_,v,T,this.f,this.v,this.z);for(let ee=0;ee<E;ee++){const te=Math.sqrt(W[ee])-Math.sqrt(q[ee]);k[ee]=Math.round(255-255*(te/this.radius+this.cutoff))}return F}};class Ni{constructor(){this.specification=o.v.light.position}possiblyEvaluate(e,i){return o.z(e.expression.evaluate(i))}interpolate(e,i,s){return{x:o.B.number(e.x,i.x,s),y:o.B.number(e.y,i.y,s),z:o.B.number(e.z,i.z,s)}}}let vr;class un extends o.E{constructor(e){super(),vr=vr||new o.r({anchor:new o.D(o.v.light.anchor),position:new Ni,color:new o.D(o.v.light.color),intensity:new o.D(o.v.light.intensity)}),this._transitionable=new o.T(vr),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(o.t,e,i))for(const s in e){const l=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),l):this._transitionable.setValue(s,l)}}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,s){return(!s||s.validate!==!1)&&o.x(this,e.call(o.y,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v}))}}const Ft=new o.r({"sky-color":new o.D(o.v.sky["sky-color"]),"horizon-color":new o.D(o.v.sky["horizon-color"]),"fog-color":new o.D(o.v.sky["fog-color"]),"fog-ground-blend":new o.D(o.v.sky["fog-ground-blend"]),"horizon-fog-blend":new o.D(o.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new o.D(o.v.sky["sky-horizon-blend"]),"atmosphere-blend":new o.D(o.v.sky["atmosphere-blend"])});class zr extends o.E{constructor(e){super(),this._transitionable=new o.T(Ft),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new o.C(0))}setSky(e,i={}){if(!this._validate(o.F,e,i)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const s in e){const l=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),l):this._transitionable.setValue(s,l)}}}getSky(){return this._transitionable.serialize()}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}_validate(e,i,s={}){return(s==null?void 0:s.validate)!==!1&&o.x(this,e.call(o.y,o.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class Ar{constructor(e,i){this.width=e,this.height=i,this.nextRow=0,this.data=new Uint8Array(this.width*this.height),this.dashEntry={}}getDash(e,i){const s=e.join(",")+String(i);return this.dashEntry[s]||(this.dashEntry[s]=this.addDash(e,i)),this.dashEntry[s]}getDashRanges(e,i,s){const l=[];let h=e.length%2==1?-e[e.length-1]*s:0,f=e[0]*s,_=!0;l.push({left:h,right:f,isDash:_,zeroLength:e[0]===0});let v=e[0];for(let T=1;T<e.length;T++){_=!_;const P=e[T];h=v*s,v+=P,f=v*s,l.push({left:h,right:f,isDash:_,zeroLength:P===0})}return l}addRoundDash(e,i,s){const l=i/2;for(let h=-s;h<=s;h++){const f=this.width*(this.nextRow+s+h);let _=0,v=e[_];for(let T=0;T<this.width;T++){T/v.right>1&&(v=e[++_]);const P=Math.abs(T-v.left),E=Math.abs(T-v.right),k=Math.min(P,E);let F;const O=h/s*(l+1);if(v.isDash){const H=l-Math.abs(O);F=Math.sqrt(k*k+H*H)}else F=l-Math.sqrt(k*k+O*O);this.data[f+T]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const v=e[_],T=e[_+1];v.zeroLength?e.splice(_,1):T&&T.isDash===v.isDash&&(T.left=v.left,e.splice(_,1))}const i=e[0],s=e[e.length-1];i.isDash===s.isDash&&(i.left=s.left-this.width,s.right=i.right+this.width);const l=this.width*this.nextRow;let h=0,f=e[h];for(let _=0;_<this.width;_++){_/f.right>1&&(f=e[++h]);const v=Math.abs(_-f.left),T=Math.abs(_-f.right),P=Math.min(v,T);this.data[l+_]=Math.max(0,Math.min(255,(f.isDash?P:-P)+128))}}addDash(e,i){const s=i?7:0,l=2*s+1;if(this.nextRow+l>this.height)return o.w("LineAtlas out of space"),null;let h=0;for(let _=0;_<e.length;_++)h+=e[_];if(h!==0){const _=this.width/h,v=this.getDashRanges(e,this.width,_);i?this.addRoundDash(v,_,s):this.addRegularDash(v)}const f={y:(this.nextRow+s+.5)/this.height,height:2*s/this.height,width:h};return this.nextRow+=l,this.dirty=!0,f}bind(e){const i=e.gl;this.texture?(i.bindTexture(i.TEXTURE_2D,this.texture),this.dirty&&(this.dirty=!1,i.texSubImage2D(i.TEXTURE_2D,0,0,0,this.width,this.height,i.ALPHA,i.UNSIGNED_BYTE,this.data))):(this.texture=i.createTexture(),i.bindTexture(i.TEXTURE_2D,this.texture),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_S,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_WRAP_T,i.REPEAT),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texImage2D(i.TEXTURE_2D,0,i.ALPHA,this.width,this.height,0,i.ALPHA,i.UNSIGNED_BYTE,this.data))}}const Hn="maplibre_preloaded_worker_pool";class yi{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<yi.workerCount;)this.workers.push(new Worker(o.a.WORKER_URL));return this.active[e]=!0,this.workers.slice()}release(e){delete this.active[e],this.numActive()===0&&(this.workers.forEach(i=>{i.terminate()}),this.workers=null)}isPreloaded(){return!!this.active[Hn]}numActive(){return Object.keys(this.active).length}}const Pn=Math.floor(ve.hardwareConcurrency/2);let ir,Ti;function hn(){return ir||(ir=new yi),ir}yi.workerCount=o.G(globalThis)?Math.max(Math.min(Pn,3),1):1;class hr{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const s=this.workerPool.acquire(i);for(let l=0;l<s.length;l++){const h=new o.H(s[l],i);h.name=`Worker ${l}`,this.actors.push(h)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i){const s=[];for(const l of this.actors)s.push(l.sendAsync({type:e,data:i}));return Promise.all(s)}getActor(){return this.currentActor=(this.currentActor+1)%this.actors.length,this.actors[this.currentActor]}remove(e=!0){this.actors.forEach(i=>{i.remove()}),this.actors=[],e&&this.workerPool.release(this.id)}registerMessageHandler(e,i){for(const s of this.actors)s.registerMessageHandler(e,i)}}function Wn(){return Ti||(Ti=new hr(hn(),o.J),Ti.registerMessageHandler("GR",(u,e,i)=>o.m(e,i))),Ti}function Cn(u,e){const i=o.K();return o.L(i,i,[1,1,0]),o.M(i,i,[.5*u.width,.5*u.height,1]),u.calculatePosMatrix?o.N(i,i,u.calculatePosMatrix(e.toUnwrapped())):i}function ga(u,e,i,s,l,h,f){var _;const v=function(k,F,O){if(k)for(const H of k){const q=F[H];if(q&&q.source===O&&q.type==="fill-extrusion")return!0}else for(const H in F){const q=F[H];if(q.source===O&&q.type==="fill-extrusion")return!0}return!1}((_=l==null?void 0:l.layers)!==null&&_!==void 0?_:null,e,u.id),T=h.maxPitchScaleFactor(),P=u.tilesIn(s,T,v);P.sort(dr);const E=[];for(const k of P)E.push({wrappedTileID:k.tileID.wrapped().key,queryResults:k.tile.queryRenderedFeatures(e,i,u._state,k.queryGeometry,k.cameraQueryGeometry,k.scale,l,h,T,Cn(u.transform,k.tileID),f?(F,O)=>f(k.tileID,F,O):void 0)});return function(k,F){for(const O in k)for(const H of k[O])Ki(H,F);return k}(function(k){const F={},O={};for(const H of k){const q=H.queryResults,W=H.wrappedTileID,K=O[W]=O[W]||{};for(const ee in q){const te=q[ee],re=K[ee]=K[ee]||{},oe=F[ee]=F[ee]||[];for(const ae of te)re[ae.featureIndex]||(re[ae.featureIndex]=!0,oe.push(ae))}}return F}(E),u)}function dr(u,e){const i=u.tileID,s=e.tileID;return i.overscaledZ-s.overscaledZ||i.canonical.y-s.canonical.y||i.wrap-s.wrap||i.canonical.x-s.canonical.x}function Ki(u,e){const i=u.feature,s=e.getFeatureState(i.layer["source-layer"],i.id);i.source=i.layer.source,i.layer["source-layer"]&&(i.sourceLayer=i.layer["source-layer"]),i.state=s}function Zi(u,e,i){return o._(this,void 0,void 0,function*(){let s=u;if(u.url?s=(yield o.j(e.transformRequest(u.url,"Source"),i)).data:yield ve.frameAsync(i),!s)return null;const l=o.O(o.e(s,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(l.vectorLayerIds=s.vector_layers.map(h=>h.id)),l})}class Wt{constructor(e,i){e&&(i?this.setSouthWest(e).setNorthEast(i):Array.isArray(e)&&(e.length===4?this.setSouthWest([e[0],e[1]]).setNorthEast([e[2],e[3]]):this.setSouthWest(e[0]).setNorthEast(e[1])))}setNorthEast(e){return this._ne=e instanceof o.Q?new o.Q(e.lng,e.lat):o.Q.convert(e),this}setSouthWest(e){return this._sw=e instanceof o.Q?new o.Q(e.lng,e.lat):o.Q.convert(e),this}extend(e){const i=this._sw,s=this._ne;let l,h;if(e instanceof o.Q)l=e,h=e;else{if(!(e instanceof Wt))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Wt.convert(e)):this.extend(o.Q.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(o.Q.convert(e)):this;if(l=e._sw,h=e._ne,!l||!h)return this}return i||s?(i.lng=Math.min(l.lng,i.lng),i.lat=Math.min(l.lat,i.lat),s.lng=Math.max(h.lng,s.lng),s.lat=Math.max(h.lat,s.lat)):(this._sw=new o.Q(l.lng,l.lat),this._ne=new o.Q(h.lng,h.lat)),this}getCenter(){return new o.Q((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new o.Q(this.getWest(),this.getNorth())}getSouthEast(){return new o.Q(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:s}=o.Q.convert(e);let l=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(l=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&l}static convert(e){return e instanceof Wt?e:e&&new Wt(e)}static fromLngLat(e,i=0){const s=360*i/40075017,l=s/Math.cos(Math.PI/180*e.lat);return new Wt(new o.Q(e.lng-l,e.lat-s),new o.Q(e.lng+l,e.lat+s))}adjustAntiMeridian(){const e=new o.Q(this._sw.lng,this._sw.lat),i=new o.Q(this._ne.lng,this._ne.lat);return new Wt(e,e.lng>i.lng?new o.Q(i.lng+360,i.lat):i)}}class rr{constructor(e,i,s){this.bounds=Wt.convert(this.validateBounds(e)),this.minzoom=i||0,this.maxzoom=s||24}validateBounds(e){return Array.isArray(e)&&e.length===4?[Math.max(-180,e[0]),Math.max(-90,e[1]),Math.min(180,e[2]),Math.min(90,e[3])]:[-180,-90,180,90]}contains(e){const i=Math.pow(2,e.z),s=Math.floor(o.U(this.bounds.getWest())*i),l=Math.floor(o.S(this.bounds.getNorth())*i),h=Math.ceil(o.U(this.bounds.getEast())*i),f=Math.ceil(o.S(this.bounds.getSouth())*i);return e.x>=s&&e.x<h&&e.y>=l&&e.y<f}}class br extends o.E{constructor(e,i,s,l){if(super(),this.id=e,this.dispatcher=s,this.type="vector",this.minzoom=0,this.maxzoom=22,this.scheme="xyz",this.tileSize=512,this.reparseOverscaled=!0,this.isTileClipped=!0,this._loaded=!1,o.e(this,o.O(i,["url","scheme","tileSize","promoteId"])),this._options=o.e({type:"vector"},i),this._collectResourceTiming=i.collectResourceTiming,this.tileSize!==512)throw new Error("vector tile sources must have a tileSize of 512");this.setEventedParent(l)}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield Zi(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(o.e(this,e),e.bounds&&(this.tileBounds=new rr(e.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new o.k(e))}})}loaded(){return this._loaded}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}onAdd(e){this.map=e,this.load()}setSourceProperty(e){this._tileJSONRequest&&this._tileJSONRequest.abort(),e(),this.load()}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}serialize(){return o.e({},this._options)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(i,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};s.request.collectResourceTiming=this._collectResourceTiming;let l="RT";if(e.actor&&e.state!=="expired"){if(e.state==="loading")return new Promise((h,f)=>{e.reloadPromise={resolve:h,reject:f}})}else e.actor=this.dispatcher.getActor(),l="LT";e.abortController=new AbortController;try{const h=yield e.actor.sendAsync({type:l,data:s},e.abortController);if(delete e.abortController,e.aborted)return;this._afterTileLoadWorkerResponse(e,h)}catch(h){if(delete e.abortController,e.aborted)return;if(h&&h.status!==404)throw h;this._afterTileLoadWorkerResponse(e,null)}})}_afterTileLoadWorkerResponse(e,i){if(i&&i.resourceTiming&&(e.resourceTiming=i.resourceTiming),i&&this.map._refreshExpiredTiles&&e.setExpiryData(i),e.loadVectorData(i,this.map.painter),e.reloadPromise){const s=e.reloadPromise;e.reloadPromise=null,this.loadTile(e).then(s.resolve).catch(s.reject)}}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.actor&&(yield e.actor.sendAsync({type:"AT",data:{uid:e.uid,type:this.type,source:this.id}}))})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.unloadVectorData(),e.actor&&(yield e.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}}))})}hasTransition(){return!1}}class Vi extends o.E{constructor(e,i,s,l){super(),this.id=e,this.dispatcher=s,this.setEventedParent(l),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=o.e({type:"raster"},i),o.e(this,o.O(i,["url","scheme","tileSize"]))}load(){return o._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield Zi(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(o.e(this,i),i.bounds&&(this.tileBounds=new rr(i.bounds,this.minzoom,this.maxzoom)),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new o.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(i){this._tileJSONRequest=null,this.fire(new o.k(i))}})}loaded(){return this._loaded}onAdd(e){this.map=e,this.load()}onRemove(){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null)}setSourceProperty(e){this._tileJSONRequest&&(this._tileJSONRequest.abort(),this._tileJSONRequest=null),e(),this.load(!0)}setTiles(e){return this.setSourceProperty(()=>{this._options.tiles=e}),this}setUrl(e){return this.setSourceProperty(()=>{this.url=e,this._options.url=e}),this}serialize(){return o.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme);e.abortController=new AbortController;try{const s=yield Xt.getImage(this.map._requestManager.transformRequest(i,"Tile"),e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(s&&s.data){this.map._refreshExpiredTiles&&s.cacheControl&&s.expires&&e.setExpiryData({cacheControl:s.cacheControl,expires:s.expires});const l=this.map.painter.context,h=l.gl,f=s.data;e.texture=this.map.painter.getTileTexture(f.width),e.texture?e.texture.update(f,{useMipmap:!0}):(e.texture=new jt(l,f,h.RGBA,{useMipmap:!0}),e.texture.bind(h.LINEAR,h.CLAMP_TO_EDGE,h.LINEAR_MIPMAP_NEAREST)),e.state="loaded"}}catch(s){if(delete e.abortController,e.aborted)e.state="unloaded";else if(s)throw e.state="errored",s}})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class Xr extends Vi{constructor(e,i,s,l){super(e,i,s,l),this.type="raster-dem",this.maxzoom=22,this._options=o.e({type:"raster-dem"},i),this.encoding=i.encoding||"mapbox",this.redFactor=i.redFactor,this.greenFactor=i.greenFactor,this.blueFactor=i.blueFactor,this.baseShift=i.baseShift}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s=this.map._requestManager.transformRequest(i,"Tile");e.neighboringTiles=this._getNeighboringTiles(e.tileID),e.abortController=new AbortController;try{const l=yield Xt.getImage(s,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(l&&l.data){const h=l.data;this.map._refreshExpiredTiles&&l.cacheControl&&l.expires&&e.setExpiryData({cacheControl:l.cacheControl,expires:l.expires});const f=o.b(h)&&o.V()?h:yield this.readImageNow(h),_={type:this.type,uid:e.uid,source:this.id,rawImageData:f,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const v=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=v,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(l){if(delete e.abortController,e.aborted)e.state="unloaded";else if(l)throw e.state="errored",l}})}readImageNow(e){return o._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&o.W()){const i=e.width+2,s=e.height+2;try{return new o.R({width:i,height:s},yield o.X(e,-1,-1,i,s))}catch{}}return ve.getImageData(e,1)})}_getNeighboringTiles(e){const i=e.canonical,s=Math.pow(2,i.z),l=(i.x-1+s)%s,h=i.x===0?e.wrap-1:e.wrap,f=(i.x+1+s)%s,_=i.x+1===s?e.wrap+1:e.wrap,v={};return v[new o.Y(e.overscaledZ,h,i.z,l,i.y).key]={backfilled:!1},v[new o.Y(e.overscaledZ,_,i.z,f,i.y).key]={backfilled:!1},i.y>0&&(v[new o.Y(e.overscaledZ,h,i.z,l,i.y-1).key]={backfilled:!1},v[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},v[new o.Y(e.overscaledZ,_,i.z,f,i.y-1).key]={backfilled:!1}),i.y+1<s&&(v[new o.Y(e.overscaledZ,h,i.z,l,i.y+1).key]={backfilled:!1},v[new o.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},v[new o.Y(e.overscaledZ,_,i.z,f,i.y+1).key]={backfilled:!1}),v}unloadTile(e){return o._(this,void 0,void 0,function*(){e.demTexture&&this.map.painter.saveTileTexture(e.demTexture),e.fbo&&(e.fbo.destroy(),delete e.fbo),e.dem&&delete e.dem,delete e.neighboringTiles,e.state="unloaded",e.actor&&(yield e.actor.sendAsync({type:"RDT",data:{type:this.type,uid:e.uid,source:this.id}}))})}}class Kr extends o.E{constructor(e,i,s,l){super(),this.id=e,this.type="geojson",this.minzoom=0,this.maxzoom=18,this.tileSize=512,this.isTileClipped=!0,this.reparseOverscaled=!0,this._removed=!1,this._pendingLoads=0,this.actor=s.getActor(),this.setEventedParent(l),this._data=i.data,this._options=o.e({},i),this._collectResourceTiming=i.collectResourceTiming,i.maxzoom!==void 0&&(this.maxzoom=i.maxzoom),i.type&&(this.type=i.type),i.attribution&&(this.attribution=i.attribution),this.promoteId=i.promoteId,i.clusterMaxZoom!==void 0&&this.maxzoom<=i.clusterMaxZoom&&o.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=o.e({source:this.id,cluster:i.cluster||!1,geojsonVtOptions:{buffer:this._pixelsToTileUnits(i.buffer!==void 0?i.buffer:128),tolerance:this._pixelsToTileUnits(i.tolerance!==void 0?i.tolerance:.375),extent:o.Z,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:i.clusterMaxZoom!==void 0?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:o.Z,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(o.Z/this.tileSize)}load(){return o._(this,void 0,void 0,function*(){yield this._updateWorkerData()})}onAdd(e){this.map=e,this.load()}setData(e){return this._data=e,this._updateWorkerData(),this}updateData(e){return this._updateWorkerData(e),this}getData(){return o._(this,void 0,void 0,function*(){const e=o.e({type:this.type},this.workerOptions);return this.actor.sendAsync({type:"GD",data:e})})}getCoordinatesFromGeometry(e){return e.type==="GeometryCollection"?e.geometries.map(i=>i.coordinates).flat(1/0):e.coordinates.flat(1/0)}getBounds(){return o._(this,void 0,void 0,function*(){const e=new Wt,i=yield this.getData();let s;switch(i.type){case"FeatureCollection":s=i.features.map(l=>this.getCoordinatesFromGeometry(l.geometry)).flat(1/0);break;case"Feature":s=this.getCoordinatesFromGeometry(i.geometry);break;default:s=this.getCoordinatesFromGeometry(i)}if(s.length==0)return e;for(let l=0;l<s.length-1;l+=2)e.extend([s[l],s[l+1]]);return e})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,i,s){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:i,offset:s}})}_updateWorkerData(e){return o._(this,void 0,void 0,function*(){const i=o.e({type:this.type},this.workerOptions);e?i.dataDiff=e:typeof this._data=="string"?(i.request=this.map._requestManager.transformRequest(ve.resolveURL(this._data),"Source"),i.request.collectResourceTiming=this._collectResourceTiming):i.data=JSON.stringify(this._data),this._pendingLoads++,this.fire(new o.l("dataloading",{dataType:"source"}));try{const s=yield this.actor.sendAsync({type:"LD",data:i});if(this._pendingLoads--,this._removed||s.abandoned)return void this.fire(new o.l("dataabort",{dataType:"source"}));let l=null;s.resourceTiming&&s.resourceTiming[this.id]&&(l=s.resourceTiming[this.id].slice(0));const h={dataType:"source"};this._collectResourceTiming&&l&&l.length>0&&o.e(h,{resourceTiming:l}),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new o.l("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(s){if(this._pendingLoads--,this._removed)return void this.fire(new o.l("dataabort",{dataType:"source"}));this.fire(new o.k(s))}})}loaded(){return this._pendingLoads===0}loadTile(e){return o._(this,void 0,void 0,function*(){const i=e.actor?"RT":"LT";e.actor=this.actor;const s={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const l=yield this.actor.sendAsync({type:i,data:s},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(l,this.map.painter,i==="RT")})}abortTile(e){return o._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return o._(this,void 0,void 0,function*(){e.unloadVectorData(),yield this.actor.sendAsync({type:"RMT",data:{uid:e.uid,type:this.type,source:this.id}})})}onRemove(){this._removed=!0,this.actor.sendAsync({type:"RS",data:{type:this.type,source:this.id}})}serialize(){return o.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class Di extends o.E{constructor(e,i,s,l){super(),this.flippedWindingOrder=!1,this.id=e,this.dispatcher=s,this.coordinates=i.coordinates,this.type="image",this.minzoom=0,this.maxzoom=22,this.tileSize=512,this.tiles={},this._loaded=!1,this.setEventedParent(l),this.options=i}load(e){return o._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new o.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const i=yield Xt.getImage(this.map._requestManager.transformRequest(this.url,"Image"),this._request);this._request=null,this._loaded=!0,i&&i.data&&(this.image=i.data,e&&(this.coordinates=e),this._finishLoading())}catch(i){this._request=null,this._loaded=!0,this.fire(new o.k(i))}})}loaded(){return this._loaded}updateImage(e){return e.url?(this._request&&(this._request.abort(),this._request=null),this.options.url=e.url,this.load(e.coordinates).finally(()=>{this.texture=null}),this):this}_finishLoading(){this.map&&(this.setCoordinates(this.coordinates),this.fire(new o.l("data",{dataType:"source",sourceDataType:"metadata"})))}onAdd(e){this.map=e,this.load()}onRemove(){this._request&&(this._request.abort(),this._request=null)}setCoordinates(e){this.coordinates=e;const i=e.map(o.$.fromLngLat);var s;return this.tileID=function(l){let h=1/0,f=1/0,_=-1/0,v=-1/0;for(const k of l)h=Math.min(h,k.x),f=Math.min(f,k.y),_=Math.max(_,k.x),v=Math.max(v,k.y);const T=Math.max(_-h,v-f),P=Math.max(0,Math.floor(-Math.log(T)/Math.LN2)),E=Math.pow(2,P);return new o.a1(P,Math.floor((h+_)/2*E),Math.floor((f+v)/2*E))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map(l=>this.tileID.getTilePoint(l)._round()),this.flippedWindingOrder=((s=this.tileCoords)[1].x-s[0].x)*(s[2].y-s[0].y)-(s[1].y-s[0].y)*(s[2].x-s[0].x)<0,this.fire(new o.l("data",{dataType:"source",sourceDataType:"content"})),this}prepare(){if(Object.keys(this.tiles).length===0||!this.image)return;const e=this.map.painter.context,i=e.gl;this.texture||(this.texture=new jt(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return o._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let i=1/0,s=1/0,l=-1/0,h=-1/0;for(const _ of e)i=Math.min(i,_.x),s=Math.min(s,_.y),l=Math.max(l,_.x),h=Math.max(h,_.y);const f={};for(let _=0;_<=o.a0;_++){const v=Math.pow(2,_),T=Math.floor(i*v),P=Math.floor(s*v),E=Math.floor(l*v),k=Math.floor(h*v);f[_]={minTileX:T,minTileY:P,maxTileX:E,maxTileY:k}}return f}}class nr extends Di{constructor(e,i,s,l){super(e,i,s,l),this.roundZoom=!0,this.type="video",this.options=i}load(){return o._(this,void 0,void 0,function*(){this._loaded=!1;const e=this.options;this.urls=[];for(const i of e.urls)this.urls.push(this.map._requestManager.transformRequest(i,"Source").url);try{const i=yield o.a2(this.urls);if(this._loaded=!0,!i)return;this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(i){this.fire(new o.k(i))}})}pause(){this.video&&this.video.pause()}play(){this.video&&this.video.play()}seek(e){if(this.video){const i=this.video.seekable;e<i.start(0)||e>i.end(0)?this.fire(new o.k(new o.a3(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new jt(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const l in this.tiles){const h=this.tiles[l];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"video",urls:this.urls,coordinates:this.coordinates}}hasTransition(){return this.video&&!this.video.paused}}class Ze extends Di{constructor(e,i,s,l){super(e,i,s,l),i.coordinates?Array.isArray(i.coordinates)&&i.coordinates.length===4&&!i.coordinates.some(h=>!Array.isArray(h)||h.length!==2||h.some(f=>typeof f!="number"))||this.fire(new o.k(new o.a3(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.k(new o.a3(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new o.k(new o.a3(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?typeof i.canvas=="string"||i.canvas instanceof HTMLCanvasElement||this.fire(new o.k(new o.a3(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new o.k(new o.a3(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=i.animate===void 0||i.animate}load(){return o._(this,void 0,void 0,function*(){this._loaded=!0,this.canvas||(this.canvas=this.options.canvas instanceof HTMLCanvasElement?this.options.canvas:document.getElementById(this.options.canvas)),this.width=this.canvas.width,this.height=this.canvas.height,this._hasInvalidDimensions()?this.fire(new o.k(new Error("Canvas dimensions cannot be less than or equal to zero."))):(this.play=function(){this._playing=!0,this.map.triggerRepaint()},this.pause=function(){this._playing&&(this.prepare(),this._playing=!1)},this._finishLoading())})}getCanvas(){return this.canvas}onAdd(e){this.map=e,this.load(),this.canvas&&this.animate&&this.play()}onRemove(){this.pause()}prepare(){let e=!1;if(this.canvas.width!==this.width&&(this.width=this.canvas.width,e=!0),this.canvas.height!==this.height&&(this.height=this.canvas.height,e=!0),this._hasInvalidDimensions()||Object.keys(this.tiles).length===0)return;const i=this.map.painter.context,s=i.gl;this.texture?(e||this._playing)&&this.texture.update(this.canvas,{premultiply:!0}):this.texture=new jt(i,this.canvas,s.RGBA,{premultiply:!0});let l=!1;for(const h in this.tiles){const f=this.tiles[h];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,l=!0)}l&&this.fire(new o.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}serialize(){return{type:"canvas",coordinates:this.coordinates}}hasTransition(){return this._playing}_hasInvalidDimensions(){for(const e of[this.canvas.width,this.canvas.height])if(isNaN(e)||e<=0)return!0;return!1}}const Xe={},bt=u=>{switch(u){case"geojson":return Kr;case"image":return Di;case"raster":return Vi;case"raster-dem":return Xr;case"vector":return br;case"video":return nr;case"canvas":return Ze}return Xe[u]},Kt="RTLPluginLoaded";class fi extends o.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Wn()}_syncState(e){return this.status=e,this.dispatcher.broadcast("SRPS",{pluginStatus:e,pluginURL:this.url}).catch(i=>{throw this.status="error",i})}getRTLTextPluginStatus(){return this.status}clearRTLTextPlugin(){this.status="unavailable",this.url=null}setRTLTextPlugin(e){return o._(this,arguments,void 0,function*(i,s=!1){if(this.url)throw new Error("setRTLTextPlugin cannot be called multiple times.");if(this.url=ve.resolveURL(i),!this.url)throw new Error(`requested url ${i} is invalid`);if(this.status==="unavailable"){if(!s)return this._requestImport();this.status="deferred",this._syncState(this.status)}else if(this.status==="requested")return this._requestImport()})}_requestImport(){return o._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new o.l(Kt))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let kt=null;function ut(){return kt||(kt=new fi),kt}class Gt{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=o.a4(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const i=e+this.timeAdded;i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(l,h){const f={};if(!h)return f;for(const _ of l){const v=_.layerIds.map(T=>h.getLayer(T)).filter(Boolean);if(v.length!==0){_.layers=v,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(T=>v.filter(P=>P.id===T)[0]));for(const T of v)f[T.id]=_}}return f}(e.buckets,i==null?void 0:i.style),this.hasSymbolBuckets=!1;for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a6){if(this.hasSymbolBuckets=!0,!s)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const l in this.buckets){const h=this.buckets[l];if(h instanceof o.a6&&h.hasRTLText){this.hasRTLText=!0,ut().lazyLoad();break}}this.queryPadding=0;for(const l in this.buckets){const h=this.buckets[l];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(l).queryRadius(h))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new o.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const s in this.buckets){const l=this.buckets[s];l.uploadPending()&&l.upload(e)}const i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new jt(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new jt(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,i,s,l,h,f,_,v,T,P,E){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:h,scale:f,tileSize:this.tileSize,pixelPosMatrix:P,transform:v,params:_,queryPadding:this.queryPadding*T,getElevation:E},e,i,s):{}}querySourceFeatures(e,i){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const l=s.loadVTLayers(),h=i&&i.sourceLayer?i.sourceLayer:"",f=l._geojsonTileLayer||l[h];if(!f)return;const _=o.a7(i&&i.filter),{z:v,x:T,y:P}=this.tileID.canonical,E={z:v,x:T,y:P};for(let k=0;k<f.length;k++){const F=f.feature(k);if(_.needGeometry){const q=o.a8(F,!0);if(!_.filter(new o.C(this.tileID.overscaledZ),q,this.tileID.canonical))continue}else if(!_.filter(new o.C(this.tileID.overscaledZ),F))continue;const O=s.getId(F,h),H=new o.a9(F,v,T,P,O);H.tile=E,e.push(H)}}hasData(){return this.state==="loaded"||this.state==="reloading"||this.state==="expired"}patternsLoaded(){return this.imageAtlas&&!!Object.keys(this.imageAtlas.patternPositions).length}setExpiryData(e){const i=this.expirationTime;if(e.cacheControl){const s=o.aa(e.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const s=Date.now();let l=!1;if(this.expirationTime>s)l=!1;else if(i)if(this.expirationTime<i)l=!0;else{const h=this.expirationTime-i;h?this.expirationTime=s+Math.max(h,3e4):l=!0}else l=!0;l?(this.expiredRequestCount++,this.state="expired"):this.expiredRequestCount=0}}getExpiryTimeout(){if(this.expirationTime)return this.expiredRequestCount?1e3*(1<<Math.min(this.expiredRequestCount-1,31)):Math.min(this.expirationTime-new Date().getTime(),Math.pow(2,31)-1)}setFeatureState(e,i){if(!this.latestFeatureIndex||!this.latestFeatureIndex.rawTileData||Object.keys(e).length===0)return;const s=this.latestFeatureIndex.loadVTLayers();for(const l in this.buckets){if(!i.style.hasLayer(l))continue;const h=this.buckets[l],f=h.layers[0].sourceLayer||"_geojsonTileLayer",_=s[f],v=e[f];if(!_||!v||Object.keys(v).length===0)continue;h.update(v,_,this.imageAtlas&&this.imageAtlas.patternPositions||{});const T=i&&i.style&&i.style.getLayer(l);T&&(this.queryPadding=Math.max(this.queryPadding,T.queryRadius(h)))}}holdingForFade(){return this.symbolFadeHoldUntil!==void 0}symbolFadeFinished(){return!this.symbolFadeHoldUntil||this.symbolFadeHoldUntil<ve.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=ve.now()+e}setDependencies(e,i){const s={};for(const l of i)s[l]=!0;this.dependencies[e]=s}hasDependency(e,i){for(const s of e){const l=this.dependencies[s];if(l){for(const h of i)if(l[h])return!0}}return!1}}class qt{constructor(e,i){this.max=e,this.onRemove=i,this.reset()}reset(){for(const e in this.data)for(const i of this.data[e])i.timeout&&clearTimeout(i.timeout),this.onRemove(i.value);return this.data={},this.order=[],this}add(e,i,s){const l=e.wrapped().key;this.data[l]===void 0&&(this.data[l]=[]);const h={value:i,timeout:void 0};if(s!==void 0&&(h.timeout=setTimeout(()=>{this.remove(e,h)},s)),this.data[l].push(h),this.order.push(l),this.order.length>this.max){const f=this._getAndRemoveByKey(this.order[0]);f&&this.onRemove(f)}return this}has(e){return e.wrapped().key in this.data}getAndRemove(e){return this.has(e)?this._getAndRemoveByKey(e.wrapped().key):null}_getAndRemoveByKey(e){const i=this.data[e].shift();return i.timeout&&clearTimeout(i.timeout),this.data[e].length===0&&delete this.data[e],this.order.splice(this.order.indexOf(e),1),i.value}getByKey(e){const i=this.data[e];return i?i[0].value:null}get(e){return this.has(e)?this.data[e.wrapped().key][0].value:null}remove(e,i){if(!this.has(e))return this;const s=e.wrapped().key,l=i===void 0?0:this.data[s].indexOf(i),h=this.data[s][l];return this.data[s].splice(l,1),h.timeout&&clearTimeout(h.timeout),this.data[s].length===0&&delete this.data[s],this.onRemove(h.value),this.order.splice(this.order.indexOf(s),1),this}setMaxSize(e){for(this.max=e;this.order.length>this.max;){const i=this._getAndRemoveByKey(this.order[0]);i&&this.onRemove(i)}return this}filter(e){const i=[];for(const s in this.data)for(const l of this.data[s])e(l.value)||i.push(l);for(const s of i)this.remove(s.value.tileID,s)}}class Li{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,s){const l=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][l]=this.stateChanges[e][l]||{},o.e(this.stateChanges[e][l],s),this.deletedStates[e]===null){this.deletedStates[e]={};for(const h in this.state[e])h!==l&&(this.deletedStates[e][h]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][l]===null){this.deletedStates[e][l]={};for(const h in this.state[e][l])s[h]||(this.deletedStates[e][l][h]=null)}else for(const h in s)this.deletedStates[e]&&this.deletedStates[e][l]&&this.deletedStates[e][l][h]===null&&delete this.deletedStates[e][l][h]}removeFeatureState(e,i,s){if(this.deletedStates[e]===null)return;const l=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},s&&i!==void 0)this.deletedStates[e][l]!==null&&(this.deletedStates[e][l]=this.deletedStates[e][l]||{},this.deletedStates[e][l][s]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][l])for(s in this.deletedStates[e][l]={},this.stateChanges[e][l])this.deletedStates[e][l][s]=null;else this.deletedStates[e][l]=null;else this.deletedStates[e]=null}getState(e,i){const s=String(i),l=o.e({},(this.state[e]||{})[s],(this.stateChanges[e]||{})[s]);if(this.deletedStates[e]===null)return{};if(this.deletedStates[e]){const h=this.deletedStates[e][i];if(h===null)return{};for(const f in h)delete l[f]}return l}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const s={};for(const l in this.stateChanges){this.state[l]=this.state[l]||{};const h={};for(const f in this.stateChanges[l])this.state[l][f]||(this.state[l][f]={}),o.e(this.state[l][f],this.stateChanges[l][f]),h[f]=this.state[l][f];s[l]=h}for(const l in this.deletedStates){this.state[l]=this.state[l]||{};const h={};if(this.deletedStates[l]===null)for(const f in this.state[l])h[f]={},this.state[l][f]={};else for(const f in this.deletedStates[l]){if(this.deletedStates[l][f]===null)this.state[l][f]={};else for(const _ of Object.keys(this.deletedStates[l][f]))delete this.state[l][f][_];h[f]=this.state[l][f]}s[l]=s[l]||{},o.e(s[l],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const l in e)e[l].setFeatureState(s,i)}}const Yt=89.25;function Mi(u,e){const i=o.ae(e.lat,-85.051129,o.af);return new o.P(o.U(e.lng)*u,o.S(i)*u)}function pr(u,e){return new o.$(e.x/u,e.y/u).toLngLat()}function ue(u){return u.cameraToCenterDistance*Math.min(.85*Math.tan(o.ab(90-u.pitch)),Math.tan(o.ab(Yt-u.pitch)))}function N(u,e){const i=u.canonical,s=e/o.ac(i.z),l=i.x+Math.pow(2,i.z)*u.wrap,h=o.ad(new Float64Array(16));return o.L(h,h,[l*s,i.y*s,0]),o.M(h,h,[s/o.Z,s/o.Z,1]),h}function Z(u,e,i,s,l){const h=o.$.fromLngLat(u,e),f=l*o.ag(1,u.lat),_=f*Math.cos(o.ab(i)),v=Math.sqrt(f*f-_*_),T=v*Math.sin(o.ab(-s)),P=v*Math.cos(o.ab(-s));return new o.$(h.x+T,h.y+P,h.z+_)}function G(u,e,i){const s=e.intersectsFrustum(u);if(!i)return s;const l=e.intersectsPlane(i);return s===0||l===0?0:s===2&&l===2?2:1}function J(u,e,i){let s=0;const l=(i-e)/10;for(let h=0;h<10;h++)s+=l*Math.pow(Math.cos(e+(h+.5)/10*(i-e)),u);return s}function V(u,e){return function(i,s,l,h,f){const _=2*((u-1)/o.ah(Math.cos(o.ab(Yt-f))/Math.cos(o.ab(Yt)))-1),v=Math.acos(l/h),T=2*J(_-1,0,o.ab(f/2)),P=Math.min(o.ab(Yt),v+o.ab(f/2)),E=J(_-1,Math.min(P,v-o.ab(f/2)),P),k=Math.atan(s/l),F=Math.hypot(s,l);let O=i;return O+=o.ah(h/F/Math.max(.5,Math.cos(o.ab(f/2)))),O+=_*o.ah(Math.cos(k))/2,O-=o.ah(Math.max(1,E/T/e))/2,O}}const ce=V(9.314,3);function ge(u,e){const i=(e.roundZoom?Math.round:Math.floor)(u.zoom+o.ah(u.tileSize/e.tileSize));return Math.max(0,i)}function ie(u,e){const i=u.getCameraFrustum(),s=u.getClippingPlane(),l=u.screenPointToMercatorCoordinate(u.getCameraPoint()),h=o.$.fromLngLat(u.center,u.elevation);l.z=h.z+Math.cos(u.pitchInRadians)*u.cameraToCenterDistance/u.worldSize;const f=u.getCoveringTilesDetailsProvider(),_=f.allowVariableZoom(u,e),v=ge(u,e),T=e.minzoom||0,P=e.maxzoom!==void 0?e.maxzoom:u.maxZoom,E=Math.min(Math.max(0,v),P),k=Math.pow(2,E),F=[k*l.x,k*l.y,0],O=[k*h.x,k*h.y,0],H=Math.hypot(h.x-l.x,h.y-l.y),q=Math.abs(h.z-l.z),W=Math.hypot(H,q),K=re=>({zoom:0,x:0,y:0,wrap:re,fullyVisible:!1}),ee=[],te=[];if(u.renderWorldCopies&&f.allowWorldCopies())for(let re=1;re<=3;re++)ee.push(K(-re)),ee.push(K(re));for(ee.push(K(0));ee.length>0;){const re=ee.pop(),oe=re.x,ae=re.y;let pe=re.fullyVisible;const me={x:oe,y:ae,z:re.zoom},Se=f.getTileAABB(me,re.wrap,u.elevation,e);if(!pe){const Be=G(i,Se,s);if(Be===0)continue;pe=Be===2}const Ce=f.distanceToTile2d(l.x,l.y,me,Se);let Te=v;_&&(Te=(e.calculateTileZoom||ce)(u.zoom+o.ah(u.tileSize/e.tileSize),Ce,q,W,u.fov)),Te=(e.roundZoom?Math.round:Math.floor)(Te),Te=Math.max(0,Te);const je=Math.min(Te,P);if(re.wrap=f.getWrap(h,me,re.wrap),re.zoom>=je){if(re.zoom<T)continue;const Be=E-re.zoom,Ee=F[0]-.5-(oe<<Be),He=F[1]-.5-(ae<<Be),ft=e.reparseOverscaled?Math.max(re.zoom,Te):re.zoom;te.push({tileID:new o.Y(re.zoom===P?ft:re.zoom,re.wrap,re.zoom,oe,ae),distanceSq:o.ai([O[0]-.5-oe,O[1]-.5-ae]),tileDistanceToCamera:Math.sqrt(Ee*Ee+He*He)})}else for(let Be=0;Be<4;Be++)ee.push({zoom:re.zoom+1,x:(oe<<1)+Be%2,y:(ae<<1)+(Be>>1),wrap:re.wrap,fullyVisible:pe})}return te.sort((re,oe)=>re.distanceSq-oe.distanceSq).map(re=>re.tileID)}class ye extends o.E{constructor(e,i,s){super(),this.id=e,this.dispatcher=s,this.on("data",l=>this._dataHandler(l)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((l,h,f,_)=>{const v=new(bt(h.type))(l,h,f,_);if(v.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${v.id}`);return v})(e,i,s,this),this._tiles={},this._cache=new qt(0,l=>this._unloadTile(l)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Li,this._didEmitContent=!1,this._updated=!1}onAdd(e){this.map=e,this._maxTileCacheSize=e?e._maxTileCacheSize:null,this._maxTileCacheZoomLevels=e?e._maxTileCacheZoomLevels:null,this._source&&this._source.onAdd&&this._source.onAdd(e)}onRemove(e){this.clearTiles(),this._source&&this._source.onRemove&&this._source.onRemove(e)}loaded(){if(this._sourceErrored)return!0;if(!this._sourceLoaded||!this._source.loaded())return!1;if(!(this.used===void 0&&this.usedForTerrain===void 0||this.used||this.usedForTerrain))return!0;if(!this._updated)return!1;for(const e in this._tiles){const i=this._tiles[e];if(i.state!=="loaded"&&i.state!=="errored")return!1}return!0}getSource(){return this._source}pause(){this._paused=!0}resume(){if(!this._paused)return;const e=this._shouldReloadOnResume;this._paused=!1,this._shouldReloadOnResume=!1,e&&this.reload(),this.transform&&this.update(this.transform,this.terrain)}_loadTile(e,i,s){return o._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,s)}catch(l){e.state="errored",l.status!==404?this._source.fire(new o.k(l,{tile:e})):this.update(this.transform,this.terrain)}})}_unloadTile(e){this._source.unloadTile&&this._source.unloadTile(e)}_abortTile(e){this._source.abortTile&&this._source.abortTile(e),this._source.fire(new o.l("dataabort",{tile:e,coord:e.tileID,dataType:"source"}))}serialize(){return this._source.serialize()}prepare(e){this._source.prepare&&this._source.prepare(),this._state.coalesceChanges(this._tiles,this.map?this.map.painter:null);for(const i in this._tiles){const s=this._tiles[i];s.upload(e),s.prepare(this.map.style.imageManager)}}getIds(){return Object.values(this._tiles).map(e=>e.tileID).sort(be).map(e=>e.key)}getRenderableIds(e){const i=[];for(const s in this._tiles)this._isIdRenderable(s,e)&&i.push(this._tiles[s]);return e?i.sort((s,l)=>{const h=s.tileID,f=l.tileID,_=new o.P(h.canonical.x,h.canonical.y)._rotate(-this.transform.bearingInRadians),v=new o.P(f.canonical.x,f.canonical.y)._rotate(-this.transform.bearingInRadians);return h.overscaledZ-f.overscaledZ||v.y-_.y||v.x-_.x}).map(s=>s.tileID.key):i.map(s=>s.tileID).sort(be).map(s=>s.key)}hasRenderableParent(e){const i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)(e||this._tiles[i].state!=="errored")&&this._reloadTile(i,"reloading")}}_reloadTile(e,i){return o._(this,void 0,void 0,function*(){const s=this._tiles[e];s&&(s.state!=="loading"&&(s.state=i),yield this._loadTile(s,e,i))})}_tileLoaded(e,i,s){e.timeAdded=ve.now(),s==="expired"&&(e.refreshedUponExpiration=!0),this._setTileReloadTimer(i,e),this.getSource().type==="raster-dem"&&e.dem&&this._backfillDEM(e),this._state.initializeTileState(e,this.map?this.map.painter:null),e.aborted||this._source.fire(new o.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const i=this.getRenderableIds();for(let l=0;l<i.length;l++){const h=i[l];if(e.neighboringTiles&&e.neighboringTiles[h]){const f=this.getTileByID(h);s(e,f),s(f,e)}}function s(l,h){l.needsHillshadePrepare=!0,l.needsTerrainPrepare=!0;let f=h.tileID.canonical.x-l.tileID.canonical.x;const _=h.tileID.canonical.y-l.tileID.canonical.y,v=Math.pow(2,l.tileID.canonical.z),T=h.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+v)===1?f+=v:Math.abs(f-v)===1&&(f-=v)),h.dem&&l.dem&&(l.dem.backfillBorder(h.dem,f,_),l.neighboringTiles&&l.neighboringTiles[T]&&(l.neighboringTiles[T].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,s,l){for(const h in this._tiles){let f=this._tiles[h];if(l[h]||!f.hasData()||f.tileID.overscaledZ<=i||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>i+1;){const T=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[T.key],f&&f.hasData()&&(_=T)}let v=_;for(;v.overscaledZ>i;)if(v=v.scaledTo(v.overscaledZ-1),e[v.key]||e[v.canonical.key]){l[_.key]=_;break}}}findLoadedParent(e,i){if(e.key in this._loadedParentTiles){const s=this._loadedParentTiles[e.key];return s&&s.tileID.overscaledZ>=i?s:null}for(let s=e.overscaledZ-1;s>=i;s--){const l=e.scaledTo(s),h=this._getLoadedTile(l);if(h)return h}}findLoadedSibling(e){return this._getLoadedTile(e)}_getLoadedTile(e){const i=this._tiles[e.key];return i&&i.hasData()?i:this._cache.getByKey(e.wrapped().key)}updateCacheSize(e){const i=Math.ceil(e.width/this._source.tileSize)+1,s=Math.ceil(e.height/this._source.tileSize)+1,l=Math.floor(i*s*(this._maxTileCacheZoomLevels===null?o.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,l):l;this._cache.setMaxSize(h)}handleWrapJump(e){const i=Math.round((e-(this._prevLng===void 0?e:this._prevLng))/360);if(this._prevLng=e,i){const s={};for(const l in this._tiles){const h=this._tiles[l];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+i),s[h.tileID.key]=h}this._tiles=s;for(const l in this._timers)clearTimeout(this._timers[l]),delete this._timers[l];for(const l in this._tiles)this._setTileReloadTimer(l,this._tiles[l])}}_updateCoveredAndRetainedTiles(e,i,s,l,h,f){const _={},v={},T=Object.keys(e),P=ve.now();for(const E of T){const k=e[E],F=this._tiles[E];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=P)continue;const O=this.findLoadedParent(k,i),H=this.findLoadedSibling(k),q=O||H||null;q&&(this._addTile(q.tileID),_[q.tileID.key]=q.tileID),v[E]=k}this._retainLoadedChildren(v,l,s,e);for(const E in _)e[E]||(this._coveredTiles[E]=!0,e[E]=_[E]);if(f){const E={},k={};for(const F of h)this._tiles[F.key].hasData()?E[F.key]=F:k[F.key]=F;for(const F in k){const O=k[F].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(E[O[0].key]=e[O[0].key]=O[0],E[O[1].key]=e[O[1].key]=O[1],E[O[2].key]=e[O[2].key]=O[2],E[O[3].key]=e[O[3].key]=O[3],delete k[F])}for(const F in k){const O=k[F],H=this.findLoadedParent(O,this._source.minzoom),q=this.findLoadedSibling(O),W=H||q||null;if(W){E[W.tileID.key]=e[W.tileID.key]=W.tileID;for(const K in E)E[K].isChildOf(W.tileID)&&delete E[K]}}for(const F in this._tiles)E[F]||(this._coveredTiles[F]=!0)}}update(e,i){if(!this._sourceLoaded||this._paused)return;let s;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(P=>new o.Y(P.canonical.z,P.wrap,P.canonical.z,P.canonical.x,P.canonical.y)):(s=ie(e,{tileSize:this.usedForTerrain?this.tileSize:this._source.tileSize,minzoom:this._source.minzoom,maxzoom:this._source.maxzoom,roundZoom:!this.usedForTerrain&&this._source.roundZoom,reparseOverscaled:this._source.reparseOverscaled,terrain:i,calculateTileZoom:this._source.calculateTileZoom}),this._source.hasTile&&(s=s.filter(P=>this._source.hasTile(P)))):s=[];const l=ge(e,this._source),h=Math.max(l-ye.maxOverzooming,this._source.minzoom),f=Math.max(l+ye.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const P={};for(const E of s)if(E.canonical.z>this._source.minzoom){const k=E.scaledTo(E.canonical.z-1);P[k.key]=k;const F=E.scaledTo(Math.max(this._source.minzoom,Math.min(E.canonical.z,5)));P[F.key]=F}s=s.concat(Object.values(P))}const _=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new o.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const v=this._updateRetainedTiles(s,l);de(this._source.type)&&this._updateCoveredAndRetainedTiles(v,h,f,l,s,i);for(const P in v)this._tiles[P].clearFadeHold();const T=o.aj(this._tiles,v);for(const P of T){const E=this._tiles[P];E.hasSymbolBuckets&&!E.holdingForFade()?E.setHoldDuration(this.map._fadeDuration):E.hasSymbolBuckets&&!E.symbolFadeFinished()||this._removeTile(P)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,i){var s;const l={},h={},f=Math.max(i-ye.maxOverzooming,this._source.minzoom),_=Math.max(i+ye.maxUnderzooming,this._source.minzoom),v={};for(const T of e){const P=this._addTile(T);l[T.key]=T,P.hasData()||i<this._source.maxzoom&&(v[T.key]=T)}this._retainLoadedChildren(v,i,_,l);for(const T of e){let P=this._tiles[T.key];if(P.hasData())continue;if(i+1>this._source.maxzoom){const k=T.children(this._source.maxzoom)[0],F=this.getTile(k);if(F&&F.hasData()){l[k.key]=k;continue}}else{const k=T.children(this._source.maxzoom);if(l[k[0].key]&&l[k[1].key]&&l[k[2].key]&&l[k[3].key])continue}let E=P.wasRequested();for(let k=T.overscaledZ-1;k>=f;--k){const F=T.scaledTo(k);if(h[F.key])break;if(h[F.key]=!0,P=this.getTile(F),!P&&E&&(P=this._addTile(F)),P){const O=P.hasData();if((O||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||E)&&(l[F.key]=F),E=P.wasRequested(),O)break}}}return l}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let s,l=this._tiles[e].tileID;for(;l.overscaledZ>0;){if(l.key in this._loadedParentTiles){s=this._loadedParentTiles[l.key];break}i.push(l.key);const h=l.scaledTo(l.overscaledZ-1);if(s=this._getLoadedTile(h),s)break;l=h}for(const h of i)this._loadedParentTiles[h]=s}}_updateLoadedSiblingTileCache(){this._loadedSiblingTiles={};for(const e in this._tiles){const i=this._tiles[e].tileID,s=this._getLoadedTile(i);this._loadedSiblingTiles[i.key]=s}}_addTile(e){let i=this._tiles[e.key];if(i)return i;i=this._cache.getAndRemove(e),i&&(this._setTileReloadTimer(e.key,i),i.tileID=e,this._state.initializeTileState(i,this.map?this.map.painter:null),this._cacheTimers[e.key]&&(clearTimeout(this._cacheTimers[e.key]),delete this._cacheTimers[e.key],this._setTileReloadTimer(e.key,i)));const s=i;return i||(i=new Gt(e,this._source.tileSize*e.overscaleFactor()),this._loadTile(i,e.key,i.state)),i.uses++,this._tiles[e.key]=i,s||this._source.fire(new o.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const s=i.getExpiryTimeout();s&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},s))}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(e){const i=e.sourceDataType;e.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&i==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,s){const l=[],h=this.transform;if(!h)return l;const f=s?h.getCameraQueryGeometry(e):e,_=e.map(O=>h.screenPointToMercatorCoordinate(O,this.terrain)),v=f.map(O=>h.screenPointToMercatorCoordinate(O,this.terrain)),T=this.getIds();let P=1/0,E=1/0,k=-1/0,F=-1/0;for(const O of v)P=Math.min(P,O.x),E=Math.min(E,O.y),k=Math.max(k,O.x),F=Math.max(F,O.y);for(let O=0;O<T.length;O++){const H=this._tiles[T[O]];if(H.holdingForFade())continue;const q=h.getCoveringTilesDetailsProvider().allowWorldCopies()?H.tileID:H.tileID.unwrapTo(0),W=Math.pow(2,h.zoom-H.tileID.overscaledZ),K=i*H.queryPadding*o.Z/H.tileSize/W,ee=[q.getTilePoint(new o.$(P,E)),q.getTilePoint(new o.$(k,F))];if(ee[0].x-K<o.Z&&ee[0].y-K<o.Z&&ee[1].x+K>=0&&ee[1].y+K>=0){const te=_.map(oe=>q.getTilePoint(oe)),re=v.map(oe=>q.getTilePoint(oe));l.push({tile:H,tileID:q,queryGeometry:te,cameraQueryGeometry:re,scale:W})}}return l}getVisibleCoordinates(e){const i=this.getRenderableIds(e).map(s=>this._tiles[s].tileID);return this.transform&&this.transform.populateCache(i),i}hasTransition(){if(this._source.hasTransition())return!0;if(de(this._source.type)){const e=ve.now();for(const i in this._tiles)if(this._tiles[i].fadeEndTime>=e)return!0}return!1}setFeatureState(e,i,s){this._state.updateState(e=e||"_geojsonTileLayer",i,s)}removeFeatureState(e,i,s){this._state.removeFeatureState(e=e||"_geojsonTileLayer",i,s)}getFeatureState(e,i){return this._state.getState(e=e||"_geojsonTileLayer",i)}setDependencies(e,i,s){const l=this._tiles[e];l&&l.setDependencies(i,s)}reloadTilesForDependencies(e,i){for(const s in this._tiles)this._tiles[s].hasDependency(e,i)&&this._reloadTile(s,"reloading");this._cache.filter(s=>!s.hasDependency(e,i))}}function be(u,e){const i=Math.abs(2*u.wrap)-+(u.wrap<0),s=Math.abs(2*e.wrap)-+(e.wrap<0);return u.overscaledZ-e.overscaledZ||s-i||e.canonical.y-u.canonical.y||e.canonical.x-u.canonical.x}function de(u){return u==="raster"||u==="image"||u==="video"}ye.maxOverzooming=10,ye.maxUnderzooming=3;class ke{constructor(e,i){this.reset(e,i)}reset(e,i){this.points=e||[],this._distances=[0];for(let s=1;s<this.points.length;s++)this._distances[s]=this._distances[s-1]+this.points[s].dist(this.points[s-1]);this.length=this._distances[this._distances.length-1],this.padding=Math.min(i||0,.5*this.length),this.paddedLength=this.length-2*this.padding}lerp(e){if(this.points.length===1)return this.points[0];e=o.ae(e,0,1);let i=1,s=this._distances[i];const l=e*this.paddedLength+this.padding;for(;s<l&&i<this._distances.length;)s=this._distances[++i];const h=i-1,f=this._distances[h],_=s-f,v=_>0?(l-f)/_:0;return this.points[h].mult(1-v).add(this.points[i].mult(v))}}function Ne(u,e){let i=!0;return u==="always"||u!=="never"&&e!=="never"||(i=!1),i}class Ve{constructor(e,i,s){const l=this.boxCells=[],h=this.circleCells=[];this.xCellCount=Math.ceil(e/s),this.yCellCount=Math.ceil(i/s);for(let f=0;f<this.xCellCount*this.yCellCount;f++)l.push([]),h.push([]);this.circleKeys=[],this.boxKeys=[],this.bboxes=[],this.circles=[],this.width=e,this.height=i,this.xScale=this.xCellCount/e,this.yScale=this.yCellCount/i,this.boxUid=0,this.circleUid=0}keysLength(){return this.boxKeys.length+this.circleKeys.length}insert(e,i,s,l,h){this._forEachCell(i,s,l,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(l),this.bboxes.push(h)}insertCircle(e,i,s,l){this._forEachCell(i-l,s-l,i+l,s+l,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(s),this.circles.push(l)}_insertBoxCell(e,i,s,l,h,f){this.boxCells[h].push(f)}_insertCircleCell(e,i,s,l,h,f){this.circleCells[h].push(f)}_query(e,i,s,l,h,f,_){if(s<0||e>this.width||l<0||i>this.height)return[];const v=[];if(e<=0&&i<=0&&this.width<=s&&this.height<=l){if(h)return[{key:null,x1:e,y1:i,x2:s,y2:l}];for(let T=0;T<this.boxKeys.length;T++)v.push({key:this.boxKeys[T],x1:this.bboxes[4*T],y1:this.bboxes[4*T+1],x2:this.bboxes[4*T+2],y2:this.bboxes[4*T+3]});for(let T=0;T<this.circleKeys.length;T++){const P=this.circles[3*T],E=this.circles[3*T+1],k=this.circles[3*T+2];v.push({key:this.circleKeys[T],x1:P-k,y1:E-k,x2:P+k,y2:E+k})}}else this._forEachCell(e,i,s,l,this._queryCell,v,{hitTest:h,overlapMode:f,seenUids:{box:{},circle:{}}},_);return v}query(e,i,s,l){return this._query(e,i,s,l,!1,null)}hitTest(e,i,s,l,h,f){return this._query(e,i,s,l,!0,h,f).length>0}hitTestCircle(e,i,s,l,h){const f=e-s,_=e+s,v=i-s,T=i+s;if(_<0||f>this.width||T<0||v>this.height)return!1;const P=[];return this._forEachCell(f,v,_,T,this._queryCellCircle,P,{hitTest:!0,overlapMode:l,circle:{x:e,y:i,radius:s},seenUids:{box:{},circle:{}}},h),P.length>0}_queryCell(e,i,s,l,h,f,_,v){const{seenUids:T,hitTest:P,overlapMode:E}=_,k=this.boxCells[h];if(k!==null){const O=this.bboxes;for(const H of k)if(!T.box[H]){T.box[H]=!0;const q=4*H,W=this.boxKeys[H];if(e<=O[q+2]&&i<=O[q+3]&&s>=O[q+0]&&l>=O[q+1]&&(!v||v(W))&&(!P||!Ne(E,W.overlapMode))&&(f.push({key:W,x1:O[q],y1:O[q+1],x2:O[q+2],y2:O[q+3]}),P))return!0}}const F=this.circleCells[h];if(F!==null){const O=this.circles;for(const H of F)if(!T.circle[H]){T.circle[H]=!0;const q=3*H,W=this.circleKeys[H];if(this._circleAndRectCollide(O[q],O[q+1],O[q+2],e,i,s,l)&&(!v||v(W))&&(!P||!Ne(E,W.overlapMode))){const K=O[q],ee=O[q+1],te=O[q+2];if(f.push({key:W,x1:K-te,y1:ee-te,x2:K+te,y2:ee+te}),P)return!0}}}return!1}_queryCellCircle(e,i,s,l,h,f,_,v){const{circle:T,seenUids:P,overlapMode:E}=_,k=this.boxCells[h];if(k!==null){const O=this.bboxes;for(const H of k)if(!P.box[H]){P.box[H]=!0;const q=4*H,W=this.boxKeys[H];if(this._circleAndRectCollide(T.x,T.y,T.radius,O[q+0],O[q+1],O[q+2],O[q+3])&&(!v||v(W))&&!Ne(E,W.overlapMode))return f.push(!0),!0}}const F=this.circleCells[h];if(F!==null){const O=this.circles;for(const H of F)if(!P.circle[H]){P.circle[H]=!0;const q=3*H,W=this.circleKeys[H];if(this._circlesCollide(O[q],O[q+1],O[q+2],T.x,T.y,T.radius)&&(!v||v(W))&&!Ne(E,W.overlapMode))return f.push(!0),!0}}}_forEachCell(e,i,s,l,h,f,_,v){const T=this._convertToXCellCoord(e),P=this._convertToYCellCoord(i),E=this._convertToXCellCoord(s),k=this._convertToYCellCoord(l);for(let F=T;F<=E;F++)for(let O=P;O<=k;O++)if(h.call(this,e,i,s,l,this.xCellCount*O+F,f,_,v))return}_convertToXCellCoord(e){return Math.max(0,Math.min(this.xCellCount-1,Math.floor(e*this.xScale)))}_convertToYCellCoord(e){return Math.max(0,Math.min(this.yCellCount-1,Math.floor(e*this.yScale)))}_circlesCollide(e,i,s,l,h,f){const _=l-e,v=h-i,T=s+f;return T*T>_*_+v*v}_circleAndRectCollide(e,i,s,l,h,f,_){const v=(f-l)/2,T=Math.abs(e-(l+v));if(T>v+s)return!1;const P=(_-h)/2,E=Math.abs(i-(h+P));if(E>P+s)return!1;if(T<=v||E<=P)return!0;const k=T-v,F=E-P;return k*k+F*F<=s*s}}function rt(u,e,i){const s=o.K();if(!u){const{vecSouth:E,vecEast:k}=Me(e),F=he();F[0]=k[0],F[1]=k[1],F[2]=E[0],F[3]=E[1],l=F,(P=(f=(h=F)[0])*(T=h[3])-(v=h[2])*(_=h[1]))&&(l[0]=T*(P=1/P),l[1]=-_*P,l[2]=-v*P,l[3]=f*P),s[0]=F[0],s[1]=F[1],s[4]=F[2],s[5]=F[3]}var l,h,f,_,v,T,P;return o.M(s,s,[1/i,1/i,1]),s}function dt(u,e,i,s){if(u){const l=o.K();if(!e){const{vecSouth:h,vecEast:f}=Me(i);l[0]=f[0],l[1]=f[1],l[4]=h[0],l[5]=h[1]}return o.M(l,l,[s,s,1]),l}return i.pixelsToClipSpaceMatrix}function Me(u){const e=Math.cos(u.rollInRadians),i=Math.sin(u.rollInRadians),s=Math.cos(u.pitchInRadians),l=Math.cos(u.bearingInRadians),h=Math.sin(u.bearingInRadians),f=o.ao();f[0]=-l*s*i-h*e,f[1]=-h*s*i+l*e;const _=o.ap(f);_<1e-9?o.aq(f):o.ar(f,f,1/_);const v=o.ao();v[0]=l*s*e-h*i,v[1]=h*s*e+l*i;const T=o.ap(v);return T<1e-9?o.aq(v):o.ar(v,v,1/T),{vecEast:v,vecSouth:f}}function at(u,e,i,s){let l;s?(l=[u,e,s(u,e),1],o.at(l,l,i)):(l=[u,e,0,1],ei(l,l,i));const h=l[3];return{point:new o.P(l[0]/h,l[1]/h),signedDistanceFromCamera:h,isOccluded:!1}}function Ct(u,e){return .5+u/e*.5}function Vt(u,e){return u.x>=-e[0]&&u.x<=e[0]&&u.y>=-e[1]&&u.y<=e[1]}function It(u,e,i,s,l,h,f,_,v,T,P,E,k){const F=i?u.textSizeData:u.iconSizeData,O=o.ak(F,e.transform.zoom),H=[256/e.width*2+1,256/e.height*2+1],q=i?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;q.clear();const W=u.lineVertexArray,K=i?u.text.placedSymbolArray:u.icon.placedSymbolArray,ee=e.transform.width/e.transform.height;let te=!1;for(let re=0;re<K.length;re++){const oe=K.get(re);if(oe.hidden||oe.writingMode===o.al.vertical&&!te){Ui(oe.numGlyphs,q);continue}te=!1;const ae=new o.P(oe.anchorX,oe.anchorY),pe={getElevation:k,pitchedLabelPlaneMatrix:s,lineVertexArray:W,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:ae,unwrappedTileID:v,width:T,height:P,translation:E},me=ws(oe.anchorX,oe.anchorY,pe);if(!Vt(me.point,H)){Ui(oe.numGlyphs,q);continue}const Se=Ct(e.transform.cameraToCenterDistance,me.signedDistanceFromCamera),Ce=o.am(F,O,oe),Te=h?Ce*e.transform.getPitchedTextCorrection(oe.anchorX,oe.anchorY,v)/Se:Ce*Se,je=et({projectionContext:pe,pitchedLabelPlaneMatrixInverse:l,symbol:oe,fontSize:Te,flip:!1,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:_});te=je.useVertical,(je.notEnoughRoom||te||je.needsFlipping&&et({projectionContext:pe,pitchedLabelPlaneMatrixInverse:l,symbol:oe,fontSize:Te,flip:!0,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:q,aspectRatio:ee,rotateToLine:_}).notEnoughRoom)&&Ui(oe.numGlyphs,q)}i?u.text.dynamicLayoutVertexBuffer.updateData(q):u.icon.dynamicLayoutVertexBuffer.updateData(q)}function Ie(u,e,i,s,l,h,f,_){const v=h.glyphStartIndex+h.numGlyphs,T=h.lineStartIndex,P=h.lineStartIndex+h.lineLength,E=e.getoffsetX(h.glyphStartIndex),k=e.getoffsetX(v-1),F=Xn(u*E,i,s,l,h.segment,T,P,_,f);if(!F)return null;const O=Xn(u*k,i,s,l,h.segment,T,P,_,f);return O?_.projectionCache.anyProjectionOccluded?null:{first:F,last:O}:null}function $e(u,e,i,s){return u===o.al.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*s?{useVertical:!0}:(u===o.al.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function et(u){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:s,fontSize:l,flip:h,keepUpright:f,glyphOffsetArray:_,dynamicLayoutVertexArray:v,aspectRatio:T,rotateToLine:P}=u,E=l/24,k=s.lineOffsetX*E,F=s.lineOffsetY*E;let O;if(s.numGlyphs>1){const H=s.glyphStartIndex+s.numGlyphs,q=s.lineStartIndex,W=s.lineStartIndex+s.lineLength,K=Ie(E,_,k,F,h,s,P,e);if(!K)return{notEnoughRoom:!0};const ee=lt(K.first.point.x,K.first.point.y,e,i),te=lt(K.last.point.x,K.last.point.y,e,i);if(f&&!h){const re=$e(s.writingMode,ee,te,T);if(re)return re}O=[K.first];for(let re=s.glyphStartIndex+1;re<H-1;re++)O.push(Xn(E*_.getoffsetX(re),k,F,h,s.segment,q,W,e,P));O.push(K.last)}else{if(f&&!h){const q=ci(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,W=s.lineStartIndex+s.segment+1,K=new o.P(e.lineVertexArray.getx(W),e.lineVertexArray.gety(W)),ee=ci(K.x,K.y,e),te=ee.signedDistanceFromCamera>0?ee.point:fr(e.tileAnchorPoint,K,q,1,e),re=lt(q.x,q.y,e,i),oe=lt(te.x,te.y,e,i),ae=$e(s.writingMode,re,oe,T);if(ae)return ae}const H=Xn(E*_.getoffsetX(s.glyphStartIndex),k,F,h,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,e,P);if(!H||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};O=[H]}for(const H of O)o.as(v,H.point,H.angle);return{}}function fr(u,e,i,s,l){const h=u.add(u.sub(e)._unit()),f=ci(h.x,h.y,l).point,_=i.sub(f);return i.add(_._mult(s/_.mag()))}function ar(u,e,i){const s=e.projectionCache;if(s.projections[u])return s.projections[u];const l=new o.P(e.lineVertexArray.getx(u),e.lineVertexArray.gety(u)),h=ci(l.x,l.y,e);if(h.signedDistanceFromCamera>0)return s.projections[u]=h.point,s.anyProjectionOccluded=s.anyProjectionOccluded||h.isOccluded,h.point;const f=u-i.direction;return fr(i.distanceFromAnchor===0?e.tileAnchorPoint:new o.P(e.lineVertexArray.getx(f),e.lineVertexArray.gety(f)),l,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,e)}function ci(u,e,i){const s=u+i.translation[0],l=e+i.translation[1];let h;return i.pitchWithMap?(h=at(s,l,i.pitchedLabelPlaneMatrix,i.getElevation),h.isOccluded=!1):(h=i.transform.projectTileCoordinates(s,l,i.unwrappedTileID,i.getElevation),h.point.x=(.5*h.point.x+.5)*i.width,h.point.y=(.5*-h.point.y+.5)*i.height),h}function lt(u,e,i,s){if(i.pitchWithMap){const l=[u,e,0,1];return o.at(l,l,s),i.transform.projectTileCoordinates(l[0]/l[3],l[1]/l[3],i.unwrappedTileID,i.getElevation).point}return{x:u/i.width*2-1,y:e/i.height*2-1}}function ws(u,e,i){return i.transform.projectTileCoordinates(u,e,i.unwrappedTileID,i.getElevation)}function _a(u,e,i){return u._unit()._perp()._mult(e*i)}function wo(u,e,i,s,l,h,f,_,v){if(_.projectionCache.offsets[u])return _.projectionCache.offsets[u];const T=i.add(e);if(u+v.direction<s||u+v.direction>=l)return _.projectionCache.offsets[u]=T,T;const P=ar(u+v.direction,_,v),E=_a(P.sub(i),f,v.direction),k=i.add(E),F=P.add(E);return _.projectionCache.offsets[u]=o.au(h,T,k,F)||T,_.projectionCache.offsets[u]}function Xn(u,e,i,s,l,h,f,_,v){const T=s?u-e:u+e;let P=T>0?1:-1,E=0;s&&(P*=-1,E=Math.PI),P<0&&(E+=Math.PI);let k,F=P>0?h+l:h+l+1;_.projectionCache.cachedAnchorPoint?k=_.projectionCache.cachedAnchorPoint:(k=ci(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=k);let O,H,q=k,W=k,K=0,ee=0;const te=Math.abs(T),re=[];let oe;for(;K+ee<=te;){if(F+=P,F<h||F>=f)return null;K+=ee,W=q,H=O;const me={absOffsetX:te,direction:P,distanceFromAnchor:K,previousVertex:W};if(q=ar(F,_,me),i===0)re.push(W),oe=q.sub(W);else{let Se;const Ce=q.sub(W);Se=Ce.mag()===0?_a(ar(F+P,_,me).sub(q),i,P):_a(Ce,i,P),H||(H=W.add(Se)),O=wo(F,Se,q,h,f,H,i,_,me),re.push(H),oe=O.sub(H)}ee=oe.mag()}const ae=oe._mult((te-K)/ee)._add(H||W),pe=E+Math.atan2(q.y-W.y,q.x-W.x);return re.push(ae),{point:ae,angle:v?pe:0,path:re}}const To=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function Ui(u,e){for(let i=0;i<u;i++){const s=e.length;e.resize(s+4),e.float32.set(To,3*s)}}function ei(u,e,i){const s=e[0],l=e[1];return u[0]=i[0]*s+i[4]*l+i[12],u[1]=i[1]*s+i[5]*l+i[13],u[3]=i[3]*s+i[7]*l+i[15],u}const $i=100;class Ts{constructor(e,i=new Ve(e.width+200,e.height+200,25),s=new Ve(e.width+200,e.height+200,25)){this.transform=e,this.grid=i,this.ignoredGrid=s,this.pitchFactor=Math.cos(e.pitch*Math.PI/180)*e.cameraToCenterDistance,this.screenRightBoundary=e.width+$i,this.screenBottomBoundary=e.height+$i,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,i,s,l,h,f,_,v,T,P,E,k){const F=this.projectAndGetPerspectiveRatio(e.anchorPointX+v[0],e.anchorPointY+v[1],h,P,k),O=s*F.perspectiveRatio;let H;if(f||_)H=this._projectCollisionBox(e,O,l,h,f,_,v,F,P,E,k);else{const oe=F.x+(E?E.x*O:0),ae=F.y+(E?E.y*O:0);H={allPointsOccluded:!1,box:[oe+e.x1*O,ae+e.y1*O,oe+e.x2*O,ae+e.y2*O]}}const[q,W,K,ee]=H.box,te=f?H.allPointsOccluded:F.isOccluded;let re=te;return re||(re=F.perspectiveRatio<this.perspectiveRatioCutoff),re||(re=!this.isInsideGrid(q,W,K,ee)),re||i!=="always"&&this.grid.hitTest(q,W,K,ee,i,T)?{box:[q,W,K,ee],placeable:!1,offscreen:!1,occluded:te}:{box:[q,W,K,ee],placeable:!0,offscreen:this.isOffscreen(q,W,K,ee),occluded:te}}placeCollisionCircles(e,i,s,l,h,f,_,v,T,P,E,k,F,O){const H=[],q=new o.P(i.anchorX,i.anchorY),W=this.getPerspectiveRatio(q.x,q.y,f,O),K=(T?h*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,f)/W:h*W)/o.ay,ee={getElevation:O,pitchedLabelPlaneMatrix:_,lineVertexArray:s,pitchWithMap:T,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:q,unwrappedTileID:f,width:this.transform.width,height:this.transform.height,translation:F},te=Ie(K,l,i.lineOffsetX*K,i.lineOffsetY*K,!1,i,!1,ee);let re=!1,oe=!1,ae=!0;if(te){const pe=.5*E*W+k,me=new o.P(-100,-100),Se=new o.P(this.screenRightBoundary,this.screenBottomBoundary),Ce=new ke,Te=te.first,je=te.last;let Be=[];for(let ft=Te.path.length-1;ft>=1;ft--)Be.push(Te.path[ft]);for(let ft=1;ft<je.path.length;ft++)Be.push(je.path[ft]);const Ee=2.5*pe;if(T){const ft=this.projectPathToScreenSpace(Be,ee);Be=ft.some(st=>st.signedDistanceFromCamera<=0)?[]:ft.map(st=>st.point)}let He=[];if(Be.length>0){const ft=Be[0].clone(),st=Be[0].clone();for(let ui=1;ui<Be.length;ui++)ft.x=Math.min(ft.x,Be[ui].x),ft.y=Math.min(ft.y,Be[ui].y),st.x=Math.max(st.x,Be[ui].x),st.y=Math.max(st.y,Be[ui].y);He=ft.x>=me.x&&st.x<=Se.x&&ft.y>=me.y&&st.y<=Se.y?[Be]:st.x<me.x||ft.x>Se.x||st.y<me.y||ft.y>Se.y?[]:o.av([Be],me.x,me.y,Se.x,Se.y)}for(const ft of He){Ce.reset(ft,.25*pe);let st=0;st=Ce.length<=.5*pe?1:Math.ceil(Ce.paddedLength/Ee)+1;for(let ui=0;ui<st;ui++){const Ut=ui/Math.max(st-1,1),hi=Ce.lerp(Ut),ii=hi.x+$i,Ht=hi.y+$i;H.push(ii,Ht,pe,0);const Zt=ii-pe,Gi=Ht-pe,Bi=ii+pe,Ji=Ht+pe;if(ae=ae&&this.isOffscreen(Zt,Gi,Bi,Ji),oe=oe||this.isInsideGrid(Zt,Gi,Bi,Ji),e!=="always"&&this.grid.hitTestCircle(ii,Ht,pe,e,P)&&(re=!0,!v))return{circles:[],offscreen:!1,collisionDetected:re}}}}return{circles:!v&&re||!oe||W<this.perspectiveRatioCutoff?[]:H,offscreen:ae,collisionDetected:re}}projectPathToScreenSpace(e,i){const s=function(l,h){const f=o.K();return o.an(f,h.pitchedLabelPlaneMatrix),l.map(_=>{const v=at(_.x,_.y,f,h.getElevation),T=h.transform.projectTileCoordinates(v.point.x,v.point.y,h.unwrappedTileID,h.getElevation);return T.point.x=(.5*T.point.x+.5)*h.width,T.point.y=(.5*-T.point.y+.5)*h.height,T})}(e,i);return function(l){let h=0,f=0,_=0,v=0;for(let T=0;T<l.length;T++)l[T].isOccluded?(_=T+1,v=0):(v++,v>f&&(f=v,h=_));return l.slice(h,h+f)}(s)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const i=[];let s=1/0,l=1/0,h=-1/0,f=-1/0;for(const P of e){const E=new o.P(P.x+$i,P.y+$i);s=Math.min(s,E.x),l=Math.min(l,E.y),h=Math.max(h,E.x),f=Math.max(f,E.y),i.push(E)}const _=this.grid.query(s,l,h,f).concat(this.ignoredGrid.query(s,l,h,f)),v={},T={};for(const P of _){const E=P.key;if(v[E.bucketInstanceId]===void 0&&(v[E.bucketInstanceId]={}),v[E.bucketInstanceId][E.featureIndex])continue;const k=[new o.P(P.x1,P.y1),new o.P(P.x2,P.y1),new o.P(P.x2,P.y2),new o.P(P.x1,P.y2)];o.aw(i,k)&&(v[E.bucketInstanceId][E.featureIndex]=!0,T[E.bucketInstanceId]===void 0&&(T[E.bucketInstanceId]=[]),T[E.bucketInstanceId].push(E.featureIndex))}return T}insertCollisionBox(e,i,s,l,h,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,s,l,h,f){const _=s?this.ignoredGrid:this.grid,v={bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i};for(let T=0;T<e.length;T+=4)_.insertCircle(v,e[T],e[T+1],e[T+2])}projectAndGetPerspectiveRatio(e,i,s,l,h){if(h){let f;l?(f=[e,i,l(e,i),1],o.at(f,f,h)):(f=[e,i,0,1],ei(f,f,h));const _=f[3];return{x:(f[0]/_+1)/2*this.transform.width+$i,y:(-f[1]/_+1)/2*this.transform.height+$i,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const f=this.transform.projectTileCoordinates(e,i,s,l);return{x:(f.point.x+1)/2*this.transform.width+$i,y:(1-f.point.y)/2*this.transform.height+$i,perspectiveRatio:.5+this.transform.cameraToCenterDistance/f.signedDistanceFromCamera*.5,isOccluded:f.isOccluded,signedDistanceFromCamera:f.signedDistanceFromCamera}}}getPerspectiveRatio(e,i,s,l){const h=this.transform.projectTileCoordinates(e,i,s,l);return .5+this.transform.cameraToCenterDistance/h.signedDistanceFromCamera*.5}isOffscreen(e,i,s,l){return s<$i||e>=this.screenRightBoundary||l<$i||i>this.screenBottomBoundary}isInsideGrid(e,i,s,l){return s>=0&&e<this.gridRightBoundary&&l>=0&&i<this.gridBottomBoundary}getViewportMatrix(){const e=o.ad([]);return o.L(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,s,l,h,f,_,v,T,P,E){let k=1,F=0,O=0,H=1;const q=e.anchorPointX+_[0],W=e.anchorPointY+_[1];if(f&&!h){const Be=this.projectAndGetPerspectiveRatio(q+1,W,l,T,E),Ee=Be.x-v.x,He=Math.atan((Be.y-v.y)/Ee)+(Ee<0?Math.PI:0),ft=Math.sin(He),st=Math.cos(He);k=st,F=ft,O=-ft,H=st}else if(!f&&h){const Be=Me(this.transform);k=Be.vecEast[0],F=Be.vecEast[1],O=Be.vecSouth[0],H=Be.vecSouth[1]}let K=v.x,ee=v.y,te=i;h&&(K=q,ee=W,te=Math.pow(2,-(this.transform.zoom-s.overscaledZ)),te*=this.transform.getPitchedTextCorrection(q,W,l),P||(te*=o.ae(.5+v.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),P&&(K+=k*P.x*te+O*P.y*te,ee+=F*P.x*te+H*P.y*te);const re=e.x1*te,oe=e.x2*te,ae=(re+oe)/2,pe=e.y1*te,me=e.y2*te,Se=(pe+me)/2,Ce=[{offsetX:re,offsetY:pe},{offsetX:ae,offsetY:pe},{offsetX:oe,offsetY:pe},{offsetX:oe,offsetY:Se},{offsetX:oe,offsetY:me},{offsetX:ae,offsetY:me},{offsetX:re,offsetY:me},{offsetX:re,offsetY:Se}];let Te=[];for(const{offsetX:Be,offsetY:Ee}of Ce)Te.push(new o.P(K+k*Be+O*Ee,ee+F*Be+H*Ee));let je=!1;if(h){const Be=Te.map(Ee=>this.projectAndGetPerspectiveRatio(Ee.x,Ee.y,l,T,E));je=Be.some(Ee=>!Ee.isOccluded),Te=Be.map(Ee=>new o.P(Ee.x,Ee.y))}else je=!0;return{box:o.ax(Te),allPointsOccluded:!je}}}class Mo{constructor(e,i,s,l){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):l&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class Yr{constructor(e,i,s,l,h){this.text=new Mo(e?e.text:null,i,s,h),this.icon=new Mo(e?e.icon:null,i,l,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class ya{constructor(e,i,s){this.text=e,this.icon=i,this.skipFade=s}}class Qu{constructor(e,i,s,l,h){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=s,this.bucketIndex=l,this.tileID=h}}class eh{constructor(e){this.crossSourceCollisions=e,this.maxGroupID=0,this.collisionGroups={}}get(e){if(this.crossSourceCollisions)return{ID:0,predicate:null};if(!this.collisionGroups[e]){const i=++this.maxGroupID;this.collisionGroups[e]={ID:i,predicate:s=>s.collisionGroupID===i}}return this.collisionGroups[e]}}function Wl(u,e,i,s,l){const{horizontalAlign:h,verticalAlign:f}=o.aE(u);return new o.P(-(h-.5)*e+s[0]*l,-(f-.5)*i+s[1]*l)}class Ua{constructor(e,i,s,l,h){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new Ts(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new eh(l),this.collisionCircleArrays={},this.collisionBoxArrays=new Map,this.prevPlacement=h,h&&(h.prevPlacement=void 0),this.placedOrientations={}}_getTerrainElevationFunc(e){const i=this.terrain;return i?(s,l)=>i.getElevation(e,s,l):null}getBucketParts(e,i,s,l){const h=s.getBucket(i),f=s.latestFeatureIndex;if(!h||!f||i.id!==h.layerIds[0])return;const _=s.collisionBoxArray,v=h.layers[0].layout,T=h.layers[0].paint,P=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),E=s.tileSize/o.Z,k=s.tileID.toUnwrapped(),F=v.get("text-rotation-alignment")==="map",O=o.az(s,1,this.transform.zoom),H=o.aA(this.collisionIndex.transform,s,T.get("text-translate"),T.get("text-translate-anchor")),q=o.aA(this.collisionIndex.transform,s,T.get("icon-translate"),T.get("icon-translate-anchor")),W=rt(F,this.transform,O);this.retainedQueryData[h.bucketInstanceId]=new Qu(h.bucketInstanceId,f,h.sourceLayerIndex,h.index,s.tileID);const K={bucket:h,layout:v,translationText:H,translationIcon:q,unwrappedTileID:k,pitchedLabelPlaneMatrix:W,scale:P,textPixelRatio:E,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:o.ak(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(l)for(const ee of h.sortKeyRanges){const{sortKey:te,symbolInstanceStart:re,symbolInstanceEnd:oe}=ee;e.push({sortKey:te,symbolInstanceStart:re,symbolInstanceEnd:oe,parameters:K})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:K})}attemptAnchorPlacement(e,i,s,l,h,f,_,v,T,P,E,k,F,O,H,q,W,K,ee,te){const re=o.aB[e.textAnchor],oe=[e.textOffset0,e.textOffset1],ae=Wl(re,s,l,oe,h),pe=this.collisionIndex.placeCollisionBox(i,k,v,T,P,_,f,q,E.predicate,ee,ae,te);if((!K||this.collisionIndex.placeCollisionBox(K,k,v,T,P,_,f,W,E.predicate,ee,ae,te).placeable)&&pe.placeable){let me;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(me=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:oe,width:s,height:l,anchor:re,textBoxScale:h,prevAnchor:me},this.markUsedJustification(O,re,F,H),O.allowVerticalPlacement&&(this.markUsedOrientation(O,H,F),this.placedOrientations[F.crossTileID]=H),{shift:ae,placedGlyphBoxes:pe}}}placeLayerBucketPart(e,i,s){const{bucket:l,layout:h,translationText:f,translationIcon:_,unwrappedTileID:v,pitchedLabelPlaneMatrix:T,textPixelRatio:P,holdingForFade:E,collisionBoxArray:k,partiallyEvaluatedTextSize:F,collisionGroup:O}=e.parameters,H=h.get("text-optional"),q=h.get("icon-optional"),W=o.aC(h,"text-overlap","text-allow-overlap"),K=W==="always",ee=o.aC(h,"icon-overlap","icon-allow-overlap"),te=ee==="always",re=h.get("text-rotation-alignment")==="map",oe=h.get("text-pitch-alignment")==="map",ae=h.get("icon-text-fit")!=="none",pe=h.get("symbol-z-order")==="viewport-y",me=K&&(te||!l.hasIconData()||q),Se=te&&(K||!l.hasTextData()||H);!l.collisionArrays&&k&&l.deserializeCollisionBoxes(k);const Ce=this.retainedQueryData[l.bucketInstanceId].tileID,Te=this._getTerrainElevationFunc(Ce),je=this.transform.getFastPathSimpleProjectionMatrix(Ce),Be=(Ee,He,ft)=>{var st,ui;if(i[Ee.crossTileID])return;if(E)return void(this.placements[Ee.crossTileID]=new ya(!1,!1,!1));let Ut=!1,hi=!1,ii=!0,Ht=null,Zt={box:null,placeable:!1,offscreen:null,occluded:!1},Gi={placeable:!1},Bi=null,Ji=null,lr=null,xn=0,ia=0,Rn=0;He.textFeatureIndex?xn=He.textFeatureIndex:Ee.useRuntimeCollisionCircles&&(xn=Ee.featureIndex),He.verticalTextFeatureIndex&&(ia=He.verticalTextFeatureIndex);const Dn=He.textBox;if(Dn){const Dr=mi=>{let ri=o.al.horizontal;if(l.allowVerticalPlacement&&!mi&&this.prevPlacement){const Pi=this.prevPlacement.placedOrientations[Ee.crossTileID];Pi&&(this.placedOrientations[Ee.crossTileID]=Pi,ri=Pi,this.markUsedOrientation(l,ri,Ee))}return ri},ra=(mi,ri)=>{if(l.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&He.verticalTextBox){for(const Pi of l.writingModes)if(Pi===o.al.vertical?(Zt=ri(),Gi=Zt):Zt=mi(),Zt&&Zt.placeable)break}else Zt=mi()},Ln=Ee.textAnchorOffsetStartIndex,Bn=Ee.textAnchorOffsetEndIndex;if(Bn===Ln){const mi=(ri,Pi)=>{const di=this.collisionIndex.placeCollisionBox(ri,W,P,Ce,v,oe,re,f,O.predicate,Te,void 0,je);return di&&di.placeable&&(this.markUsedOrientation(l,Pi,Ee),this.placedOrientations[Ee.crossTileID]=Pi),di};ra(()=>mi(Dn,o.al.horizontal),()=>{const ri=He.verticalTextBox;return l.allowVerticalPlacement&&Ee.numVerticalGlyphVertices>0&&ri?mi(ri,o.al.vertical):{box:null,offscreen:null}}),Dr(Zt&&Zt.placeable)}else{let mi=o.aB[(ui=(st=this.prevPlacement)===null||st===void 0?void 0:st.variableOffsets[Ee.crossTileID])===null||ui===void 0?void 0:ui.anchor];const ri=(di,$h,Aa)=>{const cp=di.x2-di.x1,Gh=di.y2-di.y1,qc=Ee.textBoxScale,qh=ae&&ee==="never"?$h:null;let Lr=null,na=W==="never"?1:2,Hc="never";mi&&na++;for(let Hh=0;Hh<na;Hh++){for(let Js=Ln;Js<Bn;Js++){const Wc=l.textAnchorOffsets.get(Js);if(mi&&Wc.textAnchor!==mi)continue;const Xc=this.attemptAnchorPlacement(Wc,di,cp,Gh,qc,re,oe,P,Ce,v,O,Hc,Ee,l,Aa,f,_,qh,Te);if(Xc&&(Lr=Xc.placedGlyphBoxes,Lr&&Lr.placeable))return Ut=!0,Ht=Xc.shift,Lr}mi?mi=null:Hc=W}return s&&!Lr&&(Lr={box:this.collisionIndex.placeCollisionBox(Dn,"always",P,Ce,v,oe,re,f,O.predicate,Te,void 0,je).box,offscreen:!1,placeable:!1,occluded:!1}),Lr};ra(()=>ri(Dn,He.iconBox,o.al.horizontal),()=>{const di=He.verticalTextBox;return l.allowVerticalPlacement&&(!Zt||!Zt.placeable)&&Ee.numVerticalGlyphVertices>0&&di?ri(di,He.verticalIconBox,o.al.vertical):{box:null,occluded:!0,offscreen:null}}),Zt&&(Ut=Zt.placeable,ii=Zt.offscreen);const Pi=Dr(Zt&&Zt.placeable);if(!Ut&&this.prevPlacement){const di=this.prevPlacement.variableOffsets[Ee.crossTileID];di&&(this.variableOffsets[Ee.crossTileID]=di,this.markUsedJustification(l,di.anchor,Ee,Pi))}}}if(Bi=Zt,Ut=Bi&&Bi.placeable,ii=Bi&&Bi.offscreen,Ee.useRuntimeCollisionCircles){const Dr=l.text.placedSymbolArray.get(Ee.centerJustifiedTextSymbolIndex),ra=o.am(l.textSizeData,F,Dr),Ln=h.get("text-padding");Ji=this.collisionIndex.placeCollisionCircles(W,Dr,l.lineVertexArray,l.glyphOffsetArray,ra,v,T,s,oe,O.predicate,Ee.collisionCircleDiameter,Ln,f,Te),Ji.circles.length&&Ji.collisionDetected&&!s&&o.w("Collisions detected, but collision boxes are not shown"),Ut=K||Ji.circles.length>0&&!Ji.collisionDetected,ii=ii&&Ji.offscreen}if(He.iconFeatureIndex&&(Rn=He.iconFeatureIndex),He.iconBox){const Dr=ra=>this.collisionIndex.placeCollisionBox(ra,ee,P,Ce,v,oe,re,_,O.predicate,Te,ae&&Ht?Ht:void 0,je);Gi&&Gi.placeable&&He.verticalIconBox?(lr=Dr(He.verticalIconBox),hi=lr.placeable):(lr=Dr(He.iconBox),hi=lr.placeable),ii=ii&&lr.offscreen}const vn=H||Ee.numHorizontalGlyphVertices===0&&Ee.numVerticalGlyphVertices===0,ka=q||Ee.numIconVertices===0;vn||ka?ka?vn||(hi=hi&&Ut):Ut=hi&&Ut:hi=Ut=hi&&Ut;const za=hi&&lr.placeable;if(Ut&&Bi.placeable&&this.collisionIndex.insertCollisionBox(Bi.box,W,h.get("text-ignore-placement"),l.bucketInstanceId,Gi&&Gi.placeable&&ia?ia:xn,O.ID),za&&this.collisionIndex.insertCollisionBox(lr.box,ee,h.get("icon-ignore-placement"),l.bucketInstanceId,Rn,O.ID),Ji&&Ut&&this.collisionIndex.insertCollisionCircles(Ji.circles,W,h.get("text-ignore-placement"),l.bucketInstanceId,xn,O.ID),s&&this.storeCollisionData(l.bucketInstanceId,ft,He,Bi,lr,Ji),Ee.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(l.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Ee.crossTileID]=new ya((Ut||me)&&!(Bi!=null&&Bi.occluded),(hi||Se)&&!(lr!=null&&lr.occluded),ii||l.justReloaded),i[Ee.crossTileID]=!0};if(pe){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ee=l.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let He=Ee.length-1;He>=0;--He){const ft=Ee[He];Be(l.symbolInstances.get(ft),l.collisionArrays[ft],ft)}}else for(let Ee=e.symbolInstanceStart;Ee<e.symbolInstanceEnd;Ee++)Be(l.symbolInstances.get(Ee),l.collisionArrays[Ee],Ee);l.justReloaded=!1}storeCollisionData(e,i,s,l,h,f){if(s.textBox||s.iconBox){let _,v;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(i)?v=_.get(i):(v={text:null,icon:null},_.set(i,v)),s.textBox&&(v.text=l.box),s.iconBox&&(v.icon=h.box)}if(f){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=[]);for(let v=0;v<f.circles.length;v+=4)_.push(f.circles[v+0]-$i),_.push(f.circles[v+1]-$i),_.push(f.circles[v+2]),_.push(f.collisionDetected?1:0)}}markUsedJustification(e,i,s,l){let h;h=l===o.al.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[o.aD(i)];const f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex,s.verticalPlacedTextSymbolIndex];for(const _ of f)_>=0&&(e.text.placedSymbolArray.get(_).crossTileID=h>=0&&_!==h?0:s.crossTileID)}markUsedOrientation(e,i,s){const l=i===o.al.horizontal||i===o.al.horizontalOnly?i:0,h=i===o.al.vertical?i:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)e.text.placedSymbolArray.get(_).placedOrientation=l;s.verticalPlacedTextSymbolIndex&&(e.text.placedSymbolArray.get(s.verticalPlacedTextSymbolIndex).placedOrientation=h)}commit(e){this.commitTime=e,this.zoomAtLastRecencyCheck=this.transform.zoom;const i=this.prevPlacement;let s=!1;this.prevZoomAdjustment=i?i.zoomAdjustment(this.transform.zoom):0;const l=i?i.symbolFadeChange(e):1,h=i?i.opacities:{},f=i?i.variableOffsets:{},_=i?i.placedOrientations:{};for(const v in this.placements){const T=this.placements[v],P=h[v];P?(this.opacities[v]=new Yr(P,l,T.text,T.icon),s=s||T.text!==P.text.placed||T.icon!==P.icon.placed):(this.opacities[v]=new Yr(null,l,T.text,T.icon,T.skipFade),s=s||T.text||T.icon)}for(const v in h){const T=h[v];if(!this.opacities[v]){const P=new Yr(T,l,!1,!1);P.isHidden()||(this.opacities[v]=P,s=s||T.text.placed||T.icon.placed)}}for(const v in f)this.variableOffsets[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.variableOffsets[v]=f[v]);for(const v in _)this.placedOrientations[v]||!this.opacities[v]||this.opacities[v].isHidden()||(this.placedOrientations[v]=_[v]);if(i&&i.lastPlacementChangeTime===void 0)throw new Error("Last placement time for previous placement is not defined");s?this.lastPlacementChangeTime=e:typeof this.lastPlacementChangeTime!="number"&&(this.lastPlacementChangeTime=i?i.lastPlacementChangeTime:e)}updateLayerOpacities(e,i){const s={};for(const l of i){const h=l.getBucket(e);h&&l.latestFeatureIndex&&e.id===h.layerIds[0]&&this.updateBucketOpacities(h,l.tileID,s,l.collisionBoxArray)}}updateBucketOpacities(e,i,s,l){e.hasTextData()&&(e.text.opacityVertexArray.clear(),e.text.hasVisibleVertices=!1),e.hasIconData()&&(e.icon.opacityVertexArray.clear(),e.icon.hasVisibleVertices=!1),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexArray.clear(),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexArray.clear();const h=e.layers[0],f=h.layout,_=new Yr(null,0,!1,!1,!0),v=f.get("text-allow-overlap"),T=f.get("icon-allow-overlap"),P=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),E=f.get("text-rotation-alignment")==="map",k=f.get("text-pitch-alignment")==="map",F=f.get("icon-text-fit")!=="none",O=new Yr(null,0,v&&(T||!e.hasIconData()||f.get("icon-optional")),T&&(v||!e.hasTextData()||f.get("text-optional")),!0);!e.collisionArrays&&l&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(l);const H=(W,K,ee)=>{for(let te=0;te<K/4;te++)W.opacityVertexArray.emplaceBack(ee);W.hasVisibleVertices=W.hasVisibleVertices||ee!==xa},q=this.collisionBoxArrays.get(e.bucketInstanceId);for(let W=0;W<e.symbolInstances.length;W++){const K=e.symbolInstances.get(W),{numHorizontalGlyphVertices:ee,numVerticalGlyphVertices:te,crossTileID:re}=K;let oe=this.opacities[re];s[re]?oe=_:oe||(oe=O,this.opacities[re]=oe),s[re]=!0;const ae=K.numIconVertices>0,pe=this.placedOrientations[K.crossTileID],me=pe===o.al.vertical,Se=pe===o.al.horizontal||pe===o.al.horizontalOnly;if(ee>0||te>0){const Te=Jl(oe.text);H(e.text,ee,me?xa:Te),H(e.text,te,Se?xa:Te);const je=oe.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach(He=>{He>=0&&(e.text.placedSymbolArray.get(He).hidden=je||me?1:0)}),K.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=je||Se?1:0);const Be=this.variableOffsets[K.crossTileID];Be&&this.markUsedJustification(e,Be.anchor,K,pe);const Ee=this.placedOrientations[K.crossTileID];Ee&&(this.markUsedJustification(e,"left",K,Ee),this.markUsedOrientation(e,Ee,K))}if(ae){const Te=Jl(oe.icon),je=!(F&&K.verticalPlacedIconSymbolIndex&&me);K.placedIconSymbolIndex>=0&&(H(e.icon,K.numIconVertices,je?Te:xa),e.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=oe.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(H(e.icon,K.numVerticalIconVertices,je?xa:Te),e.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=oe.icon.isHidden())}const Ce=q&&q.has(W)?q.get(W):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const Te=e.collisionArrays[W];if(Te){let je=new o.P(0,0);if(Te.textBox||Te.verticalTextBox){let Be=!0;if(P){const Ee=this.variableOffsets[re];Ee?(je=Wl(Ee.anchor,Ee.width,Ee.height,Ee.textOffset,Ee.textBoxScale),E&&je._rotate(k?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Be=!1}if(Te.textBox||Te.verticalTextBox){let Ee;Te.textBox&&(Ee=me),Te.verticalTextBox&&(Ee=Se),Xl(e.textCollisionBox.collisionVertexArray,oe.text.placed,!Be||Ee,Ce.text,je.x,je.y)}}if(Te.iconBox||Te.verticalIconBox){const Be=!!(!Se&&Te.verticalIconBox);let Ee;Te.iconBox&&(Ee=Be),Te.verticalIconBox&&(Ee=!Be),Xl(e.iconCollisionBox.collisionVertexArray,oe.icon.placed,Ee,Ce.icon,F?je.x:0,F?je.y:0)}}}}if(e.sortFeatures(-this.transform.bearingInRadians),this.retainedQueryData[e.bucketInstanceId]&&(this.retainedQueryData[e.bucketInstanceId].featureSortOrder=e.featureSortOrder),e.hasTextData()&&e.text.opacityVertexBuffer&&e.text.opacityVertexBuffer.updateData(e.text.opacityVertexArray),e.hasIconData()&&e.icon.opacityVertexBuffer&&e.icon.opacityVertexBuffer.updateData(e.icon.opacityVertexArray),e.hasIconCollisionBoxData()&&e.iconCollisionBox.collisionVertexBuffer&&e.iconCollisionBox.collisionVertexBuffer.updateData(e.iconCollisionBox.collisionVertexArray),e.hasTextCollisionBoxData()&&e.textCollisionBox.collisionVertexBuffer&&e.textCollisionBox.collisionVertexBuffer.updateData(e.textCollisionBox.collisionVertexArray),e.text.opacityVertexArray.length!==e.text.layoutVertexArray.length/4)throw new Error(`bucket.text.opacityVertexArray.length (= ${e.text.opacityVertexArray.length}) !== bucket.text.layoutVertexArray.length (= ${e.text.layoutVertexArray.length}) / 4`);if(e.icon.opacityVertexArray.length!==e.icon.layoutVertexArray.length/4)throw new Error(`bucket.icon.opacityVertexArray.length (= ${e.icon.opacityVertexArray.length}) !== bucket.icon.layoutVertexArray.length (= ${e.icon.layoutVertexArray.length}) / 4`);e.bucketInstanceId in this.collisionCircleArrays&&(e.collisionCircleArray=this.collisionCircleArrays[e.bucketInstanceId],delete this.collisionCircleArrays[e.bucketInstanceId])}symbolFadeChange(e){return this.fadeDuration===0?1:(e-this.commitTime)/this.fadeDuration+this.prevZoomAdjustment}zoomAdjustment(e){return Math.max(0,(this.transform.zoom-e)/1.5)}hasTransitions(e){return this.stale||e-this.lastPlacementChangeTime<this.fadeDuration}stillRecent(e,i){const s=this.zoomAtLastRecencyCheck===i?1-this.zoomAdjustment(i):1;return this.zoomAtLastRecencyCheck=i,this.commitTime+this.fadeDuration*s>e}setStale(){this.stale=!0}}function Xl(u,e,i,s,l,h){s&&s.length!==0||(s=[0,0,0,0]);const f=s[0]-$i,_=s[1]-$i,v=s[2]-$i,T=s[3]-$i;u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,v,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,v,T),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,T)}const Zd=Math.pow(2,25),Vd=Math.pow(2,24),Ud=Math.pow(2,17),th=Math.pow(2,16),ih=Math.pow(2,9),Kl=Math.pow(2,8),Yl=Math.pow(2,1);function Jl(u){if(u.opacity===0&&!u.placed)return 0;if(u.opacity===1&&u.placed)return 4294967295;const e=u.placed?1:0,i=Math.floor(127*u.opacity);return i*Zd+e*Vd+i*Ud+e*th+i*ih+e*Kl+i*Yl+e}const xa=0;class Ql{constructor(e){this._sortAcrossTiles=e.layout.get("symbol-z-order")!=="viewport-y"&&!e.layout.get("symbol-sort-key").isConstant(),this._currentTileIndex=0,this._currentPartIndex=0,this._seenCrossTileIDs={},this._bucketParts=[]}continuePlacement(e,i,s,l,h){const f=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(f,l,e[this._currentTileIndex],this._sortAcrossTiles),this._currentTileIndex++,h())return!0;for(this._sortAcrossTiles&&(this._sortAcrossTiles=!1,f.sort((_,v)=>_.sortKey-v.sortKey));this._currentPartIndex<f.length;)if(i.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,h())return!0;return!1}}class So{constructor(e,i,s,l,h,f,_,v){this.placement=new Ua(e,i,f,_,v),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(e,i,s){const l=ve.now(),h=()=>!this._forceFullPlacement&&ve.now()-l>2;for(;this._currentPlacementIndex>=0;){const f=i[e[this._currentPlacementIndex]],_=this.placement.collisionIndex.transform.zoom;if(f.type==="symbol"&&(!f.minzoom||f.minzoom<=_)&&(!f.maxzoom||f.maxzoom>_)){if(this._inProgressLayer||(this._inProgressLayer=new Ql(f)),this._inProgressLayer.continuePlacement(s[f.source],this.placement,this._showCollisionBoxes,f,h))return;delete this._inProgressLayer}this._currentPlacementIndex--}this._done=!0}commit(e){return this.placement.commit(e),this.placement}}const $a=512/o.Z/2;class Ga{constructor(e,i,s){this.tileID=e,this.bucketInstanceId=s,this._symbolsByKey={};const l=new Map;for(let h=0;h<i.length;h++){const f=i.get(h),_=f.key,v=l.get(_);v?v.push(f):l.set(_,[f])}for(const[h,f]of l){const _={positions:f.map(v=>({x:Math.floor(v.anchorX*$a),y:Math.floor(v.anchorY*$a)})),crossTileIDs:f.map(v=>v.crossTileID)};if(_.positions.length>128){const v=new o.aF(_.positions.length,16,Uint16Array);for(const{x:T,y:P}of _.positions)v.add(T,P);v.finish(),delete _.positions,_.index=v}this._symbolsByKey[h]=_}}getScaledCoordinates(e,i){const{x:s,y:l,z:h}=this.tileID.canonical,{x:f,y:_,z:v}=i.canonical,T=$a/Math.pow(2,v-h),P=(_*o.Z+e.anchorY)*T,E=l*o.Z*$a;return{x:Math.floor((f*o.Z+e.anchorX)*T-s*o.Z*$a),y:Math.floor(P-E)}}findMatches(e,i,s){const l=this.tileID.canonical.z<i.canonical.z?1:Math.pow(2,this.tileID.canonical.z-i.canonical.z);for(let h=0;h<e.length;h++){const f=e.get(h);if(f.crossTileID)continue;const _=this._symbolsByKey[f.key];if(!_)continue;const v=this.getScaledCoordinates(f,i);if(_.index){const T=_.index.range(v.x-l,v.y-l,v.x+l,v.y+l).sort();for(const P of T){const E=_.crossTileIDs[P];if(!s[E]){s[E]=!0,f.crossTileID=E;break}}}else if(_.positions)for(let T=0;T<_.positions.length;T++){const P=_.positions[T],E=_.crossTileIDs[T];if(Math.abs(P.x-v.x)<=l&&Math.abs(P.y-v.y)<=l&&!s[E]){s[E]=!0,f.crossTileID=E;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class rh{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class $d{constructor(){this.indexes={},this.usedCrossTileIDs={},this.lng=0}handleWrapJump(e){const i=Math.round((e-this.lng)/360);if(i!==0)for(const s in this.indexes){const l=this.indexes[s],h={};for(const f in l){const _=l[f];_.tileID=_.tileID.unwrapTo(_.tileID.wrap+i),h[_.tileID.key]=_}this.indexes[s]=h}this.lng=e}addBucket(e,i,s){if(this.indexes[e.overscaledZ]&&this.indexes[e.overscaledZ][e.key]){if(this.indexes[e.overscaledZ][e.key].bucketInstanceId===i.bucketInstanceId)return!1;this.removeBucketCrossTileIDs(e.overscaledZ,this.indexes[e.overscaledZ][e.key])}for(let h=0;h<i.symbolInstances.length;h++)i.symbolInstances.get(h).crossTileID=0;this.usedCrossTileIDs[e.overscaledZ]||(this.usedCrossTileIDs[e.overscaledZ]={});const l=this.usedCrossTileIDs[e.overscaledZ];for(const h in this.indexes){const f=this.indexes[h];if(Number(h)>e.overscaledZ)for(const _ in f){const v=f[_];v.tileID.isChildOf(e)&&v.findMatches(i.symbolInstances,e,l)}else{const _=f[e.scaledTo(Number(h)).key];_&&_.findMatches(i.symbolInstances,e,l)}}for(let h=0;h<i.symbolInstances.length;h++){const f=i.symbolInstances.get(h);f.crossTileID||(f.crossTileID=s.generate(),l[f.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Ga(e,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(e,i){for(const s of i.getCrossTileIDsLists())for(const l of s)delete this.usedCrossTileIDs[e][l]}removeStaleBuckets(e){let i=!1;for(const s in this.indexes){const l=this.indexes[s];for(const h in l)e[l[h].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,l[h]),delete l[h],i=!0)}return i}}class In{constructor(){this.layerIndexes={},this.crossTileIDs=new rh,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,s){let l=this.layerIndexes[e.id];l===void 0&&(l=this.layerIndexes[e.id]=new $d);let h=!1;const f={};l.handleWrapJump(s);for(const _ of i){const v=_.getBucket(e);v&&e.id===v.layerIds[0]&&(v.bucketInstanceId||(v.bucketInstanceId=++this.maxBucketInstanceId),l.addBucket(_.tileID,v,this.crossTileIDs)&&(h=!0),f[v.bucketInstanceId]=!0)}return l.removeStaleBuckets(f)&&(h=!0),h}pruneUnusedLayers(e){const i={};e.forEach(s=>{i[s]=!0});for(const s in this.layerIndexes)i[s]||delete this.layerIndexes[s]}}var qa="void main() {fragColor=vec4(1.0);}";const gt={prelude:St(`#ifdef GL_ES
7
7
  precision mediump float;
8
8
  #else
9
9
  #if !defined(lowp)
@@ -726,4 +726,4 @@ uniform ${P} ${E} u_${k};
726
726
  `),re=ee.concat(gt.prelude.vertexSource,_.vertexSource,i.vertexSource).join(`
727
727
  `);Jr(T)||(te=function(me){return me.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(te),re=function(me){return me.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(re));const oe=T.createShader(T.FRAGMENT_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(oe,te),T.compileShader(oe),!T.getShaderParameter(oe,T.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${T.getShaderInfoLog(oe)}`);T.attachShader(this.program,oe);const ae=T.createShader(T.VERTEX_SHADER);if(T.isContextLost())return void(this.failedToCreate=!0);if(T.shaderSource(ae,re),T.compileShader(ae),!T.getShaderParameter(ae,T.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${T.getShaderInfoLog(ae)}`);T.attachShader(this.program,ae),this.attributes={};const pe={};this.numAttributes=k.length;for(let me=0;me<this.numAttributes;me++)k[me]&&(T.bindAttribLocation(this.program,me,k[me]),this.attributes[k[me]]=me);if(T.linkProgram(this.program),!T.getProgramParameter(this.program,T.LINK_STATUS))throw new Error(`Program failed to link: ${T.getProgramInfoLog(this.program)}`);T.deleteShader(ae),T.deleteShader(oe);for(let me=0;me<K.length;me++){const Se=K[me];if(Se&&!pe[Se]){const Ce=T.getUniformLocation(this.program,Se);Ce&&(pe[Se]=Ce)}}this.fixedUniforms=l(e,pe),this.terrainUniforms=((me,Se)=>({u_depth:new o.bH(me,Se.u_depth),u_terrain:new o.bH(me,Se.u_terrain),u_terrain_dim:new o.b8(me,Se.u_terrain_dim),u_terrain_matrix:new o.bJ(me,Se.u_terrain_matrix),u_terrain_unpack:new o.bK(me,Se.u_terrain_unpack),u_terrain_exaggeration:new o.b8(me,Se.u_terrain_exaggeration)}))(e,pe),this.projectionUniforms=((me,Se)=>({u_projection_matrix:new o.bJ(me,Se.u_projection_matrix),u_projection_tile_mercator_coords:new o.bK(me,Se.u_projection_tile_mercator_coords),u_projection_clipping_plane:new o.bK(me,Se.u_projection_clipping_plane),u_projection_transition:new o.b8(me,Se.u_projection_transition),u_projection_fallback_matrix:new o.bJ(me,Se.u_projection_fallback_matrix)}))(e,pe),this.binderUniforms=s?s.getUniforms(e,pe):[]}draw(e,i,s,l,h,f,_,v,T,P,E,k,F,O,H,q,W,K,ee){const te=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(s),e.setStencilMode(l),e.setColorMode(h),e.setCullFace(f),v){e.activeTexture.set(te.TEXTURE2),te.bindTexture(te.TEXTURE_2D,v.depthTexture),e.activeTexture.set(te.TEXTURE3),te.bindTexture(te.TEXTURE_2D,v.texture);for(const oe in this.terrainUniforms)this.terrainUniforms[oe].set(v[oe])}if(T)for(const oe in T)this.projectionUniforms[nc[oe]].set(T[oe]);if(_)for(const oe in this.fixedUniforms)this.fixedUniforms[oe].set(_[oe]);q&&q.setUniforms(e,this.binderUniforms,O,{zoom:H});let re=0;switch(i){case te.LINES:re=2;break;case te.TRIANGLES:re=3;break;case te.LINE_STRIP:re=1}for(const oe of F.get()){const ae=oe.vaos||(oe.vaos={});(ae[P]||(ae[P]=new fn)).bind(e,this,E,q?q.getPaintVertexBuffers():[],k,oe.vertexOffset,W,K,ee),te.drawElements(i,oe.primitiveLength*re,te.UNSIGNED_SHORT,oe.primitiveOffset*re*2)}}}function ah(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 Ls=(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 v=u.transform.transformLightDirection(f),T=l.properties.get("color");return{u_lightpos:f,u_lightpos_globe:v,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}},Hd=(u,e,i,s,l,h,f)=>o.e(Ls(u,e,i,s),ah(h,u,f),{u_height_factor:-Math.pow(2,l.overscaledZ)/f.tileSize/8}),va=(u,e,i,s)=>o.e(ah(e,u,i),{u_fill_translate:s}),Wd=(u,e)=>({u_world:u,u_fill_translate:e}),sh=(u,e,i,s,l)=>o.e(va(u,e,i,l),{u_world:s}),Xd=(u,e,i,s,l)=>{const h=u.transform;let f,_,v=0;if(i.paint.get("circle-pitch-alignment")==="map"){const T=o.az(e,1,h.zoom);f=!0,_=[T,T],v=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:v,u_translate:s}},oh=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),ac=u=>({u_viewport_size:[u.width,u.height]}),sc=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),oc=(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}},lc=(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")}},lh=(u,e,i)=>{const s=i.paint.get("hillshade-shadow-color"),l=i.paint.get("hillshade-highlight-color"),h=i.paint.get("hillshade-accent-color");let f=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);return i.paint.get("hillshade-illumination-anchor")==="viewport"&&(f+=u.transform.bearingInRadians),{u_image:0,u_latrange:ch(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),f],u_shadow:s,u_highlight:l,u_accent:h}},ba=(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 ch(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 Lo=(u,e,i,s)=>{const l=u.transform;return{u_translation:hh(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]]}},Bs=(u,e,i,s,l)=>o.e(Lo(u,e,i,s),{u_image:0,u_image_height:l}),Kd=(u,e,i,s,l)=>{const h=u.transform,f=uh(e,h);return{u_translation:hh(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]]}},Bo=(u,e,i,s,l,h)=>{const f=u.lineAtlas,_=uh(e,u.transform),v=i.layout.get("line-cap")==="round",T=f.getDash(l.from,v),P=f.getDash(l.to,v),E=T.width*h.fromScale,k=P.width*h.toScale;return o.e(Lo(u,e,i,s),{u_patternscale_a:[_/E,-T.height/2],u_patternscale_b:[_/k,-P.height/2],u_sdfgamma:f.width/(256*Math.min(E,k)*u.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:P.y,u_mix:h.t})};function uh(u,e){return 1/o.az(u,1,e.tileZoom)}function hh(u,e,i){return o.aA(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const dh=(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:ph(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 ph(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 cc=(u,e,i,s,l,h,f,_,v,T,P,E,k)=>{const F=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:F.cameraToCenterDistance,u_pitch:F.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:F.width/F.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:v,u_is_text:+P,u_pitch_with_map:+s,u_is_along_line:l,u_is_variable_anchor:h,u_texsize:E,u_texture:0,u_translation:T,u_pitched_scale:k}},Fo=(u,e,i,s,l,h,f,_,v,T,P,E,k,F)=>{const O=f.transform;return o.e(cc(u,e,i,s,l,h,f,_,v,T,P,E,F),{u_gamma_scale:s?Math.cos(O.pitch*Math.PI/180)*O.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},fh=(u,e,i,s,l,h,f,_,v,T,P,E,k)=>o.e(Fo(u,e,i,s,l,h,f,_,v,T,!0,P,0,k),{u_texsize_icon:E,u_texture_icon:1}),Oo=(u,e)=>({u_opacity:u,u_color:e}),En=(u,e,i,s,l)=>o.e(function(h,f,_,v){const T=_.imageManager.getPattern(h.from.toString()),P=_.imageManager.getPattern(h.to.toString()),{width:E,height:k}=_.imageManager.getPixelSize(),F=Math.pow(2,v.tileID.overscaledZ),O=v.tileSize*Math.pow(2,_.transform.tileZoom)/F,H=O*(v.tileID.canonical.x+v.tileID.wrap*F),q=O*v.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:[E,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(v,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}),jo=(u,e)=>{},uc={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:jo,clippingMask:jo,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_light:new o.bM(u,e.u_light),u_shadow:new o.bI(u,e.u_shadow),u_highlight:new o.bI(u,e.u_highlight),u_accent:new o.bI(u,e.u_accent)}),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 hc{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 mh={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class dc{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[mh[h.type]],!1,this.itemSize,h.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class Mt{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 pc extends Mt{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 Yd extends Mt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Jd extends Mt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Qd extends Mt{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 ep extends Mt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class gh extends Mt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class tp extends Mt{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 _h extends Mt{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 No extends Mt{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 Zo extends Mt{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 Vo extends Mt{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 fc extends Mt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class wa extends Mt{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 ts extends Mt{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 $r extends Mt{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 yh extends Mt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class xh extends Mt{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 mc extends Mt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Ta extends Mt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class Uo extends Mt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class $o extends Mt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class Fs extends Mt{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 Go extends Mt{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 vh extends Mt{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 is extends Mt{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 rs extends Mt{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 bh extends Mt{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class gc extends Mt{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const s=this.gl;Jr(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 At extends Mt{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 qo extends Mt{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 ip extends Mt{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 Ho extends Mt{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class Os extends Ho{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 rp extends Ho{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 np extends Ho{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 _c="Framebuffer is not complete";class ap{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 Os(e,_),l)this.depthAttachment=h?new np(e,_):new rp(e,_);else if(h)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(_c)}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 yc{constructor(e){var i,s;if(this.gl=e,this.clearColor=new pc(this),this.clearDepth=new Yd(this),this.clearStencil=new Jd(this),this.colorMask=new Qd(this),this.depthMask=new ep(this),this.stencilMask=new gh(this),this.stencilFunc=new tp(this),this.stencilOp=new _h(this),this.stencilTest=new No(this),this.depthRange=new Zo(this),this.depthTest=new Vo(this),this.depthFunc=new fc(this),this.blend=new wa(this),this.blendFunc=new ts(this),this.blendColor=new $r(this),this.blendEquation=new yh(this),this.cullFace=new xh(this),this.cullFaceSide=new mc(this),this.frontFace=new Ta(this),this.program=new Uo(this),this.activeTexture=new $o(this),this.viewport=new Fs(this),this.bindFramebuffer=new Go(this),this.bindRenderbuffer=new vh(this),this.bindTexture=new is(this),this.bindVertexBuffer=new rs(this),this.bindElementBuffer=new bh(this),this.bindVertexArray=new gc(this),this.pixelStoreUnpack=new At(this),this.pixelStoreUnpackPremultiplyAlpha=new qo(this),this.pixelStoreUnpackFlipY=new ip(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),Jr(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 hc(this,e,i)}createVertexBuffer(e,i,s){return new dc(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 ap(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,Nt.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 Jr(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 Jr(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 Ma;function js(u,e,i,s,l){const h=u.context,f=u.transform,_=h.gl,v=u.useProgram("collisionBox"),T=[];let P=0,E=0;for(let W=0;W<s.length;W++){const K=s[W],ee=e.getTile(K).getBucket(i);if(!ee)continue;const te=l?ee.textCollisionBox:ee.iconCollisionBox,re=ee.collisionCircleArray;re.length>0&&(T.push({circleArray:re,circleOffset:E,coord:K}),P+=re.length/4,E=P),te&&v.draw(h,_.LINES,pt.disabled,Pt.disabled,u.colorModeForRenderPass(),zt.disabled,oh(u.transform),u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),f.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,te.layoutVertexBuffer,te.indexBuffer,te.segments,null,u.transform.zoom,null,null,te.collisionVertexBuffer)}if(!l||!T.length)return;const k=u.useProgram("collisionCircle"),F=new o.bR;F.resize(4*P),F._trim();let O=0;for(const W of T)for(let K=0;K<W.circleArray.length/4;K++){const ee=4*K,te=W.circleArray[ee+0],re=W.circleArray[ee+1],oe=W.circleArray[ee+2],ae=W.circleArray[ee+3];F.emplace(O++,te,re,oe,ae,0),F.emplace(O++,te,re,oe,ae,1),F.emplace(O++,te,re,oe,ae,2),F.emplace(O++,te,re,oe,ae,3)}(!Ma||Ma.length<2*P)&&(Ma=function(W){const K=2*W,ee=new o.bT;ee.resize(K),ee._trim();for(let te=0;te<K;te++){const re=6*te;ee.uint16[re+0]=4*te+0,ee.uint16[re+1]=4*te+1,ee.uint16[re+2]=4*te+2,ee.uint16[re+3]=4*te+2,ee.uint16[re+4]=4*te+3,ee.uint16[re+5]=4*te+0}return ee}(P));const H=h.createIndexBuffer(Ma,!0),q=h.createVertexBuffer(F,o.bS.members,!0);for(const W of T){const K=ac(u.transform);k.draw(h,_.TRIANGLES,pt.disabled,Pt.disabled,u.colorModeForRenderPass(),zt.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 xc=o.ad(new Float32Array(16));function vc(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 wh(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 v=f.add(_);return at(v.x,v.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const _=ci(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(u),v=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(s.rotate(v))}return u.add(s)}function Wo(u,e,i,s,l,h,f,_,v,T,P,E){const k=u.text.placedSymbolArray,F=u.text.dynamicLayoutVertexArray,O=u.icon.dynamicLayoutVertexArray,H={};F.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 ee=new o.P(W.anchorX,W.anchorY),te={getElevation:E,width:l.width,height:l.height,pitchedLabelPlaneMatrix:h,pitchWithMap:i,transform:l,tileAnchorPoint:ee,translation:T,unwrappedTileID:P},re=i?ws(ee.x,ee.y,te):ci(ee.x,ee.y,te),oe=Ct(l.cameraToCenterDistance,re.signedDistanceFromCamera);let ae=o.am(u.textSizeData,_,W)*oe/o.ay;i&&(ae*=u.tilePixelRatio/f);const{width:pe,height:me,anchor:Se,textOffset:Ce,textBoxScale:Te}=K,je=vc(Se,pe,me,Ce,Te,ae),Be=l.getPitchedTextCorrection(ee.x+T[0],ee.y+T[1],P),Ee=wh(re.point,te,e,je,-l.bearingInRadians,Be),He=u.allowVerticalPlacement&&W.placedOrientation===o.al.vertical?Math.PI/2:0;for(let ft=0;ft<W.numGlyphs;ft++)o.as(F,Ee,He);v&&W.associatedIconIndex>=0&&(H[W.associatedIconIndex]={shiftedAnchor:Ee,angle:He})}else Ui(W.numGlyphs,F)}if(v){O.clear();const q=u.icon.placedSymbolArray;for(let W=0;W<q.length;W++){const K=q.get(W);if(K.hidden)Ui(K.numGlyphs,O);else{const ee=H[W];if(ee)for(let te=0;te<K.numGlyphs;te++)o.as(O,ee.shiftedAnchor,ee.angle);else Ui(K.numGlyphs,O)}}u.icon.dynamicLayoutVertexBuffer.updateData(O)}u.text.dynamicLayoutVertexBuffer.updateData(F)}function Xo(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Ko(u,e,i,s,l,h,f,_,v,T,P,E,k){const F=u.context,O=F.gl,H=u.transform,q=_==="map",W=v==="map",K=_!=="viewport"&&i.layout.get("symbol-placement")!=="point",ee=q&&!W&&!K,te=!i.layout.get("symbol-sort-key").isConstant();let re=!1;const oe=u.getDepthModeForSublayer(0,pt.ReadOnly),ae=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),pe=[],me=H.getCircleRadiusCorrection();for(const Se of s){const Ce=e.getTile(Se),Te=Ce.getBucket(i);if(!Te)continue;const je=l?Te.text:Te.icon;if(!je||!je.segments.get().length||!je.hasVisibleVertices)continue;const Be=je.programConfigurations.get(i.id),Ee=l||Te.sdfIcons,He=l?Te.textSizeData:Te.iconSizeData,ft=W||H.pitch!==0,st=u.useProgram(Xo(Ee,l,Te),Be),ui=o.ak(He,H.zoom),Ut=u.style.map.terrain&&u.style.map.terrain.getTerrainData(Se);let hi,ii,Ht,Zt,Gi=[0,0],Bi=null;if(l)ii=Ce.glyphAtlasTexture,Ht=O.LINEAR,hi=Ce.glyphAtlasTexture.size,Te.iconsInText&&(Gi=Ce.imageAtlasTexture.size,Bi=Ce.imageAtlasTexture,Zt=ft||u.options.rotating||u.options.zooming||He.kind==="composite"||He.kind==="camera"?O.LINEAR:O.NEAREST);else{const mi=i.layout.get("icon-size").constantOr(0)!==1||Te.iconsNeedLinear;ii=Ce.imageAtlasTexture,Ht=Ee||u.options.rotating||u.options.zooming||mi||ft?O.LINEAR:O.NEAREST,hi=Ce.imageAtlasTexture.size}const Ji=o.az(Ce,1,u.transform.zoom),lr=rt(q,u.transform,Ji),xn=o.K();o.an(xn,lr);const ia=dt(W,q,u.transform,Ji),Rn=o.aA(H,Ce,h,f),Dn=H.getProjectionData({overscaledTileID:Se,applyGlobeMatrix:!k,applyTerrainMatrix:!0}),vn=ae&&Te.hasTextData(),ka=i.layout.get("icon-text-fit")!=="none"&&vn&&Te.hasIconData();if(K){const mi=u.style.map.terrain?(Pi,di)=>u.style.map.terrain.getElevation(Se,Pi,di):null,ri=i.layout.get("text-rotation-alignment")==="map";It(Te,u,l,lr,xn,W,T,ri,Se.toUnwrapped(),H.width,H.height,Rn,mi)}const za=l&&ae||ka,Dr=K||za?xc:W?lr:u.transform.clipSpaceToPixelsMatrix,ra=Ee&&i.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Ln;Ln=Ee?Te.iconsInText?fh(He.kind,ui,ee,W,K,za,u,Dr,ia,Rn,hi,Gi,me):Fo(He.kind,ui,ee,W,K,za,u,Dr,ia,Rn,l,hi,0,me):cc(He.kind,ui,ee,W,K,za,u,Dr,ia,Rn,l,hi,me);const Bn={program:st,buffers:je,uniformValues:Ln,projectionData:Dn,atlasTexture:ii,atlasTextureIcon:Bi,atlasInterpolation:Ht,atlasInterpolationIcon:Zt,isSDF:Ee,hasHalo:ra};if(te&&Te.canOverlap){re=!0;const mi=je.segments.get();for(const ri of mi)pe.push({segments:new o.aJ([ri]),sortKey:ri.sortKey,state:Bn,terrainData:Ut})}else pe.push({segments:je.segments,sortKey:0,state:Bn,terrainData:Ut})}re&&pe.sort((Se,Ce)=>Se.sortKey-Ce.sortKey);for(const Se of pe){const Ce=Se.state;if(F.activeTexture.set(O.TEXTURE0),Ce.atlasTexture.bind(Ce.atlasInterpolation,O.CLAMP_TO_EDGE),Ce.atlasTextureIcon&&(F.activeTexture.set(O.TEXTURE1),Ce.atlasTextureIcon&&Ce.atlasTextureIcon.bind(Ce.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),Ce.isSDF){const Te=Ce.uniformValues;Ce.hasHalo&&(Te.u_is_halo=1,Th(Ce.buffers,Se.segments,i,u,Ce.program,oe,P,E,Te,Ce.projectionData,Se.terrainData)),Te.u_is_halo=0}Th(Ce.buffers,Se.segments,i,u,Ce.program,oe,P,E,Ce.uniformValues,Ce.projectionData,Se.terrainData)}}function Th(u,e,i,s,l,h,f,_,v,T,P){const E=s.context;l.draw(E,E.gl.TRIANGLES,h,f,_,zt.backCCW,v,P,T,i.id,u.layoutVertexBuffer,u.indexBuffer,e,i.paint,s.transform.zoom,u.programConfigurations.get(i.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function bc(u,e,i,s,l){const h=u.context,f=h.gl,_=Pt.disabled,v=new Nt([f.ONE,f.ONE],o.b7.transparent,[!0,!0,!0,!0]),T=e.getBucket(i);if(!T)return;const P=s.key;let E=i.heatmapFbos.get(P);E||(E=wc(h,e.tileSize,e.tileSize),i.heatmapFbos.set(P,E)),h.bindFramebuffer.set(E.framebuffer),h.viewport.set([0,0,e.tileSize,e.tileSize]),h.clear({color:o.b7.transparent});const k=T.programConfigurations.get(i.id),F=u.useProgram("heatmap",k,!l),O=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),H=u.style.map.terrain.getTerrainData(s);F.draw(h,f.TRIANGLES,pt.disabled,_,v,zt.disabled,oc(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 sp(u,e,i,s,l){const h=u.context,f=h.gl,_=u.transform;h.setColorMode(u.colorModeForRenderPass());const v=Ns(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),v.bind(f.LINEAR,f.CLAMP_TO_EDGE);const E=_.getProjectionData({overscaledTileID:i,applyTerrainMatrix:l,applyGlobeMatrix:!s});u.useProgram("heatmapTexture").draw(h,f.TRIANGLES,pt.disabled,Pt.disabled,u.colorModeForRenderPass(),zt.disabled,lc(u,e,0,1),null,E,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,_.zoom),P.destroy(),e.heatmapFbos.delete(T)}function wc(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,v=(l=u.RGBA16F)!==null&&l!==void 0?l:h.RGBA;h.texImage2D(h.TEXTURE_2D,0,v,e,i,0,h.RGBA,_,null);const T=u.createFramebuffer(e,i,!1,!1);return T.colorAttachment.set(f),T}function Ns(u,e){return e.colorRampTexture||(e.colorRampTexture=new jt(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function Yo(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 v=l.getPaintProperty(e);f=h[v],_=h[v]}f&&_&&u.setConstantPatternPositions(f,_)}function Tc(u,e,i,s,l,h,f,_){const v=u.context.gl,T="fill-pattern",P=i.paint.get(T),E=P&&P.constantOr(1),k=i.getCrossfadeParameters();let F,O,H,q,W;const K=u.transform,ee=i.paint.get("fill-translate"),te=i.paint.get("fill-translate-anchor");f?(O=E&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",F=v.LINES):(O=E?"fillPattern":"fill",F=v.TRIANGLES);const re=P.constantOr(null);for(const oe of s){const ae=e.getTile(oe);if(E&&!ae.patternsLoaded())continue;const pe=ae.getBucket(i);if(!pe)continue;const me=pe.programConfigurations.get(i.id),Se=u.useProgram(O,me),Ce=u.style.map.terrain&&u.style.map.terrain.getTerrainData(oe);E&&(u.context.activeTexture.set(v.TEXTURE0),ae.imageAtlasTexture.bind(v.LINEAR,v.CLAMP_TO_EDGE),me.updatePaintBuffers(k)),Yo(me,T,re,ae,i);const Te=K.getProjectionData({overscaledTileID:oe,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),je=o.aA(K,ae,ee,te);if(f){q=pe.indexBuffer2,W=pe.segments2;const Ee=[v.drawingBufferWidth,v.drawingBufferHeight];H=O==="fillOutlinePattern"&&E?sh(u,k,ae,Ee,je):Wd(Ee,je)}else q=pe.indexBuffer,W=pe.segments,H=E?va(u,k,ae,je):{u_fill_translate:je};let Be;if(u.renderPass==="translucent"&&_){const[Ee]=u.getStencilConfigForOverlapAndUpdateStencilID(s);Be=Ee[oe.overscaledZ]}else Be=u.stencilModeForClipping(oe);Se.draw(u.context,F,l,Be,h,zt.backCCW,H,Ce,Te,i.id,pe.layoutVertexBuffer,q,W,i.paint,u.transform.zoom,me)}}function Jo(u,e,i,s,l,h,f,_){const v=u.context,T=v.gl,P="fill-extrusion-pattern",E=i.paint.get(P),k=E.constantOr(1),F=i.getCrossfadeParameters(),O=i.paint.get("fill-extrusion-opacity"),H=E.constantOr(null),q=u.transform;for(const W of s){const K=e.getTile(W),ee=K.getBucket(i);if(!ee)continue;const te=u.style.map.terrain&&u.style.map.terrain.getTerrainData(W),re=ee.programConfigurations.get(i.id),oe=u.useProgram(k?"fillExtrusionPattern":"fillExtrusion",re);k&&(u.context.activeTexture.set(T.TEXTURE0),K.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),re.updatePaintBuffers(F));const ae=q.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!_,applyTerrainMatrix:!0});Yo(re,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"),Se=k?Hd(u,me,O,pe,W,F,K):Ls(u,me,O,pe);oe.draw(v,v.gl.TRIANGLES,l,h,f,zt.backCCW,Se,te,ae,i.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,i.paint,u.transform.zoom,re,u.style.map.terrain&&ee.centroidVertexBuffer)}}function ns(u,e,i,s,l,h,f,_,v){var T;const P=u.style.projection,E=u.context,k=u.transform,F=E.gl,O=u.useProgram("hillshade"),H=!u.options.moving;for(const q of s){const W=e.getTile(q),K=W.fbo;if(!K)continue;const ee=P.getMeshFromTileID(E,q.canonical,_,!0,"raster"),te=(T=u.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(q);E.activeTexture.set(F.TEXTURE0),F.bindTexture(F.TEXTURE_2D,K.colorAttachment.get());const re=k.getProjectionData({overscaledTileID:q,aligned:H,applyGlobeMatrix:!v,applyTerrainMatrix:!0});O.draw(E,F.TRIANGLES,h,l[q.overscaledZ],f,zt.backCCW,lh(u,W,i),te,re,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 Qo(u,e,i,s,l,h,f,_,v=!1,T=!1){const P=s[s.length-1].overscaledZ,E=u.context,k=E.gl,F=u.useProgram("raster"),O=u.transform,H=u.style.projection,q=u.colorModeForRenderPass(),W=!u.options.moving;for(const K of s){const ee=u.getDepthModeForSublayer(K.overscaledZ-P,i.paint.get("raster-opacity")===1?pt.ReadWrite:pt.ReadOnly,k.LESS),te=e.getTile(K);te.registerFadeDuration(i.paint.get("raster-fade-duration"));const re=e.findLoadedParent(K,0),oe=e.findLoadedSibling(K),ae=Mh(te,re||oe||null,e,i,u.transform,u.style.map.terrain);let pe,me;const Se=i.paint.get("raster-resampling")==="nearest"?k.NEAREST:k.LINEAR;E.activeTexture.set(k.TEXTURE0),te.texture.bind(Se,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),E.activeTexture.set(k.TEXTURE1),re?(re.texture.bind(Se,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),pe=Math.pow(2,re.tileID.overscaledZ-te.tileID.overscaledZ),me=[te.tileID.canonical.x*pe%1,te.tileID.canonical.y*pe%1]):te.texture.bind(Se,k.CLAMP_TO_EDGE,k.LINEAR_MIPMAP_NEAREST),te.texture.useMipmap&&E.extTextureFilterAnisotropic&&u.transform.pitch>20&&k.texParameterf(k.TEXTURE_2D,E.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,E.extTextureFilterAnisotropicMax);const Ce=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),Te=O.getProjectionData({overscaledTileID:K,aligned:W,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),je=dh(me||[0,0],pe||1,ae,i,_),Be=H.getMeshFromTileID(E,K.canonical,h,f,"raster");F.draw(E,k.TRIANGLES,ee,l?l[K.overscaledZ]:Pt.disabled,q,v?zt.frontCCW:zt.backCCW,je,Ce,Te,i.id,Be.vertexBuffer,Be.indexBuffer,Be.segments)}}function Mh(u,e,i,s,l,h){const f=s.paint.get("raster-fade-duration");if(!h&&f>0){const _=ve.now(),v=(_-u.timeAdded)/f,T=e?(_-e.timeAdded)/f:-1,P=i.getSource(),E=ge(l,{tileSize:P.tileSize,roundZoom:P.roundZoom}),k=!e||Math.abs(e.tileID.overscaledZ-E)>Math.abs(u.tileID.overscaledZ-E),F=k&&u.refreshedUponExpiration?1:o.ae(k?v:1-T,0,1);return u.refreshedUponExpiration&&v>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const Si=new o.b7(1,0,0,1),Sa=new o.b7(0,1,0,1),Gr=new o.b7(0,0,1,1),Mc=new o.b7(1,0,1,1),Sc=new o.b7(0,1,1,1);function Pc(u,e,i,s){Qn(u,0,e+i/2,u.transform.width,i,s)}function Pa(u,e,i,s){Qn(u,e-i/2,0,i,u.transform.height,s)}function Qn(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 Cc(u,e,i){const s=u.context,l=s.gl,h=u.useProgram("debug"),f=pt.disabled,_=Pt.disabled,v=u.colorModeForRenderPass(),T="$debug",P=u.style.map.terrain&&u.style.map.terrain.getTerrainData(i);s.activeTexture.set(l.TEXTURE0);const E=e.getTileByID(i.key).latestRawTileData,k=Math.floor((E&&E.byteLength||0)/1024),F=e.getTile(i).tileSize,O=512/Math.min(F,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 ee=W.debugOverlayCanvas,te=W.context.gl,re=W.debugOverlayCanvas.getContext("2d");re.clearRect(0,0,ee.width,ee.height),re.shadowColor="white",re.shadowBlur=2,re.lineWidth=1.5,re.strokeStyle="white",re.textBaseline="top",re.font="bold 36px Open Sans, sans-serif",re.fillText(K,5,5),re.strokeText(K,5,5),W.debugOverlayTexture.update(ee),W.debugOverlayTexture.bind(te.LINEAR,te.CLAMP_TO_EDGE)}(u,`${H} ${k}kB`);const q=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(s,l.TRIANGLES,f,_,Nt.alphaBlended,zt.disabled,sc(o.b7.transparent,O),null,q,T,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(s,l.LINE_STRIP,f,_,v,zt.disabled,sc(o.b7.red),P,q,T,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function Ic(u,e,i,s){const{isRenderingGlobe:l}=s,h=u.context,f=h.gl,_=u.transform,v=u.colorModeForRenderPass(),T=u.getDepthModeFor3D(),P=u.useProgram("terrain");h.bindFramebuffer.set(null),h.viewport.set([0,0,u.width,u.height]);for(const E of i){const k=e.getTerrainMesh(E.tileID),F=u.renderToTexture.getTexture(E),O=e.getTerrainData(E.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,F.texture);const H=e.getMeshFrameDelta(_.zoom),q=_.calculateFogMatrix(E.tileID.toUnwrapped()),W=qd(H,q,u.style.sky,_.pitch,l),K=_.getProjectionData({overscaledTileID:E.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});P.draw(h,f.TRIANGLES,T,Pt.disabled,v,zt.backCCW,W,O,K,"terrain",k.vertexBuffer,k.indexBuffer,k.segments)}}function Ec(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 Ha(u.createVertexBuffer(i,dn.members),u.createIndexBuffer(s),o.aJ.simpleSegment(0,0,i.length,s.length))}return e.mesh}class Sh{constructor(e,i){this.context=new yc(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:o.ad(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=ye.maxUnderzooming+ye.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new In}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,dn.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,dn.members),this.debugSegments=o.aJ.simpleSegment(0,0,4,5);const l=new o.bY;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,rc.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,dn.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,dn.members),this.viewportSegments=o.aJ.simpleSegment(0,0,4,2);const _=new o.bZ;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const v=new o.aK;v.emplaceBack(1,0,2),v.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(v);const T=this.context.gl;this.stencilClearMode=new Pt({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO),this.tileExtentMesh=new Ha(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,pt.disabled,this.stencilClearMode,Nt.disabled,zt.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(Nt.disabled),l.setDepthMode(pt.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,v=this.transform,T=this.useProgram("clippingMask");for(const P of i){const E=e[P.key],k=this.style.map.terrain&&this.style.map.terrain.getTerrainData(P),F=_.getMeshFromTileID(this.context,P.canonical,l,!0,"stencil"),O=v.getProjectionData({overscaledTileID:P,applyGlobeMatrix:!0,applyTerrainMatrix:!0});T.draw(h,f.TRIANGLES,pt.disabled,new Pt({func:f.ALWAYS,mask:0},E,255,f.KEEP,f.KEEP,f.REPLACE),Nt.disabled,s?zt.disabled:zt.backCCW,null,k,O,"$clipping",F.vertexBuffer,F.indexBuffer,F.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,s=this.style.projection,l=this.transform,h=this.useProgram("depth"),f=this.getDepthModeFor3D(),_=ie(l,{tileSize:l.tileSize});for(const v of _){const T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(v),P=s.getMeshFromTileID(this.context,v.canonical,!0,!0,"raster"),E=l.getProjectionData({overscaledTileID:v,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(e,i.TRIANGLES,f,Pt.disabled,Nt.disabled,zt.backCCW,null,T,E,"$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 Pt({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new Pt({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 Pt({func:i.GEQUAL,mask:255},_+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[f,s]}return[{[l]:Pt.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 v=0;v<h;v++)f[v+l]=new Pt({func:i.GREATER,mask:255},h+1+v,255,i.KEEP,i.KEEP,i.REPLACE),_[v+l]=new Pt({func:i.GREATER,mask:255},1+v,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*h+1,[f,_,s]}return this.nextStencilID=3,[{[l]:new Pt({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[l]:new Pt({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},s]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new Nt([e.CONSTANT_COLOR,e.ONE],new o.b7(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Nt.unblended:Nt.alphaBlended}getDepthModeForSublayer(e,i,s){if(!this.opaquePassEnabledForLayer())return pt.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new pt(s||this.context.gl.LEQUAL,i,[l,l])}getDepthModeFor3D(){return new pt(this.context.gl.LEQUAL,pt.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(ve.now()),this.imageManager.beginFrame();const h=this.style._order,f=this.style.sourceCaches,_={},v={},T={},P={isRenderingToTexture:!1,isRenderingGlobe:((s=e.projection)===null||s===void 0?void 0:s.transitionState)>0};for(const k in f){const F=f[k];F.used&&F.prepare(this.context),_[k]=F.getVisibleCoordinates(!1),v[k]=_[k].slice().reverse(),T[k]=F.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 F=this.style._layers[k];if(!F.hasOffscreenPass()||F.isHidden(this.transform.zoom))continue;const O=v[F.source];(F.type==="custom"||O.length)&&this.renderLayer(this,f[F.source],F,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,F){const O=k.context,H=O.gl,q=((oe,ae,pe)=>{const me=Math.cos(ae.rollInRadians),Se=Math.sin(ae.rollInRadians),Ce=ue(ae),Te=ae.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:oe.properties.get("sky-color"),u_horizon_color:oe.properties.get("horizon-color"),u_horizon:[(ae.width/2-Ce*Se)*pe,(ae.height/2+Ce*me)*pe],u_horizon_normal:[-Se,me],u_sky_horizon_blend:oe.properties.get("sky-horizon-blend")*ae.height/2*pe,u_sky_blend:Te}})(F,k.style.map.transform,k.pixelRatio),W=new pt(H.LEQUAL,pt.ReadWrite,[0,1]),K=Pt.disabled,ee=k.colorModeForRenderPass(),te=k.useProgram("sky"),re=Ec(O,F);te.draw(O,H.TRIANGLES,W,K,ee,zt.disabled,q,null,void 0,"sky",re.vertexBuffer,re.indexBuffer,re.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]],F=f[k.source],O=_[k.source];this._renderTileClippingMasks(k,O,!1),this.renderLayer(this,F,k,O,P)}this.renderPass="translucent";let E=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const k=this.style._layers[h[this.currentLayer]],F=f[k.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(k,P))continue;this.opaquePassEnabledForLayer()||E||(E=!0,P.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const O=(k.type==="symbol"?T:v)[k.source];this._renderTileClippingMasks(k,_[k.source],!1),this.renderLayer(this,F,k,O,P)}if(P.isRenderingGlobe&&function(k,F,O){const H=k.context,q=H.gl,W=k.useProgram("atmosphere"),K=new pt(q.LEQUAL,pt.ReadOnly,[0,1]),ee=k.transform,te=function(Te,je){const Be=Te.properties.get("position"),Ee=[-Be.x,-Be.y,-Be.z],He=o.ad(new Float64Array(16));return Te.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.bX(Ee,Ee,He),Ee}(O,k.transform),re=ee.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),oe=F.properties.get("atmosphere-blend")*re.projectionTransition;if(oe===0)return;const ae=Eo(ee.worldSize,ee.center.lat),pe=ee.inverseProjectionMatrix,me=new Float64Array(4);me[3]=1,o.at(me,me,ee.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 Se=((Te,je,Be,Ee,He)=>({u_sun_pos:Te,u_atmosphere_blend:je,u_globe_position:Be,u_globe_radius:Ee,u_inv_proj_matrix:He}))(te,oe,[me[0],me[1],me[2]],ae,pe),Ce=Ec(H,F);W.draw(H,q.TRIANGLES,K,Pt.disabled,Nt.alphaBlended,zt.disabled,Se,null,null,"atmosphere",Ce.vertexBuffer,Ce.indexBuffer,Ce.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const k=function(F,O){let H=null;const q=Object.values(F._layers).flatMap(te=>te.source&&!te.isHidden(O)?[F.sourceCaches[te.source]]:[]),W=q.filter(te=>te.getSource().type==="vector"),K=q.filter(te=>te.getSource().type!=="vector"),ee=te=>{(!H||H.getSource().maxzoom<te.getSource().maxzoom)&&(H=te)};return W.forEach(te=>ee(te)),H||K.forEach(te=>ee(te)),H}(this.style,this.transform.zoom);k&&function(F,O,H){for(let q=0;q<H.length;q++)Cc(F,O,H[q])}(this,k,k.getVisibleCoordinates())}this.options.showPadding&&function(k){const F=k.transform.padding;Pc(k,k.transform.height-(F.top||0),3,Si),Pc(k,F.bottom||0,3,Sa),Pa(k,F.left||0,3,Gr),Pa(k,k.transform.width-(F.right||0),3,Mc);const O=k.transform.centerPoint;(function(H,q,W,K){Qn(H,q-1,W-10,2,20,K),Qn(H,q-10,W-1,20,2,K)})(k,O.x,k.transform.height-O.y,Sc)}(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.b_(i,s):!o.b$(i,s)),l||(l=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),l&&(o.c0(i,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,f){const _=h.context,v=_.gl,T=h.transform,P=Nt.unblended,E=new pt(v.LEQUAL,pt.ReadWrite,[0,1]),k=f.sourceCache.getRenderableTiles(),F=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)};F.draw(_,v.TRIANGLES,E,Pt.disabled,P,zt.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,v=_.gl,T=h.transform,P=Nt.unblended,E=new pt(v.LEQUAL,pt.ReadWrite,[0,1]),k=f.getCoordsTexture(),F=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 F){const q=f.getTerrainMesh(H.tileID),W=f.getTerrainData(H.tileID);_.activeTexture.set(v.TEXTURE0),v.bindTexture(v.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)},ee=T.getProjectionData({overscaledTileID:H.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});O.draw(_,v.TRIANGLES,E,Pt.disabled,P,zt.backCCW,K,W,ee,"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.c1(s)?function(f,_,v,T,P,E){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:k}=E,F=Pt.disabled,O=f.colorModeForRenderPass();(v._unevaluatedLayout.hasValue("text-variable-anchor")||v._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(H,q,W,K,ee,te,re,oe,ae){const pe=q.transform,me=q.style.map.terrain,Se=ee==="map",Ce=te==="map";for(const Te of H){const je=K.getTile(Te),Be=je.getBucket(W);if(!Be||!Be.text||!Be.text.segments.get().length)continue;const Ee=o.ak(Be.textSizeData,pe.zoom),He=o.az(je,1,q.transform.zoom),ft=rt(Se,q.transform,He),st=W.layout.get("icon-text-fit")!=="none"&&Be.hasIconData();if(Ee){const ui=Math.pow(2,pe.zoom-je.tileID.overscaledZ),Ut=me?(hi,ii)=>me.getElevation(Te,hi,ii):null;Wo(Be,Se,Ce,ae,pe,ft,ui,Ee,st,o.aA(pe,je,re,oe),Te.toUnwrapped(),Ut)}}}(T,f,v,_,v.layout.get("text-rotation-alignment"),v.layout.get("text-pitch-alignment"),v.paint.get("text-translate"),v.paint.get("text-translate-anchor"),P),v.paint.get("icon-opacity").constantOr(1)!==0&&Ko(f,_,v,T,!1,v.paint.get("icon-translate"),v.paint.get("icon-translate-anchor"),v.layout.get("icon-rotation-alignment"),v.layout.get("icon-pitch-alignment"),v.layout.get("icon-keep-upright"),F,O,k),v.paint.get("text-opacity").constantOr(1)!==0&&Ko(f,_,v,T,!0,v.paint.get("text-translate"),v.paint.get("text-translate-anchor"),v.layout.get("text-rotation-alignment"),v.layout.get("text-pitch-alignment"),v.layout.get("text-keep-upright"),F,O,k),_.map.showCollisionBoxes&&(js(f,_,v,T,!0),js(f,_,v,T,!1))}(e,i,s,l,this.style.placement.variableOffsets,h):o.c2(s)?function(f,_,v,T,P){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=P,k=v.paint.get("circle-opacity"),F=v.paint.get("circle-stroke-width"),O=v.paint.get("circle-stroke-opacity"),H=!v.layout.get("circle-sort-key").isConstant();if(k.constantOr(1)===0&&(F.constantOr(1)===0||O.constantOr(1)===0))return;const q=f.context,W=q.gl,K=f.transform,ee=f.getDepthModeForSublayer(0,pt.ReadOnly),te=Pt.disabled,re=f.colorModeForRenderPass(),oe=[],ae=K.getCircleRadiusCorrection();for(let pe=0;pe<T.length;pe++){const me=T[pe],Se=_.getTile(me),Ce=Se.getBucket(v);if(!Ce)continue;const Te=v.paint.get("circle-translate"),je=v.paint.get("circle-translate-anchor"),Be=o.aA(K,Se,Te,je),Ee=Ce.programConfigurations.get(v.id),He=f.useProgram("circle",Ee),ft=Ce.layoutVertexBuffer,st=Ce.indexBuffer,ui=f.style.map.terrain&&f.style.map.terrain.getTerrainData(me),Ut={programConfiguration:Ee,program:He,layoutVertexBuffer:ft,indexBuffer:st,uniformValues:Xd(f,Se,v,Be,ae),terrainData:ui,projectionData:K.getProjectionData({overscaledTileID:me,applyGlobeMatrix:!E,applyTerrainMatrix:!0})};if(H){const hi=Ce.segments.get();for(const ii of hi)oe.push({segments:new o.aJ([ii]),sortKey:ii.sortKey,state:Ut})}else oe.push({segments:Ce.segments,sortKey:0,state:Ut})}H&&oe.sort((pe,me)=>pe.sortKey-me.sortKey);for(const pe of oe){const{programConfiguration:me,program:Se,layoutVertexBuffer:Ce,indexBuffer:Te,uniformValues:je,terrainData:Be,projectionData:Ee}=pe.state;Se.draw(q,W.TRIANGLES,ee,te,re,zt.backCCW,je,Be,Ee,v.id,Ce,Te,pe.segments,v.paint,f.transform.zoom,me)}}(e,i,s,l,h):o.c3(s)?function(f,_,v,T,P){if(v.paint.get("heatmap-opacity")===0)return;const E=f.context,{isRenderingToTexture:k,isRenderingGlobe:F}=P;if(f.style.map.terrain){for(const O of T){const H=_.getTile(O);_.hasRenderableParent(O)||(f.renderPass==="offscreen"?bc(f,H,v,O,F):f.renderPass==="translucent"&&sp(f,v,O,k,F))}E.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(O,H,q,W){const K=O.context,ee=K.gl,te=O.transform,re=Pt.disabled,oe=new Nt([ee.ONE,ee.ONE],o.b7.transparent,[!0,!0,!0,!0]);(function(ae,pe,me){const Se=ae.gl;ae.activeTexture.set(Se.TEXTURE1),ae.viewport.set([0,0,pe.width/4,pe.height/4]);let Ce=me.heatmapFbos.get(o.bU);Ce?(Se.bindTexture(Se.TEXTURE_2D,Ce.colorAttachment.get()),ae.bindFramebuffer.set(Ce.framebuffer)):(Ce=wc(ae,pe.width/4,pe.height/4),me.heatmapFbos.set(o.bU,Ce))})(K,O,q),K.clear({color:o.b7.transparent});for(let ae=0;ae<W.length;ae++){const pe=W[ae];if(H.hasRenderableParent(pe))continue;const me=H.getTile(pe),Se=me.getBucket(q);if(!Se)continue;const Ce=Se.programConfigurations.get(q.id),Te=O.useProgram("heatmap",Ce),je=te.getProjectionData({overscaledTileID:pe,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Be=te.getCircleRadiusCorrection();Te.draw(K,ee.TRIANGLES,pt.disabled,re,oe,zt.backCCW,oc(me,te.zoom,q.paint.get("heatmap-intensity"),Be),null,je,q.id,Se.layoutVertexBuffer,Se.indexBuffer,Se.segments,q.paint,te.zoom,Ce)}K.viewport.set([0,0,O.width,O.height])}(f,_,v,T):f.renderPass==="translucent"&&function(O,H){const q=O.context,W=q.gl;q.setColorMode(O.colorModeForRenderPass());const K=H.heatmapFbos.get(o.bU);K&&(q.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,K.colorAttachment.get()),q.activeTexture.set(W.TEXTURE1),Ns(q,H).bind(W.LINEAR,W.CLAMP_TO_EDGE),O.useProgram("heatmapTexture").draw(q,W.TRIANGLES,pt.disabled,Pt.disabled,O.colorModeForRenderPass(),zt.disabled,lc(O,H,0,1),null,null,H.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,H.paint,O.transform.zoom))}(f,v)}(e,i,s,l,h):o.c4(s)?function(f,_,v,T,P){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=P,k=v.paint.get("line-opacity"),F=v.paint.get("line-width");if(k.constantOr(1)===0||F.constantOr(1)===0)return;const O=f.getDepthModeForSublayer(0,pt.ReadOnly),H=f.colorModeForRenderPass(),q=v.paint.get("line-dasharray"),W=v.paint.get("line-pattern"),K=W.constantOr(1),ee=v.paint.get("line-gradient"),te=v.getCrossfadeParameters(),re=K?"linePattern":q?"lineSDF":ee?"lineGradient":"line",oe=f.context,ae=oe.gl,pe=f.transform;let me=!0;for(const Se of T){const Ce=_.getTile(Se);if(K&&!Ce.patternsLoaded())continue;const Te=Ce.getBucket(v);if(!Te)continue;const je=Te.programConfigurations.get(v.id),Be=f.context.program.get(),Ee=f.useProgram(re,je),He=me||Ee.program!==Be,ft=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Se),st=W.constantOr(null);if(st&&Ce.imageAtlas){const Ht=Ce.imageAtlas,Zt=Ht.patternPositions[st.to.toString()],Gi=Ht.patternPositions[st.from.toString()];Zt&&Gi&&je.setConstantPatternPositions(Zt,Gi)}const ui=pe.getProjectionData({overscaledTileID:Se,applyGlobeMatrix:!E,applyTerrainMatrix:!0}),Ut=pe.getPixelScale(),hi=K?Kd(f,Ce,v,Ut,te):q?Bo(f,Ce,v,Ut,q,te):ee?Bs(f,Ce,v,Ut,Te.lineClipsArray.length):Lo(f,Ce,v,Ut);if(K)oe.activeTexture.set(ae.TEXTURE0),Ce.imageAtlasTexture.bind(ae.LINEAR,ae.CLAMP_TO_EDGE),je.updatePaintBuffers(te);else if(q&&(He||f.lineAtlas.dirty))oe.activeTexture.set(ae.TEXTURE0),f.lineAtlas.bind(oe);else if(ee){const Ht=Te.gradients[v.id];let Zt=Ht.texture;if(v.gradientVersion!==Ht.version){let Gi=256;if(v.stepInterpolant){const Bi=_.getSource().maxzoom,Ji=Se.canonical.z===Bi?Math.ceil(1<<f.transform.maxZoom-Se.canonical.z):1;Gi=o.ae(o.bV(Te.maxLineLength/o.Z*1024*Ji),256,oe.maxTextureSize)}Ht.gradient=o.bW({expression:v.gradientExpression(),evaluationKey:"lineProgress",resolution:Gi,image:Ht.gradient||void 0,clips:Te.lineClipsArray}),Ht.texture?Ht.texture.update(Ht.gradient):Ht.texture=new jt(oe,Ht.gradient,ae.RGBA),Ht.version=v.gradientVersion,Zt=Ht.texture}oe.activeTexture.set(ae.TEXTURE0),Zt.bind(v.stepInterpolant?ae.NEAREST:ae.LINEAR,ae.CLAMP_TO_EDGE)}let ii;if(E){const[Ht]=f.getStencilConfigForOverlapAndUpdateStencilID(T);ii=Ht[Se.overscaledZ]}else ii=f.stencilModeForClipping(Se);Ee.draw(oe,ae.TRIANGLES,O,ii,H,zt.disabled,hi,ft,ui,v.id,Te.layoutVertexBuffer,Te.indexBuffer,Te.segments,v.paint,f.transform.zoom,je,Te.layoutVertexBuffer2),me=!1}}(e,i,s,l,h):o.c5(s)?function(f,_,v,T,P){const E=v.paint.get("fill-color"),k=v.paint.get("fill-opacity");if(k.constantOr(1)===0)return;const{isRenderingToTexture:F}=P,O=f.colorModeForRenderPass(),H=v.paint.get("fill-pattern"),q=f.opaquePassEnabledForLayer()&&!H.constantOr(1)&&E.constantOr(o.b7.transparent).a===1&&k.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===q){const W=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?pt.ReadWrite:pt.ReadOnly);Tc(f,_,v,T,W,O,!1,F)}if(f.renderPass==="translucent"&&v.paint.get("fill-antialias")){const W=f.getDepthModeForSublayer(v.getPaintProperty("fill-outline-color")?2:0,pt.ReadOnly);Tc(f,_,v,T,W,O,!0,F)}}(e,i,s,l,h):o.c6(s)?function(f,_,v,T,P){const E=v.paint.get("fill-extrusion-opacity");if(E===0)return;const{isRenderingToTexture:k}=P;if(f.renderPass==="translucent"){const F=new pt(f.context.gl.LEQUAL,pt.ReadWrite,f.depthRangeFor3D);if(E!==1||v.paint.get("fill-extrusion-pattern").constantOr(1))Jo(f,_,v,T,F,Pt.disabled,Nt.disabled,k),Jo(f,_,v,T,F,f.stencilModeFor3D(),f.colorModeForRenderPass(),k);else{const O=f.colorModeForRenderPass();Jo(f,_,v,T,F,Pt.disabled,O,k)}}}(e,i,s,l,h):o.c7(s)?function(f,_,v,T,P){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=P,k=f.context,F=f.style.projection.useSubdivision,O=f.getDepthModeForSublayer(0,pt.ReadOnly),H=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function(q,W,K,ee,te,re,oe){const ae=q.context,pe=ae.gl;for(const me of K){const Se=W.getTile(me),Ce=Se.dem;if(!Ce||!Ce.data||!Se.needsHillshadePrepare)continue;const Te=Ce.dim,je=Ce.stride,Be=Ce.getPixels();if(ae.activeTexture.set(pe.TEXTURE1),ae.pixelStoreUnpackPremultiplyAlpha.set(!1),Se.demTexture=Se.demTexture||q.getTileTexture(je),Se.demTexture){const He=Se.demTexture;He.update(Be,{premultiply:!1}),He.bind(pe.NEAREST,pe.CLAMP_TO_EDGE)}else Se.demTexture=new jt(ae,Be,pe.RGBA,{premultiply:!1}),Se.demTexture.bind(pe.NEAREST,pe.CLAMP_TO_EDGE);ae.activeTexture.set(pe.TEXTURE0);let Ee=Se.fbo;if(!Ee){const He=new jt(ae,{width:Te,height:Te,data:null},pe.RGBA);He.bind(pe.LINEAR,pe.CLAMP_TO_EDGE),Ee=Se.fbo=ae.createFramebuffer(Te,Te,!0,!1),Ee.colorAttachment.set(He.texture)}ae.bindFramebuffer.set(Ee.framebuffer),ae.viewport.set([0,0,Te,Te]),q.useProgram("hillshadePrepare").draw(ae,pe.TRIANGLES,te,re,oe,zt.disabled,ba(Se.tileID,Ce),null,null,ee.id,q.rasterBoundsBuffer,q.quadTriangleIndexBuffer,q.rasterBoundsSegments),Se.needsHillshadePrepare=!1}})(f,_,T,v,O,Pt.disabled,H),k.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(F){const[q,W,K]=f.stencilConfigForOverlapTwoPass(T);ns(f,_,v,K,q,O,H,!1,E),ns(f,_,v,K,W,O,H,!0,E)}else{const[q,W]=f.getStencilConfigForOverlapAndUpdateStencilID(T);ns(f,_,v,W,q,O,H,!1,E)}}(e,i,s,l,h):o.c8(s)?function(f,_,v,T,P){if(f.renderPass!=="translucent"||v.paint.get("raster-opacity")===0||!T.length)return;const{isRenderingToTexture:E}=P,k=_.getSource(),F=f.style.projection.useSubdivision;if(k instanceof Di)Qo(f,_,v,T,null,!1,!1,k.tileCoords,k.flippedWindingOrder,E);else if(F){const[O,H,q]=f.stencilConfigForOverlapTwoPass(T);Qo(f,_,v,q,O,!1,!0,Zs,!1,E),Qo(f,_,v,q,H,!0,!0,Zs,!1,E)}else{const[O,H]=f.getStencilConfigForOverlapAndUpdateStencilID(T);Qo(f,_,v,H,O,!1,!0,Zs,!1,E)}}(e,i,s,l,h):o.c9(s)?function(f,_,v,T,P){const E=v.paint.get("background-color"),k=v.paint.get("background-opacity");if(k===0)return;const{isRenderingToTexture:F}=P,O=f.context,H=O.gl,q=f.style.projection,W=f.transform,K=W.tileSize,ee=v.paint.get("background-pattern");if(f.isPatternMissing(ee))return;const te=!ee&&E.a===1&&k===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==te)return;const re=Pt.disabled,oe=f.getDepthModeForSublayer(0,te==="opaque"?pt.ReadWrite:pt.ReadOnly),ae=f.colorModeForRenderPass(),pe=f.useProgram(ee?"backgroundPattern":"background"),me=T||ie(W,{tileSize:K,terrain:f.style.map.terrain});ee&&(O.activeTexture.set(H.TEXTURE0),f.imageManager.bind(f.context));const Se=v.getCrossfadeParameters();for(const Ce of me){const Te=W.getProjectionData({overscaledTileID:Ce,applyGlobeMatrix:!F,applyTerrainMatrix:!0}),je=ee?En(k,f,ee,{tileID:Ce,tileSize:K},Se):Oo(k,E),Be=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Ce),Ee=q.getMeshFromTileID(O,Ce.canonical,!1,!0,"raster");pe.draw(O,H.TRIANGLES,oe,re,ae,zt.backCCW,je,Be,Te,v.id,Ee.vertexBuffer,Ee.indexBuffer,Ee.segments)}}(e,0,s,l,h):o.ca(s)&&function(f,_,v,T){const{isRenderingGlobe:P}=T,E=f.context,k=v.implementation,F=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:F.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
728
728
  uniform mat4 u_projection_matrix;
729
- ${F.shaderPreludeCode.vertexSource}`,define:F.shaderDefine},defaultProjectionData:H},W=k.renderingMode?k.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=k.prerender;K&&(f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),K.call(k,E.gl,q),E.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),E.setStencilMode(Pt.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,pt.ReadOnly);E.setDepthMode(K),k.render(E.gl,q),E.setDirty(),f.setBaseState(),E.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){this.cache=this.cache||{};const l=!!this.style.map.terrain,h=this.style.projection,f=e+(i?i.cacheKey:"")+`/${s?sr:h.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(l?"/terrain":"");return this.cache[f]||(this.cache[f]=new Ds(this.context,gt[e],i,uc[e],this._showOverdrawInspector,l,s?gt.projectionMercator:h.shaderPreludeCode,s?wr:h.shaderDefine)),this.cache[f]}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 jt(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 kc(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 zc{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=kc(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,v=this._map.getBearing(),T=this._map.getPitch();let P="";if(P+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(v||T)&&(P+="/"+Math.round(10*v)/10),T&&(P+=`/${Math.round(T)}`),this._hashName){const E=this._hashName;let k=!1;const F=window.location.hash.slice(1).split("&").map(O=>{const H=O.split("=")[0];return H===E?(k=!0,`${H}=${P}`):O}).filter(O=>O);return k||F.push(`${E}=${P}`),`#${F.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 en={linearity:.3,easing:o.cb(0,0,.3,1)},Ph=o.e({deceleration:2500,maxSpeed:1400},en),Ch=o.e({deceleration:20,maxSpeed:1400},en),Ih=o.e({deceleration:1e3,maxSpeed:360},en),Eh=o.e({deceleration:1e3,maxSpeed:90},en),kh=o.e({deceleration:1e3,maxSpeed:360},en);class zh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ve.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=ve.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=ea(i.pan.mag(),s,o.e({},Ph,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,as(l,h)}if(i.zoom){const h=ea(i.zoom,s,Ch);l.zoom=this._map.transform.zoom+h.amount,as(l,h)}if(i.bearing){const h=ea(i.bearing,s,Ih);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),as(l,h)}if(i.pitch){const h=ea(i.pitch,s,Eh);l.pitch=this._map.transform.pitch+h.amount,as(l,h)}if(i.roll){const h=ea(i.roll,s,kh);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),as(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 as(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function ea(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 Mr 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=ne.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 gr 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=ne.touchPos(i.getCanvasContainer(),l),f=h.map(v=>i.unproject(v)),_=h.reduce((v,T,P,E)=>v.add(T.div(E.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class tn extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class Ah{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new tn(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new Mr(e.type,this._map,e))}mouseup(e){this._map.fire(new Mr(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new Mr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Mr(e.type,this._map,e))}mouseover(e){this._map.fire(new Mr(e.type,this._map,e))}mouseout(e){this._map.fire(new Mr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new gr(e.type,this._map,e))}touchmove(e){this._map.fire(new gr(e.type,this._map,e))}touchend(e){this._map.fire(new gr(e.type,this._map,e))}touchcancel(e){this._map.fire(new gr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class mn{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Mr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Mr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Mr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gn{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 Rh{constructor(e,i){this._map=e,this._tr=new gn(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&&(ne.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=ne.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),v=Math.max(l.y,s.y);ne.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=v-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),ne.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&&(ne.remove(this._box),this._box=null),ne.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Ac(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 op{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=Ac(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Ac(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 Rc{constructor(e){this.singleTap=new op(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 Dh{constructor(e){this._tr=new gn(e),this._zoomIn=new Rc({numTouches:1,numTaps:2}),this._zoomOut=new Rc({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 kn{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&&ne.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 zn={0:1,2:2};class Ue{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=ne.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=zn[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return ne.mouseButton(e)===this._eventButton}}class Lh{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 Dc{constructor(e=new Ue({checkCorrectEvent:()=>!0}),i=new Lh){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 Vs=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Us{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=Ac(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],E=this._touches[T];E&&(h._add(P),f._add(P.sub(E)),_++,l[T]=P)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const v=f.div(_);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ca{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=$s(s,i,l),_=$s(s,i,h);if(!f||!_)return;const v=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],v,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=$s(s,i,l),_=$s(s,i,h);f&&_||(this._active&&ne.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 $s(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function vt(u,e){return Math.log(u/e)/Math.LN2}class el extends Ca{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(vt(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:vt(this._distance,s),pinchAround:i}}}function Bh(u,e){return 180*u.angleWith(e)/Math.PI}class tl extends Ca{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:Bh(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=Bh(e,this._startVector);return Math.abs(s)<i}}function Lc(u){return Math.abs(u.y)>Math.abs(u.x)}class Fh extends Ca{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,Lc(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 Lc(e)&&Lc(i)&&f}}const Oh={panStep:100,bearingStep:15,pitchStep:10};class il{constructor(e){this._tr=new gn(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 v=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:jh,zoom:i?Math.round(v.zoom)+i*(e.shiftKey?2:1):v.zoom,bearing:v.bearing+s*this._bearingStep,pitch:v.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:v.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 jh(u){return u*(2-u)}const Nh=4.000244140625;class Bc{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new gn(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=ve.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%Nh==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=ne.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)>Nh?this._wheelZoomRate:this._defaultZoomRate;let v=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&v!==0&&(v=1/v);const T=typeof this._targetZoom!="number"?e.scale:o.ac(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,o.ah(T*v))),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 _=ve.now()-this._lastWheelEventTime,v=Math.min((_+5)/200,1),T=l(v);h=o.B.number(s,i,T),v<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.cd;if(this._prevEase){const s=this._prevEase,l=(ve.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.cb(f,_,.25,1)}return this._prevEase={start:ve.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 Zh{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 lp{constructor(e){this._tr=new gn(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 ta{constructor(){this._tap=new Rc({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 ti{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 Gs{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 rl{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 Fc{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=ne.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&&(ne.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 Vh extends o.l{}function Oc(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class _n{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},v={},T={};for(const{handlerName:k,handler:F,allowed:O}of this._handlers){if(!F.isEnabled())continue;let H;if(this._blockedByActive(T,O,k))F.reset();else if(F[h||l.type]){if(o.ce(l,h||l.type)){const q=ne.mousePos(this._map.getCanvas(),l);H=F[h||l.type](l,q)}else if(o.cf(l,h||l.type)){const q=this._getMapTouches(l.touches),W=ne.touchPos(this._map.getCanvas(),q);H=F[h||l.type](l,W,q)}else o.cg(h||l.type)||(H=F[h||l.type](l));this.mergeHandlerResult(_,v,H,k,f),H&&H.needsRenderFrame&&this._triggerRenderFrame()}(H||F.isActive())&&(T[k]=F)}const P={};for(const k in this._previousActiveHandlers)T[k]||(P[k]=f);this._previousActiveHandlers=T,(Object.keys(P).length||Oc(_))&&(this._changes.push([_,v,P]),this._triggerRenderFrame()),(Object.keys(T).length||Oc(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=_;E&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],E(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zh(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)ne.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)ne.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new Ah(i,e));const l=i.boxZoom=new Rh(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new Fc(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new Dh(i),_=new lp(i);i.doubleClickZoom=new Zh(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const v=new ta;this._add("tapDragZoom",v);const T=i.touchPitch=new Fh(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const P=()=>i.project(i.getCenter()),E=function({enable:te,clickTolerance:re,aroundCenter:oe=!0,minPixelCenterThreshold:ae=100,rotateDegreesPerPixelMoved:pe=.8},me){const Se=new Ue({checkCorrectEvent:Ce=>ne.mouseButton(Ce)===0&&Ce.ctrlKey||ne.mouseButton(Ce)===2&&!Ce.ctrlKey});return new kn({clickTolerance:re,move:(Ce,Te)=>{const je=me();if(oe&&Math.abs(je.y-Ce.y)>ae)return{bearingDelta:o.cc(new o.P(Ce.x,Te.y),Te,je)};let Be=(Te.x-Ce.x)*pe;return oe&&Te.y<je.y&&(Be=-Be),{bearingDelta:Be}},moveStateManager:Se,enable:te,assignEvents:Vs})}(e,P),k=function({enable:te,clickTolerance:re,pitchDegreesPerPixelMoved:oe=-.5}){const ae=new Ue({checkCorrectEvent:pe=>ne.mouseButton(pe)===0&&pe.ctrlKey||ne.mouseButton(pe)===2});return new kn({clickTolerance:re,move:(pe,me)=>({pitchDelta:(me.y-pe.y)*oe}),moveStateManager:ae,enable:te,assignEvents:Vs})}(e),F=function({enable:te,clickTolerance:re,rollDegreesPerPixelMoved:oe=.3},ae){const pe=new Ue({checkCorrectEvent:me=>ne.mouseButton(me)===2&&me.ctrlKey});return new kn({clickTolerance:re,move:(me,Se)=>{const Ce=ae();let Te=(Se.x-me.x)*oe;return Se.y<Ce.y&&(Te=-Te),{rollDelta:Te}},moveStateManager:pe,enable:te,assignEvents:Vs})}(e,P);i.dragRotate=new Gs(e,E,k,F),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",k,["mouseRotate","mouseRoll"]),this._add("mouseRoll",F,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:te,clickTolerance:re}){const oe=new Ue({checkCorrectEvent:ae=>ne.mouseButton(ae)===0&&!ae.ctrlKey});return new kn({clickTolerance:re,move:(ae,pe)=>({around:pe,panDelta:pe.sub(ae)}),activateOnStart:!0,moveStateManager:oe,enable:te,assignEvents:Vs})}(e),H=new Us(e,i);i.dragPan=new ti(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 tl,W=new el;i.touchZoomRotate=new rl(s,W,q,v),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 Bc(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const ee=i.keyboard=new il(i);this._add("keyboard",ee),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new mn(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(!(Oc(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:v,bearingDelta:T,pitchDelta:P,rollDelta:E,around:k,pinchAround:F}=e;F!==void 0&&(k=F),k=k||l.transform.centerPoint,f&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const O={panDelta:_,zoomDelta:v,rollDelta:E,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 E in e){const{originalEvent:k}=e[E];this._eventsInProgress[E]||(f[`${E}start`]=k),this._eventsInProgress[E]=e[E]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const E in f)this._fireEvent(E,f[E]);h&&this._fireEvent("move",h.originalEvent);for(const E in e){const{originalEvent:k}=e[E];this._fireEvent(E,k)}const _={};let v;for(const E in this._eventsInProgress){const{handlerName:k,originalEvent:F}=this._eventsInProgress[E];this._handlersById[k].isActive()||(delete this._eventsInProgress[E],v=i[k]||F,_[`${E}end`]=v)}for(const E in _)this._fireEvent(E,_[E]);const T=qs(this._eventsInProgress),P=(l||h)&&!T;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&E.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(E)}if(s&&P){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),k=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!E||!E.essential&&ve.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:v})),k(this._map.getBearing())&&this._map.resetNorth()):(k(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:v})),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 Vh("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class nl extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((ve.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=Wt.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,v=new Wt(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,v,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 v=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)),v&&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,v=f.y-h.y,T=f.z-h.z,P=Math.hypot(_,v,T);if(P===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,v),k=o.ah(this.transform.cameraToCenterDistance/P/this.transform.tileSize),F=180*Math.atan2(_,-v)/Math.PI;let O=180*Math.acos(E/P)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:k,pitch:O,bearing:F}}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.cd},e)).animate===!1||!e.essential&&ve.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,v="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let k,F;e.around&&(k=o.Q.convert(e.around),F=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:v,roll:T,padding:P,around:k,aroundPoint:F,offsetAsPoint:E,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||v!==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:v,pitch:T,bearing:P,elevation:E}=l(h);f&&h.setCenter(f),E!==void 0&&h.setElevation(E),_!==void 0&&h.setZoom(_),v!==void 0&&h.setRoll(v),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&&ve.prefersReducedMotion){const Te=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(Te,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cd},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,v="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,E="padding"in e?e.padding:s.padding,k=o.P.convert(e.offset);let F=s.centerPoint.add(k);const O=s.screenPointToLocation(F),H=this.cameraHelper.handleFlyTo(s,{bearing:v,pitch:T,roll:P,padding:E,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,ee=H.pixelPathLength;typeof H.scaleOfMinZoom=="number"&&(q=Math.sqrt(W/H.scaleOfMinZoom/ee*2));const te=q*q;function re(Te){const je=(K*K-W*W+(Te?-1:1)*te*te*ee*ee)/(2*(Te?K:W)*te*ee);return Math.log(Math.sqrt(je*je+1)-je)}function oe(Te){return(Math.exp(Te)-Math.exp(-Te))/2}function ae(Te){return(Math.exp(Te)+Math.exp(-Te))/2}const pe=re(!1);let me=function(Te){return ae(pe)/ae(pe+q*Te)},Se=function(Te){return W*((ae(pe)*(oe(je=pe+q*Te)/ae(je))-oe(pe))/te)/ee;var je},Ce=(re(!0)-pe)/q;if(Math.abs(ee)<2e-6||!isFinite(Ce)){if(Math.abs(W-K)<1e-6)return this.easeTo(e,i);const Te=K<W?-1:1;Ce=Math.abs(Math.log(K/W))/q,Se=()=>0,me=je=>Math.exp(Te*q*je)}return e.duration="duration"in e?+e.duration:1e3*Ce/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==v,this._pitching=T!==h,this._rolling=P!==f,this._padding=!s.isPaddingEqual(E),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(H.targetCenter),this._ease(Te=>{const je=Te*Ce,Be=1/me(je),Ee=Se(je);this._rotating&&s.setBearing(o.B.number(l,v,Te)),this._pitching&&s.setPitch(o.B.number(h,T,Te)),this._rolling&&s.setRoll(o.B.number(f,P,Te)),this._padding&&(s.interpolatePadding(_,E,Te),F=s.centerPoint.add(k)),H.easeFunc(Te,Be,Ee,F),this.terrain&&!e.freezeElevation&&this._updateElevation(Te),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=ve.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 Ye={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class nt{constructor(e=Ye){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=ne.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ne.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ne.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(){ne.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=ne.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=ne.create("div","maplibregl-ctrl");const i=ne.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(){ne.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class jc{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 Nc=o.aG([{name:"a_pos3d",type:"Int16",components:3}]);class Sr extends o.E{constructor(e){super(),this._lastTilesetChange=ve.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 ie(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 Gt(l,this.tileSize),this._lastTilesetChange=ve.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,v=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,[-v*P,-T*P,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,v=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,[v*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 v=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(_,_,[v*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const v=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>v<<v),P=h.canonical.y-(h.canonical.y>>v<<v),E=e.canonical.x-(h.canonical.x>>v),k=e.canonical.y-(h.canonical.y>>v),F=o.Z>>v;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[-T*F+E*o.Z,-P*F+k*o.Z,0])}else{const v=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>v<<v),P=e.canonical.y-(e.canonical.y>>v<<v),E=(e.canonical.x>>v)-h.canonical.x,k=(e.canonical.y>>v)-h.canonical.y,F=o.Z<<v;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[T*o.Z+E*F,P*o.Z+k*F,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 Uh{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new Sr(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 v=o.ch([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[v[0]*_.dim,v[1]*_.dim],P=Math.floor(T[0]),E=Math.floor(T[1]),k=T[0]-P,F=T[1]-E;return _.get(P,E)*(1-k)*(1-F)+_.get(P+1,E)*k*(1-F)+_.get(P,E+1)*(1-k)*F+_.get(P+1,E+1)*k*F}getElevationForLngLatZoom(e,i){if(!o.ci(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 jt(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new jt(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 jt(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),v=o.cj(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(v,v,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:v,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 jt(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 jt(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 jt(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 v=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),P=this.coordsIndex[255-i[3]],E=P&&this.sourceCache.getTileByID(P);if(!E)return null;const k=this._coordsTextureSize,F=(1<<E.tileID.canonical.z)*k;return new o.$((E.tileID.canonical.x*k+v)/F+E.tileID.wrap,(E.tileID.canonical.y*k+T)/F,this.getElevation(E.tileID,v,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,v=new o.ck,T=new o.aK,P=this.meshSize,E=o.Z/P,k=P*P;for(let ae=0;ae<=P;ae++)for(let pe=0;pe<=P;pe++)v.emplaceBack(pe*E,ae*E,0);for(let ae=0;ae<k;ae+=P+1)for(let pe=0;pe<P;pe++)T.emplaceBack(pe+ae,P+pe+ae+1,P+pe+ae+2),T.emplaceBack(pe+ae,P+pe+ae+2,pe+ae+1);const F=v.length,O=F+(P+1),H=(P+1)*P,q=l?o.b9:0,W=l?0:1,K=h?o.ba:o.Z,ee=h?0:1;for(let ae=0;ae<=P;ae++)v.emplaceBack(ae*E,q,W);for(let ae=0;ae<=P;ae++)v.emplaceBack(ae*E,K,ee);for(let ae=0;ae<P;ae++)T.emplaceBack(H+ae,O+ae,O+ae+1),T.emplaceBack(H+ae,O+ae+1,H+ae+1),T.emplaceBack(0+ae,F+ae+1,F+ae),T.emplaceBack(0+ae,0+ae+1,F+ae+1);const te=v.length,re=te+2*(P+1);for(const ae of[0,1])for(let pe=0;pe<=P;pe++)for(const me of[0,1])v.emplaceBack(ae*o.Z,pe*E,me);for(let ae=0;ae<2*P;ae+=2)T.emplaceBack(te+ae,te+ae+1,te+ae+3),T.emplaceBack(te+ae,te+ae+3,te+ae+2),T.emplaceBack(re+ae,re+ae+3,re+ae+1),T.emplaceBack(re+ae,re+ae+2,re+ae+3);const oe=new Ha(_.createVertexBuffer(v,Nc.members),_.createIndexBuffer(T),o.aJ.simpleSegment(0,0,v.length,T.length));return this._meshCache[f]=oe,oe}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),v=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,v),mercatorX:h,mercatorY:f}}}class yn{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 jt(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 ss={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Ws{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new yn(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 Di?h.terrainTileRanges:null;for(const _ of l){const v=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in v)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(v[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(ss[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(ss[l]&&(this._prevType&&ss[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(ss[this._prevType]||ss[l]&&f){this._prevType=l;const _=this._stacks.length-1,v=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(Ic(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const E=this.pool.getObjectForId(T.rtt[_].id);if(E.stamp===T.rtt[_].stamp){this.pool.useObject(E);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 E=0;E<v.length;E++){const k=h.style._layers[v[E]],F=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,F,!0),h.renderLayer(h,h.style.sourceCaches[k.source],k,F,s),k.source&&(T.rttCoords[k.source]=this._coordsAscendingStr[k.source][T.tileID.key])}}return Ic(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),ss[l]}return!1}}const bi={"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"},Ei=le,Zc={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ye,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},Xs={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class al{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,ne.mousePos(this.element,h)),ne.addEventListener(window,"mousemove",this.mousemove),ne.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,ne.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=ne.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),ne.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ne.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=ne.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 Dc;this._rotatePitchHanlder=new kn({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),v=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.cc(new o.P(h.x,f.y),f,v),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,ne.addEventListener(i,"mousedown",this.mousedown),ne.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),ne.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),ne.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;ne.removeEventListener(e,"mousedown",this.mousedown),ne.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),ne.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ne.removeEventListener(window,"touchend",this.touchend),ne.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){ne.enableDrag(),ne.removeEventListener(window,"mousemove",this.mousemove),ne.removeEventListener(window,"mouseup",this.mouseup),ne.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ne.removeEventListener(window,"touchend",this.touchend)}}let An;function sl(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 Ks={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 os(u,e,i){const s=u.classList;for(const l in Ks)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Ys 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=sl(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()),ne.setTransform(this._element,`${Ks[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),ve.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=ne.create("div");const i=ne.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=ne.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=ne.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=ne.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const v=[{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 v){const K=ne.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=ne.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const P=ne.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 E=ne.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const k=ne.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"),E.appendChild(k);const F=ne.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const O=ne.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=ne.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=ne.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(E),f.appendChild(F),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()}),os(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),ne.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;if(!(!((i=this._map)===null||i===void 0)&&i.terrain)){const E=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==E&&(this._element.style.opacity=E))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const l=this._map,h=l.terrain.depthAtPoint(this._pos),f=l.terrain.getElevationForLngLatZoom(this._lngLat,l.transform.tileZoom);if(l.transform.lngLatToCameraDepth(this._lngLat,f)-h<.006)return void(this._element.style.opacity=this._opacity);const _=-this._offset.y/l.transform.pixelsPerMeter,v=Math.sin(l.getPitch()*Math.PI/180)*_,T=l.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),P=l.transform.lngLatToCameraDepth(this._lngLat,f+v)-T>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&P&&this._popup.remove(),this._element.style.opacity=P?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 Vc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ls=0,Ia=!1;const Uc={maxWidth:100,unit:"metric"};function ol(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]),v=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,v,u._container.clientWidth),P=f.distanceTo(_);if(i&&i.unit==="imperial"){const E=3.2808*P;E>5280?Ea(e,T,E/5280,u._getUIString("ScaleControl.Miles")):Ea(e,T,E,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Ea(e,T,P/1852,u._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Ea(e,T,P/1e3,u._getUIString("ScaleControl.Kilometers")):Ea(e,T,P,u._getUIString("ScaleControl.Meters"))}function Ea(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(v){const T=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const $c={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},ll=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function cl(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 cl(new o.P(0,0))}const Gc=le;S.AJAXError=o.co,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cp,S.config=o.a,S.removeProtocol=o.cq,S.AttributionControl=nt,S.BoxZoomHandler=Rh,S.CanvasSource=Ze,S.CooperativeGesturesHandler=Fc,S.DoubleClickZoomHandler=Zh,S.DragPanHandler=ti,S.DragRotateHandler=Gs,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=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ne.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=ne.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ne.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=Kr,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=Wt.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(this.options.trackUserLocation)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&&Ia)return;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=ne.create("button","maplibregl-ctrl-geolocate",this._container),ne.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=ne.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ys({element:this._dotElement}),this._circleElement=ne.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ys({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({},Vc,u)}onAdd(u){return this._map=u,this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(An!==void 0&&!e)return An;if(window.navigator.permissions===void 0)return An=!!window.navigator.geolocation,An;try{An=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{An=!!window.navigator.geolocation}return An})}().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(),ne.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ls=0,Ia=!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":ls--,Ia=!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"),ls++,ls>1?(u={maximumAge:6e5,timeout:0},Ia=!0):(u=this.options.positionOptions,Ia=!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=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ne.create("button","maplibregl-ctrl-globe",this._container),ne.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(){ne.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=zc,S.ImageSource=Di,S.KeyboardHandler=il,S.LngLatBounds=Wt,S.LogoControl=Hs,S.Map=class extends nl{constructor(u){var e,i;o.cl.mark(o.cm.create);const s=Object.assign(Object.assign(Object.assign({},Zc),u),{canvasContextAttributes:Object.assign(Object.assign({},Zc.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 pn,h=new Cs;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 jc,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({},bi),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=Xt.addThrottleControl(()=>this.isMoving()),this._requestManager=new Et(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 v=kc(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?v(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new _n(this,s),this._hash=s.hash&&new zc(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 nt(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(Wt.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(v=>this.getLayer(v)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new Mr(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(v=>this.getLayer(v));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new Mr(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new Mr(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 Rs(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 Rs(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 Uh(this.painter,e,u),this.painter.renderToTexture=new Ws(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=V(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=V(Math.max(1,u),Math.max(1,e));return this._update(!0),this}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:v,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:E,data:k}=e,F=e;return this.style.addImage(u,{data:new o.R({width:P,height:E},new Uint8Array(k)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:v,textFitHeight:T,sdf:l,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:P,height:E,data:k}=ve.getImageData(e);this.style.addImage(u,{data:new o.R({width:P,height:E},k),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:v,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)?ve.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 Xt.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=ne.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=ne.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=ne.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=ne.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 Sh(i,this.transform),De.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 v=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const E=this.transform.zoom,k=ve.now();this.style.zoomHistory.update(E,k);const F=new o.C(E,{now:k,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),O=F.crossFadingFactor();O===1&&O===this._crossFadingFactor||(v=!0,this._crossFadingFactor=O),this.style.update(F)}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.cl.mark(o.cm.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||v)&&(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.cl.mark(o.cm.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),Xt.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),ne.remove(this._canvasContainer),ne.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cl.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ve.frame(this._frameRequest,u=>{o.cl.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cn(e)&&!function(i){return i.message===_c}(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 Ei}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=Mr,S.MapTouchEvent=gr,S.MapWheelEvent=tn,S.Marker=Ys,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({},Xs,u),this._container=ne.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})),ne.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})),ne.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=ne.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 al(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ne.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=ne.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&&ne.remove(this._content),this._container&&(ne.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=ne.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ne.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=sl(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=cl(this.options.offset);if(!s){const f=this._container.offsetWidth,_=this._container.offsetHeight;let v;v=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?v.push("left"):i.x>this._map.transform.width-f/2&&v.push("right"),s=v.length===0?"bottom":v.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),ne.setTransform(this._container,`${Ks[s]} translate(${h.x}px,${h.y}px)`),os(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create($c),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=ne.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=ne.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(ll);u&&u.focus()}},S.RasterDEMTileSource=Xr,S.RasterTileSource=Vi,S.ScaleControl=class{constructor(u){this._onMove=()=>{ol(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,ol(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Uc),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ne.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=Bc,S.Style=Rs,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=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ne.create("button","maplibregl-ctrl-terrain",this._container),ne.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(){ne.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=Fh,S.TwoFingersTouchRotateHandler=tl,S.TwoFingersTouchZoomHandler=el,S.TwoFingersTouchZoomRotateHandler=rl,S.VectorTileSource=br,S.VideoSource=nr,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)=>{Xe[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=ir;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Hn),ir=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=Co,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return ut().getRTLTextPluginStatus()},S.getVersion=function(){return Gc},S.getWorkerCount=function(){return yi.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return Wn().broadcast("IS",u)},S.prewarm=function(){hn().acquire(Hn)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return ut().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){yi.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var R=b;return R})}(Vu)),Vu.exports}var Ey=Iy();const Ad=Py(Ey);class Jf{constructor(m,b,I,z,R){fs(this,"bounds1");fs(this,"bounds2");fs(this,"getBounds",(m,b,I,z)=>new Ad.LngLatBounds([m,b],[I,z]));fs(this,"contains",(m,b)=>this.bounds1.contains([b,m])||this.bounds2.contains([b,m]));const S=m.unproject([b,I]),o=m.unproject([z,R]);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 ky={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}}]},zy={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 Ot;(function(y){y.assertEqual=z=>z;function m(z){}y.assertIs=m;function b(z){throw new Error}y.assertNever=b,y.arrayToEnum=z=>{const R={};for(const S of z)R[S]=S;return R},y.getValidEnumValues=z=>{const R=y.objectKeys(z).filter(o=>typeof z[z[o]]!="number"),S={};for(const o of R)S[o]=z[o];return y.objectValues(S)},y.objectValues=z=>y.objectKeys(z).map(function(R){return z[R]}),y.objectKeys=typeof Object.keys=="function"?z=>Object.keys(z):z=>{const R=[];for(const S in z)Object.prototype.hasOwnProperty.call(z,S)&&R.push(S);return R},y.find=(z,R)=>{for(const S of z)if(R(S))return S},y.isInteger=typeof Number.isInteger=="function"?z=>Number.isInteger(z):z=>typeof z=="number"&&isFinite(z)&&Math.floor(z)===z;function I(z,R=" | "){return z.map(S=>typeof S=="string"?`'${S}'`:S).join(R)}y.joinValues=I,y.jsonStringifyReplacer=(z,R)=>typeof R=="bigint"?R.toString():R})(Ot||(Ot={}));var Rd;(function(y){y.mergeShapes=(m,b)=>({...m,...b})})(Rd||(Rd={}));const Ke=Ot.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),da=y=>{switch(typeof y){case"undefined":return Ke.undefined;case"string":return Ke.string;case"number":return isNaN(y)?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(y)?Ke.array:y===null?Ke.null:y.then&&typeof y.then=="function"&&y.catch&&typeof y.catch=="function"?Ke.promise:typeof Map<"u"&&y instanceof Map?Ke.map:typeof Set<"u"&&y instanceof Set?Ke.set:typeof Date<"u"&&y instanceof Date?Ke.date:Ke.object;default:return Ke.unknown}},Oe=Ot.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"]),Ay=y=>JSON.stringify(y,null,2).replace(/"([^"]+)":/g,"$1:");class Wr extends Error{get errors(){return this.issues}constructor(m){super(),this.issues=[],this.addIssue=I=>{this.issues=[...this.issues,I]},this.addIssues=(I=[])=>{this.issues=[...this.issues,...I]};const b=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,b):this.__proto__=b,this.name="ZodError",this.issues=m}format(m){const b=m||function(R){return R.message},I={_errors:[]},z=R=>{for(const S of R.issues)if(S.code==="invalid_union")S.unionErrors.map(z);else if(S.code==="invalid_return_type")z(S.returnTypeError);else if(S.code==="invalid_arguments")z(S.argumentsError);else if(S.path.length===0)I._errors.push(b(S));else{let o=I,le=0;for(;le<S.path.length;){const he=S.path[le];le===S.path.length-1?(o[he]=o[he]||{_errors:[]},o[he]._errors.push(b(S))):o[he]=o[he]||{_errors:[]},o=o[he],le++}}};return z(this),I}static assert(m){if(!(m instanceof Wr))throw new Error(`Not a ZodError: ${m}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ot.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(m=b=>b.message){const b={},I=[];for(const z of this.issues)z.path.length>0?(b[z.path[0]]=b[z.path[0]]||[],b[z.path[0]].push(m(z))):I.push(m(z));return{formErrors:I,fieldErrors:b}}get formErrors(){return this.flatten()}}Wr.create=y=>new Wr(y);const fo=(y,m)=>{let b;switch(y.code){case Oe.invalid_type:y.received===Ke.undefined?b="Required":b=`Expected ${y.expected}, received ${y.received}`;break;case Oe.invalid_literal:b=`Invalid literal value, expected ${JSON.stringify(y.expected,Ot.jsonStringifyReplacer)}`;break;case Oe.unrecognized_keys:b=`Unrecognized key(s) in object: ${Ot.joinValues(y.keys,", ")}`;break;case Oe.invalid_union:b="Invalid input";break;case Oe.invalid_union_discriminator:b=`Invalid discriminator value. Expected ${Ot.joinValues(y.options)}`;break;case Oe.invalid_enum_value:b=`Invalid enum value. Expected ${Ot.joinValues(y.options)}, received '${y.received}'`;break;case Oe.invalid_arguments:b="Invalid function arguments";break;case Oe.invalid_return_type:b="Invalid function return type";break;case Oe.invalid_date:b="Invalid date";break;case Oe.invalid_string:typeof y.validation=="object"?"includes"in y.validation?(b=`Invalid input: must include "${y.validation.includes}"`,typeof y.validation.position=="number"&&(b=`${b} at one or more positions greater than or equal to ${y.validation.position}`)):"startsWith"in y.validation?b=`Invalid input: must start with "${y.validation.startsWith}"`:"endsWith"in y.validation?b=`Invalid input: must end with "${y.validation.endsWith}"`:Ot.assertNever(y.validation):y.validation!=="regex"?b=`Invalid ${y.validation}`:b="Invalid";break;case Oe.too_small:y.type==="array"?b=`Array must contain ${y.exact?"exactly":y.inclusive?"at least":"more than"} ${y.minimum} element(s)`:y.type==="string"?b=`String must contain ${y.exact?"exactly":y.inclusive?"at least":"over"} ${y.minimum} character(s)`:y.type==="number"?b=`Number must be ${y.exact?"exactly equal to ":y.inclusive?"greater than or equal to ":"greater than "}${y.minimum}`:y.type==="date"?b=`Date must be ${y.exact?"exactly equal to ":y.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(y.minimum))}`:b="Invalid input";break;case Oe.too_big:y.type==="array"?b=`Array must contain ${y.exact?"exactly":y.inclusive?"at most":"less than"} ${y.maximum} element(s)`:y.type==="string"?b=`String must contain ${y.exact?"exactly":y.inclusive?"at most":"under"} ${y.maximum} character(s)`:y.type==="number"?b=`Number must be ${y.exact?"exactly":y.inclusive?"less than or equal to":"less than"} ${y.maximum}`:y.type==="bigint"?b=`BigInt must be ${y.exact?"exactly":y.inclusive?"less than or equal to":"less than"} ${y.maximum}`:y.type==="date"?b=`Date must be ${y.exact?"exactly":y.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(y.maximum))}`:b="Invalid input";break;case Oe.custom:b="Invalid input";break;case Oe.invalid_intersection_types:b="Intersection results could not be merged";break;case Oe.not_multiple_of:b=`Number must be a multiple of ${y.multipleOf}`;break;case Oe.not_finite:b="Number must be finite";break;default:b=m.defaultError,Ot.assertNever(y)}return{message:b}};let Qf=fo;function Ry(y){Qf=y}function Uu(){return Qf}const $u=y=>{const{data:m,path:b,errorMaps:I,issueData:z}=y,R=[...b,...z.path||[]],S={...z,path:R};if(z.message!==void 0)return{...z,path:R,message:z.message};let o="";const le=I.filter(he=>!!he).slice().reverse();for(const he of le)o=he(S,{data:m,defaultError:o}).message;return{...z,path:R,message:o}},Dy=[];function qe(y,m){const b=Uu(),I=$u({issueData:m,data:y.data,path:y.path,errorMaps:[y.common.contextualErrorMap,y.schemaErrorMap,b,b===fo?void 0:fo].filter(z=>!!z)});y.common.issues.push(I)}class yr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(m,b){const I=[];for(const z of b){if(z.status==="aborted")return ht;z.status==="dirty"&&m.dirty(),I.push(z.value)}return{status:m.value,value:I}}static async mergeObjectAsync(m,b){const I=[];for(const z of b){const R=await z.key,S=await z.value;I.push({key:R,value:S})}return yr.mergeObjectSync(m,I)}static mergeObjectSync(m,b){const I={};for(const z of b){const{key:R,value:S}=z;if(R.status==="aborted"||S.status==="aborted")return ht;R.status==="dirty"&&m.dirty(),S.status==="dirty"&&m.dirty(),R.value!=="__proto__"&&(typeof S.value<"u"||z.alwaysSet)&&(I[R.value]=S.value)}return{status:m.value,value:I}}}const ht=Object.freeze({status:"aborted"}),mo=y=>({status:"dirty",value:y}),kr=y=>({status:"valid",value:y}),Dd=y=>y.status==="aborted",Ld=y=>y.status==="dirty",_s=y=>y.status==="valid",kl=y=>typeof Promise<"u"&&y instanceof Promise;function Gu(y,m,b,I){if(typeof m=="function"?y!==m||!0:!m.has(y))throw new TypeError("Cannot read private member from an object whose class did not declare it");return m.get(y)}function em(y,m,b,I,z){if(typeof m=="function"?y!==m||!0:!m.has(y))throw new TypeError("Cannot write private member to an object whose class did not declare it");return m.set(y,b),b}typeof SuppressedError=="function"&&SuppressedError;var it;(function(y){y.errToObj=m=>typeof m=="string"?{message:m}:m||{},y.toString=m=>typeof m=="string"?m:m==null?void 0:m.message})(it||(it={}));var zl,Al;class $n{constructor(m,b,I,z){this._cachedPath=[],this.parent=m,this.data=b,this._path=I,this._key=z}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const tm=(y,m)=>{if(_s(m))return{success:!0,data:m.value};if(!y.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const b=new Wr(y.common.issues);return this._error=b,this._error}}};function xt(y){if(!y)return{};const{errorMap:m,invalid_type_error:b,required_error:I,description:z}=y;if(m&&(b||I))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return m?{errorMap:m,description:z}:{errorMap:(S,o)=>{var le,he;const{message:_e}=y;return S.code==="invalid_enum_value"?{message:_e??o.defaultError}:typeof o.data>"u"?{message:(le=_e??I)!==null&&le!==void 0?le:o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:(he=_e??b)!==null&&he!==void 0?he:o.defaultError}},description:z}}class Tt{get description(){return this._def.description}_getType(m){return da(m.data)}_getOrReturnCtx(m,b){return b||{common:m.parent.common,data:m.data,parsedType:da(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}_processInputParams(m){return{status:new yr,ctx:{common:m.parent.common,data:m.data,parsedType:da(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}}_parseSync(m){const b=this._parse(m);if(kl(b))throw new Error("Synchronous parse encountered promise.");return b}_parseAsync(m){const b=this._parse(m);return Promise.resolve(b)}parse(m,b){const I=this.safeParse(m,b);if(I.success)return I.data;throw I.error}safeParse(m,b){var I;const z={common:{issues:[],async:(I=b==null?void 0:b.async)!==null&&I!==void 0?I:!1,contextualErrorMap:b==null?void 0:b.errorMap},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:da(m)},R=this._parseSync({data:m,path:z.path,parent:z});return tm(z,R)}"~validate"(m){var b,I;const z={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:da(m)};if(!this["~standard"].async)try{const R=this._parseSync({data:m,path:[],parent:z});return _s(R)?{value:R.value}:{issues:z.common.issues}}catch(R){!((I=(b=R==null?void 0:R.message)===null||b===void 0?void 0:b.toLowerCase())===null||I===void 0)&&I.includes("encountered")&&(this["~standard"].async=!0),z.common={issues:[],async:!0}}return this._parseAsync({data:m,path:[],parent:z}).then(R=>_s(R)?{value:R.value}:{issues:z.common.issues})}async parseAsync(m,b){const I=await this.safeParseAsync(m,b);if(I.success)return I.data;throw I.error}async safeParseAsync(m,b){const I={common:{issues:[],contextualErrorMap:b==null?void 0:b.errorMap,async:!0},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:da(m)},z=this._parse({data:m,path:I.path,parent:I}),R=await(kl(z)?z:Promise.resolve(z));return tm(I,R)}refine(m,b){const I=z=>typeof b=="string"||typeof b>"u"?{message:b}:typeof b=="function"?b(z):b;return this._refinement((z,R)=>{const S=m(z),o=()=>R.addIssue({code:Oe.custom,...I(z)});return typeof Promise<"u"&&S instanceof Promise?S.then(le=>le?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(m,b){return this._refinement((I,z)=>m(I)?!0:(z.addIssue(typeof b=="function"?b(I,z):b),!1))}_refinement(m){return new Sn({schema:this,typeName:ct.ZodEffects,effect:{type:"refinement",refinement:m}})}superRefine(m){return this._refinement(m)}constructor(m){this.spa=this.safeParseAsync,this._def=m,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:b=>this["~validate"](b)}}optional(){return qn.create(this,this._def)}nullable(){return Za.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mn.create(this)}promise(){return xo.create(this,this._def)}or(m){return Bl.create([this,m],this._def)}and(m){return Fl.create(this,m,this._def)}transform(m){return new Sn({...xt(this._def),schema:this,typeName:ct.ZodEffects,effect:{type:"transform",transform:m}})}default(m){const b=typeof m=="function"?m:()=>m;return new Vl({...xt(this._def),innerType:this,defaultValue:b,typeName:ct.ZodDefault})}brand(){return new Od({typeName:ct.ZodBranded,type:this,...xt(this._def)})}catch(m){const b=typeof m=="function"?m:()=>m;return new Ul({...xt(this._def),innerType:this,catchValue:b,typeName:ct.ZodCatch})}describe(m){const b=this.constructor;return new b({...this._def,description:m})}pipe(m){return $l.create(this,m)}readonly(){return Gl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ly=/^c[^\s-]{8,}$/i,By=/^[0-9a-z]+$/,Fy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Oy=/^[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,jy=/^[a-z0-9_-]{21}$/i,Ny=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Zy=/^[-+]?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)?)??$/,Vy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Uy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bd;const $y=/^(?:(?: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])$/,Gy=/^(?:(?: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])$/,qy=/^(([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]))$/,Hy=/^(([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])$/,Wy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,im="((\\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])))",Ky=new RegExp(`^${im}$`);function rm(y){let m="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return y.precision?m=`${m}\\.\\d{${y.precision}}`:y.precision==null&&(m=`${m}(\\.\\d+)?`),m}function Yy(y){return new RegExp(`^${rm(y)}$`)}function nm(y){let m=`${im}T${rm(y)}`;const b=[];return b.push(y.local?"Z?":"Z"),y.offset&&b.push("([+-]\\d{2}:?\\d{2})"),m=`${m}(${b.join("|")})`,new RegExp(`^${m}$`)}function Jy(y,m){return!!((m==="v4"||!m)&&$y.test(y)||(m==="v6"||!m)&&qy.test(y))}function Qy(y,m){if(!Ny.test(y))return!1;try{const[b]=y.split("."),I=b.replace(/-/g,"+").replace(/_/g,"/").padEnd(b.length+(4-b.length%4)%4,"="),z=JSON.parse(atob(I));return!(typeof z!="object"||z===null||!z.typ||!z.alg||m&&z.alg!==m)}catch{return!1}}function ex(y,m){return!!((m==="v4"||!m)&&Gy.test(y)||(m==="v6"||!m)&&Hy.test(y))}class Tn extends Tt{_parse(m){if(this._def.coerce&&(m.data=String(m.data)),this._getType(m)!==Ke.string){const R=this._getOrReturnCtx(m);return qe(R,{code:Oe.invalid_type,expected:Ke.string,received:R.parsedType}),ht}const I=new yr;let z;for(const R of this._def.checks)if(R.kind==="min")m.data.length<R.value&&(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.too_small,minimum:R.value,type:"string",inclusive:!0,exact:!1,message:R.message}),I.dirty());else if(R.kind==="max")m.data.length>R.value&&(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.too_big,maximum:R.value,type:"string",inclusive:!0,exact:!1,message:R.message}),I.dirty());else if(R.kind==="length"){const S=m.data.length>R.value,o=m.data.length<R.value;(S||o)&&(z=this._getOrReturnCtx(m,z),S?qe(z,{code:Oe.too_big,maximum:R.value,type:"string",inclusive:!0,exact:!0,message:R.message}):o&&qe(z,{code:Oe.too_small,minimum:R.value,type:"string",inclusive:!0,exact:!0,message:R.message}),I.dirty())}else if(R.kind==="email")Vy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"email",code:Oe.invalid_string,message:R.message}),I.dirty());else if(R.kind==="emoji")Bd||(Bd=new RegExp(Uy,"u")),Bd.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"emoji",code:Oe.invalid_string,message:R.message}),I.dirty());else if(R.kind==="uuid")Oy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"uuid",code:Oe.invalid_string,message:R.message}),I.dirty());else if(R.kind==="nanoid")jy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"nanoid",code:Oe.invalid_string,message:R.message}),I.dirty());else if(R.kind==="cuid")Ly.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"cuid",code:Oe.invalid_string,message:R.message}),I.dirty());else if(R.kind==="cuid2")By.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"cuid2",code:Oe.invalid_string,message:R.message}),I.dirty());else if(R.kind==="ulid")Fy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"ulid",code:Oe.invalid_string,message:R.message}),I.dirty());else if(R.kind==="url")try{new URL(m.data)}catch{z=this._getOrReturnCtx(m,z),qe(z,{validation:"url",code:Oe.invalid_string,message:R.message}),I.dirty()}else R.kind==="regex"?(R.regex.lastIndex=0,R.regex.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"regex",code:Oe.invalid_string,message:R.message}),I.dirty())):R.kind==="trim"?m.data=m.data.trim():R.kind==="includes"?m.data.includes(R.value,R.position)||(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.invalid_string,validation:{includes:R.value,position:R.position},message:R.message}),I.dirty()):R.kind==="toLowerCase"?m.data=m.data.toLowerCase():R.kind==="toUpperCase"?m.data=m.data.toUpperCase():R.kind==="startsWith"?m.data.startsWith(R.value)||(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.invalid_string,validation:{startsWith:R.value},message:R.message}),I.dirty()):R.kind==="endsWith"?m.data.endsWith(R.value)||(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.invalid_string,validation:{endsWith:R.value},message:R.message}),I.dirty()):R.kind==="datetime"?nm(R).test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.invalid_string,validation:"datetime",message:R.message}),I.dirty()):R.kind==="date"?Ky.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.invalid_string,validation:"date",message:R.message}),I.dirty()):R.kind==="time"?Yy(R).test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.invalid_string,validation:"time",message:R.message}),I.dirty()):R.kind==="duration"?Zy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"duration",code:Oe.invalid_string,message:R.message}),I.dirty()):R.kind==="ip"?Jy(m.data,R.version)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"ip",code:Oe.invalid_string,message:R.message}),I.dirty()):R.kind==="jwt"?Qy(m.data,R.alg)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"jwt",code:Oe.invalid_string,message:R.message}),I.dirty()):R.kind==="cidr"?ex(m.data,R.version)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"cidr",code:Oe.invalid_string,message:R.message}),I.dirty()):R.kind==="base64"?Wy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"base64",code:Oe.invalid_string,message:R.message}),I.dirty()):R.kind==="base64url"?Xy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"base64url",code:Oe.invalid_string,message:R.message}),I.dirty()):Ot.assertNever(R);return{status:I.value,value:m.data}}_regex(m,b,I){return this.refinement(z=>m.test(z),{validation:b,code:Oe.invalid_string,...it.errToObj(I)})}_addCheck(m){return new Tn({...this._def,checks:[...this._def.checks,m]})}email(m){return this._addCheck({kind:"email",...it.errToObj(m)})}url(m){return this._addCheck({kind:"url",...it.errToObj(m)})}emoji(m){return this._addCheck({kind:"emoji",...it.errToObj(m)})}uuid(m){return this._addCheck({kind:"uuid",...it.errToObj(m)})}nanoid(m){return this._addCheck({kind:"nanoid",...it.errToObj(m)})}cuid(m){return this._addCheck({kind:"cuid",...it.errToObj(m)})}cuid2(m){return this._addCheck({kind:"cuid2",...it.errToObj(m)})}ulid(m){return this._addCheck({kind:"ulid",...it.errToObj(m)})}base64(m){return this._addCheck({kind:"base64",...it.errToObj(m)})}base64url(m){return this._addCheck({kind:"base64url",...it.errToObj(m)})}jwt(m){return this._addCheck({kind:"jwt",...it.errToObj(m)})}ip(m){return this._addCheck({kind:"ip",...it.errToObj(m)})}cidr(m){return this._addCheck({kind:"cidr",...it.errToObj(m)})}datetime(m){var b,I;return typeof m=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:m}):this._addCheck({kind:"datetime",precision:typeof(m==null?void 0:m.precision)>"u"?null:m==null?void 0:m.precision,offset:(b=m==null?void 0:m.offset)!==null&&b!==void 0?b:!1,local:(I=m==null?void 0:m.local)!==null&&I!==void 0?I:!1,...it.errToObj(m==null?void 0:m.message)})}date(m){return this._addCheck({kind:"date",message:m})}time(m){return typeof m=="string"?this._addCheck({kind:"time",precision:null,message:m}):this._addCheck({kind:"time",precision:typeof(m==null?void 0:m.precision)>"u"?null:m==null?void 0:m.precision,...it.errToObj(m==null?void 0:m.message)})}duration(m){return this._addCheck({kind:"duration",...it.errToObj(m)})}regex(m,b){return this._addCheck({kind:"regex",regex:m,...it.errToObj(b)})}includes(m,b){return this._addCheck({kind:"includes",value:m,position:b==null?void 0:b.position,...it.errToObj(b==null?void 0:b.message)})}startsWith(m,b){return this._addCheck({kind:"startsWith",value:m,...it.errToObj(b)})}endsWith(m,b){return this._addCheck({kind:"endsWith",value:m,...it.errToObj(b)})}min(m,b){return this._addCheck({kind:"min",value:m,...it.errToObj(b)})}max(m,b){return this._addCheck({kind:"max",value:m,...it.errToObj(b)})}length(m,b){return this._addCheck({kind:"length",value:m,...it.errToObj(b)})}nonempty(m){return this.min(1,it.errToObj(m))}trim(){return new Tn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Tn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Tn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(m=>m.kind==="datetime")}get isDate(){return!!this._def.checks.find(m=>m.kind==="date")}get isTime(){return!!this._def.checks.find(m=>m.kind==="time")}get isDuration(){return!!this._def.checks.find(m=>m.kind==="duration")}get isEmail(){return!!this._def.checks.find(m=>m.kind==="email")}get isURL(){return!!this._def.checks.find(m=>m.kind==="url")}get isEmoji(){return!!this._def.checks.find(m=>m.kind==="emoji")}get isUUID(){return!!this._def.checks.find(m=>m.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(m=>m.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(m=>m.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(m=>m.kind==="cuid2")}get isULID(){return!!this._def.checks.find(m=>m.kind==="ulid")}get isIP(){return!!this._def.checks.find(m=>m.kind==="ip")}get isCIDR(){return!!this._def.checks.find(m=>m.kind==="cidr")}get isBase64(){return!!this._def.checks.find(m=>m.kind==="base64")}get isBase64url(){return!!this._def.checks.find(m=>m.kind==="base64url")}get minLength(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxLength(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}}Tn.create=y=>{var m;return new Tn({checks:[],typeName:ct.ZodString,coerce:(m=y==null?void 0:y.coerce)!==null&&m!==void 0?m:!1,...xt(y)})};function tx(y,m){const b=(y.toString().split(".")[1]||"").length,I=(m.toString().split(".")[1]||"").length,z=b>I?b:I,R=parseInt(y.toFixed(z).replace(".","")),S=parseInt(m.toFixed(z).replace(".",""));return R%S/Math.pow(10,z)}class Oa extends Tt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(m){if(this._def.coerce&&(m.data=Number(m.data)),this._getType(m)!==Ke.number){const R=this._getOrReturnCtx(m);return qe(R,{code:Oe.invalid_type,expected:Ke.number,received:R.parsedType}),ht}let I;const z=new yr;for(const R of this._def.checks)R.kind==="int"?Ot.isInteger(m.data)||(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.invalid_type,expected:"integer",received:"float",message:R.message}),z.dirty()):R.kind==="min"?(R.inclusive?m.data<R.value:m.data<=R.value)&&(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.too_small,minimum:R.value,type:"number",inclusive:R.inclusive,exact:!1,message:R.message}),z.dirty()):R.kind==="max"?(R.inclusive?m.data>R.value:m.data>=R.value)&&(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.too_big,maximum:R.value,type:"number",inclusive:R.inclusive,exact:!1,message:R.message}),z.dirty()):R.kind==="multipleOf"?tx(m.data,R.value)!==0&&(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.not_multiple_of,multipleOf:R.value,message:R.message}),z.dirty()):R.kind==="finite"?Number.isFinite(m.data)||(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.not_finite,message:R.message}),z.dirty()):Ot.assertNever(R);return{status:z.value,value:m.data}}gte(m,b){return this.setLimit("min",m,!0,it.toString(b))}gt(m,b){return this.setLimit("min",m,!1,it.toString(b))}lte(m,b){return this.setLimit("max",m,!0,it.toString(b))}lt(m,b){return this.setLimit("max",m,!1,it.toString(b))}setLimit(m,b,I,z){return new Oa({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:I,message:it.toString(z)}]})}_addCheck(m){return new Oa({...this._def,checks:[...this._def.checks,m]})}int(m){return this._addCheck({kind:"int",message:it.toString(m)})}positive(m){return this._addCheck({kind:"min",value:0,inclusive:!1,message:it.toString(m)})}negative(m){return this._addCheck({kind:"max",value:0,inclusive:!1,message:it.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:0,inclusive:!0,message:it.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:0,inclusive:!0,message:it.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:it.toString(b)})}finite(m){return this._addCheck({kind:"finite",message:it.toString(m)})}safe(m){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:it.toString(m)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:it.toString(m)})}get minValue(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxValue(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}get isInt(){return!!this._def.checks.find(m=>m.kind==="int"||m.kind==="multipleOf"&&Ot.isInteger(m.value))}get isFinite(){let m=null,b=null;for(const I of this._def.checks){if(I.kind==="finite"||I.kind==="int"||I.kind==="multipleOf")return!0;I.kind==="min"?(b===null||I.value>b)&&(b=I.value):I.kind==="max"&&(m===null||I.value<m)&&(m=I.value)}return Number.isFinite(b)&&Number.isFinite(m)}}Oa.create=y=>new Oa({checks:[],typeName:ct.ZodNumber,coerce:(y==null?void 0:y.coerce)||!1,...xt(y)});class ja extends Tt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(m){if(this._def.coerce)try{m.data=BigInt(m.data)}catch{return this._getInvalidInput(m)}if(this._getType(m)!==Ke.bigint)return this._getInvalidInput(m);let I;const z=new yr;for(const R of this._def.checks)R.kind==="min"?(R.inclusive?m.data<R.value:m.data<=R.value)&&(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.too_small,type:"bigint",minimum:R.value,inclusive:R.inclusive,message:R.message}),z.dirty()):R.kind==="max"?(R.inclusive?m.data>R.value:m.data>=R.value)&&(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.too_big,type:"bigint",maximum:R.value,inclusive:R.inclusive,message:R.message}),z.dirty()):R.kind==="multipleOf"?m.data%R.value!==BigInt(0)&&(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.not_multiple_of,multipleOf:R.value,message:R.message}),z.dirty()):Ot.assertNever(R);return{status:z.value,value:m.data}}_getInvalidInput(m){const b=this._getOrReturnCtx(m);return qe(b,{code:Oe.invalid_type,expected:Ke.bigint,received:b.parsedType}),ht}gte(m,b){return this.setLimit("min",m,!0,it.toString(b))}gt(m,b){return this.setLimit("min",m,!1,it.toString(b))}lte(m,b){return this.setLimit("max",m,!0,it.toString(b))}lt(m,b){return this.setLimit("max",m,!1,it.toString(b))}setLimit(m,b,I,z){return new ja({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:I,message:it.toString(z)}]})}_addCheck(m){return new ja({...this._def,checks:[...this._def.checks,m]})}positive(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:it.toString(m)})}negative(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:it.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:it.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:it.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:it.toString(b)})}get minValue(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxValue(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}}ja.create=y=>{var m;return new ja({checks:[],typeName:ct.ZodBigInt,coerce:(m=y==null?void 0:y.coerce)!==null&&m!==void 0?m:!1,...xt(y)})};class Rl extends Tt{_parse(m){if(this._def.coerce&&(m.data=!!m.data),this._getType(m)!==Ke.boolean){const I=this._getOrReturnCtx(m);return qe(I,{code:Oe.invalid_type,expected:Ke.boolean,received:I.parsedType}),ht}return kr(m.data)}}Rl.create=y=>new Rl({typeName:ct.ZodBoolean,coerce:(y==null?void 0:y.coerce)||!1,...xt(y)});class ys extends Tt{_parse(m){if(this._def.coerce&&(m.data=new Date(m.data)),this._getType(m)!==Ke.date){const R=this._getOrReturnCtx(m);return qe(R,{code:Oe.invalid_type,expected:Ke.date,received:R.parsedType}),ht}if(isNaN(m.data.getTime())){const R=this._getOrReturnCtx(m);return qe(R,{code:Oe.invalid_date}),ht}const I=new yr;let z;for(const R of this._def.checks)R.kind==="min"?m.data.getTime()<R.value&&(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.too_small,message:R.message,inclusive:!0,exact:!1,minimum:R.value,type:"date"}),I.dirty()):R.kind==="max"?m.data.getTime()>R.value&&(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.too_big,message:R.message,inclusive:!0,exact:!1,maximum:R.value,type:"date"}),I.dirty()):Ot.assertNever(R);return{status:I.value,value:new Date(m.data.getTime())}}_addCheck(m){return new ys({...this._def,checks:[...this._def.checks,m]})}min(m,b){return this._addCheck({kind:"min",value:m.getTime(),message:it.toString(b)})}max(m,b){return this._addCheck({kind:"max",value:m.getTime(),message:it.toString(b)})}get minDate(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m!=null?new Date(m):null}get maxDate(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m!=null?new Date(m):null}}ys.create=y=>new ys({checks:[],coerce:(y==null?void 0:y.coerce)||!1,typeName:ct.ZodDate,...xt(y)});class qu extends Tt{_parse(m){if(this._getType(m)!==Ke.symbol){const I=this._getOrReturnCtx(m);return qe(I,{code:Oe.invalid_type,expected:Ke.symbol,received:I.parsedType}),ht}return kr(m.data)}}qu.create=y=>new qu({typeName:ct.ZodSymbol,...xt(y)});class Dl extends Tt{_parse(m){if(this._getType(m)!==Ke.undefined){const I=this._getOrReturnCtx(m);return qe(I,{code:Oe.invalid_type,expected:Ke.undefined,received:I.parsedType}),ht}return kr(m.data)}}Dl.create=y=>new Dl({typeName:ct.ZodUndefined,...xt(y)});class Ll extends Tt{_parse(m){if(this._getType(m)!==Ke.null){const I=this._getOrReturnCtx(m);return qe(I,{code:Oe.invalid_type,expected:Ke.null,received:I.parsedType}),ht}return kr(m.data)}}Ll.create=y=>new Ll({typeName:ct.ZodNull,...xt(y)});class go extends Tt{constructor(){super(...arguments),this._any=!0}_parse(m){return kr(m.data)}}go.create=y=>new go({typeName:ct.ZodAny,...xt(y)});class xs extends Tt{constructor(){super(...arguments),this._unknown=!0}_parse(m){return kr(m.data)}}xs.create=y=>new xs({typeName:ct.ZodUnknown,...xt(y)});class pa extends Tt{_parse(m){const b=this._getOrReturnCtx(m);return qe(b,{code:Oe.invalid_type,expected:Ke.never,received:b.parsedType}),ht}}pa.create=y=>new pa({typeName:ct.ZodNever,...xt(y)});class Hu extends Tt{_parse(m){if(this._getType(m)!==Ke.undefined){const I=this._getOrReturnCtx(m);return qe(I,{code:Oe.invalid_type,expected:Ke.void,received:I.parsedType}),ht}return kr(m.data)}}Hu.create=y=>new Hu({typeName:ct.ZodVoid,...xt(y)});class Mn extends Tt{_parse(m){const{ctx:b,status:I}=this._processInputParams(m),z=this._def;if(b.parsedType!==Ke.array)return qe(b,{code:Oe.invalid_type,expected:Ke.array,received:b.parsedType}),ht;if(z.exactLength!==null){const S=b.data.length>z.exactLength.value,o=b.data.length<z.exactLength.value;(S||o)&&(qe(b,{code:S?Oe.too_big:Oe.too_small,minimum:o?z.exactLength.value:void 0,maximum:S?z.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:z.exactLength.message}),I.dirty())}if(z.minLength!==null&&b.data.length<z.minLength.value&&(qe(b,{code:Oe.too_small,minimum:z.minLength.value,type:"array",inclusive:!0,exact:!1,message:z.minLength.message}),I.dirty()),z.maxLength!==null&&b.data.length>z.maxLength.value&&(qe(b,{code:Oe.too_big,maximum:z.maxLength.value,type:"array",inclusive:!0,exact:!1,message:z.maxLength.message}),I.dirty()),b.common.async)return Promise.all([...b.data].map((S,o)=>z.type._parseAsync(new $n(b,S,b.path,o)))).then(S=>yr.mergeArray(I,S));const R=[...b.data].map((S,o)=>z.type._parseSync(new $n(b,S,b.path,o)));return yr.mergeArray(I,R)}get element(){return this._def.type}min(m,b){return new Mn({...this._def,minLength:{value:m,message:it.toString(b)}})}max(m,b){return new Mn({...this._def,maxLength:{value:m,message:it.toString(b)}})}length(m,b){return new Mn({...this._def,exactLength:{value:m,message:it.toString(b)}})}nonempty(m){return this.min(1,m)}}Mn.create=(y,m)=>new Mn({type:y,minLength:null,maxLength:null,exactLength:null,typeName:ct.ZodArray,...xt(m)});function _o(y){if(y instanceof Ii){const m={};for(const b in y.shape){const I=y.shape[b];m[b]=qn.create(_o(I))}return new Ii({...y._def,shape:()=>m})}else return y instanceof Mn?new Mn({...y._def,type:_o(y.element)}):y instanceof qn?qn.create(_o(y.unwrap())):y instanceof Za?Za.create(_o(y.unwrap())):y instanceof Gn?Gn.create(y.items.map(m=>_o(m))):y}class Ii extends Tt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const m=this._def.shape(),b=Ot.objectKeys(m);return this._cached={shape:m,keys:b}}_parse(m){if(this._getType(m)!==Ke.object){const he=this._getOrReturnCtx(m);return qe(he,{code:Oe.invalid_type,expected:Ke.object,received:he.parsedType}),ht}const{status:I,ctx:z}=this._processInputParams(m),{shape:R,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof pa&&this._def.unknownKeys==="strip"))for(const he in z.data)S.includes(he)||o.push(he);const le=[];for(const he of S){const _e=R[he],Re=z.data[he];le.push({key:{status:"valid",value:he},value:_e._parse(new $n(z,Re,z.path,he)),alwaysSet:he in z.data})}if(this._def.catchall instanceof pa){const he=this._def.unknownKeys;if(he==="passthrough")for(const _e of o)le.push({key:{status:"valid",value:_e},value:{status:"valid",value:z.data[_e]}});else if(he==="strict")o.length>0&&(qe(z,{code:Oe.unrecognized_keys,keys:o}),I.dirty());else if(he!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const he=this._def.catchall;for(const _e of o){const Re=z.data[_e];le.push({key:{status:"valid",value:_e},value:he._parse(new $n(z,Re,z.path,_e)),alwaysSet:_e in z.data})}}return z.common.async?Promise.resolve().then(async()=>{const he=[];for(const _e of le){const Re=await _e.key,ve=await _e.value;he.push({key:Re,value:ve,alwaysSet:_e.alwaysSet})}return he}).then(he=>yr.mergeObjectSync(I,he)):yr.mergeObjectSync(I,le)}get shape(){return this._def.shape()}strict(m){return it.errToObj,new Ii({...this._def,unknownKeys:"strict",...m!==void 0?{errorMap:(b,I)=>{var z,R,S,o;const le=(S=(R=(z=this._def).errorMap)===null||R===void 0?void 0:R.call(z,b,I).message)!==null&&S!==void 0?S:I.defaultError;return b.code==="unrecognized_keys"?{message:(o=it.errToObj(m).message)!==null&&o!==void 0?o:le}:{message:le}}}:{}})}strip(){return new Ii({...this._def,unknownKeys:"strip"})}passthrough(){return new Ii({...this._def,unknownKeys:"passthrough"})}extend(m){return new Ii({...this._def,shape:()=>({...this._def.shape(),...m})})}merge(m){return new Ii({unknownKeys:m._def.unknownKeys,catchall:m._def.catchall,shape:()=>({...this._def.shape(),...m._def.shape()}),typeName:ct.ZodObject})}setKey(m,b){return this.augment({[m]:b})}catchall(m){return new Ii({...this._def,catchall:m})}pick(m){const b={};return Ot.objectKeys(m).forEach(I=>{m[I]&&this.shape[I]&&(b[I]=this.shape[I])}),new Ii({...this._def,shape:()=>b})}omit(m){const b={};return Ot.objectKeys(this.shape).forEach(I=>{m[I]||(b[I]=this.shape[I])}),new Ii({...this._def,shape:()=>b})}deepPartial(){return _o(this)}partial(m){const b={};return Ot.objectKeys(this.shape).forEach(I=>{const z=this.shape[I];m&&!m[I]?b[I]=z:b[I]=z.optional()}),new Ii({...this._def,shape:()=>b})}required(m){const b={};return Ot.objectKeys(this.shape).forEach(I=>{if(m&&!m[I])b[I]=this.shape[I];else{let R=this.shape[I];for(;R instanceof qn;)R=R._def.innerType;b[I]=R}}),new Ii({...this._def,shape:()=>b})}keyof(){return am(Ot.objectKeys(this.shape))}}Ii.create=(y,m)=>new Ii({shape:()=>y,unknownKeys:"strip",catchall:pa.create(),typeName:ct.ZodObject,...xt(m)}),Ii.strictCreate=(y,m)=>new Ii({shape:()=>y,unknownKeys:"strict",catchall:pa.create(),typeName:ct.ZodObject,...xt(m)}),Ii.lazycreate=(y,m)=>new Ii({shape:y,unknownKeys:"strip",catchall:pa.create(),typeName:ct.ZodObject,...xt(m)});class Bl extends Tt{_parse(m){const{ctx:b}=this._processInputParams(m),I=this._def.options;function z(R){for(const o of R)if(o.result.status==="valid")return o.result;for(const o of R)if(o.result.status==="dirty")return b.common.issues.push(...o.ctx.common.issues),o.result;const S=R.map(o=>new Wr(o.ctx.common.issues));return qe(b,{code:Oe.invalid_union,unionErrors:S}),ht}if(b.common.async)return Promise.all(I.map(async R=>{const S={...b,common:{...b.common,issues:[]},parent:null};return{result:await R._parseAsync({data:b.data,path:b.path,parent:S}),ctx:S}})).then(z);{let R;const S=[];for(const le of I){const he={...b,common:{...b.common,issues:[]},parent:null},_e=le._parseSync({data:b.data,path:b.path,parent:he});if(_e.status==="valid")return _e;_e.status==="dirty"&&!R&&(R={result:_e,ctx:he}),he.common.issues.length&&S.push(he.common.issues)}if(R)return b.common.issues.push(...R.ctx.common.issues),R.result;const o=S.map(le=>new Wr(le));return qe(b,{code:Oe.invalid_union,unionErrors:o}),ht}}get options(){return this._def.options}}Bl.create=(y,m)=>new Bl({options:y,typeName:ct.ZodUnion,...xt(m)});const fa=y=>y instanceof jl?fa(y.schema):y instanceof Sn?fa(y.innerType()):y instanceof Nl?[y.value]:y instanceof Na?y.options:y instanceof Zl?Ot.objectValues(y.enum):y instanceof Vl?fa(y._def.innerType):y instanceof Dl?[void 0]:y instanceof Ll?[null]:y instanceof qn?[void 0,...fa(y.unwrap())]:y instanceof Za?[null,...fa(y.unwrap())]:y instanceof Od||y instanceof Gl?fa(y.unwrap()):y instanceof Ul?fa(y._def.innerType):[];class Wu extends Tt{_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Ke.object)return qe(b,{code:Oe.invalid_type,expected:Ke.object,received:b.parsedType}),ht;const I=this.discriminator,z=b.data[I],R=this.optionsMap.get(z);return R?b.common.async?R._parseAsync({data:b.data,path:b.path,parent:b}):R._parseSync({data:b.data,path:b.path,parent:b}):(qe(b,{code:Oe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[I]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(m,b,I){const z=new Map;for(const R of b){const S=fa(R.shape[m]);if(!S.length)throw new Error(`A discriminator value for key \`${m}\` could not be extracted from all schema options`);for(const o of S){if(z.has(o))throw new Error(`Discriminator property ${String(m)} has duplicate value ${String(o)}`);z.set(o,R)}}return new Wu({typeName:ct.ZodDiscriminatedUnion,discriminator:m,options:b,optionsMap:z,...xt(I)})}}function Fd(y,m){const b=da(y),I=da(m);if(y===m)return{valid:!0,data:y};if(b===Ke.object&&I===Ke.object){const z=Ot.objectKeys(m),R=Ot.objectKeys(y).filter(o=>z.indexOf(o)!==-1),S={...y,...m};for(const o of R){const le=Fd(y[o],m[o]);if(!le.valid)return{valid:!1};S[o]=le.data}return{valid:!0,data:S}}else if(b===Ke.array&&I===Ke.array){if(y.length!==m.length)return{valid:!1};const z=[];for(let R=0;R<y.length;R++){const S=y[R],o=m[R],le=Fd(S,o);if(!le.valid)return{valid:!1};z.push(le.data)}return{valid:!0,data:z}}else return b===Ke.date&&I===Ke.date&&+y==+m?{valid:!0,data:y}:{valid:!1}}class Fl extends Tt{_parse(m){const{status:b,ctx:I}=this._processInputParams(m),z=(R,S)=>{if(Dd(R)||Dd(S))return ht;const o=Fd(R.value,S.value);return o.valid?((Ld(R)||Ld(S))&&b.dirty(),{status:b.value,value:o.data}):(qe(I,{code:Oe.invalid_intersection_types}),ht)};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(([R,S])=>z(R,S)):z(this._def.left._parseSync({data:I.data,path:I.path,parent:I}),this._def.right._parseSync({data:I.data,path:I.path,parent:I}))}}Fl.create=(y,m,b)=>new Fl({left:y,right:m,typeName:ct.ZodIntersection,...xt(b)});class Gn extends Tt{_parse(m){const{status:b,ctx:I}=this._processInputParams(m);if(I.parsedType!==Ke.array)return qe(I,{code:Oe.invalid_type,expected:Ke.array,received:I.parsedType}),ht;if(I.data.length<this._def.items.length)return qe(I,{code:Oe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ht;!this._def.rest&&I.data.length>this._def.items.length&&(qe(I,{code:Oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b.dirty());const R=[...I.data].map((S,o)=>{const le=this._def.items[o]||this._def.rest;return le?le._parse(new $n(I,S,I.path,o)):null}).filter(S=>!!S);return I.common.async?Promise.all(R).then(S=>yr.mergeArray(b,S)):yr.mergeArray(b,R)}get items(){return this._def.items}rest(m){return new Gn({...this._def,rest:m})}}Gn.create=(y,m)=>{if(!Array.isArray(y))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Gn({items:y,typeName:ct.ZodTuple,rest:null,...xt(m)})};class Ol extends Tt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:I}=this._processInputParams(m);if(I.parsedType!==Ke.object)return qe(I,{code:Oe.invalid_type,expected:Ke.object,received:I.parsedType}),ht;const z=[],R=this._def.keyType,S=this._def.valueType;for(const o in I.data)z.push({key:R._parse(new $n(I,o,I.path,o)),value:S._parse(new $n(I,I.data[o],I.path,o)),alwaysSet:o in I.data});return I.common.async?yr.mergeObjectAsync(b,z):yr.mergeObjectSync(b,z)}get element(){return this._def.valueType}static create(m,b,I){return b instanceof Tt?new Ol({keyType:m,valueType:b,typeName:ct.ZodRecord,...xt(I)}):new Ol({keyType:Tn.create(),valueType:m,typeName:ct.ZodRecord,...xt(b)})}}class Xu extends Tt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:I}=this._processInputParams(m);if(I.parsedType!==Ke.map)return qe(I,{code:Oe.invalid_type,expected:Ke.map,received:I.parsedType}),ht;const z=this._def.keyType,R=this._def.valueType,S=[...I.data.entries()].map(([o,le],he)=>({key:z._parse(new $n(I,o,I.path,[he,"key"])),value:R._parse(new $n(I,le,I.path,[he,"value"]))}));if(I.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const le of S){const he=await le.key,_e=await le.value;if(he.status==="aborted"||_e.status==="aborted")return ht;(he.status==="dirty"||_e.status==="dirty")&&b.dirty(),o.set(he.value,_e.value)}return{status:b.value,value:o}})}else{const o=new Map;for(const le of S){const he=le.key,_e=le.value;if(he.status==="aborted"||_e.status==="aborted")return ht;(he.status==="dirty"||_e.status==="dirty")&&b.dirty(),o.set(he.value,_e.value)}return{status:b.value,value:o}}}}Xu.create=(y,m,b)=>new Xu({valueType:m,keyType:y,typeName:ct.ZodMap,...xt(b)});class vs extends Tt{_parse(m){const{status:b,ctx:I}=this._processInputParams(m);if(I.parsedType!==Ke.set)return qe(I,{code:Oe.invalid_type,expected:Ke.set,received:I.parsedType}),ht;const z=this._def;z.minSize!==null&&I.data.size<z.minSize.value&&(qe(I,{code:Oe.too_small,minimum:z.minSize.value,type:"set",inclusive:!0,exact:!1,message:z.minSize.message}),b.dirty()),z.maxSize!==null&&I.data.size>z.maxSize.value&&(qe(I,{code:Oe.too_big,maximum:z.maxSize.value,type:"set",inclusive:!0,exact:!1,message:z.maxSize.message}),b.dirty());const R=this._def.valueType;function S(le){const he=new Set;for(const _e of le){if(_e.status==="aborted")return ht;_e.status==="dirty"&&b.dirty(),he.add(_e.value)}return{status:b.value,value:he}}const o=[...I.data.values()].map((le,he)=>R._parse(new $n(I,le,I.path,he)));return I.common.async?Promise.all(o).then(le=>S(le)):S(o)}min(m,b){return new vs({...this._def,minSize:{value:m,message:it.toString(b)}})}max(m,b){return new vs({...this._def,maxSize:{value:m,message:it.toString(b)}})}size(m,b){return this.min(m,b).max(m,b)}nonempty(m){return this.min(1,m)}}vs.create=(y,m)=>new vs({valueType:y,minSize:null,maxSize:null,typeName:ct.ZodSet,...xt(m)});class yo extends Tt{constructor(){super(...arguments),this.validate=this.implement}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Ke.function)return qe(b,{code:Oe.invalid_type,expected:Ke.function,received:b.parsedType}),ht;function I(o,le){return $u({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Uu(),fo].filter(he=>!!he),issueData:{code:Oe.invalid_arguments,argumentsError:le}})}function z(o,le){return $u({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Uu(),fo].filter(he=>!!he),issueData:{code:Oe.invalid_return_type,returnTypeError:le}})}const R={errorMap:b.common.contextualErrorMap},S=b.data;if(this._def.returns instanceof xo){const o=this;return kr(async function(...le){const he=new Wr([]),_e=await o._def.args.parseAsync(le,R).catch(ne=>{throw he.addIssue(I(le,ne)),he}),Re=await Reflect.apply(S,this,_e);return await o._def.returns._def.type.parseAsync(Re,R).catch(ne=>{throw he.addIssue(z(Re,ne)),he})})}else{const o=this;return kr(function(...le){const he=o._def.args.safeParse(le,R);if(!he.success)throw new Wr([I(le,he.error)]);const _e=Reflect.apply(S,this,he.data),Re=o._def.returns.safeParse(_e,R);if(!Re.success)throw new Wr([z(_e,Re.error)]);return Re.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...m){return new yo({...this._def,args:Gn.create(m).rest(xs.create())})}returns(m){return new yo({...this._def,returns:m})}implement(m){return this.parse(m)}strictImplement(m){return this.parse(m)}static create(m,b,I){return new yo({args:m||Gn.create([]).rest(xs.create()),returns:b||xs.create(),typeName:ct.ZodFunction,...xt(I)})}}class jl extends Tt{get schema(){return this._def.getter()}_parse(m){const{ctx:b}=this._processInputParams(m);return this._def.getter()._parse({data:b.data,path:b.path,parent:b})}}jl.create=(y,m)=>new jl({getter:y,typeName:ct.ZodLazy,...xt(m)});class Nl extends Tt{_parse(m){if(m.data!==this._def.value){const b=this._getOrReturnCtx(m);return qe(b,{received:b.data,code:Oe.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:m.data}}get value(){return this._def.value}}Nl.create=(y,m)=>new Nl({value:y,typeName:ct.ZodLiteral,...xt(m)});function am(y,m){return new Na({values:y,typeName:ct.ZodEnum,...xt(m)})}class Na extends Tt{constructor(){super(...arguments),zl.set(this,void 0)}_parse(m){if(typeof m.data!="string"){const b=this._getOrReturnCtx(m),I=this._def.values;return qe(b,{expected:Ot.joinValues(I),received:b.parsedType,code:Oe.invalid_type}),ht}if(Gu(this,zl)||em(this,zl,new Set(this._def.values)),!Gu(this,zl).has(m.data)){const b=this._getOrReturnCtx(m),I=this._def.values;return qe(b,{received:b.data,code:Oe.invalid_enum_value,options:I}),ht}return kr(m.data)}get options(){return this._def.values}get enum(){const m={};for(const b of this._def.values)m[b]=b;return m}get Values(){const m={};for(const b of this._def.values)m[b]=b;return m}get Enum(){const m={};for(const b of this._def.values)m[b]=b;return m}extract(m,b=this._def){return Na.create(m,{...this._def,...b})}exclude(m,b=this._def){return Na.create(this.options.filter(I=>!m.includes(I)),{...this._def,...b})}}zl=new WeakMap,Na.create=am;class Zl extends Tt{constructor(){super(...arguments),Al.set(this,void 0)}_parse(m){const b=Ot.getValidEnumValues(this._def.values),I=this._getOrReturnCtx(m);if(I.parsedType!==Ke.string&&I.parsedType!==Ke.number){const z=Ot.objectValues(b);return qe(I,{expected:Ot.joinValues(z),received:I.parsedType,code:Oe.invalid_type}),ht}if(Gu(this,Al)||em(this,Al,new Set(Ot.getValidEnumValues(this._def.values))),!Gu(this,Al).has(m.data)){const z=Ot.objectValues(b);return qe(I,{received:I.data,code:Oe.invalid_enum_value,options:z}),ht}return kr(m.data)}get enum(){return this._def.values}}Al=new WeakMap,Zl.create=(y,m)=>new Zl({values:y,typeName:ct.ZodNativeEnum,...xt(m)});class xo extends Tt{unwrap(){return this._def.type}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Ke.promise&&b.common.async===!1)return qe(b,{code:Oe.invalid_type,expected:Ke.promise,received:b.parsedType}),ht;const I=b.parsedType===Ke.promise?b.data:Promise.resolve(b.data);return kr(I.then(z=>this._def.type.parseAsync(z,{path:b.path,errorMap:b.common.contextualErrorMap})))}}xo.create=(y,m)=>new xo({type:y,typeName:ct.ZodPromise,...xt(m)});class Sn extends Tt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ct.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(m){const{status:b,ctx:I}=this._processInputParams(m),z=this._def.effect||null,R={addIssue:S=>{qe(I,S),S.fatal?b.abort():b.dirty()},get path(){return I.path}};if(R.addIssue=R.addIssue.bind(R),z.type==="preprocess"){const S=z.transform(I.data,R);if(I.common.async)return Promise.resolve(S).then(async o=>{if(b.value==="aborted")return ht;const le=await this._def.schema._parseAsync({data:o,path:I.path,parent:I});return le.status==="aborted"?ht:le.status==="dirty"||b.value==="dirty"?mo(le.value):le});{if(b.value==="aborted")return ht;const o=this._def.schema._parseSync({data:S,path:I.path,parent:I});return o.status==="aborted"?ht:o.status==="dirty"||b.value==="dirty"?mo(o.value):o}}if(z.type==="refinement"){const S=o=>{const le=z.refinement(o,R);if(I.common.async)return Promise.resolve(le);if(le 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"?ht:(o.status==="dirty"&&b.dirty(),S(o.value),{status:b.value,value:o.value})}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(o=>o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value).then(()=>({status:b.value,value:o.value}))))}if(z.type==="transform")if(I.common.async===!1){const S=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});if(!_s(S))return S;const o=z.transform(S.value,R);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:b.value,value:o}}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(S=>_s(S)?Promise.resolve(z.transform(S.value,R)).then(o=>({status:b.value,value:o})):S);Ot.assertNever(z)}}Sn.create=(y,m,b)=>new Sn({schema:y,typeName:ct.ZodEffects,effect:m,...xt(b)}),Sn.createWithPreprocess=(y,m,b)=>new Sn({schema:m,effect:{type:"preprocess",transform:y},typeName:ct.ZodEffects,...xt(b)});class qn extends Tt{_parse(m){return this._getType(m)===Ke.undefined?kr(void 0):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}qn.create=(y,m)=>new qn({innerType:y,typeName:ct.ZodOptional,...xt(m)});class Za extends Tt{_parse(m){return this._getType(m)===Ke.null?kr(null):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}Za.create=(y,m)=>new Za({innerType:y,typeName:ct.ZodNullable,...xt(m)});class Vl extends Tt{_parse(m){const{ctx:b}=this._processInputParams(m);let I=b.data;return b.parsedType===Ke.undefined&&(I=this._def.defaultValue()),this._def.innerType._parse({data:I,path:b.path,parent:b})}removeDefault(){return this._def.innerType}}Vl.create=(y,m)=>new Vl({innerType:y,typeName:ct.ZodDefault,defaultValue:typeof m.default=="function"?m.default:()=>m.default,...xt(m)});class Ul extends Tt{_parse(m){const{ctx:b}=this._processInputParams(m),I={...b,common:{...b.common,issues:[]}},z=this._def.innerType._parse({data:I.data,path:I.path,parent:{...I}});return kl(z)?z.then(R=>({status:"valid",value:R.status==="valid"?R.value:this._def.catchValue({get error(){return new Wr(I.common.issues)},input:I.data})})):{status:"valid",value:z.status==="valid"?z.value:this._def.catchValue({get error(){return new Wr(I.common.issues)},input:I.data})}}removeCatch(){return this._def.innerType}}Ul.create=(y,m)=>new Ul({innerType:y,typeName:ct.ZodCatch,catchValue:typeof m.catch=="function"?m.catch:()=>m.catch,...xt(m)});class Ku extends Tt{_parse(m){if(this._getType(m)!==Ke.nan){const I=this._getOrReturnCtx(m);return qe(I,{code:Oe.invalid_type,expected:Ke.nan,received:I.parsedType}),ht}return{status:"valid",value:m.data}}}Ku.create=y=>new Ku({typeName:ct.ZodNaN,...xt(y)});const ix=Symbol("zod_brand");class Od extends Tt{_parse(m){const{ctx:b}=this._processInputParams(m),I=b.data;return this._def.type._parse({data:I,path:b.path,parent:b})}unwrap(){return this._def.type}}class $l extends Tt{_parse(m){const{status:b,ctx:I}=this._processInputParams(m);if(I.common.async)return(async()=>{const R=await this._def.in._parseAsync({data:I.data,path:I.path,parent:I});return R.status==="aborted"?ht:R.status==="dirty"?(b.dirty(),mo(R.value)):this._def.out._parseAsync({data:R.value,path:I.path,parent:I})})();{const z=this._def.in._parseSync({data:I.data,path:I.path,parent:I});return z.status==="aborted"?ht:z.status==="dirty"?(b.dirty(),{status:"dirty",value:z.value}):this._def.out._parseSync({data:z.value,path:I.path,parent:I})}}static create(m,b){return new $l({in:m,out:b,typeName:ct.ZodPipeline})}}class Gl extends Tt{_parse(m){const b=this._def.innerType._parse(m),I=z=>(_s(z)&&(z.value=Object.freeze(z.value)),z);return kl(b)?b.then(z=>I(z)):I(b)}unwrap(){return this._def.innerType}}Gl.create=(y,m)=>new Gl({innerType:y,typeName:ct.ZodReadonly,...xt(m)});function sm(y,m){const b=typeof y=="function"?y(m):typeof y=="string"?{message:y}:y;return typeof b=="string"?{message:b}:b}function om(y,m={},b){return y?go.create().superRefine((I,z)=>{var R,S;const o=y(I);if(o instanceof Promise)return o.then(le=>{var he,_e;if(!le){const Re=sm(m,I),ve=(_e=(he=Re.fatal)!==null&&he!==void 0?he:b)!==null&&_e!==void 0?_e:!0;z.addIssue({code:"custom",...Re,fatal:ve})}});if(!o){const le=sm(m,I),he=(S=(R=le.fatal)!==null&&R!==void 0?R:b)!==null&&S!==void 0?S:!0;z.addIssue({code:"custom",...le,fatal:he})}}):go.create()}const rx={object:Ii.lazycreate};var ct;(function(y){y.ZodString="ZodString",y.ZodNumber="ZodNumber",y.ZodNaN="ZodNaN",y.ZodBigInt="ZodBigInt",y.ZodBoolean="ZodBoolean",y.ZodDate="ZodDate",y.ZodSymbol="ZodSymbol",y.ZodUndefined="ZodUndefined",y.ZodNull="ZodNull",y.ZodAny="ZodAny",y.ZodUnknown="ZodUnknown",y.ZodNever="ZodNever",y.ZodVoid="ZodVoid",y.ZodArray="ZodArray",y.ZodObject="ZodObject",y.ZodUnion="ZodUnion",y.ZodDiscriminatedUnion="ZodDiscriminatedUnion",y.ZodIntersection="ZodIntersection",y.ZodTuple="ZodTuple",y.ZodRecord="ZodRecord",y.ZodMap="ZodMap",y.ZodSet="ZodSet",y.ZodFunction="ZodFunction",y.ZodLazy="ZodLazy",y.ZodLiteral="ZodLiteral",y.ZodEnum="ZodEnum",y.ZodEffects="ZodEffects",y.ZodNativeEnum="ZodNativeEnum",y.ZodOptional="ZodOptional",y.ZodNullable="ZodNullable",y.ZodDefault="ZodDefault",y.ZodCatch="ZodCatch",y.ZodPromise="ZodPromise",y.ZodBranded="ZodBranded",y.ZodPipeline="ZodPipeline",y.ZodReadonly="ZodReadonly"})(ct||(ct={}));const nx=(y,m={message:`Input not instance of ${y.name}`})=>om(b=>b instanceof y,m),lm=Tn.create,cm=Oa.create,ax=Ku.create,sx=ja.create,um=Rl.create,ox=ys.create,lx=qu.create,cx=Dl.create,ux=Ll.create,hx=go.create,dx=xs.create,px=pa.create,fx=Hu.create,mx=Mn.create,gx=Ii.create,_x=Ii.strictCreate,yx=Bl.create,xx=Wu.create,vx=Fl.create,bx=Gn.create,wx=Ol.create,Tx=Xu.create,Mx=vs.create,Sx=yo.create,Px=jl.create,Cx=Nl.create,Ix=Na.create,Ex=Zl.create,kx=xo.create,hm=Sn.create,zx=qn.create,Ax=Za.create,Rx=Sn.createWithPreprocess,Dx=$l.create;var ot=Object.freeze({__proto__:null,defaultErrorMap:fo,setErrorMap:Ry,getErrorMap:Uu,makeIssue:$u,EMPTY_PATH:Dy,addIssueToContext:qe,ParseStatus:yr,INVALID:ht,DIRTY:mo,OK:kr,isAborted:Dd,isDirty:Ld,isValid:_s,isAsync:kl,get util(){return Ot},get objectUtil(){return Rd},ZodParsedType:Ke,getParsedType:da,ZodType:Tt,datetimeRegex:nm,ZodString:Tn,ZodNumber:Oa,ZodBigInt:ja,ZodBoolean:Rl,ZodDate:ys,ZodSymbol:qu,ZodUndefined:Dl,ZodNull:Ll,ZodAny:go,ZodUnknown:xs,ZodNever:pa,ZodVoid:Hu,ZodArray:Mn,ZodObject:Ii,ZodUnion:Bl,ZodDiscriminatedUnion:Wu,ZodIntersection:Fl,ZodTuple:Gn,ZodRecord:Ol,ZodMap:Xu,ZodSet:vs,ZodFunction:yo,ZodLazy:jl,ZodLiteral:Nl,ZodEnum:Na,ZodNativeEnum:Zl,ZodPromise:xo,ZodEffects:Sn,ZodTransformer:Sn,ZodOptional:qn,ZodNullable:Za,ZodDefault:Vl,ZodCatch:Ul,ZodNaN:Ku,BRAND:ix,ZodBranded:Od,ZodPipeline:$l,ZodReadonly:Gl,custom:om,Schema:Tt,ZodSchema:Tt,late:rx,get ZodFirstPartyTypeKind(){return ct},coerce:{string:y=>Tn.create({...y,coerce:!0}),number:y=>Oa.create({...y,coerce:!0}),boolean:y=>Rl.create({...y,coerce:!0}),bigint:y=>ja.create({...y,coerce:!0}),date:y=>ys.create({...y,coerce:!0})},any:hx,array:mx,bigint:sx,boolean:um,date:ox,discriminatedUnion:xx,effect:hm,enum:Ix,function:Sx,instanceof:nx,intersection:vx,lazy:Px,literal:Cx,map:Tx,nan:ax,nativeEnum:Ex,never:px,null:ux,nullable:Ax,number:cm,object:gx,oboolean:()=>um().optional(),onumber:()=>cm().optional(),optional:zx,ostring:()=>lm().optional(),pipeline:Dx,preprocess:Rx,promise:kx,record:wx,set:Mx,strictObject:_x,string:lm,symbol:lx,transformer:hm,tuple:bx,undefined:cx,union:yx,unknown:dx,void:fx,NEVER:ht,ZodIssueCode:Oe,quotelessJson:Ay,ZodError:Wr});const jd=ot.object({lat:ot.number(),lng:ot.number()}),Lx=ot.object({center:jd,zoom:ot.number()}),dm=ot.object({sw:jd,ne:jd}),Bx=ot.object({name:ot.literal("dark").or(ot.literal("light")),url:ot.string().optional(),colors:ot.object({primary:ot.string().max(64),background:ot.string().max(64),text:ot.string().max(64)})}),Fx=ot.object({apiKey:ot.string().min(1).max(64),container:ot.string(),position:ot.object({center:ot.object({lat:ot.number(),lng:ot.number()}),zoom:ot.number()}),restriction:ot.object({minZoom:ot.number().min(kd).max(Zu).optional(),maxZoom:ot.number().min(kd).max(Zu).optional(),maxBounds:dm.optional()}).optional(),style:Bx});ot.enum(["idle","move","click","popup_click","loading_start","loading_end"]);const Ox=ot.function().returns(ot.void()),jx=ot.function().args(Lx).returns(ot.void()),Nx=ot.function().returns(ot.void()),Zx=ot.function().args(ot.string()).returns(ot.void()),Vx=ot.function().returns(ot.void()),Ux=ot.function().returns(ot.void()),$x={idle:Ox,move:jx,click:Nx,popup_click:Zx,loading_start:Vx,loading_end:Ux},Gx=ot.object({id:ot.string(),rank:ot.number(),lat:ot.number(),lng:ot.number(),width:ot.number(),height:ot.number()}),pm=ot.array(Gx);ot.function().args(dm).returns(ot.promise(pm));const qx=ot.function().args(ot.string()).returns(ot.promise(ot.any()));var Hx=(y,m,b)=>m(Qe(b).marker.id),Wx=uo('<div class="popup svelte-1wr2z1y"></div>'),Xx=uo("<!> <!>",1),Kx=uo('<div class="marker"><!></div>'),Yx=uo('<div class="container svelte-1wr2z1y"><div class="map svelte-1wr2z1y"></div> <div class="logo svelte-1wr2z1y"><a href="https://arenarium.dev" target="_blank" class="svelte-1wr2z1y">@arenarium/maps</a></div> <div class="markers svelte-1wr2z1y"></div></div>');function fm(y,m){var rr,br,Vi,Xr,Kr,Di,nr;Tu(m,!0);let b,I,z,R,S,o=0,le=Ci(!1);qf(()=>{Fx.parse(m.options),he(),_e()});function he(){var Ze,Xe,bt;z=((Ze=m.options.restriction)==null?void 0:Ze.minZoom)??kd,R=((Xe=m.options.restriction)==null?void 0:Xe.maxZoom)??Zu,S=(bt=m.options.restriction)==null?void 0:bt.maxBounds,b=new Ad.Map({style:vr(m.options.style),center:{lat:m.options.position.center.lat,lng:m.options.position.center.lng},zoom:m.options.position.zoom,minZoom:Xt(z),maxZoom:R,maxBounds:S?[S.sw.lng,S.sw.lat,S.ne.lng,S.ne.lat]:void 0,container:I,pitchWithRotate:!1,attributionControl:{compact:!1}})}function _e(){b.on("load",Re),b.on("move",ve),b.on("idle",ne),b.on("click",De),b.dragRotate.disable(),b.keyboard.disable(),b.touchZoomRotate.disableRotation(),b.touchPitch.disable()}function Re(){si(le,!0)}function ve(){const Ze=b.getCenter(),Xe=b.getZoom();Jt("move",{center:Ze,zoom:Xe})}function ne(){Jt("idle",null)}function De(Ze){Jt("click",null)}function _t(Ze){Jt("popup_click",Ze)}const Rt=new Map;function yt(Ze,Xe){var fi;const bt=$x[Ze];if(!bt)throw new Error(`No schema defined for event ${Ze}`);if(!bt.safeParse(Xe).success)throw new Error(`Invalid handler for event ${Ze}`);Rt.has(Ze)||Rt.set(Ze,new Set),(fi=Rt.get(Ze))==null||fi.add(Xe)}function Dt(Ze,Xe){const bt=Rt.get(Ze);bt&&bt.delete(Xe)&&bt.size===0&&Rt.delete(Ze)}function Jt(Ze,Xe){const bt=Rt.get(Ze);bt&&bt.size>0&&[...bt].forEach(Kt=>{try{Kt(Xe)}catch(fi){console.error(fi)}})}function Xt(Ze){const bt=Math.ceil(Math.log2(o/Xf));return Math.max(Ze,bt)}function Et(){const Ze=b.getCenter();return Ze?{lat:Ze.lat,lng:Ze.lng}:{lat:m.options.position.center.lat,lng:m.options.position.center.lng}}function Bt(){return b.getZoom()??m.options.position.zoom}function Ri(){if(!b)throw new Error("Map not loaded!");const Ze=b.getBounds();return{sw:{lat:Ze.getSouthWest().lat,lng:Ze.getSouthWest().lng},ne:{lat:Ze.getNorthEast().lat,lng:Ze.getNorthEast().lng}}}function jt(Ze){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setCenter(Ze)}function xr(Ze){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setZoom(Ze)}function cn(){if(!b)throw new Error("Map not loaded! Consider using the position option");b.zoomIn()}function Vr(){if(!b)throw new Error("Map not loaded! Consider using the position option.");b.zoomOut()}function mt(Ze){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");z=Ze,b.setMinZoom(Xt(Ze))}function _i(Ze){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");R=Ze,b.setMaxZoom(Ze)}function li(Ze){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");S=Ze,b.setMaxBounds([Ze.sw.lng,Ze.sw.lat,Ze.ne.lng,Ze.ne.lat])}let Ni=Ci(ua(m.options.style));lo(()=>{Qe(le)&&b.setStyle(vr(Qe(Ni)),{diff:!0})});function vr(Ze){if(Ze.url)return Ze.url;switch(Ze.name){case"light":return zy;case"dark":return ky}}function un(){return b_(Qe(Ni))}function Ft(Ze){si(Ni,Ze,!0),b.setStyle(vr(Qe(Ni)),{diff:!0})}class zr{constructor(Xe){fs(this,"marker");fs(this,"libreMarker");Cr(this,rr,Ci());Cr(this,br,Ci(!1));Cr(this,Vi,Ci());Cr(this,Xr,Ci());Cr(this,Kr,Ci(!1));Cr(this,Di,Ci());Cr(this,nr,Ci());this.marker=Xe,this.libreMarker=void 0,this.element=void 0,this.rendered=!1,this.content=void 0,this.contentLoading=!1,this.component=void 0,this.circle=void 0}get element(){return Qe(Lt(this,rr))}set element(Xe){si(Lt(this,rr),Xe,!0)}get rendered(){return Qe(Lt(this,br))}set rendered(Xe){si(Lt(this,br),Xe,!0)}get popup(){return Qe(Lt(this,Vi))}set popup(Xe){si(Lt(this,Vi),Xe,!0)}get content(){return Qe(Lt(this,Xr))}set content(Xe){si(Lt(this,Xr),Xe,!0)}get contentLoading(){return Qe(Lt(this,Kr))}set contentLoading(Xe){si(Lt(this,Kr),Xe,!0)}get component(){return Qe(Lt(this,Di))}set component(Xe){si(Lt(this,Di),Xe,!0)}get circle(){return Qe(Lt(this,nr))}set circle(Xe){si(Lt(this,nr),Xe,!0)}getAngle(Xe){let bt=this.marker.angs,Kt=bt[0],fi=0;for(;Kt[0]<Xe&&(fi++,fi!=bt.length);)Kt=bt[fi];return Kt[1]}getDistance(Xe){return(this.marker.zet-Xe)/Kf}updateZIndex(){var Kt;const Xe=(Kt=this.libreMarker)==null?void 0:Kt.getElement();if(!Xe)throw new Error("Failed to update zIndex");const bt=Math.round((Zu-this.marker.zet)*_y);Xe.style.zIndex=bt.toString()}}rr=new WeakMap,br=new WeakMap,Vi=new WeakMap,Xr=new WeakMap,Kr=new WeakMap,Di=new WeakMap,nr=new WeakMap;let Ar,Hn,yi=ua(new Array),Pn=ua(new Map),ir=new Array,Ti;qf(()=>{const Ze=()=>{hn(),Ar=window.setTimeout(Ze,25)};return Ze(),()=>{clearInterval(Ar),clearInterval(Hn)}});function hn(){if(Qe(le)==!1||yi.length==0||Ti==null)return;const Ze=b.getZoom();if(!Ze)return;const Xe=new Array,bt=Xf,Kt=new Jf(b,-512,window.innerHeight+bt,window.innerWidth+bt,-512),fi=new Jf(b,0,window.innerHeight,window.innerWidth,0);for(let kt=0;kt<yi.length;kt++){const ut=yi[kt],Gt=ut.marker,qt=ut.libreMarker;if(qt){if(Gt.zet<=Ze&&Kt.contains(Gt.lat,Gt.lng)){qt._map!=b&&qt.addTo(b),Xe.push(ut);continue}if(Gt.zet<=Ze+Kf&&fi.contains(Gt.lat,Gt.lng)){qt._map!=b&&qt.addTo(b),Xe.push(ut);continue}qt._map!=null&&qt.remove()}}for(let kt=0;kt<Xe.length;kt++){const ut=Xe[kt],Gt=ut.marker;ut.rendered||(ut.rendered=!0);const qt=ut.component,Li=ut.circle;if(!Li||!qt)continue;Gt.zet<=Ze+yy?qt.setDisplayed(!0):qt.setDisplayed(!1),Gt.zet<=Ze?(Li.setCollapsed(!0),qt.setCollapsed(!1),qt.setAngle(ut.getAngle(Ze))):(qt.setCollapsed(!0),Li==null||Li.setCollapsed(!1),Li==null||Li.setDistance(ut.getDistance(Ze)));const Yt=ut.popup;if(!Yt)continue;ut.content==null&&ut.contentLoading==!1&&(ut.contentLoading=!0,Ti(Gt.id).then(ue=>{ut.content=ue,ut.contentLoading=!1}));const Mi=ut.content;if(!Mi)continue;Yt.firstElementChild==null&&Yt.appendChild(Mi)}}async function hr(Ze){var fi;const Xe=new Map(Ze.map(kt=>[kt.id,new zr(kt)])),bt=new Array,Kt=Array.from(yi);for(const kt of Kt)Xe.has(kt.marker.id)==!1&&((fi=kt.libreMarker)==null||fi.remove(),Pn.delete(kt.marker.id),yi.splice(yi.indexOf(kt),1));for(const kt of Ze){const ut=Pn.get(kt.id);if(ut)ut.marker=kt,ut.updateZIndex();else{const Gt=new zr(kt);Pn.set(kt.id,Gt),yi.push(Gt),bt.push(Gt)}}await U_();for(const kt of bt){const ut=kt.marker,Gt=kt.element;if(!Gt)throw new Error("Failed to render marker element.");const qt=new Ad.Marker({element:Gt});qt.setLngLat([ut.lng,ut.lat]),kt.libreMarker=qt,kt.updateZIndex()}}function Wn(){var Ze;for(let Xe=0;Xe<yi.length;Xe++)(Ze=yi[Xe].libreMarker)==null||Ze.remove();yi.length=0,Pn.clear()}function Cn(Ze){if(!qx.safeParse(Ze).success)throw new Error("Invalid popup content callback");Ti=Ze}async function ga(Ze){if(Ti==null)throw new Error("Popup content callback not set");if(!(await pm.safeParseAsync(Ze)).success)throw new Error("Invalid popups");try{Jt("loading_start",null);for(const bt of Ze){const Kt=ir.findIndex(fi=>fi.id==bt.id);Kt==-1?ir.push(bt):ir[Kt]=bt}await hr(await My(m.options.apiKey,ir,z,R))}finally{Jt("loading_end",null)}}function dr(){Wn()}var Ki=Yx();X_("resize",_d,()=>b.setMinZoom(Xt(z)));var Zi=Ml(Ki);Fa(Zi,Ze=>I=Ze,()=>I);var Wt=yd(Zi,4);return ry(Wt,21,()=>yi,Ze=>Ze.marker.id,(Ze,Xe,bt)=>{var Kt=Kx(),fi=Ml(Kt);{var kt=ut=>{var Gt=Xx(),qt=I_(Gt);Fa(Ty(qt,{}),(Yt,Mi)=>Mi.circle=Yt,Yt=>Yt==null?void 0:Yt.circle,()=>[Qe(Xe)]);var Li=yd(qt,2);Fa(by(Li,{children:(Yt,Mi)=>{var pr=Wx();pr.__click=[Hx,_t,Xe],Fa(pr,(ue,N)=>N.popup=ue,ue=>ue==null?void 0:ue.popup,()=>[Qe(Xe)]),Eu(()=>Nu(pr,`width: ${Qe(Xe).marker.width??""}px; height: ${Qe(Xe).marker.height??""}px;`)),ho(Yt,pr)},$$slots:{default:!0}}),(Yt,Mi)=>Mi.component=Yt,Yt=>Yt==null?void 0:Yt.component,()=>[Qe(Xe)]),ho(ut,Gt)};ty(fi,ut=>{Qe(Xe).rendered&&ut(kt)})}Fa(Kt,(ut,Gt)=>Gt.element=ut,ut=>ut==null?void 0:ut.element,()=>[Qe(Xe)]),ho(Ze,Kt)}),Eu(()=>Nu(Ki,`--primary: ${Qe(Ni).colors.primary??""}; --background: ${Qe(Ni).colors.background??""}; --text: ${Qe(Ni).colors.text??""};`)),ho(y,Ki),Mu({on:yt,off:Dt,emit:Jt,getCenter:Et,getZoom:Bt,getBounds:Ri,setCenter:jt,setZoom:xr,zoomIn:cn,zoomOut:Vr,setMinZoom:mt,setMaxZoom:_i,setMaxBounds:li,getStyle:un,setStyle:Ft,updatePopupContentCallback:Cn,updatePopups:ga,removePopups:dr})}K_(["click"]);function Jx(y){const m=document.getElementById(y.container);if(!m)throw new Error(`Container not found: ${y.container}`);return J_(fm,{target:m,props:{options:y}})}function Qx(y){ey(y)}$t.Map=fm,$t.mountMap=Jx,$t.unmountMap=Qx,Object.defineProperty($t,Symbol.toStringTag,{value:"Module"})});
729
+ ${F.shaderPreludeCode.vertexSource}`,define:F.shaderDefine},defaultProjectionData:H},W=k.renderingMode?k.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=k.prerender;K&&(f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),K.call(k,E.gl,q),E.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),E.setColorMode(f.colorModeForRenderPass()),E.setStencilMode(Pt.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,pt.ReadOnly);E.setDepthMode(K),k.render(E.gl,q),E.setDirty(),f.setBaseState(),E.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){this.cache=this.cache||{};const l=!!this.style.map.terrain,h=this.style.projection,f=e+(i?i.cacheKey:"")+`/${s?sr:h.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(l?"/terrain":"");return this.cache[f]||(this.cache[f]=new Ds(this.context,gt[e],i,uc[e],this._showOverdrawInspector,l,s?gt.projectionMercator:h.shaderPreludeCode,s?wr:h.shaderDefine)),this.cache[f]}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 jt(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 kc(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 zc{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=kc(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,v=this._map.getBearing(),T=this._map.getPitch();let P="";if(P+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(v||T)&&(P+="/"+Math.round(10*v)/10),T&&(P+=`/${Math.round(T)}`),this._hashName){const E=this._hashName;let k=!1;const F=window.location.hash.slice(1).split("&").map(O=>{const H=O.split("=")[0];return H===E?(k=!0,`${H}=${P}`):O}).filter(O=>O);return k||F.push(`${E}=${P}`),`#${F.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 en={linearity:.3,easing:o.cb(0,0,.3,1)},Ph=o.e({deceleration:2500,maxSpeed:1400},en),Ch=o.e({deceleration:20,maxSpeed:1400},en),Ih=o.e({deceleration:1e3,maxSpeed:360},en),Eh=o.e({deceleration:1e3,maxSpeed:90},en),kh=o.e({deceleration:1e3,maxSpeed:360},en);class zh{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:ve.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=ve.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=ea(i.pan.mag(),s,o.e({},Ph,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,as(l,h)}if(i.zoom){const h=ea(i.zoom,s,Ch);l.zoom=this._map.transform.zoom+h.amount,as(l,h)}if(i.bearing){const h=ea(i.bearing,s,Ih);l.bearing=this._map.transform.bearing+o.ae(h.amount,-179,179),as(l,h)}if(i.pitch){const h=ea(i.pitch,s,Eh);l.pitch=this._map.transform.pitch+h.amount,as(l,h)}if(i.roll){const h=ea(i.roll,s,kh);l.roll=this._map.transform.roll+o.ae(h.amount,-179,179),as(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 as(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function ea(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 Mr 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=ne.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 gr 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=ne.touchPos(i.getCanvasContainer(),l),f=h.map(v=>i.unproject(v)),_=h.reduce((v,T,P,E)=>v.add(T.div(E.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class tn extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class Ah{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new tn(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new Mr(e.type,this._map,e))}mouseup(e){this._map.fire(new Mr(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new Mr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new Mr(e.type,this._map,e))}mouseover(e){this._map.fire(new Mr(e.type,this._map,e))}mouseout(e){this._map.fire(new Mr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new gr(e.type,this._map,e))}touchmove(e){this._map.fire(new gr(e.type,this._map,e))}touchend(e){this._map.fire(new gr(e.type,this._map,e))}touchcancel(e){this._map.fire(new gr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class mn{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new Mr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new Mr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new Mr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class gn{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 Rh{constructor(e,i){this._map=e,this._tr=new gn(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&&(ne.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=ne.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),v=Math.max(l.y,s.y);ne.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=v-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),ne.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&&(ne.remove(this._box),this._box=null),ne.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Ac(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 op{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=Ac(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Ac(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 Rc{constructor(e){this.singleTap=new op(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 Dh{constructor(e){this._tr=new gn(e),this._zoomIn=new Rc({numTouches:1,numTaps:2}),this._zoomOut=new Rc({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 kn{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&&ne.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 zn={0:1,2:2};class Ue{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=ne.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=zn[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return ne.mouseButton(e)===this._eventButton}}class Lh{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 Dc{constructor(e=new Ue({checkCorrectEvent:()=>!0}),i=new Lh){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 Vs=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Us{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=Ac(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],E=this._touches[T];E&&(h._add(P),f._add(P.sub(E)),_++,l[T]=P)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const v=f.div(_);return this._sum._add(v),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:v}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Ca{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=$s(s,i,l),_=$s(s,i,h);if(!f||!_)return;const v=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],v,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=$s(s,i,l),_=$s(s,i,h);f&&_||(this._active&&ne.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 $s(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function vt(u,e){return Math.log(u/e)/Math.LN2}class el extends Ca{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(vt(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:vt(this._distance,s),pinchAround:i}}}function Bh(u,e){return 180*u.angleWith(e)/Math.PI}class tl extends Ca{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:Bh(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=Bh(e,this._startVector);return Math.abs(s)<i}}function Lc(u){return Math.abs(u.y)>Math.abs(u.x)}class Fh extends Ca{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,Lc(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 Lc(e)&&Lc(i)&&f}}const Oh={panStep:100,bearingStep:15,pitchStep:10};class il{constructor(e){this._tr=new gn(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 v=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:jh,zoom:i?Math.round(v.zoom)+i*(e.shiftKey?2:1):v.zoom,bearing:v.bearing+s*this._bearingStep,pitch:v.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:v.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 jh(u){return u*(2-u)}const Nh=4.000244140625;class Bc{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new gn(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=ve.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%Nh==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=ne.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)>Nh?this._wheelZoomRate:this._defaultZoomRate;let v=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&v!==0&&(v=1/v);const T=typeof this._targetZoom!="number"?e.scale:o.ac(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,o.ah(T*v))),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 _=ve.now()-this._lastWheelEventTime,v=Math.min((_+5)/200,1),T=l(v);h=o.B.number(s,i,T),v<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.cd;if(this._prevEase){const s=this._prevEase,l=(ve.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.cb(f,_,.25,1)}return this._prevEase={start:ve.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 Zh{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 lp{constructor(e){this._tr=new gn(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 ta{constructor(){this._tap=new Rc({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 ti{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 Gs{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 rl{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 Fc{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=ne.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&&(ne.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 Vh extends o.l{}function Oc(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class _n{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},v={},T={};for(const{handlerName:k,handler:F,allowed:O}of this._handlers){if(!F.isEnabled())continue;let H;if(this._blockedByActive(T,O,k))F.reset();else if(F[h||l.type]){if(o.ce(l,h||l.type)){const q=ne.mousePos(this._map.getCanvas(),l);H=F[h||l.type](l,q)}else if(o.cf(l,h||l.type)){const q=this._getMapTouches(l.touches),W=ne.touchPos(this._map.getCanvas(),q);H=F[h||l.type](l,W,q)}else o.cg(h||l.type)||(H=F[h||l.type](l));this.mergeHandlerResult(_,v,H,k,f),H&&H.needsRenderFrame&&this._triggerRenderFrame()}(H||F.isActive())&&(T[k]=F)}const P={};for(const k in this._previousActiveHandlers)T[k]||(P[k]=f);this._previousActiveHandlers=T,(Object.keys(P).length||Oc(_))&&(this._changes.push([_,v,P]),this._triggerRenderFrame()),(Object.keys(T).length||Oc(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:E}=_;E&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],E(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new zh(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)ne.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)ne.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new Ah(i,e));const l=i.boxZoom=new Rh(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new Fc(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new Dh(i),_=new lp(i);i.doubleClickZoom=new Zh(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const v=new ta;this._add("tapDragZoom",v);const T=i.touchPitch=new Fh(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const P=()=>i.project(i.getCenter()),E=function({enable:te,clickTolerance:re,aroundCenter:oe=!0,minPixelCenterThreshold:ae=100,rotateDegreesPerPixelMoved:pe=.8},me){const Se=new Ue({checkCorrectEvent:Ce=>ne.mouseButton(Ce)===0&&Ce.ctrlKey||ne.mouseButton(Ce)===2&&!Ce.ctrlKey});return new kn({clickTolerance:re,move:(Ce,Te)=>{const je=me();if(oe&&Math.abs(je.y-Ce.y)>ae)return{bearingDelta:o.cc(new o.P(Ce.x,Te.y),Te,je)};let Be=(Te.x-Ce.x)*pe;return oe&&Te.y<je.y&&(Be=-Be),{bearingDelta:Be}},moveStateManager:Se,enable:te,assignEvents:Vs})}(e,P),k=function({enable:te,clickTolerance:re,pitchDegreesPerPixelMoved:oe=-.5}){const ae=new Ue({checkCorrectEvent:pe=>ne.mouseButton(pe)===0&&pe.ctrlKey||ne.mouseButton(pe)===2});return new kn({clickTolerance:re,move:(pe,me)=>({pitchDelta:(me.y-pe.y)*oe}),moveStateManager:ae,enable:te,assignEvents:Vs})}(e),F=function({enable:te,clickTolerance:re,rollDegreesPerPixelMoved:oe=.3},ae){const pe=new Ue({checkCorrectEvent:me=>ne.mouseButton(me)===2&&me.ctrlKey});return new kn({clickTolerance:re,move:(me,Se)=>{const Ce=ae();let Te=(Se.x-me.x)*oe;return Se.y<Ce.y&&(Te=-Te),{rollDelta:Te}},moveStateManager:pe,enable:te,assignEvents:Vs})}(e,P);i.dragRotate=new Gs(e,E,k,F),this._add("mouseRotate",E,["mousePitch"]),this._add("mousePitch",k,["mouseRotate","mouseRoll"]),this._add("mouseRoll",F,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:te,clickTolerance:re}){const oe=new Ue({checkCorrectEvent:ae=>ne.mouseButton(ae)===0&&!ae.ctrlKey});return new kn({clickTolerance:re,move:(ae,pe)=>({around:pe,panDelta:pe.sub(ae)}),activateOnStart:!0,moveStateManager:oe,enable:te,assignEvents:Vs})}(e),H=new Us(e,i);i.dragPan=new ti(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 tl,W=new el;i.touchZoomRotate=new rl(s,W,q,v),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 Bc(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const ee=i.keyboard=new il(i);this._add("keyboard",ee),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new mn(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(!(Oc(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:v,bearingDelta:T,pitchDelta:P,rollDelta:E,around:k,pinchAround:F}=e;F!==void 0&&(k=F),k=k||l.transform.centerPoint,f&&!h.isPointOnMapSurface(k)&&(k=h.centerPoint);const O={panDelta:_,zoomDelta:v,rollDelta:E,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 E in e){const{originalEvent:k}=e[E];this._eventsInProgress[E]||(f[`${E}start`]=k),this._eventsInProgress[E]=e[E]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const E in f)this._fireEvent(E,f[E]);h&&this._fireEvent("move",h.originalEvent);for(const E in e){const{originalEvent:k}=e[E];this._fireEvent(E,k)}const _={};let v;for(const E in this._eventsInProgress){const{handlerName:k,originalEvent:F}=this._eventsInProgress[E];this._handlersById[k].isActive()||(delete this._eventsInProgress[E],v=i[k]||F,_[`${E}end`]=v)}for(const E in _)this._fireEvent(E,_[E]);const T=qs(this._eventsInProgress),P=(l||h)&&!T;if(P&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const E=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&E.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(E)}if(s&&P){this._updatingCamera=!0;const E=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),k=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!E||!E.essential&&ve.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:v})),k(this._map.getBearing())&&this._map.resetNorth()):(k(E.bearing||this._map.getBearing())&&(E.bearing=0),E.freezeElevation=!0,this._map.easeTo(E,{originalEvent:v})),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 Vh("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class nl extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((ve.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=Wt.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,v=new Wt(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,v,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 v=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)),v&&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,v=f.y-h.y,T=f.z-h.z,P=Math.hypot(_,v,T);if(P===0)throw new Error("Can't calculate camera options with same From and To");const E=Math.hypot(_,v),k=o.ah(this.transform.cameraToCenterDistance/P/this.transform.tileSize),F=180*Math.atan2(_,-v)/Math.PI;let O=180*Math.acos(E/P)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:k,pitch:O,bearing:F}}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.cd},e)).animate===!1||!e.essential&&ve.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,v="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,P="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let k,F;e.around&&(k=o.Q.convert(e.around),F=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:v,roll:T,padding:P,around:k,aroundPoint:F,offsetAsPoint:E,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||v!==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:v,pitch:T,bearing:P,elevation:E}=l(h);f&&h.setCenter(f),E!==void 0&&h.setElevation(E),_!==void 0&&h.setZoom(_),v!==void 0&&h.setRoll(v),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&&ve.prefersReducedMotion){const Te=o.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(Te,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cd},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,v="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,E="padding"in e?e.padding:s.padding,k=o.P.convert(e.offset);let F=s.centerPoint.add(k);const O=s.screenPointToLocation(F),H=this.cameraHelper.handleFlyTo(s,{bearing:v,pitch:T,roll:P,padding:E,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,ee=H.pixelPathLength;typeof H.scaleOfMinZoom=="number"&&(q=Math.sqrt(W/H.scaleOfMinZoom/ee*2));const te=q*q;function re(Te){const je=(K*K-W*W+(Te?-1:1)*te*te*ee*ee)/(2*(Te?K:W)*te*ee);return Math.log(Math.sqrt(je*je+1)-je)}function oe(Te){return(Math.exp(Te)-Math.exp(-Te))/2}function ae(Te){return(Math.exp(Te)+Math.exp(-Te))/2}const pe=re(!1);let me=function(Te){return ae(pe)/ae(pe+q*Te)},Se=function(Te){return W*((ae(pe)*(oe(je=pe+q*Te)/ae(je))-oe(pe))/te)/ee;var je},Ce=(re(!0)-pe)/q;if(Math.abs(ee)<2e-6||!isFinite(Ce)){if(Math.abs(W-K)<1e-6)return this.easeTo(e,i);const Te=K<W?-1:1;Ce=Math.abs(Math.log(K/W))/q,Se=()=>0,me=je=>Math.exp(Te*q*je)}return e.duration="duration"in e?+e.duration:1e3*Ce/("screenSpeed"in e?+e.screenSpeed/q:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==v,this._pitching=T!==h,this._rolling=P!==f,this._padding=!s.isPaddingEqual(E),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(H.targetCenter),this._ease(Te=>{const je=Te*Ce,Be=1/me(je),Ee=Se(je);this._rotating&&s.setBearing(o.B.number(l,v,Te)),this._pitching&&s.setPitch(o.B.number(h,T,Te)),this._rolling&&s.setRoll(o.B.number(f,P,Te)),this._padding&&(s.interpolatePadding(_,E,Te),F=s.centerPoint.add(k)),H.easeFunc(Te,Be,Ee,F),this.terrain&&!e.freezeElevation&&this._updateElevation(Te),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=ve.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 Ye={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class nt{constructor(e=Ye){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=ne.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ne.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ne.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(){ne.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=ne.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=ne.create("div","maplibregl-ctrl");const i=ne.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(){ne.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class jc{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 Nc=o.aG([{name:"a_pos3d",type:"Int16",components:3}]);class Sr extends o.E{constructor(e){super(),this._lastTilesetChange=ve.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 ie(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 Gt(l,this.tileSize),this._lastTilesetChange=ve.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,v=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,[-v*P,-T*P,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,v=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,[v*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 v=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(_,_,[v*o.Z,T*o.Z,0])}else if(h.canonical.z>e.canonical.z){const v=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>v<<v),P=h.canonical.y-(h.canonical.y>>v<<v),E=e.canonical.x-(h.canonical.x>>v),k=e.canonical.y-(h.canonical.y>>v),F=o.Z>>v;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[-T*F+E*o.Z,-P*F+k*o.Z,0])}else{const v=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>v<<v),P=e.canonical.y-(e.canonical.y>>v<<v),E=(e.canonical.x>>v)-h.canonical.x,k=(e.canonical.y>>v)-h.canonical.y,F=o.Z<<v;o.bQ(_,0,F,F,0,0,1),o.L(_,_,[T*o.Z+E*F,P*o.Z+k*F,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 Uh{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new Sr(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 v=o.ch([],[i/l*o.Z,s/l*o.Z],f.u_terrain_matrix),T=[v[0]*_.dim,v[1]*_.dim],P=Math.floor(T[0]),E=Math.floor(T[1]),k=T[0]-P,F=T[1]-E;return _.get(P,E)*(1-k)*(1-F)+_.get(P+1,E)*k*(1-F)+_.get(P,E+1)*(1-k)*F+_.get(P+1,E+1)*k*F}getElevationForLngLatZoom(e,i){if(!o.ci(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 jt(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new jt(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 jt(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),v=o.cj(new Float64Array(16),[1/(o.Z<<h),1/(o.Z<<h),0]);o.L(v,v,[f*o.Z,_*o.Z,0]),this._demMatrixCache[e.key]={matrix:v,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 jt(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 jt(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 jt(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 v=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),P=this.coordsIndex[255-i[3]],E=P&&this.sourceCache.getTileByID(P);if(!E)return null;const k=this._coordsTextureSize,F=(1<<E.tileID.canonical.z)*k;return new o.$((E.tileID.canonical.x*k+v)/F+E.tileID.wrap,(E.tileID.canonical.y*k+T)/F,this.getElevation(E.tileID,v,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,v=new o.ck,T=new o.aK,P=this.meshSize,E=o.Z/P,k=P*P;for(let ae=0;ae<=P;ae++)for(let pe=0;pe<=P;pe++)v.emplaceBack(pe*E,ae*E,0);for(let ae=0;ae<k;ae+=P+1)for(let pe=0;pe<P;pe++)T.emplaceBack(pe+ae,P+pe+ae+1,P+pe+ae+2),T.emplaceBack(pe+ae,P+pe+ae+2,pe+ae+1);const F=v.length,O=F+(P+1),H=(P+1)*P,q=l?o.b9:0,W=l?0:1,K=h?o.ba:o.Z,ee=h?0:1;for(let ae=0;ae<=P;ae++)v.emplaceBack(ae*E,q,W);for(let ae=0;ae<=P;ae++)v.emplaceBack(ae*E,K,ee);for(let ae=0;ae<P;ae++)T.emplaceBack(H+ae,O+ae,O+ae+1),T.emplaceBack(H+ae,O+ae+1,H+ae+1),T.emplaceBack(0+ae,F+ae+1,F+ae),T.emplaceBack(0+ae,0+ae+1,F+ae+1);const te=v.length,re=te+2*(P+1);for(const ae of[0,1])for(let pe=0;pe<=P;pe++)for(const me of[0,1])v.emplaceBack(ae*o.Z,pe*E,me);for(let ae=0;ae<2*P;ae+=2)T.emplaceBack(te+ae,te+ae+1,te+ae+3),T.emplaceBack(te+ae,te+ae+3,te+ae+2),T.emplaceBack(re+ae,re+ae+3,re+ae+1),T.emplaceBack(re+ae,re+ae+2,re+ae+3);const oe=new Ha(_.createVertexBuffer(v,Nc.members),_.createIndexBuffer(T),o.aJ.simpleSegment(0,0,v.length,T.length));return this._meshCache[f]=oe,oe}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),v=Math.floor(f/o.Z);return{tileID:new o.Y(i,0,i,_,v),mercatorX:h,mercatorY:f}}}class yn{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 jt(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 ss={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class Ws{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new yn(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 Di?h.terrainTileRanges:null;for(const _ of l){const v=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in v)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(v[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(ss[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(ss[l]&&(this._prevType&&ss[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(ss[this._prevType]||ss[l]&&f){this._prevType=l;const _=this._stacks.length-1,v=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(Ic(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const E=this.pool.getObjectForId(T.rtt[_].id);if(E.stamp===T.rtt[_].stamp){this.pool.useObject(E);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 E=0;E<v.length;E++){const k=h.style._layers[v[E]],F=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,F,!0),h.renderLayer(h,h.style.sourceCaches[k.source],k,F,s),k.source&&(T.rttCoords[k.source]=this._coordsAscendingStr[k.source][T.tileID.key])}}return Ic(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),ss[l]}return!1}}const bi={"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"},Ei=le,Zc={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ye,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},Xs={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class al{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,ne.mousePos(this.element,h)),ne.addEventListener(window,"mousemove",this.mousemove),ne.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,ne.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=ne.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),ne.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ne.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=ne.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 Dc;this._rotatePitchHanlder=new kn({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),v=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.cc(new o.P(h.x,f.y),f,v),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,ne.addEventListener(i,"mousedown",this.mousedown),ne.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),ne.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),ne.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;ne.removeEventListener(e,"mousedown",this.mousedown),ne.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),ne.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ne.removeEventListener(window,"touchend",this.touchend),ne.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){ne.enableDrag(),ne.removeEventListener(window,"mousemove",this.mousemove),ne.removeEventListener(window,"mouseup",this.mouseup),ne.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ne.removeEventListener(window,"touchend",this.touchend)}}let An;function sl(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 Ks={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 os(u,e,i){const s=u.classList;for(const l in Ks)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class Ys 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=sl(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()),ne.setTransform(this._element,`${Ks[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),ve.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=ne.create("div");const i=ne.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=ne.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=ne.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=ne.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const v=[{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 v){const K=ne.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=ne.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const P=ne.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 E=ne.createNS("http://www.w3.org/2000/svg","g");E.setAttributeNS(null,"opacity","0.25"),E.setAttributeNS(null,"fill","#000000");const k=ne.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"),E.appendChild(k);const F=ne.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const O=ne.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const H=ne.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=ne.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(E),f.appendChild(F),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()}),os(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),ne.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;if(!(!((i=this._map)===null||i===void 0)&&i.terrain)){const E=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==E&&(this._element.style.opacity=E))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const l=this._map,h=l.terrain.depthAtPoint(this._pos),f=l.terrain.getElevationForLngLatZoom(this._lngLat,l.transform.tileZoom);if(l.transform.lngLatToCameraDepth(this._lngLat,f)-h<.006)return void(this._element.style.opacity=this._opacity);const _=-this._offset.y/l.transform.pixelsPerMeter,v=Math.sin(l.getPitch()*Math.PI/180)*_,T=l.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),P=l.transform.lngLatToCameraDepth(this._lngLat,f+v)-T>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&P&&this._popup.remove(),this._element.style.opacity=P?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 Vc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ls=0,Ia=!1;const Uc={maxWidth:100,unit:"metric"};function ol(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]),v=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,v,u._container.clientWidth),P=f.distanceTo(_);if(i&&i.unit==="imperial"){const E=3.2808*P;E>5280?Ea(e,T,E/5280,u._getUIString("ScaleControl.Miles")):Ea(e,T,E,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?Ea(e,T,P/1852,u._getUIString("ScaleControl.NauticalMiles")):P>=1e3?Ea(e,T,P/1e3,u._getUIString("ScaleControl.Kilometers")):Ea(e,T,P,u._getUIString("ScaleControl.Meters"))}function Ea(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(v){const T=Math.pow(10,Math.ceil(-Math.log(v)/Math.LN10));return Math.round(v*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l}&nbsp;${s}`}const $c={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},ll=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function cl(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 cl(new o.P(0,0))}const Gc=le;S.AJAXError=o.co,S.Event=o.l,S.Evented=o.E,S.LngLat=o.Q,S.MercatorCoordinate=o.$,S.Point=o.P,S.addProtocol=o.cp,S.config=o.a,S.removeProtocol=o.cq,S.AttributionControl=nt,S.BoxZoomHandler=Rh,S.CanvasSource=Ze,S.CooperativeGesturesHandler=Fc,S.DoubleClickZoomHandler=Zh,S.DragPanHandler=ti,S.DragRotateHandler=Gs,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=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ne.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=ne.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ne.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=Kr,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=Wt.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(this.options.trackUserLocation)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&&Ia)return;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=ne.create("button","maplibregl-ctrl-geolocate",this._container),ne.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=ne.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new Ys({element:this._dotElement}),this._circleElement=ne.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new Ys({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({},Vc,u)}onAdd(u){return this._map=u,this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(An!==void 0&&!e)return An;if(window.navigator.permissions===void 0)return An=!!window.navigator.geolocation,An;try{An=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{An=!!window.navigator.geolocation}return An})}().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(),ne.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ls=0,Ia=!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":ls--,Ia=!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"),ls++,ls>1?(u={maximumAge:6e5,timeout:0},Ia=!0):(u=this.options.positionOptions,Ia=!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=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ne.create("button","maplibregl-ctrl-globe",this._container),ne.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(){ne.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},S.Hash=zc,S.ImageSource=Di,S.KeyboardHandler=il,S.LngLatBounds=Wt,S.LogoControl=Hs,S.Map=class extends nl{constructor(u){var e,i;o.cl.mark(o.cm.create);const s=Object.assign(Object.assign(Object.assign({},Zc),u),{canvasContextAttributes:Object.assign(Object.assign({},Zc.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 pn,h=new Cs;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 jc,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({},bi),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=Xt.addThrottleControl(()=>this.isMoving()),this._requestManager=new Et(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 v=kc(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?v(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new _n(this,s),this._hash=s.hash&&new zc(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 nt(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(Wt.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(v=>this.getLayer(v)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new Mr(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(v=>this.getLayer(v));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new Mr(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new Mr(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 Rs(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 Rs(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 Uh(this.painter,e,u),this.painter.renderToTexture=new Ws(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=V(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=V(Math.max(1,u),Math.max(1,e));return this._update(!0),this}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:v,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:E,data:k}=e,F=e;return this.style.addImage(u,{data:new o.R({width:P,height:E},new Uint8Array(k)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:v,textFitHeight:T,sdf:l,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:P,height:E,data:k}=ve.getImageData(e);this.style.addImage(u,{data:new o.R({width:P,height:E},k),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:v,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)?ve.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 Xt.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=ne.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=ne.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=ne.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=ne.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 Sh(i,this.transform),De.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 v=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const E=this.transform.zoom,k=ve.now();this.style.zoomHistory.update(E,k);const F=new o.C(E,{now:k,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),O=F.crossFadingFactor();O===1&&O===this._crossFadingFactor||(v=!0,this._crossFadingFactor=O),this.style.update(F)}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.cl.mark(o.cm.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||v)&&(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.cl.mark(o.cm.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),Xt.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),ne.remove(this._canvasContainer),ne.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cl.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,ve.frame(this._frameRequest,u=>{o.cl.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cn(e)&&!function(i){return i.message===_c}(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 Ei}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},S.MapMouseEvent=Mr,S.MapTouchEvent=gr,S.MapWheelEvent=tn,S.Marker=Ys,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({},Xs,u),this._container=ne.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})),ne.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})),ne.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=ne.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 al(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ne.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=ne.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&&ne.remove(this._content),this._container&&(ne.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=ne.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ne.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=sl(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=cl(this.options.offset);if(!s){const f=this._container.offsetWidth,_=this._container.offsetHeight;let v;v=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?v.push("left"):i.x>this._map.transform.width-f/2&&v.push("right"),s=v.length===0?"bottom":v.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),ne.setTransform(this._container,`${Ks[s]} translate(${h.x}px,${h.y}px)`),os(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create($c),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=ne.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=ne.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(ll);u&&u.focus()}},S.RasterDEMTileSource=Xr,S.RasterTileSource=Vi,S.ScaleControl=class{constructor(u){this._onMove=()=>{ol(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,ol(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},Uc),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=ne.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ne.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},S.ScrollZoomHandler=Bc,S.Style=Rs,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=ne.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ne.create("button","maplibregl-ctrl-terrain",this._container),ne.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(){ne.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},S.TwoFingersTouchPitchHandler=Fh,S.TwoFingersTouchRotateHandler=tl,S.TwoFingersTouchZoomHandler=el,S.TwoFingersTouchZoomRotateHandler=rl,S.VectorTileSource=br,S.VideoSource=nr,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)=>{Xe[i]=s})(u,e)}),S.clearPrewarmedResources=function(){const u=ir;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Hn),ir=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=Co,S.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},S.getRTLTextPluginStatus=function(){return ut().getRTLTextPluginStatus()},S.getVersion=function(){return Gc},S.getWorkerCount=function(){return yi.workerCount},S.getWorkerUrl=function(){return o.a.WORKER_URL},S.importScriptInWorkers=function(u){return Wn().broadcast("IS",u)},S.prewarm=function(){hn().acquire(Hn)},S.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},S.setRTLTextPlugin=function(u,e){return ut().setRTLTextPlugin(u,e)},S.setWorkerCount=function(u){yi.workerCount=u},S.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var D=b;return D})}(Vu)),Vu.exports}var Ey=Iy();const Ad=Py(Ey);class Jf{constructor(m,b,I,z,D){fs(this,"bounds1");fs(this,"bounds2");fs(this,"getBounds",(m,b,I,z)=>new Ad.LngLatBounds([m,b],[I,z]));fs(this,"contains",(m,b)=>this.bounds1.contains([b,m])||this.bounds2.contains([b,m]));const S=m.unproject([b,I]),o=m.unproject([z,D]);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 ky={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}}]},zy={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 Ot;(function(y){y.assertEqual=z=>z;function m(z){}y.assertIs=m;function b(z){throw new Error}y.assertNever=b,y.arrayToEnum=z=>{const D={};for(const S of z)D[S]=S;return D},y.getValidEnumValues=z=>{const D=y.objectKeys(z).filter(o=>typeof z[z[o]]!="number"),S={};for(const o of D)S[o]=z[o];return y.objectValues(S)},y.objectValues=z=>y.objectKeys(z).map(function(D){return z[D]}),y.objectKeys=typeof Object.keys=="function"?z=>Object.keys(z):z=>{const D=[];for(const S in z)Object.prototype.hasOwnProperty.call(z,S)&&D.push(S);return D},y.find=(z,D)=>{for(const S of z)if(D(S))return S},y.isInteger=typeof Number.isInteger=="function"?z=>Number.isInteger(z):z=>typeof z=="number"&&isFinite(z)&&Math.floor(z)===z;function I(z,D=" | "){return z.map(S=>typeof S=="string"?`'${S}'`:S).join(D)}y.joinValues=I,y.jsonStringifyReplacer=(z,D)=>typeof D=="bigint"?D.toString():D})(Ot||(Ot={}));var Rd;(function(y){y.mergeShapes=(m,b)=>({...m,...b})})(Rd||(Rd={}));const Ke=Ot.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),da=y=>{switch(typeof y){case"undefined":return Ke.undefined;case"string":return Ke.string;case"number":return isNaN(y)?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(y)?Ke.array:y===null?Ke.null:y.then&&typeof y.then=="function"&&y.catch&&typeof y.catch=="function"?Ke.promise:typeof Map<"u"&&y instanceof Map?Ke.map:typeof Set<"u"&&y instanceof Set?Ke.set:typeof Date<"u"&&y instanceof Date?Ke.date:Ke.object;default:return Ke.unknown}},Oe=Ot.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"]),Ay=y=>JSON.stringify(y,null,2).replace(/"([^"]+)":/g,"$1:");class Wr extends Error{get errors(){return this.issues}constructor(m){super(),this.issues=[],this.addIssue=I=>{this.issues=[...this.issues,I]},this.addIssues=(I=[])=>{this.issues=[...this.issues,...I]};const b=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,b):this.__proto__=b,this.name="ZodError",this.issues=m}format(m){const b=m||function(D){return D.message},I={_errors:[]},z=D=>{for(const S of D.issues)if(S.code==="invalid_union")S.unionErrors.map(z);else if(S.code==="invalid_return_type")z(S.returnTypeError);else if(S.code==="invalid_arguments")z(S.argumentsError);else if(S.path.length===0)I._errors.push(b(S));else{let o=I,le=0;for(;le<S.path.length;){const he=S.path[le];le===S.path.length-1?(o[he]=o[he]||{_errors:[]},o[he]._errors.push(b(S))):o[he]=o[he]||{_errors:[]},o=o[he],le++}}};return z(this),I}static assert(m){if(!(m instanceof Wr))throw new Error(`Not a ZodError: ${m}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Ot.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(m=b=>b.message){const b={},I=[];for(const z of this.issues)z.path.length>0?(b[z.path[0]]=b[z.path[0]]||[],b[z.path[0]].push(m(z))):I.push(m(z));return{formErrors:I,fieldErrors:b}}get formErrors(){return this.flatten()}}Wr.create=y=>new Wr(y);const fo=(y,m)=>{let b;switch(y.code){case Oe.invalid_type:y.received===Ke.undefined?b="Required":b=`Expected ${y.expected}, received ${y.received}`;break;case Oe.invalid_literal:b=`Invalid literal value, expected ${JSON.stringify(y.expected,Ot.jsonStringifyReplacer)}`;break;case Oe.unrecognized_keys:b=`Unrecognized key(s) in object: ${Ot.joinValues(y.keys,", ")}`;break;case Oe.invalid_union:b="Invalid input";break;case Oe.invalid_union_discriminator:b=`Invalid discriminator value. Expected ${Ot.joinValues(y.options)}`;break;case Oe.invalid_enum_value:b=`Invalid enum value. Expected ${Ot.joinValues(y.options)}, received '${y.received}'`;break;case Oe.invalid_arguments:b="Invalid function arguments";break;case Oe.invalid_return_type:b="Invalid function return type";break;case Oe.invalid_date:b="Invalid date";break;case Oe.invalid_string:typeof y.validation=="object"?"includes"in y.validation?(b=`Invalid input: must include "${y.validation.includes}"`,typeof y.validation.position=="number"&&(b=`${b} at one or more positions greater than or equal to ${y.validation.position}`)):"startsWith"in y.validation?b=`Invalid input: must start with "${y.validation.startsWith}"`:"endsWith"in y.validation?b=`Invalid input: must end with "${y.validation.endsWith}"`:Ot.assertNever(y.validation):y.validation!=="regex"?b=`Invalid ${y.validation}`:b="Invalid";break;case Oe.too_small:y.type==="array"?b=`Array must contain ${y.exact?"exactly":y.inclusive?"at least":"more than"} ${y.minimum} element(s)`:y.type==="string"?b=`String must contain ${y.exact?"exactly":y.inclusive?"at least":"over"} ${y.minimum} character(s)`:y.type==="number"?b=`Number must be ${y.exact?"exactly equal to ":y.inclusive?"greater than or equal to ":"greater than "}${y.minimum}`:y.type==="date"?b=`Date must be ${y.exact?"exactly equal to ":y.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(y.minimum))}`:b="Invalid input";break;case Oe.too_big:y.type==="array"?b=`Array must contain ${y.exact?"exactly":y.inclusive?"at most":"less than"} ${y.maximum} element(s)`:y.type==="string"?b=`String must contain ${y.exact?"exactly":y.inclusive?"at most":"under"} ${y.maximum} character(s)`:y.type==="number"?b=`Number must be ${y.exact?"exactly":y.inclusive?"less than or equal to":"less than"} ${y.maximum}`:y.type==="bigint"?b=`BigInt must be ${y.exact?"exactly":y.inclusive?"less than or equal to":"less than"} ${y.maximum}`:y.type==="date"?b=`Date must be ${y.exact?"exactly":y.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(y.maximum))}`:b="Invalid input";break;case Oe.custom:b="Invalid input";break;case Oe.invalid_intersection_types:b="Intersection results could not be merged";break;case Oe.not_multiple_of:b=`Number must be a multiple of ${y.multipleOf}`;break;case Oe.not_finite:b="Number must be finite";break;default:b=m.defaultError,Ot.assertNever(y)}return{message:b}};let Qf=fo;function Ry(y){Qf=y}function Uu(){return Qf}const $u=y=>{const{data:m,path:b,errorMaps:I,issueData:z}=y,D=[...b,...z.path||[]],S={...z,path:D};if(z.message!==void 0)return{...z,path:D,message:z.message};let o="";const le=I.filter(he=>!!he).slice().reverse();for(const he of le)o=he(S,{data:m,defaultError:o}).message;return{...z,path:D,message:o}},Dy=[];function qe(y,m){const b=Uu(),I=$u({issueData:m,data:y.data,path:y.path,errorMaps:[y.common.contextualErrorMap,y.schemaErrorMap,b,b===fo?void 0:fo].filter(z=>!!z)});y.common.issues.push(I)}class yr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(m,b){const I=[];for(const z of b){if(z.status==="aborted")return ht;z.status==="dirty"&&m.dirty(),I.push(z.value)}return{status:m.value,value:I}}static async mergeObjectAsync(m,b){const I=[];for(const z of b){const D=await z.key,S=await z.value;I.push({key:D,value:S})}return yr.mergeObjectSync(m,I)}static mergeObjectSync(m,b){const I={};for(const z of b){const{key:D,value:S}=z;if(D.status==="aborted"||S.status==="aborted")return ht;D.status==="dirty"&&m.dirty(),S.status==="dirty"&&m.dirty(),D.value!=="__proto__"&&(typeof S.value<"u"||z.alwaysSet)&&(I[D.value]=S.value)}return{status:m.value,value:I}}}const ht=Object.freeze({status:"aborted"}),mo=y=>({status:"dirty",value:y}),kr=y=>({status:"valid",value:y}),Dd=y=>y.status==="aborted",Ld=y=>y.status==="dirty",_s=y=>y.status==="valid",kl=y=>typeof Promise<"u"&&y instanceof Promise;function Gu(y,m,b,I){if(typeof m=="function"?y!==m||!0:!m.has(y))throw new TypeError("Cannot read private member from an object whose class did not declare it");return m.get(y)}function em(y,m,b,I,z){if(typeof m=="function"?y!==m||!0:!m.has(y))throw new TypeError("Cannot write private member to an object whose class did not declare it");return m.set(y,b),b}typeof SuppressedError=="function"&&SuppressedError;var it;(function(y){y.errToObj=m=>typeof m=="string"?{message:m}:m||{},y.toString=m=>typeof m=="string"?m:m==null?void 0:m.message})(it||(it={}));var zl,Al;class $n{constructor(m,b,I,z){this._cachedPath=[],this.parent=m,this.data=b,this._path=I,this._key=z}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const tm=(y,m)=>{if(_s(m))return{success:!0,data:m.value};if(!y.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const b=new Wr(y.common.issues);return this._error=b,this._error}}};function xt(y){if(!y)return{};const{errorMap:m,invalid_type_error:b,required_error:I,description:z}=y;if(m&&(b||I))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return m?{errorMap:m,description:z}:{errorMap:(S,o)=>{var le,he;const{message:_e}=y;return S.code==="invalid_enum_value"?{message:_e??o.defaultError}:typeof o.data>"u"?{message:(le=_e??I)!==null&&le!==void 0?le:o.defaultError}:S.code!=="invalid_type"?{message:o.defaultError}:{message:(he=_e??b)!==null&&he!==void 0?he:o.defaultError}},description:z}}class Tt{get description(){return this._def.description}_getType(m){return da(m.data)}_getOrReturnCtx(m,b){return b||{common:m.parent.common,data:m.data,parsedType:da(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}_processInputParams(m){return{status:new yr,ctx:{common:m.parent.common,data:m.data,parsedType:da(m.data),schemaErrorMap:this._def.errorMap,path:m.path,parent:m.parent}}}_parseSync(m){const b=this._parse(m);if(kl(b))throw new Error("Synchronous parse encountered promise.");return b}_parseAsync(m){const b=this._parse(m);return Promise.resolve(b)}parse(m,b){const I=this.safeParse(m,b);if(I.success)return I.data;throw I.error}safeParse(m,b){var I;const z={common:{issues:[],async:(I=b==null?void 0:b.async)!==null&&I!==void 0?I:!1,contextualErrorMap:b==null?void 0:b.errorMap},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:da(m)},D=this._parseSync({data:m,path:z.path,parent:z});return tm(z,D)}"~validate"(m){var b,I;const z={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:da(m)};if(!this["~standard"].async)try{const D=this._parseSync({data:m,path:[],parent:z});return _s(D)?{value:D.value}:{issues:z.common.issues}}catch(D){!((I=(b=D==null?void 0:D.message)===null||b===void 0?void 0:b.toLowerCase())===null||I===void 0)&&I.includes("encountered")&&(this["~standard"].async=!0),z.common={issues:[],async:!0}}return this._parseAsync({data:m,path:[],parent:z}).then(D=>_s(D)?{value:D.value}:{issues:z.common.issues})}async parseAsync(m,b){const I=await this.safeParseAsync(m,b);if(I.success)return I.data;throw I.error}async safeParseAsync(m,b){const I={common:{issues:[],contextualErrorMap:b==null?void 0:b.errorMap,async:!0},path:(b==null?void 0:b.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:m,parsedType:da(m)},z=this._parse({data:m,path:I.path,parent:I}),D=await(kl(z)?z:Promise.resolve(z));return tm(I,D)}refine(m,b){const I=z=>typeof b=="string"||typeof b>"u"?{message:b}:typeof b=="function"?b(z):b;return this._refinement((z,D)=>{const S=m(z),o=()=>D.addIssue({code:Oe.custom,...I(z)});return typeof Promise<"u"&&S instanceof Promise?S.then(le=>le?!0:(o(),!1)):S?!0:(o(),!1)})}refinement(m,b){return this._refinement((I,z)=>m(I)?!0:(z.addIssue(typeof b=="function"?b(I,z):b),!1))}_refinement(m){return new Sn({schema:this,typeName:ct.ZodEffects,effect:{type:"refinement",refinement:m}})}superRefine(m){return this._refinement(m)}constructor(m){this.spa=this.safeParseAsync,this._def=m,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:b=>this["~validate"](b)}}optional(){return qn.create(this,this._def)}nullable(){return Za.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Mn.create(this)}promise(){return xo.create(this,this._def)}or(m){return Bl.create([this,m],this._def)}and(m){return Fl.create(this,m,this._def)}transform(m){return new Sn({...xt(this._def),schema:this,typeName:ct.ZodEffects,effect:{type:"transform",transform:m}})}default(m){const b=typeof m=="function"?m:()=>m;return new Vl({...xt(this._def),innerType:this,defaultValue:b,typeName:ct.ZodDefault})}brand(){return new Od({typeName:ct.ZodBranded,type:this,...xt(this._def)})}catch(m){const b=typeof m=="function"?m:()=>m;return new Ul({...xt(this._def),innerType:this,catchValue:b,typeName:ct.ZodCatch})}describe(m){const b=this.constructor;return new b({...this._def,description:m})}pipe(m){return $l.create(this,m)}readonly(){return Gl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Ly=/^c[^\s-]{8,}$/i,By=/^[0-9a-z]+$/,Fy=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Oy=/^[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,jy=/^[a-z0-9_-]{21}$/i,Ny=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Zy=/^[-+]?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)?)??$/,Vy=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Uy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Bd;const $y=/^(?:(?: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])$/,Gy=/^(?:(?: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])$/,qy=/^(([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]))$/,Hy=/^(([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])$/,Wy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Xy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,im="((\\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])))",Ky=new RegExp(`^${im}$`);function rm(y){let m="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return y.precision?m=`${m}\\.\\d{${y.precision}}`:y.precision==null&&(m=`${m}(\\.\\d+)?`),m}function Yy(y){return new RegExp(`^${rm(y)}$`)}function nm(y){let m=`${im}T${rm(y)}`;const b=[];return b.push(y.local?"Z?":"Z"),y.offset&&b.push("([+-]\\d{2}:?\\d{2})"),m=`${m}(${b.join("|")})`,new RegExp(`^${m}$`)}function Jy(y,m){return!!((m==="v4"||!m)&&$y.test(y)||(m==="v6"||!m)&&qy.test(y))}function Qy(y,m){if(!Ny.test(y))return!1;try{const[b]=y.split("."),I=b.replace(/-/g,"+").replace(/_/g,"/").padEnd(b.length+(4-b.length%4)%4,"="),z=JSON.parse(atob(I));return!(typeof z!="object"||z===null||!z.typ||!z.alg||m&&z.alg!==m)}catch{return!1}}function ex(y,m){return!!((m==="v4"||!m)&&Gy.test(y)||(m==="v6"||!m)&&Hy.test(y))}class Tn extends Tt{_parse(m){if(this._def.coerce&&(m.data=String(m.data)),this._getType(m)!==Ke.string){const D=this._getOrReturnCtx(m);return qe(D,{code:Oe.invalid_type,expected:Ke.string,received:D.parsedType}),ht}const I=new yr;let z;for(const D of this._def.checks)if(D.kind==="min")m.data.length<D.value&&(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.too_small,minimum:D.value,type:"string",inclusive:!0,exact:!1,message:D.message}),I.dirty());else if(D.kind==="max")m.data.length>D.value&&(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.too_big,maximum:D.value,type:"string",inclusive:!0,exact:!1,message:D.message}),I.dirty());else if(D.kind==="length"){const S=m.data.length>D.value,o=m.data.length<D.value;(S||o)&&(z=this._getOrReturnCtx(m,z),S?qe(z,{code:Oe.too_big,maximum:D.value,type:"string",inclusive:!0,exact:!0,message:D.message}):o&&qe(z,{code:Oe.too_small,minimum:D.value,type:"string",inclusive:!0,exact:!0,message:D.message}),I.dirty())}else if(D.kind==="email")Vy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"email",code:Oe.invalid_string,message:D.message}),I.dirty());else if(D.kind==="emoji")Bd||(Bd=new RegExp(Uy,"u")),Bd.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"emoji",code:Oe.invalid_string,message:D.message}),I.dirty());else if(D.kind==="uuid")Oy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"uuid",code:Oe.invalid_string,message:D.message}),I.dirty());else if(D.kind==="nanoid")jy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"nanoid",code:Oe.invalid_string,message:D.message}),I.dirty());else if(D.kind==="cuid")Ly.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"cuid",code:Oe.invalid_string,message:D.message}),I.dirty());else if(D.kind==="cuid2")By.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"cuid2",code:Oe.invalid_string,message:D.message}),I.dirty());else if(D.kind==="ulid")Fy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"ulid",code:Oe.invalid_string,message:D.message}),I.dirty());else if(D.kind==="url")try{new URL(m.data)}catch{z=this._getOrReturnCtx(m,z),qe(z,{validation:"url",code:Oe.invalid_string,message:D.message}),I.dirty()}else D.kind==="regex"?(D.regex.lastIndex=0,D.regex.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"regex",code:Oe.invalid_string,message:D.message}),I.dirty())):D.kind==="trim"?m.data=m.data.trim():D.kind==="includes"?m.data.includes(D.value,D.position)||(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.invalid_string,validation:{includes:D.value,position:D.position},message:D.message}),I.dirty()):D.kind==="toLowerCase"?m.data=m.data.toLowerCase():D.kind==="toUpperCase"?m.data=m.data.toUpperCase():D.kind==="startsWith"?m.data.startsWith(D.value)||(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.invalid_string,validation:{startsWith:D.value},message:D.message}),I.dirty()):D.kind==="endsWith"?m.data.endsWith(D.value)||(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.invalid_string,validation:{endsWith:D.value},message:D.message}),I.dirty()):D.kind==="datetime"?nm(D).test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.invalid_string,validation:"datetime",message:D.message}),I.dirty()):D.kind==="date"?Ky.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.invalid_string,validation:"date",message:D.message}),I.dirty()):D.kind==="time"?Yy(D).test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.invalid_string,validation:"time",message:D.message}),I.dirty()):D.kind==="duration"?Zy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"duration",code:Oe.invalid_string,message:D.message}),I.dirty()):D.kind==="ip"?Jy(m.data,D.version)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"ip",code:Oe.invalid_string,message:D.message}),I.dirty()):D.kind==="jwt"?Qy(m.data,D.alg)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"jwt",code:Oe.invalid_string,message:D.message}),I.dirty()):D.kind==="cidr"?ex(m.data,D.version)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"cidr",code:Oe.invalid_string,message:D.message}),I.dirty()):D.kind==="base64"?Wy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"base64",code:Oe.invalid_string,message:D.message}),I.dirty()):D.kind==="base64url"?Xy.test(m.data)||(z=this._getOrReturnCtx(m,z),qe(z,{validation:"base64url",code:Oe.invalid_string,message:D.message}),I.dirty()):Ot.assertNever(D);return{status:I.value,value:m.data}}_regex(m,b,I){return this.refinement(z=>m.test(z),{validation:b,code:Oe.invalid_string,...it.errToObj(I)})}_addCheck(m){return new Tn({...this._def,checks:[...this._def.checks,m]})}email(m){return this._addCheck({kind:"email",...it.errToObj(m)})}url(m){return this._addCheck({kind:"url",...it.errToObj(m)})}emoji(m){return this._addCheck({kind:"emoji",...it.errToObj(m)})}uuid(m){return this._addCheck({kind:"uuid",...it.errToObj(m)})}nanoid(m){return this._addCheck({kind:"nanoid",...it.errToObj(m)})}cuid(m){return this._addCheck({kind:"cuid",...it.errToObj(m)})}cuid2(m){return this._addCheck({kind:"cuid2",...it.errToObj(m)})}ulid(m){return this._addCheck({kind:"ulid",...it.errToObj(m)})}base64(m){return this._addCheck({kind:"base64",...it.errToObj(m)})}base64url(m){return this._addCheck({kind:"base64url",...it.errToObj(m)})}jwt(m){return this._addCheck({kind:"jwt",...it.errToObj(m)})}ip(m){return this._addCheck({kind:"ip",...it.errToObj(m)})}cidr(m){return this._addCheck({kind:"cidr",...it.errToObj(m)})}datetime(m){var b,I;return typeof m=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:m}):this._addCheck({kind:"datetime",precision:typeof(m==null?void 0:m.precision)>"u"?null:m==null?void 0:m.precision,offset:(b=m==null?void 0:m.offset)!==null&&b!==void 0?b:!1,local:(I=m==null?void 0:m.local)!==null&&I!==void 0?I:!1,...it.errToObj(m==null?void 0:m.message)})}date(m){return this._addCheck({kind:"date",message:m})}time(m){return typeof m=="string"?this._addCheck({kind:"time",precision:null,message:m}):this._addCheck({kind:"time",precision:typeof(m==null?void 0:m.precision)>"u"?null:m==null?void 0:m.precision,...it.errToObj(m==null?void 0:m.message)})}duration(m){return this._addCheck({kind:"duration",...it.errToObj(m)})}regex(m,b){return this._addCheck({kind:"regex",regex:m,...it.errToObj(b)})}includes(m,b){return this._addCheck({kind:"includes",value:m,position:b==null?void 0:b.position,...it.errToObj(b==null?void 0:b.message)})}startsWith(m,b){return this._addCheck({kind:"startsWith",value:m,...it.errToObj(b)})}endsWith(m,b){return this._addCheck({kind:"endsWith",value:m,...it.errToObj(b)})}min(m,b){return this._addCheck({kind:"min",value:m,...it.errToObj(b)})}max(m,b){return this._addCheck({kind:"max",value:m,...it.errToObj(b)})}length(m,b){return this._addCheck({kind:"length",value:m,...it.errToObj(b)})}nonempty(m){return this.min(1,it.errToObj(m))}trim(){return new Tn({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Tn({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Tn({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(m=>m.kind==="datetime")}get isDate(){return!!this._def.checks.find(m=>m.kind==="date")}get isTime(){return!!this._def.checks.find(m=>m.kind==="time")}get isDuration(){return!!this._def.checks.find(m=>m.kind==="duration")}get isEmail(){return!!this._def.checks.find(m=>m.kind==="email")}get isURL(){return!!this._def.checks.find(m=>m.kind==="url")}get isEmoji(){return!!this._def.checks.find(m=>m.kind==="emoji")}get isUUID(){return!!this._def.checks.find(m=>m.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(m=>m.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(m=>m.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(m=>m.kind==="cuid2")}get isULID(){return!!this._def.checks.find(m=>m.kind==="ulid")}get isIP(){return!!this._def.checks.find(m=>m.kind==="ip")}get isCIDR(){return!!this._def.checks.find(m=>m.kind==="cidr")}get isBase64(){return!!this._def.checks.find(m=>m.kind==="base64")}get isBase64url(){return!!this._def.checks.find(m=>m.kind==="base64url")}get minLength(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxLength(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}}Tn.create=y=>{var m;return new Tn({checks:[],typeName:ct.ZodString,coerce:(m=y==null?void 0:y.coerce)!==null&&m!==void 0?m:!1,...xt(y)})};function tx(y,m){const b=(y.toString().split(".")[1]||"").length,I=(m.toString().split(".")[1]||"").length,z=b>I?b:I,D=parseInt(y.toFixed(z).replace(".","")),S=parseInt(m.toFixed(z).replace(".",""));return D%S/Math.pow(10,z)}class Oa extends Tt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(m){if(this._def.coerce&&(m.data=Number(m.data)),this._getType(m)!==Ke.number){const D=this._getOrReturnCtx(m);return qe(D,{code:Oe.invalid_type,expected:Ke.number,received:D.parsedType}),ht}let I;const z=new yr;for(const D of this._def.checks)D.kind==="int"?Ot.isInteger(m.data)||(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.invalid_type,expected:"integer",received:"float",message:D.message}),z.dirty()):D.kind==="min"?(D.inclusive?m.data<D.value:m.data<=D.value)&&(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.too_small,minimum:D.value,type:"number",inclusive:D.inclusive,exact:!1,message:D.message}),z.dirty()):D.kind==="max"?(D.inclusive?m.data>D.value:m.data>=D.value)&&(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.too_big,maximum:D.value,type:"number",inclusive:D.inclusive,exact:!1,message:D.message}),z.dirty()):D.kind==="multipleOf"?tx(m.data,D.value)!==0&&(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.not_multiple_of,multipleOf:D.value,message:D.message}),z.dirty()):D.kind==="finite"?Number.isFinite(m.data)||(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.not_finite,message:D.message}),z.dirty()):Ot.assertNever(D);return{status:z.value,value:m.data}}gte(m,b){return this.setLimit("min",m,!0,it.toString(b))}gt(m,b){return this.setLimit("min",m,!1,it.toString(b))}lte(m,b){return this.setLimit("max",m,!0,it.toString(b))}lt(m,b){return this.setLimit("max",m,!1,it.toString(b))}setLimit(m,b,I,z){return new Oa({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:I,message:it.toString(z)}]})}_addCheck(m){return new Oa({...this._def,checks:[...this._def.checks,m]})}int(m){return this._addCheck({kind:"int",message:it.toString(m)})}positive(m){return this._addCheck({kind:"min",value:0,inclusive:!1,message:it.toString(m)})}negative(m){return this._addCheck({kind:"max",value:0,inclusive:!1,message:it.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:0,inclusive:!0,message:it.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:0,inclusive:!0,message:it.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:it.toString(b)})}finite(m){return this._addCheck({kind:"finite",message:it.toString(m)})}safe(m){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:it.toString(m)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:it.toString(m)})}get minValue(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxValue(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}get isInt(){return!!this._def.checks.find(m=>m.kind==="int"||m.kind==="multipleOf"&&Ot.isInteger(m.value))}get isFinite(){let m=null,b=null;for(const I of this._def.checks){if(I.kind==="finite"||I.kind==="int"||I.kind==="multipleOf")return!0;I.kind==="min"?(b===null||I.value>b)&&(b=I.value):I.kind==="max"&&(m===null||I.value<m)&&(m=I.value)}return Number.isFinite(b)&&Number.isFinite(m)}}Oa.create=y=>new Oa({checks:[],typeName:ct.ZodNumber,coerce:(y==null?void 0:y.coerce)||!1,...xt(y)});class ja extends Tt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(m){if(this._def.coerce)try{m.data=BigInt(m.data)}catch{return this._getInvalidInput(m)}if(this._getType(m)!==Ke.bigint)return this._getInvalidInput(m);let I;const z=new yr;for(const D of this._def.checks)D.kind==="min"?(D.inclusive?m.data<D.value:m.data<=D.value)&&(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.too_small,type:"bigint",minimum:D.value,inclusive:D.inclusive,message:D.message}),z.dirty()):D.kind==="max"?(D.inclusive?m.data>D.value:m.data>=D.value)&&(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.too_big,type:"bigint",maximum:D.value,inclusive:D.inclusive,message:D.message}),z.dirty()):D.kind==="multipleOf"?m.data%D.value!==BigInt(0)&&(I=this._getOrReturnCtx(m,I),qe(I,{code:Oe.not_multiple_of,multipleOf:D.value,message:D.message}),z.dirty()):Ot.assertNever(D);return{status:z.value,value:m.data}}_getInvalidInput(m){const b=this._getOrReturnCtx(m);return qe(b,{code:Oe.invalid_type,expected:Ke.bigint,received:b.parsedType}),ht}gte(m,b){return this.setLimit("min",m,!0,it.toString(b))}gt(m,b){return this.setLimit("min",m,!1,it.toString(b))}lte(m,b){return this.setLimit("max",m,!0,it.toString(b))}lt(m,b){return this.setLimit("max",m,!1,it.toString(b))}setLimit(m,b,I,z){return new ja({...this._def,checks:[...this._def.checks,{kind:m,value:b,inclusive:I,message:it.toString(z)}]})}_addCheck(m){return new ja({...this._def,checks:[...this._def.checks,m]})}positive(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:it.toString(m)})}negative(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:it.toString(m)})}nonpositive(m){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:it.toString(m)})}nonnegative(m){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:it.toString(m)})}multipleOf(m,b){return this._addCheck({kind:"multipleOf",value:m,message:it.toString(b)})}get minValue(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m}get maxValue(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m}}ja.create=y=>{var m;return new ja({checks:[],typeName:ct.ZodBigInt,coerce:(m=y==null?void 0:y.coerce)!==null&&m!==void 0?m:!1,...xt(y)})};class Rl extends Tt{_parse(m){if(this._def.coerce&&(m.data=!!m.data),this._getType(m)!==Ke.boolean){const I=this._getOrReturnCtx(m);return qe(I,{code:Oe.invalid_type,expected:Ke.boolean,received:I.parsedType}),ht}return kr(m.data)}}Rl.create=y=>new Rl({typeName:ct.ZodBoolean,coerce:(y==null?void 0:y.coerce)||!1,...xt(y)});class ys extends Tt{_parse(m){if(this._def.coerce&&(m.data=new Date(m.data)),this._getType(m)!==Ke.date){const D=this._getOrReturnCtx(m);return qe(D,{code:Oe.invalid_type,expected:Ke.date,received:D.parsedType}),ht}if(isNaN(m.data.getTime())){const D=this._getOrReturnCtx(m);return qe(D,{code:Oe.invalid_date}),ht}const I=new yr;let z;for(const D of this._def.checks)D.kind==="min"?m.data.getTime()<D.value&&(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.too_small,message:D.message,inclusive:!0,exact:!1,minimum:D.value,type:"date"}),I.dirty()):D.kind==="max"?m.data.getTime()>D.value&&(z=this._getOrReturnCtx(m,z),qe(z,{code:Oe.too_big,message:D.message,inclusive:!0,exact:!1,maximum:D.value,type:"date"}),I.dirty()):Ot.assertNever(D);return{status:I.value,value:new Date(m.data.getTime())}}_addCheck(m){return new ys({...this._def,checks:[...this._def.checks,m]})}min(m,b){return this._addCheck({kind:"min",value:m.getTime(),message:it.toString(b)})}max(m,b){return this._addCheck({kind:"max",value:m.getTime(),message:it.toString(b)})}get minDate(){let m=null;for(const b of this._def.checks)b.kind==="min"&&(m===null||b.value>m)&&(m=b.value);return m!=null?new Date(m):null}get maxDate(){let m=null;for(const b of this._def.checks)b.kind==="max"&&(m===null||b.value<m)&&(m=b.value);return m!=null?new Date(m):null}}ys.create=y=>new ys({checks:[],coerce:(y==null?void 0:y.coerce)||!1,typeName:ct.ZodDate,...xt(y)});class qu extends Tt{_parse(m){if(this._getType(m)!==Ke.symbol){const I=this._getOrReturnCtx(m);return qe(I,{code:Oe.invalid_type,expected:Ke.symbol,received:I.parsedType}),ht}return kr(m.data)}}qu.create=y=>new qu({typeName:ct.ZodSymbol,...xt(y)});class Dl extends Tt{_parse(m){if(this._getType(m)!==Ke.undefined){const I=this._getOrReturnCtx(m);return qe(I,{code:Oe.invalid_type,expected:Ke.undefined,received:I.parsedType}),ht}return kr(m.data)}}Dl.create=y=>new Dl({typeName:ct.ZodUndefined,...xt(y)});class Ll extends Tt{_parse(m){if(this._getType(m)!==Ke.null){const I=this._getOrReturnCtx(m);return qe(I,{code:Oe.invalid_type,expected:Ke.null,received:I.parsedType}),ht}return kr(m.data)}}Ll.create=y=>new Ll({typeName:ct.ZodNull,...xt(y)});class go extends Tt{constructor(){super(...arguments),this._any=!0}_parse(m){return kr(m.data)}}go.create=y=>new go({typeName:ct.ZodAny,...xt(y)});class xs extends Tt{constructor(){super(...arguments),this._unknown=!0}_parse(m){return kr(m.data)}}xs.create=y=>new xs({typeName:ct.ZodUnknown,...xt(y)});class pa extends Tt{_parse(m){const b=this._getOrReturnCtx(m);return qe(b,{code:Oe.invalid_type,expected:Ke.never,received:b.parsedType}),ht}}pa.create=y=>new pa({typeName:ct.ZodNever,...xt(y)});class Hu extends Tt{_parse(m){if(this._getType(m)!==Ke.undefined){const I=this._getOrReturnCtx(m);return qe(I,{code:Oe.invalid_type,expected:Ke.void,received:I.parsedType}),ht}return kr(m.data)}}Hu.create=y=>new Hu({typeName:ct.ZodVoid,...xt(y)});class Mn extends Tt{_parse(m){const{ctx:b,status:I}=this._processInputParams(m),z=this._def;if(b.parsedType!==Ke.array)return qe(b,{code:Oe.invalid_type,expected:Ke.array,received:b.parsedType}),ht;if(z.exactLength!==null){const S=b.data.length>z.exactLength.value,o=b.data.length<z.exactLength.value;(S||o)&&(qe(b,{code:S?Oe.too_big:Oe.too_small,minimum:o?z.exactLength.value:void 0,maximum:S?z.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:z.exactLength.message}),I.dirty())}if(z.minLength!==null&&b.data.length<z.minLength.value&&(qe(b,{code:Oe.too_small,minimum:z.minLength.value,type:"array",inclusive:!0,exact:!1,message:z.minLength.message}),I.dirty()),z.maxLength!==null&&b.data.length>z.maxLength.value&&(qe(b,{code:Oe.too_big,maximum:z.maxLength.value,type:"array",inclusive:!0,exact:!1,message:z.maxLength.message}),I.dirty()),b.common.async)return Promise.all([...b.data].map((S,o)=>z.type._parseAsync(new $n(b,S,b.path,o)))).then(S=>yr.mergeArray(I,S));const D=[...b.data].map((S,o)=>z.type._parseSync(new $n(b,S,b.path,o)));return yr.mergeArray(I,D)}get element(){return this._def.type}min(m,b){return new Mn({...this._def,minLength:{value:m,message:it.toString(b)}})}max(m,b){return new Mn({...this._def,maxLength:{value:m,message:it.toString(b)}})}length(m,b){return new Mn({...this._def,exactLength:{value:m,message:it.toString(b)}})}nonempty(m){return this.min(1,m)}}Mn.create=(y,m)=>new Mn({type:y,minLength:null,maxLength:null,exactLength:null,typeName:ct.ZodArray,...xt(m)});function _o(y){if(y instanceof Ii){const m={};for(const b in y.shape){const I=y.shape[b];m[b]=qn.create(_o(I))}return new Ii({...y._def,shape:()=>m})}else return y instanceof Mn?new Mn({...y._def,type:_o(y.element)}):y instanceof qn?qn.create(_o(y.unwrap())):y instanceof Za?Za.create(_o(y.unwrap())):y instanceof Gn?Gn.create(y.items.map(m=>_o(m))):y}class Ii extends Tt{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const m=this._def.shape(),b=Ot.objectKeys(m);return this._cached={shape:m,keys:b}}_parse(m){if(this._getType(m)!==Ke.object){const he=this._getOrReturnCtx(m);return qe(he,{code:Oe.invalid_type,expected:Ke.object,received:he.parsedType}),ht}const{status:I,ctx:z}=this._processInputParams(m),{shape:D,keys:S}=this._getCached(),o=[];if(!(this._def.catchall instanceof pa&&this._def.unknownKeys==="strip"))for(const he in z.data)S.includes(he)||o.push(he);const le=[];for(const he of S){const _e=D[he],Re=z.data[he];le.push({key:{status:"valid",value:he},value:_e._parse(new $n(z,Re,z.path,he)),alwaysSet:he in z.data})}if(this._def.catchall instanceof pa){const he=this._def.unknownKeys;if(he==="passthrough")for(const _e of o)le.push({key:{status:"valid",value:_e},value:{status:"valid",value:z.data[_e]}});else if(he==="strict")o.length>0&&(qe(z,{code:Oe.unrecognized_keys,keys:o}),I.dirty());else if(he!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const he=this._def.catchall;for(const _e of o){const Re=z.data[_e];le.push({key:{status:"valid",value:_e},value:he._parse(new $n(z,Re,z.path,_e)),alwaysSet:_e in z.data})}}return z.common.async?Promise.resolve().then(async()=>{const he=[];for(const _e of le){const Re=await _e.key,ve=await _e.value;he.push({key:Re,value:ve,alwaysSet:_e.alwaysSet})}return he}).then(he=>yr.mergeObjectSync(I,he)):yr.mergeObjectSync(I,le)}get shape(){return this._def.shape()}strict(m){return it.errToObj,new Ii({...this._def,unknownKeys:"strict",...m!==void 0?{errorMap:(b,I)=>{var z,D,S,o;const le=(S=(D=(z=this._def).errorMap)===null||D===void 0?void 0:D.call(z,b,I).message)!==null&&S!==void 0?S:I.defaultError;return b.code==="unrecognized_keys"?{message:(o=it.errToObj(m).message)!==null&&o!==void 0?o:le}:{message:le}}}:{}})}strip(){return new Ii({...this._def,unknownKeys:"strip"})}passthrough(){return new Ii({...this._def,unknownKeys:"passthrough"})}extend(m){return new Ii({...this._def,shape:()=>({...this._def.shape(),...m})})}merge(m){return new Ii({unknownKeys:m._def.unknownKeys,catchall:m._def.catchall,shape:()=>({...this._def.shape(),...m._def.shape()}),typeName:ct.ZodObject})}setKey(m,b){return this.augment({[m]:b})}catchall(m){return new Ii({...this._def,catchall:m})}pick(m){const b={};return Ot.objectKeys(m).forEach(I=>{m[I]&&this.shape[I]&&(b[I]=this.shape[I])}),new Ii({...this._def,shape:()=>b})}omit(m){const b={};return Ot.objectKeys(this.shape).forEach(I=>{m[I]||(b[I]=this.shape[I])}),new Ii({...this._def,shape:()=>b})}deepPartial(){return _o(this)}partial(m){const b={};return Ot.objectKeys(this.shape).forEach(I=>{const z=this.shape[I];m&&!m[I]?b[I]=z:b[I]=z.optional()}),new Ii({...this._def,shape:()=>b})}required(m){const b={};return Ot.objectKeys(this.shape).forEach(I=>{if(m&&!m[I])b[I]=this.shape[I];else{let D=this.shape[I];for(;D instanceof qn;)D=D._def.innerType;b[I]=D}}),new Ii({...this._def,shape:()=>b})}keyof(){return am(Ot.objectKeys(this.shape))}}Ii.create=(y,m)=>new Ii({shape:()=>y,unknownKeys:"strip",catchall:pa.create(),typeName:ct.ZodObject,...xt(m)}),Ii.strictCreate=(y,m)=>new Ii({shape:()=>y,unknownKeys:"strict",catchall:pa.create(),typeName:ct.ZodObject,...xt(m)}),Ii.lazycreate=(y,m)=>new Ii({shape:y,unknownKeys:"strip",catchall:pa.create(),typeName:ct.ZodObject,...xt(m)});class Bl extends Tt{_parse(m){const{ctx:b}=this._processInputParams(m),I=this._def.options;function z(D){for(const o of D)if(o.result.status==="valid")return o.result;for(const o of D)if(o.result.status==="dirty")return b.common.issues.push(...o.ctx.common.issues),o.result;const S=D.map(o=>new Wr(o.ctx.common.issues));return qe(b,{code:Oe.invalid_union,unionErrors:S}),ht}if(b.common.async)return Promise.all(I.map(async D=>{const S={...b,common:{...b.common,issues:[]},parent:null};return{result:await D._parseAsync({data:b.data,path:b.path,parent:S}),ctx:S}})).then(z);{let D;const S=[];for(const le of I){const he={...b,common:{...b.common,issues:[]},parent:null},_e=le._parseSync({data:b.data,path:b.path,parent:he});if(_e.status==="valid")return _e;_e.status==="dirty"&&!D&&(D={result:_e,ctx:he}),he.common.issues.length&&S.push(he.common.issues)}if(D)return b.common.issues.push(...D.ctx.common.issues),D.result;const o=S.map(le=>new Wr(le));return qe(b,{code:Oe.invalid_union,unionErrors:o}),ht}}get options(){return this._def.options}}Bl.create=(y,m)=>new Bl({options:y,typeName:ct.ZodUnion,...xt(m)});const fa=y=>y instanceof jl?fa(y.schema):y instanceof Sn?fa(y.innerType()):y instanceof Nl?[y.value]:y instanceof Na?y.options:y instanceof Zl?Ot.objectValues(y.enum):y instanceof Vl?fa(y._def.innerType):y instanceof Dl?[void 0]:y instanceof Ll?[null]:y instanceof qn?[void 0,...fa(y.unwrap())]:y instanceof Za?[null,...fa(y.unwrap())]:y instanceof Od||y instanceof Gl?fa(y.unwrap()):y instanceof Ul?fa(y._def.innerType):[];class Wu extends Tt{_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Ke.object)return qe(b,{code:Oe.invalid_type,expected:Ke.object,received:b.parsedType}),ht;const I=this.discriminator,z=b.data[I],D=this.optionsMap.get(z);return D?b.common.async?D._parseAsync({data:b.data,path:b.path,parent:b}):D._parseSync({data:b.data,path:b.path,parent:b}):(qe(b,{code:Oe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[I]}),ht)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(m,b,I){const z=new Map;for(const D of b){const S=fa(D.shape[m]);if(!S.length)throw new Error(`A discriminator value for key \`${m}\` could not be extracted from all schema options`);for(const o of S){if(z.has(o))throw new Error(`Discriminator property ${String(m)} has duplicate value ${String(o)}`);z.set(o,D)}}return new Wu({typeName:ct.ZodDiscriminatedUnion,discriminator:m,options:b,optionsMap:z,...xt(I)})}}function Fd(y,m){const b=da(y),I=da(m);if(y===m)return{valid:!0,data:y};if(b===Ke.object&&I===Ke.object){const z=Ot.objectKeys(m),D=Ot.objectKeys(y).filter(o=>z.indexOf(o)!==-1),S={...y,...m};for(const o of D){const le=Fd(y[o],m[o]);if(!le.valid)return{valid:!1};S[o]=le.data}return{valid:!0,data:S}}else if(b===Ke.array&&I===Ke.array){if(y.length!==m.length)return{valid:!1};const z=[];for(let D=0;D<y.length;D++){const S=y[D],o=m[D],le=Fd(S,o);if(!le.valid)return{valid:!1};z.push(le.data)}return{valid:!0,data:z}}else return b===Ke.date&&I===Ke.date&&+y==+m?{valid:!0,data:y}:{valid:!1}}class Fl extends Tt{_parse(m){const{status:b,ctx:I}=this._processInputParams(m),z=(D,S)=>{if(Dd(D)||Dd(S))return ht;const o=Fd(D.value,S.value);return o.valid?((Ld(D)||Ld(S))&&b.dirty(),{status:b.value,value:o.data}):(qe(I,{code:Oe.invalid_intersection_types}),ht)};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(([D,S])=>z(D,S)):z(this._def.left._parseSync({data:I.data,path:I.path,parent:I}),this._def.right._parseSync({data:I.data,path:I.path,parent:I}))}}Fl.create=(y,m,b)=>new Fl({left:y,right:m,typeName:ct.ZodIntersection,...xt(b)});class Gn extends Tt{_parse(m){const{status:b,ctx:I}=this._processInputParams(m);if(I.parsedType!==Ke.array)return qe(I,{code:Oe.invalid_type,expected:Ke.array,received:I.parsedType}),ht;if(I.data.length<this._def.items.length)return qe(I,{code:Oe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ht;!this._def.rest&&I.data.length>this._def.items.length&&(qe(I,{code:Oe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),b.dirty());const D=[...I.data].map((S,o)=>{const le=this._def.items[o]||this._def.rest;return le?le._parse(new $n(I,S,I.path,o)):null}).filter(S=>!!S);return I.common.async?Promise.all(D).then(S=>yr.mergeArray(b,S)):yr.mergeArray(b,D)}get items(){return this._def.items}rest(m){return new Gn({...this._def,rest:m})}}Gn.create=(y,m)=>{if(!Array.isArray(y))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Gn({items:y,typeName:ct.ZodTuple,rest:null,...xt(m)})};class Ol extends Tt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:I}=this._processInputParams(m);if(I.parsedType!==Ke.object)return qe(I,{code:Oe.invalid_type,expected:Ke.object,received:I.parsedType}),ht;const z=[],D=this._def.keyType,S=this._def.valueType;for(const o in I.data)z.push({key:D._parse(new $n(I,o,I.path,o)),value:S._parse(new $n(I,I.data[o],I.path,o)),alwaysSet:o in I.data});return I.common.async?yr.mergeObjectAsync(b,z):yr.mergeObjectSync(b,z)}get element(){return this._def.valueType}static create(m,b,I){return b instanceof Tt?new Ol({keyType:m,valueType:b,typeName:ct.ZodRecord,...xt(I)}):new Ol({keyType:Tn.create(),valueType:m,typeName:ct.ZodRecord,...xt(b)})}}class Xu extends Tt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(m){const{status:b,ctx:I}=this._processInputParams(m);if(I.parsedType!==Ke.map)return qe(I,{code:Oe.invalid_type,expected:Ke.map,received:I.parsedType}),ht;const z=this._def.keyType,D=this._def.valueType,S=[...I.data.entries()].map(([o,le],he)=>({key:z._parse(new $n(I,o,I.path,[he,"key"])),value:D._parse(new $n(I,le,I.path,[he,"value"]))}));if(I.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const le of S){const he=await le.key,_e=await le.value;if(he.status==="aborted"||_e.status==="aborted")return ht;(he.status==="dirty"||_e.status==="dirty")&&b.dirty(),o.set(he.value,_e.value)}return{status:b.value,value:o}})}else{const o=new Map;for(const le of S){const he=le.key,_e=le.value;if(he.status==="aborted"||_e.status==="aborted")return ht;(he.status==="dirty"||_e.status==="dirty")&&b.dirty(),o.set(he.value,_e.value)}return{status:b.value,value:o}}}}Xu.create=(y,m,b)=>new Xu({valueType:m,keyType:y,typeName:ct.ZodMap,...xt(b)});class vs extends Tt{_parse(m){const{status:b,ctx:I}=this._processInputParams(m);if(I.parsedType!==Ke.set)return qe(I,{code:Oe.invalid_type,expected:Ke.set,received:I.parsedType}),ht;const z=this._def;z.minSize!==null&&I.data.size<z.minSize.value&&(qe(I,{code:Oe.too_small,minimum:z.minSize.value,type:"set",inclusive:!0,exact:!1,message:z.minSize.message}),b.dirty()),z.maxSize!==null&&I.data.size>z.maxSize.value&&(qe(I,{code:Oe.too_big,maximum:z.maxSize.value,type:"set",inclusive:!0,exact:!1,message:z.maxSize.message}),b.dirty());const D=this._def.valueType;function S(le){const he=new Set;for(const _e of le){if(_e.status==="aborted")return ht;_e.status==="dirty"&&b.dirty(),he.add(_e.value)}return{status:b.value,value:he}}const o=[...I.data.values()].map((le,he)=>D._parse(new $n(I,le,I.path,he)));return I.common.async?Promise.all(o).then(le=>S(le)):S(o)}min(m,b){return new vs({...this._def,minSize:{value:m,message:it.toString(b)}})}max(m,b){return new vs({...this._def,maxSize:{value:m,message:it.toString(b)}})}size(m,b){return this.min(m,b).max(m,b)}nonempty(m){return this.min(1,m)}}vs.create=(y,m)=>new vs({valueType:y,minSize:null,maxSize:null,typeName:ct.ZodSet,...xt(m)});class yo extends Tt{constructor(){super(...arguments),this.validate=this.implement}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Ke.function)return qe(b,{code:Oe.invalid_type,expected:Ke.function,received:b.parsedType}),ht;function I(o,le){return $u({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Uu(),fo].filter(he=>!!he),issueData:{code:Oe.invalid_arguments,argumentsError:le}})}function z(o,le){return $u({data:o,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,Uu(),fo].filter(he=>!!he),issueData:{code:Oe.invalid_return_type,returnTypeError:le}})}const D={errorMap:b.common.contextualErrorMap},S=b.data;if(this._def.returns instanceof xo){const o=this;return kr(async function(...le){const he=new Wr([]),_e=await o._def.args.parseAsync(le,D).catch(ne=>{throw he.addIssue(I(le,ne)),he}),Re=await Reflect.apply(S,this,_e);return await o._def.returns._def.type.parseAsync(Re,D).catch(ne=>{throw he.addIssue(z(Re,ne)),he})})}else{const o=this;return kr(function(...le){const he=o._def.args.safeParse(le,D);if(!he.success)throw new Wr([I(le,he.error)]);const _e=Reflect.apply(S,this,he.data),Re=o._def.returns.safeParse(_e,D);if(!Re.success)throw new Wr([z(_e,Re.error)]);return Re.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...m){return new yo({...this._def,args:Gn.create(m).rest(xs.create())})}returns(m){return new yo({...this._def,returns:m})}implement(m){return this.parse(m)}strictImplement(m){return this.parse(m)}static create(m,b,I){return new yo({args:m||Gn.create([]).rest(xs.create()),returns:b||xs.create(),typeName:ct.ZodFunction,...xt(I)})}}class jl extends Tt{get schema(){return this._def.getter()}_parse(m){const{ctx:b}=this._processInputParams(m);return this._def.getter()._parse({data:b.data,path:b.path,parent:b})}}jl.create=(y,m)=>new jl({getter:y,typeName:ct.ZodLazy,...xt(m)});class Nl extends Tt{_parse(m){if(m.data!==this._def.value){const b=this._getOrReturnCtx(m);return qe(b,{received:b.data,code:Oe.invalid_literal,expected:this._def.value}),ht}return{status:"valid",value:m.data}}get value(){return this._def.value}}Nl.create=(y,m)=>new Nl({value:y,typeName:ct.ZodLiteral,...xt(m)});function am(y,m){return new Na({values:y,typeName:ct.ZodEnum,...xt(m)})}class Na extends Tt{constructor(){super(...arguments),zl.set(this,void 0)}_parse(m){if(typeof m.data!="string"){const b=this._getOrReturnCtx(m),I=this._def.values;return qe(b,{expected:Ot.joinValues(I),received:b.parsedType,code:Oe.invalid_type}),ht}if(Gu(this,zl)||em(this,zl,new Set(this._def.values)),!Gu(this,zl).has(m.data)){const b=this._getOrReturnCtx(m),I=this._def.values;return qe(b,{received:b.data,code:Oe.invalid_enum_value,options:I}),ht}return kr(m.data)}get options(){return this._def.values}get enum(){const m={};for(const b of this._def.values)m[b]=b;return m}get Values(){const m={};for(const b of this._def.values)m[b]=b;return m}get Enum(){const m={};for(const b of this._def.values)m[b]=b;return m}extract(m,b=this._def){return Na.create(m,{...this._def,...b})}exclude(m,b=this._def){return Na.create(this.options.filter(I=>!m.includes(I)),{...this._def,...b})}}zl=new WeakMap,Na.create=am;class Zl extends Tt{constructor(){super(...arguments),Al.set(this,void 0)}_parse(m){const b=Ot.getValidEnumValues(this._def.values),I=this._getOrReturnCtx(m);if(I.parsedType!==Ke.string&&I.parsedType!==Ke.number){const z=Ot.objectValues(b);return qe(I,{expected:Ot.joinValues(z),received:I.parsedType,code:Oe.invalid_type}),ht}if(Gu(this,Al)||em(this,Al,new Set(Ot.getValidEnumValues(this._def.values))),!Gu(this,Al).has(m.data)){const z=Ot.objectValues(b);return qe(I,{received:I.data,code:Oe.invalid_enum_value,options:z}),ht}return kr(m.data)}get enum(){return this._def.values}}Al=new WeakMap,Zl.create=(y,m)=>new Zl({values:y,typeName:ct.ZodNativeEnum,...xt(m)});class xo extends Tt{unwrap(){return this._def.type}_parse(m){const{ctx:b}=this._processInputParams(m);if(b.parsedType!==Ke.promise&&b.common.async===!1)return qe(b,{code:Oe.invalid_type,expected:Ke.promise,received:b.parsedType}),ht;const I=b.parsedType===Ke.promise?b.data:Promise.resolve(b.data);return kr(I.then(z=>this._def.type.parseAsync(z,{path:b.path,errorMap:b.common.contextualErrorMap})))}}xo.create=(y,m)=>new xo({type:y,typeName:ct.ZodPromise,...xt(m)});class Sn extends Tt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ct.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(m){const{status:b,ctx:I}=this._processInputParams(m),z=this._def.effect||null,D={addIssue:S=>{qe(I,S),S.fatal?b.abort():b.dirty()},get path(){return I.path}};if(D.addIssue=D.addIssue.bind(D),z.type==="preprocess"){const S=z.transform(I.data,D);if(I.common.async)return Promise.resolve(S).then(async o=>{if(b.value==="aborted")return ht;const le=await this._def.schema._parseAsync({data:o,path:I.path,parent:I});return le.status==="aborted"?ht:le.status==="dirty"||b.value==="dirty"?mo(le.value):le});{if(b.value==="aborted")return ht;const o=this._def.schema._parseSync({data:S,path:I.path,parent:I});return o.status==="aborted"?ht:o.status==="dirty"||b.value==="dirty"?mo(o.value):o}}if(z.type==="refinement"){const S=o=>{const le=z.refinement(o,D);if(I.common.async)return Promise.resolve(le);if(le 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"?ht:(o.status==="dirty"&&b.dirty(),S(o.value),{status:b.value,value:o.value})}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(o=>o.status==="aborted"?ht:(o.status==="dirty"&&b.dirty(),S(o.value).then(()=>({status:b.value,value:o.value}))))}if(z.type==="transform")if(I.common.async===!1){const S=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});if(!_s(S))return S;const o=z.transform(S.value,D);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:b.value,value:o}}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(S=>_s(S)?Promise.resolve(z.transform(S.value,D)).then(o=>({status:b.value,value:o})):S);Ot.assertNever(z)}}Sn.create=(y,m,b)=>new Sn({schema:y,typeName:ct.ZodEffects,effect:m,...xt(b)}),Sn.createWithPreprocess=(y,m,b)=>new Sn({schema:m,effect:{type:"preprocess",transform:y},typeName:ct.ZodEffects,...xt(b)});class qn extends Tt{_parse(m){return this._getType(m)===Ke.undefined?kr(void 0):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}qn.create=(y,m)=>new qn({innerType:y,typeName:ct.ZodOptional,...xt(m)});class Za extends Tt{_parse(m){return this._getType(m)===Ke.null?kr(null):this._def.innerType._parse(m)}unwrap(){return this._def.innerType}}Za.create=(y,m)=>new Za({innerType:y,typeName:ct.ZodNullable,...xt(m)});class Vl extends Tt{_parse(m){const{ctx:b}=this._processInputParams(m);let I=b.data;return b.parsedType===Ke.undefined&&(I=this._def.defaultValue()),this._def.innerType._parse({data:I,path:b.path,parent:b})}removeDefault(){return this._def.innerType}}Vl.create=(y,m)=>new Vl({innerType:y,typeName:ct.ZodDefault,defaultValue:typeof m.default=="function"?m.default:()=>m.default,...xt(m)});class Ul extends Tt{_parse(m){const{ctx:b}=this._processInputParams(m),I={...b,common:{...b.common,issues:[]}},z=this._def.innerType._parse({data:I.data,path:I.path,parent:{...I}});return kl(z)?z.then(D=>({status:"valid",value:D.status==="valid"?D.value:this._def.catchValue({get error(){return new Wr(I.common.issues)},input:I.data})})):{status:"valid",value:z.status==="valid"?z.value:this._def.catchValue({get error(){return new Wr(I.common.issues)},input:I.data})}}removeCatch(){return this._def.innerType}}Ul.create=(y,m)=>new Ul({innerType:y,typeName:ct.ZodCatch,catchValue:typeof m.catch=="function"?m.catch:()=>m.catch,...xt(m)});class Ku extends Tt{_parse(m){if(this._getType(m)!==Ke.nan){const I=this._getOrReturnCtx(m);return qe(I,{code:Oe.invalid_type,expected:Ke.nan,received:I.parsedType}),ht}return{status:"valid",value:m.data}}}Ku.create=y=>new Ku({typeName:ct.ZodNaN,...xt(y)});const ix=Symbol("zod_brand");class Od extends Tt{_parse(m){const{ctx:b}=this._processInputParams(m),I=b.data;return this._def.type._parse({data:I,path:b.path,parent:b})}unwrap(){return this._def.type}}class $l extends Tt{_parse(m){const{status:b,ctx:I}=this._processInputParams(m);if(I.common.async)return(async()=>{const D=await this._def.in._parseAsync({data:I.data,path:I.path,parent:I});return D.status==="aborted"?ht:D.status==="dirty"?(b.dirty(),mo(D.value)):this._def.out._parseAsync({data:D.value,path:I.path,parent:I})})();{const z=this._def.in._parseSync({data:I.data,path:I.path,parent:I});return z.status==="aborted"?ht:z.status==="dirty"?(b.dirty(),{status:"dirty",value:z.value}):this._def.out._parseSync({data:z.value,path:I.path,parent:I})}}static create(m,b){return new $l({in:m,out:b,typeName:ct.ZodPipeline})}}class Gl extends Tt{_parse(m){const b=this._def.innerType._parse(m),I=z=>(_s(z)&&(z.value=Object.freeze(z.value)),z);return kl(b)?b.then(z=>I(z)):I(b)}unwrap(){return this._def.innerType}}Gl.create=(y,m)=>new Gl({innerType:y,typeName:ct.ZodReadonly,...xt(m)});function sm(y,m){const b=typeof y=="function"?y(m):typeof y=="string"?{message:y}:y;return typeof b=="string"?{message:b}:b}function om(y,m={},b){return y?go.create().superRefine((I,z)=>{var D,S;const o=y(I);if(o instanceof Promise)return o.then(le=>{var he,_e;if(!le){const Re=sm(m,I),ve=(_e=(he=Re.fatal)!==null&&he!==void 0?he:b)!==null&&_e!==void 0?_e:!0;z.addIssue({code:"custom",...Re,fatal:ve})}});if(!o){const le=sm(m,I),he=(S=(D=le.fatal)!==null&&D!==void 0?D:b)!==null&&S!==void 0?S:!0;z.addIssue({code:"custom",...le,fatal:he})}}):go.create()}const rx={object:Ii.lazycreate};var ct;(function(y){y.ZodString="ZodString",y.ZodNumber="ZodNumber",y.ZodNaN="ZodNaN",y.ZodBigInt="ZodBigInt",y.ZodBoolean="ZodBoolean",y.ZodDate="ZodDate",y.ZodSymbol="ZodSymbol",y.ZodUndefined="ZodUndefined",y.ZodNull="ZodNull",y.ZodAny="ZodAny",y.ZodUnknown="ZodUnknown",y.ZodNever="ZodNever",y.ZodVoid="ZodVoid",y.ZodArray="ZodArray",y.ZodObject="ZodObject",y.ZodUnion="ZodUnion",y.ZodDiscriminatedUnion="ZodDiscriminatedUnion",y.ZodIntersection="ZodIntersection",y.ZodTuple="ZodTuple",y.ZodRecord="ZodRecord",y.ZodMap="ZodMap",y.ZodSet="ZodSet",y.ZodFunction="ZodFunction",y.ZodLazy="ZodLazy",y.ZodLiteral="ZodLiteral",y.ZodEnum="ZodEnum",y.ZodEffects="ZodEffects",y.ZodNativeEnum="ZodNativeEnum",y.ZodOptional="ZodOptional",y.ZodNullable="ZodNullable",y.ZodDefault="ZodDefault",y.ZodCatch="ZodCatch",y.ZodPromise="ZodPromise",y.ZodBranded="ZodBranded",y.ZodPipeline="ZodPipeline",y.ZodReadonly="ZodReadonly"})(ct||(ct={}));const nx=(y,m={message:`Input not instance of ${y.name}`})=>om(b=>b instanceof y,m),lm=Tn.create,cm=Oa.create,ax=Ku.create,sx=ja.create,um=Rl.create,ox=ys.create,lx=qu.create,cx=Dl.create,ux=Ll.create,hx=go.create,dx=xs.create,px=pa.create,fx=Hu.create,mx=Mn.create,gx=Ii.create,_x=Ii.strictCreate,yx=Bl.create,xx=Wu.create,vx=Fl.create,bx=Gn.create,wx=Ol.create,Tx=Xu.create,Mx=vs.create,Sx=yo.create,Px=jl.create,Cx=Nl.create,Ix=Na.create,Ex=Zl.create,kx=xo.create,hm=Sn.create,zx=qn.create,Ax=Za.create,Rx=Sn.createWithPreprocess,Dx=$l.create;var ot=Object.freeze({__proto__:null,defaultErrorMap:fo,setErrorMap:Ry,getErrorMap:Uu,makeIssue:$u,EMPTY_PATH:Dy,addIssueToContext:qe,ParseStatus:yr,INVALID:ht,DIRTY:mo,OK:kr,isAborted:Dd,isDirty:Ld,isValid:_s,isAsync:kl,get util(){return Ot},get objectUtil(){return Rd},ZodParsedType:Ke,getParsedType:da,ZodType:Tt,datetimeRegex:nm,ZodString:Tn,ZodNumber:Oa,ZodBigInt:ja,ZodBoolean:Rl,ZodDate:ys,ZodSymbol:qu,ZodUndefined:Dl,ZodNull:Ll,ZodAny:go,ZodUnknown:xs,ZodNever:pa,ZodVoid:Hu,ZodArray:Mn,ZodObject:Ii,ZodUnion:Bl,ZodDiscriminatedUnion:Wu,ZodIntersection:Fl,ZodTuple:Gn,ZodRecord:Ol,ZodMap:Xu,ZodSet:vs,ZodFunction:yo,ZodLazy:jl,ZodLiteral:Nl,ZodEnum:Na,ZodNativeEnum:Zl,ZodPromise:xo,ZodEffects:Sn,ZodTransformer:Sn,ZodOptional:qn,ZodNullable:Za,ZodDefault:Vl,ZodCatch:Ul,ZodNaN:Ku,BRAND:ix,ZodBranded:Od,ZodPipeline:$l,ZodReadonly:Gl,custom:om,Schema:Tt,ZodSchema:Tt,late:rx,get ZodFirstPartyTypeKind(){return ct},coerce:{string:y=>Tn.create({...y,coerce:!0}),number:y=>Oa.create({...y,coerce:!0}),boolean:y=>Rl.create({...y,coerce:!0}),bigint:y=>ja.create({...y,coerce:!0}),date:y=>ys.create({...y,coerce:!0})},any:hx,array:mx,bigint:sx,boolean:um,date:ox,discriminatedUnion:xx,effect:hm,enum:Ix,function:Sx,instanceof:nx,intersection:vx,lazy:Px,literal:Cx,map:Tx,nan:ax,nativeEnum:Ex,never:px,null:ux,nullable:Ax,number:cm,object:gx,oboolean:()=>um().optional(),onumber:()=>cm().optional(),optional:zx,ostring:()=>lm().optional(),pipeline:Dx,preprocess:Rx,promise:kx,record:wx,set:Mx,strictObject:_x,string:lm,symbol:lx,transformer:hm,tuple:bx,undefined:cx,union:yx,unknown:dx,void:fx,NEVER:ht,ZodIssueCode:Oe,quotelessJson:Ay,ZodError:Wr});const jd=ot.object({lat:ot.number(),lng:ot.number()}),Lx=ot.object({center:jd,zoom:ot.number()}),dm=ot.object({sw:jd,ne:jd}),Bx=ot.object({name:ot.literal("dark").or(ot.literal("light")),url:ot.string().optional(),colors:ot.object({primary:ot.string().max(64),background:ot.string().max(64),text:ot.string().max(64)})}),Fx=ot.object({apiKey:ot.string().min(1).max(64),container:ot.string(),position:ot.object({center:ot.object({lat:ot.number(),lng:ot.number()}),zoom:ot.number()}),restriction:ot.object({minZoom:ot.number().min(kd).max(Zu).optional(),maxZoom:ot.number().min(kd).max(Zu).optional(),maxBounds:dm.optional()}).optional(),style:Bx});ot.enum(["idle","move","click","popup_click","loading_start","loading_end"]);const Ox=ot.function().returns(ot.void()),jx=ot.function().args(Lx).returns(ot.void()),Nx=ot.function().returns(ot.void()),Zx=ot.function().args(ot.string()).returns(ot.void()),Vx=ot.function().returns(ot.void()),Ux=ot.function().returns(ot.void()),$x={idle:Ox,move:jx,click:Nx,popup_click:Zx,loading_start:Vx,loading_end:Ux},Gx=ot.object({id:ot.string(),rank:ot.number(),lat:ot.number(),lng:ot.number(),width:ot.number(),height:ot.number()}),pm=ot.array(Gx);ot.function().args(dm).returns(ot.promise(pm));const qx=ot.function().args(ot.string()).returns(ot.promise(ot.any()));var Hx=(y,m,b)=>m(Qe(b).marker.id),Wx=uo('<div class="popup svelte-1wr2z1y"></div>'),Xx=uo("<!> <!>",1),Kx=uo('<div class="marker"><!></div>'),Yx=uo('<div class="container svelte-1wr2z1y"><div class="map svelte-1wr2z1y"></div> <div class="logo svelte-1wr2z1y"><a href="https://arenarium.dev" target="_blank" class="svelte-1wr2z1y">@arenarium/maps</a></div> <div class="markers svelte-1wr2z1y"></div></div>');function fm(y,m){var rr,br,Vi,Xr,Kr,Di,nr;Tu(m,!0);let b,I,z,D,S,o=0,le=Ci(!1);qf(()=>{Fx.parse(m.options),he(),_e()});function he(){var Ze,Xe,bt;z=((Ze=m.options.restriction)==null?void 0:Ze.minZoom)??kd,D=((Xe=m.options.restriction)==null?void 0:Xe.maxZoom)??Zu,S=(bt=m.options.restriction)==null?void 0:bt.maxBounds,b=new Ad.Map({style:vr(m.options.style),center:{lat:m.options.position.center.lat,lng:m.options.position.center.lng},zoom:m.options.position.zoom,minZoom:Xt(z),maxZoom:D,maxBounds:S?[S.sw.lng,S.sw.lat,S.ne.lng,S.ne.lat]:void 0,container:I,pitchWithRotate:!1,attributionControl:{compact:!1}})}function _e(){b.on("load",Re),b.on("move",ve),b.on("idle",ne),b.on("click",De),b.dragRotate.disable(),b.keyboard.disable(),b.touchZoomRotate.disableRotation(),b.touchPitch.disable()}function Re(){si(le,!0)}function ve(){const Ze=b.getCenter(),Xe=b.getZoom();Jt("move",{center:Ze,zoom:Xe})}function ne(){Jt("idle",null)}function De(Ze){Jt("click",null)}function _t(Ze){Jt("popup_click",Ze)}const Rt=new Map;function yt(Ze,Xe){var fi;const bt=$x[Ze];if(!bt)throw new Error(`No schema defined for event ${Ze}`);if(!bt.safeParse(Xe).success)throw new Error(`Invalid handler for event ${Ze}`);Rt.has(Ze)||Rt.set(Ze,new Set),(fi=Rt.get(Ze))==null||fi.add(Xe)}function Dt(Ze,Xe){const bt=Rt.get(Ze);bt&&bt.delete(Xe)&&bt.size===0&&Rt.delete(Ze)}function Jt(Ze,Xe){const bt=Rt.get(Ze);bt&&bt.size>0&&[...bt].forEach(Kt=>{try{Kt(Xe)}catch(fi){console.error(fi)}})}function Xt(Ze){const bt=Math.ceil(Math.log2(o/Xf));return Math.max(Ze,bt)}function Et(){const Ze=b.getCenter();return Ze?{lat:Ze.lat,lng:Ze.lng}:{lat:m.options.position.center.lat,lng:m.options.position.center.lng}}function Bt(){return b.getZoom()??m.options.position.zoom}function Ri(){if(!b)throw new Error("Map not loaded!");const Ze=b.getBounds();return{sw:{lat:Ze.getSouthWest().lat,lng:Ze.getSouthWest().lng},ne:{lat:Ze.getNorthEast().lat,lng:Ze.getNorthEast().lng}}}function jt(Ze){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setCenter(Ze)}function xr(Ze){if(!b)throw new Error("Map not loaded! Consider using the position option");b.setZoom(Ze)}function cn(){if(!b)throw new Error("Map not loaded! Consider using the position option");b.zoomIn()}function Vr(){if(!b)throw new Error("Map not loaded! Consider using the position option.");b.zoomOut()}function mt(Ze){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");z=Ze,b.setMinZoom(Xt(Ze))}function _i(Ze){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");D=Ze,b.setMaxZoom(Ze)}function li(Ze){if(!b)throw new Error("Map not loaded! Consider using the restriction option.");S=Ze,b.setMaxBounds([Ze.sw.lng,Ze.sw.lat,Ze.ne.lng,Ze.ne.lat])}let Ni=Ci(ua(m.options.style));lo(()=>{Qe(le)&&b.setStyle(vr(Qe(Ni)),{diff:!0})});function vr(Ze){if(Ze.url)return Ze.url;switch(Ze.name){case"light":return zy;case"dark":return ky}}function un(){return b_(Qe(Ni))}function Ft(Ze){si(Ni,Ze,!0),b.setStyle(vr(Qe(Ni)),{diff:!0})}class zr{constructor(Xe){fs(this,"marker");fs(this,"libreMarker");Cr(this,rr,Ci());Cr(this,br,Ci(!1));Cr(this,Vi,Ci());Cr(this,Xr,Ci());Cr(this,Kr,Ci(!1));Cr(this,Di,Ci());Cr(this,nr,Ci());this.marker=Xe,this.libreMarker=void 0,this.element=void 0,this.rendered=!1,this.content=void 0,this.contentLoading=!1,this.component=void 0,this.circle=void 0}get element(){return Qe(Lt(this,rr))}set element(Xe){si(Lt(this,rr),Xe,!0)}get rendered(){return Qe(Lt(this,br))}set rendered(Xe){si(Lt(this,br),Xe,!0)}get popup(){return Qe(Lt(this,Vi))}set popup(Xe){si(Lt(this,Vi),Xe,!0)}get content(){return Qe(Lt(this,Xr))}set content(Xe){si(Lt(this,Xr),Xe,!0)}get contentLoading(){return Qe(Lt(this,Kr))}set contentLoading(Xe){si(Lt(this,Kr),Xe,!0)}get component(){return Qe(Lt(this,Di))}set component(Xe){si(Lt(this,Di),Xe,!0)}get circle(){return Qe(Lt(this,nr))}set circle(Xe){si(Lt(this,nr),Xe,!0)}getAngle(Xe){let bt=this.marker.angs,Kt=bt[0],fi=0;for(;Kt[0]<Xe&&(fi++,fi!=bt.length);)Kt=bt[fi];return Kt[1]}getDistance(Xe){return(this.marker.zet-Xe)/Kf}updateZIndex(){var Kt;const Xe=(Kt=this.libreMarker)==null?void 0:Kt.getElement();if(!Xe)throw new Error("Failed to update zIndex");const bt=Math.round((Zu-this.marker.zet)*_y);Xe.style.zIndex=bt.toString()}}rr=new WeakMap,br=new WeakMap,Vi=new WeakMap,Xr=new WeakMap,Kr=new WeakMap,Di=new WeakMap,nr=new WeakMap;let Ar,Hn,yi=ua(new Array),Pn=ua(new Map),ir=new Array,Ti;qf(()=>{const Ze=()=>{hn(),Ar=window.setTimeout(Ze,25)};return Ze(),()=>{clearInterval(Ar),clearInterval(Hn)}});function hn(){if(Qe(le)==!1||yi.length==0||Ti==null)return;const Ze=b.getZoom();if(!Ze)return;const Xe=new Array,bt=Xf,Kt=new Jf(b,-512,window.innerHeight+bt,window.innerWidth+bt,-512),fi=new Jf(b,0,window.innerHeight,window.innerWidth,0);for(let kt=0;kt<yi.length;kt++){const ut=yi[kt],Gt=ut.marker,qt=ut.libreMarker;if(qt){if(Gt.zet<=Ze&&Kt.contains(Gt.lat,Gt.lng)){qt._map!=b&&qt.addTo(b),Xe.push(ut);continue}if(Gt.zet<=Ze+Kf&&fi.contains(Gt.lat,Gt.lng)){qt._map!=b&&qt.addTo(b),Xe.push(ut);continue}qt._map!=null&&qt.remove()}}for(let kt=0;kt<Xe.length;kt++){const ut=Xe[kt],Gt=ut.marker;ut.rendered||(ut.rendered=!0);const qt=ut.component,Li=ut.circle;if(!Li||!qt)continue;Gt.zet<=Ze+yy?qt.setDisplayed(!0):qt.setDisplayed(!1),Gt.zet<=Ze?(Li.setCollapsed(!0),qt.setCollapsed(!1),qt.setAngle(ut.getAngle(Ze))):(qt.setCollapsed(!0),Li==null||Li.setCollapsed(!1),Li==null||Li.setDistance(ut.getDistance(Ze)));const Yt=ut.popup;if(!Yt)continue;ut.content==null&&ut.contentLoading==!1&&(ut.contentLoading=!0,Ti(Gt.id).then(ue=>{ut.content=ue,ut.contentLoading=!1}));const Mi=ut.content;if(!Mi)continue;Yt.firstElementChild==null&&Yt.appendChild(Mi)}}async function hr(Ze){var fi;const Xe=new Map(Ze.map(kt=>[kt.id,new zr(kt)])),bt=new Array,Kt=Array.from(yi);for(const kt of Kt)Xe.has(kt.marker.id)==!1&&((fi=kt.libreMarker)==null||fi.remove(),Pn.delete(kt.marker.id),yi.splice(yi.indexOf(kt),1));for(const kt of Ze){const ut=Pn.get(kt.id);if(ut)ut.marker=kt,ut.updateZIndex();else{const Gt=new zr(kt);Pn.set(kt.id,Gt),yi.push(Gt),bt.push(Gt)}}await U_();for(const kt of bt){const ut=kt.marker,Gt=kt.element;if(!Gt)throw new Error("Failed to render marker element.");const qt=new Ad.Marker({element:Gt});qt.setLngLat([ut.lng,ut.lat]),kt.libreMarker=qt,kt.updateZIndex()}}function Wn(){var Ze;for(let Xe=0;Xe<yi.length;Xe++)(Ze=yi[Xe].libreMarker)==null||Ze.remove();yi.length=0,Pn.clear()}function Cn(Ze){if(!qx.safeParse(Ze).success)throw new Error("Invalid popup content callback");Ti=Ze}async function ga(Ze){if(Ti==null)throw new Error("Popup content callback not set");if(!(await pm.safeParseAsync(Ze)).success)throw new Error("Invalid popups");try{Jt("loading_start",null);for(const bt of Ze){const Kt=ir.findIndex(fi=>fi.id==bt.id);Kt==-1?ir.push(bt):ir[Kt]=bt}await hr(await My({apiKey:m.options.apiKey,popups:ir,minZoom:z,maxZoom:D}))}finally{Jt("loading_end",null)}}function dr(){Wn()}var Ki=Yx();X_("resize",_d,()=>b.setMinZoom(Xt(z)));var Zi=Ml(Ki);Fa(Zi,Ze=>I=Ze,()=>I);var Wt=yd(Zi,4);return ry(Wt,21,()=>yi,Ze=>Ze.marker.id,(Ze,Xe,bt)=>{var Kt=Kx(),fi=Ml(Kt);{var kt=ut=>{var Gt=Xx(),qt=I_(Gt);Fa(Ty(qt,{}),(Yt,Mi)=>Mi.circle=Yt,Yt=>Yt==null?void 0:Yt.circle,()=>[Qe(Xe)]);var Li=yd(qt,2);Fa(by(Li,{children:(Yt,Mi)=>{var pr=Wx();pr.__click=[Hx,_t,Xe],Fa(pr,(ue,N)=>N.popup=ue,ue=>ue==null?void 0:ue.popup,()=>[Qe(Xe)]),Eu(()=>Nu(pr,`width: ${Qe(Xe).marker.width??""}px; height: ${Qe(Xe).marker.height??""}px;`)),ho(Yt,pr)},$$slots:{default:!0}}),(Yt,Mi)=>Mi.component=Yt,Yt=>Yt==null?void 0:Yt.component,()=>[Qe(Xe)]),ho(ut,Gt)};ty(fi,ut=>{Qe(Xe).rendered&&ut(kt)})}Fa(Kt,(ut,Gt)=>Gt.element=ut,ut=>ut==null?void 0:ut.element,()=>[Qe(Xe)]),ho(Ze,Kt)}),Eu(()=>Nu(Ki,`--primary: ${Qe(Ni).colors.primary??""}; --background: ${Qe(Ni).colors.background??""}; --text: ${Qe(Ni).colors.text??""};`)),ho(y,Ki),Mu({on:yt,off:Dt,emit:Jt,getCenter:Et,getZoom:Bt,getBounds:Ri,setCenter:jt,setZoom:xr,zoomIn:cn,zoomOut:Vr,setMinZoom:mt,setMaxZoom:_i,setMaxBounds:li,getStyle:un,setStyle:Ft,updatePopupContentCallback:Cn,updatePopups:ga,removePopups:dr})}K_(["click"]);function Jx(y){const m=document.getElementById(y.container);if(!m)throw new Error(`Container not found: ${y.container}`);return J_(fm,{target:m,props:{options:y}})}function Qx(y){ey(y)}$t.Map=fm,$t.mountMap=Jx,$t.unmountMap=Qx,Object.defineProperty($t,Symbol.toStringTag,{value:"Module"})});