@arenarium/maps 1.0.123 → 1.0.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +74 -16
- package/dist/index.js +2 -750
- package/dist/style.css +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,750 +1,2 @@
|
|
|
1
|
-
(function(Et,Gt){typeof exports=="object"&&typeof module<"u"?Gt(exports):typeof define=="function"&&define.amd?define(["exports"],Gt):(Et=typeof globalThis<"u"?globalThis:Et||self,Gt(Et.arenarium={}))})(this,function(Et){"use strict";var Sv=Object.defineProperty;var Cg=Et=>{throw TypeError(Et)};var Pv=(Et,Gt,vi)=>Gt in Et?Sv(Et,Gt,{enumerable:!0,configurable:!0,writable:!0,value:vi}):Et[Gt]=vi;var lt=(Et,Gt,vi)=>Pv(Et,typeof Gt!="symbol"?Gt+"":Gt,vi),Mp=(Et,Gt,vi)=>Gt.has(Et)||Cg("Cannot "+vi);var gi=(Et,Gt,vi)=>(Mp(Et,Gt,"read from private field"),vi?vi.call(Et):Gt.get(Et)),va=(Et,Gt,vi)=>Gt.has(Et)?Cg("Cannot add the same private member more than once"):Gt instanceof WeakSet?Gt.add(Et):Gt.set(Et,vi),Gc=(Et,Gt,vi,qc)=>(Mp(Et,Gt,"write to private field"),qc?qc.call(Et,vi):Gt.set(Et,vi),vi),Ig=(Et,Gt,vi)=>(Mp(Et,Gt,"access private method"),vi);var za,So,kl,mu,Eg,Nf,Qn,Po,Rl,ms;var vi=Array.isArray,qc=Array.prototype.indexOf,zg=Array.from,kg=Object.defineProperty,Tl=Object.getOwnPropertyDescriptor,Rg=Object.prototype,Dg=Array.prototype,Lg=Object.getPrototypeOf,Cp=Object.isExtensible;function Fg(w){for(var g=0;g<w.length;g++)w[g]()}const un=2,Ip=4,Wc=8,Ih=16,ba=32,co=64,Eh=128,Ar=256,Hc=512,Wr=1024,wa=2048,ds=4096,Xc=8192,Ah=16384,Ep=32768,Bg=65536,Og=1<<19,Ap=1<<20,zh=1<<21,Yc=Symbol("$state");function zp(w){return w===this.v}function jg(w){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ng(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function Vg(w){throw new Error("https://svelte.dev/e/effect_orphan")}function Zg(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Ug(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function $g(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Gg(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let Mv=!1;const qg=2,zr=Symbol();let Hr=null;function kp(w){Hr=w}function Kc(w,g=!1,v){var I=Hr={p:Hr,c:null,d:!1,e:null,m:!1,s:w,x:null,l:null};Up(()=>{I.d=!0})}function Jc(w){const g=Hr;if(g!==null){w!==void 0&&(g.x=w);const P=g.e;if(P!==null){var v=ti,I=qt;g.e=null;try{for(var z=0;z<P.length;z++){var B=P[z];Ta(B.effect),An(B.reaction),Qc(B.fn)}}finally{Ta(v),An(I)}}Hr=g.p,g.m=!0}return w||{}}function Rp(){return!0}function uo(w){if(typeof w!="object"||w===null||Yc in w)return w;const g=Lg(w);if(g!==Rg&&g!==Dg)return w;var v=new Map,I=vi(w),z=kr(0),B=qt,P=o=>{var ye=qt;An(B);var be=o();return An(ye),be};return I&&v.set("length",kr(w.length)),new Proxy(w,{defineProperty(o,ye,be){(!("value"in be)||be.configurable===!1||be.enumerable===!1||be.writable===!1)&&Ug();var Re=v.get(ye);return Re===void 0?(Re=P(()=>kr(be.value)),v.set(ye,Re)):Gi(Re,P(()=>uo(be.value))),!0},deleteProperty(o,ye){var be=v.get(ye);if(be===void 0)ye in o&&(v.set(ye,P(()=>kr(zr))),kh(z));else{if(I&&typeof ye=="string"){var Re=v.get("length"),Ve=Number(ye);Number.isInteger(Ve)&&Ve<Re.v&&Gi(Re,Ve)}Gi(be,zr),kh(z)}return!0},get(o,ye,be){var ce;if(ye===Yc)return w;var Re=v.get(ye),Ve=ye in o;if(Re===void 0&&(!Ve||(ce=Tl(o,ye))!=null&&ce.writable)&&(Re=P(()=>kr(uo(Ve?o[ye]:zr))),v.set(ye,Re)),Re!==void 0){var Ae=oi(Re);return Ae===zr?void 0:Ae}return Reflect.get(o,ye,be)},getOwnPropertyDescriptor(o,ye){var be=Reflect.getOwnPropertyDescriptor(o,ye);if(be&&"value"in be){var Re=v.get(ye);Re&&(be.value=oi(Re))}else if(be===void 0){var Ve=v.get(ye),Ae=Ve==null?void 0:Ve.v;if(Ve!==void 0&&Ae!==zr)return{enumerable:!0,configurable:!0,value:Ae,writable:!0}}return be},has(o,ye){var Ae;if(ye===Yc)return!0;var be=v.get(ye),Re=be!==void 0&&be.v!==zr||Reflect.has(o,ye);if(be!==void 0||ti!==null&&(!Re||(Ae=Tl(o,ye))!=null&&Ae.writable)){be===void 0&&(be=P(()=>kr(Re?uo(o[ye]):zr)),v.set(ye,be));var Ve=oi(be);if(Ve===zr)return!1}return Re},set(o,ye,be,Re){var Dt;var Ve=v.get(ye),Ae=ye in o;if(I&&ye==="length")for(var ce=be;ce<Ve.v;ce+=1){var Be=v.get(ce+"");Be!==void 0?Gi(Be,zr):ce in o&&(Be=P(()=>kr(zr)),v.set(ce+"",Be))}Ve===void 0?(!Ae||(Dt=Tl(o,ye))!=null&&Dt.writable)&&(Ve=P(()=>kr(void 0)),Gi(Ve,P(()=>uo(be))),v.set(ye,Ve)):(Ae=Ve.v!==zr,Gi(Ve,P(()=>uo(be))));var Rt=Reflect.getOwnPropertyDescriptor(o,ye);if(Rt!=null&&Rt.set&&Rt.set.call(Re,be),!Ae){if(I&&typeof ye=="string"){var ft=v.get("length"),di=Number(ye);Number.isInteger(di)&&di>=ft.v&&Gi(ft,di+1)}kh(z)}return!0},ownKeys(o){oi(z);var ye=Reflect.ownKeys(o).filter(Ve=>{var Ae=v.get(Ve);return Ae===void 0||Ae.v!==zr});for(var[be,Re]of v)Re.v!==zr&&!(be in o)&&ye.push(be);return ye},setPrototypeOf(){$g()}})}function kh(w,g=1){Gi(w,w.v+g)}function Wg(w){var g=un|wa,v=qt!==null&&(qt.f&un)!==0?qt:null;return ti===null||v!==null&&(v.f&Ar)!==0?g|=Ar:ti.f|=Ap,{ctx:Hr,deps:null,effects:null,equals:zp,f:g,fn:w,reactions:null,rv:0,v:null,wv:0,parent:v??ti}}function Dp(w){var g=w.effects;if(g!==null){w.effects=null;for(var v=0;v<g.length;v+=1)ps(g[v])}}function Hg(w){for(var g=w.parent;g!==null;){if((g.f&un)===0)return g;g=g.parent}return null}function Lp(w){var g,v=ti;Ta(Hg(w));try{Dp(w),g=rf(w)}finally{Ta(v)}return g}function Fp(w){var g=Lp(w);if(w.equals(g)||(w.v=g,w.wv=ef()),!po){var v=(Sa||(w.f&Ar)!==0)&&w.deps!==null?ds:Wr;zn(w,v)}}const Sl=new Map;function Rh(w,g){var v={f:0,v:w,reactions:null,equals:zp,rv:0,wv:0};return v}function kr(w,g){const v=Rh(w);return u_(v),v}function Gi(w,g,v=!1){qt!==null&&!En&&Rp()&&(qt.f&(un|Ih))!==0&&!(cr!=null&&cr.includes(w))&&Gg();let I=v?uo(g):g;return Xg(w,I)}function Xg(w,g){if(!w.equals(g)){var v=w.v;po?Sl.set(w,g):Sl.set(w,v),w.v=g,(w.f&un)!==0&&((w.f&wa)!==0&&Lp(w),zn(w,(w.f&Ar)===0?Wr:ds)),w.wv=ef(),Bp(w,wa),ti!==null&&(ti.f&Wr)!==0&&(ti.f&(ba|co))===0&&(Xr===null?h_([w]):Xr.push(w))}return g}function Bp(w,g){var v=w.reactions;if(v!==null)for(var I=v.length,z=0;z<I;z++){var B=v[z],P=B.f;(P&wa)===0&&(zn(B,g),(P&(Wr|Ar))!==0&&((P&un)!==0?Bp(B,ds):Oh(B)))}}var Dh,Op,jp,Np;function Yg(){if(Dh===void 0){Dh=window,Op=/Firefox/.test(navigator.userAgent);var w=Element.prototype,g=Node.prototype,v=Text.prototype;jp=Tl(g,"firstChild").get,Np=Tl(g,"nextSibling").get,Cp(w)&&(w.__click=void 0,w.__className=void 0,w.__attributes=null,w.__style=void 0,w.__e=void 0),Cp(v)&&(v.__t=void 0)}}function Kg(w=""){return document.createTextNode(w)}function Vp(w){return jp.call(w)}function Zp(w){return Np.call(w)}function Lh(w,g){return Vp(w)}function Jg(w,g=1,v=!1){let I=w;for(;g--;)I=Zp(I);return I}function Qg(w){ti===null&&qt===null&&Vg(),qt!==null&&(qt.f&Ar)!==0&&ti===null&&Ng(),po&&jg()}function e_(w,g){var v=g.last;v===null?g.last=g.first=w:(v.next=w,w.prev=v,g.last=w)}function ho(w,g,v,I=!0){var z=ti,B={ctx:Hr,deps:null,nodes_start:null,nodes_end:null,f:w|wa,first:null,fn:g,last:null,next:null,parent:z,prev:null,teardown:null,transitions:null,wv:0};if(v)try{Bh(B),B.f|=Ep}catch(ye){throw ps(B),ye}else g!==null&&Oh(B);var P=v&&B.deps===null&&B.first===null&&B.nodes_start===null&&B.teardown===null&&(B.f&(Ap|Eh))===0;if(!P&&I&&(z!==null&&e_(B,z),qt!==null&&(qt.f&un)!==0)){var o=qt;(o.effects??(o.effects=[])).push(B)}return B}function Up(w){const g=ho(Wc,null,!1);return zn(g,Wr),g.teardown=w,g}function Yn(w){Qg();var g=ti!==null&&(ti.f&ba)!==0&&Hr!==null&&!Hr.m;if(g){var v=Hr;(v.e??(v.e=[])).push({fn:w,effect:ti,reaction:qt})}else{var I=Qc(w);return I}}function t_(w){const g=ho(co,w,!0);return(v={})=>new Promise(I=>{v.outro?s_(g,()=>{ps(g),I(void 0)}):(ps(g),I(void 0))})}function Qc(w){return ho(Ip,w,!1)}function $p(w){return ho(Wc,w,!0)}function Gp(w,g=[],v=Wg){const I=g.map(v);return i_(()=>w(...I.map(oi)))}function i_(w,g=0){return ho(Wc|Ih|g,w,!0)}function r_(w,g=!0){return ho(Wc|ba,w,!0,g)}function qp(w){var g=w.teardown;if(g!==null){const v=po,I=qt;Jp(!0),An(null);try{g.call(null)}finally{Jp(v),An(I)}}}function Wp(w,g=!1){var v=w.first;for(w.first=w.last=null;v!==null;){var I=v.next;(v.f&co)!==0?v.parent=null:ps(v,g),v=I}}function n_(w){for(var g=w.first;g!==null;){var v=g.next;(g.f&ba)===0&&ps(g),g=v}}function ps(w,g=!0){var v=!1;(g||(w.f&Og)!==0)&&w.nodes_start!==null&&w.nodes_end!==null&&(a_(w.nodes_start,w.nodes_end),v=!0),Wp(w,g&&!v),au(w,0),zn(w,Ah);var I=w.transitions;if(I!==null)for(const B of I)B.stop();qp(w);var z=w.parent;z!==null&&z.first!==null&&Hp(w),w.next=w.prev=w.teardown=w.ctx=w.deps=w.fn=w.nodes_start=w.nodes_end=null}function a_(w,g){for(;w!==null;){var v=w===g?null:Zp(w);w.remove(),w=v}}function Hp(w){var g=w.parent,v=w.prev,I=w.next;v!==null&&(v.next=I),I!==null&&(I.prev=v),g!==null&&(g.first===w&&(g.first=I),g.last===w&&(g.last=v))}function s_(w,g){var v=[];Xp(w,v,!0),o_(v,()=>{ps(w),g&&g()})}function o_(w,g){var v=w.length;if(v>0){var I=()=>--v||g();for(var z of w)z.out(I)}else g()}function Xp(w,g,v){if((w.f&Xc)===0){if(w.f^=Xc,w.transitions!==null)for(const P of w.transitions)(P.is_global||v)&&g.push(P);for(var I=w.first;I!==null;){var z=I.next,B=(I.f&Bg)!==0||(I.f&ba)!==0;Xp(I,g,B?v:!1),I=z}}}let eu=[];function l_(){var w=eu;eu=[],Fg(w)}function Yp(w){eu.length===0&&queueMicrotask(l_),eu.push(w)}function c_(w){var g=ti;if((g.f&Ep)===0){if((g.f&Eh)===0)throw w;g.fn(w)}else Kp(w,g)}function Kp(w,g){for(;g!==null;){if((g.f&Eh)!==0)try{g.fn(w);return}catch{}g=g.parent}throw w}let Fh=!1,tu=null,fs=!1,po=!1;function Jp(w){po=w}let iu=[],Cv=[],qt=null,En=!1;function An(w){qt=w}let ti=null;function Ta(w){ti=w}let cr=null;function u_(w){qt!==null&&qt.f&zh&&(cr===null?cr=[w]:cr.push(w))}let ur=null,Rr=0,Xr=null;function h_(w){Xr=w}let Qp=1,ru=0,Sa=!1;function ef(){return++Qp}function nu(w){var Ve;var g=w.f;if((g&wa)!==0)return!0;if((g&ds)!==0){var v=w.deps,I=(g&Ar)!==0;if(v!==null){var z,B,P=(g&Hc)!==0,o=I&&ti!==null&&!Sa,ye=v.length;if(P||o){var be=w,Re=be.parent;for(z=0;z<ye;z++)B=v[z],(P||!((Ve=B==null?void 0:B.reactions)!=null&&Ve.includes(be)))&&(B.reactions??(B.reactions=[])).push(be);P&&(be.f^=Hc),o&&Re!==null&&(Re.f&Ar)===0&&(be.f^=Ar)}for(z=0;z<ye;z++)if(B=v[z],nu(B)&&Fp(B),B.wv>w.wv)return!0}(!I||ti!==null&&!Sa)&&zn(w,Wr)}return!1}function tf(w,g,v=!0){var I=w.reactions;if(I!==null)for(var z=0;z<I.length;z++){var B=I[z];cr!=null&&cr.includes(w)||((B.f&un)!==0?tf(B,g,!1):g===B&&(v?zn(B,wa):(B.f&Wr)!==0&&zn(B,ds),Oh(B)))}}function rf(w){var ce;var g=ur,v=Rr,I=Xr,z=qt,B=Sa,P=cr,o=Hr,ye=En,be=w.f;ur=null,Rr=0,Xr=null,Sa=(be&Ar)!==0&&(En||!fs||qt===null),qt=(be&(ba|co))===0?w:null,cr=null,kp(w.ctx),En=!1,ru++,w.f|=zh;try{var Re=(0,w.fn)(),Ve=w.deps;if(ur!==null){var Ae;if(au(w,Rr),Ve!==null&&Rr>0)for(Ve.length=Rr+ur.length,Ae=0;Ae<ur.length;Ae++)Ve[Rr+Ae]=ur[Ae];else w.deps=Ve=ur;if(!Sa)for(Ae=Rr;Ae<Ve.length;Ae++)((ce=Ve[Ae]).reactions??(ce.reactions=[])).push(w)}else Ve!==null&&Rr<Ve.length&&(au(w,Rr),Ve.length=Rr);if(Rp()&&Xr!==null&&!En&&Ve!==null&&(w.f&(un|ds|wa))===0)for(Ae=0;Ae<Xr.length;Ae++)tf(Xr[Ae],w);return z!==null&&z!==w&&(ru++,Xr!==null&&(I===null?I=Xr:I.push(...Xr))),Re}catch(Be){c_(Be)}finally{ur=g,Rr=v,Xr=I,qt=z,Sa=B,cr=P,kp(o),En=ye,w.f^=zh}}function d_(w,g){let v=g.reactions;if(v!==null){var I=qc.call(v,w);if(I!==-1){var z=v.length-1;z===0?v=g.reactions=null:(v[I]=v[z],v.pop())}}v===null&&(g.f&un)!==0&&(ur===null||!ur.includes(g))&&(zn(g,ds),(g.f&(Ar|Hc))===0&&(g.f^=Hc),Dp(g),au(g,0))}function au(w,g){var v=w.deps;if(v!==null)for(var I=g;I<v.length;I++)d_(w,v[I])}function Bh(w){var g=w.f;if((g&Ah)===0){zn(w,Wr);var v=ti,I=fs;ti=w,fs=!0;try{(g&Ih)!==0?n_(w):Wp(w),qp(w);var z=rf(w);w.teardown=typeof z=="function"?z:null,w.wv=Qp;var B=w.deps,P}finally{fs=I,ti=v}}}function p_(){try{Zg()}catch(w){if(tu!==null)Kp(w,tu);else throw w}}function f_(){var w=fs;try{var g=0;for(fs=!0;iu.length>0;){g++>1e3&&p_();var v=iu,I=v.length;iu=[];for(var z=0;z<I;z++){var B=g_(v[z]);m_(B)}Sl.clear()}}finally{Fh=!1,fs=w,tu=null}}function m_(w){var g=w.length;if(g!==0)for(var v=0;v<g;v++){var I=w[v];(I.f&(Ah|Xc))===0&&nu(I)&&(Bh(I),I.deps===null&&I.first===null&&I.nodes_start===null&&(I.teardown===null?Hp(I):I.fn=null))}}function Oh(w){Fh||(Fh=!0,queueMicrotask(f_));for(var g=tu=w;g.parent!==null;){g=g.parent;var v=g.f;if((v&(co|ba))!==0){if((v&Wr)===0)return;g.f^=Wr}}iu.push(g)}function g_(w){for(var g=[],v=w;v!==null;){var I=v.f,z=(I&(ba|co))!==0,B=z&&(I&Wr)!==0;if(!B&&(I&Xc)===0){(I&Ip)!==0?g.push(v):z?v.f^=Wr:nu(v)&&Bh(v);var P=v.first;if(P!==null){v=P;continue}}var o=v.parent;for(v=v.next;v===null&&o!==null;)v=o.next,o=o.parent}return g}function oi(w){var g=w.f,v=(g&un)!==0;if(qt!==null&&!En){if(!(cr!=null&&cr.includes(w))){var I=qt.deps;w.rv<ru&&(w.rv=ru,ur===null&&I!==null&&I[Rr]===w?Rr++:ur===null?ur=[w]:(!Sa||!ur.includes(w))&&ur.push(w))}}else if(v&&w.deps===null&&w.effects===null){var z=w,B=z.parent;B!==null&&(B.f&Ar)===0&&(z.f^=Ar)}return v&&(z=w,nu(z)&&Fp(z)),po&&Sl.has(w)?Sl.get(w):w.v}function nf(w){var g=En;try{return En=!0,w()}finally{En=g}}const __=-7169;function zn(w,g){w.f=w.f&__|g}const y_=["touchstart","touchmove"];function x_(w){return y_.includes(w)}function v_(w){var g=qt,v=ti;An(null),Ta(null);try{return w()}finally{An(g),Ta(v)}}const b_=new Set,af=new Set;function w_(w,g,v,I={}){function z(B){if(I.capture||Pl.call(g,B),!B.cancelBubble)return v_(()=>v==null?void 0:v.call(this,B))}return w.startsWith("pointer")||w.startsWith("touch")||w==="wheel"?Yp(()=>{g.addEventListener(w,z,I)}):g.addEventListener(w,z,I),z}function T_(w,g,v,I,z){var B={capture:I,passive:z},P=w_(w,g,v,B);(g===document.body||g===window||g===document||g instanceof HTMLMediaElement)&&Up(()=>{g.removeEventListener(w,P,B)})}function Pl(w){var Dt;var g=this,v=g.ownerDocument,I=w.type,z=((Dt=w.composedPath)==null?void 0:Dt.call(w))||[],B=z[0]||w.target,P=0,o=w.__root;if(o){var ye=z.indexOf(o);if(ye!==-1&&(g===document||g===window)){w.__root=g;return}var be=z.indexOf(g);if(be===-1)return;ye<=be&&(P=ye)}if(B=z[P]||w.target,B!==g){kg(w,"currentTarget",{configurable:!0,get(){return B||v}});var Re=qt,Ve=ti;An(null),Ta(null);try{for(var Ae,ce=[];B!==null;){var Be=B.assignedSlot||B.parentNode||B.host||null;try{var Rt=B["__"+I];if(Rt!=null&&(!B.disabled||w.target===B))if(vi(Rt)){var[ft,...di]=Rt;ft.apply(B,[w,...di])}else Rt.call(B,w)}catch(Lt){Ae?ce.push(Lt):Ae=Lt}if(w.cancelBubble||Be===g||Be===null)break;B=Be}if(Ae){for(let Lt of ce)queueMicrotask(()=>{throw Lt});throw Ae}}finally{w.__root=g,delete w.currentTarget,An(Re),Ta(Ve)}}}function S_(w){var g=document.createElement("template");return g.innerHTML=w.replaceAll("<!>","<!---->"),g.content}function P_(w,g){var v=ti;v.nodes_start===null&&(v.nodes_start=w,v.nodes_end=g)}function jh(w,g){var v=(g&qg)!==0,I,z=!w.startsWith("<!>");return()=>{I===void 0&&(I=S_(z?w:"<!>"+w),I=Vp(I));var B=v||Op?document.importNode(I,!0):I.cloneNode(!0);return P_(B,B),B}}function Nh(w,g){w!==null&&w.before(g)}function Vh(w,g){return M_(w,g)}const fo=new Map;function M_(w,{target:g,anchor:v,props:I={},events:z,context:B,intro:P=!0}){Yg();var o=new Set,ye=Ve=>{for(var Ae=0;Ae<Ve.length;Ae++){var ce=Ve[Ae];if(!o.has(ce)){o.add(ce);var Be=x_(ce);g.addEventListener(ce,Pl,{passive:Be});var Rt=fo.get(ce);Rt===void 0?(document.addEventListener(ce,Pl,{passive:Be}),fo.set(ce,1)):fo.set(ce,Rt+1)}}};ye(zg(b_)),af.add(ye);var be=void 0,Re=t_(()=>{var Ve=v??g.appendChild(Kg());return r_(()=>{if(B){Kc({});var Ae=Hr;Ae.c=B}z&&(I.$$events=z),be=w(Ve,I)||{},B&&Jc()}),()=>{var Be;for(var Ae of o){g.removeEventListener(Ae,Pl);var ce=fo.get(Ae);--ce===0?(document.removeEventListener(Ae,Pl),fo.delete(Ae)):fo.set(Ae,ce)}af.delete(ye),Ve!==v&&((Be=Ve.parentNode)==null||Be.removeChild(Ve))}});return Zh.set(be,Re),be}let Zh=new WeakMap;function C_(w,g){const v=Zh.get(w);return v?(Zh.delete(w),v(g)):Promise.resolve()}const sf=[...`
|
|
2
|
-
\r\f \v\uFEFF`];function I_(w,g,v){var I=w==null?"":""+w;if(v){for(var z in v)if(v[z])I=I?I+" "+z:z;else if(I.length)for(var B=z.length,P=0;(P=I.indexOf(z,P))>=0;){var o=P+B;(P===0||sf.includes(I[P-1]))&&(o===I.length||sf.includes(I[o]))?I=(P===0?"":I.substring(0,P))+I.substring(o+1):P=o}}return I===""?null:I}function of(w,g=!1){var v=g?" !important;":";",I="";for(var z in w){var B=w[z];B!=null&&B!==""&&(I+=" "+z+": "+B+v)}return I}function E_(w,g){if(g){var v="",I,z;return Array.isArray(g)?(I=g[0],z=g[1]):I=g,I&&(v+=of(I)),z&&(v+=of(z,!0)),v=v.trim(),v===""?null:v}return String(w)}function lf(w,g,v,I,z,B){var P=w.__className;if(P!==v||P===void 0){var o=I_(v,I,B);o==null?w.removeAttribute("class"):w.className=o,w.__className=v}else if(B&&z!==B)for(var ye in B){var be=!!B[ye];(z==null||be!==!!z[ye])&&w.classList.toggle(ye,be)}return B}function Uh(w,g={},v,I){for(var z in v){var B=v[z];g[z]!==B&&(v[z]==null?w.style.removeProperty(z):w.style.setProperty(z,B,I))}}function cf(w,g,v,I){var z=w.__style;if(z!==g){var B=E_(g,I);B==null?w.removeAttribute("style"):w.style.cssText=B,w.__style=g}else I&&(Array.isArray(I)?(Uh(w,v==null?void 0:v[0],I[0]),Uh(w,v==null?void 0:v[1],I[1],"important")):Uh(w,v,I));return I}const A_=()=>performance.now(),kn={tick:w=>requestAnimationFrame(w),now:()=>A_(),tasks:new Set};function uf(){const w=kn.now();kn.tasks.forEach(g=>{g.c(w)||(kn.tasks.delete(g),g.f())}),kn.tasks.size!==0&&kn.tick(uf)}function z_(w){let g;return kn.tasks.size===0&&kn.tick(uf),{promise:new Promise(v=>{kn.tasks.add(g={c:w,f:v})}),abort(){kn.tasks.delete(g)}}}const gu=class gu{constructor(g){va(this,mu);va(this,za,new WeakMap);va(this,So);va(this,kl);Gc(this,kl,g)}observe(g,v){var I=gi(this,za).get(g)||new Set;return I.add(v),gi(this,za).set(g,I),Ig(this,mu,Eg).call(this).observe(g,gi(this,kl)),()=>{var z=gi(this,za).get(g);z.delete(v),z.size===0&&(gi(this,za).delete(g),gi(this,So).unobserve(g))}}};za=new WeakMap,So=new WeakMap,kl=new WeakMap,mu=new WeakSet,Eg=function(){return gi(this,So)??Gc(this,So,new ResizeObserver(g=>{for(var v of g){gu.entries.set(v.target,v);for(var I of gi(this,za).get(v.target)||[])I(v)}}))},lt(gu,"entries",new WeakMap);let $h=gu;var k_=new $h({box:"border-box"});function R_(w,g,v){var I=k_.observe(w,()=>v(w[g]));Qc(()=>(nf(()=>v(w[g])),I))}function hf(w,g){return w===g||(w==null?void 0:w[Yc])===g}function mo(w={},g,v,I){return Qc(()=>{var z,B;return $p(()=>{z=B,B=[],nf(()=>{w!==v(...B)&&(g(w,...B),z&&hf(v(...z),w)&&g(null,...z))})}),()=>{Yp(()=>{B&&hf(v(...B),w)&&g(null,...B)})}}),w}const D_="5";typeof window<"u"&&((Nf=window.__svelte??(window.__svelte={})).v??(Nf.v=new Set)).add(D_);function L_(w){return w}function Gh(w){return-.5*(Math.cos(Math.PI*w)-1)}function F_(w){const g=Math.cos(w*Math.PI*.5);return Math.abs(g)<1e-14?1:1-g}function B_(w){return Math.sin(w*Math.PI/2)}const O_=128,j_=0,qh=1,N_=2;class V_{constructor(){lt(this,"animationsStarted",!1);lt(this,"animationsCount",0);lt(this,"animationsLimit",O_);lt(this,"layers",new Array)}start(){window.requestAnimationFrame(this.tick.bind(this))}tick(){try{this.animationsCount=0;for(let g=0;g<this.layers.length;g++){const v=this.layers[g];if(v==null)continue;const I=v.animations;if(I!=null)for(let z=0;z<I.length;z++){const B=I[z];if(B!=null){for(const P of B.values())if(!P.executed&&(P.executed=!0,P.function(),this.animationsCount++,this.animationsCount==this.animationsLimit))return}}}}finally{window.requestAnimationFrame(this.tick.bind(this))}}equeue(g,v,I,z){let B=this.layers[g];B==null&&(B=this.layers[g]={animations:new Array});let P=B.animations[v];P==null&&(P=B.animations[v]=new Map);let o={id:I,priority:v,executed:!1,function:z};P.set(I,o),this.animationsStarted==!1&&(this.animationsStarted=!0,this.start())}clear(g,v){for(let I=0;I<this.layers.length;I++){let z=this.layers[I];if(z==null)continue;let B=z.animations[g];if(B==null)return;let P=B.get(v);if(P==null||P.executed==!1)return;B.delete(v)}}speed(){return Math.pow(2,2*this.animationsCount/this.animationsLimit)}stacked(){return this.animationsCount==this.animationsLimit}setLimit(g){this.animationsLimit=g}}const Kn=new V_;function df(w){return Object.prototype.toString.call(w)==="[object Date]"}function Wh(w,g){if(w===g||w!==w)return()=>w;const v=typeof w;if(v!==typeof g||Array.isArray(w)!==Array.isArray(g))throw new Error("Cannot interpolate values of different type");if(Array.isArray(w)){const I=g.map((z,B)=>Wh(w[B],z));return z=>I.map(B=>B(z))}if(v==="object"){if(!w||!g)throw new Error("Object cannot be null");if(df(w)&&df(g)){const B=w.getTime(),o=g.getTime()-B;return ye=>new Date(B+ye*o)}const I=Object.keys(g),z={};return I.forEach(B=>{z[B]=Wh(w[B],g[B])}),B=>{const P={};return I.forEach(o=>{P[o]=z[o](B)}),P}}if(v==="number"){const I=g-w;return z=>w+z*I}return()=>g}const cd=class cd{constructor(g,v={}){va(this,Qn,Rh(void 0));va(this,Po,Rh(void 0));va(this,Rl);va(this,ms,null);gi(this,Qn).v=gi(this,Po).v=g,Gc(this,Rl,v)}static of(g,v){const I=new cd(g(),v);return $p(()=>{I.set(g())}),I}set(g,v){var Ve;Gi(gi(this,Po),g);let{delay:I=0,duration:z=400,easing:B=L_,interpolate:P=Wh}={...gi(this,Rl),...v};if(z===0)return(Ve=gi(this,ms))==null||Ve.abort(),Gi(gi(this,Qn),g),Promise.resolve();const o=kn.now()+I;let ye,be=!1,Re=gi(this,ms);return Gc(this,ms,z_(Ae=>{if(Ae<o)return!0;if(!be){be=!0;const Be=gi(this,Qn).v;ye=P(Be,g),typeof z=="function"&&(z=z(Be,g)),Re==null||Re.abort()}const ce=Ae-o;return ce>z?(Gi(gi(this,Qn),g),!1):(Gi(gi(this,Qn),ye(B(ce/z))),!0)})),gi(this,ms).promise}get current(){return oi(gi(this,Qn))}get target(){return oi(gi(this,Po))}set target(g){this.set(g)}};Qn=new WeakMap,Po=new WeakMap,Rl=new WeakMap,ms=new WeakMap;let Hh=cd;class su{constructor(g,v){lt(this,"value");lt(this,"motion");this.value=g,this.motion=new Hh(g,v)}set(g,v){this.value=g,this.motion.set(g,v)}update(g){this.motion.set(this.value,g)}snap(){this.motion.set(this.value,{duration:0})}}function pf(w,g,v){const I=v*(Math.PI/180),z=w/2,B=g/2,P=Math.sqrt(z*z+B*B),o=Math.atan(B/z)*(180/Math.PI),ye=o,be=180-o,Re=180+o,Ve=360-o;switch(!0){case(ye<=v&&v<=be):return{offsetX:P*Math.cos(I)-z,offsetY:0};case(be<=v&&v<=Re):return{offsetX:-w,offsetY:P*Math.sin(I)-B};case(Re<=v&&v<=Ve):return{offsetX:P*Math.cos(I)-z,offsetY:-g};default:return{offsetX:0,offsetY:P*Math.sin(I)-B}}}const ff=512,Z_=0,Xh=24,ou=10,U_=1e6,$_=2,G_=128,q_=270,Yh=8;var lu;(w=>{w.COUNT=12,w.DEFAULT=q_,w.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330]})(lu||(lu={}));var W_=jh('<div><div class="pin svelte-1q5zkd1"></div> <div class="marker svelte-1q5zkd1"><div class="body svelte-1q5zkd1"></div></div></div>');function H_(w,g){Kc(g,!0);let v,I,z,B;const P=g.width+2*Yh,o=g.height+2*Yh,ye=()=>B;Yn(()=>{z.style.width=`${Math.min(P,o)/4}px`,z.style.height=`${Math.min(P,o)/4}px`});let be=kr(!0);function Re(St){Gi(be,St,!0)}function Ve(){return oi(be)}let Ae=kr(!0);function ce(St){Gi(Ae,St,!0)}function Be(){return ft.motion.current==0}function Rt(){return oi(Ae)==!1}let ft=new su(0),di=qh;Yn(()=>{Dt(ft.motion.current)}),Yn(()=>{oi(be)==!1&&(ft.snap(),Kn.clear(g.priority,g.id+"_scale"))}),Yn(()=>{oi(Ae)==!0&&ft.value!=0&&(di=j_,Kn.stacked()?ft.set(0,{duration:0}):ft.set(0,{duration:150,easing:F_})),oi(Ae)==!1&&ft.value!=1&&(di=qh,ft.set(1,{duration:150,easing:B_}))});function Dt(St){!v||!I||!z||Kn.equeue(di,g.priority,g.id+"_scale",()=>{v.style.opacity=`${St}`,I.style.scale=`${St}`,z.style.scale=`${St}`})}let Lt=NaN,li=kr(!1),Ft=new su(-P/2,{easing:Gh}),jt=new su(-o/2,{easing:Gh});Yn(()=>{hr(Ft.motion.current,jt.motion.current)}),Yn(()=>{oi(be)==!1&&(Ft.snap(),Ft.snap(),Kn.clear(g.priority,g.id+"_angle"))}),Yn(()=>{oi(Ae)==!0&&oi(li)&&(Ft.update({duration:75}),Ft.update({duration:75}))});function hr(St,zi){if(!v||!I||!z)return;const Lr=St+P/2,tr=zi+o/2,Fr=o<P?Lr*o/P:Lr,Wi=o>P?tr*P/o:tr,pr=Math.atan2(Wi,Fr)/Math.PI*180-45,ir=0,Qr=30,Br=Math.sqrt(Lr*Lr+tr*tr),Or=Math.min(P,o)/2,ka=Math.sqrt(P*P+o*o)/2,ci=(Br-Or)/(ka-Or),Dn=ir+ci*(Qr-ir),Hi=Br<Or?Br/Or:1;Kn.equeue(qh,g.priority,g.id+"_angle",()=>{I.style.transform=`translate(${Math.round(St)}px, ${Math.round(zi)}px)`,z.style.transform=`scale(${Hi}) rotate(${pr}deg) skew(${Dn}deg, ${Dn}deg)`})}function ea(St){if(oi(li)==!1){let zi=pf(P,o,St);Ft.set(Math.round(zi.offsetX),{duration:0}),jt.set(Math.round(zi.offsetY),{duration:0}),hr(Ft.value,jt.value),Lt=St,Gi(li,!0)}else if(St!=Lt){let zi=Math.abs(St-Lt),Lr=zi<180?zi:360-zi,tr=Math.log(Lr)*75,Fr=pf(P,o,St);Ft.set(Math.round(Fr.offsetX),{duration:oi(li)?tr:0}),jt.set(Math.round(Fr.offsetY),{duration:oi(li)?tr:0}),Lt=St}}var dn=W_();let Kr;var pn=Lh(dn);mo(pn,St=>z=St,()=>z);var Tr=Jg(pn,2);let qi;var Jr=Lh(Tr);let dr;return mo(Jr,St=>B=St,()=>B),mo(Tr,St=>I=St,()=>I),mo(dn,St=>v=St,()=>v),Gp(St=>{Kr=lf(dn,1,"anchor svelte-1q5zkd1",null,Kr,St),qi=cf(Tr,"",qi,{padding:Yh+"px"}),dr=cf(Jr,"",dr,{width:`${g.width}px`,height:`${g.height}px`})},[()=>({displayed:oi(be)})]),Nh(w,dn),Jc({getBody:ye,setDisplayed:Re,getDisplayed:Ve,setCollapsed:ce,getCollapsed:Be,getExpanded:Rt,setAngle:ea})}var X_=jh('<div><div class="body svelte-piqgmq"></div></div>');function Y_(w,g){Kc(g,!0);let v,I;function z(){return I}let B=kr(!1);function P(ft){Gi(B,ft,!0)}function o(){return oi(B)}let ye=new su(0,{easing:Gh});Yn(()=>{be(ye.motion.current)}),Yn(()=>{oi(B)==!1&&(ye.snap(),Kn.clear(g.priority,g.id))});function be(ft){v&&Kn.equeue(N_,g.priority,g.id,()=>{v.style.scale=ft.toString(),v.style.filter=`brightness(${.25+.75*ft})`,I.style.opacity=ft.toString()})}function Re(ft){ft!=ye.value&&ye.set(ft,{duration:75})}function Ve(){return ye.motion.current==0}function Ae(){return ye.value}var ce=X_();let Be;var Rt=Lh(ce);return mo(Rt,ft=>I=ft,()=>I),mo(ce,ft=>v=ft,()=>v),Gp(ft=>Be=lf(ce,1,"circle svelte-piqgmq",null,Be,ft),[()=>({displayed:oi(B)})]),Nh(w,ce),Jc({getBody:z,setDisplayed:P,getDisplayed:o,setScale:Re,getCollapsed:Ve,getScale:Ae})}async function cu(w,g){try{await fetch("https://arenarium.dev/api/public/v1/log?log="+encodeURIComponent(JSON.stringify({title:w,content:g})))}catch(v){console.error(v)}}class go{constructor(g,v,I,z){lt(this,"swLat");lt(this,"swLng");lt(this,"neLat");lt(this,"neLng");lt(this,"contains",(g,v)=>this.swLat<=g&&g<=this.neLat&&this.swLng<=v&&v<=this.neLng);this.swLat=v,this.swLng=g,this.neLat=z,this.neLng=I}}class mf{constructor(g,v,I,z,B){lt(this,"bounds1");lt(this,"bounds2");lt(this,"contains",(g,v)=>this.bounds1.contains(g,v)||this.bounds2.contains(g,v));const P=g.unproject([v,I]),o=g.unproject([z,B]);if(P.lng<-180){this.bounds1=new go(-180,P.lat,o.lng,o.lat),this.bounds2=new go(P.wrap().lng,P.lat,180,o.lat);return}if(o.lng>180){this.bounds1=new go(P.lng,P.lat,180,o.lat),this.bounds2=new go(-180,P.lat,o.wrap().lng,o.lat);return}this.bounds1=new go(P.lng,P.lat,o.lng,o.lat),this.bounds2=new go(0,0,0,0)}}var kt;(function(w){w.assertEqual=z=>{};function g(z){}w.assertIs=g;function v(z){throw new Error}w.assertNever=v,w.arrayToEnum=z=>{const B={};for(const P of z)B[P]=P;return B},w.getValidEnumValues=z=>{const B=w.objectKeys(z).filter(o=>typeof z[z[o]]!="number"),P={};for(const o of B)P[o]=z[o];return w.objectValues(P)},w.objectValues=z=>w.objectKeys(z).map(function(B){return z[B]}),w.objectKeys=typeof Object.keys=="function"?z=>Object.keys(z):z=>{const B=[];for(const P in z)Object.prototype.hasOwnProperty.call(z,P)&&B.push(P);return B},w.find=(z,B)=>{for(const P of z)if(B(P))return P},w.isInteger=typeof Number.isInteger=="function"?z=>Number.isInteger(z):z=>typeof z=="number"&&Number.isFinite(z)&&Math.floor(z)===z;function I(z,B=" | "){return z.map(P=>typeof P=="string"?`'${P}'`:P).join(B)}w.joinValues=I,w.jsonStringifyReplacer=(z,B)=>typeof B=="bigint"?B.toString():B})(kt||(kt={}));var gf;(function(w){w.mergeShapes=(g,v)=>({...g,...v})})(gf||(gf={}));const Xe=kt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Pa=w=>{switch(typeof w){case"undefined":return Xe.undefined;case"string":return Xe.string;case"number":return Number.isNaN(w)?Xe.nan:Xe.number;case"boolean":return Xe.boolean;case"function":return Xe.function;case"bigint":return Xe.bigint;case"symbol":return Xe.symbol;case"object":return Array.isArray(w)?Xe.array:w===null?Xe.null:w.then&&typeof w.then=="function"&&w.catch&&typeof w.catch=="function"?Xe.promise:typeof Map<"u"&&w instanceof Map?Xe.map:typeof Set<"u"&&w instanceof Set?Xe.set:typeof Date<"u"&&w instanceof Date?Xe.date:Xe.object;default:return Xe.unknown}},je=kt.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class Yr extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=I=>{this.issues=[...this.issues,I]},this.addIssues=(I=[])=>{this.issues=[...this.issues,...I]};const v=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,v):this.__proto__=v,this.name="ZodError",this.issues=g}format(g){const v=g||function(B){return B.message},I={_errors:[]},z=B=>{for(const P of B.issues)if(P.code==="invalid_union")P.unionErrors.map(z);else if(P.code==="invalid_return_type")z(P.returnTypeError);else if(P.code==="invalid_arguments")z(P.argumentsError);else if(P.path.length===0)I._errors.push(v(P));else{let o=I,ye=0;for(;ye<P.path.length;){const be=P.path[ye];ye===P.path.length-1?(o[be]=o[be]||{_errors:[]},o[be]._errors.push(v(P))):o[be]=o[be]||{_errors:[]},o=o[be],ye++}}};return z(this),I}static assert(g){if(!(g instanceof Yr))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,kt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=v=>v.message){const v={},I=[];for(const z of this.issues)z.path.length>0?(v[z.path[0]]=v[z.path[0]]||[],v[z.path[0]].push(g(z))):I.push(g(z));return{formErrors:I,fieldErrors:v}}get formErrors(){return this.flatten()}}Yr.create=w=>new Yr(w);const Ml=(w,g)=>{let v;switch(w.code){case je.invalid_type:w.received===Xe.undefined?v="Required":v=`Expected ${w.expected}, received ${w.received}`;break;case je.invalid_literal:v=`Invalid literal value, expected ${JSON.stringify(w.expected,kt.jsonStringifyReplacer)}`;break;case je.unrecognized_keys:v=`Unrecognized key(s) in object: ${kt.joinValues(w.keys,", ")}`;break;case je.invalid_union:v="Invalid input";break;case je.invalid_union_discriminator:v=`Invalid discriminator value. Expected ${kt.joinValues(w.options)}`;break;case je.invalid_enum_value:v=`Invalid enum value. Expected ${kt.joinValues(w.options)}, received '${w.received}'`;break;case je.invalid_arguments:v="Invalid function arguments";break;case je.invalid_return_type:v="Invalid function return type";break;case je.invalid_date:v="Invalid date";break;case je.invalid_string:typeof w.validation=="object"?"includes"in w.validation?(v=`Invalid input: must include "${w.validation.includes}"`,typeof w.validation.position=="number"&&(v=`${v} at one or more positions greater than or equal to ${w.validation.position}`)):"startsWith"in w.validation?v=`Invalid input: must start with "${w.validation.startsWith}"`:"endsWith"in w.validation?v=`Invalid input: must end with "${w.validation.endsWith}"`:kt.assertNever(w.validation):w.validation!=="regex"?v=`Invalid ${w.validation}`:v="Invalid";break;case je.too_small:w.type==="array"?v=`Array must contain ${w.exact?"exactly":w.inclusive?"at least":"more than"} ${w.minimum} element(s)`:w.type==="string"?v=`String must contain ${w.exact?"exactly":w.inclusive?"at least":"over"} ${w.minimum} character(s)`:w.type==="number"?v=`Number must be ${w.exact?"exactly equal to ":w.inclusive?"greater than or equal to ":"greater than "}${w.minimum}`:w.type==="date"?v=`Date must be ${w.exact?"exactly equal to ":w.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(w.minimum))}`:v="Invalid input";break;case je.too_big:w.type==="array"?v=`Array must contain ${w.exact?"exactly":w.inclusive?"at most":"less than"} ${w.maximum} element(s)`:w.type==="string"?v=`String must contain ${w.exact?"exactly":w.inclusive?"at most":"under"} ${w.maximum} character(s)`:w.type==="number"?v=`Number must be ${w.exact?"exactly":w.inclusive?"less than or equal to":"less than"} ${w.maximum}`:w.type==="bigint"?v=`BigInt must be ${w.exact?"exactly":w.inclusive?"less than or equal to":"less than"} ${w.maximum}`:w.type==="date"?v=`Date must be ${w.exact?"exactly":w.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(w.maximum))}`:v="Invalid input";break;case je.custom:v="Invalid input";break;case je.invalid_intersection_types:v="Intersection results could not be merged";break;case je.not_multiple_of:v=`Number must be a multiple of ${w.multipleOf}`;break;case je.not_finite:v="Number must be finite";break;default:v=g.defaultError,kt.assertNever(w)}return{message:v}};let K_=Ml;function Kh(){return K_}const Jh=w=>{const{data:g,path:v,errorMaps:I,issueData:z}=w,B=[...v,...z.path||[]],P={...z,path:B};if(z.message!==void 0)return{...z,path:B,message:z.message};let o="";const ye=I.filter(be=>!!be).slice().reverse();for(const be of ye)o=be(P,{data:g,defaultError:o}).message;return{...z,path:B,message:o}};function We(w,g){const v=Kh(),I=Jh({issueData:g,data:w.data,path:w.path,errorMaps:[w.common.contextualErrorMap,w.schemaErrorMap,v,v===Ml?void 0:Ml].filter(z=>!!z)});w.common.issues.push(I)}class Dr{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,v){const I=[];for(const z of v){if(z.status==="aborted")return ct;z.status==="dirty"&&g.dirty(),I.push(z.value)}return{status:g.value,value:I}}static async mergeObjectAsync(g,v){const I=[];for(const z of v){const B=await z.key,P=await z.value;I.push({key:B,value:P})}return Dr.mergeObjectSync(g,I)}static mergeObjectSync(g,v){const I={};for(const z of v){const{key:B,value:P}=z;if(B.status==="aborted"||P.status==="aborted")return ct;B.status==="dirty"&&g.dirty(),P.status==="dirty"&&g.dirty(),B.value!=="__proto__"&&(typeof P.value<"u"||z.alwaysSet)&&(I[B.value]=P.value)}return{status:g.value,value:I}}}const ct=Object.freeze({status:"aborted"}),Cl=w=>({status:"dirty",value:w}),wr=w=>({status:"valid",value:w}),_f=w=>w.status==="aborted",yf=w=>w.status==="dirty",_o=w=>w.status==="valid",uu=w=>typeof Promise<"u"&&w instanceof Promise;var Qe;(function(w){w.errToObj=g=>typeof g=="string"?{message:g}:g||{},w.toString=g=>typeof g=="string"?g:g==null?void 0:g.message})(Qe||(Qe={}));class Ma{constructor(g,v,I,z){this._cachedPath=[],this.parent=g,this.data=v,this._path=I,this._key=z}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const xf=(w,g)=>{if(_o(g))return{success:!0,data:g.value};if(!w.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const v=new Yr(w.common.issues);return this._error=v,this._error}}};function wt(w){if(!w)return{};const{errorMap:g,invalid_type_error:v,required_error:I,description:z}=w;if(g&&(v||I))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:z}:{errorMap:(P,o)=>{const{message:ye}=w;return P.code==="invalid_enum_value"?{message:ye??o.defaultError}:typeof o.data>"u"?{message:ye??I??o.defaultError}:P.code!=="invalid_type"?{message:o.defaultError}:{message:ye??v??o.defaultError}},description:z}}class It{get description(){return this._def.description}_getType(g){return Pa(g.data)}_getOrReturnCtx(g,v){return v||{common:g.parent.common,data:g.data,parsedType:Pa(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new Dr,ctx:{common:g.parent.common,data:g.data,parsedType:Pa(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const v=this._parse(g);if(uu(v))throw new Error("Synchronous parse encountered promise.");return v}_parseAsync(g){const v=this._parse(g);return Promise.resolve(v)}parse(g,v){const I=this.safeParse(g,v);if(I.success)return I.data;throw I.error}safeParse(g,v){const I={common:{issues:[],async:(v==null?void 0:v.async)??!1,contextualErrorMap:v==null?void 0:v.errorMap},path:(v==null?void 0:v.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:Pa(g)},z=this._parseSync({data:g,path:I.path,parent:I});return xf(I,z)}"~validate"(g){var I,z;const v={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:Pa(g)};if(!this["~standard"].async)try{const B=this._parseSync({data:g,path:[],parent:v});return _o(B)?{value:B.value}:{issues:v.common.issues}}catch(B){(z=(I=B==null?void 0:B.message)==null?void 0:I.toLowerCase())!=null&&z.includes("encountered")&&(this["~standard"].async=!0),v.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:v}).then(B=>_o(B)?{value:B.value}:{issues:v.common.issues})}async parseAsync(g,v){const I=await this.safeParseAsync(g,v);if(I.success)return I.data;throw I.error}async safeParseAsync(g,v){const I={common:{issues:[],contextualErrorMap:v==null?void 0:v.errorMap,async:!0},path:(v==null?void 0:v.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:Pa(g)},z=this._parse({data:g,path:I.path,parent:I}),B=await(uu(z)?z:Promise.resolve(z));return xf(I,B)}refine(g,v){const I=z=>typeof v=="string"||typeof v>"u"?{message:v}:typeof v=="function"?v(z):v;return this._refinement((z,B)=>{const P=g(z),o=()=>B.addIssue({code:je.custom,...I(z)});return typeof Promise<"u"&&P instanceof Promise?P.then(ye=>ye?!0:(o(),!1)):P?!0:(o(),!1)})}refinement(g,v){return this._refinement((I,z)=>g(I)?!0:(z.addIssue(typeof v=="function"?v(I,z):v),!1))}_refinement(g){return new wo({schema:this,typeName:ut.ZodEffects,effect:{type:"refinement",refinement:g}})}superRefine(g){return this._refinement(g)}constructor(g){this.spa=this.safeParseAsync,this._def=g,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:v=>this["~validate"](v)}}optional(){return Ea.create(this,this._def)}nullable(){return To.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Rn.create(this)}promise(){return zl.create(this,this._def)}or(g){return du.create([this,g],this._def)}and(g){return pu.create(this,g,this._def)}transform(g){return new wo({...wt(this._def),schema:this,typeName:ut.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const v=typeof g=="function"?g:()=>g;return new rd({...wt(this._def),innerType:this,defaultValue:v,typeName:ut.ZodDefault})}brand(){return new vy({typeName:ut.ZodBranded,type:this,...wt(this._def)})}catch(g){const v=typeof g=="function"?g:()=>g;return new nd({...wt(this._def),innerType:this,catchValue:v,typeName:ut.ZodCatch})}describe(g){const v=this.constructor;return new v({...this._def,description:g})}pipe(g){return ad.create(this,g)}readonly(){return sd.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const J_=/^c[^\s-]{8,}$/i,Q_=/^[0-9a-z]+$/,ey=/^[0-9A-HJKMNP-TV-Z]{26}$/i,ty=/^[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,iy=/^[a-z0-9_-]{21}$/i,ry=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,ny=/^[-+]?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)?)??$/,ay=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,sy="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Qh;const oy=/^(?:(?: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])$/,ly=/^(?:(?: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])$/,cy=/^(([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]))$/,uy=/^(([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])$/,hy=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,dy=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,vf="((\\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])))",py=new RegExp(`^${vf}$`);function bf(w){let g="[0-5]\\d";w.precision?g=`${g}\\.\\d{${w.precision}}`:w.precision==null&&(g=`${g}(\\.\\d+)?`);const v=w.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${g})${v}`}function fy(w){return new RegExp(`^${bf(w)}$`)}function my(w){let g=`${vf}T${bf(w)}`;const v=[];return v.push(w.local?"Z?":"Z"),w.offset&&v.push("([+-]\\d{2}:?\\d{2})"),g=`${g}(${v.join("|")})`,new RegExp(`^${g}$`)}function gy(w,g){return!!((g==="v4"||!g)&&oy.test(w)||(g==="v6"||!g)&&cy.test(w))}function _y(w,g){if(!ry.test(w))return!1;try{const[v]=w.split("."),I=v.replace(/-/g,"+").replace(/_/g,"/").padEnd(v.length+(4-v.length%4)%4,"="),z=JSON.parse(atob(I));return!(typeof z!="object"||z===null||"typ"in z&&(z==null?void 0:z.typ)!=="JWT"||!z.alg||g&&z.alg!==g)}catch{return!1}}function yy(w,g){return!!((g==="v4"||!g)&&ly.test(w)||(g==="v6"||!g)&&uy.test(w))}class Ca extends It{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Xe.string){const B=this._getOrReturnCtx(g);return We(B,{code:je.invalid_type,expected:Xe.string,received:B.parsedType}),ct}const I=new Dr;let z;for(const B of this._def.checks)if(B.kind==="min")g.data.length<B.value&&(z=this._getOrReturnCtx(g,z),We(z,{code:je.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="max")g.data.length>B.value&&(z=this._getOrReturnCtx(g,z),We(z,{code:je.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!1,message:B.message}),I.dirty());else if(B.kind==="length"){const P=g.data.length>B.value,o=g.data.length<B.value;(P||o)&&(z=this._getOrReturnCtx(g,z),P?We(z,{code:je.too_big,maximum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}):o&&We(z,{code:je.too_small,minimum:B.value,type:"string",inclusive:!0,exact:!0,message:B.message}),I.dirty())}else if(B.kind==="email")ay.test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"email",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="emoji")Qh||(Qh=new RegExp(sy,"u")),Qh.test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"emoji",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="uuid")ty.test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"uuid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="nanoid")iy.test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"nanoid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid")J_.test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"cuid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="cuid2")Q_.test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"cuid2",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="ulid")ey.test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"ulid",code:je.invalid_string,message:B.message}),I.dirty());else if(B.kind==="url")try{new URL(g.data)}catch{z=this._getOrReturnCtx(g,z),We(z,{validation:"url",code:je.invalid_string,message:B.message}),I.dirty()}else B.kind==="regex"?(B.regex.lastIndex=0,B.regex.test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"regex",code:je.invalid_string,message:B.message}),I.dirty())):B.kind==="trim"?g.data=g.data.trim():B.kind==="includes"?g.data.includes(B.value,B.position)||(z=this._getOrReturnCtx(g,z),We(z,{code:je.invalid_string,validation:{includes:B.value,position:B.position},message:B.message}),I.dirty()):B.kind==="toLowerCase"?g.data=g.data.toLowerCase():B.kind==="toUpperCase"?g.data=g.data.toUpperCase():B.kind==="startsWith"?g.data.startsWith(B.value)||(z=this._getOrReturnCtx(g,z),We(z,{code:je.invalid_string,validation:{startsWith:B.value},message:B.message}),I.dirty()):B.kind==="endsWith"?g.data.endsWith(B.value)||(z=this._getOrReturnCtx(g,z),We(z,{code:je.invalid_string,validation:{endsWith:B.value},message:B.message}),I.dirty()):B.kind==="datetime"?my(B).test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{code:je.invalid_string,validation:"datetime",message:B.message}),I.dirty()):B.kind==="date"?py.test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{code:je.invalid_string,validation:"date",message:B.message}),I.dirty()):B.kind==="time"?fy(B).test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{code:je.invalid_string,validation:"time",message:B.message}),I.dirty()):B.kind==="duration"?ny.test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"duration",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="ip"?gy(g.data,B.version)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"ip",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="jwt"?_y(g.data,B.alg)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"jwt",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="cidr"?yy(g.data,B.version)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"cidr",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="base64"?hy.test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"base64",code:je.invalid_string,message:B.message}),I.dirty()):B.kind==="base64url"?dy.test(g.data)||(z=this._getOrReturnCtx(g,z),We(z,{validation:"base64url",code:je.invalid_string,message:B.message}),I.dirty()):kt.assertNever(B);return{status:I.value,value:g.data}}_regex(g,v,I){return this.refinement(z=>g.test(z),{validation:v,code:je.invalid_string,...Qe.errToObj(I)})}_addCheck(g){return new Ca({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...Qe.errToObj(g)})}url(g){return this._addCheck({kind:"url",...Qe.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...Qe.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...Qe.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...Qe.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...Qe.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...Qe.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...Qe.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...Qe.errToObj(g)})}base64url(g){return this._addCheck({kind:"base64url",...Qe.errToObj(g)})}jwt(g){return this._addCheck({kind:"jwt",...Qe.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...Qe.errToObj(g)})}cidr(g){return this._addCheck({kind:"cidr",...Qe.errToObj(g)})}datetime(g){return typeof g=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:g}):this._addCheck({kind:"datetime",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,offset:(g==null?void 0:g.offset)??!1,local:(g==null?void 0:g.local)??!1,...Qe.errToObj(g==null?void 0:g.message)})}date(g){return this._addCheck({kind:"date",message:g})}time(g){return typeof g=="string"?this._addCheck({kind:"time",precision:null,message:g}):this._addCheck({kind:"time",precision:typeof(g==null?void 0:g.precision)>"u"?null:g==null?void 0:g.precision,...Qe.errToObj(g==null?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...Qe.errToObj(g)})}regex(g,v){return this._addCheck({kind:"regex",regex:g,...Qe.errToObj(v)})}includes(g,v){return this._addCheck({kind:"includes",value:g,position:v==null?void 0:v.position,...Qe.errToObj(v==null?void 0:v.message)})}startsWith(g,v){return this._addCheck({kind:"startsWith",value:g,...Qe.errToObj(v)})}endsWith(g,v){return this._addCheck({kind:"endsWith",value:g,...Qe.errToObj(v)})}min(g,v){return this._addCheck({kind:"min",value:g,...Qe.errToObj(v)})}max(g,v){return this._addCheck({kind:"max",value:g,...Qe.errToObj(v)})}length(g,v){return this._addCheck({kind:"length",value:g,...Qe.errToObj(v)})}nonempty(g){return this.min(1,Qe.errToObj(g))}trim(){return new Ca({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new Ca({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new Ca({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(g=>g.kind==="datetime")}get isDate(){return!!this._def.checks.find(g=>g.kind==="date")}get isTime(){return!!this._def.checks.find(g=>g.kind==="time")}get isDuration(){return!!this._def.checks.find(g=>g.kind==="duration")}get isEmail(){return!!this._def.checks.find(g=>g.kind==="email")}get isURL(){return!!this._def.checks.find(g=>g.kind==="url")}get isEmoji(){return!!this._def.checks.find(g=>g.kind==="emoji")}get isUUID(){return!!this._def.checks.find(g=>g.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(g=>g.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(g=>g.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(g=>g.kind==="cuid2")}get isULID(){return!!this._def.checks.find(g=>g.kind==="ulid")}get isIP(){return!!this._def.checks.find(g=>g.kind==="ip")}get isCIDR(){return!!this._def.checks.find(g=>g.kind==="cidr")}get isBase64(){return!!this._def.checks.find(g=>g.kind==="base64")}get isBase64url(){return!!this._def.checks.find(g=>g.kind==="base64url")}get minLength(){let g=null;for(const v of this._def.checks)v.kind==="min"&&(g===null||v.value>g)&&(g=v.value);return g}get maxLength(){let g=null;for(const v of this._def.checks)v.kind==="max"&&(g===null||v.value<g)&&(g=v.value);return g}}Ca.create=w=>new Ca({checks:[],typeName:ut.ZodString,coerce:(w==null?void 0:w.coerce)??!1,...wt(w)});function xy(w,g){const v=(w.toString().split(".")[1]||"").length,I=(g.toString().split(".")[1]||"").length,z=v>I?v:I,B=Number.parseInt(w.toFixed(z).replace(".","")),P=Number.parseInt(g.toFixed(z).replace(".",""));return B%P/10**z}class yo extends It{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){if(this._def.coerce&&(g.data=Number(g.data)),this._getType(g)!==Xe.number){const B=this._getOrReturnCtx(g);return We(B,{code:je.invalid_type,expected:Xe.number,received:B.parsedType}),ct}let I;const z=new Dr;for(const B of this._def.checks)B.kind==="int"?kt.isInteger(g.data)||(I=this._getOrReturnCtx(g,I),We(I,{code:je.invalid_type,expected:"integer",received:"float",message:B.message}),z.dirty()):B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),We(I,{code:je.too_small,minimum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),z.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),We(I,{code:je.too_big,maximum:B.value,type:"number",inclusive:B.inclusive,exact:!1,message:B.message}),z.dirty()):B.kind==="multipleOf"?xy(g.data,B.value)!==0&&(I=this._getOrReturnCtx(g,I),We(I,{code:je.not_multiple_of,multipleOf:B.value,message:B.message}),z.dirty()):B.kind==="finite"?Number.isFinite(g.data)||(I=this._getOrReturnCtx(g,I),We(I,{code:je.not_finite,message:B.message}),z.dirty()):kt.assertNever(B);return{status:z.value,value:g.data}}gte(g,v){return this.setLimit("min",g,!0,Qe.toString(v))}gt(g,v){return this.setLimit("min",g,!1,Qe.toString(v))}lte(g,v){return this.setLimit("max",g,!0,Qe.toString(v))}lt(g,v){return this.setLimit("max",g,!1,Qe.toString(v))}setLimit(g,v,I,z){return new yo({...this._def,checks:[...this._def.checks,{kind:g,value:v,inclusive:I,message:Qe.toString(z)}]})}_addCheck(g){return new yo({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:Qe.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:Qe.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:Qe.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:Qe.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:Qe.toString(g)})}multipleOf(g,v){return this._addCheck({kind:"multipleOf",value:g,message:Qe.toString(v)})}finite(g){return this._addCheck({kind:"finite",message:Qe.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:Qe.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:Qe.toString(g)})}get minValue(){let g=null;for(const v of this._def.checks)v.kind==="min"&&(g===null||v.value>g)&&(g=v.value);return g}get maxValue(){let g=null;for(const v of this._def.checks)v.kind==="max"&&(g===null||v.value<g)&&(g=v.value);return g}get isInt(){return!!this._def.checks.find(g=>g.kind==="int"||g.kind==="multipleOf"&&kt.isInteger(g.value))}get isFinite(){let g=null,v=null;for(const I of this._def.checks){if(I.kind==="finite"||I.kind==="int"||I.kind==="multipleOf")return!0;I.kind==="min"?(v===null||I.value>v)&&(v=I.value):I.kind==="max"&&(g===null||I.value<g)&&(g=I.value)}return Number.isFinite(v)&&Number.isFinite(g)}}yo.create=w=>new yo({checks:[],typeName:ut.ZodNumber,coerce:(w==null?void 0:w.coerce)||!1,...wt(w)});class Il extends It{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){if(this._def.coerce)try{g.data=BigInt(g.data)}catch{return this._getInvalidInput(g)}if(this._getType(g)!==Xe.bigint)return this._getInvalidInput(g);let I;const z=new Dr;for(const B of this._def.checks)B.kind==="min"?(B.inclusive?g.data<B.value:g.data<=B.value)&&(I=this._getOrReturnCtx(g,I),We(I,{code:je.too_small,type:"bigint",minimum:B.value,inclusive:B.inclusive,message:B.message}),z.dirty()):B.kind==="max"?(B.inclusive?g.data>B.value:g.data>=B.value)&&(I=this._getOrReturnCtx(g,I),We(I,{code:je.too_big,type:"bigint",maximum:B.value,inclusive:B.inclusive,message:B.message}),z.dirty()):B.kind==="multipleOf"?g.data%B.value!==BigInt(0)&&(I=this._getOrReturnCtx(g,I),We(I,{code:je.not_multiple_of,multipleOf:B.value,message:B.message}),z.dirty()):kt.assertNever(B);return{status:z.value,value:g.data}}_getInvalidInput(g){const v=this._getOrReturnCtx(g);return We(v,{code:je.invalid_type,expected:Xe.bigint,received:v.parsedType}),ct}gte(g,v){return this.setLimit("min",g,!0,Qe.toString(v))}gt(g,v){return this.setLimit("min",g,!1,Qe.toString(v))}lte(g,v){return this.setLimit("max",g,!0,Qe.toString(v))}lt(g,v){return this.setLimit("max",g,!1,Qe.toString(v))}setLimit(g,v,I,z){return new Il({...this._def,checks:[...this._def.checks,{kind:g,value:v,inclusive:I,message:Qe.toString(z)}]})}_addCheck(g){return new Il({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:Qe.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:Qe.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:Qe.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:Qe.toString(g)})}multipleOf(g,v){return this._addCheck({kind:"multipleOf",value:g,message:Qe.toString(v)})}get minValue(){let g=null;for(const v of this._def.checks)v.kind==="min"&&(g===null||v.value>g)&&(g=v.value);return g}get maxValue(){let g=null;for(const v of this._def.checks)v.kind==="max"&&(g===null||v.value<g)&&(g=v.value);return g}}Il.create=w=>new Il({checks:[],typeName:ut.ZodBigInt,coerce:(w==null?void 0:w.coerce)??!1,...wt(w)});class ed extends It{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Xe.boolean){const I=this._getOrReturnCtx(g);return We(I,{code:je.invalid_type,expected:Xe.boolean,received:I.parsedType}),ct}return wr(g.data)}}ed.create=w=>new ed({typeName:ut.ZodBoolean,coerce:(w==null?void 0:w.coerce)||!1,...wt(w)});class hu extends It{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Xe.date){const B=this._getOrReturnCtx(g);return We(B,{code:je.invalid_type,expected:Xe.date,received:B.parsedType}),ct}if(Number.isNaN(g.data.getTime())){const B=this._getOrReturnCtx(g);return We(B,{code:je.invalid_date}),ct}const I=new Dr;let z;for(const B of this._def.checks)B.kind==="min"?g.data.getTime()<B.value&&(z=this._getOrReturnCtx(g,z),We(z,{code:je.too_small,message:B.message,inclusive:!0,exact:!1,minimum:B.value,type:"date"}),I.dirty()):B.kind==="max"?g.data.getTime()>B.value&&(z=this._getOrReturnCtx(g,z),We(z,{code:je.too_big,message:B.message,inclusive:!0,exact:!1,maximum:B.value,type:"date"}),I.dirty()):kt.assertNever(B);return{status:I.value,value:new Date(g.data.getTime())}}_addCheck(g){return new hu({...this._def,checks:[...this._def.checks,g]})}min(g,v){return this._addCheck({kind:"min",value:g.getTime(),message:Qe.toString(v)})}max(g,v){return this._addCheck({kind:"max",value:g.getTime(),message:Qe.toString(v)})}get minDate(){let g=null;for(const v of this._def.checks)v.kind==="min"&&(g===null||v.value>g)&&(g=v.value);return g!=null?new Date(g):null}get maxDate(){let g=null;for(const v of this._def.checks)v.kind==="max"&&(g===null||v.value<g)&&(g=v.value);return g!=null?new Date(g):null}}hu.create=w=>new hu({checks:[],coerce:(w==null?void 0:w.coerce)||!1,typeName:ut.ZodDate,...wt(w)});class wf extends It{_parse(g){if(this._getType(g)!==Xe.symbol){const I=this._getOrReturnCtx(g);return We(I,{code:je.invalid_type,expected:Xe.symbol,received:I.parsedType}),ct}return wr(g.data)}}wf.create=w=>new wf({typeName:ut.ZodSymbol,...wt(w)});class Tf extends It{_parse(g){if(this._getType(g)!==Xe.undefined){const I=this._getOrReturnCtx(g);return We(I,{code:je.invalid_type,expected:Xe.undefined,received:I.parsedType}),ct}return wr(g.data)}}Tf.create=w=>new Tf({typeName:ut.ZodUndefined,...wt(w)});class Sf extends It{_parse(g){if(this._getType(g)!==Xe.null){const I=this._getOrReturnCtx(g);return We(I,{code:je.invalid_type,expected:Xe.null,received:I.parsedType}),ct}return wr(g.data)}}Sf.create=w=>new Sf({typeName:ut.ZodNull,...wt(w)});class td extends It{constructor(){super(...arguments),this._any=!0}_parse(g){return wr(g.data)}}td.create=w=>new td({typeName:ut.ZodAny,...wt(w)});class xo extends It{constructor(){super(...arguments),this._unknown=!0}_parse(g){return wr(g.data)}}xo.create=w=>new xo({typeName:ut.ZodUnknown,...wt(w)});class Ia extends It{_parse(g){const v=this._getOrReturnCtx(g);return We(v,{code:je.invalid_type,expected:Xe.never,received:v.parsedType}),ct}}Ia.create=w=>new Ia({typeName:ut.ZodNever,...wt(w)});class Pf extends It{_parse(g){if(this._getType(g)!==Xe.undefined){const I=this._getOrReturnCtx(g);return We(I,{code:je.invalid_type,expected:Xe.void,received:I.parsedType}),ct}return wr(g.data)}}Pf.create=w=>new Pf({typeName:ut.ZodVoid,...wt(w)});class Rn extends It{_parse(g){const{ctx:v,status:I}=this._processInputParams(g),z=this._def;if(v.parsedType!==Xe.array)return We(v,{code:je.invalid_type,expected:Xe.array,received:v.parsedType}),ct;if(z.exactLength!==null){const P=v.data.length>z.exactLength.value,o=v.data.length<z.exactLength.value;(P||o)&&(We(v,{code:P?je.too_big:je.too_small,minimum:o?z.exactLength.value:void 0,maximum:P?z.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:z.exactLength.message}),I.dirty())}if(z.minLength!==null&&v.data.length<z.minLength.value&&(We(v,{code:je.too_small,minimum:z.minLength.value,type:"array",inclusive:!0,exact:!1,message:z.minLength.message}),I.dirty()),z.maxLength!==null&&v.data.length>z.maxLength.value&&(We(v,{code:je.too_big,maximum:z.maxLength.value,type:"array",inclusive:!0,exact:!1,message:z.maxLength.message}),I.dirty()),v.common.async)return Promise.all([...v.data].map((P,o)=>z.type._parseAsync(new Ma(v,P,v.path,o)))).then(P=>Dr.mergeArray(I,P));const B=[...v.data].map((P,o)=>z.type._parseSync(new Ma(v,P,v.path,o)));return Dr.mergeArray(I,B)}get element(){return this._def.type}min(g,v){return new Rn({...this._def,minLength:{value:g,message:Qe.toString(v)}})}max(g,v){return new Rn({...this._def,maxLength:{value:g,message:Qe.toString(v)}})}length(g,v){return new Rn({...this._def,exactLength:{value:g,message:Qe.toString(v)}})}nonempty(g){return this.min(1,g)}}Rn.create=(w,g)=>new Rn({type:w,minLength:null,maxLength:null,exactLength:null,typeName:ut.ZodArray,...wt(g)});function vo(w){if(w instanceof bi){const g={};for(const v in w.shape){const I=w.shape[v];g[v]=Ea.create(vo(I))}return new bi({...w._def,shape:()=>g})}else return w instanceof Rn?new Rn({...w._def,type:vo(w.element)}):w instanceof Ea?Ea.create(vo(w.unwrap())):w instanceof To?To.create(vo(w.unwrap())):w instanceof Jn?Jn.create(w.items.map(g=>vo(g))):w}class bi extends It{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const g=this._def.shape(),v=kt.objectKeys(g);return this._cached={shape:g,keys:v},this._cached}_parse(g){if(this._getType(g)!==Xe.object){const be=this._getOrReturnCtx(g);return We(be,{code:je.invalid_type,expected:Xe.object,received:be.parsedType}),ct}const{status:I,ctx:z}=this._processInputParams(g),{shape:B,keys:P}=this._getCached(),o=[];if(!(this._def.catchall instanceof Ia&&this._def.unknownKeys==="strip"))for(const be in z.data)P.includes(be)||o.push(be);const ye=[];for(const be of P){const Re=B[be],Ve=z.data[be];ye.push({key:{status:"valid",value:be},value:Re._parse(new Ma(z,Ve,z.path,be)),alwaysSet:be in z.data})}if(this._def.catchall instanceof Ia){const be=this._def.unknownKeys;if(be==="passthrough")for(const Re of o)ye.push({key:{status:"valid",value:Re},value:{status:"valid",value:z.data[Re]}});else if(be==="strict")o.length>0&&(We(z,{code:je.unrecognized_keys,keys:o}),I.dirty());else if(be!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const be=this._def.catchall;for(const Re of o){const Ve=z.data[Re];ye.push({key:{status:"valid",value:Re},value:be._parse(new Ma(z,Ve,z.path,Re)),alwaysSet:Re in z.data})}}return z.common.async?Promise.resolve().then(async()=>{const be=[];for(const Re of ye){const Ve=await Re.key,Ae=await Re.value;be.push({key:Ve,value:Ae,alwaysSet:Re.alwaysSet})}return be}).then(be=>Dr.mergeObjectSync(I,be)):Dr.mergeObjectSync(I,ye)}get shape(){return this._def.shape()}strict(g){return Qe.errToObj,new bi({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(v,I)=>{var B,P;const z=((P=(B=this._def).errorMap)==null?void 0:P.call(B,v,I).message)??I.defaultError;return v.code==="unrecognized_keys"?{message:Qe.errToObj(g).message??z}:{message:z}}}:{}})}strip(){return new bi({...this._def,unknownKeys:"strip"})}passthrough(){return new bi({...this._def,unknownKeys:"passthrough"})}extend(g){return new bi({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new bi({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:ut.ZodObject})}setKey(g,v){return this.augment({[g]:v})}catchall(g){return new bi({...this._def,catchall:g})}pick(g){const v={};for(const I of kt.objectKeys(g))g[I]&&this.shape[I]&&(v[I]=this.shape[I]);return new bi({...this._def,shape:()=>v})}omit(g){const v={};for(const I of kt.objectKeys(this.shape))g[I]||(v[I]=this.shape[I]);return new bi({...this._def,shape:()=>v})}deepPartial(){return vo(this)}partial(g){const v={};for(const I of kt.objectKeys(this.shape)){const z=this.shape[I];g&&!g[I]?v[I]=z:v[I]=z.optional()}return new bi({...this._def,shape:()=>v})}required(g){const v={};for(const I of kt.objectKeys(this.shape))if(g&&!g[I])v[I]=this.shape[I];else{let B=this.shape[I];for(;B instanceof Ea;)B=B._def.innerType;v[I]=B}return new bi({...this._def,shape:()=>v})}keyof(){return Ef(kt.objectKeys(this.shape))}}bi.create=(w,g)=>new bi({shape:()=>w,unknownKeys:"strip",catchall:Ia.create(),typeName:ut.ZodObject,...wt(g)}),bi.strictCreate=(w,g)=>new bi({shape:()=>w,unknownKeys:"strict",catchall:Ia.create(),typeName:ut.ZodObject,...wt(g)}),bi.lazycreate=(w,g)=>new bi({shape:w,unknownKeys:"strip",catchall:Ia.create(),typeName:ut.ZodObject,...wt(g)});class du extends It{_parse(g){const{ctx:v}=this._processInputParams(g),I=this._def.options;function z(B){for(const o of B)if(o.result.status==="valid")return o.result;for(const o of B)if(o.result.status==="dirty")return v.common.issues.push(...o.ctx.common.issues),o.result;const P=B.map(o=>new Yr(o.ctx.common.issues));return We(v,{code:je.invalid_union,unionErrors:P}),ct}if(v.common.async)return Promise.all(I.map(async B=>{const P={...v,common:{...v.common,issues:[]},parent:null};return{result:await B._parseAsync({data:v.data,path:v.path,parent:P}),ctx:P}})).then(z);{let B;const P=[];for(const ye of I){const be={...v,common:{...v.common,issues:[]},parent:null},Re=ye._parseSync({data:v.data,path:v.path,parent:be});if(Re.status==="valid")return Re;Re.status==="dirty"&&!B&&(B={result:Re,ctx:be}),be.common.issues.length&&P.push(be.common.issues)}if(B)return v.common.issues.push(...B.ctx.common.issues),B.result;const o=P.map(ye=>new Yr(ye));return We(v,{code:je.invalid_union,unionErrors:o}),ct}}get options(){return this._def.options}}du.create=(w,g)=>new du({options:w,typeName:ut.ZodUnion,...wt(g)});function id(w,g){const v=Pa(w),I=Pa(g);if(w===g)return{valid:!0,data:w};if(v===Xe.object&&I===Xe.object){const z=kt.objectKeys(g),B=kt.objectKeys(w).filter(o=>z.indexOf(o)!==-1),P={...w,...g};for(const o of B){const ye=id(w[o],g[o]);if(!ye.valid)return{valid:!1};P[o]=ye.data}return{valid:!0,data:P}}else if(v===Xe.array&&I===Xe.array){if(w.length!==g.length)return{valid:!1};const z=[];for(let B=0;B<w.length;B++){const P=w[B],o=g[B],ye=id(P,o);if(!ye.valid)return{valid:!1};z.push(ye.data)}return{valid:!0,data:z}}else return v===Xe.date&&I===Xe.date&&+w==+g?{valid:!0,data:w}:{valid:!1}}class pu extends It{_parse(g){const{status:v,ctx:I}=this._processInputParams(g),z=(B,P)=>{if(_f(B)||_f(P))return ct;const o=id(B.value,P.value);return o.valid?((yf(B)||yf(P))&&v.dirty(),{status:v.value,value:o.data}):(We(I,{code:je.invalid_intersection_types}),ct)};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(([B,P])=>z(B,P)):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}))}}pu.create=(w,g,v)=>new pu({left:w,right:g,typeName:ut.ZodIntersection,...wt(v)});class Jn extends It{_parse(g){const{status:v,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.array)return We(I,{code:je.invalid_type,expected:Xe.array,received:I.parsedType}),ct;if(I.data.length<this._def.items.length)return We(I,{code:je.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ct;!this._def.rest&&I.data.length>this._def.items.length&&(We(I,{code:je.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),v.dirty());const B=[...I.data].map((P,o)=>{const ye=this._def.items[o]||this._def.rest;return ye?ye._parse(new Ma(I,P,I.path,o)):null}).filter(P=>!!P);return I.common.async?Promise.all(B).then(P=>Dr.mergeArray(v,P)):Dr.mergeArray(v,B)}get items(){return this._def.items}rest(g){return new Jn({...this._def,rest:g})}}Jn.create=(w,g)=>{if(!Array.isArray(w))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Jn({items:w,typeName:ut.ZodTuple,rest:null,...wt(g)})};class Mf extends It{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:v,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.map)return We(I,{code:je.invalid_type,expected:Xe.map,received:I.parsedType}),ct;const z=this._def.keyType,B=this._def.valueType,P=[...I.data.entries()].map(([o,ye],be)=>({key:z._parse(new Ma(I,o,I.path,[be,"key"])),value:B._parse(new Ma(I,ye,I.path,[be,"value"]))}));if(I.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const ye of P){const be=await ye.key,Re=await ye.value;if(be.status==="aborted"||Re.status==="aborted")return ct;(be.status==="dirty"||Re.status==="dirty")&&v.dirty(),o.set(be.value,Re.value)}return{status:v.value,value:o}})}else{const o=new Map;for(const ye of P){const be=ye.key,Re=ye.value;if(be.status==="aborted"||Re.status==="aborted")return ct;(be.status==="dirty"||Re.status==="dirty")&&v.dirty(),o.set(be.value,Re.value)}return{status:v.value,value:o}}}}Mf.create=(w,g,v)=>new Mf({valueType:g,keyType:w,typeName:ut.ZodMap,...wt(v)});class El extends It{_parse(g){const{status:v,ctx:I}=this._processInputParams(g);if(I.parsedType!==Xe.set)return We(I,{code:je.invalid_type,expected:Xe.set,received:I.parsedType}),ct;const z=this._def;z.minSize!==null&&I.data.size<z.minSize.value&&(We(I,{code:je.too_small,minimum:z.minSize.value,type:"set",inclusive:!0,exact:!1,message:z.minSize.message}),v.dirty()),z.maxSize!==null&&I.data.size>z.maxSize.value&&(We(I,{code:je.too_big,maximum:z.maxSize.value,type:"set",inclusive:!0,exact:!1,message:z.maxSize.message}),v.dirty());const B=this._def.valueType;function P(ye){const be=new Set;for(const Re of ye){if(Re.status==="aborted")return ct;Re.status==="dirty"&&v.dirty(),be.add(Re.value)}return{status:v.value,value:be}}const o=[...I.data.values()].map((ye,be)=>B._parse(new Ma(I,ye,I.path,be)));return I.common.async?Promise.all(o).then(ye=>P(ye)):P(o)}min(g,v){return new El({...this._def,minSize:{value:g,message:Qe.toString(v)}})}max(g,v){return new El({...this._def,maxSize:{value:g,message:Qe.toString(v)}})}size(g,v){return this.min(g,v).max(g,v)}nonempty(g){return this.min(1,g)}}El.create=(w,g)=>new El({valueType:w,minSize:null,maxSize:null,typeName:ut.ZodSet,...wt(g)});class Al extends It{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:v}=this._processInputParams(g);if(v.parsedType!==Xe.function)return We(v,{code:je.invalid_type,expected:Xe.function,received:v.parsedType}),ct;function I(o,ye){return Jh({data:o,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,Kh(),Ml].filter(be=>!!be),issueData:{code:je.invalid_arguments,argumentsError:ye}})}function z(o,ye){return Jh({data:o,path:v.path,errorMaps:[v.common.contextualErrorMap,v.schemaErrorMap,Kh(),Ml].filter(be=>!!be),issueData:{code:je.invalid_return_type,returnTypeError:ye}})}const B={errorMap:v.common.contextualErrorMap},P=v.data;if(this._def.returns instanceof zl){const o=this;return wr(async function(...ye){const be=new Yr([]),Re=await o._def.args.parseAsync(ye,B).catch(ce=>{throw be.addIssue(I(ye,ce)),be}),Ve=await Reflect.apply(P,this,Re);return await o._def.returns._def.type.parseAsync(Ve,B).catch(ce=>{throw be.addIssue(z(Ve,ce)),be})})}else{const o=this;return wr(function(...ye){const be=o._def.args.safeParse(ye,B);if(!be.success)throw new Yr([I(ye,be.error)]);const Re=Reflect.apply(P,this,be.data),Ve=o._def.returns.safeParse(Re,B);if(!Ve.success)throw new Yr([z(Re,Ve.error)]);return Ve.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new Al({...this._def,args:Jn.create(g).rest(xo.create())})}returns(g){return new Al({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,v,I){return new Al({args:g||Jn.create([]).rest(xo.create()),returns:v||xo.create(),typeName:ut.ZodFunction,...wt(I)})}}class Cf extends It{get schema(){return this._def.getter()}_parse(g){const{ctx:v}=this._processInputParams(g);return this._def.getter()._parse({data:v.data,path:v.path,parent:v})}}Cf.create=(w,g)=>new Cf({getter:w,typeName:ut.ZodLazy,...wt(g)});class If extends It{_parse(g){if(g.data!==this._def.value){const v=this._getOrReturnCtx(g);return We(v,{received:v.data,code:je.invalid_literal,expected:this._def.value}),ct}return{status:"valid",value:g.data}}get value(){return this._def.value}}If.create=(w,g)=>new If({value:w,typeName:ut.ZodLiteral,...wt(g)});function Ef(w,g){return new bo({values:w,typeName:ut.ZodEnum,...wt(g)})}class bo extends It{_parse(g){if(typeof g.data!="string"){const v=this._getOrReturnCtx(g),I=this._def.values;return We(v,{expected:kt.joinValues(I),received:v.parsedType,code:je.invalid_type}),ct}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(g.data)){const v=this._getOrReturnCtx(g),I=this._def.values;return We(v,{received:v.data,code:je.invalid_enum_value,options:I}),ct}return wr(g.data)}get options(){return this._def.values}get enum(){const g={};for(const v of this._def.values)g[v]=v;return g}get Values(){const g={};for(const v of this._def.values)g[v]=v;return g}get Enum(){const g={};for(const v of this._def.values)g[v]=v;return g}extract(g,v=this._def){return bo.create(g,{...this._def,...v})}exclude(g,v=this._def){return bo.create(this.options.filter(I=>!g.includes(I)),{...this._def,...v})}}bo.create=Ef;class Af extends It{_parse(g){const v=kt.getValidEnumValues(this._def.values),I=this._getOrReturnCtx(g);if(I.parsedType!==Xe.string&&I.parsedType!==Xe.number){const z=kt.objectValues(v);return We(I,{expected:kt.joinValues(z),received:I.parsedType,code:je.invalid_type}),ct}if(this._cache||(this._cache=new Set(kt.getValidEnumValues(this._def.values))),!this._cache.has(g.data)){const z=kt.objectValues(v);return We(I,{received:I.data,code:je.invalid_enum_value,options:z}),ct}return wr(g.data)}get enum(){return this._def.values}}Af.create=(w,g)=>new Af({values:w,typeName:ut.ZodNativeEnum,...wt(g)});class zl extends It{unwrap(){return this._def.type}_parse(g){const{ctx:v}=this._processInputParams(g);if(v.parsedType!==Xe.promise&&v.common.async===!1)return We(v,{code:je.invalid_type,expected:Xe.promise,received:v.parsedType}),ct;const I=v.parsedType===Xe.promise?v.data:Promise.resolve(v.data);return wr(I.then(z=>this._def.type.parseAsync(z,{path:v.path,errorMap:v.common.contextualErrorMap})))}}zl.create=(w,g)=>new zl({type:w,typeName:ut.ZodPromise,...wt(g)});class wo extends It{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===ut.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:v,ctx:I}=this._processInputParams(g),z=this._def.effect||null,B={addIssue:P=>{We(I,P),P.fatal?v.abort():v.dirty()},get path(){return I.path}};if(B.addIssue=B.addIssue.bind(B),z.type==="preprocess"){const P=z.transform(I.data,B);if(I.common.async)return Promise.resolve(P).then(async o=>{if(v.value==="aborted")return ct;const ye=await this._def.schema._parseAsync({data:o,path:I.path,parent:I});return ye.status==="aborted"?ct:ye.status==="dirty"||v.value==="dirty"?Cl(ye.value):ye});{if(v.value==="aborted")return ct;const o=this._def.schema._parseSync({data:P,path:I.path,parent:I});return o.status==="aborted"?ct:o.status==="dirty"||v.value==="dirty"?Cl(o.value):o}}if(z.type==="refinement"){const P=o=>{const ye=z.refinement(o,B);if(I.common.async)return Promise.resolve(ye);if(ye 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"?ct:(o.status==="dirty"&&v.dirty(),P(o.value),{status:v.value,value:o.value})}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(o=>o.status==="aborted"?ct:(o.status==="dirty"&&v.dirty(),P(o.value).then(()=>({status:v.value,value:o.value}))))}if(z.type==="transform")if(I.common.async===!1){const P=this._def.schema._parseSync({data:I.data,path:I.path,parent:I});if(!_o(P))return ct;const o=z.transform(P.value,B);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:v.value,value:o}}else return this._def.schema._parseAsync({data:I.data,path:I.path,parent:I}).then(P=>_o(P)?Promise.resolve(z.transform(P.value,B)).then(o=>({status:v.value,value:o})):ct);kt.assertNever(z)}}wo.create=(w,g,v)=>new wo({schema:w,typeName:ut.ZodEffects,effect:g,...wt(v)}),wo.createWithPreprocess=(w,g,v)=>new wo({schema:g,effect:{type:"preprocess",transform:w},typeName:ut.ZodEffects,...wt(v)});class Ea extends It{_parse(g){return this._getType(g)===Xe.undefined?wr(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}Ea.create=(w,g)=>new Ea({innerType:w,typeName:ut.ZodOptional,...wt(g)});class To extends It{_parse(g){return this._getType(g)===Xe.null?wr(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}To.create=(w,g)=>new To({innerType:w,typeName:ut.ZodNullable,...wt(g)});class rd extends It{_parse(g){const{ctx:v}=this._processInputParams(g);let I=v.data;return v.parsedType===Xe.undefined&&(I=this._def.defaultValue()),this._def.innerType._parse({data:I,path:v.path,parent:v})}removeDefault(){return this._def.innerType}}rd.create=(w,g)=>new rd({innerType:w,typeName:ut.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...wt(g)});class nd extends It{_parse(g){const{ctx:v}=this._processInputParams(g),I={...v,common:{...v.common,issues:[]}},z=this._def.innerType._parse({data:I.data,path:I.path,parent:{...I}});return uu(z)?z.then(B=>({status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new Yr(I.common.issues)},input:I.data})})):{status:"valid",value:z.status==="valid"?z.value:this._def.catchValue({get error(){return new Yr(I.common.issues)},input:I.data})}}removeCatch(){return this._def.innerType}}nd.create=(w,g)=>new nd({innerType:w,typeName:ut.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...wt(g)});class zf extends It{_parse(g){if(this._getType(g)!==Xe.nan){const I=this._getOrReturnCtx(g);return We(I,{code:je.invalid_type,expected:Xe.nan,received:I.parsedType}),ct}return{status:"valid",value:g.data}}}zf.create=w=>new zf({typeName:ut.ZodNaN,...wt(w)});class vy extends It{_parse(g){const{ctx:v}=this._processInputParams(g),I=v.data;return this._def.type._parse({data:I,path:v.path,parent:v})}unwrap(){return this._def.type}}class ad extends It{_parse(g){const{status:v,ctx:I}=this._processInputParams(g);if(I.common.async)return(async()=>{const B=await this._def.in._parseAsync({data:I.data,path:I.path,parent:I});return B.status==="aborted"?ct:B.status==="dirty"?(v.dirty(),Cl(B.value)):this._def.out._parseAsync({data:B.value,path:I.path,parent:I})})();{const z=this._def.in._parseSync({data:I.data,path:I.path,parent:I});return z.status==="aborted"?ct:z.status==="dirty"?(v.dirty(),{status:"dirty",value:z.value}):this._def.out._parseSync({data:z.value,path:I.path,parent:I})}}static create(g,v){return new ad({in:g,out:v,typeName:ut.ZodPipeline})}}class sd extends It{_parse(g){const v=this._def.innerType._parse(g),I=z=>(_o(z)&&(z.value=Object.freeze(z.value)),z);return uu(v)?v.then(z=>I(z)):I(v)}unwrap(){return this._def.innerType}}sd.create=(w,g)=>new sd({innerType:w,typeName:ut.ZodReadonly,...wt(g)});var ut;(function(w){w.ZodString="ZodString",w.ZodNumber="ZodNumber",w.ZodNaN="ZodNaN",w.ZodBigInt="ZodBigInt",w.ZodBoolean="ZodBoolean",w.ZodDate="ZodDate",w.ZodSymbol="ZodSymbol",w.ZodUndefined="ZodUndefined",w.ZodNull="ZodNull",w.ZodAny="ZodAny",w.ZodUnknown="ZodUnknown",w.ZodNever="ZodNever",w.ZodVoid="ZodVoid",w.ZodArray="ZodArray",w.ZodObject="ZodObject",w.ZodUnion="ZodUnion",w.ZodDiscriminatedUnion="ZodDiscriminatedUnion",w.ZodIntersection="ZodIntersection",w.ZodTuple="ZodTuple",w.ZodRecord="ZodRecord",w.ZodMap="ZodMap",w.ZodSet="ZodSet",w.ZodFunction="ZodFunction",w.ZodLazy="ZodLazy",w.ZodLiteral="ZodLiteral",w.ZodEnum="ZodEnum",w.ZodEffects="ZodEffects",w.ZodNativeEnum="ZodNativeEnum",w.ZodOptional="ZodOptional",w.ZodNullable="ZodNullable",w.ZodDefault="ZodDefault",w.ZodCatch="ZodCatch",w.ZodPromise="ZodPromise",w.ZodBranded="ZodBranded",w.ZodPipeline="ZodPipeline",w.ZodReadonly="ZodReadonly"})(ut||(ut={}));const od=Ca.create,hn=yo.create,by=ed.create,wy=td.create;xo.create,Ia.create;const ld=Rn.create,Aa=bi.create;du.create,pu.create;const kf=Jn.create,Ty=Al.create;bo.create;const Sy=zl.create;Ea.create,To.create,Aa({pin:Aa({fade:by().optional(),maxCount:hn().optional(),maxZoom:hn().optional()}).optional(),animation:Aa({queue:Aa({limit:hn().optional()}).optional()}).optional()});const Rf=Aa({id:od().min(1),rank:hn(),lat:hn().min(-90).max(90),lng:hn().min(-180).max(180),width:hn().min(56),height:hn().min(56)}),Py=kf([hn(),ld(kf([hn(),hn()]))]),Df=Ty().args(od()).returns(Sy(wy())),My=Aa({data:Rf,state:Py,callbacks:Aa({body:Df,pin:Df.optional()})}),Cy=ld(My);Aa({key:od(),data:ld(Rf)});class Lf{constructor(g,v){lt(this,"mapMarkerCallback");lt(this,"map");lt(this,"mapConfiguration",null);lt(this,"mapPopupDataArray",new Array);lt(this,"mapPopupDataMap",new Map);lt(this,"mapPopupDataUpdating",!1);this.mapMarkerCallback=v,this.map=g,this.map.on("load",this.onMapLoad.bind(this)),this.setConfiguration(null)}setConfiguration(g){var v,I;this.mapConfiguration=g,(I=(v=g==null?void 0:g.animation)==null?void 0:v.queue)!=null&&I.limit?Kn.setLimit(g.animation.queue.limit):Kn.setLimit(8*navigator.hardwareConcurrency)}setColors(g,v,I){const z=this.map.getContainer();z.style.setProperty("--map-style-primary",g),z.style.setProperty("--map-style-background",v),z.style.setProperty("--map-style-text",I)}async updatePopups(g){try{await Cy.parseAsync(g),await this.updatePopupData(g)}catch(v){throw console.error(v),cu("[Error] Failed to update popups",{message:v.message,stack:v.stack}),v}}removePopups(){try{this.removePopupData()}catch(g){throw console.error(g),cu("[Error] Failed to remove popups",{message:g.message,stack:g.stack}),g}}togglePopups(g){try{this.togglePopupData(g)}catch(v){throw console.error(v),cu("[Error] Failed to toggle popups",{message:v.message,stack:v.stack}),v}}onMapLoad(){this.processPopupDataCallback()}processPopupDataCallback(){if(!this.map._removed)try{this.processPopupData(),window.setTimeout(this.processPopupDataCallback.bind(this),25)}catch(g){console.error(g),cu("[Error] Failed to process popups",{message:g.message,stack:g.stack})}}processPopupData(){var Re,Ve,Ae,ce,Be,Rt;if(this.mapPopupDataArray.length==0||this.mapPopupDataUpdating)return;const g=this.map.getZoom();if(!g)return;const v=this.map.getCanvas().width,I=this.map.getCanvas().height,z=ff,B=new mf(this.map,-z,I+z,v+z,-z),P=new mf(this.map,0,I,v,0);let o=0,ye=((Ve=(Re=this.mapConfiguration)==null?void 0:Re.pin)==null?void 0:Ve.maxCount)??Math.max(G_,8*navigator.hardwareConcurrency),be=((ce=(Ae=this.mapConfiguration)==null?void 0:Ae.pin)==null?void 0:ce.maxZoom)??$_;for(const ft of this.mapPopupDataArray){const di=ft.supressed?-1:g,Dt=ft.circle;P.contains(Dt.lat,Dt.lng)?di<=Dt.zoom&&Dt.zoom<=g+be?(o<ye&&(((Rt=(Be=this.mapConfiguration)==null?void 0:Be.pin)==null?void 0:Rt.fade)==!0?Dt.updateState(g):Dt.setExpanded(),Dt.updateMap(this.map),Dt.isPinLoaded()==!1&&Dt.updatePin()),o++):(Dt.setCollapsed(),Dt.isCollapsed()&&Dt.updateMap(null)):Dt.updateMap(null);const Lt=ft.marker;B.contains(Lt.lat,Lt.lng)?Lt.zoom<=di?(Lt.updateState(g),Lt.setCollapsed(!1),Lt.updateMap(this.map),Lt.isExpanded()&&Lt.isBodyLoaded()==!1&&Lt.updateBody()):(Lt.setCollapsed(!0),Lt.isCollapsed()&&Lt.updateMap(null)):Lt.updateMap(null)}}async updatePopupData(g){try{this.mapPopupDataUpdating=!0;const v=new Map(g.map(z=>[z.data.id,new Bf(z)])),I=Array.from(this.mapPopupDataArray);for(const z of I)v.has(z.id)==!1&&(z.remove(),this.mapPopupDataMap.delete(z.id),this.mapPopupDataArray.splice(this.mapPopupDataArray.indexOf(z),1));for(const z of g){const B=this.mapPopupDataMap.get(z.data.id);if(B)B.update(z);else{const P=new Bf(z);P.create(this.mapMarkerCallback),this.mapPopupDataMap.set(z.data.id,P),this.mapPopupDataArray.push(P)}}this.mapPopupDataArray.sort((z,B)=>z.zoom-B.zoom)}catch(v){throw console.error(v),this.mapPopupDataArray.length=0,this.mapPopupDataMap.clear(),v}finally{this.mapPopupDataUpdating=!1}}removePopupData(){try{this.mapPopupDataUpdating=!0,this.mapPopupDataArray.forEach(g=>g.remove()),this.mapPopupDataArray.length=0,this.mapPopupDataMap.clear()}catch(g){throw console.error(g),this.mapPopupDataArray.forEach(v=>v.remove()),this.mapPopupDataArray.length=0,this.mapPopupDataMap.clear(),g}finally{this.mapPopupDataUpdating=!1}}togglePopupData(g){g.forEach(v=>{const I=this.mapPopupDataMap.get(v.id);I&&(I.supressed=!v.toggled)})}}class Ff{constructor(g){lt(this,"id");lt(this,"lat");lt(this,"lng");lt(this,"zoom");lt(this,"element");lt(this,"component");lt(this,"libreMarker");this.id=g.data.id,this.lat=g.data.lat,this.lng=g.data.lng,this.zoom=g.state[0]}create(g){this.createElement(),this.createLibreMarker(g),this.updateZIndex()}createElement(){throw new Error("Create element not implemented")}createLibreMarker(g){const v=this.element;if(!v)throw new Error("Failed to create libre marker");const I=g({element:v});I.setLngLat([this.lng,this.lat]),this.libreMarker=I}update(g){this.zoom=g.state[0],this.updateZIndex()}updateZIndex(){throw new Error("Update z-index not implemented")}updateMap(g){const v=this.libreMarker,I=this.component;if(v==null||I==null)throw new Error("Failed to update popup map");g?v._map!=g&&v.addTo(g):v._map!=null&&v.remove()}isInBlock(g,v){return this.zoom<=g&&v.contains(this.lat,this.lng)}remove(){var g,v;(g=this.libreMarker)==null||g.remove(),(v=this.element)==null||v.remove()}}class Iy extends Ff{constructor(v){super(v);lt(this,"pinLoading",!1);lt(this,"pinLoaded",!1);lt(this,"pinCallback");this.pinCallback=v.callbacks.pin}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=Vh(Y_,{target:this.element,props:{id:this.id+"_circle",priority:this.zoom*ou}})}updateZIndex(){const v=this.element;if(!v)return;const I=Math.round((Xh-this.zoom)*ou);v.style.zIndex=I.toString()}updateMap(v){var I;super.updateMap(v),(I=this.component)==null||I.setDisplayed(v!=null)}updateState(v){const I=this.component;if(!I)throw new Error("Failed to update circle state");I.setScale(this.getScale(v))}updatePin(){var I;if(this.pinCallback==null||this.pinLoaded||this.pinLoading)return;const v=(I=this.component)==null?void 0:I.getBody();v!=null&&(this.pinLoading=!0,this.pinCallback(this.id).then(z=>{v.appendChild(z),this.pinLoaded=!0,this.pinLoading=!1}))}setExpanded(){if(this.component==null)throw new Error("Failed to set circle expanded");this.component.setScale(1)}setCollapsed(){if(this.component==null)throw new Error("Failed to set circle collapsed");this.component.setScale(0)}getScale(v){return this.zoom<v?1:Math.max(0,1-(this.zoom-v)*.125)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isPinLoaded(){return this.pinCallback==null||this.pinLoaded}}class Ey extends Ff{constructor(v){super(v);lt(this,"width");lt(this,"height");lt(this,"states");lt(this,"bodyLoading",!1);lt(this,"bodyLoaded",!1);lt(this,"bodyCallback");this.id=v.data.id,this.width=v.data.width,this.height=v.data.height,this.states=v.state[1].map(I=>[I[0],lu.DEGREES[I[1]]]),this.bodyCallback=v.callbacks.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=Vh(H_,{target:this.element,props:{id:this.id+"_marker",priority:this.zoom*ou,width:this.width,height:this.height}})}update(v){super.update(v),this.states=v.state[1].map(I=>[I[0],lu.DEGREES[I[1]]])}updateZIndex(){const v=this.element;if(!v)return;const I=Math.round((Xh-this.zoom)*ou)+U_;v.style.zIndex=I.toString()}updateMap(v){var I;super.updateMap(v),(I=this.component)==null||I.setDisplayed(v!=null)}updateState(v){const I=this.component;if(!I)throw new Error("Failed to update marker state");I.setAngle(this.getAngle(v))}updateBody(){var I;if(this.bodyLoaded||this.bodyLoading)return;const v=(I=this.component)==null?void 0:I.getBody();v!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(z=>{v.appendChild(z),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(v){const I=this.states.findLast(z=>z[0]<=v);if(!I)throw new Error("Angle not found");return I[1]}setCollapsed(v){if(this.component==null)throw new Error("Failed to set marker collapsed");this.component.setCollapsed(v)}isExpanded(){return this.component?this.component.getExpanded():!1}isCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class Bf{constructor(g){lt(this,"id");lt(this,"rank");lt(this,"lat");lt(this,"lng");lt(this,"zoom");lt(this,"supressed");lt(this,"circle");lt(this,"marker");this.id=g.data.id,this.rank=g.data.rank,this.lat=g.data.lat,this.lng=g.data.lng,this.zoom=g.state[0],this.supressed=!1,this.circle=new Iy(g),this.marker=new Ey(g)}create(g){this.circle.create(g),this.marker.create(g)}update(g){this.circle.update(g),this.marker.update(g)}remove(){this.circle.remove(),this.marker.remove()}}function Ay(w){return w&&w.__esModule&&Object.prototype.hasOwnProperty.call(w,"default")?w.default:w}var fu={exports:{}};/**
|
|
3
|
-
* MapLibre GL JS
|
|
4
|
-
* @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.6.0/LICENSE.txt
|
|
5
|
-
*/var zy=fu.exports,Of;function ky(){return Of||(Of=1,function(w,g){(function(v,I){w.exports=I()})(zy,function(){var v={},I={};function z(P,o,ye){if(I[P]=ye,P==="index"){var be="var sharedModule = {}; ("+I.shared+")(sharedModule); ("+I.worker+")(sharedModule);",Re={};return I.shared(Re),I.index(v,Re),typeof window<"u"&&v.setWorkerUrl(window.URL.createObjectURL(new Blob([be],{type:"text/javascript"}))),v}}z("shared",["exports"],function(P){function o(n,t,r,a){return new(r||(r=Promise))(function(c,d){function p(b){try{y(a.next(b))}catch(S){d(S)}}function m(b){try{y(a.throw(b))}catch(S){d(S)}}function y(b){var S;b.done?c(b.value):(S=b.value,S instanceof r?S:new r(function(C){C(S)})).then(p,m)}y((a=a.apply(n,t||[])).next())})}function ye(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var be,Re;function Ve(){if(Re)return be;function n(t,r){this.x=t,this.y=r}return Re=1,be=n,n.prototype={clone:function(){return new n(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,r){return this.clone()._rotateAround(t,r)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var r=t.x-this.x,a=t.y-this.y;return r*r+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,r){return Math.atan2(this.x*r-this.y*t,this.x*t+this.y*r)},_matMult:function(t){var r=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=r,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var r=Math.cos(t),a=Math.sin(t),c=a*this.x+r*this.y;return this.x=r*this.x-a*this.y,this.y=c,this},_rotateAround:function(t,r){var a=Math.cos(t),c=Math.sin(t),d=r.y+c*(this.x-r.x)+a*(this.y-r.y);return this.x=r.x+a*(this.x-r.x)-c*(this.y-r.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},n.convert=function(t){return t instanceof n?t:Array.isArray(t)?new n(t[0],t[1]):t},be}typeof SuppressedError=="function"&&SuppressedError;var Ae,ce,Be=ye(Ve()),Rt=function(){if(ce)return Ae;function n(t,r,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=a,this.p2y=c}return ce=1,Ae=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<r)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<r));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},Ae}(),ft=ye(Rt);let di,Dt;function Lt(){return di==null&&(di=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),di}function li(){if(Dt==null&&(Dt=!1,Lt())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let a=0;a<5*5;a++){const c=4*a;t.fillStyle=`rgb(${c},${c+1},${c+2})`,t.fillRect(a%5,Math.floor(a/5),1,1)}const r=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&r[a]!==a){Dt=!0;break}}}return Dt||!1}var Ft=1e-6,jt=typeof Float32Array<"u"?Float32Array:Array;function hr(){var n=new jt(9);return jt!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[5]=0,n[6]=0,n[7]=0),n[0]=1,n[4]=1,n[8]=1,n}function ea(n){return n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n}function dn(){var n=new jt(3);return jt!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n}function Kr(n){return Math.hypot(n[0],n[1],n[2])}function pn(n,t,r){var a=new jt(3);return a[0]=n,a[1]=t,a[2]=r,a}function Tr(n,t,r){return n[0]=t[0]+r[0],n[1]=t[1]+r[1],n[2]=t[2]+r[2],n}function qi(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n[2]=t[2]*r,n}function Jr(n,t,r){var a=t[0],c=t[1],d=t[2],p=r[0],m=r[1],y=r[2];return n[0]=c*y-d*m,n[1]=d*p-a*y,n[2]=a*m-c*p,n}Math.hypot||(Math.hypot=function(){for(var n=0,t=arguments.length;t--;)n+=arguments[t]*arguments[t];return Math.sqrt(n)});var dr,St=Kr;function zi(n,t,r){var a=t[0],c=t[1],d=t[2],p=t[3];return n[0]=r[0]*a+r[4]*c+r[8]*d+r[12]*p,n[1]=r[1]*a+r[5]*c+r[9]*d+r[13]*p,n[2]=r[2]*a+r[6]*c+r[10]*d+r[14]*p,n[3]=r[3]*a+r[7]*c+r[11]*d+r[15]*p,n}function Lr(){var n=new jt(4);return jt!=Float32Array&&(n[0]=0,n[1]=0,n[2]=0),n[3]=1,n}function tr(n,t,r,a){var c=.5*Math.PI/180;t*=c,r*=c,a*=c;var d=Math.sin(t),p=Math.cos(t),m=Math.sin(r),y=Math.cos(r),b=Math.sin(a),S=Math.cos(a);return n[0]=d*y*S-p*m*b,n[1]=p*m*S+d*y*b,n[2]=p*y*b-d*m*S,n[3]=p*y*S+d*m*b,n}function Fr(){var n=new jt(2);return jt!=Float32Array&&(n[0]=0,n[1]=0),n}function Wi(n,t){var r=new jt(2);return r[0]=n,r[1]=t,r}dn(),dr=new jt(4),jt!=Float32Array&&(dr[0]=0,dr[1]=0,dr[2]=0,dr[3]=0),dn(),pn(1,0,0),pn(0,1,0),Lr(),Lr(),hr(),Fr();const At=8192;function pr(n,t,r){return t*(At/(n.tileSize*Math.pow(2,r-n.tileID.overscaledZ)))}function ir(n,t){return(n%t+t)%t}function Qr(n,t,r){return n*(1-r)+t*r}function Br(n){if(n<=0)return 0;if(n>=1)return 1;const t=n*n,r=t*n;return 4*(n<.5?r:3*(n-t)+r-.75)}function Or(n,t,r,a){const c=new ft(n,t,r,a);return d=>c.solve(d)}const ka=Or(.25,.1,.25,1);function ci(n,t,r){return Math.min(r,Math.max(t,n))}function Dn(n,t,r){const a=r-t,c=((n-t)%a+a)%a+t;return c===t?r:c}function Hi(n,...t){for(const r of t)for(const a in r)n[a]=r[a];return n}let gs=1;function ii(n,t,r){const a={};for(const c in n)a[c]=t.call(this,n[c],c,n);return a}function en(n,t,r){const a={};for(const c in n)t.call(this,n[c],c,n)&&(a[c]=n[c]);return a}function Sr(n){return Array.isArray(n)?n.map(Sr):typeof n=="object"&&n?ii(n,Sr):n}const Ra={};function ki(n){Ra[n]||(typeof console<"u"&&console.warn(n),Ra[n]=!0)}function fr(n,t,r){return(r.y-n.y)*(t.x-n.x)>(t.y-n.y)*(r.x-n.x)}function rr(n){return typeof WorkerGlobalScope<"u"&&n!==void 0&&n instanceof WorkerGlobalScope}let ta=null;function Ln(n){return typeof ImageBitmap<"u"&&n instanceof ImageBitmap}const _s="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function ia(n,t,r,a,c){return o(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(n,{timestamp:0});try{const p=d==null?void 0:d.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const m=p.startsWith("BGR"),y=new Uint8ClampedArray(a*c*4);if(yield d.copyTo(y,function(b,S,C,k,L){const F=4*Math.max(1,0),j=(Math.max(0,C)-C)*k*4+F,U=4*k,H=Math.max(0,S),se=Math.max(0,C);return{rect:{x:H,y:se,width:Math.min(b.width,S+k)-H,height:Math.min(b.height,C+L)-se},layout:[{offset:j,stride:U}]}}(n,t,r,a,c)),m)for(let b=0;b<y.length;b+=4){const S=y[b];y[b]=y[b+2],y[b+2]=S}return y}finally{d.close()}})}let fn,ra;function mn(n,t,r,a){return n.addEventListener(t,r,a),{unsubscribe:()=>{n.removeEventListener(t,r,a)}}}function mr(n){return n*Math.PI/180}function tn(n){return n/Math.PI*180}const ys={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Mo={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},gn="AbortError";function he(){return new Error(gn)}const N={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function V(n){return N.REGISTERED_PROTOCOLS[n.substring(0,n.indexOf("://"))]}const G="global-dispatcher";class Q extends Error{constructor(t,r,a,c){super(`AJAXError: ${r} (${t}): ${a}`),this.status=t,this.statusText=r,this.url=a,this.body=c}}const ae=()=>rr(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,ue=function(n,t){if(/:\/\//.test(n.url)&&!/^https?:|^file:/.test(n.url)){const a=V(n.url);if(a)return a(n,t);if(rr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,targetMapId:G},t)}if(!(/^file:/.test(r=n.url)||/^file:/.test(ae())&&!/^\w+:/.test(r))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(a,c){return o(this,void 0,void 0,function*(){const d=new Request(a.url,{method:a.method||"GET",body:a.body,credentials:a.credentials,headers:a.headers,cache:a.cache,referrer:ae(),signal:c.signal});let p,m;a.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{p=yield fetch(d)}catch(b){throw new Q(0,b.message,a.url,new Blob)}if(!p.ok){const b=yield p.blob();throw new Q(p.status,p.statusText,a.url,b)}m=a.type==="arrayBuffer"||a.type==="image"?p.arrayBuffer():a.type==="json"?p.json():p.text();const y=yield m;if(c.signal.aborted)throw he();return{data:y,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(n,t);if(rr(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:n,mustQueue:!0,targetMapId:G},t)}var r;return function(a,c){return new Promise((d,p)=>{var m;const y=new XMLHttpRequest;y.open(a.method||"GET",a.url,!0),a.type!=="arrayBuffer"&&a.type!=="image"||(y.responseType="arraybuffer");for(const b in a.headers)y.setRequestHeader(b,a.headers[b]);a.type==="json"&&(y.responseType="text",!((m=a.headers)===null||m===void 0)&&m.Accept||y.setRequestHeader("Accept","application/json")),y.withCredentials=a.credentials==="include",y.onerror=()=>{p(new Error(y.statusText))},y.onload=()=>{if(!c.signal.aborted)if((y.status>=200&&y.status<300||y.status===0)&&y.response!==null){let b=y.response;if(a.type==="json")try{b=JSON.parse(y.response)}catch(S){return void p(S)}d({data:b,cacheControl:y.getResponseHeader("Cache-Control"),expires:y.getResponseHeader("Expires")})}else{const b=new Blob([y.response],{type:y.getResponseHeader("Content-Type")});p(new Q(y.status,y.statusText,a.url,b))}},c.signal.addEventListener("abort",()=>{y.abort(),p(he())}),y.send(a.body)})}(n,t)};function ge(n){if(!n||n.indexOf("://")<=0||n.indexOf("data:image/")===0||n.indexOf("blob:")===0)return!0;const t=new URL(n),r=window.location;return t.protocol===r.protocol&&t.host===r.host}function le(n,t,r){r[n]&&r[n].indexOf(t)!==-1||(r[n]=r[n]||[],r[n].push(t))}function Se(n,t,r){if(r&&r[n]){const a=r[n].indexOf(t);a!==-1&&r[n].splice(a,1)}}class we{constructor(t,r={}){Hi(this,r),this.type=t}}class de extends we{constructor(t,r={}){super("error",Hi({error:t},r))}}class Me{on(t,r){return this._listeners=this._listeners||{},le(t,r,this._listeners),{unsubscribe:()=>{this.off(t,r)}}}off(t,r){return Se(t,r,this._listeners),Se(t,r,this._oneTimeListeners),this}once(t,r){return r?(this._oneTimeListeners=this._oneTimeListeners||{},le(t,r,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,r){typeof t=="string"&&(t=new we(t,r||{}));const a=t.type;if(this.listens(a)){t.target=this;const c=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const m of c)m.call(this,t);const d=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const m of d)Se(a,m,this._oneTimeListeners),m.call(this,t);const p=this._eventedParent;p&&(Hi(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof de&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,r){return this._eventedParent=t,this._eventedParentData=r,this}}var ne={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},state:{type:"state",default:{}},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},"color-relief":{},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_color-relief","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"}},"layout_color-relief":{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_color-relief","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"numberArray",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-altitude":{type:"numberArray",default:45,minimum:0,maximum:90,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"colorArray",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"colorArray",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-method":{type:"enum",values:{standard:{},basic:{},combined:{},igor:{},multidirectional:{}},default:"standard",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},"paint_color-relief":{"color-relief-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"color-relief-color":{type:"color",transition:!1,expression:{interpolated:!0,parameters:["elevation"]},"property-type":"color-ramp"}},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 Ne=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function tt(n,t){const r={};for(const a in n)a!=="ref"&&(r[a]=n[a]);return Ne.forEach(a=>{a in t&&(r[a]=t[a])}),r}function Ue(n,t){if(Array.isArray(n)){if(!Array.isArray(t)||n.length!==t.length)return!1;for(let r=0;r<n.length;r++)if(!Ue(n[r],t[r]))return!1;return!0}if(typeof n=="object"&&n!==null&&t!==null){if(typeof t!="object"||Object.keys(n).length!==Object.keys(t).length)return!1;for(const r in n)if(!Ue(n[r],t[r]))return!1;return!0}return n===t}function Ye(n,t){n.push(t)}function nt(n,t,r){Ye(r,{command:"addSource",args:[n,t[n]]})}function Zt(n,t,r){Ye(t,{command:"removeSource",args:[n]}),r[n]=!0}function zt(n,t,r,a){Zt(n,r,a),nt(n,t,r)}function Pt(n,t,r){let a;for(a in n[r])if(Object.prototype.hasOwnProperty.call(n[r],a)&&a!=="data"&&!Ue(n[r][a],t[r][a]))return!1;for(a in t[r])if(Object.prototype.hasOwnProperty.call(t[r],a)&&a!=="data"&&!Ue(n[r][a],t[r][a]))return!1;return!0}function rt(n,t,r,a,c,d){n=n||{},t=t||{};for(const p in n)Object.prototype.hasOwnProperty.call(n,p)&&(Ue(n[p],t[p])||r.push({command:d,args:[a,p,t[p],c]}));for(const p in t)Object.prototype.hasOwnProperty.call(t,p)&&!Object.prototype.hasOwnProperty.call(n,p)&&(Ue(n[p],t[p])||r.push({command:d,args:[a,p,t[p],c]}))}function vt(n){return n.id}function wi(n,t){return n[t.id]=t,n}class De{constructor(t,r,a,c){this.message=(t?`${t}: `:"")+a,c&&(this.identifier=c),r!=null&&r.__line__&&(this.line=r.__line__)}}function Ri(n,...t){for(const r of t)for(const a in r)n[a]=r[a];return n}class Ht extends Error{constructor(t,r){super(r),this.message=r,this.key=t}}class Fn{constructor(t,r=[]){this.parent=t,this.bindings={};for(const[a,c]of r)this.bindings[a]=c}concat(t){return new Fn(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 na={kind:"null"},Oe={kind:"number"},ht={kind:"string"},dt={kind:"boolean"},gr={kind:"color"},Co={kind:"projectionDefinition"},rn={kind:"object"},pt={kind:"value"},_n={kind:"collator"},aa={kind:"formatted"},ui={kind:"padding"},xs={kind:"colorArray"},vs={kind:"numberArray"},yn={kind:"resolvedImage"},bs={kind:"variableAnchorOffsetCollection"};function _r(n,t){return{kind:"array",itemType:n,N:t}}function Xt(n){if(n.kind==="array"){const t=Xt(n.itemType);return typeof n.N=="number"?`array<${t}, ${n.N}>`:n.itemType.kind==="value"?"array":`array<${t}>`}return n.kind}const _u=[na,Oe,ht,dt,gr,Co,aa,rn,_r(pt),ui,vs,xs,yn,bs];function ws(n,t){if(t.kind==="error")return null;if(n.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!ws(n.itemType,t.itemType))&&(typeof n.N!="number"||n.N===t.N))return null}else{if(n.kind===t.kind)return null;if(n.kind==="value"){for(const r of _u)if(!ws(r,t))return null}}return`Expected ${Xt(n)} but found ${Xt(t)} instead.`}function Io(n,t){return t.some(r=>r.kind===n.kind)}function sa(n,t){return t.some(r=>r==="null"?n===null:r==="array"?Array.isArray(n):r==="object"?n&&!Array.isArray(n)&&typeof n=="object":r===typeof n)}function Bn(n,t){return n.kind==="array"&&t.kind==="array"?n.itemType.kind===t.itemType.kind&&typeof n.N=="number":n.kind===t.kind}const yu=.96422,xu=.82521,vu=4/29,Da=6/29,bu=3*Da*Da,wu=Da*Da*Da,Ts=Math.PI/180,ud=180/Math.PI;function Tu(n){return(n%=360)<0&&(n+=360),n}function La([n,t,r,a]){let c,d;const p=Ll((.2225045*(n=Dl(n))+.7168786*(t=Dl(t))+.0606169*(r=Dl(r)))/1);n===t&&t===r?c=d=p:(c=Ll((.4360747*n+.3850649*t+.1430804*r)/yu),d=Ll((.0139322*n+.0971045*t+.7141733*r)/xu));const m=116*p-16;return[m<0?0:m,500*(c-p),200*(p-d),a]}function Dl(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function Ll(n){return n>wu?Math.pow(n,1/3):n/bu+vu}function Su([n,t,r,a]){let c=(n+16)/116,d=isNaN(t)?c:c+t/500,p=isNaN(r)?c:c-r/200;return c=1*Ao(c),d=yu*Ao(d),p=xu*Ao(p),[Eo(3.1338561*d-1.6168667*c-.4906146*p),Eo(-.9787684*d+1.9161415*c+.033454*p),Eo(.0719453*d-.2289914*c+1.4052427*p),a]}function Eo(n){return(n=n<=.00304?12.92*n:1.055*Math.pow(n,1/2.4)-.055)<0?0:n>1?1:n}function Ao(n){return n>Da?n*n*n:bu*(n-vu)}const nn=Object.hasOwn||function(n,t){return Object.prototype.hasOwnProperty.call(n,t)};function mt(n,t){return nn(n,t)?n[t]:void 0}function xn(n){return parseInt(n.padEnd(2,n),16)/255}function vn(n,t){return oa(t?n/100:n,0,1)}function oa(n,t,r){return Math.min(Math.max(t,n),r)}function Fl(n){return!n.some(Number.isNaN)}const Bl={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]};function Pr(n,t,r){return n+r*(t-n)}function bn(n,t,r){return n.map((a,c)=>Pr(a,t[c],r))}class gt{constructor(t,r,a,c=1,d=!0){this.r=t,this.g=r,this.b=a,this.a=c,d||(this.r*=c,this.g*=c,this.b*=c,c||this.overwriteGetter("rgb",[t,r,a,c]))}static parse(t){if(t instanceof gt)return t;if(typeof t!="string")return;const r=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const c=mt(Bl,a);if(c){const[p,m,y]=c;return[p/255,m/255,y/255,1]}if(a.startsWith("#")&&/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(a)){const p=a.length<6?1:2;let m=1;return[xn(a.slice(m,m+=p)),xn(a.slice(m,m+=p)),xn(a.slice(m,m+=p)),xn(a.slice(m,m+p)||"ff")]}if(a.startsWith("rgb")){const p=a.match(/^rgba?\(\s*([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s+|\s*(,)\s*)([\de.+-]+)(%)?(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(p){const[m,y,b,S,C,k,L,F,j,U,H,se]=p,J=[S||" ",L||" ",U].join("");if(J===" "||J===" /"||J===",,"||J===",,,"){const D=[b,k,j].join(""),Z=D==="%%%"?100:D===""?255:0;if(Z){const te=[oa(+y/Z,0,1),oa(+C/Z,0,1),oa(+F/Z,0,1),H?vn(+H,se):1];if(Fl(te))return te}}return}}const d=a.match(/^hsla?\(\s*([\de.+-]+)(?:deg)?(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s+|\s*(,)\s*)([\de.+-]+)%(?:\s*([,\/])\s*([\de.+-]+)(%)?)?\s*\)$/);if(d){const[p,m,y,b,S,C,k,L,F]=d,j=[y||" ",S||" ",k].join("");if(j===" "||j===" /"||j===",,"||j===",,,"){const U=[+m,oa(+b,0,100),oa(+C,0,100),L?vn(+L,F):1];if(Fl(U))return function([H,se,J,D]){function Z(te){const me=(te+H/30)%12,Ce=se*Math.min(J,1-J);return J-Ce*Math.max(-1,Math.min(me-3,9-me,1))}return H=Tu(H),se/=100,J/=100,[Z(0),Z(8),Z(4),D]}(U)}}}(t);return r?new gt(...r,!1):void 0}get rgb(){const{r:t,g:r,b:a,a:c}=this,d=c||1/0;return this.overwriteGetter("rgb",[t/d,r/d,a/d,c])}get hcl(){return this.overwriteGetter("hcl",function(t){const[r,a,c,d]=La(t),p=Math.sqrt(a*a+c*c);return[Math.round(1e4*p)?Tu(Math.atan2(c,a)*ud):NaN,p,r,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",La(this.rgb))}overwriteGetter(t,r){return Object.defineProperty(this,t,{value:r}),r}toString(){const[t,r,a,c]=this.rgb;return`rgba(${[t,r,a].map(d=>Math.round(255*d)).join(",")},${c})`}static interpolate(t,r,a,c="rgb"){switch(c){case"rgb":{const[d,p,m,y]=bn(t.rgb,r.rgb,a);return new gt(d,p,m,y,!1)}case"hcl":{const[d,p,m,y]=t.hcl,[b,S,C,k]=r.hcl;let L,F;if(isNaN(d)||isNaN(b))isNaN(d)?isNaN(b)?L=NaN:(L=b,m!==1&&m!==0||(F=S)):(L=d,C!==1&&C!==0||(F=p));else{let J=b-d;b>d&&J>180?J-=360:b<d&&d-b>180&&(J+=360),L=d+a*J}const[j,U,H,se]=function([J,D,Z,te]){return J=isNaN(J)?0:J*Ts,Su([Z,Math.cos(J)*D,Math.sin(J)*D,te])}([L,F??Pr(p,S,a),Pr(m,C,a),Pr(y,k,a)]);return new gt(j,U,H,se,!1)}case"lab":{const[d,p,m,y]=Su(bn(t.lab,r.lab,a));return new gt(d,p,m,y,!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 Ss{constructor(t,r,a){this.sensitivity=t?r?"variant":"case":r?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,r){return this.collator.compare(t,r)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const zo=["bottom","center","top"];class Ol{constructor(t,r,a,c,d,p){this.text=t,this.image=r,this.scale=a,this.fontStack=c,this.textColor=d,this.verticalAlign=p}}class Vi{constructor(t){this.sections=t}static fromString(t){return new Vi([new Ol(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 Vi?t:Vi.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class pi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof pi)return t;if(typeof t=="number")return new pi([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const r of t)if(typeof r!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new pi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){return new pi(bn(t.values,r.values,a))}}class Zi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Zi)return t;if(typeof t=="number")return new Zi([t]);if(Array.isArray(t)){for(const r of t)if(typeof r!="number")return;return new Zi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){return new Zi(bn(t.values,r.values,a))}}class Ti{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Ti)return t;if(typeof t=="string"){const a=gt.parse(t);return a?new Ti([a]):void 0}if(!Array.isArray(t))return;const r=[];for(const a of t){if(typeof a!="string")return;const c=gt.parse(a);if(!c)return;r.push(c)}return new Ti(r)}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a,c="rgb"){const d=[];if(t.values.length!=r.values.length)throw new Error(`colorArray: Arrays have mismatched length (${t.values.length} vs. ${r.values.length}), cannot interpolate.`);for(let p=0;p<t.values.length;p++)d.push(gt.interpolate(t.values[p],r.values[p],a,c));return new Ti(d)}}class Yt extends Error{constructor(t){super(t),this.name="RuntimeError"}toJSON(){return this.message}}const ko=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class bt{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof bt)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let r=0;r<t.length;r+=2){const a=t[r],c=t[r+1];if(typeof a!="string"||!ko.has(a)||!Array.isArray(c)||c.length!==2||typeof c[0]!="number"||typeof c[1]!="number")return}return new bt(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,r,a){const c=t.values,d=r.values;if(c.length!==d.length)throw new Yt(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${r.toString()}`);const p=[];for(let m=0;m<c.length;m+=2){if(c[m]!==d[m])throw new Yt(`Cannot interpolate values containing mismatched anchors. from[${m}]: ${c[m]}, to[${m}]: ${d[m]}`);p.push(c[m]);const[y,b]=c[m+1],[S,C]=d[m+1];p.push([Pr(y,S,a),Pr(b,C,a)])}return new bt(p)}}class nr{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new nr({name:t,available:!1}):null}}class at{constructor(t,r,a){this.from=t,this.to=r,this.transition=a}static interpolate(t,r,a){return new at(t,r,a)}static parse(t){return t instanceof at?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new at(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new at(t.from,t.to,t.transition):typeof t=="string"?new at(t,t,1):void 0}}function st(n,t,r,a){return typeof n=="number"&&n>=0&&n<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof r=="number"&&r>=0&&r<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[n,t,r,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[n,t,r,a]:[n,t,r]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function la(n){if(n===null||typeof n=="string"||typeof n=="boolean"||typeof n=="number"||n instanceof at||n instanceof gt||n instanceof Ss||n instanceof Vi||n instanceof pi||n instanceof Zi||n instanceof Ti||n instanceof bt||n instanceof nr)return!0;if(Array.isArray(n)){for(const t of n)if(!la(t))return!1;return!0}if(typeof n=="object"){for(const t in n)if(!la(n[t]))return!1;return!0}return!1}function it(n){if(n===null)return na;if(typeof n=="string")return ht;if(typeof n=="boolean")return dt;if(typeof n=="number")return Oe;if(n instanceof gt)return gr;if(n instanceof at)return Co;if(n instanceof Ss)return _n;if(n instanceof Vi)return aa;if(n instanceof pi)return ui;if(n instanceof Zi)return vs;if(n instanceof Ti)return xs;if(n instanceof bt)return bs;if(n instanceof nr)return yn;if(Array.isArray(n)){const t=n.length;let r;for(const a of n){const c=it(a);if(r){if(r===c)continue;r=pt;break}r=c}return _r(r||pt,t)}return rn}function ca(n){const t=typeof n;return n===null?"":t==="string"||t==="number"||t==="boolean"?String(n):n instanceof gt||n instanceof at||n instanceof Vi||n instanceof pi||n instanceof Zi||n instanceof Ti||n instanceof bt||n instanceof nr?n.toString():JSON.stringify(n)}class Xi{constructor(t,r){this.type=t,this.value=r}static parse(t,r){if(t.length!==2)return r.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!la(t[1]))return r.error("invalid value");const a=t[1];let c=it(a);const d=r.expectedType;return c.kind!=="array"||c.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(c=d),new Xi(c,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const Fa={string:ht,number:Oe,boolean:dt,object:rn};class Mr{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a,c=1;const d=t[0];if(d==="array"){let m,y;if(t.length>2){const b=t[1];if(typeof b!="string"||!(b in Fa)||b==="object")return r.error('The item type argument of "array" must be one of string, number, boolean',1);m=Fa[b],c++}else m=pt;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return r.error('The length argument to "array" must be a positive integer literal',2);y=t[2],c++}a=_r(m,y)}else{if(!Fa[d])throw new Error(`Types doesn't contain name = ${d}`);a=Fa[d]}const p=[];for(;c<t.length;c++){const m=r.parse(t[c],c,pt);if(!m)return null;p.push(m)}return new Mr(a,p)}evaluate(t){for(let r=0;r<this.args.length;r++){const a=this.args[r].evaluate(t);if(!ws(this.type,it(a)))return a;if(r===this.args.length-1)throw new Yt(`Expected value to be of type ${Xt(this.type)}, but found ${Xt(it(a))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const jl={"to-boolean":dt,"to-color":gr,"to-number":Oe,"to-string":ht};class an{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const a=t[0];if(!jl[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&t.length!==2)return r.error("Expected one argument.");const c=jl[a],d=[];for(let p=1;p<t.length;p++){const m=r.parse(t[p],p,pt);if(!m)return null;d.push(m)}return new an(c,d)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let r,a;for(const c of this.args){if(r=c.evaluate(t),a=null,r instanceof gt)return r;if(typeof r=="string"){const d=t.parseColor(r);if(d)return d}else if(Array.isArray(r)&&(a=r.length<3||r.length>4?`Invalid rgba value ${JSON.stringify(r)}: expected an array containing either three or four numeric values.`:st(r[0],r[1],r[2],r[3]),!a))return new gt(r[0]/255,r[1]/255,r[2]/255,r[3])}throw new Yt(a||`Could not parse color from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"padding":{let r;for(const a of this.args){r=a.evaluate(t);const c=pi.parse(r);if(c)return c}throw new Yt(`Could not parse padding from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"numberArray":{let r;for(const a of this.args){r=a.evaluate(t);const c=Zi.parse(r);if(c)return c}throw new Yt(`Could not parse numberArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"colorArray":{let r;for(const a of this.args){r=a.evaluate(t);const c=Ti.parse(r);if(c)return c}throw new Yt(`Could not parse colorArray from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"variableAnchorOffsetCollection":{let r;for(const a of this.args){r=a.evaluate(t);const c=bt.parse(r);if(c)return c}throw new Yt(`Could not parse variableAnchorOffsetCollection from value '${typeof r=="string"?r:JSON.stringify(r)}'`)}case"number":{let r=null;for(const a of this.args){if(r=a.evaluate(t),r===null)return 0;const c=Number(r);if(!isNaN(c))return c}throw new Yt(`Could not convert ${JSON.stringify(r)} to number.`)}case"formatted":return Vi.fromString(ca(this.args[0].evaluate(t)));case"resolvedImage":return nr.fromString(ca(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return ca(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Pu=["Unknown","Point","LineString","Polygon"];class Mu{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache=new Map,this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?Pu[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let r=this._parseColorCache.get(t);return r||(r=gt.parse(t),this._parseColorCache.set(t,r)),r}}class Ps{constructor(t,r,a=[],c,d=new Fn,p=[]){this.registry=t,this.path=a,this.key=a.map(m=>`[${m}]`).join(""),this.scope=d,this.errors=p,this.expectedType=c,this._isConstant=r}parse(t,r,a,c,d={}){return r?this.concat(r,a,c)._parse(t,d):this._parse(t,d)}_parse(t,r){function a(c,d,p){return p==="assert"?new Mr(d,[c]):p==="coerce"?new an(d,[c]):c}if(t!==null&&typeof t!="string"&&typeof t!="boolean"&&typeof t!="number"||(t=["literal",t]),Array.isArray(t)){if(t.length===0)return this.error('Expected an array with at least one element. If you wanted a literal array, use ["literal", []].');const c=t[0];if(typeof c!="string")return this.error(`Expression name must be a string, but found ${typeof c} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[c];if(d){let p=d.parse(t,this);if(!p)return null;if(this.expectedType){const m=this.expectedType,y=p.type;if(m.kind!=="string"&&m.kind!=="number"&&m.kind!=="boolean"&&m.kind!=="object"&&m.kind!=="array"||y.kind!=="value"){if(m.kind==="projectionDefinition"&&["string","array"].includes(y.kind)||["color","formatted","resolvedImage"].includes(m.kind)&&["value","string"].includes(y.kind)||["padding","numberArray"].includes(m.kind)&&["value","number","array"].includes(y.kind)||m.kind==="colorArray"&&["value","string","array"].includes(y.kind)||m.kind==="variableAnchorOffsetCollection"&&["value","array"].includes(y.kind))p=a(p,m,r.typeAnnotation||"coerce");else if(this.checkSubtype(m,y))return null}else p=a(p,m,r.typeAnnotation||"assert")}if(!(p instanceof Xi)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const m=new Mu;try{p=new Xi(p.type,p.evaluate(m))}catch(y){return this.error(y.message),null}}return p}return this.error(`Unknown expression "${c}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,r,a){const c=typeof t=="number"?this.path.concat(t):this.path,d=a?this.scope.concat(a):this.scope;return new Ps(this.registry,this._isConstant,c,r||null,d,this.errors)}error(t,...r){const a=`${this.key}${r.map(c=>`[${c}]`).join("")}`;this.errors.push(new Ht(a,t))}checkSubtype(t,r){const a=ws(t,r);return a&&this.error(a),a}}class Ms{constructor(t,r){this.type=r.type,this.bindings=[].concat(t),this.result=r}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const r of this.bindings)t(r[1]);t(this.result)}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const a=[];for(let d=1;d<t.length-1;d+=2){const p=t[d];if(typeof p!="string")return r.error(`Expected string, but found ${typeof p} instead.`,d);if(/[^a-zA-Z0-9_]/.test(p))return r.error("Variable names must contain only alphanumeric characters or '_'.",d);const m=r.parse(t[d+1],d+1);if(!m)return null;a.push([p,m])}const c=r.parse(t[t.length-1],t.length-1,r.expectedType,a);return c?new Ms(a,c):null}outputDefined(){return this.result.outputDefined()}}class jr{constructor(t,r){this.type=r.type,this.name=t,this.boundExpression=r}static parse(t,r){if(t.length!==2||typeof t[1]!="string")return r.error("'var' expression requires exactly one string literal argument.");const a=t[1];return r.scope.has(a)?new jr(a,r.scope.get(a)):r.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class Si{constructor(t,r,a){this.type=t,this.index=r,this.input=a}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,Oe),c=r.parse(t[2],2,_r(r.expectedType||pt));return a&&c?new Si(c.type.itemType,a,c):null}evaluate(t){const r=this.index.evaluate(t),a=this.input.evaluate(t);if(r<0)throw new Yt(`Array index out of bounds: ${r} < 0.`);if(r>=a.length)throw new Yt(`Array index out of bounds: ${r} > ${a.length-1}.`);if(r!==Math.floor(r))throw new Yt(`Array index must be an integer, but found ${r} instead.`);return a[r]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Ba{constructor(t,r){this.type=dt,this.needle=t,this.haystack=r}static parse(t,r){if(t.length!==3)return r.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,pt),c=r.parse(t[2],2,pt);return a&&c?Io(a.type,[dt,ht,Oe,na,pt])?new Ba(a,c):r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xt(a.type)} instead`):null}evaluate(t){const r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!sa(r,["boolean","string","number","null"]))throw new Yt(`Expected first argument to be of type boolean, string, number or null, but found ${Xt(it(r))} instead.`);if(!sa(a,["string","array"]))throw new Yt(`Expected second argument to be of type array or string, but found ${Xt(it(a))} instead.`);return a.indexOf(r)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Cs{constructor(t,r,a){this.type=Oe,this.needle=t,this.haystack=r,this.fromIndex=a}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,pt),c=r.parse(t[2],2,pt);if(!a||!c)return null;if(!Io(a.type,[dt,ht,Oe,na,pt]))return r.error(`Expected first argument to be of type boolean, string, number or null, but found ${Xt(a.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,Oe);return d?new Cs(a,c,d):null}return new Cs(a,c)}evaluate(t){const r=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!sa(r,["boolean","string","number","null"]))throw new Yt(`Expected first argument to be of type boolean, string, number or null, but found ${Xt(it(r))} instead.`);let c;if(this.fromIndex&&(c=this.fromIndex.evaluate(t)),sa(a,["string"])){const d=a.indexOf(r,c);return d===-1?-1:[...a.slice(0,d)].length}if(sa(a,["array"]))return a.indexOf(r,c);throw new Yt(`Expected second argument to be of type array or string, but found ${Xt(it(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class Oa{constructor(t,r,a,c,d,p){this.inputType=t,this.type=r,this.input=a,this.cases=c,this.outputs=d,this.otherwise=p}static parse(t,r){if(t.length<5)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return r.error("Expected an even number of arguments.");let a,c;r.expectedType&&r.expectedType.kind!=="value"&&(c=r.expectedType);const d={},p=[];for(let b=2;b<t.length-1;b+=2){let S=t[b];const C=t[b+1];Array.isArray(S)||(S=[S]);const k=r.concat(b);if(S.length===0)return k.error("Expected at least one branch label.");for(const F of S){if(typeof F!="number"&&typeof F!="string")return k.error("Branch labels must be numbers or strings.");if(typeof F=="number"&&Math.abs(F)>Number.MAX_SAFE_INTEGER)return k.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof F=="number"&&Math.floor(F)!==F)return k.error("Numeric branch labels must be integer values.");if(a){if(k.checkSubtype(a,it(F)))return null}else a=it(F);if(d[String(F)]!==void 0)return k.error("Branch labels must be unique.");d[String(F)]=p.length}const L=r.parse(C,b,c);if(!L)return null;c=c||L.type,p.push(L)}const m=r.parse(t[1],1,pt);if(!m)return null;const y=r.parse(t[t.length-1],t.length-1,c);return y?m.type.kind!=="value"&&r.concat(1).checkSubtype(a,m.type)?null:new Oa(a,c,m,d,p,y):null}evaluate(t){const r=this.input.evaluate(t);return(it(r)===this.inputType&&this.outputs[this.cases[r]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class fi{constructor(t,r,a){this.type=t,this.branches=r,this.otherwise=a}static parse(t,r){if(t.length<4)return r.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return r.error("Expected an odd number of arguments.");let a;r.expectedType&&r.expectedType.kind!=="value"&&(a=r.expectedType);const c=[];for(let p=1;p<t.length-1;p+=2){const m=r.parse(t[p],p,dt);if(!m)return null;const y=r.parse(t[p+1],p+1,a);if(!y)return null;c.push([m,y]),a=a||y.type}const d=r.parse(t[t.length-1],t.length-1,a);if(!d)return null;if(!a)throw new Error("Can't infer output type");return new fi(a,c,d)}evaluate(t){for(const[r,a]of this.branches)if(r.evaluate(t))return a.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[r,a]of this.branches)t(r),t(a);t(this.otherwise)}outputDefined(){return this.branches.every(([t,r])=>r.outputDefined())&&this.otherwise.outputDefined()}}class Is{constructor(t,r,a,c){this.type=t,this.input=r,this.beginIndex=a,this.endIndex=c}static parse(t,r){if(t.length<=2||t.length>=5)return r.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=r.parse(t[1],1,pt),c=r.parse(t[2],2,Oe);if(!a||!c)return null;if(!Io(a.type,[_r(pt),ht,pt]))return r.error(`Expected first argument to be of type array or string, but found ${Xt(a.type)} instead`);if(t.length===4){const d=r.parse(t[3],3,Oe);return d?new Is(a.type,a,c,d):null}return new Is(a.type,a,c)}evaluate(t){const r=this.input.evaluate(t),a=this.beginIndex.evaluate(t);let c;if(this.endIndex&&(c=this.endIndex.evaluate(t)),sa(r,["string"]))return[...r].slice(a,c).join("");if(sa(r,["array"]))return r.slice(a,c);throw new Yt(`Expected first argument to be of type array or string, but found ${Xt(it(r))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function ja(n,t){const r=n.length-1;let a,c,d=0,p=r,m=0;for(;d<=p;)if(m=Math.floor((d+p)/2),a=n[m],c=n[m+1],a<=t){if(m===r||t<c)return m;d=m+1}else{if(!(a>t))throw new Yt("Input is not a number.");p=m-1}return 0}class Na{constructor(t,r,a){this.type=t,this.input=r,this.labels=[],this.outputs=[];for(const[c,d]of a)this.labels.push(c),this.outputs.push(d)}static parse(t,r){if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");const a=r.parse(t[1],1,Oe);if(!a)return null;const c=[];let d=null;r.expectedType&&r.expectedType.kind!=="value"&&(d=r.expectedType);for(let p=1;p<t.length;p+=2){const m=p===1?-1/0:t[p],y=t[p+1],b=p,S=p+1;if(typeof m!="number")return r.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',b);if(c.length&&c[c.length-1][0]>=m)return r.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',b);const C=r.parse(y,S,d);if(!C)return null;d=d||C.type,c.push([m,C])}return new Na(d,a,c)}evaluate(t){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=r[0])return a[0].evaluate(t);const d=r.length;return c>=r[d-1]?a[d-1].evaluate(t):a[ja(r,c)].evaluate(t)}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function hd(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var On,Es,Nl=function(){if(Es)return On;function n(t,r,a,c){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*r,this.by=3*(c-r)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=r,this.p2x=a,this.p2y=c}return Es=1,On=n,n.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,r){if(r===void 0&&(r=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,c=0;c<8;c++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<r)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,c=0;c<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<r));c++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,r){return this.sampleCurveY(this.solveCurveX(t,r))}},On}(),dd=hd(Nl);class Yi{constructor(t,r,a,c,d){this.type=t,this.operator=r,this.interpolation=a,this.input=c,this.labels=[],this.outputs=[];for(const[p,m]of d)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(t,r,a,c){let d=0;if(t.name==="exponential")d=Va(r,t.base,a,c);else if(t.name==="linear")d=Va(r,1,a,c);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new dd(p[0],p[1],p[2],p[3]).solve(Va(r,1,a,c))}return d}static parse(t,r){let[a,c,d,...p]=t;if(!Array.isArray(c)||c.length===0)return r.error("Expected an interpolation type expression.",1);if(c[0]==="linear")c={name:"linear"};else if(c[0]==="exponential"){const b=c[1];if(typeof b!="number")return r.error("Exponential interpolation requires a numeric base.",1,1);c={name:"exponential",base:b}}else{if(c[0]!=="cubic-bezier")return r.error(`Unknown interpolation type ${String(c[0])}`,1,0);{const b=c.slice(1);if(b.length!==4||b.some(S=>typeof S!="number"||S<0||S>1))return r.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);c={name:"cubic-bezier",controlPoints:b}}}if(t.length-1<4)return r.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return r.error("Expected an even number of arguments.");if(d=r.parse(d,2,Oe),!d)return null;const m=[];let y=null;a!=="interpolate-hcl"&&a!=="interpolate-lab"||r.expectedType==xs?r.expectedType&&r.expectedType.kind!=="value"&&(y=r.expectedType):y=gr;for(let b=0;b<p.length;b+=2){const S=p[b],C=p[b+1],k=b+3,L=b+4;if(typeof S!="number")return r.error('Input/output pairs for "interpolate" expressions must be defined using literal numeric values (not computed expressions) for the input values.',k);if(m.length&&m[m.length-1][0]>=S)return r.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',k);const F=r.parse(C,L,y);if(!F)return null;y=y||F.type,m.push([S,F])}return Bn(y,Oe)||Bn(y,Co)||Bn(y,gr)||Bn(y,ui)||Bn(y,vs)||Bn(y,xs)||Bn(y,bs)||Bn(y,_r(Oe))?new Yi(y,a,c,d,m):r.error(`Type ${Xt(y)} is not interpolatable.`)}evaluate(t){const r=this.labels,a=this.outputs;if(r.length===1)return a[0].evaluate(t);const c=this.input.evaluate(t);if(c<=r[0])return a[0].evaluate(t);const d=r.length;if(c>=r[d-1])return a[d-1].evaluate(t);const p=ja(r,c),m=Yi.interpolationFactor(this.interpolation,c,r[p],r[p+1]),y=a[p].evaluate(t),b=a[p+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Pr(y,b,m);case"color":return gt.interpolate(y,b,m);case"padding":return pi.interpolate(y,b,m);case"colorArray":return Ti.interpolate(y,b,m);case"numberArray":return Zi.interpolate(y,b,m);case"variableAnchorOffsetCollection":return bt.interpolate(y,b,m);case"array":return bn(y,b,m);case"projectionDefinition":return at.interpolate(y,b,m)}case"interpolate-hcl":switch(this.type.kind){case"color":return gt.interpolate(y,b,m,"hcl");case"colorArray":return Ti.interpolate(y,b,m,"hcl")}case"interpolate-lab":switch(this.type.kind){case"color":return gt.interpolate(y,b,m,"lab");case"colorArray":return Ti.interpolate(y,b,m,"lab")}}}eachChild(t){t(this.input);for(const r of this.outputs)t(r)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function Va(n,t,r,a){const c=a-r,d=n-r;return c===0?0:t===1?d/c:(Math.pow(t,d)-1)/(Math.pow(t,c)-1)}const yr={color:gt.interpolate,number:Pr,padding:pi.interpolate,numberArray:Zi.interpolate,colorArray:Ti.interpolate,variableAnchorOffsetCollection:bt.interpolate,array:bn};class ar{constructor(t,r){this.type=t,this.args=r}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");let a=null;const c=r.expectedType;c&&c.kind!=="value"&&(a=c);const d=[];for(const m of t.slice(1)){const y=r.parse(m,1+d.length,a,void 0,{typeAnnotation:"omit"});if(!y)return null;a=a||y.type,d.push(y)}if(!a)throw new Error("No output type");const p=c&&d.some(m=>ws(c,m.type));return new ar(p?pt:a,d)}evaluate(t){let r,a=null,c=0;for(const d of this.args)if(c++,a=d.evaluate(t),a&&a instanceof nr&&!a.available&&(r||(r=a.name),a=null,c===this.args.length&&(a=r)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Vl(n,t){return n==="=="||n==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function As(n,t,r,a){return a.compare(t,r)===0}function Za(n,t,r){const a=n!=="=="&&n!=="!=";return class Ag{constructor(d,p,m){this.type=dt,this.lhs=d,this.rhs=p,this.collator=m,this.hasUntypedArgument=d.type.kind==="value"||p.type.kind==="value"}static parse(d,p){if(d.length!==3&&d.length!==4)return p.error("Expected two or three arguments.");const m=d[0];let y=p.parse(d[1],1,pt);if(!y)return null;if(!Vl(m,y.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${Xt(y.type)}'.`);let b=p.parse(d[2],2,pt);if(!b)return null;if(!Vl(m,b.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${Xt(b.type)}'.`);if(y.type.kind!==b.type.kind&&y.type.kind!=="value"&&b.type.kind!=="value")return p.error(`Cannot compare types '${Xt(y.type)}' and '${Xt(b.type)}'.`);a&&(y.type.kind==="value"&&b.type.kind!=="value"?y=new Mr(b.type,[y]):y.type.kind!=="value"&&b.type.kind==="value"&&(b=new Mr(y.type,[b])));let S=null;if(d.length===4){if(y.type.kind!=="string"&&b.type.kind!=="string"&&y.type.kind!=="value"&&b.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(S=p.parse(d[3],3,_n),!S)return null}return new Ag(y,b,S)}evaluate(d){const p=this.lhs.evaluate(d),m=this.rhs.evaluate(d);if(a&&this.hasUntypedArgument){const y=it(p),b=it(m);if(y.kind!==b.kind||y.kind!=="string"&&y.kind!=="number")throw new Yt(`Expected arguments for "${n}" to be (string, string) or (number, number), but found (${y.kind}, ${b.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const y=it(p),b=it(m);if(y.kind!=="string"||b.kind!=="string")return t(d,p,m)}return this.collator?r(d,p,m,this.collator.evaluate(d)):t(d,p,m)}eachChild(d){d(this.lhs),d(this.rhs),this.collator&&d(this.collator)}outputDefined(){return!0}}}const Zl=Za("==",function(n,t,r){return t===r},As),pd=Za("!=",function(n,t,r){return t!==r},function(n,t,r,a){return!As(0,t,r,a)}),fd=Za("<",function(n,t,r){return t<r},function(n,t,r,a){return a.compare(t,r)<0}),md=Za(">",function(n,t,r){return t>r},function(n,t,r,a){return a.compare(t,r)>0}),gd=Za("<=",function(n,t,r){return t<=r},function(n,t,r,a){return a.compare(t,r)<=0}),Ro=Za(">=",function(n,t,r){return t>=r},function(n,t,r,a){return a.compare(t,r)>=0});class Do{constructor(t,r,a){this.type=_n,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=r}static parse(t,r){if(t.length!==2)return r.error("Expected one argument.");const a=t[1];if(typeof a!="object"||Array.isArray(a))return r.error("Collator options argument must be an object.");const c=r.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,dt);if(!c)return null;const d=r.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,dt);if(!d)return null;let p=null;return a.locale&&(p=r.parse(a.locale,1,ht),!p)?null:new Do(c,d,p)}evaluate(t){return new Ss(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 Lo{constructor(t,r,a,c,d){this.type=ht,this.number=t,this.locale=r,this.currency=a,this.minFractionDigits=c,this.maxFractionDigits=d}static parse(t,r){if(t.length!==3)return r.error("Expected two arguments.");const a=r.parse(t[1],1,Oe);if(!a)return null;const c=t[2];if(typeof c!="object"||Array.isArray(c))return r.error("NumberFormat options argument must be an object.");let d=null;if(c.locale&&(d=r.parse(c.locale,1,ht),!d))return null;let p=null;if(c.currency&&(p=r.parse(c.currency,1,ht),!p))return null;let m=null;if(c["min-fraction-digits"]&&(m=r.parse(c["min-fraction-digits"],1,Oe),!m))return null;let y=null;return c["max-fraction-digits"]&&(y=r.parse(c["max-fraction-digits"],1,Oe),!y)?null:new Lo(a,d,p,m,y)}evaluate(t){return new Intl.NumberFormat(this.locale?this.locale.evaluate(t):[],{style:this.currency?"currency":"decimal",currency:this.currency?this.currency.evaluate(t):void 0,minimumFractionDigits:this.minFractionDigits?this.minFractionDigits.evaluate(t):void 0,maximumFractionDigits:this.maxFractionDigits?this.maxFractionDigits.evaluate(t):void 0}).format(this.number.evaluate(t))}eachChild(t){t(this.number),this.locale&&t(this.locale),this.currency&&t(this.currency),this.minFractionDigits&&t(this.minFractionDigits),this.maxFractionDigits&&t(this.maxFractionDigits)}outputDefined(){return!1}}class zs{constructor(t){this.type=aa,this.sections=t}static parse(t,r){if(t.length<2)return r.error("Expected at least one argument.");const a=t[1];if(!Array.isArray(a)&&typeof a=="object")return r.error("First argument must be an image or text section.");const c=[];let d=!1;for(let p=1;p<=t.length-1;++p){const m=t[p];if(d&&typeof m=="object"&&!Array.isArray(m)){d=!1;let y=null;if(m["font-scale"]&&(y=r.parse(m["font-scale"],1,Oe),!y))return null;let b=null;if(m["text-font"]&&(b=r.parse(m["text-font"],1,_r(ht)),!b))return null;let S=null;if(m["text-color"]&&(S=r.parse(m["text-color"],1,gr),!S))return null;let C=null;if(m["vertical-align"]){if(typeof m["vertical-align"]=="string"&&!zo.includes(m["vertical-align"]))return r.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${m["vertical-align"]}' instead.`);if(C=r.parse(m["vertical-align"],1,ht),!C)return null}const k=c[c.length-1];k.scale=y,k.font=b,k.textColor=S,k.verticalAlign=C}else{const y=r.parse(t[p],1,pt);if(!y)return null;const b=y.type.kind;if(b!=="string"&&b!=="value"&&b!=="null"&&b!=="resolvedImage")return r.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,c.push({content:y,scale:null,font:null,textColor:null,verticalAlign:null})}}return new zs(c)}evaluate(t){return new Vi(this.sections.map(r=>{const a=r.content.evaluate(t);return it(a)===yn?new Ol("",a,null,null,null,r.verticalAlign?r.verticalAlign.evaluate(t):null):new Ol(ca(a),null,r.scale?r.scale.evaluate(t):null,r.font?r.font.evaluate(t).join(","):null,r.textColor?r.textColor.evaluate(t):null,r.verticalAlign?r.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const r of this.sections)t(r.content),r.scale&&t(r.scale),r.font&&t(r.font),r.textColor&&t(r.textColor),r.verticalAlign&&t(r.verticalAlign)}outputDefined(){return!1}}class Ul{constructor(t){this.type=yn,this.input=t}static parse(t,r){if(t.length!==2)return r.error("Expected two arguments.");const a=r.parse(t[1],1,ht);return a?new Ul(a):r.error("No image name provided.")}evaluate(t){const r=this.input.evaluate(t),a=nr.fromString(r);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(r)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class Fo{constructor(t){this.type=Oe,this.input=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=r.parse(t[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?r.error(`Expected argument of type string or array, but found ${Xt(a.type)} instead.`):new Fo(a):null}evaluate(t){const r=this.input.evaluate(t);if(typeof r=="string")return[...r].length;if(Array.isArray(r))return r.length;throw new Yt(`Expected value to be of type string or array, but found ${Xt(it(r))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const sn=8192;function _d(n,t){const r=(180+n[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n[1]*Math.PI/360)))/360,c=Math.pow(2,t.z);return[Math.round(r*c*sn),Math.round(a*c*sn)]}function $l(n,t){const r=Math.pow(2,t.z);return[(c=(n[0]/sn+t.x)/r,360*c-180),(a=(n[1]/sn+t.y)/r,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,c}function ks(n,t){n[0]=Math.min(n[0],t[0]),n[1]=Math.min(n[1],t[1]),n[2]=Math.max(n[2],t[0]),n[3]=Math.max(n[3],t[1])}function Rs(n,t){return!(n[0]<=t[0]||n[2]>=t[2]||n[1]<=t[1]||n[3]>=t[3])}function Cu(n,t,r){const a=n[0]-t[0],c=n[1]-t[1],d=n[0]-r[0],p=n[1]-r[1];return a*p-d*c==0&&a*d<=0&&c*p<=0}function Ds(n,t,r,a){return(c=[a[0]-r[0],a[1]-r[1]])[0]*(d=[t[0]-n[0],t[1]-n[1]])[1]-c[1]*d[0]!=0&&!(!Bo(n,t,r,a)||!Bo(r,a,n,t));var c,d}function Iu(n,t,r){for(const a of r)for(let c=0;c<a.length-1;++c)if(Ds(n,t,a[c],a[c+1]))return!0;return!1}function Ua(n,t,r=!1){let a=!1;for(const m of t)for(let y=0;y<m.length-1;y++){if(Cu(n,m[y],m[y+1]))return r;(d=m[y])[1]>(c=n)[1]!=(p=m[y+1])[1]>c[1]&&c[0]<(p[0]-d[0])*(c[1]-d[1])/(p[1]-d[1])+d[0]&&(a=!a)}var c,d,p;return a}function yd(n,t){for(const r of t)if(Ua(n,r))return!0;return!1}function Eu(n,t){for(const r of n)if(!Ua(r,t))return!1;for(let r=0;r<n.length-1;++r)if(Iu(n[r],n[r+1],t))return!1;return!0}function xd(n,t){for(const r of t)if(Eu(n,r))return!0;return!1}function Bo(n,t,r,a){const c=a[0]-r[0],d=a[1]-r[1],p=(n[0]-r[0])*d-c*(n[1]-r[1]),m=(t[0]-r[0])*d-c*(t[1]-r[1]);return p>0&&m<0||p<0&&m>0}function Gl(n,t,r){const a=[];for(let c=0;c<n.length;c++){const d=[];for(let p=0;p<n[c].length;p++){const m=_d(n[c][p],r);ks(t,m),d.push(m)}a.push(d)}return a}function Au(n,t,r){const a=[];for(let c=0;c<n.length;c++){const d=Gl(n[c],t,r);a.push(d)}return a}function zu(n,t,r,a){if(n[0]<r[0]||n[0]>r[2]){const c=.5*a;let d=n[0]-r[0]>c?-a:r[0]-n[0]>c?a:0;d===0&&(d=n[0]-r[2]>c?-a:r[2]-n[0]>c?a:0),n[0]+=d}ks(t,n)}function ql(n,t,r,a){const c=Math.pow(2,a.z)*sn,d=[a.x*sn,a.y*sn],p=[];for(const m of n)for(const y of m){const b=[y.x+d[0],y.y+d[1]];zu(b,t,r,c),p.push(b)}return p}function Wl(n,t,r,a){const c=Math.pow(2,a.z)*sn,d=[a.x*sn,a.y*sn],p=[];for(const y of n){const b=[];for(const S of y){const C=[S.x+d[0],S.y+d[1]];ks(t,C),b.push(C)}p.push(b)}if(t[2]-t[0]<=c/2){(m=t)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const y of p)for(const b of y)zu(b,t,r,c)}var m;return p}class ua{constructor(t,r){this.type=dt,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(la(t[1])){const a=t[1];if(a.type==="FeatureCollection"){const c=[];for(const d of a.features){const{type:p,coordinates:m}=d.geometry;p==="Polygon"&&c.push(m),p==="MultiPolygon"&&c.push(...m)}if(c.length)return new ua(a,{type:"MultiPolygon",coordinates:c})}else if(a.type==="Feature"){const c=a.geometry.type;if(c==="Polygon"||c==="MultiPolygon")return new ua(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new ua(a,a)}return r.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(a.type==="Polygon"){const m=Gl(a.coordinates,d,p),y=ql(r.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const b of y)if(!Ua(b,m))return!1}if(a.type==="MultiPolygon"){const m=Au(a.coordinates,d,p),y=ql(r.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const b of y)if(!yd(b,m))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){const c=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=r.canonicalID();if(a.type==="Polygon"){const m=Gl(a.coordinates,d,p),y=Wl(r.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const b of y)if(!Eu(b,m))return!1}if(a.type==="MultiPolygon"){const m=Au(a.coordinates,d,p),y=Wl(r.geometry(),c,d,p);if(!Rs(c,d))return!1;for(const b of y)if(!xd(b,m))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let ku=class{constructor(n=[],t=(r,a)=>r<a?-1:r>a?1:0){if(this.data=n,this.length=this.data.length,this.compare=t,this.length>0)for(let r=(this.length>>1)-1;r>=0;r--)this._down(r)}push(n){this.data.push(n),this._up(this.length++)}pop(){if(this.length===0)return;const n=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),n}peek(){return this.data[0]}_up(n){const{data:t,compare:r}=this,a=t[n];for(;n>0;){const c=n-1>>1,d=t[c];if(r(a,d)>=0)break;t[n]=d,n=c}t[n]=a}_down(n){const{data:t,compare:r}=this,a=this.length>>1,c=t[n];for(;n<a;){let d=1+(n<<1);const p=d+1;if(p<this.length&&r(t[p],t[d])<0&&(d=p),r(t[d],c)>=0)break;t[n]=t[d],n=d}t[n]=c}};function Hl(n,t,r=0,a=n.length-1,c=vd){for(;a>r;){if(a-r>600){const y=a-r+1,b=t-r+1,S=Math.log(y),C=.5*Math.exp(2*S/3),k=.5*Math.sqrt(S*C*(y-C)/y)*(b-y/2<0?-1:1);Hl(n,t,Math.max(r,Math.floor(t-b*C/y+k)),Math.min(a,Math.floor(t+(y-b)*C/y+k)),c)}const d=n[t];let p=r,m=a;for($a(n,r,t),c(n[a],d)>0&&$a(n,r,a);p<m;){for($a(n,p,m),p++,m--;c(n[p],d)<0;)p++;for(;c(n[m],d)>0;)m--}c(n[r],d)===0?$a(n,r,m):(m++,$a(n,m,a)),m<=t&&(r=m+1),t<=m&&(a=m-1)}}function $a(n,t,r){const a=n[t];n[t]=n[r],n[r]=a}function vd(n,t){return n<t?-1:n>t?1:0}function Oo(n,t){if(n.length<=1)return[n];const r=[];let a,c;for(const d of n){const p=Ru(d);p!==0&&(d.area=Math.abs(p),c===void 0&&(c=p<0),c===p<0?(a&&r.push(a),a=[d]):a.push(d))}if(a&&r.push(a),t>1)for(let d=0;d<r.length;d++)r[d].length<=t||(Hl(r[d],t,1,r[d].length-1,bd),r[d]=r[d].slice(0,t));return r}function bd(n,t){return t.area-n.area}function Ru(n){let t=0;for(let r,a,c=0,d=n.length,p=d-1;c<d;p=c++)r=n[c],a=n[p],t+=(a.x-r.x)*(r.y+a.y);return t}const Du=1/298.257223563,Lu=Du*(2-Du),Fu=Math.PI/180;class Xl{constructor(t){const r=6378.137*Fu*1e3,a=Math.cos(t*Fu),c=1/(1-Lu*(1-a*a)),d=Math.sqrt(c);this.kx=r*d*a,this.ky=r*d*c*(1-Lu)}distance(t,r){const a=this.wrap(t[0]-r[0])*this.kx,c=(t[1]-r[1])*this.ky;return Math.sqrt(a*a+c*c)}pointOnLine(t,r){let a,c,d,p,m=1/0;for(let y=0;y<t.length-1;y++){let b=t[y][0],S=t[y][1],C=this.wrap(t[y+1][0]-b)*this.kx,k=(t[y+1][1]-S)*this.ky,L=0;C===0&&k===0||(L=(this.wrap(r[0]-b)*this.kx*C+(r[1]-S)*this.ky*k)/(C*C+k*k),L>1?(b=t[y+1][0],S=t[y+1][1]):L>0&&(b+=C/this.kx*L,S+=k/this.ky*L)),C=this.wrap(r[0]-b)*this.kx,k=(r[1]-S)*this.ky;const F=C*C+k*k;F<m&&(m=F,a=b,c=S,d=y,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 Mt(n,t){return t[0]-n[0]}function jo(n){return n[1]-n[0]+1}function wn(n,t){return n[1]>=n[0]&&n[1]<t}function Yl(n,t){if(n[0]>n[1])return[null,null];const r=jo(n);if(t){if(r===2)return[n,null];const c=Math.floor(r/2);return[[n[0],n[0]+c],[n[0]+c,n[1]]]}if(r===1)return[n,null];const a=Math.floor(r/2)-1;return[[n[0],n[0]+a],[n[0]+a+1,n[1]]]}function Kl(n,t){if(!wn(t,n.length))return[1/0,1/0,-1/0,-1/0];const r=[1/0,1/0,-1/0,-1/0];for(let a=t[0];a<=t[1];++a)ks(r,n[a]);return r}function Jl(n){const t=[1/0,1/0,-1/0,-1/0];for(const r of n)for(const a of r)ks(t,a);return t}function Bu(n){return n[0]!==-1/0&&n[1]!==-1/0&&n[2]!==1/0&&n[3]!==1/0}function Ql(n,t,r){if(!Bu(n)||!Bu(t))return NaN;let a=0,c=0;return n[2]<t[0]&&(a=t[0]-n[2]),n[0]>t[2]&&(a=n[0]-t[2]),n[1]>t[3]&&(c=n[1]-t[3]),n[3]<t[1]&&(c=t[1]-n[3]),r.distance([0,0],[a,c])}function ha(n,t,r){const a=r.pointOnLine(t,n);return r.distance(n,a.point)}function ec(n,t,r,a,c){const d=Math.min(ha(n,[r,a],c),ha(t,[r,a],c)),p=Math.min(ha(r,[n,t],c),ha(a,[n,t],c));return Math.min(d,p)}function wd(n,t,r,a,c){if(!wn(t,n.length)||!wn(a,r.length))return 1/0;let d=1/0;for(let p=t[0];p<t[1];++p){const m=n[p],y=n[p+1];for(let b=a[0];b<a[1];++b){const S=r[b],C=r[b+1];if(Ds(m,y,S,C))return 0;d=Math.min(d,ec(m,y,S,C,c))}}return d}function Td(n,t,r,a,c){if(!wn(t,n.length)||!wn(a,r.length))return NaN;let d=1/0;for(let p=t[0];p<=t[1];++p)for(let m=a[0];m<=a[1];++m)if(d=Math.min(d,c.distance(n[p],r[m])),d===0)return d;return d}function Sd(n,t,r){if(Ua(n,t,!0))return 0;let a=1/0;for(const c of t){const d=c[0],p=c[c.length-1];if(d!==p&&(a=Math.min(a,ha(n,[p,d],r)),a===0))return a;const m=r.pointOnLine(c,n);if(a=Math.min(a,r.distance(n,m.point)),a===0)return a}return a}function Pd(n,t,r,a){if(!wn(t,n.length))return NaN;for(let d=t[0];d<=t[1];++d)if(Ua(n[d],r,!0))return 0;let c=1/0;for(let d=t[0];d<t[1];++d){const p=n[d],m=n[d+1];for(const y of r)for(let b=0,S=y.length,C=S-1;b<S;C=b++){const k=y[C],L=y[b];if(Ds(p,m,k,L))return 0;c=Math.min(c,ec(p,m,k,L,a))}}return c}function Ou(n,t){for(const r of n)for(const a of r)if(Ua(a,t,!0))return!0;return!1}function Md(n,t,r,a=1/0){const c=Jl(n),d=Jl(t);if(a!==1/0&&Ql(c,d,r)>=a)return a;if(Rs(c,d)){if(Ou(n,t))return 0}else if(Ou(t,n))return 0;let p=1/0;for(const m of n)for(let y=0,b=m.length,S=b-1;y<b;S=y++){const C=m[S],k=m[y];for(const L of t)for(let F=0,j=L.length,U=j-1;F<j;U=F++){const H=L[U],se=L[F];if(Ds(C,k,H,se))return 0;p=Math.min(p,ec(C,k,H,se,r))}}return p}function ju(n,t,r,a,c,d){if(!d)return;const p=Ql(Kl(a,d),c,r);p<t&&n.push([p,d,[0,0]])}function No(n,t,r,a,c,d,p){if(!d||!p)return;const m=Ql(Kl(a,d),Kl(c,p),r);m<t&&n.push([m,d,p])}function Vo(n,t,r,a,c=1/0){let d=Math.min(a.distance(n[0],r[0][0]),c);if(d===0)return d;const p=new ku([[0,[0,n.length-1],[0,0]]],Mt),m=Jl(r);for(;p.length>0;){const y=p.pop();if(y[0]>=d)continue;const b=y[1],S=t?50:100;if(jo(b)<=S){if(!wn(b,n.length))return NaN;if(t){const C=Pd(n,b,r,a);if(isNaN(C)||C===0)return C;d=Math.min(d,C)}else for(let C=b[0];C<=b[1];++C){const k=Sd(n[C],r,a);if(d=Math.min(d,k),d===0)return 0}}else{const C=Yl(b,t);ju(p,d,a,n,m,C[0]),ju(p,d,a,n,m,C[1])}}return d}function Zo(n,t,r,a,c,d=1/0){let p=Math.min(d,c.distance(n[0],r[0]));if(p===0)return p;const m=new ku([[0,[0,n.length-1],[0,r.length-1]]],Mt);for(;m.length>0;){const y=m.pop();if(y[0]>=p)continue;const b=y[1],S=y[2],C=t?50:100,k=a?50:100;if(jo(b)<=C&&jo(S)<=k){if(!wn(b,n.length)&&wn(S,r.length))return NaN;let L;if(t&&a)L=wd(n,b,r,S,c),p=Math.min(p,L);else if(t&&!a){const F=n.slice(b[0],b[1]+1);for(let j=S[0];j<=S[1];++j)if(L=ha(r[j],F,c),p=Math.min(p,L),p===0)return p}else if(!t&&a){const F=r.slice(S[0],S[1]+1);for(let j=b[0];j<=b[1];++j)if(L=ha(n[j],F,c),p=Math.min(p,L),p===0)return p}else L=Td(n,b,r,S,c),p=Math.min(p,L)}else{const L=Yl(b,t),F=Yl(S,a);No(m,p,c,n,r,L[0],F[0]),No(m,p,c,n,r,L[0],F[1]),No(m,p,c,n,r,L[1],F[0]),No(m,p,c,n,r,L[1],F[1])}}return p}function tc(n){return n.type==="MultiPolygon"?n.coordinates.map(t=>({type:"Polygon",coordinates:t})):n.type==="MultiLineString"?n.coordinates.map(t=>({type:"LineString",coordinates:t})):n.type==="MultiPoint"?n.coordinates.map(t=>({type:"Point",coordinates:t})):[n]}class da{constructor(t,r){this.type=Oe,this.geojson=t,this.geometries=r}static parse(t,r){if(t.length!==2)return r.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(la(t[1])){const a=t[1];if(a.type==="FeatureCollection")return new da(a,a.features.map(c=>tc(c.geometry)).flat());if(a.type==="Feature")return new da(a,tc(a.geometry));if("type"in a&&"coordinates"in a)return new da(a,tc(a))}return r.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(r,a){const c=r.geometry(),d=c.flat().map(y=>$l([y.x,y.y],r.canonical));if(c.length===0)return NaN;const p=new Xl(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,Zo(d,!1,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,Zo(d,!1,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,Vo(d,!1,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="LineString")return function(r,a){const c=r.geometry(),d=c.flat().map(y=>$l([y.x,y.y],r.canonical));if(c.length===0)return NaN;const p=new Xl(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,Zo(d,!0,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,Zo(d,!0,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,Vo(d,!0,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="Polygon")return function(r,a){const c=r.geometry();if(c.length===0||c[0].length===0)return NaN;const d=Oo(c,0).map(y=>y.map(b=>b.map(S=>$l([S.x,S.y],r.canonical)))),p=new Xl(d[0][0][0][1]);let m=1/0;for(const y of a)for(const b of d){switch(y.type){case"Point":m=Math.min(m,Vo([y.coordinates],!1,b,p,m));break;case"LineString":m=Math.min(m,Vo(y.coordinates,!0,b,p,m));break;case"Polygon":m=Math.min(m,Md(b,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}class Ls{constructor(t){this.type=pt,this.key=t}static parse(t,r){if(t.length!==2)return r.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=t[1];return a==null?r.error("Global state property must be defined."):typeof a!="string"?r.error(`Global state property must be string, but found ${typeof t[1]} instead.`):new Ls(a)}evaluate(t){var r;const a=(r=t.globals)===null||r===void 0?void 0:r.globalState;return a&&Object.keys(a).length!==0?mt(a,this.key):null}eachChild(){}outputDefined(){return!1}}const Ga={"==":Zl,"!=":pd,">":md,"<":fd,">=":Ro,"<=":gd,array:Mr,at:Si,boolean:Mr,case:fi,coalesce:ar,collator:Do,format:zs,image:Ul,in:Ba,"index-of":Cs,interpolate:Yi,"interpolate-hcl":Yi,"interpolate-lab":Yi,length:Fo,let:Ms,literal:Xi,match:Oa,number:Mr,"number-format":Lo,object:Mr,slice:Is,step:Na,string:Mr,"to-boolean":an,"to-color":an,"to-number":an,"to-string":an,var:jr,within:ua,distance:da,"global-state":Ls};class Cr{constructor(t,r,a,c){this.name=t,this.type=r,this._evaluate=a,this.args=c}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,r){const a=t[0],c=Cr.definitions[a];if(!c)return r.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(c)?c[0]:c.type,p=Array.isArray(c)?[[c[1],c[2]]]:c.overloads,m=p.filter(([b])=>!Array.isArray(b)||b.length===t.length-1);let y=null;for(const[b,S]of m){y=new Ps(r.registry,Uo,r.path,null,r.scope);const C=[];let k=!1;for(let L=1;L<t.length;L++){const F=t[L],j=Array.isArray(b)?b[L-1]:b.type,U=y.parse(F,1+C.length,j);if(!U){k=!0;break}C.push(U)}if(!k)if(Array.isArray(b)&&b.length!==C.length)y.error(`Expected ${b.length} arguments, but found ${C.length} instead.`);else{for(let L=0;L<C.length;L++){const F=Array.isArray(b)?b[L]:b.type,j=C[L];y.concat(L+1).checkSubtype(F,j.type)}if(y.errors.length===0)return new Cr(a,d,S,C)}}if(m.length===1)r.errors.push(...y.errors);else{const b=(m.length?m:p).map(([C])=>{return k=C,Array.isArray(k)?`(${k.map(Xt).join(", ")})`:`(${Xt(k.type)}...)`;var k}).join(" | "),S=[];for(let C=1;C<t.length;C++){const k=r.parse(t[C],1+S.length);if(!k)return null;S.push(Xt(k.type))}r.error(`Expected arguments of type ${b}, but found (${S.join(", ")}) instead.`)}return null}static register(t,r){Cr.definitions=r;for(const a in r)t[a]=Cr}}function Nu(n,[t,r,a,c]){t=t.evaluate(n),r=r.evaluate(n),a=a.evaluate(n);const d=c?c.evaluate(n):1,p=st(t,r,a,d);if(p)throw new Yt(p);return new gt(t/255,r/255,a/255,d,!1)}function Vu(n,t){return n in t}function ic(n,t){const r=t[n];return r===void 0?null:r}function pa(n){return{type:n}}function Uo(n){if(n instanceof jr)return Uo(n.boundExpression);if(n instanceof Cr&&n.name==="error"||n instanceof Do||n instanceof ua||n instanceof da||n instanceof Ls)return!1;const t=n instanceof an||n instanceof Mr;let r=!0;return n.eachChild(a=>{r=t?r&&Uo(a):r&&a instanceof Xi}),!!r&&$o(n)&&qa(n,["zoom","heatmap-density","elevation","line-progress","accumulated","is-supported-script"])}function $o(n){if(n instanceof Cr&&(n.name==="get"&&n.args.length===1||n.name==="feature-state"||n.name==="has"&&n.args.length===1||n.name==="properties"||n.name==="geometry-type"||n.name==="id"||/^filter-/.test(n.name))||n instanceof ua||n instanceof da)return!1;let t=!0;return n.eachChild(r=>{t&&!$o(r)&&(t=!1)}),t}function Fs(n){if(n instanceof Cr&&n.name==="feature-state")return!1;let t=!0;return n.eachChild(r=>{t&&!Fs(r)&&(t=!1)}),t}function qa(n,t){if(n instanceof Cr&&t.indexOf(n.name)>=0)return!1;let r=!0;return n.eachChild(a=>{r&&!qa(a,t)&&(r=!1)}),r}function Zu(n){return{result:"success",value:n}}function Wa(n){return{result:"error",value:n}}function Ha(n){return n["property-type"]==="data-driven"||n["property-type"]==="cross-faded-data-driven"}function rc(n){return!!n.expression&&n.expression.parameters.indexOf("zoom")>-1}function nc(n){return!!n.expression&&n.expression.interpolated}function _t(n){return n instanceof Number?"number":n instanceof String?"string":n instanceof Boolean?"boolean":Array.isArray(n)?"array":n===null?"null":typeof n}function fa(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)&&it(n)===rn}function Uu(n){return n}function $u(n,t){const r=n.stops&&typeof n.stops[0][0]=="object",a=r||!(r||n.property!==void 0),c=n.type||(nc(t)?"exponential":"interval"),d=function(S){switch(S.type){case"color":return gt.parse;case"padding":return pi.parse;case"numberArray":return Zi.parse;case"colorArray":return Ti.parse;default:return null}}(t);if(d&&((n=Ri({},n)).stops&&(n.stops=n.stops.map(S=>[S[0],d(S[1])])),n.default=d(n.default?n.default:t.default)),n.colorSpace&&(p=n.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${n.colorSpace}"`);var p;const m=function(S){switch(S){case"exponential":return Gu;case"interval":return Id;case"categorical":return Cd;case"identity":return qu;default:throw new Error(`Unknown function type "${S}"`)}}(c);let y,b;if(c==="categorical"){y=Object.create(null);for(const S of n.stops)y[S[0]]=S[1];b=typeof n.stops[0][0]}if(r){const S={},C=[];for(let F=0;F<n.stops.length;F++){const j=n.stops[F],U=j[0].zoom;S[U]===void 0&&(S[U]={zoom:U,type:n.type,property:n.property,default:n.default,stops:[]},C.push(U)),S[U].stops.push([j[0].value,j[1]])}const k=[];for(const F of C)k.push([S[F].zoom,$u(S[F],t)]);const L={name:"linear"};return{kind:"composite",interpolationType:L,interpolationFactor:Yi.interpolationFactor.bind(void 0,L),zoomStops:k.map(F=>F[0]),evaluate:({zoom:F},j)=>Gu({stops:k,base:n.base},t,F).evaluate(F,j)}}if(a){const S=c==="exponential"?{name:"exponential",base:n.base!==void 0?n.base:1}:null;return{kind:"camera",interpolationType:S,interpolationFactor:Yi.interpolationFactor.bind(void 0,S),zoomStops:n.stops.map(C=>C[0]),evaluate:({zoom:C})=>m(n,t,C,y,b)}}return{kind:"source",evaluate(S,C){const k=C&&C.properties?C.properties[n.property]:void 0;return k===void 0?Bs(n.default,t.default):m(n,t,k,y,b)}}}function Bs(n,t,r){return n!==void 0?n:t!==void 0?t:r!==void 0?r:void 0}function Cd(n,t,r,a,c){return Bs(typeof r===c?a[r]:void 0,n.default,t.default)}function Id(n,t,r){if(_t(r)!=="number")return Bs(n.default,t.default);const a=n.stops.length;if(a===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[a-1][0])return n.stops[a-1][1];const c=ja(n.stops.map(d=>d[0]),r);return n.stops[c][1]}function Gu(n,t,r){const a=n.base!==void 0?n.base:1;if(_t(r)!=="number")return Bs(n.default,t.default);const c=n.stops.length;if(c===1||r<=n.stops[0][0])return n.stops[0][1];if(r>=n.stops[c-1][0])return n.stops[c-1][1];const d=ja(n.stops.map(S=>S[0]),r),p=function(S,C,k,L){const F=L-k,j=S-k;return F===0?0:C===1?j/F:(Math.pow(C,j)-1)/(Math.pow(C,F)-1)}(r,a,n.stops[d][0],n.stops[d+1][0]),m=n.stops[d][1],y=n.stops[d+1][1],b=yr[t.type]||Uu;return typeof m.evaluate=="function"?{evaluate(...S){const C=m.evaluate.apply(void 0,S),k=y.evaluate.apply(void 0,S);if(C!==void 0&&k!==void 0)return b(C,k,p,n.colorSpace)}}:b(m,y,p,n.colorSpace)}function qu(n,t,r){switch(t.type){case"color":r=gt.parse(r);break;case"formatted":r=Vi.fromString(r.toString());break;case"resolvedImage":r=nr.fromString(r.toString());break;case"padding":r=pi.parse(r);break;case"colorArray":r=Ti.parse(r);break;case"numberArray":r=Zi.parse(r);break;default:_t(r)===t.type||t.type==="enum"&&t.values[r]||(r=void 0)}return Bs(r,n.default,t.default)}Cr.register(Ga,{error:[{kind:"error"},[ht],(n,[t])=>{throw new Yt(t.evaluate(n))}],typeof:[ht,[pt],(n,[t])=>Xt(it(t.evaluate(n)))],"to-rgba":[_r(Oe,4),[gr],(n,[t])=>{const[r,a,c,d]=t.evaluate(n).rgb;return[255*r,255*a,255*c,d]}],rgb:[gr,[Oe,Oe,Oe],Nu],rgba:[gr,[Oe,Oe,Oe,Oe],Nu],has:{type:dt,overloads:[[[ht],(n,[t])=>Vu(t.evaluate(n),n.properties())],[[ht,rn],(n,[t,r])=>Vu(t.evaluate(n),r.evaluate(n))]]},get:{type:pt,overloads:[[[ht],(n,[t])=>ic(t.evaluate(n),n.properties())],[[ht,rn],(n,[t,r])=>ic(t.evaluate(n),r.evaluate(n))]]},"feature-state":[pt,[ht],(n,[t])=>ic(t.evaluate(n),n.featureState||{})],properties:[rn,[],n=>n.properties()],"geometry-type":[ht,[],n=>n.geometryType()],id:[pt,[],n=>n.id()],zoom:[Oe,[],n=>n.globals.zoom],"heatmap-density":[Oe,[],n=>n.globals.heatmapDensity||0],elevation:[Oe,[],n=>n.globals.elevation||0],"line-progress":[Oe,[],n=>n.globals.lineProgress||0],accumulated:[pt,[],n=>n.globals.accumulated===void 0?null:n.globals.accumulated],"+":[Oe,pa(Oe),(n,t)=>{let r=0;for(const a of t)r+=a.evaluate(n);return r}],"*":[Oe,pa(Oe),(n,t)=>{let r=1;for(const a of t)r*=a.evaluate(n);return r}],"-":{type:Oe,overloads:[[[Oe,Oe],(n,[t,r])=>t.evaluate(n)-r.evaluate(n)],[[Oe],(n,[t])=>-t.evaluate(n)]]},"/":[Oe,[Oe,Oe],(n,[t,r])=>t.evaluate(n)/r.evaluate(n)],"%":[Oe,[Oe,Oe],(n,[t,r])=>t.evaluate(n)%r.evaluate(n)],ln2:[Oe,[],()=>Math.LN2],pi:[Oe,[],()=>Math.PI],e:[Oe,[],()=>Math.E],"^":[Oe,[Oe,Oe],(n,[t,r])=>Math.pow(t.evaluate(n),r.evaluate(n))],sqrt:[Oe,[Oe],(n,[t])=>Math.sqrt(t.evaluate(n))],log10:[Oe,[Oe],(n,[t])=>Math.log(t.evaluate(n))/Math.LN10],ln:[Oe,[Oe],(n,[t])=>Math.log(t.evaluate(n))],log2:[Oe,[Oe],(n,[t])=>Math.log(t.evaluate(n))/Math.LN2],sin:[Oe,[Oe],(n,[t])=>Math.sin(t.evaluate(n))],cos:[Oe,[Oe],(n,[t])=>Math.cos(t.evaluate(n))],tan:[Oe,[Oe],(n,[t])=>Math.tan(t.evaluate(n))],asin:[Oe,[Oe],(n,[t])=>Math.asin(t.evaluate(n))],acos:[Oe,[Oe],(n,[t])=>Math.acos(t.evaluate(n))],atan:[Oe,[Oe],(n,[t])=>Math.atan(t.evaluate(n))],min:[Oe,pa(Oe),(n,t)=>Math.min(...t.map(r=>r.evaluate(n)))],max:[Oe,pa(Oe),(n,t)=>Math.max(...t.map(r=>r.evaluate(n)))],abs:[Oe,[Oe],(n,[t])=>Math.abs(t.evaluate(n))],round:[Oe,[Oe],(n,[t])=>{const r=t.evaluate(n);return r<0?-Math.round(-r):Math.round(r)}],floor:[Oe,[Oe],(n,[t])=>Math.floor(t.evaluate(n))],ceil:[Oe,[Oe],(n,[t])=>Math.ceil(t.evaluate(n))],"filter-==":[dt,[ht,pt],(n,[t,r])=>n.properties()[t.value]===r.value],"filter-id-==":[dt,[pt],(n,[t])=>n.id()===t.value],"filter-type-==":[dt,[ht],(n,[t])=>n.geometryType()===t.value],"filter-<":[dt,[ht,pt],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a<c}],"filter-id-<":[dt,[pt],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r<a}],"filter->":[dt,[ht,pt],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a>c}],"filter-id->":[dt,[pt],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r>a}],"filter-<=":[dt,[ht,pt],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a<=c}],"filter-id-<=":[dt,[pt],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r<=a}],"filter->=":[dt,[ht,pt],(n,[t,r])=>{const a=n.properties()[t.value],c=r.value;return typeof a==typeof c&&a>=c}],"filter-id->=":[dt,[pt],(n,[t])=>{const r=n.id(),a=t.value;return typeof r==typeof a&&r>=a}],"filter-has":[dt,[pt],(n,[t])=>t.value in n.properties()],"filter-has-id":[dt,[],n=>n.id()!==null&&n.id()!==void 0],"filter-type-in":[dt,[_r(ht)],(n,[t])=>t.value.indexOf(n.geometryType())>=0],"filter-id-in":[dt,[_r(pt)],(n,[t])=>t.value.indexOf(n.id())>=0],"filter-in-small":[dt,[ht,_r(pt)],(n,[t,r])=>r.value.indexOf(n.properties()[t.value])>=0],"filter-in-large":[dt,[ht,_r(pt)],(n,[t,r])=>function(a,c,d,p){for(;d<=p;){const m=d+p>>1;if(c[m]===a)return!0;c[m]>a?p=m-1:d=m+1}return!1}(n.properties()[t.value],r.value,0,r.value.length-1)],all:{type:dt,overloads:[[[dt,dt],(n,[t,r])=>t.evaluate(n)&&r.evaluate(n)],[pa(dt),(n,t)=>{for(const r of t)if(!r.evaluate(n))return!1;return!0}]]},any:{type:dt,overloads:[[[dt,dt],(n,[t,r])=>t.evaluate(n)||r.evaluate(n)],[pa(dt),(n,t)=>{for(const r of t)if(r.evaluate(n))return!0;return!1}]]},"!":[dt,[dt],(n,[t])=>!t.evaluate(n)],"is-supported-script":[dt,[ht],(n,[t])=>{const r=n.globals&&n.globals.isSupportedScript;return!r||r(t.evaluate(n))}],upcase:[ht,[ht],(n,[t])=>t.evaluate(n).toUpperCase()],downcase:[ht,[ht],(n,[t])=>t.evaluate(n).toLowerCase()],concat:[ht,pa(pt),(n,t)=>t.map(r=>ca(r.evaluate(n))).join("")],"resolved-locale":[ht,[_n],(n,[t])=>t.evaluate(n).resolvedLocale()]});class Go{constructor(t,r){this.expression=t,this._warningHistory={},this._evaluator=new Mu,this._defaultValue=r?function(a){if(a.type==="color"&&fa(a.default))return new gt(0,0,0,0);switch(a.type){case"color":return gt.parse(a.default)||null;case"padding":return pi.parse(a.default)||null;case"numberArray":return Zi.parse(a.default)||null;case"colorArray":return Ti.parse(a.default)||null;case"variableAnchorOffsetCollection":return bt.parse(a.default)||null;case"projectionDefinition":return at.parse(a.default)||null;default:return a.default===void 0?null:a.default}}(r):null,this._enumValues=r&&r.type==="enum"?r.values:null}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._evaluator.globals=t,this._evaluator.feature=r,this._evaluator.featureState=a,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,r,a,c,d,p){this._evaluator.globals=t,this._evaluator.feature=r||null,this._evaluator.featureState=a||null,this._evaluator.canonical=c,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p||null;try{const m=this.expression.evaluate(this._evaluator);if(m==null||typeof m=="number"&&m!=m)return this._defaultValue;if(this._enumValues&&!(m in this._enumValues))throw new Yt(`Expected value to be one of ${Object.keys(this._enumValues).map(y=>JSON.stringify(y)).join(", ")}, but found ${JSON.stringify(m)} instead.`);return m}catch(m){return this._warningHistory[m.message]||(this._warningHistory[m.message]=!0,typeof console<"u"&&console.warn(m.message)),this._defaultValue}}}function qo(n){return Array.isArray(n)&&n.length>0&&typeof n[0]=="string"&&n[0]in Ga}function Wo(n,t){const r=new Ps(Ga,Uo,[],t?function(c){const d={color:gr,string:ht,number:Oe,enum:ht,boolean:dt,formatted:aa,padding:ui,numberArray:vs,colorArray:xs,projectionDefinition:Co,resolvedImage:yn,variableAnchorOffsetCollection:bs};return c.type==="array"?_r(d[c.value]||pt,c.length):d[c.type]}(t):void 0),a=r.parse(n,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Zu(new Go(a,t)):Wa(r.errors)}class Os{constructor(t,r){this.kind=t,this._styleExpression=r,this.isStateDependent=t!=="constant"&&!Fs(r.expression),this.globalStateRefs=Ya(r.expression)}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,c,d,p)}evaluate(t,r,a,c,d,p){return this._styleExpression.evaluate(t,r,a,c,d,p)}}class Ho{constructor(t,r,a,c){this.kind=t,this.zoomStops=a,this._styleExpression=r,this.isStateDependent=t!=="camera"&&!Fs(r.expression),this.globalStateRefs=Ya(r.expression),this.interpolationType=c}evaluateWithoutErrorHandling(t,r,a,c,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,r,a,c,d,p)}evaluate(t,r,a,c,d,p){return this._styleExpression.evaluate(t,r,a,c,d,p)}interpolationFactor(t,r,a){return this.interpolationType?Yi.interpolationFactor(this.interpolationType,t,r,a):0}}function ac(n,t){const r=Wo(n,t);if(r.result==="error")return r;const a=r.value.expression,c=$o(a);if(!c&&!Ha(t))return Wa([new Ht("","data expressions not supported")]);const d=qa(a,["zoom"]);if(!d&&!rc(t))return Wa([new Ht("","zoom expressions not supported")]);const p=Xa(a);return p||d?p instanceof Ht?Wa([p]):p instanceof Yi&&!nc(t)?Wa([new Ht("",'"interpolate" expressions cannot be used with this property')]):Zu(p?new Ho(c?"camera":"composite",r.value,p.labels,p instanceof Yi?p.interpolation:void 0):new Os(c?"constant":"source",r.value)):Wa([new Ht("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class js{constructor(t,r){this._parameters=t,this._specification=r,Ri(this,$u(this._parameters,this._specification))}static deserialize(t){return new js(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Xa(n){let t=null;if(n instanceof Ms)t=Xa(n.result);else if(n instanceof ar){for(const r of n.args)if(t=Xa(r),t)break}else(n instanceof Na||n instanceof Yi)&&n.input instanceof Cr&&n.input.name==="zoom"&&(t=n);return t instanceof Ht||n.eachChild(r=>{const a=Xa(r);a instanceof Ht?t=a:!t&&a?t=new Ht("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new Ht("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function Ya(n,t=new Set){return n instanceof Ls&&t.add(n.key),n.eachChild(r=>{Ya(r,t)}),t}function Ns(n){if(n===!0||n===!1)return!0;if(!Array.isArray(n)||n.length===0)return!1;switch(n[0]){case"has":return n.length>=2&&n[1]!=="$id"&&n[1]!=="$type";case"in":return n.length>=3&&(typeof n[1]!="string"||Array.isArray(n[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return n.length!==3||Array.isArray(n[1])||Array.isArray(n[2]);case"any":case"all":for(const t of n.slice(1))if(!Ns(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const sc={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function jn(n){if(n==null)return{filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set};Ns(n)||(n=Xo(n));const t=Wo(n,sc);if(t.result==="error")throw new Error(t.value.map(r=>`${r.key}: ${r.message}`).join(", "));return{filter:(r,a,c)=>t.value.evaluate(r,a,{},c),needGeometry:Wu(n),getGlobalStateRefs:()=>Ya(t.value.expression)}}function Ed(n,t){return n<t?-1:n>t?1:0}function Wu(n){if(!Array.isArray(n))return!1;if(n[0]==="within"||n[0]==="distance")return!0;for(let t=1;t<n.length;t++)if(Wu(n[t]))return!0;return!1}function Xo(n){if(!n)return!0;const t=n[0];return n.length<=1?t!=="any":t==="=="?oc(n[1],n[2],"=="):t==="!="?Vs(oc(n[1],n[2],"==")):t==="<"||t===">"||t==="<="||t===">="?oc(n[1],n[2],t):t==="any"?(r=n.slice(1),["any"].concat(r.map(Xo))):t==="all"?["all"].concat(n.slice(1).map(Xo)):t==="none"?["all"].concat(n.slice(1).map(Xo).map(Vs)):t==="in"?Hu(n[1],n.slice(2)):t==="!in"?Vs(Hu(n[1],n.slice(2))):t==="has"?Xu(n[1]):t!=="!has"||Vs(Xu(n[1]));var r}function oc(n,t,r){switch(n){case"$type":return[`filter-type-${r}`,t];case"$id":return[`filter-id-${r}`,t];default:return[`filter-${r}`,n,t]}}function Hu(n,t){if(t.length===0)return!1;switch(n){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(r=>typeof r!=typeof t[0])?["filter-in-large",n,["literal",t.sort(Ed)]]:["filter-in-small",n,["literal",t]]}}function Xu(n){switch(n){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",n]}}function Vs(n){return["!",n]}function Yo(n){const t=typeof n;if(t==="number"||t==="boolean"||t==="string"||n==null)return JSON.stringify(n);if(Array.isArray(n)){let c="[";for(const d of n)c+=`${Yo(d)},`;return`${c}]`}const r=Object.keys(n).sort();let a="{";for(let c=0;c<r.length;c++)a+=`${JSON.stringify(r[c])}:${Yo(n[r[c]])},`;return`${a}}`}function Ko(n){let t="";for(const r of Ne)t+=`/${Yo(n[r])}`;return t}function Yu(n){const t=n.value;return t?[new De(n.key,t,"constants have been deprecated as of v8")]:[]}function ri(n){return n instanceof Number||n instanceof String||n instanceof Boolean?n.valueOf():n}function Nn(n){if(Array.isArray(n))return n.map(Nn);if(n instanceof Object&&!(n instanceof Number||n instanceof String||n instanceof Boolean)){const t={};for(const r in n)t[r]=Nn(n[r]);return t}return ri(n)}function Ir(n){const t=n.key,r=n.value,a=n.valueSpec||{},c=n.objectElementValidators||{},d=n.style,p=n.styleSpec,m=n.validateSpec;let y=[];const b=_t(r);if(b!=="object")return[new De(t,r,`object expected, ${b} found`)];for(const S in r){const C=S.split(".")[0],k=mt(a,C)||a["*"];let L;if(mt(c,C))L=c[C];else if(mt(a,C))L=m;else if(c["*"])L=c["*"];else{if(!a["*"]){y.push(new De(t,r[S],`unknown property "${S}"`));continue}L=m}y=y.concat(L({key:(t&&`${t}.`)+S,value:r[S],valueSpec:k,style:d,styleSpec:p,object:r,objectKey:S,validateSpec:m},r))}for(const S in a)c[S]||a[S].required&&a[S].default===void 0&&r[S]===void 0&&y.push(new De(t,r,`missing required property "${S}"`));return y}function Jo(n){const t=n.value,r=n.valueSpec,a=n.style,c=n.styleSpec,d=n.key,p=n.arrayElementValidator||n.validateSpec;if(_t(t)!=="array")return[new De(d,t,`array expected, ${_t(t)} found`)];if(r.length&&t.length!==r.length)return[new De(d,t,`array length ${r.length} expected, length ${t.length} found`)];if(r["min-length"]&&t.length<r["min-length"])return[new De(d,t,`array length at least ${r["min-length"]} expected, length ${t.length} found`)];let m={type:r.value,values:r.values};c.$version<7&&(m.function=r.function),_t(r.value)==="object"&&(m=r.value);let y=[];for(let b=0;b<t.length;b++)y=y.concat(p({array:t,arrayIndex:b,value:t[b],valueSpec:m,validateSpec:n.validateSpec,style:a,styleSpec:c,key:`${d}[${b}]`}));return y}function Zs(n){const t=n.key,r=n.value,a=n.valueSpec;let c=_t(r);return c==="number"&&r!=r&&(c="NaN"),c!=="number"?[new De(t,r,`number expected, ${c} found`)]:"minimum"in a&&r<a.minimum?[new De(t,r,`${r} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&r>a.maximum?[new De(t,r,`${r} is greater than the maximum value ${a.maximum}`)]:[]}function Ka(n){const t=n.valueSpec,r=ri(n.value.type);let a,c,d,p={};const m=r!=="categorical"&&n.value.property===void 0,y=!m,b=_t(n.value.stops)==="array"&&_t(n.value.stops[0])==="array"&&_t(n.value.stops[0][0])==="object",S=Ir({key:n.key,value:n.value,valueSpec:n.styleSpec.function,validateSpec:n.validateSpec,style:n.style,styleSpec:n.styleSpec,objectElementValidators:{stops:function(L){if(r==="identity")return[new De(L.key,L.value,'identity function may not have a "stops" property')];let F=[];const j=L.value;return F=F.concat(Jo({key:L.key,value:j,valueSpec:L.valueSpec,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec,arrayElementValidator:C})),_t(j)==="array"&&j.length===0&&F.push(new De(L.key,j,"array must have at least one stop")),F},default:function(L){return L.validateSpec({key:L.key,value:L.value,valueSpec:t,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec})}}});return r==="identity"&&m&&S.push(new De(n.key,n.value,'missing required property "property"')),r==="identity"||n.value.stops||S.push(new De(n.key,n.value,'missing required property "stops"')),r==="exponential"&&n.valueSpec.expression&&!nc(n.valueSpec)&&S.push(new De(n.key,n.value,"exponential functions not supported")),n.styleSpec.$version>=8&&(y&&!Ha(n.valueSpec)?S.push(new De(n.key,n.value,"property functions not supported")):m&&!rc(n.valueSpec)&&S.push(new De(n.key,n.value,"zoom functions not supported"))),r!=="categorical"&&!b||n.value.property!==void 0||S.push(new De(n.key,n.value,'"property" property is required')),S;function C(L){let F=[];const j=L.value,U=L.key;if(_t(j)!=="array")return[new De(U,j,`array expected, ${_t(j)} found`)];if(j.length!==2)return[new De(U,j,`array length 2 expected, length ${j.length} found`)];if(b){if(_t(j[0])!=="object")return[new De(U,j,`object expected, ${_t(j[0])} found`)];if(j[0].zoom===void 0)return[new De(U,j,"object stop key must have zoom")];if(j[0].value===void 0)return[new De(U,j,"object stop key must have value")];if(d&&d>ri(j[0].zoom))return[new De(U,j[0].zoom,"stop zoom values must appear in ascending order")];ri(j[0].zoom)!==d&&(d=ri(j[0].zoom),c=void 0,p={}),F=F.concat(Ir({key:`${U}[0]`,value:j[0],valueSpec:{zoom:{}},validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec,objectElementValidators:{zoom:Zs,value:k}}))}else F=F.concat(k({key:`${U}[0]`,value:j[0],validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec},j));return qo(Nn(j[1]))?F.concat([new De(`${U}[1]`,j[1],"expressions are not allowed in function stops.")]):F.concat(L.validateSpec({key:`${U}[1]`,value:j[1],valueSpec:t,validateSpec:L.validateSpec,style:L.style,styleSpec:L.styleSpec}))}function k(L,F){const j=_t(L.value),U=ri(L.value),H=L.value!==null?L.value:F;if(a){if(j!==a)return[new De(L.key,H,`${j} stop domain type must match previous stop domain type ${a}`)]}else a=j;if(j!=="number"&&j!=="string"&&j!=="boolean")return[new De(L.key,H,"stop domain value must be a number, string, or boolean")];if(j!=="number"&&r!=="categorical"){let se=`number expected, ${j} found`;return Ha(t)&&r===void 0&&(se+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new De(L.key,H,se)]}return r!=="categorical"||j!=="number"||isFinite(U)&&Math.floor(U)===U?r!=="categorical"&&j==="number"&&c!==void 0&&U<c?[new De(L.key,H,"stop domain values must appear in ascending order")]:(c=U,r==="categorical"&&U in p?[new De(L.key,H,"stop domain values must be unique")]:(p[U]=!0,[])):[new De(L.key,H,`integer expected, found ${U}`)]}}function Ja(n){const t=(n.expressionContext==="property"?ac:Wo)(Nn(n.value),n.valueSpec);if(t.result==="error")return t.value.map(a=>new De(`${n.key}${a.key}`,n.value,a.message));const r=t.value.expression||t.value._styleExpression.expression;if(n.expressionContext==="property"&&n.propertyKey==="text-font"&&!r.outputDefined())return[new De(n.key,n.value,`Invalid data expression for "${n.propertyKey}". Output values must be contained as literals within the expression.`)];if(n.expressionContext==="property"&&n.propertyType==="layout"&&!Fs(r))return[new De(n.key,n.value,'"feature-state" data expressions are not supported with layout properties.')];if(n.expressionContext==="filter"&&!Fs(r))return[new De(n.key,n.value,'"feature-state" data expressions are not supported with filters.')];if(n.expressionContext&&n.expressionContext.indexOf("cluster")===0){if(!qa(r,["zoom","feature-state"]))return[new De(n.key,n.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(n.expressionContext==="cluster-initial"&&!$o(r))return[new De(n.key,n.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function lc(n){const t=n.key,r=n.value,a=_t(r);return a!=="string"?[new De(t,r,`color expected, ${a} found`)]:gt.parse(String(r))?[]:[new De(t,r,`color expected, "${r}" found`)]}function Us(n){const t=n.key,r=n.value,a=n.valueSpec,c=[];return Array.isArray(a.values)?a.values.indexOf(ri(r))===-1&&c.push(new De(t,r,`expected one of [${a.values.join(", ")}], ${JSON.stringify(r)} found`)):Object.keys(a.values).indexOf(ri(r))===-1&&c.push(new De(t,r,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(r)} found`)),c}function cc(n){return Ns(Nn(n.value))?Ja(Ri({},n,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Ku(n)}function Ku(n){const t=n.value,r=n.key;if(_t(t)!=="array")return[new De(r,t,`array expected, ${_t(t)} found`)];const a=n.styleSpec;let c,d=[];if(t.length<1)return[new De(r,t,"filter array must have at least 1 element")];switch(d=d.concat(Us({key:`${r}[0]`,value:t[0],valueSpec:a.filter_operator,style:n.style,styleSpec:n.styleSpec})),ri(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&ri(t[1])==="$type"&&d.push(new De(r,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new De(r,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(c=_t(t[1]),c!=="string"&&d.push(new De(`${r}[1]`,t[1],`string expected, ${c} found`)));for(let p=2;p<t.length;p++)c=_t(t[p]),ri(t[1])==="$type"?d=d.concat(Us({key:`${r}[${p}]`,value:t[p],valueSpec:a.geometry_type,style:n.style,styleSpec:n.styleSpec})):c!=="string"&&c!=="number"&&c!=="boolean"&&d.push(new De(`${r}[${p}]`,t[p],`string, number, or boolean expected, ${c} found`));break;case"any":case"all":case"none":for(let p=1;p<t.length;p++)d=d.concat(Ku({key:`${r}[${p}]`,value:t[p],style:n.style,styleSpec:n.styleSpec}));break;case"has":case"!has":c=_t(t[1]),t.length!==2?d.push(new De(r,t,`filter array for "${t[0]}" operator must have 2 elements`)):c!=="string"&&d.push(new De(`${r}[1]`,t[1],`string expected, ${c} found`))}return d}function Ju(n,t){const r=n.key,a=n.validateSpec,c=n.style,d=n.styleSpec,p=n.value,m=n.objectKey,y=d[`${t}_${n.layerType}`];if(!y)return[];const b=m.match(/^(.*)-transition$/);if(t==="paint"&&b&&y[b[1]]&&y[b[1]].transition)return a({key:r,value:p,valueSpec:d.transition,style:c,styleSpec:d});const S=n.valueSpec||y[m];if(!S)return[new De(r,p,`unknown property "${m}"`)];let C;if(_t(p)==="string"&&Ha(S)&&!S.tokens&&(C=/^{([^}]+)}$/.exec(p)))return[new De(r,p,`"${m}" does not support interpolation syntax
|
|
6
|
-
Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(C[1])} }\`.`)];const k=[];return n.layerType==="symbol"&&(m==="text-field"&&c&&!c.glyphs&&k.push(new De(r,p,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&fa(Nn(p))&&ri(p.type)==="identity"&&k.push(new De(r,p,'"text-font" does not support identity functions'))),k.concat(a({key:n.key,value:p,valueSpec:S,style:c,styleSpec:d,expressionContext:"property",propertyType:t,propertyKey:m}))}function Qa(n){return Ju(n,"paint")}function es(n){return Ju(n,"layout")}function sr(n){let t=[];const r=n.value,a=n.key,c=n.style,d=n.styleSpec;if(_t(r)!=="object")return[new De(a,r,`object expected, ${_t(r)} found`)];r.type||r.ref||t.push(new De(a,r,'either "type" or "ref" is required'));let p=ri(r.type);const m=ri(r.ref);if(r.id){const y=ri(r.id);for(let b=0;b<n.arrayIndex;b++){const S=c.layers[b];ri(S.id)===y&&t.push(new De(a,r.id,`duplicate layer id "${r.id}", previously used at line ${S.id.__line__}`))}}if("ref"in r){let y;["type","source","source-layer","filter","layout"].forEach(b=>{b in r&&t.push(new De(a,r[b],`"${b}" is prohibited for ref layers`))}),c.layers.forEach(b=>{ri(b.id)===m&&(y=b)}),y?y.ref?t.push(new De(a,r.ref,"ref cannot reference another ref layer")):p=ri(y.type):t.push(new De(a,r.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(r.source){const y=c.sources&&c.sources[r.source],b=y&&ri(y.type);y?b==="vector"&&p==="raster"?t.push(new De(a,r.source,`layer "${r.id}" requires a raster source`)):b!=="raster-dem"&&p==="hillshade"||b!=="raster-dem"&&p==="color-relief"?t.push(new De(a,r.source,`layer "${r.id}" requires a raster-dem source`)):b==="raster"&&p!=="raster"?t.push(new De(a,r.source,`layer "${r.id}" requires a vector source`)):b!=="vector"||r["source-layer"]?b==="raster-dem"&&p!=="hillshade"&&p!=="color-relief"?t.push(new De(a,r.source,"raster-dem source can only be used with layer type 'hillshade' or 'color-relief'.")):p!=="line"||!r.paint||!r.paint["line-gradient"]||b==="geojson"&&y.lineMetrics||t.push(new De(a,r,`layer "${r.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new De(a,r,`layer "${r.id}" must specify a "source-layer"`)):t.push(new De(a,r.source,`source "${r.source}" not found`))}else t.push(new De(a,r,'missing required property "source"'));return t=t.concat(Ir({key:a,value:r,valueSpec:d.layer,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,objectElementValidators:{"*":()=>[],type:()=>n.validateSpec({key:`${a}.type`,value:r.type,valueSpec:d.layer.type,style:n.style,styleSpec:n.styleSpec,validateSpec:n.validateSpec,object:r,objectKey:"type"}),filter:cc,layout:y=>Ir({layer:r,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":b=>es(Ri({layerType:p},b))}}),paint:y=>Ir({layer:r,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":b=>Qa(Ri({layerType:p},b))}})}})),t}function Nr(n){const t=n.value,r=n.key,a=_t(t);return a!=="string"?[new De(r,t,`string expected, ${a} found`)]:[]}const uc={promoteId:function({key:n,value:t}){if(_t(t)==="string")return Nr({key:n,value:t});{const r=[];for(const a in t)r.push(...Nr({key:`${n}.${a}`,value:t[a]}));return r}}};function Qu(n){const t=n.value,r=n.key,a=n.styleSpec,c=n.style,d=n.validateSpec;if(!t.type)return[new De(r,t,'"type" is required')];const p=ri(t.type);let m;switch(p){case"vector":case"raster":return m=Ir({key:r,value:t,valueSpec:a[`source_${p.replace("-","_")}`],style:n.style,styleSpec:a,objectElementValidators:uc,validateSpec:d}),m;case"raster-dem":return m=function(y){var b;const S=(b=y.sourceName)!==null&&b!==void 0?b:"",C=y.value,k=y.styleSpec,L=k.source_raster_dem,F=y.style;let j=[];const U=_t(C);if(C===void 0)return j;if(U!=="object")return j.push(new De("source_raster_dem",C,`object expected, ${U} found`)),j;const H=ri(C.encoding)==="custom",se=["redFactor","greenFactor","blueFactor","baseShift"],J=y.value.encoding?`"${y.value.encoding}"`:"Default";for(const D in C)!H&&se.includes(D)?j.push(new De(D,C[D],`In "${S}": "${D}" is only valid when "encoding" is set to "custom". ${J} encoding found`)):L[D]?j=j.concat(y.validateSpec({key:D,value:C[D],valueSpec:L[D],validateSpec:y.validateSpec,style:F,styleSpec:k})):j.push(new De(D,C[D],`unknown property "${D}"`));return j}({sourceName:r,value:t,style:n.style,styleSpec:a,validateSpec:d}),m;case"geojson":if(m=Ir({key:r,value:t,valueSpec:a.source_geojson,style:c,styleSpec:a,validateSpec:d,objectElementValidators:uc}),t.cluster)for(const y in t.clusterProperties){const[b,S]=t.clusterProperties[y],C=typeof b=="string"?[b,["accumulated"],["get",y]]:b;m.push(...Ja({key:`${r}.${y}.map`,value:S,expressionContext:"cluster-map"})),m.push(...Ja({key:`${r}.${y}.reduce`,value:C,expressionContext:"cluster-reduce"}))}return m;case"video":return Ir({key:r,value:t,valueSpec:a.source_video,style:c,validateSpec:d,styleSpec:a});case"image":return Ir({key:r,value:t,valueSpec:a.source_image,style:c,validateSpec:d,styleSpec:a});case"canvas":return[new De(r,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Us({key:`${r}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function eh(n){const t=n.value,r=n.styleSpec,a=r.light,c=n.style;let d=[];const p=_t(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new De("light",t,`object expected, ${p} found`)]),d;for(const m in t){const y=m.match(/^(.*)-transition$/);d=d.concat(y&&a[y[1]]&&a[y[1]].transition?n.validateSpec({key:m,value:t[m],valueSpec:r.transition,validateSpec:n.validateSpec,style:c,styleSpec:r}):a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],validateSpec:n.validateSpec,style:c,styleSpec:r}):[new De(m,t[m],`unknown property "${m}"`)])}return d}function ts(n){const t=n.value,r=n.styleSpec,a=r.sky,c=n.style,d=_t(t);if(t===void 0)return[];if(d!=="object")return[new De("sky",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],style:c,styleSpec:r}):[new De(m,t[m],`unknown property "${m}"`)]);return p}function hc(n){const t=n.value,r=n.styleSpec,a=r.terrain,c=n.style;let d=[];const p=_t(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new De("terrain",t,`object expected, ${p} found`)]),d;for(const m in t)d=d.concat(a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],validateSpec:n.validateSpec,style:c,styleSpec:r}):[new De(m,t[m],`unknown property "${m}"`)]);return d}function Qo(n){let t=[];const r=n.value,a=n.key;if(Array.isArray(r)){const c=[],d=[];for(const p in r)r[p].id&&c.includes(r[p].id)&&t.push(new De(a,r,`all the sprites' ids must be unique, but ${r[p].id} is duplicated`)),c.push(r[p].id),r[p].url&&d.includes(r[p].url)&&t.push(new De(a,r,`all the sprites' URLs must be unique, but ${r[p].url} is duplicated`)),d.push(r[p].url),t=t.concat(Ir({key:`${a}[${p}]`,value:r[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:n.validateSpec}));return t}return Nr({key:a,value:r})}function th(n){return t=n.value,t&&t.constructor===Object?[]:[new De(n.key,n.value,`object expected, ${_t(n.value)} found`)];var t}const el={"*":()=>[],array:Jo,boolean:function(n){const t=n.value,r=n.key,a=_t(t);return a!=="boolean"?[new De(r,t,`boolean expected, ${a} found`)]:[]},number:Zs,color:lc,constants:Yu,enum:Us,filter:cc,function:Ka,layer:sr,object:Ir,source:Qu,light:eh,sky:ts,terrain:hc,projection:function(n){const t=n.value,r=n.styleSpec,a=r.projection,c=n.style,d=_t(t);if(t===void 0)return[];if(d!=="object")return[new De("projection",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(a[m]?n.validateSpec({key:m,value:t[m],valueSpec:a[m],style:c,styleSpec:r}):[new De(m,t[m],`unknown property "${m}"`)]);return p},projectionDefinition:function(n){const t=n.key;let r=n.value;r=r instanceof String?r.valueOf():r;const a=_t(r);return a!=="array"||function(c){return Array.isArray(c)&&c.length===3&&typeof c[0]=="string"&&typeof c[1]=="string"&&typeof c[2]=="number"}(r)||function(c){return!!["interpolate","step","literal"].includes(c[0])}(r)?["array","string"].includes(a)?[]:[new De(t,r,`projection expected, invalid type "${a}" found`)]:[new De(t,r,`projection expected, invalid array ${JSON.stringify(r)} found`)]},string:Nr,formatted:function(n){return Nr(n).length===0?[]:Ja(n)},resolvedImage:function(n){return Nr(n).length===0?[]:Ja(n)},padding:function(n){const t=n.key,r=n.value;if(_t(r)==="array"){if(r.length<1||r.length>4)return[new De(t,r,`padding requires 1 to 4 values; ${r.length} values found`)];const a={type:"number"};let c=[];for(let d=0;d<r.length;d++)c=c.concat(n.validateSpec({key:`${t}[${d}]`,value:r[d],validateSpec:n.validateSpec,valueSpec:a}));return c}return Zs({key:t,value:r,valueSpec:{}})},numberArray:function(n){const t=n.key,r=n.value;if(_t(r)==="array"){const a={type:"number"};if(r.length<1)return[new De(t,r,"array length at least 1 expected, length 0 found")];let c=[];for(let d=0;d<r.length;d++)c=c.concat(n.validateSpec({key:`${t}[${d}]`,value:r[d],validateSpec:n.validateSpec,valueSpec:a}));return c}return Zs({key:t,value:r,valueSpec:{}})},colorArray:function(n){const t=n.key,r=n.value;if(_t(r)==="array"){if(r.length<1)return[new De(t,r,"array length at least 1 expected, length 0 found")];let a=[];for(let c=0;c<r.length;c++)a=a.concat(lc({key:`${t}[${c}]`,value:r[c]}));return a}return lc({key:t,value:r})},variableAnchorOffsetCollection:function(n){const t=n.key,r=n.value,a=_t(r),c=n.styleSpec;if(a!=="array"||r.length<1||r.length%2!=0)return[new De(t,r,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let p=0;p<r.length;p+=2)d=d.concat(Us({key:`${t}[${p}]`,value:r[p],valueSpec:c.layout_symbol["text-anchor"]})),d=d.concat(Jo({key:`${t}[${p+1}]`,value:r[p+1],valueSpec:{length:2,value:"number"},validateSpec:n.validateSpec,style:n.style,styleSpec:c}));return d},sprite:Qo,state:th};function tl(n){const t=n.value,r=n.valueSpec,a=n.styleSpec;return n.validateSpec=tl,r.expression&&fa(ri(t))?Ka(n):r.expression&&qo(Nn(t))?Ja(n):r.type&&el[r.type]?el[r.type](n):Ir(Ri({},n,{valueSpec:r.type?a[r.type]:r}))}function is(n){const t=n.value,r=n.key,a=Nr(n);return a.length||(t.indexOf("{fontstack}")===-1&&a.push(new De(r,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&a.push(new De(r,t,'"glyphs" url must include a "{range}" token'))),a}function Er(n,t=ne){let r=[];return r=r.concat(tl({key:"",value:n,valueSpec:t.$root,styleSpec:t,style:n,validateSpec:tl,objectElementValidators:{glyphs:is,"*":()=>[]}})),n.constants&&(r=r.concat(Yu({key:"constants",value:n.constants}))),ih(r)}function Vr(n){return function(t){return n({...t,validateSpec:tl})}}function ih(n){return[].concat(n).sort((t,r)=>t.line-r.line)}function Ki(n){return function(...t){return ih(n.apply(this,t))}}Er.source=Ki(Vr(Qu)),Er.sprite=Ki(Vr(Qo)),Er.glyphs=Ki(Vr(is)),Er.light=Ki(Vr(eh)),Er.sky=Ki(Vr(ts)),Er.terrain=Ki(Vr(hc)),Er.state=Ki(Vr(th)),Er.layer=Ki(Vr(sr)),Er.filter=Ki(Vr(cc)),Er.paintProperty=Ki(Vr(Qa)),Er.layoutProperty=Ki(Vr(es));const rs=Er,Ad=rs.light,il=rs.sky,zd=rs.paintProperty,dc=rs.layoutProperty;function $s(n,t){let r=!1;if(t&&t.length)for(const a of t)n.fire(new de(new Error(a.message))),r=!0;return r}class ns{constructor(t,r,a){const c=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const p=new Int32Array(this.arrayBuffer);t=p[0],this.d=(r=p[1])+2*(a=p[2]);for(let y=0;y<this.d*this.d;y++){const b=p[3+y],S=p[3+y+1];c.push(b===S?null:p.subarray(b,S))}const m=p[3+c.length+1];this.keys=p.subarray(p[3+c.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=r+2*a;for(let p=0;p<this.d*this.d;p++)c.push([]);this.keys=[],this.bboxes=[]}this.n=r,this.extent=t,this.padding=a,this.scale=r/t,this.uid=0;const d=a/r*t;this.min=-d,this.max=t+d}insert(t,r,a,c,d){this._forEachCell(r,a,c,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(r),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,r,a,c,d,p){this.cells[d].push(p)}query(t,r,a,c,d){const p=this.min,m=this.max;if(t<=p&&r<=p&&m<=a&&m<=c&&!d)return Array.prototype.slice.call(this.keys);{const y=[];return this._forEachCell(t,r,a,c,this._queryCell,y,{},d),y}}_queryCell(t,r,a,c,d,p,m,y){const b=this.cells[d];if(b!==null){const S=this.keys,C=this.bboxes;for(let k=0;k<b.length;k++){const L=b[k];if(m[L]===void 0){const F=4*L;(y?y(C[F+0],C[F+1],C[F+2],C[F+3]):t<=C[F+2]&&r<=C[F+3]&&a>=C[F+0]&&c>=C[F+1])?(m[L]=!0,p.push(S[L])):m[L]=!1}}}}_forEachCell(t,r,a,c,d,p,m,y){const b=this._convertToCellCoord(t),S=this._convertToCellCoord(r),C=this._convertToCellCoord(a),k=this._convertToCellCoord(c);for(let L=b;L<=C;L++)for(let F=S;F<=k;F++){const j=this.d*F+L;if((!y||y(this._convertFromCellCoord(L),this._convertFromCellCoord(F),this._convertFromCellCoord(L+1),this._convertFromCellCoord(F+1)))&&d.call(this,t,r,a,c,j,p,m,y))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,r=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(r+a+this.keys.length+this.bboxes.length);c[0]=this.extent,c[1]=this.n,c[2]=this.padding;let d=r;for(let p=0;p<t.length;p++){const m=t[p];c[3+p]=d,c.set(m,d),d+=m.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,r){const a=t.toArrayBuffer();return r&&r.push(a),{buffer:a}}static deserialize(t){return new ns(t.buffer)}}const on={};function Ze(n,t,r={}){if(on[n])throw new Error(`${n} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:n,writeable:!1}),on[n]={klass:t,omit:r.omit||[],shallow:r.shallow||[]}}Ze("Object",Object),Ze("Set",Set),Ze("TransferableGridIndex",ns),Ze("Color",gt),Ze("Error",Error),Ze("AJAXError",Q),Ze("ResolvedImage",nr),Ze("StylePropertyFunction",js),Ze("StyleExpression",Go,{omit:["_evaluator"]}),Ze("ZoomDependentExpression",Ho),Ze("ZoomConstantExpression",Os),Ze("CompoundExpression",Cr,{omit:["_evaluate"]});for(const n in Ga)Ga[n]._classRegistryKey||Ze(`Expression_${n}`,Ga[n]);function pc(n){return n&&typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||n.constructor&&n.constructor.name==="ArrayBuffer")}function Gs(n){return n.$name||n.constructor._classRegistryKey}function fc(n){return!function(t){if(t===null||typeof t!="object")return!1;const r=Gs(t);return!(!r||r==="Object")}(n)&&(n==null||typeof n=="boolean"||typeof n=="number"||typeof n=="string"||n instanceof Boolean||n instanceof Number||n instanceof String||n instanceof Date||n instanceof RegExp||n instanceof Blob||n instanceof Error||pc(n)||Ln(n)||ArrayBuffer.isView(n)||n instanceof ImageData)}function qs(n,t){if(fc(n))return(pc(n)||Ln(n))&&t&&t.push(n),ArrayBuffer.isView(n)&&t&&t.push(n.buffer),n instanceof ImageData&&t&&t.push(n.data.buffer),n;if(Array.isArray(n)){const d=[];for(const p of n)d.push(qs(p,t));return d}if(typeof n!="object")throw new Error("can't serialize object of type "+typeof n);const r=Gs(n);if(!r)throw new Error(`can't serialize object of unregistered class ${n.constructor.name}`);if(!on[r])throw new Error(`${r} is not registered.`);const{klass:a}=on[r],c=a.serialize?a.serialize(n,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 n){if(!n.hasOwnProperty(d)||on[r].omit.indexOf(d)>=0)continue;const p=n[d];c[d]=on[r].shallow.indexOf(d)>=0?p:qs(p,t)}n instanceof Error&&(c.message=n.message)}if(c.$name)throw new Error("$name property is reserved for worker serialization logic.");return r!=="Object"&&(c.$name=r),c}function as(n){if(fc(n))return n;if(Array.isArray(n))return n.map(as);if(typeof n!="object")throw new Error("can't deserialize object of type "+typeof n);const t=Gs(n)||"Object";if(!on[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:r}=on[t];if(!r)throw new Error(`can't deserialize unregistered class ${t}`);if(r.deserialize)return r.deserialize(n);const a=Object.create(r.prototype);for(const c of Object.keys(n)){if(c==="$name")continue;const d=n[c];a[c]=on[t].shallow.indexOf(c)>=0?d:as(d)}return a}class mc{constructor(){this.first=!0}update(t,r){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=r):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=r),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=a,!0))}}const yt={"Latin-1 Supplement":n=>n>=128&&n<=255,"Hangul Jamo":n=>n>=4352&&n<=4607,Khmer:n=>n>=6016&&n<=6143,"General Punctuation":n=>n>=8192&&n<=8303,"Letterlike Symbols":n=>n>=8448&&n<=8527,"Number Forms":n=>n>=8528&&n<=8591,"Miscellaneous Technical":n=>n>=8960&&n<=9215,"Control Pictures":n=>n>=9216&&n<=9279,"Optical Character Recognition":n=>n>=9280&&n<=9311,"Enclosed Alphanumerics":n=>n>=9312&&n<=9471,"Geometric Shapes":n=>n>=9632&&n<=9727,"Miscellaneous Symbols":n=>n>=9728&&n<=9983,"Miscellaneous Symbols and Arrows":n=>n>=11008&&n<=11263,"Ideographic Description Characters":n=>n>=12272&&n<=12287,"CJK Symbols and Punctuation":n=>n>=12288&&n<=12351,Hiragana:n=>n>=12352&&n<=12447,Katakana:n=>n>=12448&&n<=12543,Kanbun:n=>n>=12688&&n<=12703,"CJK Strokes":n=>n>=12736&&n<=12783,"Enclosed CJK Letters and Months":n=>n>=12800&&n<=13055,"CJK Compatibility":n=>n>=13056&&n<=13311,"Yijing Hexagram Symbols":n=>n>=19904&&n<=19967,"CJK Unified Ideographs":n=>n>=19968&&n<=40959,"Hangul Syllables":n=>n>=44032&&n<=55215,"Private Use Area":n=>n>=57344&&n<=63743,"Vertical Forms":n=>n>=65040&&n<=65055,"CJK Compatibility Forms":n=>n>=65072&&n<=65103,"Small Form Variants":n=>n>=65104&&n<=65135,"Halfwidth and Fullwidth Forms":n=>n>=65280&&n<=65519};function gc(n){for(const t of n)if(nl(t.charCodeAt(0)))return!0;return!1}function rh(n){for(const t of n)if(!Rd(t.charCodeAt(0)))return!1;return!0}function rl(n){const t=n.map(r=>{try{return new RegExp(`\\p{sc=${r}}`,"u").source}catch{return null}}).filter(r=>r);return new RegExp(t.join("|"),"u")}const kd=rl(["Arab","Dupl","Mong","Ougr","Syrc"]);function Rd(n){return!kd.test(String.fromCodePoint(n))}const _c=rl(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function nl(n){return!(n!==746&&n!==747&&(n<4352||!(yt["CJK Compatibility Forms"](n)&&!(n>=65097&&n<=65103)||yt["CJK Compatibility"](n)||yt["CJK Strokes"](n)||!(!yt["CJK Symbols and Punctuation"](n)||n>=12296&&n<=12305||n>=12308&&n<=12319||n===12336)||yt["Enclosed CJK Letters and Months"](n)||yt["Ideographic Description Characters"](n)||yt.Kanbun(n)||yt.Katakana(n)&&n!==12540||!(!yt["Halfwidth and Fullwidth Forms"](n)||n===65288||n===65289||n===65293||n>=65306&&n<=65310||n===65339||n===65341||n===65343||n>=65371&&n<=65503||n===65507||n>=65512&&n<=65519)||!(!yt["Small Form Variants"](n)||n>=65112&&n<=65118||n>=65123&&n<=65126)||yt["Vertical Forms"](n)||yt["Yijing Hexagram Symbols"](n)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(n))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(n))||_c.test(String.fromCodePoint(n)))))}function yc(n){return!(nl(n)||function(t){return!!(yt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||yt["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)||yt["Letterlike Symbols"](t)||yt["Number Forms"](t)||yt["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)||yt["Control Pictures"](t)&&t!==9251||yt["Optical Character Recognition"](t)||yt["Enclosed Alphanumerics"](t)||yt["Geometric Shapes"](t)||yt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||yt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||yt["CJK Symbols and Punctuation"](t)||yt.Katakana(t)||yt["Private Use Area"](t)||yt["CJK Compatibility Forms"](t)||yt["Small Form Variants"](t)||yt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(n))}const nh=rl(["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 Ws(n){return nh.test(String.fromCodePoint(n))}function Dd(n,t){return!(!t&&Ws(n)||n>=2304&&n<=3583||n>=3840&&n<=4255||yt.Khmer(n))}function xc(n){for(const t of n)if(Ws(t.charCodeAt(0)))return!0;return!1}const Vn=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(n){this.pluginStatus=n.pluginStatus,this.pluginURL=n.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(n){if(Vn.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=n.applyArabicShaping,this.processBidirectionalText=n.processBidirectionalText,this.processStyledBidirectionalText=n.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(n,t){return o(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(n.pluginStatus!=="loading")return this.setState(n),n;const r=n.pluginURL,a=new Promise(d=>{this.loadScriptResolve=d});t(r);const c=new Promise(d=>setTimeout(()=>d(),this.TIMEOUT));if(yield Promise.race([a,c]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:r};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${r}`)})}};class Wt{constructor(t,r){this.zoom=t,r?(this.now=r.now||0,this.fadeDuration=r.fadeDuration||0,this.zoomHistory=r.zoomHistory||new mc,this.transition=r.transition||{},this.globalState=r.globalState||{}):(this.now=0,this.fadeDuration=0,this.zoomHistory=new mc,this.transition={},this.globalState={})}isSupportedScript(t){return function(r,a){for(const c of r)if(!Dd(c.charCodeAt(0),a))return!1;return!0}(t,Vn.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,r=t-Math.floor(t),a=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:r+(1-r)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*r}}}class Hs{constructor(t,r){this.property=t,this.value=r,this.expression=function(a,c){if(fa(a))return new js(a,c);if(qo(a)){const d=ac(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!=="numberArray"||typeof a!="number"&&!Array.isArray(a)?c.type!=="colorArray"||typeof a!="string"&&!Array.isArray(a)?c.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?d=bt.parse(a):c.type==="projectionDefinition"&&typeof a=="string"&&(d=at.parse(a)):d=Ti.parse(a):d=Zi.parse(a):d=pi.parse(a),{globalStateRefs:new Set,kind:"constant",evaluate:()=>d}}}(r===void 0?t.specification.default:r,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}getGlobalStateRefs(){return this.expression.globalStateRefs||new Set}possiblyEvaluate(t,r,a){return this.property.possiblyEvaluate(this,t,r,a)}}class al{constructor(t){this.property=t,this.value=new Hs(t,void 0)}transitioned(t,r){return new ah(this.property,this.value,r,Hi({},t.transition,this.transition),t.now)}untransitioned(){return new ah(this.property,this.value,null,{},0)}}class vc{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Sr(this._values[t].value.value)}setValue(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new al(this._values[t].property)),this._values[t].value=new Hs(this._values[t].property,r===null?void 0:Sr(r))}getTransition(t){return Sr(this._values[t].transition)}setTransition(t,r){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new al(this._values[t].property)),this._values[t].transition=Sr(r)||void 0}serialize(){const t={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(t[r]=a);const c=this.getTransition(r);c!==void 0&&(t[`${r}-transition`]=c)}return t}transitioned(t,r){const a=new sh(this._properties);for(const c of Object.keys(this._values))a._values[c]=this._values[c].transitioned(t,r._values[c]);return a}untransitioned(){const t=new sh(this._properties);for(const r of Object.keys(this._values))t._values[r]=this._values[r].untransitioned();return t}}class ah{constructor(t,r,a,c,d){this.property=t,this.value=r,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,r,a){const c=t.now||0,d=this.value.possiblyEvaluate(t,r,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,r,a);{const m=(c-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(t,r,a),d,Br(m))}}return d}}class sh{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,r,a){const c=new sl(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,r,a);return c}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class Ld{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return Sr(this._values[t].value)}setValue(t,r){this._values[t]=new Hs(this._values[t].property,r===null?void 0:Sr(r))}serialize(){const t={};for(const r of Object.keys(this._values)){const a=this.getValue(r);a!==void 0&&(t[r]=a)}return t}possiblyEvaluate(t,r,a){const c=new sl(this._properties);for(const d of Object.keys(this._values))c._values[d]=this._values[d].possiblyEvaluate(t,r,a);return c}}class ln{constructor(t,r,a){this.property=t,this.value=r,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,r,a,c){return this.property.evaluate(this.value,this.parameters,t,r,a,c)}}class sl{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class qe{constructor(t){this.specification=t}possiblyEvaluate(t,r){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(r)}interpolate(t,r,a){const c=yr[this.specification.type];return c?c(t,r,a):t}}class et{constructor(t,r){this.specification=t,this.overrides=r}possiblyEvaluate(t,r,a,c){return new ln(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(r,null,{},a,c)}:t.expression,r)}interpolate(t,r,a){if(t.value.kind!=="constant"||r.value.kind!=="constant")return t;if(t.value.value===void 0||r.value.value===void 0)return new ln(this,{kind:"constant",value:void 0},t.parameters);const c=yr[this.specification.type];if(c){const d=c(t.value.value,r.value.value,a);return new ln(this,{kind:"constant",value:d},t.parameters)}return t}evaluate(t,r,a,c,d,p){return t.kind==="constant"?t.value:t.evaluate(r,a,c,d,p)}}class ol extends et{possiblyEvaluate(t,r,a,c){if(t.value===void 0)return new ln(this,{kind:"constant",value:void 0},r);if(t.expression.kind==="constant"){const d=t.expression.evaluate(r,null,{},a,c),p=t.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,m=this._calculate(p,p,p,r);return new ln(this,{kind:"constant",value:m},r)}if(t.expression.kind==="camera"){const d=this._calculate(t.expression.evaluate({zoom:r.zoom-1}),t.expression.evaluate({zoom:r.zoom}),t.expression.evaluate({zoom:r.zoom+1}),r);return new ln(this,{kind:"constant",value:d},r)}return new ln(this,t.expression,r)}evaluate(t,r,a,c,d,p){if(t.kind==="source"){const m=t.evaluate(r,a,c,d,p);return this._calculate(m,m,m,r)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(r.zoom)-1},a,c),t.evaluate({zoom:Math.floor(r.zoom)},a,c),t.evaluate({zoom:Math.floor(r.zoom)+1},a,c),r):t.value}_calculate(t,r,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class bc{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,c){if(t.value!==void 0){if(t.expression.kind==="constant"){const d=t.expression.evaluate(r,null,{},a,c);return this._calculate(d,d,d,r)}return this._calculate(t.expression.evaluate(new Wt(Math.floor(r.zoom-1),r)),t.expression.evaluate(new Wt(Math.floor(r.zoom),r)),t.expression.evaluate(new Wt(Math.floor(r.zoom+1),r)),r)}}_calculate(t,r,a,c){return c.zoom>c.zoomHistory.lastIntegerZoom?{from:t,to:r}:{from:a,to:r}}interpolate(t){return t}}class Xs{constructor(t){this.specification=t}possiblyEvaluate(t,r,a,c){return!!t.expression.evaluate(r,null,{},a,c)}interpolate(){return!1}}class Ji{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const r in t){const a=t[r];a.specification.overridable&&this.overridableProperties.push(r);const c=this.defaultPropertyValues[r]=new Hs(a,void 0),d=this.defaultTransitionablePropertyValues[r]=new al(a);this.defaultTransitioningPropertyValues[r]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[r]=c.possiblyEvaluate({})}}}Ze("DataDrivenProperty",et),Ze("DataConstantProperty",qe),Ze("CrossFadedDataDrivenProperty",ol),Ze("CrossFadedProperty",bc),Ze("ColorRampProperty",Xs);const oh="-transition";class Di extends Me{constructor(t,r){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1,getGlobalStateRefs:()=>new Set},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,this._featureFilter=jn(t.filter)),r.layout&&(this._unevaluatedLayout=new Ld(r.layout)),r.paint)){this._transitionablePaint=new vc(r.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 sl(r.paint)}}setFilter(t){this.filter=t,this._featureFilter=jn(t)}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}getLayoutAffectingGlobalStateRefs(){const t=new Set;if(this._unevaluatedLayout)for(const r in this._unevaluatedLayout._values){const a=this._unevaluatedLayout._values[r];for(const c of a.getGlobalStateRefs())t.add(c)}for(const r of this._featureFilter.getGlobalStateRefs())t.add(r);return t}setLayoutProperty(t,r,a={}){r!=null&&this._validate(dc,`layers.${this.id}.layout.${t}`,t,r,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,r):this.visibility=r)}getPaintProperty(t){return t.endsWith(oh)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,r,a={}){if(r!=null&&this._validate(zd,`layers.${this.id}.paint.${t}`,t,r,a))return!1;if(t.endsWith(oh))return this._transitionablePaint.setTransition(t.slice(0,-11),r||void 0),!1;{const c=this._transitionablePaint._values[t],d=c.property.specification["property-type"]==="cross-faded-data-driven",p=c.value.isDataDriven(),m=c.value;this._transitionablePaint.setValue(t,r),this._handleSpecialPaintPropertyUpdate(t);const y=this._transitionablePaint._values[t].value;return y.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(t,m,y)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,r,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,r){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,r)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,r)}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),en(t,(r,a)=>!(r===void 0||a==="layout"&&!Object.keys(r).length||a==="paint"&&!Object.keys(r).length))}_validate(t,r,a,c,d={}){return(!d||d.validate!==!1)&&$s(this,t.call(rs,{key:r,layerType:this.type,objectKey:a,value:c,styleSpec:ne,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const r=this.paint.get(t);if(r instanceof ln&&Ha(r.property.specification)&&(r.value.kind==="source"||r.value.kind==="composite")&&r.value.isStateDependent)return!0}return!1}}const lh={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class ma{constructor(t,r){this._structArray=t,this._pos1=r*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Kt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,r){return t._trim(),r&&(t.isTransferred=!0,r.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const r=Object.create(this.prototype);return r.arrayBuffer=t.arrayBuffer,r.length=t.length,r.capacity=t.arrayBuffer.byteLength/r.bytesPerElement,r._refreshViews(),r}_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 r=this.uint8;this._refreshViews(),r&&this.uint8.set(r)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function ni(n,t=1){let r=0,a=0;return{members:n.map(c=>{const d=lh[c.type].BYTES_PER_ELEMENT,p=r=ch(r,Math.max(t,d)),m=c.components||1;return a=Math.max(a,d),r+=d*m,{name:c.name,type:c.type,components:m,offset:p}}),size:ch(r,Math.max(a,t)),alignment:t}}function ch(n,t){return Math.ceil(n/t)*t}class Zn extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r){const a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){const c=2*t;return this.int16[c+0]=r,this.int16[c+1]=a,t}}Zn.prototype.bytesPerElement=4,Ze("StructArrayLayout2i4",Zn);class Un extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.int16[d+0]=r,this.int16[d+1]=a,this.int16[d+2]=c,t}}Un.prototype.bytesPerElement=6,Ze("StructArrayLayout3i6",Un);class wc extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,a,c)}emplace(t,r,a,c,d){const p=4*t;return this.int16[p+0]=r,this.int16[p+1]=a,this.int16[p+2]=c,this.int16[p+3]=d,t}}wc.prototype.bytesPerElement=8,Ze("StructArrayLayout4i8",wc);class ll extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=6*t;return this.int16[y+0]=r,this.int16[y+1]=a,this.int16[y+2]=c,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}ll.prototype.bytesPerElement=12,Ze("StructArrayLayout2i4i12",ll);class ga extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=4*t,b=8*t;return this.int16[y+0]=r,this.int16[y+1]=a,this.uint8[b+4]=c,this.uint8[b+5]=d,this.uint8[b+6]=p,this.uint8[b+7]=m,t}}ga.prototype.bytesPerElement=8,Ze("StructArrayLayout2i4ub8",ga);class Ys extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r){const a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){const c=2*t;return this.float32[c+0]=r,this.float32[c+1]=a,t}}Ys.prototype.bytesPerElement=8,Ze("StructArrayLayout2f8",Ys);class Tc extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,b,S){const C=this.length;return this.resize(C+1),this.emplace(C,t,r,a,c,d,p,m,y,b,S)}emplace(t,r,a,c,d,p,m,y,b,S,C){const k=10*t;return this.uint16[k+0]=r,this.uint16[k+1]=a,this.uint16[k+2]=c,this.uint16[k+3]=d,this.uint16[k+4]=p,this.uint16[k+5]=m,this.uint16[k+6]=y,this.uint16[k+7]=b,this.uint16[k+8]=S,this.uint16[k+9]=C,t}}Tc.prototype.bytesPerElement=20,Ze("StructArrayLayout10ui20",Tc);class cl extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p,m,y,b,S,C,k){const L=this.length;return this.resize(L+1),this.emplace(L,t,r,a,c,d,p,m,y,b,S,C,k)}emplace(t,r,a,c,d,p,m,y,b,S,C,k,L){const F=12*t;return this.int16[F+0]=r,this.int16[F+1]=a,this.int16[F+2]=c,this.int16[F+3]=d,this.uint16[F+4]=p,this.uint16[F+5]=m,this.uint16[F+6]=y,this.uint16[F+7]=b,this.int16[F+8]=S,this.int16[F+9]=C,this.int16[F+10]=k,this.int16[F+11]=L,t}}cl.prototype.bytesPerElement=24,Ze("StructArrayLayout4i4ui4i24",cl);class Sc extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.float32[d+0]=r,this.float32[d+1]=a,this.float32[d+2]=c,t}}Sc.prototype.bytesPerElement=12,Ze("StructArrayLayout3f12",Sc);class u extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint32[1*t+0]=r,t}}u.prototype.bytesPerElement=4,Ze("StructArrayLayout1ul4",u);class e extends Kt{_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,r,a,c,d,p,m,y,b){const S=this.length;return this.resize(S+1),this.emplace(S,t,r,a,c,d,p,m,y,b)}emplace(t,r,a,c,d,p,m,y,b,S){const C=10*t,k=5*t;return this.int16[C+0]=r,this.int16[C+1]=a,this.int16[C+2]=c,this.int16[C+3]=d,this.int16[C+4]=p,this.int16[C+5]=m,this.uint32[k+3]=y,this.uint16[C+8]=b,this.uint16[C+9]=S,t}}e.prototype.bytesPerElement=20,Ze("StructArrayLayout6i1ul2ui20",e);class i extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=6*t;return this.int16[y+0]=r,this.int16[y+1]=a,this.int16[y+2]=c,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}i.prototype.bytesPerElement=12,Ze("StructArrayLayout2i2i2i12",i);class s extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d){const p=this.length;return this.resize(p+1),this.emplace(p,t,r,a,c,d)}emplace(t,r,a,c,d,p){const m=4*t,y=8*t;return this.float32[m+0]=r,this.float32[m+1]=a,this.float32[m+2]=c,this.int16[y+6]=d,this.int16[y+7]=p,t}}s.prototype.bytesPerElement=16,Ze("StructArrayLayout2f1f2i16",s);class l extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,r,a,c,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,r,a,c,d,p)}emplace(t,r,a,c,d,p,m){const y=16*t,b=4*t,S=8*t;return this.uint8[y+0]=r,this.uint8[y+1]=a,this.float32[b+1]=c,this.float32[b+2]=d,this.int16[S+6]=p,this.int16[S+7]=m,t}}l.prototype.bytesPerElement=16,Ze("StructArrayLayout2ub2f2i16",l);class h extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.uint16[d+0]=r,this.uint16[d+1]=a,this.uint16[d+2]=c,t}}h.prototype.bytesPerElement=6,Ze("StructArrayLayout3ui6",h);class f extends Kt{_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,r,a,c,d,p,m,y,b,S,C,k,L,F,j,U,H){const se=this.length;return this.resize(se+1),this.emplace(se,t,r,a,c,d,p,m,y,b,S,C,k,L,F,j,U,H)}emplace(t,r,a,c,d,p,m,y,b,S,C,k,L,F,j,U,H,se){const J=24*t,D=12*t,Z=48*t;return this.int16[J+0]=r,this.int16[J+1]=a,this.uint16[J+2]=c,this.uint16[J+3]=d,this.uint32[D+2]=p,this.uint32[D+3]=m,this.uint32[D+4]=y,this.uint16[J+10]=b,this.uint16[J+11]=S,this.uint16[J+12]=C,this.float32[D+7]=k,this.float32[D+8]=L,this.uint8[Z+36]=F,this.uint8[Z+37]=j,this.uint8[Z+38]=U,this.uint32[D+10]=H,this.int16[J+22]=se,t}}f.prototype.bytesPerElement=48,Ze("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",f);class _ extends Kt{_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,r,a,c,d,p,m,y,b,S,C,k,L,F,j,U,H,se,J,D,Z,te,me,Ce,ve,Te,ze,Ee){const ke=this.length;return this.resize(ke+1),this.emplace(ke,t,r,a,c,d,p,m,y,b,S,C,k,L,F,j,U,H,se,J,D,Z,te,me,Ce,ve,Te,ze,Ee)}emplace(t,r,a,c,d,p,m,y,b,S,C,k,L,F,j,U,H,se,J,D,Z,te,me,Ce,ve,Te,ze,Ee,ke){const Pe=32*t,Ge=16*t;return this.int16[Pe+0]=r,this.int16[Pe+1]=a,this.int16[Pe+2]=c,this.int16[Pe+3]=d,this.int16[Pe+4]=p,this.int16[Pe+5]=m,this.int16[Pe+6]=y,this.int16[Pe+7]=b,this.uint16[Pe+8]=S,this.uint16[Pe+9]=C,this.uint16[Pe+10]=k,this.uint16[Pe+11]=L,this.uint16[Pe+12]=F,this.uint16[Pe+13]=j,this.uint16[Pe+14]=U,this.uint16[Pe+15]=H,this.uint16[Pe+16]=se,this.uint16[Pe+17]=J,this.uint16[Pe+18]=D,this.uint16[Pe+19]=Z,this.uint16[Pe+20]=te,this.uint16[Pe+21]=me,this.uint16[Pe+22]=Ce,this.uint32[Ge+12]=ve,this.float32[Ge+13]=Te,this.float32[Ge+14]=ze,this.uint16[Pe+30]=Ee,this.uint16[Pe+31]=ke,t}}_.prototype.bytesPerElement=64,Ze("StructArrayLayout8i15ui1ul2f2ui64",_);class x extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.float32[1*t+0]=r,t}}x.prototype.bytesPerElement=4,Ze("StructArrayLayout1f4",x);class T extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=3*t;return this.uint16[6*t+0]=r,this.float32[d+1]=a,this.float32[d+2]=c,t}}T.prototype.bytesPerElement=12,Ze("StructArrayLayout1ui2f12",T);class M extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r,a){const c=this.length;return this.resize(c+1),this.emplace(c,t,r,a)}emplace(t,r,a,c){const d=4*t;return this.uint32[2*t+0]=r,this.uint16[d+2]=a,this.uint16[d+3]=c,t}}M.prototype.bytesPerElement=8,Ze("StructArrayLayout1ul2ui8",M);class A extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,r){const a=this.length;return this.resize(a+1),this.emplace(a,t,r)}emplace(t,r,a){const c=2*t;return this.uint16[c+0]=r,this.uint16[c+1]=a,t}}A.prototype.bytesPerElement=4,Ze("StructArrayLayout2ui4",A);class E extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const r=this.length;return this.resize(r+1),this.emplace(r,t)}emplace(t,r){return this.uint16[1*t+0]=r,t}}E.prototype.bytesPerElement=2,Ze("StructArrayLayout1ui2",E);class R extends Kt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,r,a,c){const d=this.length;return this.resize(d+1),this.emplace(d,t,r,a,c)}emplace(t,r,a,c,d){const p=4*t;return this.float32[p+0]=r,this.float32[p+1]=a,this.float32[p+2]=c,this.float32[p+3]=d,t}}R.prototype.bytesPerElement=16,Ze("StructArrayLayout4f16",R);class O extends ma{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 Be(this.anchorPointX,this.anchorPointY)}}O.prototype.size=20;class q extends e{get(t){return new O(this,t)}}Ze("CollisionBoxArray",q);class $ extends ma{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]}}$.prototype.size=48;class W extends f{get(t){return new $(this,t)}}Ze("PlacedSymbolArray",W);class X extends ma{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]}}X.prototype.size=64;class ee extends _{get(t){return new X(this,t)}}Ze("SymbolInstanceArray",ee);class Y extends x{getoffsetX(t){return this.float32[1*t+0]}}Ze("GlyphOffsetArray",Y);class ie extends Un{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ze("SymbolLineVertexArray",ie);class re extends ma{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]}}re.prototype.size=12;class K extends T{get(t){return new re(this,t)}}Ze("TextAnchorOffsetArray",K);class oe extends ma{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]}}oe.prototype.size=8;class _e extends M{get(t){return new oe(this,t)}}Ze("FeatureIndexArray",_e);class pe extends Zn{}class fe extends Zn{}class xe extends Zn{}class Fe extends ll{}class Le extends ga{}class Ie extends Ys{}class $e extends Tc{}class ot extends cl{}class Ct extends Sc{}class Jt extends u{}class Bt extends i{}class Qt extends l{}class Nt extends h{}class Ot extends A{}const Vt=ni([{name:"a_pos",components:2,type:"Int16"}],4),{members:Li}=Vt;class Tt{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,r,a,c){const d=this.segments[this.segments.length-1];return t>Tt.MAX_VERTEX_ARRAY_LENGTH&&ki(`Max vertices per segment is ${Tt.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${Tt.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+t>Tt.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==c?this.createNewSegment(r,a,c):d}createNewSegment(t,r,a){const c={vertexOffset:t.length,primitiveOffset:r.length,vertexLength:0,primitiveLength:0,vaos:{}};return a!==void 0&&(c.sortKey=a),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(c),c}getOrCreateLatestSegment(t,r,a){return this.prepareSegment(0,t,r,a)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const r in t.vaos)t.vaos[r].destroy()}static simpleSegment(t,r,a,c){return new Tt([{vertexOffset:t,primitiveOffset:r,vertexLength:a,primitiveLength:c,vaos:{},sortKey:0}])}}function Pi(n,t){return 256*(n=ci(Math.floor(n),0,255))+ci(Math.floor(t),0,255)}Tt.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ze("SegmentVector",Tt);const Fi=ni([{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 $n,Gn,qn,cn={exports:{}},Ks={exports:{}},Js={exports:{}},ss=function(){if(qn)return cn.exports;qn=1;var n=($n||($n=1,Ks.exports=function(r,a){var c,d,p,m,y,b,S,C;for(d=r.length-(c=3&r.length),p=a,y=3432918353,b=461845907,C=0;C<d;)S=255&r.charCodeAt(C)|(255&r.charCodeAt(++C))<<8|(255&r.charCodeAt(++C))<<16|(255&r.charCodeAt(++C))<<24,++C,p=27492+(65535&(m=5*(65535&(p=(p^=S=(65535&(S=(S=(65535&S)*y+(((S>>>16)*y&65535)<<16)&4294967295)<<15|S>>>17))*b+(((S>>>16)*b&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(S=0,c){case 3:S^=(255&r.charCodeAt(C+2))<<16;case 2:S^=(255&r.charCodeAt(C+1))<<8;case 1:p^=S=(65535&(S=(S=(65535&(S^=255&r.charCodeAt(C)))*y+(((S>>>16)*y&65535)<<16)&4294967295)<<15|S>>>17))*b+(((S>>>16)*b&65535)<<16)&4294967295}return p^=r.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}),Ks.exports),t=(Gn||(Gn=1,Js.exports=function(r,a){for(var c,d=r.length,p=a^d,m=0;d>=4;)c=1540483477*(65535&(c=255&r.charCodeAt(m)|(255&r.charCodeAt(++m))<<8|(255&r.charCodeAt(++m))<<16|(255&r.charCodeAt(++m))<<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,++m;switch(d){case 3:p^=(255&r.charCodeAt(m+2))<<16;case 2:p^=(255&r.charCodeAt(m+1))<<8;case 1:p=1540483477*(65535&(p^=255&r.charCodeAt(m)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0}),Js.exports);return cn.exports=n,cn.exports.murmur3=n,cn.exports.murmur2=t,cn.exports}(),or=ye(ss);class Zr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,r,a,c){this.ids.push(Wn(t)),this.positions.push(r,a,c)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const r=Wn(t);let a=0,c=this.ids.length-1;for(;a<c;){const p=a+c>>1;this.ids[p]>=r?c=p:a=p+1}const d=[];for(;this.ids[a]===r;)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,r){const a=new Float64Array(t.ids),c=new Uint32Array(t.positions);return _a(a,c,0,a.length-1),r&&r.push(a.buffer,c.buffer),{ids:a,positions:c}}static deserialize(t){const r=new Zr;return r.ids=t.ids,r.positions=t.positions,r.indexed=!0,r}}function Wn(n){const t=+n;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:or(String(n))}function _a(n,t,r,a){for(;r<a;){const c=n[r+a>>1];let d=r-1,p=a+1;for(;;){do d++;while(n[d]<c);do p--;while(n[p]>c);if(d>=p)break;si(n,d,p),si(t,3*d,3*p),si(t,3*d+1,3*p+1),si(t,3*d+2,3*p+2)}p-r<a-p?(_a(n,t,r,p),r=p+1):(_a(n,t,p+1,a),a=p)}}function si(n,t,r){const a=n[t];n[t]=n[r],n[r]=a}Ze("FeaturePositionMap",Zr);class Ut{constructor(t,r){this.gl=t.gl,this.location=r}}class Qi extends Ut{constructor(t,r){super(t,r),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class _i extends Ut{constructor(t,r){super(t,r),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 uh extends Ut{constructor(t,r){super(t,r),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 Fd=new Float32Array(16);function Pc(n){return[Pi(255*n.r,255*n.g),Pi(255*n.b,255*n.a)]}class Qs{constructor(t,r,a){this.value=t,this.uniformNames=r.map(c=>`u_${c}`),this.type=a}setUniform(t,r,a){t.set(a.constantOr(this.value))}getBinding(t,r,a){return this.type==="color"?new uh(t,r):new Qi(t,r)}}class os{constructor(t,r){this.uniformNames=r.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,r){this.pixelRatioFrom=r.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=r.tlbr,this.patternTo=t.tlbr}setUniform(t,r,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,r,a){return a.substr(0,9)==="u_pattern"?new _i(t,r):new Qi(t,r)}}class Tn{constructor(t,r,a,c){this.expression=t,this.type=a,this.maxValue=0,this.paintVertexAttributes=r.map(d=>({name:`a_${d}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new c}populatePaintArray(t,r,a,c,d){const p=this.paintVertexArray.length,m=this.expression.evaluate(new Wt(0),r,{},c,[],d);this.paintVertexArray.resize(t),this._setPaintValue(p,t,m)}updatePaintArray(t,r,a,c){const d=this.expression.evaluate({zoom:0},a,c);this._setPaintValue(t,r,d)}_setPaintValue(t,r,a){if(this.type==="color"){const c=Pc(a);for(let d=t;d<r;d++)this.paintVertexArray.emplace(d,c[0],c[1])}else{for(let c=t;c<r;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 Bi{constructor(t,r,a,c,d,p){this.expression=t,this.uniformNames=r.map(m=>`u_${m}_t`),this.type=a,this.useIntegerZoom=c,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=r.map(m=>({name:`a_${m}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(t,r,a,c,d){const p=this.expression.evaluate(new Wt(this.zoom),r,{},c,[],d),m=this.expression.evaluate(new Wt(this.zoom+1),r,{},c,[],d),y=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(y,t,p,m)}updatePaintArray(t,r,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,r,d,p)}_setPaintValue(t,r,a,c){if(this.type==="color"){const d=Pc(a),p=Pc(c);for(let m=t;m<r;m++)this.paintVertexArray.emplace(m,d[0],d[1],p[0],p[1])}else{for(let d=t;d<r;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,r){const a=this.useIntegerZoom?Math.floor(r.zoom):r.zoom,c=ci(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(c)}getBinding(t,r,a){return new Qi(t,r)}}class Sn{constructor(t,r,a,c,d,p){this.expression=t,this.type=r,this.useIntegerZoom=a,this.zoom=c,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(t,r,a){const c=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(c,t,r.patterns&&r.patterns[this.layerId],a)}updatePaintArray(t,r,a,c,d){this._setPaintValues(t,r,a.patterns&&a.patterns[this.layerId],d)}_setPaintValues(t,r,a,c){if(!c||!a)return;const{min:d,mid:p,max:m}=a,y=c[d],b=c[p],S=c[m];if(y&&b&&S)for(let C=t;C<r;C++)this.zoomInPaintVertexArray.emplace(C,b.tl[0],b.tl[1],b.br[0],b.br[1],y.tl[0],y.tl[1],y.br[0],y.br[1],b.pixelRatio,y.pixelRatio),this.zoomOutPaintVertexArray.emplace(C,b.tl[0],b.tl[1],b.br[0],b.br[1],S.tl[0],S.tl[1],S.br[0],S.br[1],b.pixelRatio,S.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,Fi.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,Fi.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class Mc{constructor(t,r,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 ln&&Ha(p.property.specification)))continue;const m=Cc(d,t.type),y=p.value,b=p.property.specification.type,S=p.property.useIntegerZoom,C=p.property.specification["property-type"],k=C==="cross-faded"||C==="cross-faded-data-driven";if(y.kind==="constant")this.binders[d]=k?new os(y.value,m):new Qs(y.value,m,b),c.push(`/u_${d}`);else if(y.kind==="source"||k){const L=Ic(d,b,"source");this.binders[d]=k?new Sn(y,b,S,r,L,t.id):new Tn(y,m,b,L),c.push(`/a_${d}`)}else{const L=Ic(d,b,"composite");this.binders[d]=new Bi(y,m,b,S,r,L),c.push(`/z_${d}`)}}this.cacheKey=c.sort().join("")}getMaxValue(t){const r=this.binders[t];return r instanceof Tn||r instanceof Bi?r.maxValue:0}populatePaintArrays(t,r,a,c,d){for(const p in this.binders){const m=this.binders[p];(m instanceof Tn||m instanceof Bi||m instanceof Sn)&&m.populatePaintArray(t,r,a,c,d)}}setConstantPatternPositions(t,r){for(const a in this.binders){const c=this.binders[a];c instanceof os&&c.setConstantPatternPositions(t,r)}}updatePaintArrays(t,r,a,c,d){let p=!1;for(const m in t){const y=r.getPositions(m);for(const b of y){const S=a.feature(b.index);for(const C in this.binders){const k=this.binders[C];if((k instanceof Tn||k instanceof Bi||k instanceof Sn)&&k.expression.isStateDependent===!0){const L=c.paint.get(C);k.expression=L.value,k.updatePaintArray(b.start,b.end,S,t[m],d),p=!0}}}}return p}defines(){const t=[];for(const r in this.binders){const a=this.binders[r];(a instanceof Qs||a instanceof os)&&t.push(...a.uniformNames.map(c=>`#define HAS_UNIFORM_${c}`))}return t}getBinderAttributes(){const t=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof Tn||a instanceof Bi)for(let c=0;c<a.paintVertexAttributes.length;c++)t.push(a.paintVertexAttributes[c].name);else if(a instanceof Sn)for(let c=0;c<Fi.members.length;c++)t.push(Fi.members[c].name)}return t}getBinderUniforms(){const t=[];for(const r in this.binders){const a=this.binders[r];if(a instanceof Qs||a instanceof os||a instanceof Bi)for(const c of a.uniformNames)t.push(c)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,r){const a=[];for(const c in this.binders){const d=this.binders[c];if(d instanceof Qs||d instanceof os||d instanceof Bi){for(const p of d.uniformNames)if(r[p]){const m=d.getBinding(t,r[p],p);a.push({name:p,property:c,binding:m})}}}return a}setUniforms(t,r,a,c){for(const{name:d,property:p,binding:m}of r)this.binders[p].setUniform(m,c,a.get(p),d)}updatePaintBuffers(t){this._buffers=[];for(const r in this.binders){const a=this.binders[r];if(t&&a instanceof Sn){const c=t.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;c&&this._buffers.push(c)}else(a instanceof Tn||a instanceof Bi)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(t){for(const r in this.binders){const a=this.binders[r];(a instanceof Tn||a instanceof Bi||a instanceof Sn)&&a.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const r=this.binders[t];(r instanceof Tn||r instanceof Bi||r instanceof Sn)&&r.destroy()}}}class Hn{constructor(t,r,a=()=>!0){this.programConfigurations={};for(const c of t)this.programConfigurations[c.id]=new Mc(c,r,a);this.needsUpload=!1,this._featureMap=new Zr,this._bufferOffset=0}populatePaintArrays(t,r,a,c,d,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(t,r,c,d,p);r.id!==void 0&&this._featureMap.add(r.id,a,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,r,a,c){for(const d of a)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(t,this._featureMap,r,d,c)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const r in this.programConfigurations)this.programConfigurations[r].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function Cc(n,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"]}[n]||[n.replace(`${t}-`,"").replace(/-/g,"_")]}function Ic(n,t,r){const a={color:{source:Ys,composite:R},number:{source:x,composite:Ys}},c=function(d){return{"line-pattern":{source:$e,composite:$e},"fill-pattern":{source:$e,composite:$e},"fill-extrusion-pattern":{source:$e,composite:$e}}[d]}(n);return c&&c[r]||a[t][r]}Ze("ConstantBinder",Qs),Ze("CrossFadedConstantBinder",os),Ze("SourceExpressionBinder",Tn),Ze("CrossFadedCompositeBinder",Sn),Ze("CompositeExpressionBinder",Bi),Ze("ProgramConfiguration",Mc,{omit:["_buffers"]}),Ze("ProgramConfigurationSet",Hn);const eo=Math.pow(2,14)-1,Vf=-eo-1;function to(n){const t=At/n.extent,r=n.loadGeometry();for(let a=0;a<r.length;a++){const c=r[a];for(let d=0;d<c.length;d++){const p=c[d],m=Math.round(p.x*t),y=Math.round(p.y*t);p.x=ci(m,Vf,eo),p.y=ci(y,Vf,eo),(m<p.x||m>p.x+1||y<p.y||y>p.y+1)&&ki("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return r}function io(n,t){return{type:n.type,id:n.id,properties:n.properties,geometry:t?to(n):[]}}const Zf=-32768;function jy(n,t,r,a,c){n.emplaceBack(Zf+8*t+a,Zf+8*r+c)}class Bd{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new fe,this.indexArray=new Nt,this.segments=new Tt,this.programConfigurations=new Hn(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){const c=this.layers[0],d=[];let p=null,m=!1,y=c.type==="heatmap";if(c.type==="circle"){const S=c;p=S.layout.get("circle-sort-key"),m=!p.isConstant(),y=y||S.paint.get("circle-pitch-alignment")==="map"}const b=y?r.subdivisionGranularity.circle:1;for(const{feature:S,id:C,index:k,sourceLayerIndex:L}of t){const F=this.layers[0]._featureFilter.needGeometry,j=io(S,F);if(!this.layers[0]._featureFilter.filter(new Wt(this.zoom,{globalState:this.globalState}),j,a))continue;const U=m?p.evaluate(j,{},a):void 0,H={id:C,properties:S.properties,type:S.type,sourceLayerIndex:L,index:k,geometry:F?j.geometry:to(S),patterns:{},sortKey:U};d.push(H)}m&&d.sort((S,C)=>S.sortKey-C.sortKey);for(const S of d){const{geometry:C,index:k,sourceLayerIndex:L}=S,F=t[k].feature;this.addFeature(S,C,k,a,b),r.featureIndex.insert(F,C,k,L,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,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,Li),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,r,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 m=p.length;for(const y of r)for(const b of y){const S=b.x,C=b.y;if(S<0||S>=At||C<0||C>=At)continue;const k=this.segments.prepareSegment(m*m,this.layoutVertexArray,this.indexArray,t.sortKey),L=k.vertexLength;for(let F=0;F<m;F++)for(let j=0;j<m;j++)jy(this.layoutVertexArray,S,C,p[j],p[F]);for(let F=0;F<m-1;F++)for(let j=0;j<m-1;j++){const U=L+F*m+j,H=L+(F+1)*m+j;this.indexArray.emplaceBack(U,H+1,U+1),this.indexArray.emplaceBack(U,H,H+1)}k.vertexLength+=m*m,k.primitiveLength+=(m-1)*(m-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,{},c)}}function Uf(n,t){for(let r=0;r<n.length;r++)if(ul(t,n[r]))return!0;for(let r=0;r<t.length;r++)if(ul(n,t[r]))return!0;return!!Od(n,t)}function Ny(n,t,r){return!!ul(n,t)||!!jd(t,n,r)}function $f(n,t){if(n.length===1)return qf(t,n[0]);for(let r=0;r<t.length;r++){const a=t[r];for(let c=0;c<a.length;c++)if(ul(n,a[c]))return!0}for(let r=0;r<n.length;r++)if(qf(t,n[r]))return!0;for(let r=0;r<t.length;r++)if(Od(n,t[r]))return!0;return!1}function Vy(n,t,r){if(n.length>1){if(Od(n,t))return!0;for(let a=0;a<t.length;a++)if(jd(t[a],n,r))return!0}for(let a=0;a<n.length;a++)if(jd(n[a],t,r))return!0;return!1}function Od(n,t){if(n.length===0||t.length===0)return!1;for(let r=0;r<n.length-1;r++){const a=n[r],c=n[r+1];for(let d=0;d<t.length-1;d++)if(Zy(a,c,t[d],t[d+1]))return!0}return!1}function Zy(n,t,r,a){return fr(n,r,a)!==fr(t,r,a)&&fr(n,t,r)!==fr(n,t,a)}function jd(n,t,r){const a=r*r;if(t.length===1)return n.distSqr(t[0])<a;for(let c=1;c<t.length;c++)if(Gf(n,t[c-1],t[c])<a)return!0;return!1}function Gf(n,t,r){const a=t.distSqr(r);if(a===0)return n.distSqr(t);const c=((n.x-t.x)*(r.x-t.x)+(n.y-t.y)*(r.y-t.y))/a;return n.distSqr(c<0?t:c>1?r:r.sub(t)._mult(c)._add(t))}function qf(n,t){let r,a,c,d=!1;for(let p=0;p<n.length;p++){r=n[p];for(let m=0,y=r.length-1;m<r.length;y=m++)a=r[m],c=r[y],a.y>t.y!=c.y>t.y&&t.x<(c.x-a.x)*(t.y-a.y)/(c.y-a.y)+a.x&&(d=!d)}return d}function ul(n,t){let r=!1;for(let a=0,c=n.length-1;a<n.length;c=a++){const d=n[a],p=n[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&&(r=!r)}return r}function Uy(n,t,r){const a=r[0],c=r[2];if(n.x<a.x&&t.x<a.x||n.x>c.x&&t.x>c.x||n.y<a.y&&t.y<a.y||n.y>c.y&&t.y>c.y)return!1;const d=fr(n,t,r[0]);return d!==fr(n,t,r[1])||d!==fr(n,t,r[2])||d!==fr(n,t,r[3])}function Ec(n,t,r){const a=t.paint.get(n).value;return a.kind==="constant"?a.value:r.programConfigurations.get(t.id).getMaxValue(n)}function hh(n){return Math.sqrt(n[0]*n[0]+n[1]*n[1])}function dh(n,t,r,a,c){if(!t[0]&&!t[1])return n;const d=Be.convert(t)._mult(c);r==="viewport"&&d._rotate(-a);const p=[];for(let m=0;m<n.length;m++)p.push(n[m].sub(d));return p}let Wf,Hf;Ze("CircleBucket",Bd,{omit:["layers"]});var $y={get paint(){return Hf=Hf||new Ji({"circle-radius":new et(ne.paint_circle["circle-radius"]),"circle-color":new et(ne.paint_circle["circle-color"]),"circle-blur":new et(ne.paint_circle["circle-blur"]),"circle-opacity":new et(ne.paint_circle["circle-opacity"]),"circle-translate":new qe(ne.paint_circle["circle-translate"]),"circle-translate-anchor":new qe(ne.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new qe(ne.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new qe(ne.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new et(ne.paint_circle["circle-stroke-width"]),"circle-stroke-color":new et(ne.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new et(ne.paint_circle["circle-stroke-opacity"])})},get layout(){return Wf=Wf||new Ji({"circle-sort-key":new et(ne.layout_circle["circle-sort-key"])})}};class Gy extends Di{constructor(t){super(t,$y)}createBucket(t){return new Bd(t)}queryRadius(t){const r=t;return Ec("circle-radius",this,r)+Ec("circle-stroke-width",this,r)+hh(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,unwrappedTileID:m,getElevation:y}){const b=dh(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,p),S=this.paint.get("circle-radius").evaluate(r,a)+this.paint.get("circle-stroke-width").evaluate(r,a),C=this.paint.get("circle-pitch-alignment")==="map",k=C?b:function(F,j,U,H){return F.map(se=>Xf(se,j,U,H))}(b,d,m,y),L=C?S*p:S;for(const F of c)for(const j of F){const U=C?j:Xf(j,d,m,y);let H=L;const se=d.projectTileCoordinates(j.x,j.y,m,y).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?H*=se/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(H*=d.cameraToCenterDistance/se),Ny(k,U,H))return!0}return!1}}function Xf(n,t,r,a){const c=t.projectTileCoordinates(n.x,n.y,r,a).point;return new Be((.5*c.x+.5)*t.width,(.5*-c.y+.5)*t.height)}class Yf extends Bd{}let Kf;Ze("HeatmapBucket",Yf,{omit:["layers"]});var qy={get paint(){return Kf=Kf||new Ji({"heatmap-radius":new et(ne.paint_heatmap["heatmap-radius"]),"heatmap-weight":new et(ne.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new qe(ne.paint_heatmap["heatmap-intensity"]),"heatmap-color":new Xs(ne.paint_heatmap["heatmap-color"]),"heatmap-opacity":new qe(ne.paint_heatmap["heatmap-opacity"])})}};function Nd(n,{width:t,height:r},a,c){if(c){if(c instanceof Uint8ClampedArray)c=new Uint8Array(c.buffer);else if(c.length!==t*r*a)throw new RangeError(`mismatched image size. expected: ${c.length} but got: ${t*r*a}`)}else c=new Uint8Array(t*r*a);return n.width=t,n.height=r,n.data=c,n}function Jf(n,{width:t,height:r},a){if(t===n.width&&r===n.height)return;const c=Nd({},{width:t,height:r},a);Vd(n,c,{x:0,y:0},{x:0,y:0},{width:Math.min(n.width,t),height:Math.min(n.height,r)},a),n.width=t,n.height=r,n.data=c.data}function Vd(n,t,r,a,c,d){if(c.width===0||c.height===0)return t;if(c.width>n.width||c.height>n.height||r.x>n.width-c.width||r.y>n.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=n.data,m=t.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let y=0;y<c.height;y++){const b=((r.y+y)*n.width+r.x)*d,S=((a.y+y)*t.width+a.x)*d;for(let C=0;C<c.width*d;C++)m[S+C]=p[b+C]}return t}class Ac{constructor(t,r){Nd(this,t,1,r)}resize(t){Jf(this,t,1)}clone(){return new Ac({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,a,c,d){Vd(t,r,a,c,d,1)}}class xr{constructor(t,r){Nd(this,t,4,r)}resize(t){Jf(this,t,4)}replace(t,r){r?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new xr({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,r,a,c,d){Vd(t,r,a,c,d,4)}setPixel(t,r,a){const c=4*(t*this.width+r);this.data[c+0]=Math.round(255*a.r/a.a),this.data[c+1]=Math.round(255*a.g/a.a),this.data[c+2]=Math.round(255*a.b/a.a),this.data[c+3]=Math.round(255*a.a)}}function Qf(n){const t={},r=n.resolution||256,a=n.clips?n.clips.length:1,c=n.image||new xr({width:r,height:a});if(Math.log(r)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${r}`);const d=(p,m,y)=>{t[n.evaluationKey]=y;const b=n.expression.evaluate(t);c.setPixel(p/4/r,m/4,b)};if(n.clips)for(let p=0,m=0;p<a;++p,m+=4*r)for(let y=0,b=0;y<r;y++,b+=4){const S=y/(r-1),{start:C,end:k}=n.clips[p];d(m,b,C*(1-S)+k*S)}else for(let p=0,m=0;p<r;p++,m+=4)d(0,m,p/(r-1));return c}Ze("AlphaImage",Ac),Ze("RGBAImage",xr);const Zd="big-fb";class Wy extends Di{createBucket(t){return new Yf(t)}constructor(t){super(t,qy),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=Qf({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(Zd)&&this.heatmapFbos.delete(Zd)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let em;var Hy={get paint(){return em=em||new Ji({"hillshade-illumination-direction":new qe(ne.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-altitude":new qe(ne.paint_hillshade["hillshade-illumination-altitude"]),"hillshade-illumination-anchor":new qe(ne.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new qe(ne.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new qe(ne.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new qe(ne.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new qe(ne.paint_hillshade["hillshade-accent-color"]),"hillshade-method":new qe(ne.paint_hillshade["hillshade-method"])})}};class Xy extends Di{constructor(t){super(t,Hy),this.recalculate({zoom:0,zoomHistory:{}},void 0)}getIlluminationProperties(){let t=this.paint.get("hillshade-illumination-direction").values,r=this.paint.get("hillshade-illumination-altitude").values,a=this.paint.get("hillshade-highlight-color").values,c=this.paint.get("hillshade-shadow-color").values;const d=Math.max(t.length,r.length,a.length,c.length);t=t.concat(Array(d-t.length).fill(t.at(-1))),r=r.concat(Array(d-r.length).fill(r.at(-1))),a=a.concat(Array(d-a.length).fill(a.at(-1))),c=c.concat(Array(d-c.length).fill(c.at(-1)));const p=r.map(mr);return{directionRadians:t.map(mr),altitudeRadians:p,shadowColor:c,highlightColor:a}}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}let tm;var Yy={get paint(){return tm=tm||new Ji({"color-relief-opacity":new qe(ne["paint_color-relief"]["color-relief-opacity"]),"color-relief-color":new Xs(ne["paint_color-relief"]["color-relief-color"])})}};class Ud{constructor(t,r,a,c){this.context=t,this.format=a,this.texture=t.gl.createTexture(),this.update(r,c)}update(t,r,a){const{width:c,height:d}=t,p=!(this.size&&this.size[0]===c&&this.size[1]===d||a),{context:m}=this,{gl:y}=m;if(this.useMipmap=!!(r&&r.useMipmap),y.bindTexture(y.TEXTURE_2D,this.texture),m.pixelStoreUnpackFlipY.set(!1),m.pixelStoreUnpack.set(1),m.pixelStoreUnpackPremultiplyAlpha.set(this.format===y.RGBA&&(!r||r.premultiply!==!1)),p)this.size=[c,d],t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||Ln(t)?y.texImage2D(y.TEXTURE_2D,0,this.format,this.format,y.UNSIGNED_BYTE,t):y.texImage2D(y.TEXTURE_2D,0,this.format,c,d,0,this.format,y.UNSIGNED_BYTE,t.data);else{const{x:b,y:S}=a||{x:0,y:0};t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof HTMLVideoElement||t instanceof ImageData||Ln(t)?y.texSubImage2D(y.TEXTURE_2D,0,b,S,y.RGBA,y.UNSIGNED_BYTE,t):y.texSubImage2D(y.TEXTURE_2D,0,b,S,c,d,y.RGBA,y.UNSIGNED_BYTE,t.data)}this.useMipmap&&this.isSizePowerOfTwo()&&y.generateMipmap(y.TEXTURE_2D),m.pixelStoreUnpackFlipY.setDefault(),m.pixelStoreUnpack.setDefault(),m.pixelStoreUnpackPremultiplyAlpha.setDefault()}bind(t,r,a){const{context:c}=this,{gl:d}=c;d.bindTexture(d.TEXTURE_2D,this.texture),a!==d.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(a=d.LINEAR),t!==this.filter&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MAG_FILTER,t),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_MIN_FILTER,a||t),this.filter=t),r!==this.wrap&&(d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_S,r),d.texParameteri(d.TEXTURE_2D,d.TEXTURE_WRAP_T,r),this.wrap=r)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:t}=this.context;t.deleteTexture(this.texture),this.texture=null}}class im{constructor(t,r,a,c=1,d=1,p=1,m=0){if(this.uid=t,r.height!==r.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void ki(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=r.height;const y=this.dim=r.height-2;switch(this.data=new Uint32Array(r.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=m;break;default:this.redFactor=6553.6,this.greenFactor=25.6,this.blueFactor=.1,this.baseShift=1e4}for(let b=0;b<y;b++)this.data[this._idx(-1,b)]=this.data[this._idx(0,b)],this.data[this._idx(y,b)]=this.data[this._idx(y-1,b)],this.data[this._idx(b,-1)]=this.data[this._idx(b,0)],this.data[this._idx(b,y)]=this.data[this._idx(b,y-1)];this.data[this._idx(-1,-1)]=this.data[this._idx(0,0)],this.data[this._idx(y,-1)]=this.data[this._idx(y-1,0)],this.data[this._idx(-1,y)]=this.data[this._idx(0,y-1)],this.data[this._idx(y,y)]=this.data[this._idx(y-1,y-1)],this.min=Number.MAX_SAFE_INTEGER,this.max=Number.MIN_SAFE_INTEGER;for(let b=0;b<y;b++)for(let S=0;S<y;S++){const C=this.get(b,S);C>this.max&&(this.max=C),C<this.min&&(this.min=C)}}get(t,r){const a=new Uint8Array(this.data.buffer),c=4*this._idx(t,r);return this.unpack(a[c],a[c+1],a[c+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,r){if(t<-1||t>=this.dim+1||r<-1||r>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(r+1)*this.stride+(t+1)}unpack(t,r,a){return t*this.redFactor+r*this.greenFactor+a*this.blueFactor-this.baseShift}pack(t){return rm(t,this.getUnpackVector())}getPixels(){return new xr({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,r,a){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let c=r*this.dim,d=r*this.dim+this.dim,p=a*this.dim,m=a*this.dim+this.dim;switch(r){case-1:c=d-1;break;case 1:d=c+1}switch(a){case-1:p=m-1;break;case 1:m=p+1}const y=-r*this.dim,b=-a*this.dim;for(let S=p;S<m;S++)for(let C=c;C<d;C++)this.data[this._idx(C,S)]=t.data[this._idx(C+y,S+b)]}}function rm(n,t){const r=t[0],a=t[1],c=t[2],d=t[3],p=Math.min(r,a,c),m=Math.round((n+d)/p);return{r:Math.floor(m*p/r)%256,g:Math.floor(m*p/a)%256,b:Math.floor(m*p/c)%256}}Ze("DEMData",im);class Ky extends Di{constructor(t){super(t,Yy)}_createColorRamp(t){const r={elevationStops:[],colorStops:[]},a=this._transitionablePaint._values["color-relief-color"].value.expression;if(a instanceof Os&&a._styleExpression.expression instanceof Yi){this.colorRampExpression=a;const p=a._styleExpression.expression;r.elevationStops=p.labels,r.colorStops=[];for(const m of r.elevationStops)r.colorStops.push(p.evaluate({globals:{elevation:m}}))}if(r.elevationStops.length<1&&(r.elevationStops=[0],r.colorStops=[gt.transparent]),r.elevationStops.length<2&&(r.elevationStops.push(r.elevationStops[0]+1),r.colorStops.push(r.colorStops[0])),r.elevationStops.length<=t)return r;const c={elevationStops:[],colorStops:[]},d=(r.elevationStops.length-1)/(t-1);for(let p=0;p<r.elevationStops.length-.5;p+=d)c.elevationStops.push(r.elevationStops[Math.round(p)]),c.colorStops.push(r.colorStops[Math.round(p)]);return ki(`Too many colors in specification of ${this.id} color-relief layer, may not render properly.`),c}_colorRampChanged(){return this.colorRampExpression!=this._transitionablePaint._values["color-relief-color"].value.expression}getColorRampTextures(t,r,a){if(this.colorRampTextures&&!this._colorRampChanged())return this.colorRampTextures;const c=this._createColorRamp(r),d=new xr({width:c.colorStops.length,height:1}),p=new xr({width:c.colorStops.length,height:1});for(let m=0;m<c.elevationStops.length;m++){const y=rm(c.elevationStops[m],a);p.setPixel(0,m,new gt(y.r/255,y.g/255,y.b/255,1)),d.setPixel(0,m,c.colorStops[m])}return this.colorRampTextures={elevationTexture:new Ud(t,p,t.gl.RGBA),colorTexture:new Ud(t,d,t.gl.RGBA)},this.colorRampTextures}hasOffscreenPass(){return this.visibility!=="none"&&!!this.colorRampTextures}}const Jy=ni([{name:"a_pos",components:2,type:"Int16"}],4),{members:Qy}=Jy;function $d(n,t,r){const a=r.patternDependencies;let c=!1;for(const d of t){const p=d.paint.get(`${n}-pattern`);p.isConstant()||(c=!0);const m=p.constantOr(null);m&&(c=!0,a[m.to]=!0,a[m.from]=!0)}return c}function Gd(n,t,r,a,c){const d=c.patternDependencies;for(const p of t){const m=p.paint.get(`${n}-pattern`).value;if(m.kind!=="constant"){let y=m.evaluate({zoom:a-1},r,{},c.availableImages),b=m.evaluate({zoom:a},r,{},c.availableImages),S=m.evaluate({zoom:a+1},r,{},c.availableImages);y=y&&y.name?y.name:y,b=b&&b.name?b.name:b,S=S&&S.name?S.name:S,d[y]=!0,d[b]=!0,d[S]=!0,r.patterns[p.id]={min:y,mid:b,max:S}}}return r}function nm(n,t,r,a,c){let d;if(c===function(p,m,y,b){let S=0;for(let C=m,k=y-b;C<y;C+=b)S+=(p[k]-p[C])*(p[C+1]+p[k+1]),k=C;return S}(n,t,r,a)>0)for(let p=t;p<r;p+=a)d=lm(p/a|0,n[p],n[p+1],d);else for(let p=r-a;p>=t;p-=a)d=lm(p/a|0,n[p],n[p+1],d);return d&&hl(d,d.next)&&(Dc(d),d=d.next),d}function ro(n,t){if(!n)return n;t||(t=n);let r,a=n;do if(r=!1,a.steiner||!hl(a,a.next)&&hi(a.prev,a,a.next)!==0)a=a.next;else{if(Dc(a),a=t=a.prev,a===a.next)break;r=!0}while(r||a!==t);return t}function zc(n,t,r,a,c,d,p){if(!n)return;!p&&d&&function(y,b,S,C){let k=y;do k.z===0&&(k.z=qd(k.x,k.y,b,S,C)),k.prevZ=k.prev,k.nextZ=k.next,k=k.next;while(k!==y);k.prevZ.nextZ=null,k.prevZ=null,function(L){let F,j=1;do{let U,H=L;L=null;let se=null;for(F=0;H;){F++;let J=H,D=0;for(let te=0;te<j&&(D++,J=J.nextZ,J);te++);let Z=j;for(;D>0||Z>0&&J;)D!==0&&(Z===0||!J||H.z<=J.z)?(U=H,H=H.nextZ,D--):(U=J,J=J.nextZ,Z--),se?se.nextZ=U:L=U,U.prevZ=se,se=U;H=J}se.nextZ=null,j*=2}while(F>1)}(k)}(n,a,c,d);let m=n;for(;n.prev!==n.next;){const y=n.prev,b=n.next;if(d?tx(n,a,c,d):ex(n))t.push(y.i,n.i,b.i),Dc(n),n=b.next,m=b.next;else if((n=b)===m){p?p===1?zc(n=ix(ro(n),t),t,r,a,c,d,2):p===2&&rx(n,t,r,a,c,d):zc(ro(n),t,r,a,c,d,1);break}}}function ex(n){const t=n.prev,r=n,a=n.next;if(hi(t,r,a)>=0)return!1;const c=t.x,d=r.x,p=a.x,m=t.y,y=r.y,b=a.y,S=Math.min(c,d,p),C=Math.min(m,y,b),k=Math.max(c,d,p),L=Math.max(m,y,b);let F=a.next;for(;F!==t;){if(F.x>=S&&F.x<=k&&F.y>=C&&F.y<=L&&kc(c,m,d,y,p,b,F.x,F.y)&&hi(F.prev,F,F.next)>=0)return!1;F=F.next}return!0}function tx(n,t,r,a){const c=n.prev,d=n,p=n.next;if(hi(c,d,p)>=0)return!1;const m=c.x,y=d.x,b=p.x,S=c.y,C=d.y,k=p.y,L=Math.min(m,y,b),F=Math.min(S,C,k),j=Math.max(m,y,b),U=Math.max(S,C,k),H=qd(L,F,t,r,a),se=qd(j,U,t,r,a);let J=n.prevZ,D=n.nextZ;for(;J&&J.z>=H&&D&&D.z<=se;){if(J.x>=L&&J.x<=j&&J.y>=F&&J.y<=U&&J!==c&&J!==p&&kc(m,S,y,C,b,k,J.x,J.y)&&hi(J.prev,J,J.next)>=0||(J=J.prevZ,D.x>=L&&D.x<=j&&D.y>=F&&D.y<=U&&D!==c&&D!==p&&kc(m,S,y,C,b,k,D.x,D.y)&&hi(D.prev,D,D.next)>=0))return!1;D=D.nextZ}for(;J&&J.z>=H;){if(J.x>=L&&J.x<=j&&J.y>=F&&J.y<=U&&J!==c&&J!==p&&kc(m,S,y,C,b,k,J.x,J.y)&&hi(J.prev,J,J.next)>=0)return!1;J=J.prevZ}for(;D&&D.z<=se;){if(D.x>=L&&D.x<=j&&D.y>=F&&D.y<=U&&D!==c&&D!==p&&kc(m,S,y,C,b,k,D.x,D.y)&&hi(D.prev,D,D.next)>=0)return!1;D=D.nextZ}return!0}function ix(n,t){let r=n;do{const a=r.prev,c=r.next.next;!hl(a,c)&&sm(a,r,r.next,c)&&Rc(a,c)&&Rc(c,a)&&(t.push(a.i,r.i,c.i),Dc(r),Dc(r.next),r=n=c),r=r.next}while(r!==n);return ro(r)}function rx(n,t,r,a,c,d){let p=n;do{let m=p.next.next;for(;m!==p.prev;){if(p.i!==m.i&&lx(p,m)){let y=om(p,m);return p=ro(p,p.next),y=ro(y,y.next),zc(p,t,r,a,c,d,0),void zc(y,t,r,a,c,d,0)}m=m.next}p=p.next}while(p!==n)}function nx(n,t){let r=n.x-t.x;return r===0&&(r=n.y-t.y,r===0)&&(r=(n.next.y-n.y)/(n.next.x-n.x)-(t.next.y-t.y)/(t.next.x-t.x)),r}function ax(n,t){const r=function(c,d){let p=d;const m=c.x,y=c.y;let b,S=-1/0;if(hl(c,p))return p;do{if(hl(c,p.next))return p.next;if(y<=p.y&&y>=p.next.y&&p.next.y!==p.y){const j=p.x+(y-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(j<=m&&j>S&&(S=j,b=p.x<p.next.x?p:p.next,j===m))return b}p=p.next}while(p!==d);if(!b)return null;const C=b,k=b.x,L=b.y;let F=1/0;p=b;do{if(m>=p.x&&p.x>=k&&m!==p.x&&am(y<L?m:S,y,k,L,y<L?S:m,y,p.x,p.y)){const j=Math.abs(y-p.y)/(m-p.x);Rc(p,c)&&(j<F||j===F&&(p.x>b.x||p.x===b.x&&sx(b,p)))&&(b=p,F=j)}p=p.next}while(p!==C);return b}(n,t);if(!r)return t;const a=om(r,n);return ro(a,a.next),ro(r,r.next)}function sx(n,t){return hi(n.prev,n,t.prev)<0&&hi(t.next,n,n.next)<0}function qd(n,t,r,a,c){return(n=1431655765&((n=858993459&((n=252645135&((n=16711935&((n=(n-r)*c|0)|n<<8))|n<<4))|n<<2))|n<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*c|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function ox(n){let t=n,r=n;do(t.x<r.x||t.x===r.x&&t.y<r.y)&&(r=t),t=t.next;while(t!==n);return r}function am(n,t,r,a,c,d,p,m){return(c-p)*(t-m)>=(n-p)*(d-m)&&(n-p)*(a-m)>=(r-p)*(t-m)&&(r-p)*(d-m)>=(c-p)*(a-m)}function kc(n,t,r,a,c,d,p,m){return!(n===p&&t===m)&&am(n,t,r,a,c,d,p,m)}function lx(n,t){return n.next.i!==t.i&&n.prev.i!==t.i&&!function(r,a){let c=r;do{if(c.i!==r.i&&c.next.i!==r.i&&c.i!==a.i&&c.next.i!==a.i&&sm(c,c.next,r,a))return!0;c=c.next}while(c!==r);return!1}(n,t)&&(Rc(n,t)&&Rc(t,n)&&function(r,a){let c=r,d=!1;const p=(r.x+a.x)/2,m=(r.y+a.y)/2;do c.y>m!=c.next.y>m&&c.next.y!==c.y&&p<(c.next.x-c.x)*(m-c.y)/(c.next.y-c.y)+c.x&&(d=!d),c=c.next;while(c!==r);return d}(n,t)&&(hi(n.prev,n,t.prev)||hi(n,t.prev,t))||hl(n,t)&&hi(n.prev,n,n.next)>0&&hi(t.prev,t,t.next)>0)}function hi(n,t,r){return(t.y-n.y)*(r.x-t.x)-(t.x-n.x)*(r.y-t.y)}function hl(n,t){return n.x===t.x&&n.y===t.y}function sm(n,t,r,a){const c=fh(hi(n,t,r)),d=fh(hi(n,t,a)),p=fh(hi(r,a,n)),m=fh(hi(r,a,t));return c!==d&&p!==m||!(c!==0||!ph(n,r,t))||!(d!==0||!ph(n,a,t))||!(p!==0||!ph(r,n,a))||!(m!==0||!ph(r,t,a))}function ph(n,t,r){return t.x<=Math.max(n.x,r.x)&&t.x>=Math.min(n.x,r.x)&&t.y<=Math.max(n.y,r.y)&&t.y>=Math.min(n.y,r.y)}function fh(n){return n>0?1:n<0?-1:0}function Rc(n,t){return hi(n.prev,n,n.next)<0?hi(n,t,n.next)>=0&&hi(n,n.prev,t)>=0:hi(n,t,n.prev)<0||hi(n,n.next,t)<0}function om(n,t){const r=Wd(n.i,n.x,n.y),a=Wd(t.i,t.x,t.y),c=n.next,d=t.prev;return n.next=t,t.prev=n,r.next=c,c.prev=r,a.next=r,r.prev=a,d.next=a,a.prev=d,a}function lm(n,t,r,a){const c=Wd(n,t,r);return a?(c.next=a.next,c.prev=a,a.next.prev=c,a.next=c):(c.prev=c,c.next=c),c}function Dc(n){n.next.prev=n.prev,n.prev.next=n.next,n.prevZ&&(n.prevZ.nextZ=n.nextZ),n.nextZ&&(n.nextZ.prevZ=n.prevZ)}function Wd(n,t,r){return{i:n,x:t,y:r,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class dl{constructor(t,r){if(r>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=r}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class mh{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}mh.noSubdivision=new mh({fill:new dl(0,0),line:new dl(0,0),tile:new dl(0,0),stencil:new dl(0,0),circle:1}),Ze("SubdivisionGranularityExpression",dl),Ze("SubdivisionGranularitySetting",mh);const pl=-32768,Lc=32767;class cx{constructor(t,r){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=At/t,this._canonical=r}_getKey(t,r){return(t+=32768)<<16|r+32768}_vertexToIndex(t,r){if(t<-32768||r<-32768||t>32767||r>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const a=0|Math.round(t),c=0|Math.round(r),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 m=0;m<d.length;m+=3){const y=d[m],b=d[m+1],S=d[m+2],C=c[2*y],k=c[2*y+1];(c[2*b]-C)*(c[2*S+1]-k)-(c[2*b+1]-k)*(c[2*S]-C)>0?(p.push(y),p.push(S),p.push(b)):(p.push(y),p.push(b),p.push(S))}return p}(this._vertexBuffer,t);const r=[],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 m=1/0,y=1/0,b=-1/0,S=-1/0;for(let j=0;j<3;j++){const U=p[2*j],H=p[2*j+1];m=Math.min(m,U),b=Math.max(b,U),y=Math.min(y,H),S=Math.max(S,H)}if(m===b||y===S)continue;const C=Math.floor(m/this._granularityCellSize),k=Math.ceil(b/this._granularityCellSize),L=Math.floor(y/this._granularityCellSize),F=Math.ceil(S/this._granularityCellSize);if(C!==k||L!==F)for(let j=L;j<F;j++){const U=this._scanlineGenerateVertexRingForCellRow(j,p,d);ux(this._vertexBuffer,U,r)}else r.push(...d)}return r}_scanlineGenerateVertexRingForCellRow(t,r,a){const c=t*this._granularityCellSize,d=c+this._granularityCellSize,p=[];for(let m=0;m<3;m++){const y=r[2*m],b=r[2*m+1],S=r[2*(m+1)%6],C=r[(2*(m+1)+1)%6],k=r[2*(m+2)%6],L=r[(2*(m+2)+1)%6],F=S-y,j=C-b,U=F===0,H=j===0,se=(c-b)/j,J=(d-b)/j,D=Math.min(se,J),Z=Math.max(se,J);if(!H&&(D>=1||Z<=0)||H&&(b<c||b>d)){C>=c&&C<=d&&p.push(a[(m+1)%3]);continue}!H&&D>0&&p.push(this._vertexToIndex(y+F*D,b+j*D));const te=y+F*Math.max(D,0),me=y+F*Math.min(Z,1);U||this._generateIntraEdgeVertices(p,y,b,S,C,te,me),!H&&Z<1&&p.push(this._vertexToIndex(y+F*Z,b+j*Z)),(H||C>=c&&C<=d)&&p.push(a[(m+1)%3]),!H&&(C<=c||C>=d)&&this._generateInterEdgeVertices(p,y,b,S,C,k,L,me,c,d)}return p}_generateIntraEdgeVertices(t,r,a,c,d,p,m){const y=c-r,b=d-a,S=b===0,C=S?Math.min(r,c):Math.min(p,m),k=S?Math.max(r,c):Math.max(p,m),L=Math.floor(C/this._granularityCellSize)+1,F=Math.ceil(k/this._granularityCellSize)-1;if(S?r<c:p<m)for(let j=L;j<=F;j++){const U=j*this._granularityCellSize;t.push(this._vertexToIndex(U,a+b*(U-r)/y))}else for(let j=F;j>=L;j--){const U=j*this._granularityCellSize;t.push(this._vertexToIndex(U,a+b*(U-r)/y))}}_generateInterEdgeVertices(t,r,a,c,d,p,m,y,b,S){const C=d-a,k=p-c,L=m-d,F=(b-d)/L,j=(S-d)/L,U=Math.min(F,j),H=Math.max(F,j),se=c+k*U;let J=Math.floor(Math.min(se,y)/this._granularityCellSize)+1,D=Math.ceil(Math.max(se,y)/this._granularityCellSize)-1,Z=y<se;const te=L===0;if(te&&(m===b||m===S))return;if(te||U>=1||H<=0){const Ce=a-m,ve=p+(r-p)*Math.min((b-m)/Ce,(S-m)/Ce);J=Math.floor(Math.min(ve,y)/this._granularityCellSize)+1,D=Math.ceil(Math.max(ve,y)/this._granularityCellSize)-1,Z=y<ve}const me=C>0?S:b;if(Z)for(let Ce=J;Ce<=D;Ce++)t.push(this._vertexToIndex(Ce*this._granularityCellSize,me));else for(let Ce=D;Ce>=J;Ce--)t.push(this._vertexToIndex(Ce*this._granularityCellSize,me))}_generateOutline(t){const r=[];for(const a of t){const c=no(a,this._granularity,!0),d=this._pointArrayToIndices(c),p=[];for(let m=1;m<d.length;m++)p.push(d[m-1]),p.push(d[m]);r.push(p)}return r}_handlePoles(t){let r=!1,a=!1;this._canonical&&(this._canonical.y===0&&(r=!0),this._canonical.y===(1<<this._canonical.z)-1&&(a=!0)),(r||a)&&this._fillPoles(t,r,a)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let r=0;r<t.length;r+=2){const a=t[r+1];a===pl&&(t[r+1]=-32767),a===Lc&&(t[r+1]=32766)}}_generatePoleQuad(t,r,a,c,d,p){c>d!=(p===pl)?(t.push(r),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(r),t.push(this._vertexToIndex(c,p)),t.push(this._vertexToIndex(d,p)),t.push(a),t.push(this._vertexToIndex(c,p)))}_fillPoles(t,r,a){const c=this._vertexBuffer,d=At,p=t.length;for(let m=2;m<p;m+=3){const y=t[m-2],b=t[m-1],S=t[m],C=c[2*y],k=c[2*y+1],L=c[2*b],F=c[2*b+1],j=c[2*S],U=c[2*S+1];r&&(k===0&&F===0&&this._generatePoleQuad(t,y,b,C,L,pl),F===0&&U===0&&this._generatePoleQuad(t,b,S,L,j,pl),U===0&&k===0&&this._generatePoleQuad(t,S,y,j,C,pl)),a&&(k===d&&F===d&&this._generatePoleQuad(t,y,b,C,L,Lc),F===d&&U===d&&this._generatePoleQuad(t,b,S,L,j,Lc),U===d&&k===d&&this._generatePoleQuad(t,S,y,j,C,Lc))}}_initializeVertices(t){for(let r=0;r<t.length;r+=2)this._vertexToIndex(t[r],t[r+1])}subdividePolygonInternal(t,r){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:a,holeIndices:c}=function(m){const y=[],b=[];for(const S of m)if(S.length!==0){S!==m[0]&&y.push(b.length/2);for(let C=0;C<S.length;C++)b.push(S[C].x),b.push(S[C].y)}return{flattened:b,holeIndices:y}}(t);let d;this._initializeVertices(a);try{const m=function(b,S,C=2){const k=S&&S.length,L=k?S[0]*C:b.length;let F=nm(b,0,L,C,!0);const j=[];if(!F||F.next===F.prev)return j;let U,H,se;if(k&&(F=function(J,D,Z,te){const me=[];for(let Ce=0,ve=D.length;Ce<ve;Ce++){const Te=nm(J,D[Ce]*te,Ce<ve-1?D[Ce+1]*te:J.length,te,!1);Te===Te.next&&(Te.steiner=!0),me.push(ox(Te))}me.sort(nx);for(let Ce=0;Ce<me.length;Ce++)Z=ax(me[Ce],Z);return Z}(b,S,F,C)),b.length>80*C){U=1/0,H=1/0;let J=-1/0,D=-1/0;for(let Z=C;Z<L;Z+=C){const te=b[Z],me=b[Z+1];te<U&&(U=te),me<H&&(H=me),te>J&&(J=te),me>D&&(D=me)}se=Math.max(J-U,D-H),se=se!==0?32767/se:0}return zc(F,j,C,U,H,se,0),j}(a,c),y=this._convertIndices(a,m);d=this._subdivideTrianglesScanline(y)}catch(m){console.error(m)}let p=[];return r&&(p=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:p}}_convertIndices(t,r){const a=[];for(let c=0;c<r.length;c++)a.push(this._vertexToIndex(t[2*r[c]],t[2*r[c]+1]));return a}_pointArrayToIndices(t){const r=[];for(let a=0;a<t.length;a++){const c=t[a];r.push(this._vertexToIndex(c.x,c.y))}return r}}function cm(n,t,r,a=!0){return new cx(r,t).subdividePolygonInternal(n,a)}function no(n,t,r=!1){if(!n||n.length<1)return[];if(n.length<2)return[];const a=n[0],c=n[n.length-1],d=r&&(a.x!==c.x||a.y!==c.y);if(t<2)return d?[...n,n[0]]:[...n];const p=Math.floor(At/t),m=[];m.push(new Be(n[0].x,n[0].y));const y=n.length,b=d?y:y-1;for(let S=0;S<b;S++){const C=n[S],k=S<y-1?n[S+1]:n[0],L=C.x,F=C.y,j=k.x,U=k.y,H=L!==j,se=F!==U;if(!H&&!se)continue;const J=j-L,D=U-F,Z=Math.abs(J),te=Math.abs(D);let me=L,Ce=F;for(;;){const Te=J>0?(Math.floor(me/p)+1)*p:(Math.ceil(me/p)-1)*p,ze=D>0?(Math.floor(Ce/p)+1)*p:(Math.ceil(Ce/p)-1)*p,Ee=Math.abs(me-Te),ke=Math.abs(Ce-ze),Pe=Math.abs(me-j),Ge=Math.abs(Ce-U),Je=H?Ee/Z:Number.POSITIVE_INFINITY,Ke=se?ke/te:Number.POSITIVE_INFINITY;if((Pe<=Ee||!H)&&(Ge<=ke||!se))break;if(Je<Ke&&H||!se){me=Te,Ce+=D*Je;const He=new Be(me,Math.round(Ce));m[m.length-1].x===He.x&&m[m.length-1].y===He.y||m.push(He)}else{me+=J*Ke,Ce=ze;const He=new Be(Math.round(me),Ce);m[m.length-1].x===He.x&&m[m.length-1].y===He.y||m.push(He)}}const ve=new Be(j,U);m[m.length-1].x===ve.x&&m[m.length-1].y===ve.y||m.push(ve)}return m}function ux(n,t,r){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let a=0,c=n[2*t[0]];for(let y=1;y<t.length;y++){const b=n[2*t[y]];b<c&&(c=b,a=y)}const d=t.length;let p=a,m=(p+1)%d;for(;;){const y=p-1>=0?p-1:d-1,b=(m+1)%d,S=n[2*t[y]],C=n[2*t[b]],k=n[2*t[p]],L=n[2*t[p]+1],F=n[2*t[m]+1];let j=!1;if(S<C)j=!0;else if(S>C)j=!1;else{const U=F-L,H=-(n[2*t[m]]-k),se=L<F?1:-1;((S-k)*U+(n[2*t[y]+1]-L)*H)*se>((C-k)*U+(n[2*t[b]+1]-L)*H)*se&&(j=!0)}if(j){const U=t[y],H=t[p],se=t[m];U!==H&&U!==se&&H!==se&&r.push(se,H,U),p--,p<0&&(p=d-1)}else{const U=t[b],H=t[p],se=t[m];U!==H&&U!==se&&H!==se&&r.push(se,H,U),m++,m>=d&&(m=0)}if(y===b)break}}function um(n,t,r,a,c,d,p,m,y){const b=c.length/2,S=p&&m&&y;if(b<Tt.MAX_VERTEX_ARRAY_LENGTH){const C=t.prepareSegment(b,r,a),k=C.vertexLength;for(let j=0;j<d.length;j+=3)a.emplaceBack(k+d[j],k+d[j+1],k+d[j+2]);let L,F;C.vertexLength+=b,C.primitiveLength+=d.length/3,S&&(F=p.prepareSegment(b,r,m),L=F.vertexLength,F.vertexLength+=b);for(let j=0;j<c.length;j+=2)n(c[j],c[j+1]);if(S)for(let j=0;j<y.length;j++){const U=y[j];for(let H=1;H<U.length;H+=2)m.emplaceBack(L+U[H-1],L+U[H]);F.primitiveLength+=U.length/2}}else(function(C,k,L,F,j,U){const H=[];for(let te=0;te<F.length/2;te++)H.push(-1);const se={count:0};let J=0,D=C.getOrCreateLatestSegment(k,L),Z=D.vertexLength;for(let te=2;te<j.length;te+=3){const me=j[te-2],Ce=j[te-1],ve=j[te];let Te=H[me]<J,ze=H[Ce]<J,Ee=H[ve]<J;D.vertexLength+((Te?1:0)+(ze?1:0)+(Ee?1:0))>Tt.MAX_VERTEX_ARRAY_LENGTH&&(D=C.createNewSegment(k,L),J=se.count,Te=!0,ze=!0,Ee=!0,Z=0);const ke=Fc(H,F,U,se,me,Te,D),Pe=Fc(H,F,U,se,Ce,ze,D),Ge=Fc(H,F,U,se,ve,Ee,D);L.emplaceBack(Z+ke-J,Z+Pe-J,Z+Ge-J),D.primitiveLength++}})(t,r,a,c,d,n),S&&function(C,k,L,F,j,U){const H=[];for(let te=0;te<F.length/2;te++)H.push(-1);const se={count:0};let J=0,D=C.getOrCreateLatestSegment(k,L),Z=D.vertexLength;for(let te=0;te<j.length;te++){const me=j[te];for(let Ce=1;Ce<j[te].length;Ce+=2){const ve=me[Ce-1],Te=me[Ce];let ze=H[ve]<J,Ee=H[Te]<J;D.vertexLength+((ze?1:0)+(Ee?1:0))>Tt.MAX_VERTEX_ARRAY_LENGTH&&(D=C.createNewSegment(k,L),J=se.count,ze=!0,Ee=!0,Z=0);const ke=Fc(H,F,U,se,ve,ze,D),Pe=Fc(H,F,U,se,Te,Ee,D);L.emplaceBack(Z+ke-J,Z+Pe-J),D.primitiveLength++}}}(p,r,m,c,y,n),t.forceNewSegmentOnNextPrepare(),p==null||p.forceNewSegmentOnNextPrepare()}function Fc(n,t,r,a,c,d,p){if(d){const m=a.count;return r(t[2*c],t[2*c+1]),n[c]=a.count,a.count++,p.vertexLength++,m}return n[c]}class Hd{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new xe,this.indexArray=new Nt,this.indexArray2=new Ot,this.programConfigurations=new Hn(t.layers,t.zoom),this.segments=new Tt,this.segments2=new Tt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=$d("fill",this.layers,r);const c=this.layers[0].layout.get("fill-sort-key"),d=!c.isConstant(),p=[];for(const{feature:m,id:y,index:b,sourceLayerIndex:S}of t){const C=this.layers[0]._featureFilter.needGeometry,k=io(m,C);if(!this.layers[0]._featureFilter.filter(new Wt(this.zoom,{globalState:this.globalState}),k,a))continue;const L=d?c.evaluate(k,{},a,r.availableImages):void 0,F={id:y,properties:m.properties,type:m.type,sourceLayerIndex:S,index:b,geometry:C?k.geometry:to(m),patterns:{},sortKey:L};p.push(F)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:b,sourceLayerIndex:S}=m;if(this.hasPattern){const C=Gd("fill",this.layers,m,this.zoom,r);this.patternFeatures.push(C)}else this.addFeature(m,y,b,a,{},r.subdivisionGranularity);r.featureIndex.insert(t[b].feature,y,b,S,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,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,Qy),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,r,a,c,d,p){for(const m of Oo(r,500)){const y=cm(m,c,p.fill.getGranularityForZoomLevel(c.z)),b=this.layoutVertexArray;um((S,C)=>{b.emplaceBack(S,C)},this.segments,this.layoutVertexArray,this.indexArray,y.verticesFlattened,y.indicesTriangles,this.segments2,this.indexArray2,y.indicesLineList)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}}let hm,dm;Ze("FillBucket",Hd,{omit:["layers","patternFeatures"]});var hx={get paint(){return dm=dm||new Ji({"fill-antialias":new qe(ne.paint_fill["fill-antialias"]),"fill-opacity":new et(ne.paint_fill["fill-opacity"]),"fill-color":new et(ne.paint_fill["fill-color"]),"fill-outline-color":new et(ne.paint_fill["fill-outline-color"]),"fill-translate":new qe(ne.paint_fill["fill-translate"]),"fill-translate-anchor":new qe(ne.paint_fill["fill-translate-anchor"]),"fill-pattern":new ol(ne.paint_fill["fill-pattern"])})},get layout(){return hm=hm||new Ji({"fill-sort-key":new et(ne.layout_fill["fill-sort-key"])})}};class dx extends Di{constructor(t){super(t,hx)}recalculate(t,r){super.recalculate(t,r);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 Hd(t)}queryRadius(){return hh(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:r,transform:a,pixelsToTileUnits:c}){return $f(dh(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,c),r)}isTileClipped(){return!0}}const px=ni([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),fx=ni([{name:"a_centroid",components:2,type:"Int16"}],4),{members:mx}=px;var Xd,pm,Yd,fm,Kd,mm,gm,gh={};function _m(){if(pm)return Xd;pm=1;var n=Ve();function t(c,d,p,m,y){this.properties={},this.extent=p,this.type=0,this._pbf=c,this._geometry=-1,this._keys=m,this._values=y,c.readFields(r,this,d)}function r(c,d,p){c==1?d.id=p.readVarint():c==2?function(m,y){for(var b=m.readVarint()+m.pos;m.pos<b;){var S=y._keys[m.readVarint()],C=y._values[m.readVarint()];y.properties[S]=C}}(p,d):c==3?d.type=p.readVarint():c==4&&(d._geometry=p.pos)}function a(c){for(var d,p,m=0,y=0,b=c.length,S=b-1;y<b;S=y++)m+=((p=c[S]).x-(d=c[y]).x)*(d.y+p.y);return m}return Xd=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,m=1,y=0,b=0,S=0,C=[];c.pos<p;){if(y<=0){var k=c.readVarint();m=7&k,y=k>>3}if(y--,m===1||m===2)b+=c.readSVarint(),S+=c.readSVarint(),m===1&&(d&&C.push(d),d=[]),d.push(new n(b,S));else{if(m!==7)throw new Error("unknown command "+m);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,m=0,y=0,b=0,S=1/0,C=-1/0,k=1/0,L=-1/0;c.pos<d;){if(m<=0){var F=c.readVarint();p=7&F,m=F>>3}if(m--,p===1||p===2)(y+=c.readSVarint())<S&&(S=y),y>C&&(C=y),(b+=c.readSVarint())<k&&(k=b),b>L&&(L=b);else if(p!==7)throw new Error("unknown command "+p)}return[S,k,C,L]},t.prototype.toGeoJSON=function(c,d,p){var m,y,b=this.extent*Math.pow(2,p),S=this.extent*c,C=this.extent*d,k=this.loadGeometry(),L=t.types[this.type];function F(H){for(var se=0;se<H.length;se++){var J=H[se];H[se]=[360*(J.x+S)/b-180,360/Math.PI*Math.atan(Math.exp((180-360*(J.y+C)/b)*Math.PI/180))-90]}}switch(this.type){case 1:var j=[];for(m=0;m<k.length;m++)j[m]=k[m][0];F(k=j);break;case 2:for(m=0;m<k.length;m++)F(k[m]);break;case 3:for(k=function(H){var se=H.length;if(se<=1)return[H];for(var J,D,Z=[],te=0;te<se;te++){var me=a(H[te]);me!==0&&(D===void 0&&(D=me<0),D===me<0?(J&&Z.push(J),J=[H[te]]):J.push(H[te]))}return J&&Z.push(J),Z}(k),m=0;m<k.length;m++)for(y=0;y<k[m].length;y++)F(k[m][y])}k.length===1?k=k[0]:L="Multi"+L;var U={type:"Feature",geometry:{type:L,coordinates:k},properties:this.properties};return"id"in this&&(U.id=this.id),U},Xd}function ym(){if(fm)return Yd;fm=1;var n=_m();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(r,this,c),this.length=this._features.length}function r(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 m=null,y=p.readVarint()+p.pos;p.pos<y;){var b=p.readVarint()>>3;m=b===1?p.readString():b===2?p.readFloat():b===3?p.readDouble():b===4?p.readVarint64():b===5?p.readVarint():b===6?p.readSVarint():b===7?p.readBoolean():null}return m}(d))}return Yd=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 n(this._pbf,c,this.extent,this._keys,this._values)},Yd}function xm(){return gm||(gm=1,gh.VectorTile=function(){if(mm)return Kd;mm=1;var n=ym();function t(r,a,c){if(r===3){var d=new n(c,c.readVarint()+c.pos);d.length&&(a[d.name]=d)}}return Kd=function(r,a){this.layers=r.readFields(t,{},a)},Kd}(),gh.VectorTileFeature=_m(),gh.VectorTileLayer=ym()),gh}var Bc=ye(xm());const gx=Bc.VectorTileFeature.types,Jd=Math.pow(2,13);function Oc(n,t,r,a,c,d,p,m){n.emplaceBack(t,r,2*Math.floor(a*Jd)+p,c*Jd*2,d*Jd*2,Math.round(m))}class Qd{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new Fe,this.centroidVertexArray=new pe,this.indexArray=new Nt,this.programConfigurations=new Hn(t.layers,t.zoom),this.segments=new Tt,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.features=[],this.hasPattern=$d("fill-extrusion",this.layers,r);for(const{feature:c,id:d,index:p,sourceLayerIndex:m}of t){const y=this.layers[0]._featureFilter.needGeometry,b=io(c,y);if(!this.layers[0]._featureFilter.filter(new Wt(this.zoom,{globalState:this.globalState}),b,a))continue;const S={id:d,sourceLayerIndex:m,index:p,geometry:y?b.geometry:to(c),properties:c.properties,type:c.type,patterns:{}};this.hasPattern?this.features.push(Gd("fill-extrusion",this.layers,S,this.zoom,r)):this.addFeature(S,S.geometry,p,a,{},r.subdivisionGranularity),r.featureIndex.insert(c,S.geometry,p,m,this.index,!0)}}addFeatures(t,r,a){for(const c of this.features){const{geometry:d}=c;this.addFeature(c,d,c.index,r,a,t.subdivisionGranularity)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,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,mx),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,fx.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,r,a,c,d,p){for(const m of Oo(r,500)){const y={x:0,y:0,sampleCount:0},b=this.layoutVertexArray.length;this.processPolygon(y,c,t,m,p);const S=this.layoutVertexArray.length-b,C=Math.floor(y.x/y.sampleCount),k=Math.floor(y.y/y.sampleCount);for(let L=0;L<S;L++)this.centroidVertexArray.emplaceBack(C,k)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}processPolygon(t,r,a,c,d){if(c.length<1||vm(c[0]))return;for(const C of c)C.length!==0&&_x(t,C);const p={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},m=d.fill.getGranularityForZoomLevel(r.z),y=gx[a.type]==="Polygon";for(const C of c){if(C.length===0||vm(C))continue;const k=no(C,m,y);this._generateSideFaces(k,p)}if(!y)return;const b=cm(c,r,m,!1),S=this.layoutVertexArray;um((C,k)=>{Oc(S,C,k,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,b.verticesFlattened,b.indicesTriangles)}_generateSideFaces(t,r){let a=0;for(let c=1;c<t.length;c++){const d=t[c],p=t[c-1];if(yx(d,p))continue;r.segment.vertexLength+4>Tt.MAX_VERTEX_ARRAY_LENGTH&&(r.segment=this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray));const m=d.sub(p)._perp()._unit(),y=p.dist(d);a+y>32768&&(a=0),Oc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,0,a),Oc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,1,a),a+=y,Oc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,0,a),Oc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,1,a);const b=r.segment.vertexLength;this.indexArray.emplaceBack(b,b+2,b+1),this.indexArray.emplaceBack(b+1,b+2,b+3),r.segment.vertexLength+=4,r.segment.primitiveLength+=2}}}function _x(n,t){for(let r=0;r<t.length;r++){const a=t[r];r===t.length-1&&t[0].x===a.x&&t[0].y===a.y||(n.x+=a.x,n.y+=a.y,n.sampleCount++)}}function yx(n,t){return n.x===t.x&&(n.x<0||n.x>At)||n.y===t.y&&(n.y<0||n.y>At)}function vm(n){return n.every(t=>t.x<0)||n.every(t=>t.x>At)||n.every(t=>t.y<0)||n.every(t=>t.y>At)}let bm;Ze("FillExtrusionBucket",Qd,{omit:["layers","features"]});var xx={get paint(){return bm=bm||new Ji({"fill-extrusion-opacity":new qe(ne["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new et(ne["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new qe(ne["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new qe(ne["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new ol(ne["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new et(ne["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new et(ne["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new qe(ne["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class vx extends Di{constructor(t){super(t,xx)}createBucket(t){return new Qd(t)}queryRadius(){return hh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p,pixelPosMatrix:m}){const y=dh(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,p),b=this.paint.get("fill-extrusion-height").evaluate(r,a),S=this.paint.get("fill-extrusion-base").evaluate(r,a),C=function(L,F){const j=[];for(const U of L){const H=[U.x,U.y,0,1];zi(H,H,F),j.push(new Be(H[0]/H[3],H[1]/H[3]))}return j}(y,m),k=function(L,F,j,U){const H=[],se=[],J=U[8]*F,D=U[9]*F,Z=U[10]*F,te=U[11]*F,me=U[8]*j,Ce=U[9]*j,ve=U[10]*j,Te=U[11]*j;for(const ze of L){const Ee=[],ke=[];for(const Pe of ze){const Ge=Pe.x,Je=Pe.y,Ke=U[0]*Ge+U[4]*Je+U[12],He=U[1]*Ge+U[5]*Je+U[13],xt=U[2]*Ge+U[6]*Je+U[14],ai=U[3]*Ge+U[7]*Je+U[15],yi=xt+Z,$i=ai+te,$r=Ke+me,vr=He+Ce,Oi=xt+ve,ei=ai+Te,Ci=new Be((Ke+J)/$i,(He+D)/$i);Ci.z=yi/$i,Ee.push(Ci);const ji=new Be($r/ei,vr/ei);ji.z=Oi/ei,ke.push(ji)}H.push(Ee),se.push(ke)}return[H,se]}(c,S,b,m);return function(L,F,j){let U=1/0;$f(j,F)&&(U=wm(j,F[0]));for(let H=0;H<F.length;H++){const se=F[H],J=L[H];for(let D=0;D<se.length-1;D++){const Z=se[D],te=[Z,se[D+1],J[D+1],J[D],Z];Uf(j,te)&&(U=Math.min(U,wm(j,te)))}}return U!==1/0&&U}(k[0],k[1],C)}}function jc(n,t){return n.x*t.x+n.y*t.y}function wm(n,t){if(n.length===1){let r=0;const a=t[r++];let c;for(;!c||a.equals(c);)if(c=t[r++],!c)return 1/0;for(;r<t.length;r++){const d=t[r],p=n[0],m=c.sub(a),y=d.sub(a),b=p.sub(a),S=jc(m,m),C=jc(m,y),k=jc(y,y),L=jc(b,m),F=jc(b,y),j=S*k-C*C,U=(k*L-C*F)/j,H=(S*F-C*L)/j,se=a.z*(1-U-H)+c.z*U+d.z*H;if(isFinite(se))return se}return 1/0}{let r=1/0;for(const a of t)r=Math.min(r,a.z);return r}}const bx=ni([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:wx}=bx,Tx=ni([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Sx}=Tx,Px=Bc.VectorTileFeature.types,Mx=Math.cos(Math.PI/180*37.5),Tm=Math.pow(2,14)/.5;class ep{constructor(t){this.zoom=t.zoom,this.globalState=t.globalState,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(r=>r.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(r=>{this.gradients[r.id]={}}),this.layoutVertexArray=new Le,this.layoutVertexArray2=new Ie,this.indexArray=new Nt,this.programConfigurations=new Hn(t.layers,t.zoom),this.segments=new Tt,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(r=>r.isStateDependent()).map(r=>r.id)}populate(t,r,a){this.hasPattern=$d("line",this.layers,r);const c=this.layers[0].layout.get("line-sort-key"),d=!c.isConstant(),p=[];for(const{feature:m,id:y,index:b,sourceLayerIndex:S}of t){const C=this.layers[0]._featureFilter.needGeometry,k=io(m,C);if(!this.layers[0]._featureFilter.filter(new Wt(this.zoom,{globalState:this.globalState}),k,a))continue;const L=d?c.evaluate(k,{},a):void 0,F={id:y,properties:m.properties,type:m.type,sourceLayerIndex:S,index:b,geometry:C?k.geometry:to(m),patterns:{},sortKey:L};p.push(F)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:b,sourceLayerIndex:S}=m;if(this.hasPattern){const C=Gd("line",this.layers,m,this.zoom,r);this.patternFeatures.push(C)}else this.addFeature(m,y,b,a,{},r.subdivisionGranularity);r.featureIndex.insert(t[b].feature,y,b,S,this.index)}}update(t,r,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,r,this.stateDependentLayers,a)}addFeatures(t,r,a){for(const c of this.patternFeatures)this.addFeature(c,c.geometry,c.index,r,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,Sx)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,wx),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,r,a,c,d,p){const m=this.layers[0].layout,y=m.get("line-join").evaluate(t,{}),b=m.get("line-cap"),S=m.get("line-miter-limit"),C=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const k of r)this.addLine(k,t,y,b,S,C,c,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,c)}addLine(t,r,a,c,d,p,m,y){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=no(t,m?y.line.getGranularityForZoomLevel(m.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let J=0;J<t.length-1;J++)this.totalDistance+=t[J].dist(t[J+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const b=Px[r.type]==="Polygon";let S=t.length;for(;S>=2&&t[S-1].equals(t[S-2]);)S--;let C=0;for(;C<S-1&&t[C].equals(t[C+1]);)C++;if(S<(b?3:2))return;a==="bevel"&&(d=1.05);const k=this.overscaling<=16?122880/(512*this.overscaling):0,L=this.segments.prepareSegment(10*S,this.layoutVertexArray,this.indexArray);let F,j,U,H,se;this.e1=this.e2=-1,b&&(F=t[S-2],se=t[C].sub(F)._unit()._perp());for(let J=C;J<S;J++){if(U=J===S-1?b?t[C+1]:void 0:t[J+1],U&&t[J].equals(U))continue;se&&(H=se),F&&(j=F),F=t[J],se=U?U.sub(F)._unit()._perp():H,H=H||se;let D=H.add(se);D.x===0&&D.y===0||D._unit();const Z=H.x*se.x+H.y*se.y,te=D.x*se.x+D.y*se.y,me=te!==0?1/te:1/0,Ce=2*Math.sqrt(2-2*te),ve=te<Mx&&j&&U,Te=H.x*se.y-H.y*se.x>0;if(ve&&J>C){const ke=F.dist(j);if(ke>2*k){const Pe=F.sub(F.sub(j)._mult(k/ke)._round());this.updateDistance(j,Pe),this.addCurrentVertex(Pe,H,0,0,L),j=Pe}}const ze=j&&U;let Ee=ze?a:b?"butt":c;if(ze&&Ee==="round"&&(me<p?Ee="miter":me<=2&&(Ee="fakeround")),Ee==="miter"&&me>d&&(Ee="bevel"),Ee==="bevel"&&(me>2&&(Ee="flipbevel"),me<d&&(Ee="miter")),j&&this.updateDistance(j,F),Ee==="miter")D._mult(me),this.addCurrentVertex(F,D,0,0,L);else if(Ee==="flipbevel"){if(me>100)D=se.mult(-1);else{const ke=me*H.add(se).mag()/H.sub(se).mag();D._perp()._mult(ke*(Te?-1:1))}this.addCurrentVertex(F,D,0,0,L),this.addCurrentVertex(F,D.mult(-1),0,0,L)}else if(Ee==="bevel"||Ee==="fakeround"){const ke=-Math.sqrt(me*me-1),Pe=Te?ke:0,Ge=Te?0:ke;if(j&&this.addCurrentVertex(F,H,Pe,Ge,L),Ee==="fakeround"){const Je=Math.round(180*Ce/Math.PI/20);for(let Ke=1;Ke<Je;Ke++){let He=Ke/Je;if(He!==.5){const ai=He-.5;He+=He*ai*(He-1)*((1.0904+Z*(Z*(3.55645-1.43519*Z)-3.2452))*ai*ai+(.848013+Z*(.215638*Z-1.06021)))}const xt=se.sub(H)._mult(He)._add(H)._unit()._mult(Te?-1:1);this.addHalfVertex(F,xt.x,xt.y,!1,Te,0,L)}}U&&this.addCurrentVertex(F,se,-Pe,-Ge,L)}else if(Ee==="butt")this.addCurrentVertex(F,D,0,0,L);else if(Ee==="square"){const ke=j?1:-1;this.addCurrentVertex(F,D,ke,ke,L)}else Ee==="round"&&(j&&(this.addCurrentVertex(F,H,0,0,L),this.addCurrentVertex(F,H,1,1,L,!0)),U&&(this.addCurrentVertex(F,se,-1,-1,L,!0),this.addCurrentVertex(F,se,0,0,L)));if(ve&&J<S-1){const ke=F.dist(U);if(ke>2*k){const Pe=F.add(U.sub(F)._mult(k/ke)._round());this.updateDistance(F,Pe),this.addCurrentVertex(Pe,se,0,0,L),F=Pe}}}}addCurrentVertex(t,r,a,c,d,p=!1){const m=r.y*c-r.x,y=-r.y-r.x*c;this.addHalfVertex(t,r.x+r.y*a,r.y-r.x*a,p,!1,a,d),this.addHalfVertex(t,m,y,p,!0,-c,d),this.distance>Tm/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,r,a,c,d,p))}addHalfVertex({x:t,y:r},a,c,d,p,m,y){const b=.5*(this.lineClips?this.scaledDistance*(Tm-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(d?1:0),(r<<1)+(p?1:0),Math.round(63*a)+128,Math.round(63*c)+128,1+(m===0?0:m<0?-1:1)|(63&b)<<2,b>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const S=y.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,S,this.e2),y.primitiveLength++),p?this.e2=S:this.e1=S}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,r){this.distance+=t.dist(r),this.updateScaledDistance()}}let Sm,Pm;Ze("LineBucket",ep,{omit:["layers","patternFeatures"]});var Mm={get paint(){return Pm=Pm||new Ji({"line-opacity":new et(ne.paint_line["line-opacity"]),"line-color":new et(ne.paint_line["line-color"]),"line-translate":new qe(ne.paint_line["line-translate"]),"line-translate-anchor":new qe(ne.paint_line["line-translate-anchor"]),"line-width":new et(ne.paint_line["line-width"]),"line-gap-width":new et(ne.paint_line["line-gap-width"]),"line-offset":new et(ne.paint_line["line-offset"]),"line-blur":new et(ne.paint_line["line-blur"]),"line-dasharray":new bc(ne.paint_line["line-dasharray"]),"line-pattern":new ol(ne.paint_line["line-pattern"]),"line-gradient":new Xs(ne.paint_line["line-gradient"])})},get layout(){return Sm=Sm||new Ji({"line-cap":new qe(ne.layout_line["line-cap"]),"line-join":new et(ne.layout_line["line-join"]),"line-miter-limit":new qe(ne.layout_line["line-miter-limit"]),"line-round-limit":new qe(ne.layout_line["line-round-limit"]),"line-sort-key":new et(ne.layout_line["line-sort-key"])})}};class Cx extends et{possiblyEvaluate(t,r){return r=new Wt(Math.floor(r.zoom),{now:r.now,fadeDuration:r.fadeDuration,zoomHistory:r.zoomHistory,transition:r.transition}),super.possiblyEvaluate(t,r)}evaluate(t,r,a,c){return r=Hi({},r,{zoom:Math.floor(r.zoom)}),super.evaluate(t,r,a,c)}}let _h;class Ix extends Di{constructor(t){super(t,Mm),this.gradientVersion=0,_h||(_h=new Cx(Mm.paint.properties["line-width"].specification),_h.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const r=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(r)&&r._styleExpression.expression instanceof Na,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,r){super.recalculate(t,r),this.paint._values["line-floorwidth"]=_h.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new ep(t)}queryRadius(t){const r=t,a=Cm(Ec("line-width",this,r),Ec("line-gap-width",this,r)),c=Ec("line-offset",this,r);return a/2+Math.abs(c)+hh(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:r,featureState:a,geometry:c,transform:d,pixelsToTileUnits:p}){const m=dh(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,p),y=p/2*Cm(this.paint.get("line-width").evaluate(r,a),this.paint.get("line-gap-width").evaluate(r,a)),b=this.paint.get("line-offset").evaluate(r,a);return b&&(c=function(S,C){const k=[];for(let L=0;L<S.length;L++){const F=S[L],j=[];for(let U=0;U<F.length;U++){const H=F[U-1],se=F[U],J=F[U+1],D=U===0?new Be(0,0):se.sub(H)._unit()._perp(),Z=U===F.length-1?new Be(0,0):J.sub(se)._unit()._perp(),te=D._add(Z)._unit(),me=te.x*Z.x+te.y*Z.y;me!==0&&te._mult(1/me),j.push(te._mult(C)._add(se))}k.push(j)}return k}(c,b*p)),function(S,C,k){for(let L=0;L<C.length;L++){const F=C[L];if(S.length>=3){for(let j=0;j<F.length;j++)if(ul(S,F[j]))return!0}if(Vy(S,F,k))return!0}return!1}(m,c,y)}isTileClipped(){return!0}}function Cm(n,t){return t>0?t+2*n:n}const Ex=ni([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Ax=ni([{name:"a_projected_pos",components:3,type:"Float32"}],4);ni([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const zx=ni([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);ni([{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 Im=ni([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),kx=ni([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Rx(n,t,r){return n.sections.forEach(a=>{a.text=function(c,d,p){const m=d.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?c=c.toLocaleUpperCase():m==="lowercase"&&(c=c.toLocaleLowerCase()),Vn.applyArabicShaping&&(c=Vn.applyArabicShaping(c)),c}(a.text,t,r)}),n}ni([{name:"triangle",components:3,type:"Uint16"}]),ni([{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"}]),ni([{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"}]),ni([{type:"Float32",name:"offsetX"}]),ni([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),ni([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Nc={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Em,tp,Am,Mi=24,ip={};function Dx(){return Em||(Em=1,ip.read=function(n,t,r,a,c){var d,p,m=8*c-a-1,y=(1<<m)-1,b=y>>1,S=-7,C=r?c-1:0,k=r?-1:1,L=n[t+C];for(C+=k,d=L&(1<<-S)-1,L>>=-S,S+=m;S>0;d=256*d+n[t+C],C+=k,S-=8);for(p=d&(1<<-S)-1,d>>=-S,S+=a;S>0;p=256*p+n[t+C],C+=k,S-=8);if(d===0)d=1-b;else{if(d===y)return p?NaN:1/0*(L?-1:1);p+=Math.pow(2,a),d-=b}return(L?-1:1)*p*Math.pow(2,d-a)},ip.write=function(n,t,r,a,c,d){var p,m,y,b=8*d-c-1,S=(1<<b)-1,C=S>>1,k=c===23?Math.pow(2,-24)-Math.pow(2,-77):0,L=a?0:d-1,F=a?1:-1,j=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(m=isNaN(t)?1:0,p=S):(p=Math.floor(Math.log(t)/Math.LN2),t*(y=Math.pow(2,-p))<1&&(p--,y*=2),(t+=p+C>=1?k/y:k*Math.pow(2,1-C))*y>=2&&(p++,y/=2),p+C>=S?(m=0,p=S):p+C>=1?(m=(t*y-1)*Math.pow(2,c),p+=C):(m=t*Math.pow(2,C-1)*Math.pow(2,c),p=0));c>=8;n[r+L]=255&m,L+=F,m/=256,c-=8);for(p=p<<c|m,b+=c;b>0;n[r+L]=255&p,L+=F,p/=256,b-=8);n[r+L-F]|=128*j}),ip}function zm(){if(Am)return tp;Am=1,tp=t;var n=Dx();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 r=4294967296,a=1/r,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,Z,te){return te?4294967296*Z+(D>>>0):4294967296*(Z>>>0)+(D>>>0)}function m(D,Z,te){var me=Z<=16383?1:Z<=2097151?2:Z<=268435455?3:Math.floor(Math.log(Z)/(7*Math.LN2));te.realloc(me);for(var Ce=te.pos-1;Ce>=D;Ce--)te.buf[Ce+me]=te.buf[Ce]}function y(D,Z){for(var te=0;te<D.length;te++)Z.writeVarint(D[te])}function b(D,Z){for(var te=0;te<D.length;te++)Z.writeSVarint(D[te])}function S(D,Z){for(var te=0;te<D.length;te++)Z.writeFloat(D[te])}function C(D,Z){for(var te=0;te<D.length;te++)Z.writeDouble(D[te])}function k(D,Z){for(var te=0;te<D.length;te++)Z.writeBoolean(D[te])}function L(D,Z){for(var te=0;te<D.length;te++)Z.writeFixed32(D[te])}function F(D,Z){for(var te=0;te<D.length;te++)Z.writeSFixed32(D[te])}function j(D,Z){for(var te=0;te<D.length;te++)Z.writeFixed64(D[te])}function U(D,Z){for(var te=0;te<D.length;te++)Z.writeSFixed64(D[te])}function H(D,Z){return(D[Z]|D[Z+1]<<8|D[Z+2]<<16)+16777216*D[Z+3]}function se(D,Z,te){D[te]=Z,D[te+1]=Z>>>8,D[te+2]=Z>>>16,D[te+3]=Z>>>24}function J(D,Z){return(D[Z]|D[Z+1]<<8|D[Z+2]<<16)+(D[Z+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(D,Z,te){for(te=te||this.length;this.pos<te;){var me=this.readVarint(),Ce=me>>3,ve=this.pos;this.type=7&me,D(Ce,Z,this),this.pos===ve&&this.skip(me)}return Z},readMessage:function(D,Z){return this.readFields(D,Z,this.readVarint()+this.pos)},readFixed32:function(){var D=H(this.buf,this.pos);return this.pos+=4,D},readSFixed32:function(){var D=J(this.buf,this.pos);return this.pos+=4,D},readFixed64:function(){var D=H(this.buf,this.pos)+H(this.buf,this.pos+4)*r;return this.pos+=8,D},readSFixed64:function(){var D=H(this.buf,this.pos)+J(this.buf,this.pos+4)*r;return this.pos+=8,D},readFloat:function(){var D=n.read(this.buf,this.pos,!0,23,4);return this.pos+=4,D},readDouble:function(){var D=n.read(this.buf,this.pos,!0,52,8);return this.pos+=8,D},readVarint:function(D){var Z,te,me=this.buf;return Z=127&(te=me[this.pos++]),te<128?Z:(Z|=(127&(te=me[this.pos++]))<<7,te<128?Z:(Z|=(127&(te=me[this.pos++]))<<14,te<128?Z:(Z|=(127&(te=me[this.pos++]))<<21,te<128?Z:function(Ce,ve,Te){var ze,Ee,ke=Te.buf;if(ze=(112&(Ee=ke[Te.pos++]))>>4,Ee<128||(ze|=(127&(Ee=ke[Te.pos++]))<<3,Ee<128)||(ze|=(127&(Ee=ke[Te.pos++]))<<10,Ee<128)||(ze|=(127&(Ee=ke[Te.pos++]))<<17,Ee<128)||(ze|=(127&(Ee=ke[Te.pos++]))<<24,Ee<128)||(ze|=(1&(Ee=ke[Te.pos++]))<<31,Ee<128))return p(Ce,ze,ve);throw new Error("Expected varint not more than 10 bytes")}(Z|=(15&(te=me[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,Z=this.pos;return this.pos=D,D-Z>=12&&c?function(te,me,Ce){return c.decode(te.subarray(me,Ce))}(this.buf,Z,D):function(te,me,Ce){for(var ve="",Te=me;Te<Ce;){var ze,Ee,ke,Pe=te[Te],Ge=null,Je=Pe>239?4:Pe>223?3:Pe>191?2:1;if(Te+Je>Ce)break;Je===1?Pe<128&&(Ge=Pe):Je===2?(192&(ze=te[Te+1]))==128&&(Ge=(31&Pe)<<6|63&ze)<=127&&(Ge=null):Je===3?(Ee=te[Te+2],(192&(ze=te[Te+1]))==128&&(192&Ee)==128&&((Ge=(15&Pe)<<12|(63&ze)<<6|63&Ee)<=2047||Ge>=55296&&Ge<=57343)&&(Ge=null)):Je===4&&(Ee=te[Te+2],ke=te[Te+3],(192&(ze=te[Te+1]))==128&&(192&Ee)==128&&(192&ke)==128&&((Ge=(15&Pe)<<18|(63&ze)<<12|(63&Ee)<<6|63&ke)<=65535||Ge>=1114112)&&(Ge=null)),Ge===null?(Ge=65533,Je=1):Ge>65535&&(Ge-=65536,ve+=String.fromCharCode(Ge>>>10&1023|55296),Ge=56320|1023&Ge),ve+=String.fromCharCode(Ge),Te+=Je}return ve}(this.buf,Z,D)},readBytes:function(){var D=this.readVarint()+this.pos,Z=this.buf.subarray(this.pos,D);return this.pos=D,Z},readPackedVarint:function(D,Z){if(this.type!==t.Bytes)return D.push(this.readVarint(Z));var te=d(this);for(D=D||[];this.pos<te;)D.push(this.readVarint(Z));return D},readPackedSVarint:function(D){if(this.type!==t.Bytes)return D.push(this.readSVarint());var Z=d(this);for(D=D||[];this.pos<Z;)D.push(this.readSVarint());return D},readPackedBoolean:function(D){if(this.type!==t.Bytes)return D.push(this.readBoolean());var Z=d(this);for(D=D||[];this.pos<Z;)D.push(this.readBoolean());return D},readPackedFloat:function(D){if(this.type!==t.Bytes)return D.push(this.readFloat());var Z=d(this);for(D=D||[];this.pos<Z;)D.push(this.readFloat());return D},readPackedDouble:function(D){if(this.type!==t.Bytes)return D.push(this.readDouble());var Z=d(this);for(D=D||[];this.pos<Z;)D.push(this.readDouble());return D},readPackedFixed32:function(D){if(this.type!==t.Bytes)return D.push(this.readFixed32());var Z=d(this);for(D=D||[];this.pos<Z;)D.push(this.readFixed32());return D},readPackedSFixed32:function(D){if(this.type!==t.Bytes)return D.push(this.readSFixed32());var Z=d(this);for(D=D||[];this.pos<Z;)D.push(this.readSFixed32());return D},readPackedFixed64:function(D){if(this.type!==t.Bytes)return D.push(this.readFixed64());var Z=d(this);for(D=D||[];this.pos<Z;)D.push(this.readFixed64());return D},readPackedSFixed64:function(D){if(this.type!==t.Bytes)return D.push(this.readSFixed64());var Z=d(this);for(D=D||[];this.pos<Z;)D.push(this.readSFixed64());return D},skip:function(D){var Z=7&D;if(Z===t.Varint)for(;this.buf[this.pos++]>127;);else if(Z===t.Bytes)this.pos=this.readVarint()+this.pos;else if(Z===t.Fixed32)this.pos+=4;else{if(Z!==t.Fixed64)throw new Error("Unimplemented type: "+Z);this.pos+=8}},writeTag:function(D,Z){this.writeVarint(D<<3|Z)},realloc:function(D){for(var Z=this.length||16;Z<this.pos+D;)Z*=2;if(Z!==this.length){var te=new Uint8Array(Z);te.set(this.buf),this.buf=te,this.length=Z}},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(Z,te){var me,Ce;if(Z>=0?(me=Z%4294967296|0,Ce=Z/4294967296|0):(Ce=~(-Z/4294967296),4294967295^(me=~(-Z%4294967296))?me=me+1|0:(me=0,Ce=Ce+1|0)),Z>=18446744073709552e3||Z<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");te.realloc(10),function(ve,Te,ze){ze.buf[ze.pos++]=127&ve|128,ve>>>=7,ze.buf[ze.pos++]=127&ve|128,ve>>>=7,ze.buf[ze.pos++]=127&ve|128,ve>>>=7,ze.buf[ze.pos++]=127&ve|128,ze.buf[ze.pos]=127&(ve>>>=7)}(me,0,te),function(ve,Te){var ze=(7&ve)<<4;Te.buf[Te.pos++]|=ze|((ve>>>=3)?128:0),ve&&(Te.buf[Te.pos++]=127&ve|((ve>>>=7)?128:0),ve&&(Te.buf[Te.pos++]=127&ve|((ve>>>=7)?128:0),ve&&(Te.buf[Te.pos++]=127&ve|((ve>>>=7)?128:0),ve&&(Te.buf[Te.pos++]=127&ve|((ve>>>=7)?128:0),ve&&(Te.buf[Te.pos++]=127&ve)))))}(Ce,te)}(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 Z=this.pos;this.pos=function(me,Ce,ve){for(var Te,ze,Ee=0;Ee<Ce.length;Ee++){if((Te=Ce.charCodeAt(Ee))>55295&&Te<57344){if(!ze){Te>56319||Ee+1===Ce.length?(me[ve++]=239,me[ve++]=191,me[ve++]=189):ze=Te;continue}if(Te<56320){me[ve++]=239,me[ve++]=191,me[ve++]=189,ze=Te;continue}Te=ze-55296<<10|Te-56320|65536,ze=null}else ze&&(me[ve++]=239,me[ve++]=191,me[ve++]=189,ze=null);Te<128?me[ve++]=Te:(Te<2048?me[ve++]=Te>>6|192:(Te<65536?me[ve++]=Te>>12|224:(me[ve++]=Te>>18|240,me[ve++]=Te>>12&63|128),me[ve++]=Te>>6&63|128),me[ve++]=63&Te|128)}return ve}(this.buf,D,this.pos);var te=this.pos-Z;te>=128&&m(Z,te,this),this.pos=Z-1,this.writeVarint(te),this.pos+=te},writeFloat:function(D){this.realloc(4),n.write(this.buf,D,this.pos,!0,23,4),this.pos+=4},writeDouble:function(D){this.realloc(8),n.write(this.buf,D,this.pos,!0,52,8),this.pos+=8},writeBytes:function(D){var Z=D.length;this.writeVarint(Z),this.realloc(Z);for(var te=0;te<Z;te++)this.buf[this.pos++]=D[te]},writeRawMessage:function(D,Z){this.pos++;var te=this.pos;D(Z,this);var me=this.pos-te;me>=128&&m(te,me,this),this.pos=te-1,this.writeVarint(me),this.pos+=me},writeMessage:function(D,Z,te){this.writeTag(D,t.Bytes),this.writeRawMessage(Z,te)},writePackedVarint:function(D,Z){Z.length&&this.writeMessage(D,y,Z)},writePackedSVarint:function(D,Z){Z.length&&this.writeMessage(D,b,Z)},writePackedBoolean:function(D,Z){Z.length&&this.writeMessage(D,k,Z)},writePackedFloat:function(D,Z){Z.length&&this.writeMessage(D,S,Z)},writePackedDouble:function(D,Z){Z.length&&this.writeMessage(D,C,Z)},writePackedFixed32:function(D,Z){Z.length&&this.writeMessage(D,L,Z)},writePackedSFixed32:function(D,Z){Z.length&&this.writeMessage(D,F,Z)},writePackedFixed64:function(D,Z){Z.length&&this.writeMessage(D,j,Z)},writePackedSFixed64:function(D,Z){Z.length&&this.writeMessage(D,U,Z)},writeBytesField:function(D,Z){this.writeTag(D,t.Bytes),this.writeBytes(Z)},writeFixed32Field:function(D,Z){this.writeTag(D,t.Fixed32),this.writeFixed32(Z)},writeSFixed32Field:function(D,Z){this.writeTag(D,t.Fixed32),this.writeSFixed32(Z)},writeFixed64Field:function(D,Z){this.writeTag(D,t.Fixed64),this.writeFixed64(Z)},writeSFixed64Field:function(D,Z){this.writeTag(D,t.Fixed64),this.writeSFixed64(Z)},writeVarintField:function(D,Z){this.writeTag(D,t.Varint),this.writeVarint(Z)},writeSVarintField:function(D,Z){this.writeTag(D,t.Varint),this.writeSVarint(Z)},writeStringField:function(D,Z){this.writeTag(D,t.Bytes),this.writeString(Z)},writeFloatField:function(D,Z){this.writeTag(D,t.Fixed32),this.writeFloat(Z)},writeDoubleField:function(D,Z){this.writeTag(D,t.Fixed64),this.writeDouble(Z)},writeBooleanField:function(D,Z){this.writeVarintField(D,!!Z)}},tp}var ls,rp=ye(zm());function Lx(n,t,r){n===1&&r.readMessage(Fx,t)}function Fx(n,t,r){if(n===3){const{id:a,bitmap:c,width:d,height:p,left:m,top:y,advance:b}=r.readMessage(Bx,{});t.push({id:a,bitmap:new Ac({width:d+6,height:p+6},c),metrics:{width:d,height:p,left:m,top:y,advance:b}})}}function Bx(n,t,r){n===1?t.id=r.readVarint():n===2?t.bitmap=r.readBytes():n===3?t.width=r.readVarint():n===4?t.height=r.readVarint():n===5?t.left=r.readSVarint():n===6?t.top=r.readSVarint():n===7&&(t.advance=r.readVarint())}function km(n){let t=0,r=0;for(const p of n)t+=p.w*p.h,r=Math.max(r,p.w);n.sort((p,m)=>m.h-p.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),r),h:1/0}];let c=0,d=0;for(const p of n)for(let m=a.length-1;m>=0;m--){const y=a[m];if(!(p.w>y.w||p.h>y.h)){if(p.x=y.x,p.y=y.y,d=Math.max(d,p.y+p.h),c=Math.max(c,p.x+p.w),p.w===y.w&&p.h===y.h){const b=a.pop();m<a.length&&(a[m]=b)}else p.h===y.h?(y.x+=p.w,y.w-=p.w):p.w===y.w?(y.y+=p.h,y.h-=p.h):(a.push({x:y.x+p.w,y:y.y,w:y.w-p.w,h:p.h}),y.y+=p.h,y.h-=p.h);break}}return{w:c,h:d,fill:t/(c*d)||0}}class np{constructor(t,{pixelRatio:r,version:a,stretchX:c,stretchY:d,content:p,textFitWidth:m,textFitHeight:y}){this.paddedRect=t,this.pixelRatio=r,this.stretchX=c,this.stretchY=d,this.content=p,this.version=a,this.textFitWidth=m,this.textFitHeight=y}get tl(){return[this.paddedRect.x+1,this.paddedRect.y+1]}get br(){return[this.paddedRect.x+this.paddedRect.w-1,this.paddedRect.y+this.paddedRect.h-1]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2)/this.pixelRatio,(this.paddedRect.h-2)/this.pixelRatio]}}class Rm{constructor(t,r){const a={},c={};this.haveRenderCallbacks=[];const d=[];this.addImages(t,a,d),this.addImages(r,c,d);const{w:p,h:m}=km(d),y=new xr({width:p||1,height:m||1});for(const b in t){const S=t[b],C=a[b].paddedRect;xr.copy(S.data,y,{x:0,y:0},{x:C.x+1,y:C.y+1},S.data)}for(const b in r){const S=r[b],C=c[b].paddedRect,k=C.x+1,L=C.y+1,F=S.data.width,j=S.data.height;xr.copy(S.data,y,{x:0,y:0},{x:k,y:L},S.data),xr.copy(S.data,y,{x:0,y:j-1},{x:k,y:L-1},{width:F,height:1}),xr.copy(S.data,y,{x:0,y:0},{x:k,y:L+j},{width:F,height:1}),xr.copy(S.data,y,{x:F-1,y:0},{x:k-1,y:L},{width:1,height:j}),xr.copy(S.data,y,{x:0,y:0},{x:k+F,y:L},{width:1,height:j})}this.image=y,this.iconPositions=a,this.patternPositions=c}addImages(t,r,a){for(const c in t){const d=t[c],p={x:0,y:0,w:d.data.width+2,h:d.data.height+2};a.push(p),r[c]=new np(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(c)}}patchUpdatedImages(t,r){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in t.updatedImages)this.patchUpdatedImage(this.iconPositions[a],t.getImage(a),r),this.patchUpdatedImage(this.patternPositions[a],t.getImage(a),r)}patchUpdatedImage(t,r,a){if(!t||!r||t.version===r.version)return;t.version=r.version;const[c,d]=t.tl;a.update(r.data,void 0,{x:c,y:d})}}Ze("ImagePosition",np),Ze("ImageAtlas",Rm),P.an=void 0,(ls=P.an||(P.an={}))[ls.none=0]="none",ls[ls.horizontal=1]="horizontal",ls[ls.vertical=2]="vertical",ls[ls.horizontalOnly=3]="horizontalOnly";class Vc{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,r,a){const c=new Vc;return c.scale=t||1,c.fontStack=r,c.verticalAlign=a||"bottom",c}static forImage(t,r){const a=new Vc;return a.imageName=t,a.verticalAlign=r||"bottom",a}}class fl{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,r){const a=new fl;for(let c=0;c<t.sections.length;c++){const d=t.sections[c];d.image?a.addImageSection(d):a.addTextSection(d,r)}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 r="";for(let a=0;a<t.length;a++){const c=t.charCodeAt(a+1)||null,d=t.charCodeAt(a-1)||null;r+=c&&yc(c)&&!Nc[t[a+1]]||d&&yc(d)&&!Nc[t[a-1]]||!Nc[t[a]]?t[a]:Nc[t[a]]}return r}(this.text)}trim(){let t=0;for(let a=0;a<this.text.length&&xh[this.text.charCodeAt(a)];a++)t++;let r=this.text.length;for(let a=this.text.length-1;a>=0&&a>=t&&xh[this.text.charCodeAt(a)];a--)r--;this.text=this.text.substring(t,r),this.sectionIndex=this.sectionIndex.slice(t,r)}substring(t,r){const a=new fl;return a.text=this.text.substring(t,r),a.sectionIndex=this.sectionIndex.slice(t,r),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,r)=>Math.max(t,this.sections[r].scale),0)}getMaxImageSize(t){let r=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 m=p.displaySize;r=Math.max(r,m[0]),a=Math.max(a,m[1])}}return{maxImageWidth:r,maxImageHeight:a}}addTextSection(t,r){this.text+=t.text,this.sections.push(Vc.forText(t.scale,t.fontStack||r,t.verticalAlign));const a=this.sections.length-1;for(let c=0;c<t.text.length;++c)this.sectionIndex.push(a)}addImageSection(t){const r=t.image?t.image.name:"";if(r.length===0)return void ki("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(Vc.forImage(r,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):ki("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function yh(n,t,r,a,c,d,p,m,y,b,S,C,k,L,F){const j=fl.fromFeature(n,c);let U;C===P.an.vertical&&j.verticalizePunctuation();const{processBidirectionalText:H,processStyledBidirectionalText:se}=Vn;if(H&&j.sections.length===1){U=[];const Z=H(j.toString(),ap(j,b,d,t,a,L));for(const te of Z){const me=new fl;me.text=te,me.sections=j.sections;for(let Ce=0;Ce<te.length;Ce++)me.sectionIndex.push(0);U.push(me)}}else if(se){U=[];const Z=se(j.text,j.sectionIndex,ap(j,b,d,t,a,L));for(const te of Z){const me=new fl;me.text=te[0],me.sectionIndex=te[1],me.sections=j.sections,U.push(me)}}else U=function(Z,te){const me=[],Ce=Z.text;let ve=0;for(const Te of te)me.push(Z.substring(ve,Te)),ve=Te;return ve<Ce.length&&me.push(Z.substring(ve,Ce.length)),me}(j,ap(j,b,d,t,a,L));const J=[],D={positionedLines:J,text:j.toString(),top:S[1],bottom:S[1],left:S[0],right:S[0],writingMode:C,iconsInText:!1,verticalizable:!1};return function(Z,te,me,Ce,ve,Te,ze,Ee,ke,Pe,Ge,Je){let Ke=0,He=0,xt=0,ai=0;const yi=Ee==="right"?1:Ee==="left"?0:.5,$i=Mi/Je;let $r=0;for(const ei of ve){ei.trim();const Ci=ei.getMaxScale(),ji={positionedGlyphs:[],lineOffset:0};Z.positionedLines[$r]=ji;const Ni=ji.positionedGlyphs;let lr=0;if(!ei.length()){He+=Te,++$r;continue}const Gr=Vx(Ce,ei,$i);for(let br=0;br<ei.length();br++){const xi=ei.getSection(br),Ei=ei.getSectionIndex(br),Ai=ei.getCharCode(br),mi=Zx(ke,Ge,Ai);let $t;if(xi.imageName){if(Z.iconsInText=!0,xi.scale=xi.scale*$i,$t=$x(xi,mi,Ci,Gr,Ce),!$t)continue;lr=Math.max(lr,$t.imageOffset)}else if($t=Ux(xi,Ai,mi,Gr,te,me),!$t)continue;const{rect:Pn,metrics:yl,baselineOffset:Mn}=$t;Ni.push({glyph:Ai,imageName:xi.imageName,x:Ke,y:He+Mn+-17,vertical:mi,scale:xi.scale,fontStack:xi.fontStack,sectionIndex:Ei,metrics:yl,rect:Pn}),mi?(Z.verticalizable=!0,Ke+=(xi.imageName?yl.advance:Mi)*xi.scale+Pe):Ke+=yl.advance*xi.scale+Pe}Ni.length!==0&&(xt=Math.max(Ke-Pe,xt),Gx(Ni,0,Ni.length-1,yi)),Ke=0,ji.lineOffset=Math.max(lr,(Ci-1)*Mi);const Ii=Te*Ci+lr;He+=Ii,ai=Math.max(Ii,ai),++$r}const{horizontalAlign:vr,verticalAlign:Oi}=sp(ze);(function(ei,Ci,ji,Ni,lr,Gr,Ii,br,xi){const Ei=(Ci-ji)*lr;let Ai=0;Ai=Gr!==Ii?-br*Ni- -17:-Ni*xi*Ii+.5*Ii;for(const mi of ei)for(const $t of mi.positionedGlyphs)$t.x+=Ei,$t.y+=Ai})(Z.positionedLines,yi,vr,Oi,xt,ai,Te,He,ve.length),Z.top+=-Oi*He,Z.bottom=Z.top+He,Z.left+=-vr*xt,Z.right=Z.left+xt}(D,t,r,a,U,p,m,y,C,b,k,F),!function(Z){for(const te of Z)if(te.positionedGlyphs.length!==0)return!1;return!0}(J)&&D}const xh={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},Ox={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},jx={40:!0};function Dm(n,t,r,a,c,d){if(t.imageName){const p=a[t.imageName];return p?p.displaySize[0]*t.scale*Mi/d+c:0}{const p=r[t.fontStack],m=p&&p[n];return m?m.metrics.advance*t.scale+c:0}}function Lm(n,t,r,a){const c=Math.pow(n-t,2);return a?n<t?c/2:2*c:c+Math.abs(r)*r}function Nx(n,t,r){let a=0;return n===10&&(a-=1e4),r&&(a+=150),n!==40&&n!==65288||(a+=50),t!==41&&t!==65289||(a+=50),a}function Fm(n,t,r,a,c,d){let p=null,m=Lm(t,r,c,d);for(const y of a){const b=Lm(t-y.x,r,c,d)+y.badness;b<=m&&(p=y,m=b)}return{index:n,x:t,priorBreak:p,badness:m}}function Bm(n){return n?Bm(n.priorBreak).concat(n.index):[]}function ap(n,t,r,a,c,d){if(!n)return[];const p=[],m=function(C,k,L,F,j,U){let H=0;for(let se=0;se<C.length();se++){const J=C.getSection(se);H+=Dm(C.getCharCode(se),J,F,j,k,U)}return H/Math.max(1,Math.ceil(H/L))}(n,t,r,a,c,d),y=n.text.indexOf("")>=0;let b=0;for(let C=0;C<n.length();C++){const k=n.getSection(C),L=n.getCharCode(C);if(xh[L]||(b+=Dm(L,k,a,c,t,d)),C<n.length()-1){const F=!((S=L)<11904)&&(!!yt["CJK Compatibility Forms"](S)||!!yt["CJK Compatibility"](S)||!!yt["CJK Strokes"](S)||!!yt["CJK Symbols and Punctuation"](S)||!!yt["Enclosed CJK Letters and Months"](S)||!!yt["Halfwidth and Fullwidth Forms"](S)||!!yt["Ideographic Description Characters"](S)||!!yt["Vertical Forms"](S)||_c.test(String.fromCodePoint(S)));(Ox[L]||F||k.imageName||C!==n.length()-2&&jx[n.getCharCode(C+1)])&&p.push(Fm(C+1,b,m,p,Nx(L,n.getCharCode(C+1),F&&y),!1))}}var S;return Bm(Fm(n.length(),b,m,p,0,!0))}function sp(n){let t=.5,r=.5;switch(n){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(n){case"bottom":case"bottom-right":case"bottom-left":r=1;break;case"top":case"top-right":case"top-left":r=0}return{horizontalAlign:t,verticalAlign:r}}function Vx(n,t,r){const a=t.getMaxScale()*Mi,{maxImageWidth:c,maxImageHeight:d}=t.getMaxImageSize(n),p=Math.max(a,d*r);return{verticalLineContentWidth:Math.max(a,c*r),horizontalLineContentHeight:p}}function Om(n){switch(n){case"top":return 0;case"center":return .5;default:return 1}}function Zx(n,t,r){return!(n===P.an.horizontal||!t&&!nl(r)||t&&(xh[r]||(a=r,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(a)))));var a}function Ux(n,t,r,a,c,d){const p=d[n.fontStack],m=function(b,S,C,k){if(b&&b.rect)return b;const L=S[C.fontStack],F=L&&L[k];return F?{rect:null,metrics:F.metrics}:null}(p&&p[t],c,n,t);if(m===null)return null;let y;if(r)y=a.verticalLineContentWidth-n.scale*Mi;else{const b=Om(n.verticalAlign);y=(a.horizontalLineContentHeight-n.scale*Mi)*b}return{rect:m.rect,metrics:m.metrics,baselineOffset:y}}function $x(n,t,r,a,c){const d=c[n.imageName];if(!d)return null;const p=d.paddedRect,m=d.displaySize,y={width:m[0],height:m[1],left:1,top:-3,advance:t?m[1]:m[0]};let b;if(t)b=a.verticalLineContentWidth-m[1]*n.scale;else{const S=Om(n.verticalAlign);b=(a.horizontalLineContentHeight-m[1]*n.scale)*S}return{rect:p,metrics:y,baselineOffset:b,imageOffset:(t?m[0]:m[1])*n.scale-Mi*r}}function Gx(n,t,r,a){if(a===0)return;const c=n[r],d=(n[r].x+c.metrics.advance*c.scale)*a;for(let p=t;p<=r;p++)n[p].x-=d}function qx(n,t,r){const{horizontalAlign:a,verticalAlign:c}=sp(r),d=t[0]-n.displaySize[0]*a,p=t[1]-n.displaySize[1]*c;return{image:n,top:p,bottom:p+n.displaySize[1],left:d,right:d+n.displaySize[0]}}function jm(n){var t,r;let a=n.left,c=n.top,d=n.right-a,p=n.bottom-c;const m=(t=n.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",y=(r=n.image.textFitHeight)!==null&&r!==void 0?r:"stretchOrShrink",b=(n.image.content[2]-n.image.content[0])/(n.image.content[3]-n.image.content[1]);if(y==="proportional"){if(m==="stretchOnly"&&d/p<b||m==="proportional"){const S=Math.ceil(p*b);a*=S/d,d=S}}else if(m==="proportional"&&y==="stretchOnly"&&b!==0&&d/p>b){const S=Math.ceil(d/b);c*=S/p,p=S}return{x1:a,y1:c,x2:a+d,y2:c+p}}function Nm(n,t,r,a,c,d){const p=n.image;let m;if(p.content){const U=p.content,H=p.pixelRatio||1;m=[U[0]/H,U[1]/H,p.displaySize[0]-U[2]/H,p.displaySize[1]-U[3]/H]}const y=t.left*d,b=t.right*d;let S,C,k,L;r==="width"||r==="both"?(L=c[0]+y-a[3],C=c[0]+b+a[1]):(L=c[0]+(y+b-p.displaySize[0])/2,C=L+p.displaySize[0]);const F=t.top*d,j=t.bottom*d;return r==="height"||r==="both"?(S=c[1]+F-a[0],k=c[1]+j+a[2]):(S=c[1]+(F+j-p.displaySize[1])/2,k=S+p.displaySize[1]),{image:p,top:S,right:C,bottom:k,left:L,collisionPadding:m}}const ya=128,cs=32640;function Vm(n,t){const{expression:r}=t;if(r.kind==="constant")return{kind:"constant",layoutSize:r.evaluate(new Wt(n+1))};if(r.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:c}=r;let d=0;for(;d<a.length&&a[d]<=n;)d++;d=Math.max(0,d-1);let p=d;for(;p<a.length&&a[p]<n+1;)p++;p=Math.min(a.length-1,p);const m=a[d],y=a[p];return r.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:y,interpolationType:c}:{kind:"camera",minZoom:m,maxZoom:y,minSize:r.evaluate(new Wt(m)),maxSize:r.evaluate(new Wt(y)),interpolationType:c}}}function op(n,t,r){let a="never";const c=n.get(t);return c?a=c:n.get(r)&&(a="always"),a}const Wx=Bc.VectorTileFeature.types,Hx=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function vh(n,t,r,a,c,d,p,m,y,b,S,C,k){const L=m?Math.min(cs,Math.round(m[0])):0,F=m?Math.min(cs,Math.round(m[1])):0;n.emplaceBack(t,r,Math.round(32*a),Math.round(32*c),d,p,(L<<1)+(y?1:0),F,16*b,16*S,256*C,256*k)}function lp(n,t,r){n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r),n.emplaceBack(t.x,t.y,r)}function Xx(n){for(const t of n.sections)if(xc(t.text))return!0;return!1}class cp{constructor(t){this.layoutVertexArray=new ot,this.indexArray=new Nt,this.programConfigurations=t,this.segments=new Tt,this.dynamicLayoutVertexArray=new Ct,this.opacityVertexArray=new Jt,this.hasVisibleVertices=!1,this.placedSymbolArray=new W}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,r,a,c){this.isEmpty()||(a&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ex.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,r),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Ax.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,Hx,!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())}}Ze("SymbolBuffers",cp);class up{constructor(t,r,a){this.layoutVertexArray=new t,this.layoutAttributes=r,this.indexArray=new a,this.segments=new Tt,this.collisionVertexArray=new Qt}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,zx.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ze("CollisionBuffers",up);class ml{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.globalState=t.globalState,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 r=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Vm(this.zoom,r["text-size"]),this.iconSizeData=Vm(this.zoom,r["icon-size"]);const a=this.layers[0].layout,c=a.get("symbol-sort-key"),d=a.get("symbol-z-order");this.canOverlap=op(a,"text-overlap","text-allow-overlap")!=="never"||op(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=>P.an[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=t.sourceID}createArrays(){this.text=new cp(new Hn(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new cp(new Hn(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new Y,this.lineVertexArray=new ie,this.symbolInstances=new ee,this.textAnchorOffsets=new K}calculateGlyphDependencies(t,r,a,c,d){for(let p=0;p<t.length;p++)if(r[t.charCodeAt(p)]=!0,(a||c)&&d){const m=Nc[t.charAt(p)];m&&(r[m.charCodeAt(0)]=!0)}}populate(t,r,a){const c=this.layers[0],d=c.layout,p=d.get("text-font"),m=d.get("text-field"),y=d.get("icon-image"),b=(m.value.kind!=="constant"||m.value.value instanceof Vi&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),S=y.value.kind!=="constant"||!!y.value.value||Object.keys(y.parameters).length>0,C=d.get("symbol-sort-key");if(this.features=[],!b&&!S)return;const k=r.iconDependencies,L=r.glyphDependencies,F=r.availableImages,j=new Wt(this.zoom,{globalState:this.globalState});for(const{feature:U,id:H,index:se,sourceLayerIndex:J}of t){const D=c._featureFilter.needGeometry,Z=io(U,D);if(!c._featureFilter.filter(j,Z,a))continue;let te,me;if(D||(Z.geometry=to(U)),b){const ve=c.getValueAndResolveTokens("text-field",Z,a,F),Te=Vi.factory(ve),ze=this.hasRTLText=this.hasRTLText||Xx(Te);(!ze||Vn.getRTLTextPluginStatus()==="unavailable"||ze&&Vn.isParsed())&&(te=Rx(Te,c,Z))}if(S){const ve=c.getValueAndResolveTokens("icon-image",Z,a,F);me=ve instanceof nr?ve:nr.fromString(ve)}if(!te&&!me)continue;const Ce=this.sortFeaturesByKey?C.evaluate(Z,{},a):void 0;if(this.features.push({id:H,text:te,icon:me,index:se,sourceLayerIndex:J,geometry:Z.geometry,properties:U.properties,type:Wx[U.type],sortKey:Ce}),me&&(k[me.name]=!0),te){const ve=p.evaluate(Z,{},a).join(","),Te=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(P.an.vertical)>=0;for(const ze of te.sections)if(ze.image)k[ze.image.name]=!0;else{const Ee=gc(te.toString()),ke=ze.fontStack||ve,Pe=L[ke]=L[ke]||{};this.calculateGlyphDependencies(ze.text,Pe,Te,this.allowVerticalPlacement,Ee)}}}d.get("symbol-placement")==="line"&&(this.features=function(U){const H={},se={},J=[];let D=0;function Z(ve){J.push(U[ve]),D++}function te(ve,Te,ze){const Ee=se[ve];return delete se[ve],se[Te]=Ee,J[Ee].geometry[0].pop(),J[Ee].geometry[0]=J[Ee].geometry[0].concat(ze[0]),Ee}function me(ve,Te,ze){const Ee=H[Te];return delete H[Te],H[ve]=Ee,J[Ee].geometry[0].shift(),J[Ee].geometry[0]=ze[0].concat(J[Ee].geometry[0]),Ee}function Ce(ve,Te,ze){const Ee=ze?Te[0][Te[0].length-1]:Te[0][0];return`${ve}:${Ee.x}:${Ee.y}`}for(let ve=0;ve<U.length;ve++){const Te=U[ve],ze=Te.geometry,Ee=Te.text?Te.text.toString():null;if(!Ee){Z(ve);continue}const ke=Ce(Ee,ze),Pe=Ce(Ee,ze,!0);if(ke in se&&Pe in H&&se[ke]!==H[Pe]){const Ge=me(ke,Pe,ze),Je=te(ke,Pe,J[Ge].geometry);delete H[ke],delete se[Pe],se[Ce(Ee,J[Je].geometry,!0)]=Je,J[Ge].geometry=null}else ke in se?te(ke,Pe,ze):Pe in H?me(ke,Pe,ze):(Z(ve),H[ke]=D-1,se[Pe]=D-1)}return J.filter(ve=>ve.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort((U,H)=>U.sortKey-H.sortKey)}update(t,r,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,r,this.layers,a),this.icon.programConfigurations.updatePaintArrays(t,r,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,r){const a=this.lineVertexArray.length;if(t.segment!==void 0){let c=t.dist(r[t.segment+1]),d=t.dist(r[t.segment]);const p={};for(let m=t.segment+1;m<r.length;m++)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:c},m<r.length-1&&(c+=r[m+1].dist(r[m]));for(let m=t.segment||0;m>=0;m--)p[m]={x:r[m].x,y:r[m].y,tileUnitDistanceFromAnchor:d},m>0&&(d+=r[m-1].dist(r[m]));for(let m=0;m<r.length;m++){const y=p[m];this.lineVertexArray.emplaceBack(y.x,y.y,y.tileUnitDistanceFromAnchor)}}return{lineStartIndex:a,lineLength:this.lineVertexArray.length-a}}addSymbols(t,r,a,c,d,p,m,y,b,S,C,k){const L=t.indexArray,F=t.layoutVertexArray,j=t.segments.prepareSegment(4*r.length,F,L,this.canOverlap?p.sortKey:void 0),U=this.glyphOffsetArray.length,H=j.vertexLength,se=this.allowVerticalPlacement&&m===P.an.vertical?Math.PI/2:0,J=p.text&&p.text.sections;for(let D=0;D<r.length;D++){const{tl:Z,tr:te,bl:me,br:Ce,tex:ve,pixelOffsetTL:Te,pixelOffsetBR:ze,minFontScaleX:Ee,minFontScaleY:ke,glyphOffset:Pe,isSDF:Ge,sectionIndex:Je}=r[D],Ke=j.vertexLength,He=Pe[1];vh(F,y.x,y.y,Z.x,He+Z.y,ve.x,ve.y,a,Ge,Te.x,Te.y,Ee,ke),vh(F,y.x,y.y,te.x,He+te.y,ve.x+ve.w,ve.y,a,Ge,ze.x,Te.y,Ee,ke),vh(F,y.x,y.y,me.x,He+me.y,ve.x,ve.y+ve.h,a,Ge,Te.x,ze.y,Ee,ke),vh(F,y.x,y.y,Ce.x,He+Ce.y,ve.x+ve.w,ve.y+ve.h,a,Ge,ze.x,ze.y,Ee,ke),lp(t.dynamicLayoutVertexArray,y,se),L.emplaceBack(Ke,Ke+2,Ke+1),L.emplaceBack(Ke+1,Ke+2,Ke+3),j.vertexLength+=4,j.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Pe[0]),D!==r.length-1&&Je===r[D+1].sectionIndex||t.programConfigurations.populatePaintArrays(F.length,p,p.index,{},k,J&&J[Je])}t.placedSymbolArray.emplaceBack(y.x,y.y,U,this.glyphOffsetArray.length-U,H,b,S,y.segment,a?a[0]:0,a?a[1]:0,c[0],c[1],m,0,!1,0,C)}_addCollisionDebugVertex(t,r,a,c,d,p){return r.emplaceBack(0,0),t.emplaceBack(a.x,a.y,c,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(t,r,a,c,d,p,m){const y=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),b=y.vertexLength,S=d.layoutVertexArray,C=d.collisionVertexArray,k=m.anchorX,L=m.anchorY;this._addCollisionDebugVertex(S,C,p,k,L,new Be(t,r)),this._addCollisionDebugVertex(S,C,p,k,L,new Be(a,r)),this._addCollisionDebugVertex(S,C,p,k,L,new Be(a,c)),this._addCollisionDebugVertex(S,C,p,k,L,new Be(t,c)),y.vertexLength+=4;const F=d.indexArray;F.emplaceBack(b,b+1),F.emplaceBack(b+1,b+2),F.emplaceBack(b+2,b+3),F.emplaceBack(b+3,b),y.primitiveLength+=4}addDebugCollisionBoxes(t,r,a,c){for(let d=t;d<r;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 up(Bt,Im.members,Ot),this.iconCollisionBox=new up(Bt,Im.members,Ot);for(let t=0;t<this.symbolInstances.length;t++){const r=this.symbolInstances.get(t);this.addDebugCollisionBoxes(r.textBoxStartIndex,r.textBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.verticalTextBoxStartIndex,r.verticalTextBoxEndIndex,r,!0),this.addDebugCollisionBoxes(r.iconBoxStartIndex,r.iconBoxEndIndex,r,!1),this.addDebugCollisionBoxes(r.verticalIconBoxStartIndex,r.verticalIconBoxEndIndex,r,!1)}}_deserializeCollisionBoxesForSymbol(t,r,a,c,d,p,m,y,b){const S={};for(let C=r;C<a;C++){const k=t.get(C);S.textBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},S.textFeatureIndex=k.featureIndex;break}for(let C=c;C<d;C++){const k=t.get(C);S.verticalTextBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},S.verticalTextFeatureIndex=k.featureIndex;break}for(let C=p;C<m;C++){const k=t.get(C);S.iconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},S.iconFeatureIndex=k.featureIndex;break}for(let C=y;C<b;C++){const k=t.get(C);S.verticalIconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},S.verticalIconFeatureIndex=k.featureIndex;break}return S}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let r=0;r<this.symbolInstances.length;r++){const a=this.symbolInstances.get(r);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,r){const a=t.placedSymbolArray.get(r),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 r=Math.sin(t),a=Math.cos(t),c=[],d=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const y=this.symbolInstances.get(m);c.push(0|Math.round(r*y.anchorX+a*y.anchorY)),d.push(y.featureIndex)}return p.sort((m,y)=>c[m]-c[y]||d[y]-d[m]),p}addToSortKeyRanges(t,r){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===r?a.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:r,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 r of this.symbolInstanceIndexes){const a=this.symbolInstances.get(r);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 Zm,Um;Ze("SymbolBucket",ml,{omit:["layers","collisionBoxArray","features","compareText"]}),ml.MAX_GLYPHS=65535,ml.addDynamicAttributes=lp;var hp={get paint(){return Um=Um||new Ji({"icon-opacity":new et(ne.paint_symbol["icon-opacity"]),"icon-color":new et(ne.paint_symbol["icon-color"]),"icon-halo-color":new et(ne.paint_symbol["icon-halo-color"]),"icon-halo-width":new et(ne.paint_symbol["icon-halo-width"]),"icon-halo-blur":new et(ne.paint_symbol["icon-halo-blur"]),"icon-translate":new qe(ne.paint_symbol["icon-translate"]),"icon-translate-anchor":new qe(ne.paint_symbol["icon-translate-anchor"]),"text-opacity":new et(ne.paint_symbol["text-opacity"]),"text-color":new et(ne.paint_symbol["text-color"],{runtimeType:gr,getOverride:n=>n.textColor,hasOverride:n=>!!n.textColor}),"text-halo-color":new et(ne.paint_symbol["text-halo-color"]),"text-halo-width":new et(ne.paint_symbol["text-halo-width"]),"text-halo-blur":new et(ne.paint_symbol["text-halo-blur"]),"text-translate":new qe(ne.paint_symbol["text-translate"]),"text-translate-anchor":new qe(ne.paint_symbol["text-translate-anchor"])})},get layout(){return Zm=Zm||new Ji({"symbol-placement":new qe(ne.layout_symbol["symbol-placement"]),"symbol-spacing":new qe(ne.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new qe(ne.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new et(ne.layout_symbol["symbol-sort-key"]),"symbol-z-order":new qe(ne.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new qe(ne.layout_symbol["icon-allow-overlap"]),"icon-overlap":new qe(ne.layout_symbol["icon-overlap"]),"icon-ignore-placement":new qe(ne.layout_symbol["icon-ignore-placement"]),"icon-optional":new qe(ne.layout_symbol["icon-optional"]),"icon-rotation-alignment":new qe(ne.layout_symbol["icon-rotation-alignment"]),"icon-size":new et(ne.layout_symbol["icon-size"]),"icon-text-fit":new qe(ne.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new qe(ne.layout_symbol["icon-text-fit-padding"]),"icon-image":new et(ne.layout_symbol["icon-image"]),"icon-rotate":new et(ne.layout_symbol["icon-rotate"]),"icon-padding":new et(ne.layout_symbol["icon-padding"]),"icon-keep-upright":new qe(ne.layout_symbol["icon-keep-upright"]),"icon-offset":new et(ne.layout_symbol["icon-offset"]),"icon-anchor":new et(ne.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new qe(ne.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new qe(ne.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new qe(ne.layout_symbol["text-rotation-alignment"]),"text-field":new et(ne.layout_symbol["text-field"]),"text-font":new et(ne.layout_symbol["text-font"]),"text-size":new et(ne.layout_symbol["text-size"]),"text-max-width":new et(ne.layout_symbol["text-max-width"]),"text-line-height":new qe(ne.layout_symbol["text-line-height"]),"text-letter-spacing":new et(ne.layout_symbol["text-letter-spacing"]),"text-justify":new et(ne.layout_symbol["text-justify"]),"text-radial-offset":new et(ne.layout_symbol["text-radial-offset"]),"text-variable-anchor":new qe(ne.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new et(ne.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new et(ne.layout_symbol["text-anchor"]),"text-max-angle":new qe(ne.layout_symbol["text-max-angle"]),"text-writing-mode":new qe(ne.layout_symbol["text-writing-mode"]),"text-rotate":new et(ne.layout_symbol["text-rotate"]),"text-padding":new qe(ne.layout_symbol["text-padding"]),"text-keep-upright":new qe(ne.layout_symbol["text-keep-upright"]),"text-transform":new et(ne.layout_symbol["text-transform"]),"text-offset":new et(ne.layout_symbol["text-offset"]),"text-allow-overlap":new qe(ne.layout_symbol["text-allow-overlap"]),"text-overlap":new qe(ne.layout_symbol["text-overlap"]),"text-ignore-placement":new qe(ne.layout_symbol["text-ignore-placement"]),"text-optional":new qe(ne.layout_symbol["text-optional"])})}};class $m{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:na,this.defaultValue=t}evaluate(t){if(t.formattedSection){const r=this.defaultValue.property.overrides;if(r&&r.hasOverride(t.formattedSection))return r.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}}Ze("FormatSectionOverride",$m,{omit:["defaultValue"]});class bh extends Di{constructor(t){super(t,hp)}recalculate(t,r){if(super.recalculate(t,r),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,r,a,c){const d=this.layout.get(t).evaluate(r,{},a,c),p=this._unevaluatedLayout._values[t];return p.isDataDriven()||qo(p.value)||!d?d:function(m,y){return y.replace(/{([^{}]+)}/g,(b,S)=>m&&S in m?String(m[S]):"")}(r.properties,d)}createBucket(t){return new ml(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of hp.paint.overridableProperties){if(!bh.hasPaintOverride(this.layout,t))continue;const r=this.paint.get(t),a=new $m(r),c=new Go(a,r.property.specification);let d=null;d=r.value.kind==="constant"||r.value.kind==="source"?new Os("source",c):new Ho("composite",c,r.value.zoomStops),this.paint._values[t]=new ln(r.property,d,r.parameters)}}_handleOverridablePaintPropertyUpdate(t,r,a){return!(!this.layout||r.isDataDriven()||a.isDataDriven())&&bh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,r){const a=t.get("text-field"),c=hp.paint.properties[r];let d=!1;const p=m=>{for(const y of m)if(c.overrides&&c.overrides.hasOverride(y))return void(d=!0)};if(a.value.kind==="constant"&&a.value.value instanceof Vi)p(a.value.value.sections);else if(a.value.kind==="source"){const m=b=>{d||(b instanceof Xi&&it(b.value)===aa?p(b.value.sections):b instanceof zs?p(b.sections):b.eachChild(m))},y=a.value;y._styleExpression&&m(y._styleExpression.expression)}return d}}let Gm;var Yx={get paint(){return Gm=Gm||new Ji({"background-color":new qe(ne.paint_background["background-color"]),"background-pattern":new bc(ne.paint_background["background-pattern"]),"background-opacity":new qe(ne.paint_background["background-opacity"])})}};class Kx extends Di{constructor(t){super(t,Yx)}}let qm;var Jx={get paint(){return qm=qm||new Ji({"raster-opacity":new qe(ne.paint_raster["raster-opacity"]),"raster-hue-rotate":new qe(ne.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new qe(ne.paint_raster["raster-brightness-min"]),"raster-brightness-max":new qe(ne.paint_raster["raster-brightness-max"]),"raster-saturation":new qe(ne.paint_raster["raster-saturation"]),"raster-contrast":new qe(ne.paint_raster["raster-contrast"]),"raster-resampling":new qe(ne.paint_raster["raster-resampling"]),"raster-fade-duration":new qe(ne.paint_raster["raster-fade-duration"])})}};class Qx extends Di{constructor(t){super(t,Jx)}}class ev extends Di{constructor(t){super(t,{}),this.onAdd=r=>{this.implementation.onAdd&&this.implementation.onAdd(r,r.painter.context.gl)},this.onRemove=r=>{this.implementation.onRemove&&this.implementation.onRemove(r,r.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 tv{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 iv={once:!0},dp=63710088e-1;class us{constructor(t,r){if(isNaN(t)||isNaN(r))throw new Error(`Invalid LngLat object: (${t}, ${r})`);if(this.lng=+t,this.lat=+r,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new us(Dn(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const r=Math.PI/180,a=this.lat*r,c=t.lat*r,d=Math.sin(a)*Math.sin(c)+Math.cos(a)*Math.cos(c)*Math.cos((t.lng-this.lng)*r);return dp*Math.acos(Math.min(d,1))}static convert(t){if(t instanceof us)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new us(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new us(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 Wm=2*Math.PI*dp;function Hm(n){return Wm*Math.cos(n*Math.PI/180)}function Xm(n){return(180+n)/360}function Ym(n){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+n*Math.PI/360)))/360}function Km(n,t){return n/Hm(t)}function pp(n){return 360/Math.PI*Math.atan(Math.exp((180-360*n)*Math.PI/180))-90}function Jm(n,t){return n*Hm(pp(t))}class Zc{constructor(t,r,a=0){this.x=+t,this.y=+r,this.z=+a}static fromLngLat(t,r=0){const a=us.convert(t);return new Zc(Xm(a.lng),Ym(a.lat),Km(r,a.lat))}toLngLat(){return new us(360*this.x-180,pp(this.y))}toAltitude(){return Jm(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/Wm*(t=pp(this.y),1/Math.cos(t*Math.PI/180));var t}}function Qm(n,t,r){var a=2*Math.PI*6378137/256/Math.pow(2,r);return[n*a-2*Math.PI*6378137/2,t*a-2*Math.PI*6378137/2]}class fp{constructor(t,r,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,r,a))throw new Error(`x=${r}, 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=r,this.y=a,this.key=gl(0,t,t,r,a)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,r,a){const c=(p=this.y,m=this.z,y=Qm(256*(d=this.x),256*(p=Math.pow(2,m)-p-1),m),b=Qm(256*(d+1),256*(p+1),m),y[0]+","+y[1]+","+b[0]+","+b[1]);var d,p,m,y,b;const S=function(C,k,L){let F,j="";for(let U=C;U>0;U--)F=1<<U-1,j+=(k&F?1:0)+(L&F?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,r>1?"@2x":"").replace(/{quadkey}/g,S).replace(/{bbox-epsg-3857}/g,c)}isChildOf(t){const r=this.z-t.z;return r>0&&t.x===this.x>>r&&t.y===this.y>>r}getTilePoint(t){const r=Math.pow(2,this.z);return new Be((t.x*r-this.x)*At,(t.y*r-this.y)*At)}toString(){return`${this.z}/${this.x}/${this.y}`}}class eg{constructor(t,r){this.wrap=t,this.canonical=r,this.key=gl(t,r.z,r.z,r.x,r.y)}}class Ur{constructor(t,r,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=r,this.canonical=new fp(a,+c,+d),this.key=gl(r,t,a,c,d)}clone(){return new Ur(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 r=this.canonical.z-t;return t>this.canonical.z?new Ur(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new Ur(t,this.wrap,t,this.canonical.x>>r,this.canonical.y>>r)}calculateScaledKey(t,r){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?gl(this.wrap*+r,t,this.canonical.z,this.canonical.x,this.canonical.y):gl(this.wrap*+r,t,t,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const r=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>r&&t.canonical.y===this.canonical.y>>r}children(t){if(this.overscaledZ>=t)return[new Ur(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const r=this.canonical.z+1,a=2*this.canonical.x,c=2*this.canonical.y;return[new Ur(r,this.wrap,r,a,c),new Ur(r,this.wrap,r,a+1,c),new Ur(r,this.wrap,r,a,c+1),new Ur(r,this.wrap,r,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 Ur(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new Ur(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 eg(this.wrap,this.canonical)}toString(){return`${this.overscaledZ}/${this.canonical.x}/${this.canonical.y}`}getTilePoint(t){return this.canonical.getTilePoint(new Zc(t.x-this.wrap,t.y))}}function gl(n,t,r,a,c){(n*=2)<0&&(n=-1*n-1);const d=1<<r;return(d*d*n+d*c+a).toString(36)+r.toString(36)+t.toString(36)}Ze("CanonicalTileID",fp),Ze("OverscaledTileID",Ur,{omit:["terrainRttPosMatrix32f"]});class ao{constructor(){this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0}extend(t){return this.minX=Math.min(this.minX,t.x),this.minY=Math.min(this.minY,t.y),this.maxX=Math.max(this.maxX,t.x),this.maxY=Math.max(this.maxY,t.y),this}expandBy(t){return this.minX-=t,this.minY-=t,this.maxX+=t,this.maxY+=t,(this.minX>this.maxX||this.minY>this.maxY)&&(this.minX=1/0,this.maxX=-1/0,this.minY=1/0,this.maxY=-1/0),this}shrinkBy(t){return this.expandBy(-t)}map(t){const r=new ao;return r.extend(t(new Be(this.minX,this.minY))),r.extend(t(new Be(this.maxX,this.minY))),r.extend(t(new Be(this.minX,this.maxY))),r.extend(t(new Be(this.maxX,this.maxY))),r}static fromPoints(t){const r=new ao;for(const a of t)r.extend(a);return r}contains(t){return t.x>=this.minX&&t.x<=this.maxX&&t.y>=this.minY&&t.y<=this.maxY}empty(){return this.minX>this.maxX}width(){return this.maxX-this.minX}height(){return this.maxY-this.minY}covers(t){return!this.empty()&&!t.empty()&&t.minX>=this.minX&&t.maxX<=this.maxX&&t.minY>=this.minY&&t.maxY<=this.maxY}intersects(t){return!this.empty()&&!t.empty()&&t.minX<=this.maxX&&t.maxX>=this.minX&&t.minY<=this.maxY&&t.maxY>=this.minY}}class tg{constructor(t){this._stringToNumber={},this._numberToString=[];for(let r=0;r<t.length;r++){const a=t[r];this._stringToNumber[a]=r,this._numberToString[r]=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 ig{constructor(t,r,a,c,d){this.type="Feature",this._vectorTileFeature=t,t._z=r,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 r in this)r!=="_geometry"&&r!=="_vectorTileFeature"&&(t[r]=this[r]);return t}}class rg{constructor(t,r){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new ns(At,16,0),this.grid3D=new ns(At,16,0),this.featureIndexArray=new _e,this.promoteId=r}insert(t,r,a,c,d,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,c,d);const y=p?this.grid3D:this.grid;for(let b=0;b<r.length;b++){const S=r[b],C=[1/0,1/0,-1/0,-1/0];for(let k=0;k<S.length;k++){const L=S[k];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]<At&&C[1]<At&&C[2]>=0&&C[3]>=0&&y.insert(m,C[0],C[1],C[2],C[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Bc.VectorTile(new rp(this.rawTileData)).layers,this.sourceLayerCoder=new tg(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,r,a,c){this.loadVTLayers();const d=t.params,p=At/t.tileSize/t.scale,m=jn(d.filter),y=t.queryGeometry,b=t.queryPadding*p,S=ao.fromPoints(y),C=this.grid.query(S.minX-b,S.minY-b,S.maxX+b,S.maxY+b),k=ao.fromPoints(t.cameraQueryGeometry).expandBy(b),L=this.grid3D.query(k.minX,k.minY,k.maxX,k.maxY,(U,H,se,J)=>function(D,Z,te,me,Ce){for(const Te of D)if(Z<=Te.x&&te<=Te.y&&me>=Te.x&&Ce>=Te.y)return!0;const ve=[new Be(Z,te),new Be(Z,Ce),new Be(me,Ce),new Be(me,te)];if(D.length>2){for(const Te of ve)if(ul(D,Te))return!0}for(let Te=0;Te<D.length-1;Te++)if(Uy(D[Te],D[Te+1],ve))return!0;return!1}(t.cameraQueryGeometry,U-b,H-b,se+b,J+b));for(const U of L)C.push(U);C.sort(rv);const F={};let j;for(let U=0;U<C.length;U++){const H=C[U];if(H===j)continue;j=H;const se=this.featureIndexArray.get(H);let J=null;this.loadMatchingFeature(F,se.bucketIndex,se.sourceLayerIndex,se.featureIndex,m,d.layers,d.availableImages,r,a,c,(D,Z,te)=>(J||(J=to(D)),Z.queryIntersectsFeature({queryGeometry:y,feature:D,featureState:te,geometry:J,zoom:this.z,transform:t.transform,pixelsToTileUnits:p,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return F}loadMatchingFeature(t,r,a,c,d,p,m,y,b,S,C){const k=this.bucketLayerIDs[r];if(p&&!k.some(U=>p.has(U)))return;const L=this.sourceLayerCoder.decode(a),F=this.vtLayers[L].feature(c);if(d.needGeometry){const U=io(F,!0);if(!d.filter(new Wt(this.tileID.overscaledZ),U,this.tileID.canonical))return}else if(!d.filter(new Wt(this.tileID.overscaledZ),F))return;const j=this.getId(F,L);for(let U=0;U<k.length;U++){const H=k[U];if(p&&!p.has(H))continue;const se=y[H];if(!se)continue;let J={};j&&S&&(J=S.getState(se.sourceLayer||"_geojsonTileLayer",j));const D=Hi({},b[H]);D.paint=ng(D.paint,se.paint,F,J,m),D.layout=ng(D.layout,se.layout,F,J,m);const Z=!C||C(F,se,J);if(!Z)continue;const te=new ig(F,this.z,this.x,this.y,j);te.layer=D;let me=t[H];me===void 0&&(me=t[H]=[]),me.push({featureIndex:c,feature:te,intersectionZ:Z})}}lookupSymbolFeatures(t,r,a,c,d,p,m,y){const b={};this.loadVTLayers();const S=jn(d);for(const C of t)this.loadMatchingFeature(b,a,c,C,S,p,m,y,r);return b}hasLayer(t){for(const r of this.bucketLayerIDs)for(const a of r)if(t===a)return!0;return!1}getId(t,r){var a;let c=t.id;return this.promoteId&&(c=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[r]],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 ng(n,t,r,a,c){return ii(n,(d,p)=>{const m=t instanceof sl?t.get(p):null;return m&&m.evaluate?m.evaluate(r,a,c):m})}function rv(n,t){return t-n}function ag(n,t,r,a,c){const d=[];for(let p=0;p<n.length;p++){const m=n[p];let y;for(let b=0;b<m.length-1;b++){let S=m[b],C=m[b+1];S.x<t&&C.x<t||(S.x<t?S=new Be(t,S.y+(t-S.x)/(C.x-S.x)*(C.y-S.y))._round():C.x<t&&(C=new Be(t,S.y+(t-S.x)/(C.x-S.x)*(C.y-S.y))._round()),S.y<r&&C.y<r||(S.y<r?S=new Be(S.x+(r-S.y)/(C.y-S.y)*(C.x-S.x),r)._round():C.y<r&&(C=new Be(S.x+(r-S.y)/(C.y-S.y)*(C.x-S.x),r)._round()),S.x>=a&&C.x>=a||(S.x>=a?S=new Be(a,S.y+(a-S.x)/(C.x-S.x)*(C.y-S.y))._round():C.x>=a&&(C=new Be(a,S.y+(a-S.x)/(C.x-S.x)*(C.y-S.y))._round()),S.y>=c&&C.y>=c||(S.y>=c?S=new Be(S.x+(c-S.y)/(C.y-S.y)*(C.x-S.x),c)._round():C.y>=c&&(C=new Be(S.x+(c-S.y)/(C.y-S.y)*(C.x-S.x),c)._round()),y&&S.equals(y[y.length-1])||(y=[S],d.push(y)),y.push(C)))))}}return d}Ze("FeatureIndex",rg,{omit:["rawTileData","sourceLayerCoder"]});class hs extends Be{constructor(t,r,a,c){super(t,r),this.angle=a,c!==void 0&&(this.segment=c)}clone(){return new hs(this.x,this.y,this.angle,this.segment)}}function sg(n,t,r,a,c){if(t.segment===void 0||r===0)return!0;let d=t,p=t.segment+1,m=0;for(;m>-r/2;){if(p--,p<0)return!1;m-=n[p].dist(d),d=n[p]}m+=n[p].dist(n[p+1]),p++;const y=[];let b=0;for(;m<r/2;){const S=n[p],C=n[p+1];if(!C)return!1;let k=n[p-1].angleTo(S)-S.angleTo(C);for(k=Math.abs((k+3*Math.PI)%(2*Math.PI)-Math.PI),y.push({distance:m,angleDelta:k}),b+=k;m-y[0].distance>a;)b-=y.shift().angleDelta;if(b>c)return!1;p++,m+=S.dist(C)}return!0}function og(n){let t=0;for(let r=0;r<n.length-1;r++)t+=n[r].dist(n[r+1]);return t}function lg(n,t,r){return n?.6*t*r:0}function cg(n,t){return Math.max(n?n.right-n.left:0,t?t.right-t.left:0)}function nv(n,t,r,a,c,d){const p=lg(r,c,d),m=cg(r,a)*d;let y=0;const b=og(n)/2;for(let S=0;S<n.length-1;S++){const C=n[S],k=n[S+1],L=C.dist(k);if(y+L>b){const F=(b-y)/L,j=yr.number(C.x,k.x,F),U=yr.number(C.y,k.y,F),H=new hs(j,U,k.angleTo(C),S);return H._round(),!p||sg(n,H,m,p,t)?H:void 0}y+=L}}function av(n,t,r,a,c,d,p,m,y){const b=lg(a,d,p),S=cg(a,c),C=S*p,k=n[0].x===0||n[0].x===y||n[0].y===0||n[0].y===y;return t-C<t/4&&(t=C+t/4),ug(n,k?t/2*m%t:(S/2+2*d)*p*m%t,t,b,r,C,k,!1,y)}function ug(n,t,r,a,c,d,p,m,y){const b=d/2,S=og(n);let C=0,k=t-r,L=[];for(let F=0;F<n.length-1;F++){const j=n[F],U=n[F+1],H=j.dist(U),se=U.angleTo(j);for(;k+r<C+H;){k+=r;const J=(k-C)/H,D=yr.number(j.x,U.x,J),Z=yr.number(j.y,U.y,J);if(D>=0&&D<y&&Z>=0&&Z<y&&k-b>=0&&k+b<=S){const te=new hs(D,Z,se,F);te._round(),a&&!sg(n,te,d,a,c)||L.push(te)}}C+=H}return m||L.length||p||(L=ug(n,C/2,r,a,c,d,p,!0,y)),L}function hg(n,t,r,a){const c=[],d=n.image,p=d.pixelRatio,m=d.paddedRect.w-2,y=d.paddedRect.h-2;let b={x1:n.left,y1:n.top,x2:n.right,y2:n.bottom};const S=d.stretchX||[[0,m]],C=d.stretchY||[[0,y]],k=(Pe,Ge)=>Pe+Ge[1]-Ge[0],L=S.reduce(k,0),F=C.reduce(k,0),j=m-L,U=y-F;let H=0,se=L,J=0,D=F,Z=0,te=j,me=0,Ce=U;if(d.content&&a){const Pe=d.content,Ge=Pe[2]-Pe[0],Je=Pe[3]-Pe[1];(d.textFitWidth||d.textFitHeight)&&(b=jm(n)),H=wh(S,0,Pe[0]),J=wh(C,0,Pe[1]),se=wh(S,Pe[0],Pe[2]),D=wh(C,Pe[1],Pe[3]),Z=Pe[0]-H,me=Pe[1]-J,te=Ge-se,Ce=Je-D}const ve=b.x1,Te=b.y1,ze=b.x2-ve,Ee=b.y2-Te,ke=(Pe,Ge,Je,Ke)=>{const He=Th(Pe.stretch-H,se,ze,ve),xt=Sh(Pe.fixed-Z,te,Pe.stretch,L),ai=Th(Ge.stretch-J,D,Ee,Te),yi=Sh(Ge.fixed-me,Ce,Ge.stretch,F),$i=Th(Je.stretch-H,se,ze,ve),$r=Sh(Je.fixed-Z,te,Je.stretch,L),vr=Th(Ke.stretch-J,D,Ee,Te),Oi=Sh(Ke.fixed-me,Ce,Ke.stretch,F),ei=new Be(He,ai),Ci=new Be($i,ai),ji=new Be($i,vr),Ni=new Be(He,vr),lr=new Be(xt/p,yi/p),Gr=new Be($r/p,Oi/p),Ii=t*Math.PI/180;if(Ii){const Ei=Math.sin(Ii),Ai=Math.cos(Ii),mi=[Ai,-Ei,Ei,Ai];ei._matMult(mi),Ci._matMult(mi),Ni._matMult(mi),ji._matMult(mi)}const br=Pe.stretch+Pe.fixed,xi=Ge.stretch+Ge.fixed;return{tl:ei,tr:Ci,bl:Ni,br:ji,tex:{x:d.paddedRect.x+1+br,y:d.paddedRect.y+1+xi,w:Je.stretch+Je.fixed-br,h:Ke.stretch+Ke.fixed-xi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:lr,pixelOffsetBR:Gr,minFontScaleX:te/p/ze,minFontScaleY:Ce/p/Ee,isSDF:r}};if(a&&(d.stretchX||d.stretchY)){const Pe=dg(S,j,L),Ge=dg(C,U,F);for(let Je=0;Je<Pe.length-1;Je++){const Ke=Pe[Je],He=Pe[Je+1];for(let xt=0;xt<Ge.length-1;xt++)c.push(ke(Ke,Ge[xt],He,Ge[xt+1]))}}else c.push(ke({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:y+1}));return c}function wh(n,t,r){let a=0;for(const c of n)a+=Math.max(t,Math.min(r,c[1]))-Math.max(t,Math.min(r,c[0]));return a}function dg(n,t,r){const a=[{fixed:-1,stretch:0}];for(const[c,d]of n){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+1,stretch:r}),a}function Th(n,t,r,a){return n/t*r+a}function Sh(n,t,r,a){return n-t*r/a}Ze("Anchor",hs);class Ph{constructor(t,r,a,c,d,p,m,y,b,S){var C;if(this.boxStartIndex=t.length,b){let k=p.top,L=p.bottom;const F=p.collisionPadding;F&&(k-=F[1],L+=F[3]);let j=L-k;j>0&&(j=Math.max(10,j),this.circleDiameter=j)}else{const k=!((C=p.image)===null||C===void 0)&&C.content&&(p.image.textFitWidth||p.image.textFitHeight)?jm(p):{x1:p.left,y1:p.top,x2:p.right,y2:p.bottom};k.y1=k.y1*m-y[0],k.y2=k.y2*m+y[2],k.x1=k.x1*m-y[3],k.x2=k.x2*m+y[1];const L=p.collisionPadding;if(L&&(k.x1-=L[0]*m,k.y1-=L[1]*m,k.x2+=L[2]*m,k.y2+=L[3]*m),S){const F=new Be(k.x1,k.y1),j=new Be(k.x2,k.y1),U=new Be(k.x1,k.y2),H=new Be(k.x2,k.y2),se=S*Math.PI/180;F._rotate(se),j._rotate(se),U._rotate(se),H._rotate(se),k.x1=Math.min(F.x,j.x,U.x,H.x),k.x2=Math.max(F.x,j.x,U.x,H.x),k.y1=Math.min(F.y,j.y,U.y,H.y),k.y2=Math.max(F.y,j.y,U.y,H.y)}t.emplaceBack(r.x,r.y,k.x1,k.y1,k.x2,k.y2,a,c,d)}this.boxEndIndex=t.length}}class sv{constructor(t=[],r=(a,c)=>a<c?-1:a>c?1:0){if(this.data=t,this.length=this.data.length,this.compare=r,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],r=this.data.pop();return--this.length>0&&(this.data[0]=r,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:r,compare:a}=this,c=r[t];for(;t>0;){const d=t-1>>1,p=r[d];if(a(c,p)>=0)break;r[t]=p,t=d}r[t]=c}_down(t){const{data:r,compare:a}=this,c=this.length>>1,d=r[t];for(;t<c;){let p=1+(t<<1);const m=p+1;if(m<this.length&&a(r[m],r[p])<0&&(p=m),a(r[p],d)>=0)break;r[t]=r[p],t=p}r[t]=d}}function ov(n,t=1,r=!1){const a=ao.fromPoints(n[0]),c=Math.min(a.width(),a.height());let d=c/2;const p=new sv([],lv),{minX:m,minY:y,maxX:b,maxY:S}=a;if(c===0)return new Be(m,y);for(let L=m;L<b;L+=c)for(let F=y;F<S;F+=c)p.push(new _l(L+d,F+d,d,n));let C=function(L){let F=0,j=0,U=0;const H=L[0];for(let se=0,J=H.length,D=J-1;se<J;D=se++){const Z=H[se],te=H[D],me=Z.x*te.y-te.x*Z.y;j+=(Z.x+te.x)*me,U+=(Z.y+te.y)*me,F+=3*me}return new _l(j/F,U/F,0,L)}(n),k=p.length;for(;p.length;){const L=p.pop();(L.d>C.d||!C.d)&&(C=L,r&&console.log("found best %d after %d probes",Math.round(1e4*L.d)/1e4,k)),L.max-C.d<=t||(d=L.h/2,p.push(new _l(L.p.x-d,L.p.y-d,d,n)),p.push(new _l(L.p.x+d,L.p.y-d,d,n)),p.push(new _l(L.p.x-d,L.p.y+d,d,n)),p.push(new _l(L.p.x+d,L.p.y+d,d,n)),k+=4)}return r&&(console.log(`num probes: ${k}`),console.log(`best distance: ${C.d}`)),C.p}function lv(n,t){return t.max-n.max}function _l(n,t,r,a){this.p=new Be(n,t),this.h=r,this.d=function(c,d){let p=!1,m=1/0;for(let y=0;y<d.length;y++){const b=d[y];for(let S=0,C=b.length,k=C-1;S<C;k=S++){const L=b[S],F=b[k];L.y>c.y!=F.y>c.y&&c.x<(F.x-L.x)*(c.y-L.y)/(F.y-L.y)+L.x&&(p=!p),m=Math.min(m,Gf(c,L,F))}}return(p?1:-1)*Math.sqrt(m)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var Ui;P.aD=void 0,(Ui=P.aD||(P.aD={}))[Ui.center=1]="center",Ui[Ui.left=2]="left",Ui[Ui.right=3]="right",Ui[Ui.top=4]="top",Ui[Ui.bottom=5]="bottom",Ui[Ui["top-left"]=6]="top-left",Ui[Ui["top-right"]=7]="top-right",Ui[Ui["bottom-left"]=8]="bottom-left",Ui[Ui["bottom-right"]=9]="bottom-right";const mp=Number.POSITIVE_INFINITY;function pg(n,t){return t[1]!==mp?function(r,a,c){let d=0,p=0;switch(a=Math.abs(a),c=Math.abs(c),r){case"top-right":case"top-left":case"top":p=c-7;break;case"bottom-right":case"bottom-left":case"bottom":p=7-c}switch(r){case"top-right":case"bottom-right":case"right":d=-a;break;case"top-left":case"bottom-left":case"left":d=a}return[d,p]}(n,t[0],t[1]):function(r,a){let c=0,d=0;a<0&&(a=0);const p=a/Math.SQRT2;switch(r){case"top-right":case"top-left":d=p-7;break;case"bottom-right":case"bottom-left":d=7-p;break;case"bottom":d=7-a;break;case"top":d=a-7}switch(r){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]}(n,t[0])}function fg(n,t,r){var a;const c=n.layout,d=(a=c.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(t,{},r);if(d){const m=d.values,y=[];for(let b=0;b<m.length;b+=2){const S=y[b]=m[b],C=m[b+1].map(k=>k*Mi);S.startsWith("top")?C[1]-=7:S.startsWith("bottom")&&(C[1]+=7),y[b+1]=C}return new bt(y)}const p=c.get("text-variable-anchor");if(p){let m;m=n._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[c.get("text-radial-offset").evaluate(t,{},r)*Mi,mp]:c.get("text-offset").evaluate(t,{},r).map(b=>b*Mi);const y=[];for(const b of p)y.push(b,pg(b,m));return new bt(y)}return null}function gp(n){switch(n){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function cv(n,t,r,a,c,d,p,m,y,b,S,C){let k=d.textMaxSize.evaluate(t,{});k===void 0&&(k=p);const L=n.layers[0].layout,F=L.get("icon-offset").evaluate(t,{},S),j=gg(r.horizontal),U=p/24,H=n.tilePixelRatio*U,se=n.tilePixelRatio*k/24,J=n.tilePixelRatio*m,D=n.tilePixelRatio*L.get("symbol-spacing"),Z=L.get("text-padding")*n.tilePixelRatio,te=function(Je,Ke,He,xt=1){const ai=Je.get("icon-padding").evaluate(Ke,{},He),yi=ai&&ai.values;return[yi[0]*xt,yi[1]*xt,yi[2]*xt,yi[3]*xt]}(L,t,S,n.tilePixelRatio),me=L.get("text-max-angle")/180*Math.PI,Ce=L.get("text-rotation-alignment")!=="viewport"&&L.get("symbol-placement")!=="point",ve=L.get("icon-rotation-alignment")==="map"&&L.get("symbol-placement")!=="point",Te=L.get("symbol-placement"),ze=D/2,Ee=L.get("icon-text-fit");let ke;a&&Ee!=="none"&&(n.allowVerticalPlacement&&r.vertical&&(ke=Nm(a,r.vertical,Ee,L.get("icon-text-fit-padding"),F,U)),j&&(a=Nm(a,j,Ee,L.get("icon-text-fit-padding"),F,U)));const Pe=S?C.line.getGranularityForZoomLevel(S.z):1,Ge=(Je,Ke)=>{Ke.x<0||Ke.x>=At||Ke.y<0||Ke.y>=At||function(He,xt,ai,yi,$i,$r,vr,Oi,ei,Ci,ji,Ni,lr,Gr,Ii,br,xi,Ei,Ai,mi,$t,Pn,yl,Mn,dv){const xl=He.addToLineVertexArray(xt,ai);let so,vl,bl,wl,vg=0,bg=0,wg=0,Tg=0,Sp=-1,Pp=-1;const xa={};let Sg=or("");if(He.allowVerticalPlacement&&yi.vertical){const er=Oi.layout.get("text-rotate").evaluate($t,{},Mn)+90;bl=new Ph(ei,xt,Ci,ji,Ni,yi.vertical,lr,Gr,Ii,er),vr&&(wl=new Ph(ei,xt,Ci,ji,Ni,vr,xi,Ei,Ii,er))}if($i){const er=Oi.layout.get("icon-rotate").evaluate($t,{}),qr=Oi.layout.get("icon-text-fit")!=="none",oo=hg($i,er,yl,qr),In=vr?hg(vr,er,yl,qr):void 0;vl=new Ph(ei,xt,Ci,ji,Ni,$i,xi,Ei,!1,er),vg=4*oo.length;const lo=He.iconSizeData;let Xn=null;lo.kind==="source"?(Xn=[ya*Oi.layout.get("icon-size").evaluate($t,{})],Xn[0]>cs&&ki(`${He.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)):lo.kind==="composite"&&(Xn=[ya*Pn.compositeIconSizes[0].evaluate($t,{},Mn),ya*Pn.compositeIconSizes[1].evaluate($t,{},Mn)],(Xn[0]>cs||Xn[1]>cs)&&ki(`${He.layerIds[0]}: Value for "icon-size" is >= 255. Reduce your "icon-size".`)),He.addSymbols(He.icon,oo,Xn,mi,Ai,$t,P.an.none,xt,xl.lineStartIndex,xl.lineLength,-1,Mn),Sp=He.icon.placedSymbolArray.length-1,In&&(bg=4*In.length,He.addSymbols(He.icon,In,Xn,mi,Ai,$t,P.an.vertical,xt,xl.lineStartIndex,xl.lineLength,-1,Mn),Pp=He.icon.placedSymbolArray.length-1)}const Pg=Object.keys(yi.horizontal);for(const er of Pg){const qr=yi.horizontal[er];if(!so){Sg=or(qr.text);const In=Oi.layout.get("text-rotate").evaluate($t,{},Mn);so=new Ph(ei,xt,Ci,ji,Ni,qr,lr,Gr,Ii,In)}const oo=qr.positionedLines.length===1;if(wg+=mg(He,xt,qr,$r,Oi,Ii,$t,br,xl,yi.vertical?P.an.horizontal:P.an.horizontalOnly,oo?Pg:[er],xa,Sp,Pn,Mn),oo)break}yi.vertical&&(Tg+=mg(He,xt,yi.vertical,$r,Oi,Ii,$t,br,xl,P.an.vertical,["vertical"],xa,Pp,Pn,Mn));const pv=so?so.boxStartIndex:He.collisionBoxArray.length,fv=so?so.boxEndIndex:He.collisionBoxArray.length,mv=bl?bl.boxStartIndex:He.collisionBoxArray.length,gv=bl?bl.boxEndIndex:He.collisionBoxArray.length,_v=vl?vl.boxStartIndex:He.collisionBoxArray.length,yv=vl?vl.boxEndIndex:He.collisionBoxArray.length,xv=wl?wl.boxStartIndex:He.collisionBoxArray.length,vv=wl?wl.boxEndIndex:He.collisionBoxArray.length;let Cn=-1;const Ch=(er,qr)=>er&&er.circleDiameter?Math.max(er.circleDiameter,qr):qr;Cn=Ch(so,Cn),Cn=Ch(bl,Cn),Cn=Ch(vl,Cn),Cn=Ch(wl,Cn);const Mg=Cn>-1?1:0;Mg&&(Cn*=dv/Mi),He.glyphOffsetArray.length>=ml.MAX_GLYPHS&&ki("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),$t.sortKey!==void 0&&He.addToSortKeyRanges(He.symbolInstances.length,$t.sortKey);const bv=fg(Oi,$t,Mn),[wv,Tv]=function(er,qr){const oo=er.length,In=qr==null?void 0:qr.values;if((In==null?void 0:In.length)>0)for(let lo=0;lo<In.length;lo+=2){const Xn=In[lo+1];er.emplaceBack(P.aD[In[lo]],Xn[0],Xn[1])}return[oo,er.length]}(He.textAnchorOffsets,bv);He.symbolInstances.emplaceBack(xt.x,xt.y,xa.right>=0?xa.right:-1,xa.center>=0?xa.center:-1,xa.left>=0?xa.left:-1,xa.vertical||-1,Sp,Pp,Sg,pv,fv,mv,gv,_v,yv,xv,vv,Ci,wg,Tg,vg,bg,Mg,0,lr,Cn,wv,Tv)}(n,Ke,Je,r,a,c,ke,n.layers[0],n.collisionBoxArray,t.index,t.sourceLayerIndex,n.index,H,[Z,Z,Z,Z],Ce,y,J,te,ve,F,t,d,b,S,p)};if(Te==="line")for(const Je of ag(t.geometry,0,0,At,At)){const Ke=no(Je,Pe),He=av(Ke,D,me,r.vertical||j,a,24,se,n.overscaling,At);for(const xt of He)j&&uv(n,j.text,ze,xt)||Ge(Ke,xt)}else if(Te==="line-center"){for(const Je of t.geometry)if(Je.length>1){const Ke=no(Je,Pe),He=nv(Ke,me,r.vertical||j,a,24,se);He&&Ge(Ke,He)}}else if(t.type==="Polygon")for(const Je of Oo(t.geometry,0)){const Ke=ov(Je,16);Ge(no(Je[0],Pe,!0),new hs(Ke.x,Ke.y,0))}else if(t.type==="LineString")for(const Je of t.geometry){const Ke=no(Je,Pe);Ge(Ke,new hs(Ke[0].x,Ke[0].y,0))}else if(t.type==="Point")for(const Je of t.geometry)for(const Ke of Je)Ge([Ke],new hs(Ke.x,Ke.y,0))}function mg(n,t,r,a,c,d,p,m,y,b,S,C,k,L,F){const j=function(se,J,D,Z,te,me,Ce,ve){const Te=Z.layout.get("text-rotate").evaluate(me,{})*Math.PI/180,ze=[];for(const Ee of J.positionedLines)for(const ke of Ee.positionedGlyphs){if(!ke.rect)continue;const Pe=ke.rect||{};let Ge=4,Je=!0,Ke=1,He=0;const xt=(te||ve)&&ke.vertical,ai=ke.metrics.advance*ke.scale/2;if(ve&&J.verticalizable&&(He=Ee.lineOffset/2-(ke.imageName?-(Mi-ke.metrics.width*ke.scale)/2:(ke.scale-1)*Mi)),ke.imageName){const Ei=Ce[ke.imageName];Je=Ei.sdf,Ke=Ei.pixelRatio,Ge=1/Ke}const yi=te?[ke.x+ai,ke.y]:[0,0];let $i=te?[0,0]:[ke.x+ai+D[0],ke.y+D[1]-He],$r=[0,0];xt&&($r=$i,$i=[0,0]);const vr=ke.metrics.isDoubleResolution?2:1,Oi=(ke.metrics.left-Ge)*ke.scale-ai+$i[0],ei=(-ke.metrics.top-Ge)*ke.scale+$i[1],Ci=Oi+Pe.w/vr*ke.scale/Ke,ji=ei+Pe.h/vr*ke.scale/Ke,Ni=new Be(Oi,ei),lr=new Be(Ci,ei),Gr=new Be(Oi,ji),Ii=new Be(Ci,ji);if(xt){const Ei=new Be(-ai,ai- -17),Ai=-Math.PI/2,mi=12-ai,$t=new Be(22-mi,-(ke.imageName?mi:0)),Pn=new Be(...$r);Ni._rotateAround(Ai,Ei)._add($t)._add(Pn),lr._rotateAround(Ai,Ei)._add($t)._add(Pn),Gr._rotateAround(Ai,Ei)._add($t)._add(Pn),Ii._rotateAround(Ai,Ei)._add($t)._add(Pn)}if(Te){const Ei=Math.sin(Te),Ai=Math.cos(Te),mi=[Ai,-Ei,Ei,Ai];Ni._matMult(mi),lr._matMult(mi),Gr._matMult(mi),Ii._matMult(mi)}const br=new Be(0,0),xi=new Be(0,0);ze.push({tl:Ni,tr:lr,bl:Gr,br:Ii,tex:Pe,writingMode:J.writingMode,glyphOffset:yi,sectionIndex:ke.sectionIndex,isSDF:Je,pixelOffsetTL:br,pixelOffsetBR:xi,minFontScaleX:0,minFontScaleY:0})}return ze}(0,r,m,c,d,p,a,n.allowVerticalPlacement),U=n.textSizeData;let H=null;U.kind==="source"?(H=[ya*c.layout.get("text-size").evaluate(p,{})],H[0]>cs&&ki(`${n.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)):U.kind==="composite"&&(H=[ya*L.compositeTextSizes[0].evaluate(p,{},F),ya*L.compositeTextSizes[1].evaluate(p,{},F)],(H[0]>cs||H[1]>cs)&&ki(`${n.layerIds[0]}: Value for "text-size" is >= 255. Reduce your "text-size".`)),n.addSymbols(n.text,j,H,m,d,p,b,t,y.lineStartIndex,y.lineLength,k,F);for(const se of S)C[se]=n.text.placedSymbolArray.length-1;return 4*j.length}function gg(n){for(const t in n)return n[t];return null}function uv(n,t,r,a){const c=n.compareText;if(t in c){const d=c[t];for(let p=d.length-1;p>=0;p--)if(a.dist(d[p])<r)return!0}else c[t]=[];return c[t].push(a),!1}const _g=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class _p{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[r,a]=new Uint8Array(t,0,2);if(r!==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=_g[15&a];if(!d)throw new Error("Unrecognized array type.");const[p]=new Uint16Array(t,2,1),[m]=new Uint32Array(t,4,1);return new _p(m,p,d,t)}constructor(t,r=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(+r,2),65535),this.ArrayType=a,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const d=_g.indexOf(this.ArrayType),p=2*t*this.ArrayType.BYTES_PER_ELEMENT,m=t*this.IndexArrayType.BYTES_PER_ELEMENT,y=(8-m%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+m+y,2*t),this._pos=2*t,this._finished=!0):(this.data=new ArrayBuffer(8+p+m+y),this.ids=new this.IndexArrayType(this.data,8,t),this.coords=new this.ArrayType(this.data,8+m+y,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]=r,new Uint32Array(this.data,4,1)[0]=t)}add(t,r){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=t,this.coords[this._pos++]=r,a}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return yp(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,r,a,c){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:d,coords:p,nodeSize:m}=this,y=[0,d.length-1,0],b=[];for(;y.length;){const S=y.pop()||0,C=y.pop()||0,k=y.pop()||0;if(C-k<=m){for(let U=k;U<=C;U++){const H=p[2*U],se=p[2*U+1];H>=t&&H<=a&&se>=r&&se<=c&&b.push(d[U])}continue}const L=k+C>>1,F=p[2*L],j=p[2*L+1];F>=t&&F<=a&&j>=r&&j<=c&&b.push(d[L]),(S===0?t<=F:r<=j)&&(y.push(k),y.push(L-1),y.push(1-S)),(S===0?a>=F:c>=j)&&(y.push(L+1),y.push(C),y.push(1-S))}return b}within(t,r,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:c,coords:d,nodeSize:p}=this,m=[0,c.length-1,0],y=[],b=a*a;for(;m.length;){const S=m.pop()||0,C=m.pop()||0,k=m.pop()||0;if(C-k<=p){for(let U=k;U<=C;U++)xg(d[2*U],d[2*U+1],t,r)<=b&&y.push(c[U]);continue}const L=k+C>>1,F=d[2*L],j=d[2*L+1];xg(F,j,t,r)<=b&&y.push(c[L]),(S===0?t-a<=F:r-a<=j)&&(m.push(k),m.push(L-1),m.push(1-S)),(S===0?t+a>=F:r+a>=j)&&(m.push(L+1),m.push(C),m.push(1-S))}return y}}function yp(n,t,r,a,c,d){if(c-a<=r)return;const p=a+c>>1;yg(n,t,p,a,c,d),yp(n,t,r,a,p-1,1-d),yp(n,t,r,p+1,c,1-d)}function yg(n,t,r,a,c,d){for(;c>a;){if(c-a>600){const b=c-a+1,S=r-a+1,C=Math.log(b),k=.5*Math.exp(2*C/3),L=.5*Math.sqrt(C*k*(b-k)/b)*(S-b/2<0?-1:1);yg(n,t,r,Math.max(a,Math.floor(r-S*k/b+L)),Math.min(c,Math.floor(r+(b-S)*k/b+L)),d)}const p=t[2*r+d];let m=a,y=c;for(Uc(n,t,a,r),t[2*c+d]>p&&Uc(n,t,a,c);m<y;){for(Uc(n,t,m,y),m++,y--;t[2*m+d]<p;)m++;for(;t[2*y+d]>p;)y--}t[2*a+d]===p?Uc(n,t,a,y):(y++,Uc(n,t,y,c)),y<=r&&(a=y+1),r<=y&&(c=y-1)}}function Uc(n,t,r,a){xp(n,r,a),xp(t,2*r,2*a),xp(t,2*r+1,2*a+1)}function xp(n,t,r){const a=n[t];n[t]=n[r],n[r]=a}function xg(n,t,r,a){const c=n-r,d=t-a;return c*c+d*d}var vp;P.cw=void 0,(vp=P.cw||(P.cw={})).create="create",vp.load="load",vp.fullLoad="fullLoad";let Mh=null,$c=[];const bp=1e3/60,wp="loadTime",Tp="fullLoadTime",hv={mark(n){performance.mark(n)},frame(n){const t=n;Mh!=null&&$c.push(t-Mh),Mh=t},clearMetrics(){Mh=null,$c=[],performance.clearMeasures(wp),performance.clearMeasures(Tp);for(const n in P.cw)performance.clearMarks(P.cw[n])},getPerformanceMetrics(){performance.measure(wp,P.cw.create,P.cw.load),performance.measure(Tp,P.cw.create,P.cw.fullLoad);const n=performance.getEntriesByName(wp)[0].duration,t=performance.getEntriesByName(Tp)[0].duration,r=$c.length,a=1/($c.reduce((d,p)=>d+p,0)/r/1e3),c=$c.filter(d=>d>bp).reduce((d,p)=>d+(p-bp)/bp,0);return{loadTime:n,fullLoadTime:t,fps:a,percentDroppedFrames:c/(r+c)*100,totalFrames:r}}};P.$=At,P.A=jt,P.B=function([n,t,r]){return t+=90,t*=Math.PI/180,r*=Math.PI/180,{x:n*Math.cos(t)*Math.sin(r),y:n*Math.sin(t)*Math.sin(r),z:n*Math.cos(r)}},P.C=yr,P.D=qe,P.E=Me,P.F=Wt,P.G=il,P.H=function(n){if(ta==null){const t=n.navigator?n.navigator.userAgent:null;ta=!!n.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return ta},P.I=np,P.J=class{constructor(n,t){this.target=n,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new tv(()=>this.process()),this.subscription=mn(this.target,"message",r=>this.receive(r),!1),this.globalScope=rr(self)?n:window}registerMessageHandler(n,t){this.messageHandlers[n]=t}sendAsync(n,t){return new Promise((r,a)=>{const c=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=t?mn(t.signal,"abort",()=>{d==null||d.unsubscribe(),delete this.resolveRejects[c];const y={id:c,type:"<cancel>",origin:location.origin,targetMapId:n.targetMapId,sourceMapId:this.mapId};this.target.postMessage(y)},iv):null;this.resolveRejects[c]={resolve:y=>{d==null||d.unsubscribe(),r(y)},reject:y=>{d==null||d.unsubscribe(),a(y)}};const p=[],m=Object.assign(Object.assign({},n),{id:c,sourceMapId:this.mapId,origin:location.origin,data:qs(n.data,p)});this.target.postMessage(m,{transfer:p})})}receive(n){const t=n.data,r=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[r];const a=this.abortControllers[r];return delete this.abortControllers[r],void(a&&a.abort())}if(rr(self)||t.mustQueue)return this.tasks[r]=t,this.taskQueue.push(r),void this.invoker.trigger();this.processTask(r,t)}}process(){if(this.taskQueue.length===0)return;const n=this.taskQueue.shift(),t=this.tasks[n];delete this.tasks[n],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(n,t)}processTask(n,t){return o(this,void 0,void 0,function*(){if(t.type==="<response>"){const c=this.resolveRejects[n];return delete this.resolveRejects[n],c?void(t.error?c.reject(as(t.error)):c.resolve(as(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(n,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const r=as(t.data),a=new AbortController;this.abortControllers[n]=a;try{const c=yield this.messageHandlers[t.type](t.sourceMapId,r,a);this.completeTask(n,null,c)}catch(c){this.completeTask(n,c)}})}completeTask(n,t,r){const a=[];delete this.abortControllers[n];const c={id:n,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?qs(t):null,data:qs(r,a)};this.target.postMessage(c,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},P.K=G,P.L=function(){var n=new jt(16);return jt!=Float32Array&&(n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=0,n[12]=0,n[13]=0,n[14]=0),n[0]=1,n[5]=1,n[10]=1,n[15]=1,n},P.M=function(n,t,r){var a,c,d,p,m,y,b,S,C,k,L,F,j=r[0],U=r[1],H=r[2];return t===n?(n[12]=t[0]*j+t[4]*U+t[8]*H+t[12],n[13]=t[1]*j+t[5]*U+t[9]*H+t[13],n[14]=t[2]*j+t[6]*U+t[10]*H+t[14],n[15]=t[3]*j+t[7]*U+t[11]*H+t[15]):(c=t[1],d=t[2],p=t[3],m=t[4],y=t[5],b=t[6],S=t[7],C=t[8],k=t[9],L=t[10],F=t[11],n[0]=a=t[0],n[1]=c,n[2]=d,n[3]=p,n[4]=m,n[5]=y,n[6]=b,n[7]=S,n[8]=C,n[9]=k,n[10]=L,n[11]=F,n[12]=a*j+m*U+C*H+t[12],n[13]=c*j+y*U+k*H+t[13],n[14]=d*j+b*U+L*H+t[14],n[15]=p*j+S*U+F*H+t[15]),n},P.N=function(n,t,r){var a=r[0],c=r[1],d=r[2];return n[0]=t[0]*a,n[1]=t[1]*a,n[2]=t[2]*a,n[3]=t[3]*a,n[4]=t[4]*c,n[5]=t[5]*c,n[6]=t[6]*c,n[7]=t[7]*c,n[8]=t[8]*d,n[9]=t[9]*d,n[10]=t[10]*d,n[11]=t[11]*d,n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},P.O=function(n,t,r){var a=t[0],c=t[1],d=t[2],p=t[3],m=t[4],y=t[5],b=t[6],S=t[7],C=t[8],k=t[9],L=t[10],F=t[11],j=t[12],U=t[13],H=t[14],se=t[15],J=r[0],D=r[1],Z=r[2],te=r[3];return n[0]=J*a+D*m+Z*C+te*j,n[1]=J*c+D*y+Z*k+te*U,n[2]=J*d+D*b+Z*L+te*H,n[3]=J*p+D*S+Z*F+te*se,n[4]=(J=r[4])*a+(D=r[5])*m+(Z=r[6])*C+(te=r[7])*j,n[5]=J*c+D*y+Z*k+te*U,n[6]=J*d+D*b+Z*L+te*H,n[7]=J*p+D*S+Z*F+te*se,n[8]=(J=r[8])*a+(D=r[9])*m+(Z=r[10])*C+(te=r[11])*j,n[9]=J*c+D*y+Z*k+te*U,n[10]=J*d+D*b+Z*L+te*H,n[11]=J*p+D*S+Z*F+te*se,n[12]=(J=r[12])*a+(D=r[13])*m+(Z=r[14])*C+(te=r[15])*j,n[13]=J*c+D*y+Z*k+te*U,n[14]=J*d+D*b+Z*L+te*H,n[15]=J*p+D*S+Z*F+te*se,n},P.P=Be,P.Q=function(n,t){const r={};for(let a=0;a<t.length;a++){const c=t[a];c in n&&(r[c]=n[c])}return r},P.R=xr,P.S=us,P.T=Ud,P.U=Ym,P.V=Xm,P.W=Lt,P.X=li,P.Y=ia,P.Z=Ur,P._=o,P.a=N,P.a$=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n[2]=t[2]*r,n[3]=t[3]*r,n},P.a0=Zc,P.a1=ao,P.a2=25,P.a3=fp,P.a4=n=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(r=>{t.onloadstart=()=>{r(t)};for(const a of n){const c=window.document.createElement("source");ge(a)||(t.crossOrigin="Anonymous"),c.src=a,t.appendChild(c)}})},P.a5=De,P.a6=function(){return gs++},P.a7=q,P.a8=ml,P.a9=jn,P.aA=Mi,P.aB=pr,P.aC=function(n,t,r,a,c=!1){if(!r[0]&&!r[1])return[0,0];const d=c?a==="map"?-n.bearingInRadians:0:a==="viewport"?n.bearingInRadians:0;if(d){const p=Math.sin(d),m=Math.cos(d);r=[r[0]*m-r[1]*p,r[0]*p+r[1]*m]}return[c?r[0]:pr(t,r[0],n.zoom),c?r[1]:pr(t,r[1],n.zoom)]},P.aE=op,P.aF=gp,P.aG=sp,P.aH=_p,P.aI=ni,P.aJ=mh,P.aK=pe,P.aL=Tt,P.aM=Nt,P.aN=Dn,P.aO=tn,P.aP=Jm,P.aQ=qi,P.aR=Tr,P.aS=function(n){var t=new jt(3);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t},P.aT=function(n,t,r){return n[0]=t[0]-r[0],n[1]=t[1]-r[1],n[2]=t[2]-r[2],n},P.aU=function(n,t){var r=t[0],a=t[1],c=t[2],d=r*r+a*a+c*c;return d>0&&(d=1/Math.sqrt(d)),n[0]=t[0]*d,n[1]=t[1]*d,n[2]=t[2]*d,n},P.aV=Jr,P.aW=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]},P.aX=function(n,t,r){return n[0]=t[0]*r[0],n[1]=t[1]*r[1],n[2]=t[2]*r[2],n[3]=t[3]*r[3],n},P.aY=Kr,P.aZ=function(n,t,r){const a=t[0]*r[0]+t[1]*r[1]+t[2]*r[2];return a===0?null:(-(n[0]*r[0]+n[1]*r[1]+n[2]*r[2])-r[3])/a},P.a_=St,P.aa=io,P.ab=ig,P.ac=function(n){const t={};if(n.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(r,a,c,d)=>{const p=c||d;return t[a]=!p||p.toLowerCase(),""}),t["max-age"]){const r=parseInt(t["max-age"],10);isNaN(r)?delete t["max-age"]:t["max-age"]=r}return t},P.ad=mr,P.ae=function(n){return Math.pow(2,n)},P.af=ea,P.ag=ci,P.ah=85.051129,P.ai=Km,P.aj=function(n){return Math.log(n)/Math.LN2},P.ak=function(n){var t=n[0],r=n[1];return t*t+r*r},P.al=function(n,t){const r=[];for(const a in n)a in t||r.push(a);return r},P.am=function(n,t){let r=0,a=0;if(n.kind==="constant")a=n.layoutSize;else if(n.kind!=="source"){const{interpolationType:c,minZoom:d,maxZoom:p}=n,m=c?ci(Yi.interpolationFactor(c,t,d,p),0,1):0;n.kind==="camera"?a=yr.number(n.minSize,n.maxSize,m):r=m}return{uSizeT:r,uSize:a}},P.ao=function(n,{uSize:t,uSizeT:r},{lowerSize:a,upperSize:c}){return n.kind==="source"?a/ya:n.kind==="composite"?yr.number(a/ya,c/ya,r):t},P.ap=function(n,t){var r=t[0],a=t[1],c=t[2],d=t[3],p=t[4],m=t[5],y=t[6],b=t[7],S=t[8],C=t[9],k=t[10],L=t[11],F=t[12],j=t[13],U=t[14],H=t[15],se=r*m-a*p,J=r*y-c*p,D=r*b-d*p,Z=a*y-c*m,te=a*b-d*m,me=c*b-d*y,Ce=S*j-C*F,ve=S*U-k*F,Te=S*H-L*F,ze=C*U-k*j,Ee=C*H-L*j,ke=k*H-L*U,Pe=se*ke-J*Ee+D*ze+Z*Te-te*ve+me*Ce;return Pe?(n[0]=(m*ke-y*Ee+b*ze)*(Pe=1/Pe),n[1]=(c*Ee-a*ke-d*ze)*Pe,n[2]=(j*me-U*te+H*Z)*Pe,n[3]=(k*te-C*me-L*Z)*Pe,n[4]=(y*Te-p*ke-b*ve)*Pe,n[5]=(r*ke-c*Te+d*ve)*Pe,n[6]=(U*D-F*me-H*J)*Pe,n[7]=(S*me-k*D+L*J)*Pe,n[8]=(p*Ee-m*Te+b*Ce)*Pe,n[9]=(a*Te-r*Ee-d*Ce)*Pe,n[10]=(F*te-j*D+H*se)*Pe,n[11]=(C*D-S*te-L*se)*Pe,n[12]=(m*ve-p*ze-y*Ce)*Pe,n[13]=(r*ze-a*ve+c*Ce)*Pe,n[14]=(j*J-F*Z-U*se)*Pe,n[15]=(S*Z-C*J+k*se)*Pe,n):null},P.aq=Fr,P.ar=function(n){return Math.hypot(n[0],n[1])},P.as=function(n){return n[0]=0,n[1]=0,n},P.at=function(n,t,r){return n[0]=t[0]*r,n[1]=t[1]*r,n},P.au=lp,P.av=zi,P.aw=function(n,t,r,a){const c=t.y-n.y,d=t.x-n.x,p=a.y-r.y,m=a.x-r.x,y=p*d-m*c;if(y===0)return null;const b=(m*(n.y-r.y)-p*(n.x-r.x))/y;return new Be(n.x+b*d,n.y+b*c)},P.ax=ag,P.ay=Uf,P.az=function(n){let t=1/0,r=1/0,a=-1/0,c=-1/0;for(const d of n)t=Math.min(t,d.x),r=Math.min(r,d.y),a=Math.max(a,d.x),c=Math.max(c,d.y);return[t,r,a,c]},P.b=Ln,P.b$=kx,P.b0=function(n,t){return n[0]*t[0]+n[1]*t[1]+n[2]*t[2]+n[3]},P.b1=eg,P.b2=gl,P.b3=function(n,t,r,a,c){var d,p=1/Math.tan(t/2);return n[0]=p/r,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=p,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[11]=-1,n[12]=0,n[13]=0,n[15]=0,c!=null&&c!==1/0?(n[10]=(c+a)*(d=1/(a-c)),n[14]=2*c*a*d):(n[10]=-1,n[14]=-2*a),n},P.b4=function(n){var t=new jt(16);return t[0]=n[0],t[1]=n[1],t[2]=n[2],t[3]=n[3],t[4]=n[4],t[5]=n[5],t[6]=n[6],t[7]=n[7],t[8]=n[8],t[9]=n[9],t[10]=n[10],t[11]=n[11],t[12]=n[12],t[13]=n[13],t[14]=n[14],t[15]=n[15],t},P.b5=function(n,t,r){var a=Math.sin(r),c=Math.cos(r),d=t[0],p=t[1],m=t[2],y=t[3],b=t[4],S=t[5],C=t[6],k=t[7];return t!==n&&(n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=d*c+b*a,n[1]=p*c+S*a,n[2]=m*c+C*a,n[3]=y*c+k*a,n[4]=b*c-d*a,n[5]=S*c-p*a,n[6]=C*c-m*a,n[7]=k*c-y*a,n},P.b6=function(n,t,r){var a=Math.sin(r),c=Math.cos(r),d=t[4],p=t[5],m=t[6],y=t[7],b=t[8],S=t[9],C=t[10],k=t[11];return t!==n&&(n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[4]=d*c+b*a,n[5]=p*c+S*a,n[6]=m*c+C*a,n[7]=y*c+k*a,n[8]=b*c-d*a,n[9]=S*c-p*a,n[10]=C*c-m*a,n[11]=k*c-y*a,n},P.b7=function(){const n=new Float32Array(16);return ea(n),n},P.b8=function(){const n=new Float64Array(16);return ea(n),n},P.b9=function(){return new Float64Array(16)},P.bA=function(n){return n[0]=0,n[1]=0,n[2]=0,n},P.bB=function(n,t,r,a){const c=Math.sqrt(n*n+t*t),d=Math.sqrt(r*r+a*a);n/=c,t/=c,r/=d,a/=d;const p=Math.acos(n*r+t*a);return-t*r+n*a>0?p:-p},P.bC=function(n,t){const r=ir(n,2*Math.PI),a=ir(t,2*Math.PI);return Math.min(Math.abs(r-a),Math.abs(r-a+2*Math.PI),Math.abs(r-a-2*Math.PI))},P.bD=function(){const n={},t=ne.$version;for(const r in ne.$root){const a=ne.$root[r];if(a.required){let c=null;c=r==="version"?t:a.type==="array"?[]:{},c!=null&&(n[r]=c)}}return n},P.bE=mc,P.bF=ae,P.bG=function n(t,r){if(Array.isArray(t)){if(!Array.isArray(r)||t.length!==r.length)return!1;for(let a=0;a<t.length;a++)if(!n(t[a],r[a]))return!1;return!0}if(typeof t=="object"&&t!==null&&r!==null){if(typeof r!="object"||Object.keys(t).length!==Object.keys(r).length)return!1;for(const a in t)if(!n(t[a],r[a]))return!1;return!0}return t===r},P.bH=function(n){n=n.slice();const t=Object.create(null);for(let r=0;r<n.length;r++)t[n[r].id]=n[r];for(let r=0;r<n.length;r++)"ref"in n[r]&&(n[r]=tt(n[r],t[n[r].ref]));return n},P.bI=function(n){if(n.type==="custom")return new ev(n);switch(n.type){case"background":return new Kx(n);case"circle":return new Gy(n);case"color-relief":return new Ky(n);case"fill":return new dx(n);case"fill-extrusion":return new vx(n);case"heatmap":return new Wy(n);case"hillshade":return new Xy(n);case"line":return new Ix(n);case"raster":return new Qx(n);case"symbol":return new bh(n)}},P.bJ=Sr,P.bK=function(n,t){if(!n)return[{command:"setStyle",args:[t]}];let r=[];try{if(!Ue(n.version,t.version))return[{command:"setStyle",args:[t]}];Ue(n.center,t.center)||r.push({command:"setCenter",args:[t.center]}),Ue(n.state,t.state)||r.push({command:"setGlobalState",args:[t.state]}),Ue(n.centerAltitude,t.centerAltitude)||r.push({command:"setCenterAltitude",args:[t.centerAltitude]}),Ue(n.zoom,t.zoom)||r.push({command:"setZoom",args:[t.zoom]}),Ue(n.bearing,t.bearing)||r.push({command:"setBearing",args:[t.bearing]}),Ue(n.pitch,t.pitch)||r.push({command:"setPitch",args:[t.pitch]}),Ue(n.roll,t.roll)||r.push({command:"setRoll",args:[t.roll]}),Ue(n.sprite,t.sprite)||r.push({command:"setSprite",args:[t.sprite]}),Ue(n.glyphs,t.glyphs)||r.push({command:"setGlyphs",args:[t.glyphs]}),Ue(n.transition,t.transition)||r.push({command:"setTransition",args:[t.transition]}),Ue(n.light,t.light)||r.push({command:"setLight",args:[t.light]}),Ue(n.terrain,t.terrain)||r.push({command:"setTerrain",args:[t.terrain]}),Ue(n.sky,t.sky)||r.push({command:"setSky",args:[t.sky]}),Ue(n.projection,t.projection)||r.push({command:"setProjection",args:[t.projection]});const a={},c=[];(function(p,m,y,b){let S;for(S in m=m||{},p=p||{})Object.prototype.hasOwnProperty.call(p,S)&&(Object.prototype.hasOwnProperty.call(m,S)||Zt(S,y,b));for(S in m)Object.prototype.hasOwnProperty.call(m,S)&&(Object.prototype.hasOwnProperty.call(p,S)?Ue(p[S],m[S])||(p[S].type==="geojson"&&m[S].type==="geojson"&&Pt(p,m,S)?Ye(y,{command:"setGeoJSONSourceData",args:[S,m[S].data]}):zt(S,m,y,b)):nt(S,m,y))})(n.sources,t.sources,c,a);const d=[];n.layers&&n.layers.forEach(p=>{"source"in p&&a[p.source]?r.push({command:"removeLayer",args:[p.id]}):d.push(p)}),r=r.concat(c),function(p,m,y){m=m||[];const b=(p=p||[]).map(vt),S=m.map(vt),C=p.reduce(wi,{}),k=m.reduce(wi,{}),L=b.slice(),F=Object.create(null);let j,U,H,se,J;for(let D=0,Z=0;D<b.length;D++)j=b[D],Object.prototype.hasOwnProperty.call(k,j)?Z++:(Ye(y,{command:"removeLayer",args:[j]}),L.splice(L.indexOf(j,Z),1));for(let D=0,Z=0;D<S.length;D++)j=S[S.length-1-D],L[L.length-1-D]!==j&&(Object.prototype.hasOwnProperty.call(C,j)?(Ye(y,{command:"removeLayer",args:[j]}),L.splice(L.lastIndexOf(j,L.length-Z),1)):Z++,se=L[L.length-D],Ye(y,{command:"addLayer",args:[k[j],se]}),L.splice(L.length-D,0,j),F[j]=!0);for(let D=0;D<S.length;D++)if(j=S[D],U=C[j],H=k[j],!F[j]&&!Ue(U,H))if(Ue(U.source,H.source)&&Ue(U["source-layer"],H["source-layer"])&&Ue(U.type,H.type)){for(J in rt(U.layout,H.layout,y,j,null,"setLayoutProperty"),rt(U.paint,H.paint,y,j,null,"setPaintProperty"),Ue(U.filter,H.filter)||Ye(y,{command:"setFilter",args:[j,H.filter]}),Ue(U.minzoom,H.minzoom)&&Ue(U.maxzoom,H.maxzoom)||Ye(y,{command:"setLayerZoomRange",args:[j,H.minzoom,H.maxzoom]}),U)Object.prototype.hasOwnProperty.call(U,J)&&J!=="layout"&&J!=="paint"&&J!=="filter"&&J!=="metadata"&&J!=="minzoom"&&J!=="maxzoom"&&(J.indexOf("paint.")===0?rt(U[J],H[J],y,j,J.slice(6),"setPaintProperty"):Ue(U[J],H[J])||Ye(y,{command:"setLayerProperty",args:[j,J,H[J]]}));for(J in H)Object.prototype.hasOwnProperty.call(H,J)&&!Object.prototype.hasOwnProperty.call(U,J)&&J!=="layout"&&J!=="paint"&&J!=="filter"&&J!=="metadata"&&J!=="minzoom"&&J!=="maxzoom"&&(J.indexOf("paint.")===0?rt(U[J],H[J],y,j,J.slice(6),"setPaintProperty"):Ue(U[J],H[J])||Ye(y,{command:"setLayerProperty",args:[j,J,H[J]]}))}else Ye(y,{command:"removeLayer",args:[j]}),se=L[L.lastIndexOf(j)+1],Ye(y,{command:"addLayer",args:[H,se]})}(d,t.layers,r)}catch(a){console.warn("Unable to compute style diff:",a),r=[{command:"setStyle",args:[t]}]}return r},P.bL=function(n){const t=[],r=n.id;return r===void 0&&t.push({message:`layers.${r}: missing required property "id"`}),n.render===void 0&&t.push({message:`layers.${r}: missing required method "render"`}),n.renderingMode&&n.renderingMode!=="2d"&&n.renderingMode!=="3d"&&t.push({message:`layers.${r}: property "renderingMode" must be either "2d" or "3d"`}),t},P.bM=ii,P.bN=en,P.bO=class extends Ut{constructor(n,t){super(n,t),this.current=0}set(n){this.current!==n&&(this.current=n,this.gl.uniform1i(this.location,n))}},P.bP=uh,P.bQ=class extends Ut{constructor(n,t){super(n,t),this.current=Fd}set(n){if(n[12]!==this.current[12]||n[0]!==this.current[0])return this.current=n,void this.gl.uniformMatrix4fv(this.location,!1,n);for(let t=1;t<16;t++)if(n[t]!==this.current[t]){this.current=n,this.gl.uniformMatrix4fv(this.location,!1,n);break}}},P.bR=_i,P.bS=class extends Ut{constructor(n,t){super(n,t),this.current=[0,0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]&&n[2]===this.current[2]||(this.current=n,this.gl.uniform3f(this.location,n[0],n[1],n[2]))}},P.bT=class extends Ut{constructor(n,t){super(n,t),this.current=[0,0]}set(n){n[0]===this.current[0]&&n[1]===this.current[1]||(this.current=n,this.gl.uniform2f(this.location,n[0],n[1]))}},P.bU=hr,P.bV=function(n,t){var r=Math.sin(t),a=Math.cos(t);return n[0]=a,n[1]=r,n[2]=0,n[3]=-r,n[4]=a,n[5]=0,n[6]=0,n[7]=0,n[8]=1,n},P.bW=function(n,t,r){var a=t[0],c=t[1],d=t[2];return n[0]=a*r[0]+c*r[3]+d*r[6],n[1]=a*r[1]+c*r[4]+d*r[7],n[2]=a*r[2]+c*r[5]+d*r[8],n},P.bX=function(n,t,r,a,c,d,p){var m=1/(t-r),y=1/(a-c),b=1/(d-p);return n[0]=-2*m,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=-2*y,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=2*b,n[11]=0,n[12]=(t+r)*m,n[13]=(c+a)*y,n[14]=(p+d)*b,n[15]=1,n},P.bY=class extends Ut{constructor(n,t){super(n,t),this.current=new Array}set(n){if(n!=this.current){this.current=n;const t=new Float32Array(4*n.length);for(let r=0;r<n.length;r++)t[4*r]=n[r].r,t[4*r+1]=n[r].g,t[4*r+2]=n[r].b,t[4*r+3]=n[r].a;this.gl.uniform4fv(this.location,t)}}},P.bZ=class extends Ut{constructor(n,t){super(n,t),this.current=new Array}set(n){if(n!=this.current){this.current=n;const t=new Float32Array(n);this.gl.uniform1fv(this.location,t)}}},P.b_=class extends s{},P.ba=function(n,t,r){const a=new Float64Array(4);return tr(a,n,t-90,r),a},P.bb=function(n,t,r,a){var c,d,p,m,y,b=t[0],S=t[1],C=t[2],k=t[3],L=r[0],F=r[1],j=r[2],U=r[3];return(d=b*L+S*F+C*j+k*U)<0&&(d=-d,L=-L,F=-F,j=-j,U=-U),1-d>Ft?(c=Math.acos(d),p=Math.sin(c),m=Math.sin((1-a)*c)/p,y=Math.sin(a*c)/p):(m=1-a,y=a),n[0]=m*b+y*L,n[1]=m*S+y*F,n[2]=m*C+y*j,n[3]=m*k+y*U,n},P.bc=function(n){const t=new Float64Array(9);var r,a,c,d,p,m,y,b,S,C,k,L,F,j,U,H,se,J;C=(c=(a=n)[0])*(y=c+c),k=(d=a[1])*y,F=(p=a[2])*y,j=p*(b=d+d),H=(m=a[3])*y,se=m*b,J=m*(S=p+p),(r=t)[0]=1-(L=d*b)-(U=p*S),r[3]=k-J,r[6]=F+se,r[1]=k+J,r[4]=1-C-U,r[7]=j-H,r[2]=F-se,r[5]=j+H,r[8]=1-C-L;const D=tn(-Math.asin(ci(t[2],-1,1)));let Z,te;return Math.hypot(t[5],t[8])<.001?(Z=0,te=-tn(Math.atan2(t[3],t[4]))):(Z=tn(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),te=tn(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:Z,pitch:D+90,bearing:te}},P.bd=function(n,t){return n.roll==t.roll&&n.pitch==t.pitch&&n.bearing==t.bearing},P.be=gt,P.bf=Qi,P.bg=pl,P.bh=Lc,P.bi=dl,P.bj=Qr,P.bk=Br,P.bl=at,P.bm=function(n,t,r,a,c){return Qr(a,c,ci((n-t)/(r-t),0,1))},P.bn=ir,P.bo=function(){return new Float64Array(3)},P.bp=function(n,t,r,a){return n[0]=t[0]+r[0]*a,n[1]=t[1]+r[1]*a,n[2]=t[2]+r[2]*a,n},P.bq=tr,P.br=function(n,t,r){var a=r[0],c=r[1],d=r[2],p=t[0],m=t[1],y=t[2],b=c*y-d*m,S=d*p-a*y,C=a*m-c*p,k=c*C-d*S,L=d*b-a*C,F=a*S-c*b,j=2*r[3];return S*=j,C*=j,L*=2,F*=2,n[0]=p+(b*=j)+(k*=2),n[1]=m+S+L,n[2]=y+C+F,n},P.bs=function(n,t,r){const a=(c=[n[0],n[1],n[2],t[0],t[1],t[2],r[0],r[1],r[2]])[0]*((S=c[8])*(p=c[4])-(m=c[5])*(b=c[7]))+c[1]*(-S*(d=c[3])+m*(y=c[6]))+c[2]*(b*d-p*y);var c,d,p,m,y,b,S;if(a===0)return null;const C=Jr([],[t[0],t[1],t[2]],[r[0],r[1],r[2]]),k=Jr([],[r[0],r[1],r[2]],[n[0],n[1],n[2]]),L=Jr([],[n[0],n[1],n[2]],[t[0],t[1],t[2]]),F=qi([],C,-n[3]);return Tr(F,F,qi([],k,-t[3])),Tr(F,F,qi([],L,-r[3])),qi(F,F,1/a),F},P.bt=dp,P.bu=function(){return new Float64Array(4)},P.bv=function(n,t,r,a){var c=[],d=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[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],n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},P.bw=function(n,t,r,a){var c=[],d=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[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),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},P.bx=function(n,t,r,a){var c=[],d=[];return c[0]=t[0]-r[0],c[1]=t[1]-r[1],c[2]=t[2]-r[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),n[0]=d[0]+r[0],n[1]=d[1]+r[1],n[2]=d[2]+r[2],n},P.by=function(n,t,r){var a=Math.sin(r),c=Math.cos(r),d=t[0],p=t[1],m=t[2],y=t[3],b=t[8],S=t[9],C=t[10],k=t[11];return t!==n&&(n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15]),n[0]=d*c-b*a,n[1]=p*c-S*a,n[2]=m*c-C*a,n[3]=y*c-k*a,n[8]=d*a+b*c,n[9]=p*a+S*c,n[10]=m*a+C*c,n[11]=y*a+k*c,n},P.bz=function(n,t){const r=ir(n,360),a=ir(t,360),c=a-r,d=a>r?c-360:c+360;return Math.abs(c)<Math.abs(d)?c:d},P.c=he,P.c0=class extends h{},P.c1=Zd,P.c2=function(n){return n<=1?1:Math.pow(2,Math.ceil(Math.log(n)/Math.LN2))},P.c3=Qf,P.c4=function(n,t,r){var a=t[0],c=t[1],d=t[2],p=r[3]*a+r[7]*c+r[11]*d+r[15];return n[0]=(r[0]*a+r[4]*c+r[8]*d+r[12])/(p=p||1),n[1]=(r[1]*a+r[5]*c+r[9]*d+r[13])/p,n[2]=(r[2]*a+r[6]*c+r[10]*d+r[14])/p,n},P.c5=class extends wc{},P.c6=class extends E{},P.c7=function(n,t){return n[0]===t[0]&&n[1]===t[1]&&n[2]===t[2]&&n[3]===t[3]&&n[4]===t[4]&&n[5]===t[5]&&n[6]===t[6]&&n[7]===t[7]&&n[8]===t[8]&&n[9]===t[9]&&n[10]===t[10]&&n[11]===t[11]&&n[12]===t[12]&&n[13]===t[13]&&n[14]===t[14]&&n[15]===t[15]},P.c8=function(n,t){var r=n[0],a=n[1],c=n[2],d=n[3],p=n[4],m=n[5],y=n[6],b=n[7],S=n[8],C=n[9],k=n[10],L=n[11],F=n[12],j=n[13],U=n[14],H=n[15],se=t[0],J=t[1],D=t[2],Z=t[3],te=t[4],me=t[5],Ce=t[6],ve=t[7],Te=t[8],ze=t[9],Ee=t[10],ke=t[11],Pe=t[12],Ge=t[13],Je=t[14],Ke=t[15];return Math.abs(r-se)<=Ft*Math.max(1,Math.abs(r),Math.abs(se))&&Math.abs(a-J)<=Ft*Math.max(1,Math.abs(a),Math.abs(J))&&Math.abs(c-D)<=Ft*Math.max(1,Math.abs(c),Math.abs(D))&&Math.abs(d-Z)<=Ft*Math.max(1,Math.abs(d),Math.abs(Z))&&Math.abs(p-te)<=Ft*Math.max(1,Math.abs(p),Math.abs(te))&&Math.abs(m-me)<=Ft*Math.max(1,Math.abs(m),Math.abs(me))&&Math.abs(y-Ce)<=Ft*Math.max(1,Math.abs(y),Math.abs(Ce))&&Math.abs(b-ve)<=Ft*Math.max(1,Math.abs(b),Math.abs(ve))&&Math.abs(S-Te)<=Ft*Math.max(1,Math.abs(S),Math.abs(Te))&&Math.abs(C-ze)<=Ft*Math.max(1,Math.abs(C),Math.abs(ze))&&Math.abs(k-Ee)<=Ft*Math.max(1,Math.abs(k),Math.abs(Ee))&&Math.abs(L-ke)<=Ft*Math.max(1,Math.abs(L),Math.abs(ke))&&Math.abs(F-Pe)<=Ft*Math.max(1,Math.abs(F),Math.abs(Pe))&&Math.abs(j-Ge)<=Ft*Math.max(1,Math.abs(j),Math.abs(Ge))&&Math.abs(U-Je)<=Ft*Math.max(1,Math.abs(U),Math.abs(Je))&&Math.abs(H-Ke)<=Ft*Math.max(1,Math.abs(H),Math.abs(Ke))},P.c9=function(n,t){return n[0]=t[0],n[1]=t[1],n[2]=t[2],n[3]=t[3],n[4]=t[4],n[5]=t[5],n[6]=t[6],n[7]=t[7],n[8]=t[8],n[9]=t[9],n[10]=t[10],n[11]=t[11],n[12]=t[12],n[13]=t[13],n[14]=t[14],n[15]=t[15],n},P.cA=function(n){delete N.REGISTERED_PROTOCOLS[n]},P.cB=function(n,t){const r={};for(let c=0;c<n.length;c++){const d=t&&t[n[c].id]||Ko(n[c]);t&&(t[n[c].id]=d);let p=r[d];p||(p=r[d]=[]),p.push(n[c])}const a=[];for(const c in r)a.push(r[c]);return a},P.cC=Ze,P.cD=tg,P.cE=rg,P.cF=Rm,P.cG=function(n){n.bucket.createArrays(),n.bucket.tilePixelRatio=At/(512*n.bucket.overscaling),n.bucket.compareText={},n.bucket.iconsNeedLinear=!1;const t=n.bucket.layers[0],r=t.layout,a=t._unevaluatedLayout._values,c={layoutIconSize:a["icon-size"].possiblyEvaluate(new Wt(n.bucket.zoom+1),n.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Wt(n.bucket.zoom+1),n.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Wt(18))};if(n.bucket.textSizeData.kind==="composite"){const{minZoom:b,maxZoom:S}=n.bucket.textSizeData;c.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Wt(b),n.canonical),a["text-size"].possiblyEvaluate(new Wt(S),n.canonical)]}if(n.bucket.iconSizeData.kind==="composite"){const{minZoom:b,maxZoom:S}=n.bucket.iconSizeData;c.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Wt(b),n.canonical),a["icon-size"].possiblyEvaluate(new Wt(S),n.canonical)]}const d=r.get("text-line-height")*Mi,p=r.get("text-rotation-alignment")!=="viewport"&&r.get("symbol-placement")!=="point",m=r.get("text-keep-upright"),y=r.get("text-size");for(const b of n.bucket.features){const S=r.get("text-font").evaluate(b,{},n.canonical).join(","),C=y.evaluate(b,{},n.canonical),k=c.layoutTextSize.evaluate(b,{},n.canonical),L=c.layoutIconSize.evaluate(b,{},n.canonical),F={horizontal:{},vertical:void 0},j=b.text;let U,H=[0,0];if(j){const D=j.toString(),Z=r.get("text-letter-spacing").evaluate(b,{},n.canonical)*Mi,te=rh(D)?Z:0,me=r.get("text-anchor").evaluate(b,{},n.canonical),Ce=fg(t,b,n.canonical);if(!Ce){const Ee=r.get("text-radial-offset").evaluate(b,{},n.canonical);H=Ee?pg(me,[Ee*Mi,mp]):r.get("text-offset").evaluate(b,{},n.canonical).map(ke=>ke*Mi)}let ve=p?"center":r.get("text-justify").evaluate(b,{},n.canonical);const Te=r.get("symbol-placement")==="point"?r.get("text-max-width").evaluate(b,{},n.canonical)*Mi:1/0,ze=()=>{n.bucket.allowVerticalPlacement&&gc(D)&&(F.vertical=yh(j,n.glyphMap,n.glyphPositions,n.imagePositions,S,Te,d,me,"left",te,H,P.an.vertical,!0,k,C))};if(!p&&Ce){const Ee=new Set;if(ve==="auto")for(let Pe=0;Pe<Ce.values.length;Pe+=2)Ee.add(gp(Ce.values[Pe]));else Ee.add(ve);let ke=!1;for(const Pe of Ee)if(!F.horizontal[Pe])if(ke)F.horizontal[Pe]=F.horizontal[0];else{const Ge=yh(j,n.glyphMap,n.glyphPositions,n.imagePositions,S,Te,d,"center",Pe,te,H,P.an.horizontal,!1,k,C);Ge&&(F.horizontal[Pe]=Ge,ke=Ge.positionedLines.length===1)}ze()}else{ve==="auto"&&(ve=gp(me));const Ee=yh(j,n.glyphMap,n.glyphPositions,n.imagePositions,S,Te,d,me,ve,te,H,P.an.horizontal,!1,k,C);Ee&&(F.horizontal[ve]=Ee),ze(),gc(D)&&p&&m&&(F.vertical=yh(j,n.glyphMap,n.glyphPositions,n.imagePositions,S,Te,d,me,ve,te,H,P.an.vertical,!1,k,C))}}let se=!1;if(b.icon&&b.icon.name){const D=n.imageMap[b.icon.name];D&&(U=qx(n.imagePositions[b.icon.name],r.get("icon-offset").evaluate(b,{},n.canonical),r.get("icon-anchor").evaluate(b,{},n.canonical)),se=!!D.sdf,n.bucket.sdfIcons===void 0?n.bucket.sdfIcons=se:n.bucket.sdfIcons!==se&&ki("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(D.pixelRatio!==n.bucket.pixelRatio||r.get("icon-rotate").constantOr(1)!==0)&&(n.bucket.iconsNeedLinear=!0))}const J=gg(F.horizontal)||F.vertical;n.bucket.iconsInText=!!J&&J.iconsInText,(J||U)&&cv(n.bucket,b,F,U,n.imageMap,c,k,L,H,se,n.canonical,n.subdivisionGranularity)}n.showCollisionBoxes&&n.bucket.generateCollisionDebugBuffers()},P.cH=ep,P.cI=Hd,P.cJ=Qd,P.cK=Bc,P.cL=rp,P.cM=class{constructor(n){this._marks={start:[n.url,"start"].join("#"),end:[n.url,"end"].join("#"),measure:n.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let n=performance.getEntriesByName(this._marks.measure);return n.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),n=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),n}},P.cN=function(n,t,r,a,c){return o(this,void 0,void 0,function*(){if(li())try{return yield ia(n,t,r,a,c)}catch{}return function(d,p,m,y,b){const S=d.width,C=d.height;fn&&ra||(fn=new OffscreenCanvas(S,C),ra=fn.getContext("2d",{willReadFrequently:!0})),fn.width=S,fn.height=C,ra.drawImage(d,0,0,S,C);const k=ra.getImageData(p,m,y,b);return ra.clearRect(0,0,S,C),k.data}(n,t,r,a,c)})},P.cO=im,P.cP=ye,P.cQ=Ve,P.cR=xm,P.cS=zm,P.cT=Wo,P.cU=Vn,P.ca=n=>n.type==="symbol",P.cb=n=>n.type==="circle",P.cc=n=>n.type==="heatmap",P.cd=n=>n.type==="line",P.ce=n=>n.type==="fill",P.cf=n=>n.type==="fill-extrusion",P.cg=n=>n.type==="hillshade",P.ch=n=>n.type==="color-relief",P.ci=n=>n.type==="raster",P.cj=n=>n.type==="background",P.ck=n=>n.type==="custom",P.cl=Or,P.cm=function(n,t,r){const a=Wi(t.x-r.x,t.y-r.y),c=Wi(n.x-r.x,n.y-r.y);var d,p;return tn(Math.atan2(a[0]*c[1]-a[1]*c[0],(d=a)[0]*(p=c)[0]+d[1]*p[1]))},P.cn=ka,P.co=function(n,t){return Mo[t]&&(n instanceof MouseEvent||n instanceof WheelEvent)},P.cp=function(n,t){return ys[t]&&"touches"in n},P.cq=function(n){return ys[n]||Mo[n]},P.cr=function(n,t,r){var a=t[0],c=t[1];return n[0]=r[0]*a+r[4]*c+r[12],n[1]=r[1]*a+r[5]*c+r[13],n},P.cs=function(n,t){const{x:r,y:a}=Zc.fromLngLat(t);return!(n<0||n>25||a<0||a>=1||r<0||r>=1)},P.ct=function(n,t){return n[0]=t[0],n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=t[1],n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=t[2],n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,n},P.cu=class extends Un{},P.cv=hv,P.cx=function(n){return n.message===gn},P.cy=Q,P.cz=function(n,t){N.REGISTERED_PROTOCOLS[n]=t},P.d=ge,P.e=Hi,P.f=n=>o(void 0,void 0,void 0,function*(){if(n.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(n)],{type:"image/png"});try{return createImageBitmap(t)}catch(r){throw new Error(`Could not load image because of ${r.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),P.g=V,P.h=n=>new Promise((t,r)=>{const a=new Image;a.onload=()=>{t(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=_s})},a.onerror=()=>r(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(n)],{type:"image/png"});a.src=n.byteLength?URL.createObjectURL(c):_s}),P.i=rr,P.j=(n,t)=>ue(Hi(n,{type:"json"}),t),P.k=de,P.l=we,P.m=ue,P.n=(n,t)=>ue(Hi(n,{type:"arrayBuffer"}),t),P.o=function(n){return new rp(n).readFields(Lx,[])},P.p=km,P.q=Ac,P.r=Ji,P.s=mn,P.t=vc,P.u=yt,P.v=ne,P.w=ki,P.x=Ad,P.y=$s,P.z=rs}),z("worker",["./shared"],function(P){class o{constructor(N){this.keyCache={},N&&this.replace(N)}replace(N){this._layerConfigs={},this._layers={},this.update(N,[])}update(N,V){for(const Q of N){this._layerConfigs[Q.id]=Q;const ae=this._layers[Q.id]=P.bI(Q);ae._featureFilter=P.a9(ae.filter),this.keyCache[Q.id]&&delete this.keyCache[Q.id]}for(const Q of V)delete this.keyCache[Q],delete this._layerConfigs[Q],delete this._layers[Q];this.familiesBySource={};const G=P.cB(Object.values(this._layerConfigs),this.keyCache);for(const Q of G){const ae=Q.map(de=>this._layers[de.id]),ue=ae[0];if(ue.visibility==="none")continue;const ge=ue.source||"";let le=this.familiesBySource[ge];le||(le=this.familiesBySource[ge]={});const Se=ue.sourceLayer||"_geojsonTileLayer";let we=le[Se];we||(we=le[Se]=[]),we.push(ae)}}}class ye{constructor(N){const V={},G=[];for(const ge in N){const le=N[ge],Se=V[ge]={};for(const we in le){const de=le[+we];if(!de||de.bitmap.width===0||de.bitmap.height===0)continue;const Me={x:0,y:0,w:de.bitmap.width+2,h:de.bitmap.height+2};G.push(Me),Se[we]={rect:Me,metrics:de.metrics}}}const{w:Q,h:ae}=P.p(G),ue=new P.q({width:Q||1,height:ae||1});for(const ge in N){const le=N[ge];for(const Se in le){const we=le[+Se];if(!we||we.bitmap.width===0||we.bitmap.height===0)continue;const de=V[ge][Se].rect;P.q.copy(we.bitmap,ue,{x:0,y:0},{x:de.x+1,y:de.y+1},we.bitmap)}}this.image=ue,this.positions=V}}P.cC("GlyphAtlas",ye);class be{constructor(N){this.tileID=new P.Z(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=[],this.globalState=N.globalState}parse(N,V,G,Q,ae){return P._(this,void 0,void 0,function*(){this.status="parsing",this.data=N,this.collisionBoxArray=new P.a7;const ue=new P.cD(Object.keys(N.layers).sort()),ge=new P.cE(this.tileID,this.promoteId);ge.bucketLayerIDs=[];const le={},Se={featureIndex:ge,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:G,subdivisionGranularity:ae},we=V.familiesBySource[this.source];for(const rt in we){const vt=N.layers[rt];if(!vt)continue;vt.version===1&&P.w(`Vector tile source "${this.source}" layer "${rt}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const wi=ue.encode(rt),De=[];for(let Ri=0;Ri<vt.length;Ri++){const Ht=vt.feature(Ri),Fn=ge.getId(Ht,rt);De.push({feature:Ht,id:Fn,index:Ri,sourceLayerIndex:wi})}for(const Ri of we[rt]){const Ht=Ri[0];Ht.source!==this.source&&P.w(`layer.source = ${Ht.source} does not equal this.source = ${this.source}`),Ht.minzoom&&this.zoom<Math.floor(Ht.minzoom)||Ht.maxzoom&&this.zoom>=Ht.maxzoom||Ht.visibility!=="none"&&(Re(Ri,this.zoom,G),(le[Ht.id]=Ht.createBucket({index:ge.bucketLayerIDs.length,layers:Ri,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:wi,sourceID:this.source,globalState:this.globalState})).populate(De,Se,this.tileID.canonical),ge.bucketLayerIDs.push(Ri.map(Fn=>Fn.id)))}}const de=P.bM(Se.glyphDependencies,rt=>Object.keys(rt).map(Number));this.inFlightDependencies.forEach(rt=>rt==null?void 0:rt.abort()),this.inFlightDependencies=[];let Me=Promise.resolve({});if(Object.keys(de).length){const rt=new AbortController;this.inFlightDependencies.push(rt),Me=Q.sendAsync({type:"GG",data:{stacks:de,source:this.source,tileID:this.tileID,type:"glyphs"}},rt)}const ne=Object.keys(Se.iconDependencies);let Ne=Promise.resolve({});if(ne.length){const rt=new AbortController;this.inFlightDependencies.push(rt),Ne=Q.sendAsync({type:"GI",data:{icons:ne,source:this.source,tileID:this.tileID,type:"icons"}},rt)}const tt=Object.keys(Se.patternDependencies);let Ue=Promise.resolve({});if(tt.length){const rt=new AbortController;this.inFlightDependencies.push(rt),Ue=Q.sendAsync({type:"GI",data:{icons:tt,source:this.source,tileID:this.tileID,type:"patterns"}},rt)}const[Ye,nt,Zt]=yield Promise.all([Me,Ne,Ue]),zt=new ye(Ye),Pt=new P.cF(nt,Zt);for(const rt in le){const vt=le[rt];vt instanceof P.a8?(Re(vt.layers,this.zoom,G),P.cG({bucket:vt,glyphMap:Ye,glyphPositions:zt.positions,imageMap:nt,imagePositions:Pt.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:Se.subdivisionGranularity})):vt.hasPattern&&(vt instanceof P.cH||vt instanceof P.cI||vt instanceof P.cJ)&&(Re(vt.layers,this.zoom,G),vt.addFeatures(Se,this.tileID.canonical,Pt.patternPositions))}return this.status="done",{buckets:Object.values(le).filter(rt=>!rt.isEmpty()),featureIndex:ge,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:zt.image,imageAtlas:Pt,glyphMap:this.returnDependencies?Ye:null,iconMap:this.returnDependencies?nt:null,glyphPositions:this.returnDependencies?zt.positions:null}})}}function Re(he,N,V){const G=new P.F(N);for(const Q of he)Q.recalculate(G,V)}class Ve{constructor(N,V,G){this.actor=N,this.layerIndex=V,this.availableImages=G,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(N,V){return P._(this,void 0,void 0,function*(){const G=yield P.n(N.request,V);try{return{vectorTile:new P.cK.VectorTile(new P.cL(G.data)),rawData:G.data,cacheControl:G.cacheControl,expires:G.expires}}catch(Q){const ae=new Uint8Array(G.data);let ue=`Unable to parse the tile at ${N.request.url}, `;throw ue+=ae[0]===31&&ae[1]===139?"please make sure the data is not gzipped and that you have configured the relevant header in the server":`got error: ${Q.message}`,new Error(ue)}})}loadTile(N){return P._(this,void 0,void 0,function*(){const V=N.uid,G=!!(N&&N.request&&N.request.collectResourceTiming)&&new P.cM(N.request),Q=new be(N);this.loading[V]=Q;const ae=new AbortController;Q.abort=ae;try{const ue=yield this.loadVectorTile(N,ae);if(delete this.loading[V],!ue)return null;const ge=ue.rawData,le={};ue.expires&&(le.expires=ue.expires),ue.cacheControl&&(le.cacheControl=ue.cacheControl);const Se={};if(G){const de=G.finish();de&&(Se.resourceTiming=JSON.parse(JSON.stringify(de)))}Q.vectorTile=ue.vectorTile;const we=Q.parse(ue.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);this.loaded[V]=Q,this.fetching[V]={rawTileData:ge,cacheControl:le,resourceTiming:Se};try{const de=yield we;return P.e({rawTileData:ge.slice(0)},de,le,Se)}finally{delete this.fetching[V]}}catch(ue){throw delete this.loading[V],Q.status="done",this.loaded[V]=Q,ue}})}reloadTile(N){return P._(this,void 0,void 0,function*(){const V=N.uid;if(!this.loaded||!this.loaded[V])throw new Error("Should not be trying to reload a tile that was never loaded or has been removed");const G=this.loaded[V];if(G.showCollisionBoxes=N.showCollisionBoxes,G.globalState=N.globalState,G.status==="parsing"){const Q=yield G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity);let ae;if(this.fetching[V]){const{rawTileData:ue,cacheControl:ge,resourceTiming:le}=this.fetching[V];delete this.fetching[V],ae=P.e({rawTileData:ue.slice(0)},Q,ge,le)}else ae=Q;return ae}if(G.status==="done"&&G.vectorTile)return G.parse(G.vectorTile,this.layerIndex,this.availableImages,this.actor,N.subdivisionGranularity)})}abortTile(N){return P._(this,void 0,void 0,function*(){const V=this.loading,G=N.uid;V&&V[G]&&V[G].abort&&(V[G].abort.abort(),delete V[G])})}removeTile(N){return P._(this,void 0,void 0,function*(){this.loaded&&this.loaded[N.uid]&&delete this.loaded[N.uid]})}}class Ae{constructor(){this.loaded={}}loadTile(N){return P._(this,void 0,void 0,function*(){const{uid:V,encoding:G,rawImageData:Q,redFactor:ae,greenFactor:ue,blueFactor:ge,baseShift:le}=N,Se=Q.width+2,we=Q.height+2,de=P.b(Q)?new P.R({width:Se,height:we},yield P.cN(Q,-1,-1,Se,we)):Q,Me=new P.cO(V,de,G,ae,ue,ge,le);return this.loaded=this.loaded||{},this.loaded[V]=Me,Me})}removeTile(N){const V=this.loaded,G=N.uid;V&&V[G]&&delete V[G]}}var ce,Be,Rt=function(){if(Be)return ce;function he(V,G){if(V.length!==0){N(V[0],G);for(var Q=1;Q<V.length;Q++)N(V[Q],!G)}}function N(V,G){for(var Q=0,ae=0,ue=0,ge=V.length,le=ge-1;ue<ge;le=ue++){var Se=(V[ue][0]-V[le][0])*(V[le][1]+V[ue][1]),we=Q+Se;ae+=Math.abs(Q)>=Math.abs(Se)?Q-we+Se:Se-we+Q,Q=we}Q+ae>=0!=!!G&&V.reverse()}return Be=1,ce=function V(G,Q){var ae,ue=G&&G.type;if(ue==="FeatureCollection")for(ae=0;ae<G.features.length;ae++)V(G.features[ae],Q);else if(ue==="GeometryCollection")for(ae=0;ae<G.geometries.length;ae++)V(G.geometries[ae],Q);else if(ue==="Feature")V(G.geometry,Q);else if(ue==="Polygon")he(G.coordinates,Q);else if(ue==="MultiPolygon")for(ae=0;ae<G.coordinates.length;ae++)he(G.coordinates[ae],Q);return G}}(),ft=P.cP(Rt);const di=P.cK.VectorTileFeature.prototype.toGeoJSON;class Dt{constructor(N){this._feature=N,this.extent=P.$,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 V of this._feature.geometry)N.push([new P.P(V[0],V[1])]);return N}{const N=[];for(const V of this._feature.geometry){const G=[];for(const Q of V)G.push(new P.P(Q[0],Q[1]));N.push(G)}return N}}toGeoJSON(N,V,G){return di.call(this,N,V,G)}}class Lt{constructor(N){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=P.$,this.length=N.length,this._features=N}feature(N){return new Dt(this._features[N])}}var li,Ft,jt,hr={exports:{}},ea=function(){if(jt)return hr.exports;jt=1;var he=P.cS(),N=function(){if(Ft)return li;Ft=1;var we=P.cQ(),de=P.cR().VectorTileFeature;function Me(Ne,tt){this.options=tt||{},this.features=Ne,this.length=Ne.length}function ne(Ne,tt){this.id=typeof Ne.id=="number"?Ne.id:void 0,this.type=Ne.type,this.rawGeometry=Ne.type===1?[Ne.geometry]:Ne.geometry,this.properties=Ne.tags,this.extent=tt||4096}return li=Me,Me.prototype.feature=function(Ne){return new ne(this.features[Ne],this.options.extent)},ne.prototype.loadGeometry=function(){var Ne=this.rawGeometry;this.geometry=[];for(var tt=0;tt<Ne.length;tt++){for(var Ue=Ne[tt],Ye=[],nt=0;nt<Ue.length;nt++)Ye.push(new we(Ue[nt][0],Ue[nt][1]));this.geometry.push(Ye)}return this.geometry},ne.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Ne=this.geometry,tt=1/0,Ue=-1/0,Ye=1/0,nt=-1/0,Zt=0;Zt<Ne.length;Zt++)for(var zt=Ne[Zt],Pt=0;Pt<zt.length;Pt++){var rt=zt[Pt];tt=Math.min(tt,rt.x),Ue=Math.max(Ue,rt.x),Ye=Math.min(Ye,rt.y),nt=Math.max(nt,rt.y)}return[tt,Ye,Ue,nt]},ne.prototype.toGeoJSON=de.prototype.toGeoJSON,li}();function V(we){var de=new he;return function(Me,ne){for(var Ne in Me.layers)ne.writeMessage(3,G,Me.layers[Ne])}(we,de),de.finish()}function G(we,de){var Me;de.writeVarintField(15,we.version||1),de.writeStringField(1,we.name||""),de.writeVarintField(5,we.extent||4096);var ne={keys:[],values:[],keycache:{},valuecache:{}};for(Me=0;Me<we.length;Me++)ne.feature=we.feature(Me),de.writeMessage(2,Q,ne);var Ne=ne.keys;for(Me=0;Me<Ne.length;Me++)de.writeStringField(3,Ne[Me]);var tt=ne.values;for(Me=0;Me<tt.length;Me++)de.writeMessage(4,Se,tt[Me])}function Q(we,de){var Me=we.feature;Me.id!==void 0&&de.writeVarintField(1,Me.id),de.writeMessage(2,ae,we),de.writeVarintField(3,Me.type),de.writeMessage(4,le,Me)}function ae(we,de){var Me=we.feature,ne=we.keys,Ne=we.values,tt=we.keycache,Ue=we.valuecache;for(var Ye in Me.properties){var nt=Me.properties[Ye],Zt=tt[Ye];if(nt!==null){Zt===void 0&&(ne.push(Ye),tt[Ye]=Zt=ne.length-1),de.writeVarint(Zt);var zt=typeof nt;zt!=="string"&&zt!=="boolean"&&zt!=="number"&&(nt=JSON.stringify(nt));var Pt=zt+":"+nt,rt=Ue[Pt];rt===void 0&&(Ne.push(nt),Ue[Pt]=rt=Ne.length-1),de.writeVarint(rt)}}}function ue(we,de){return(de<<3)+(7&we)}function ge(we){return we<<1^we>>31}function le(we,de){for(var Me=we.loadGeometry(),ne=we.type,Ne=0,tt=0,Ue=Me.length,Ye=0;Ye<Ue;Ye++){var nt=Me[Ye],Zt=1;ne===1&&(Zt=nt.length),de.writeVarint(ue(1,Zt));for(var zt=ne===3?nt.length-1:nt.length,Pt=0;Pt<zt;Pt++){Pt===1&&ne!==1&&de.writeVarint(ue(2,zt-1));var rt=nt[Pt].x-Ne,vt=nt[Pt].y-tt;de.writeVarint(ge(rt)),de.writeVarint(ge(vt)),Ne+=rt,tt+=vt}ne===3&&de.writeVarint(ue(7,1))}}function Se(we,de){var Me=typeof we;Me==="string"?de.writeStringField(1,we):Me==="boolean"?de.writeBooleanField(7,we):Me==="number"&&(we%1!=0?de.writeDoubleField(3,we):we<0?de.writeSVarintField(6,we):de.writeVarintField(5,we))}return hr.exports=V,hr.exports.fromVectorTileJs=V,hr.exports.fromGeojsonVt=function(we,de){de=de||{};var Me={};for(var ne in we)Me[ne]=new N(we[ne].features,de),Me[ne].name=ne,Me[ne].version=de.version,Me[ne].extent=de.extent;return V({layers:Me})},hr.exports.GeoJSONWrapper=N,hr.exports}(),dn=P.cP(ea);const Kr={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:he=>he},pn=Math.fround||(Tr=new Float32Array(1),he=>(Tr[0]=+he,Tr[0]));var Tr;class qi{constructor(N){this.options=Object.assign(Object.create(Kr),N),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(N){const{log:V,minZoom:G,maxZoom:Q}=this.options;V&&console.time("total time");const ae=`prepare ${N.length} points`;V&&console.time(ae),this.points=N;const ue=[];for(let le=0;le<N.length;le++){const Se=N[le];if(!Se.geometry)continue;const[we,de]=Se.geometry.coordinates,Me=pn(St(we)),ne=pn(zi(de));ue.push(Me,ne,1/0,le,-1,1),this.options.reduce&&ue.push(0)}let ge=this.trees[Q+1]=this._createTree(ue);V&&console.timeEnd(ae);for(let le=Q;le>=G;le--){const Se=+Date.now();ge=this.trees[le]=this._createTree(this._cluster(ge,le)),V&&console.log("z%d: %d clusters in %dms",le,ge.numItems,+Date.now()-Se)}return V&&console.timeEnd("total time"),this}getClusters(N,V){let G=((N[0]+180)%360+360)%360-180;const Q=Math.max(-90,Math.min(90,N[1]));let ae=N[2]===180?180:((N[2]+180)%360+360)%360-180;const ue=Math.max(-90,Math.min(90,N[3]));if(N[2]-N[0]>=360)G=-180,ae=180;else if(G>ae){const de=this.getClusters([G,Q,180,ue],V),Me=this.getClusters([-180,Q,ae,ue],V);return de.concat(Me)}const ge=this.trees[this._limitZoom(V)],le=ge.range(St(G),zi(ue),St(ae),zi(Q)),Se=ge.data,we=[];for(const de of le){const Me=this.stride*de;we.push(Se[Me+5]>1?Jr(Se,Me,this.clusterProps):this.points[Se[Me+3]])}return we}getChildren(N){const V=this._getOriginId(N),G=this._getOriginZoom(N),Q="No cluster with the specified id.",ae=this.trees[G];if(!ae)throw new Error(Q);const ue=ae.data;if(V*this.stride>=ue.length)throw new Error(Q);const ge=this.options.radius/(this.options.extent*Math.pow(2,G-1)),le=ae.within(ue[V*this.stride],ue[V*this.stride+1],ge),Se=[];for(const we of le){const de=we*this.stride;ue[de+4]===N&&Se.push(ue[de+5]>1?Jr(ue,de,this.clusterProps):this.points[ue[de+3]])}if(Se.length===0)throw new Error(Q);return Se}getLeaves(N,V,G){const Q=[];return this._appendLeaves(Q,N,V=V||10,G=G||0,0),Q}getTile(N,V,G){const Q=this.trees[this._limitZoom(N)],ae=Math.pow(2,N),{extent:ue,radius:ge}=this.options,le=ge/ue,Se=(G-le)/ae,we=(G+1+le)/ae,de={features:[]};return this._addTileFeatures(Q.range((V-le)/ae,Se,(V+1+le)/ae,we),Q.data,V,G,ae,de),V===0&&this._addTileFeatures(Q.range(1-le/ae,Se,1,we),Q.data,ae,G,ae,de),V===ae-1&&this._addTileFeatures(Q.range(0,Se,le/ae,we),Q.data,-1,G,ae,de),de.features.length?de:null}getClusterExpansionZoom(N){let V=this._getOriginZoom(N)-1;for(;V<=this.options.maxZoom;){const G=this.getChildren(N);if(V++,G.length!==1)break;N=G[0].properties.cluster_id}return V}_appendLeaves(N,V,G,Q,ae){const ue=this.getChildren(V);for(const ge of ue){const le=ge.properties;if(le&&le.cluster?ae+le.point_count<=Q?ae+=le.point_count:ae=this._appendLeaves(N,le.cluster_id,G,Q,ae):ae<Q?ae++:N.push(ge),N.length===G)break}return ae}_createTree(N){const V=new P.aH(N.length/this.stride|0,this.options.nodeSize,Float32Array);for(let G=0;G<N.length;G+=this.stride)V.add(N[G],N[G+1]);return V.finish(),V.data=N,V}_addTileFeatures(N,V,G,Q,ae,ue){for(const ge of N){const le=ge*this.stride,Se=V[le+5]>1;let we,de,Me;if(Se)we=dr(V,le,this.clusterProps),de=V[le],Me=V[le+1];else{const tt=this.points[V[le+3]];we=tt.properties;const[Ue,Ye]=tt.geometry.coordinates;de=St(Ue),Me=zi(Ye)}const ne={type:1,geometry:[[Math.round(this.options.extent*(de*ae-G)),Math.round(this.options.extent*(Me*ae-Q))]],tags:we};let Ne;Ne=Se||this.options.generateId?V[le+3]:this.points[V[le+3]].id,Ne!==void 0&&(ne.id=Ne),ue.features.push(ne)}}_limitZoom(N){return Math.max(this.options.minZoom,Math.min(Math.floor(+N),this.options.maxZoom+1))}_cluster(N,V){const{radius:G,extent:Q,reduce:ae,minPoints:ue}=this.options,ge=G/(Q*Math.pow(2,V)),le=N.data,Se=[],we=this.stride;for(let de=0;de<le.length;de+=we){if(le[de+2]<=V)continue;le[de+2]=V;const Me=le[de],ne=le[de+1],Ne=N.within(le[de],le[de+1],ge),tt=le[de+5];let Ue=tt;for(const Ye of Ne){const nt=Ye*we;le[nt+2]>V&&(Ue+=le[nt+5])}if(Ue>tt&&Ue>=ue){let Ye,nt=Me*tt,Zt=ne*tt,zt=-1;const Pt=(de/we<<5)+(V+1)+this.points.length;for(const rt of Ne){const vt=rt*we;if(le[vt+2]<=V)continue;le[vt+2]=V;const wi=le[vt+5];nt+=le[vt]*wi,Zt+=le[vt+1]*wi,le[vt+4]=Pt,ae&&(Ye||(Ye=this._map(le,de,!0),zt=this.clusterProps.length,this.clusterProps.push(Ye)),ae(Ye,this._map(le,vt)))}le[de+4]=Pt,Se.push(nt/Ue,Zt/Ue,1/0,Pt,-1,Ue),ae&&Se.push(zt)}else{for(let Ye=0;Ye<we;Ye++)Se.push(le[de+Ye]);if(Ue>1)for(const Ye of Ne){const nt=Ye*we;if(!(le[nt+2]<=V)){le[nt+2]=V;for(let Zt=0;Zt<we;Zt++)Se.push(le[nt+Zt])}}}}return Se}_getOriginId(N){return N-this.points.length>>5}_getOriginZoom(N){return(N-this.points.length)%32}_map(N,V,G){if(N[V+5]>1){const ue=this.clusterProps[N[V+6]];return G?Object.assign({},ue):ue}const Q=this.points[N[V+3]].properties,ae=this.options.map(Q);return G&&ae===Q?Object.assign({},ae):ae}}function Jr(he,N,V){return{type:"Feature",id:he[N+3],properties:dr(he,N,V),geometry:{type:"Point",coordinates:[(G=he[N],360*(G-.5)),Lr(he[N+1])]}};var G}function dr(he,N,V){const G=he[N+5],Q=G>=1e4?`${Math.round(G/1e3)}k`:G>=1e3?Math.round(G/100)/10+"k":G,ae=he[N+6],ue=ae===-1?{}:Object.assign({},V[ae]);return Object.assign(ue,{cluster:!0,cluster_id:he[N+3],point_count:G,point_count_abbreviated:Q})}function St(he){return he/360+.5}function zi(he){const N=Math.sin(he*Math.PI/180),V=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return V<0?0:V>1?1:V}function Lr(he){const N=(180-360*he)*Math.PI/180;return 360*Math.atan(Math.exp(N))/Math.PI-90}function tr(he,N,V,G){let Q=G;const ae=N+(V-N>>1);let ue,ge=V-N;const le=he[N],Se=he[N+1],we=he[V],de=he[V+1];for(let Me=N+3;Me<V;Me+=3){const ne=Fr(he[Me],he[Me+1],le,Se,we,de);if(ne>Q)ue=Me,Q=ne;else if(ne===Q){const Ne=Math.abs(Me-ae);Ne<ge&&(ue=Me,ge=Ne)}}Q>G&&(ue-N>3&&tr(he,N,ue,G),he[ue+2]=Q,V-ue>3&&tr(he,ue,V,G))}function Fr(he,N,V,G,Q,ae){let ue=Q-V,ge=ae-G;if(ue!==0||ge!==0){const le=((he-V)*ue+(N-G)*ge)/(ue*ue+ge*ge);le>1?(V=Q,G=ae):le>0&&(V+=ue*le,G+=ge*le)}return ue=he-V,ge=N-G,ue*ue+ge*ge}function Wi(he,N,V,G){const Q={id:he??null,type:N,geometry:V,tags:G,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(N==="Point"||N==="MultiPoint"||N==="LineString")At(Q,V);else if(N==="Polygon")At(Q,V[0]);else if(N==="MultiLineString")for(const ae of V)At(Q,ae);else if(N==="MultiPolygon")for(const ae of V)At(Q,ae[0]);return Q}function At(he,N){for(let V=0;V<N.length;V+=3)he.minX=Math.min(he.minX,N[V]),he.minY=Math.min(he.minY,N[V+1]),he.maxX=Math.max(he.maxX,N[V]),he.maxY=Math.max(he.maxY,N[V+1])}function pr(he,N,V,G){if(!N.geometry)return;const Q=N.geometry.coordinates;if(Q&&Q.length===0)return;const ae=N.geometry.type,ue=Math.pow(V.tolerance/((1<<V.maxZoom)*V.extent),2);let ge=[],le=N.id;if(V.promoteId?le=N.properties[V.promoteId]:V.generateId&&(le=G||0),ae==="Point")ir(Q,ge);else if(ae==="MultiPoint")for(const Se of Q)ir(Se,ge);else if(ae==="LineString")Qr(Q,ge,ue,!1);else if(ae==="MultiLineString"){if(V.lineMetrics){for(const Se of Q)ge=[],Qr(Se,ge,ue,!1),he.push(Wi(le,"LineString",ge,N.properties));return}Br(Q,ge,ue,!1)}else if(ae==="Polygon")Br(Q,ge,ue,!0);else{if(ae!=="MultiPolygon"){if(ae==="GeometryCollection"){for(const Se of N.geometry.geometries)pr(he,{id:le,geometry:Se,properties:N.properties},V,G);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const Se of Q){const we=[];Br(Se,we,ue,!0),ge.push(we)}}he.push(Wi(le,ae,ge,N.properties))}function ir(he,N){N.push(Or(he[0]),ka(he[1]),0)}function Qr(he,N,V,G){let Q,ae,ue=0;for(let le=0;le<he.length;le++){const Se=Or(he[le][0]),we=ka(he[le][1]);N.push(Se,we,0),le>0&&(ue+=G?(Q*we-Se*ae)/2:Math.sqrt(Math.pow(Se-Q,2)+Math.pow(we-ae,2))),Q=Se,ae=we}const ge=N.length-3;N[2]=1,tr(N,0,ge,V),N[ge+2]=1,N.size=Math.abs(ue),N.start=0,N.end=N.size}function Br(he,N,V,G){for(let Q=0;Q<he.length;Q++){const ae=[];Qr(he[Q],ae,V,G),N.push(ae)}}function Or(he){return he/360+.5}function ka(he){const N=Math.sin(he*Math.PI/180),V=.5-.25*Math.log((1+N)/(1-N))/Math.PI;return V<0?0:V>1?1:V}function ci(he,N,V,G,Q,ae,ue,ge){if(G/=N,ae>=(V/=N)&&ue<G)return he;if(ue<V||ae>=G)return null;const le=[];for(const Se of he){const we=Se.geometry;let de=Se.type;const Me=Q===0?Se.minX:Se.minY,ne=Q===0?Se.maxX:Se.maxY;if(Me>=V&&ne<G){le.push(Se);continue}if(ne<V||Me>=G)continue;let Ne=[];if(de==="Point"||de==="MultiPoint")Dn(we,Ne,V,G,Q);else if(de==="LineString")Hi(we,Ne,V,G,Q,!1,ge.lineMetrics);else if(de==="MultiLineString")ii(we,Ne,V,G,Q,!1);else if(de==="Polygon")ii(we,Ne,V,G,Q,!0);else if(de==="MultiPolygon")for(const tt of we){const Ue=[];ii(tt,Ue,V,G,Q,!0),Ue.length&&Ne.push(Ue)}if(Ne.length){if(ge.lineMetrics&&de==="LineString"){for(const tt of Ne)le.push(Wi(Se.id,de,tt,Se.tags));continue}de!=="LineString"&&de!=="MultiLineString"||(Ne.length===1?(de="LineString",Ne=Ne[0]):de="MultiLineString"),de!=="Point"&&de!=="MultiPoint"||(de=Ne.length===3?"Point":"MultiPoint"),le.push(Wi(Se.id,de,Ne,Se.tags))}}return le.length?le:null}function Dn(he,N,V,G,Q){for(let ae=0;ae<he.length;ae+=3){const ue=he[ae+Q];ue>=V&&ue<=G&&en(N,he[ae],he[ae+1],he[ae+2])}}function Hi(he,N,V,G,Q,ae,ue){let ge=gs(he);const le=Q===0?Sr:Ra;let Se,we,de=he.start;for(let Ue=0;Ue<he.length-3;Ue+=3){const Ye=he[Ue],nt=he[Ue+1],Zt=he[Ue+2],zt=he[Ue+3],Pt=he[Ue+4],rt=Q===0?Ye:nt,vt=Q===0?zt:Pt;let wi=!1;ue&&(Se=Math.sqrt(Math.pow(Ye-zt,2)+Math.pow(nt-Pt,2))),rt<V?vt>V&&(we=le(ge,Ye,nt,zt,Pt,V),ue&&(ge.start=de+Se*we)):rt>G?vt<G&&(we=le(ge,Ye,nt,zt,Pt,G),ue&&(ge.start=de+Se*we)):en(ge,Ye,nt,Zt),vt<V&&rt>=V&&(we=le(ge,Ye,nt,zt,Pt,V),wi=!0),vt>G&&rt<=G&&(we=le(ge,Ye,nt,zt,Pt,G),wi=!0),!ae&&wi&&(ue&&(ge.end=de+Se*we),N.push(ge),ge=gs(he)),ue&&(de+=Se)}let Me=he.length-3;const ne=he[Me],Ne=he[Me+1],tt=Q===0?ne:Ne;tt>=V&&tt<=G&&en(ge,ne,Ne,he[Me+2]),Me=ge.length-3,ae&&Me>=3&&(ge[Me]!==ge[0]||ge[Me+1]!==ge[1])&&en(ge,ge[0],ge[1],ge[2]),ge.length&&N.push(ge)}function gs(he){const N=[];return N.size=he.size,N.start=he.start,N.end=he.end,N}function ii(he,N,V,G,Q,ae){for(const ue of he)Hi(ue,N,V,G,Q,ae,!1)}function en(he,N,V,G){he.push(N,V,G)}function Sr(he,N,V,G,Q,ae){const ue=(ae-N)/(G-N);return en(he,ae,V+(Q-V)*ue,1),ue}function Ra(he,N,V,G,Q,ae){const ue=(ae-V)/(Q-V);return en(he,N+(G-N)*ue,ae,1),ue}function ki(he,N){const V=[];for(let G=0;G<he.length;G++){const Q=he[G],ae=Q.type;let ue;if(ae==="Point"||ae==="MultiPoint"||ae==="LineString")ue=fr(Q.geometry,N);else if(ae==="MultiLineString"||ae==="Polygon"){ue=[];for(const ge of Q.geometry)ue.push(fr(ge,N))}else if(ae==="MultiPolygon"){ue=[];for(const ge of Q.geometry){const le=[];for(const Se of ge)le.push(fr(Se,N));ue.push(le)}}V.push(Wi(Q.id,ae,ue,Q.tags))}return V}function fr(he,N){const V=[];V.size=he.size,he.start!==void 0&&(V.start=he.start,V.end=he.end);for(let G=0;G<he.length;G+=3)V.push(he[G]+N,he[G+1],he[G+2]);return V}function rr(he,N){if(he.transformed)return he;const V=1<<he.z,G=he.x,Q=he.y;for(const ae of he.features){const ue=ae.geometry,ge=ae.type;if(ae.geometry=[],ge===1)for(let le=0;le<ue.length;le+=2)ae.geometry.push(ta(ue[le],ue[le+1],N,V,G,Q));else for(let le=0;le<ue.length;le++){const Se=[];for(let we=0;we<ue[le].length;we+=2)Se.push(ta(ue[le][we],ue[le][we+1],N,V,G,Q));ae.geometry.push(Se)}}return he.transformed=!0,he}function ta(he,N,V,G,Q,ae){return[Math.round(V*(he*G-Q)),Math.round(V*(N*G-ae))]}function Ln(he,N,V,G,Q){const ae=N===Q.maxZoom?0:Q.tolerance/((1<<N)*Q.extent),ue={features:[],numPoints:0,numSimplified:0,numFeatures:he.length,source:null,x:V,y:G,z:N,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const ge of he)_s(ue,ge,ae,Q);return ue}function _s(he,N,V,G){const Q=N.geometry,ae=N.type,ue=[];if(he.minX=Math.min(he.minX,N.minX),he.minY=Math.min(he.minY,N.minY),he.maxX=Math.max(he.maxX,N.maxX),he.maxY=Math.max(he.maxY,N.maxY),ae==="Point"||ae==="MultiPoint")for(let ge=0;ge<Q.length;ge+=3)ue.push(Q[ge],Q[ge+1]),he.numPoints++,he.numSimplified++;else if(ae==="LineString")ia(ue,Q,he,V,!1,!1);else if(ae==="MultiLineString"||ae==="Polygon")for(let ge=0;ge<Q.length;ge++)ia(ue,Q[ge],he,V,ae==="Polygon",ge===0);else if(ae==="MultiPolygon")for(let ge=0;ge<Q.length;ge++){const le=Q[ge];for(let Se=0;Se<le.length;Se++)ia(ue,le[Se],he,V,!0,Se===0)}if(ue.length){let ge=N.tags||null;if(ae==="LineString"&&G.lineMetrics){ge={};for(const Se in N.tags)ge[Se]=N.tags[Se];ge.mapbox_clip_start=Q.start/Q.size,ge.mapbox_clip_end=Q.end/Q.size}const le={geometry:ue,type:ae==="Polygon"||ae==="MultiPolygon"?3:ae==="LineString"||ae==="MultiLineString"?2:1,tags:ge};N.id!==null&&(le.id=N.id),he.features.push(le)}}function ia(he,N,V,G,Q,ae){const ue=G*G;if(G>0&&N.size<(Q?ue:G))return void(V.numPoints+=N.length/3);const ge=[];for(let le=0;le<N.length;le+=3)(G===0||N[le+2]>ue)&&(V.numSimplified++,ge.push(N[le],N[le+1])),V.numPoints++;Q&&function(le,Se){let we=0;for(let de=0,Me=le.length,ne=Me-2;de<Me;ne=de,de+=2)we+=(le[de]-le[ne])*(le[de+1]+le[ne+1]);if(we>0===Se)for(let de=0,Me=le.length;de<Me/2;de+=2){const ne=le[de],Ne=le[de+1];le[de]=le[Me-2-de],le[de+1]=le[Me-1-de],le[Me-2-de]=ne,le[Me-1-de]=Ne}}(ge,ae),he.push(ge)}const fn={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class ra{constructor(N,V){const G=(V=this.options=function(ae,ue){for(const ge in ue)ae[ge]=ue[ge];return ae}(Object.create(fn),V)).debug;if(G&&console.time("preprocess data"),V.maxZoom<0||V.maxZoom>24)throw new Error("maxZoom should be in the 0-24 range");if(V.promoteId&&V.generateId)throw new Error("promoteId and generateId cannot be used together.");let Q=function(ae,ue){const ge=[];if(ae.type==="FeatureCollection")for(let le=0;le<ae.features.length;le++)pr(ge,ae.features[le],ue,le);else pr(ge,ae.type==="Feature"?ae:{geometry:ae},ue);return ge}(N,V);this.tiles={},this.tileCoords=[],G&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",V.indexMaxZoom,V.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),Q=function(ae,ue){const ge=ue.buffer/ue.extent;let le=ae;const Se=ci(ae,1,-1-ge,ge,0,-1,2,ue),we=ci(ae,1,1-ge,2+ge,0,-1,2,ue);return(Se||we)&&(le=ci(ae,1,-ge,1+ge,0,-1,2,ue)||[],Se&&(le=ki(Se,1).concat(le)),we&&(le=le.concat(ki(we,-1)))),le}(Q,V),Q.length&&this.splitTile(Q,0,0,0),G&&(Q.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,V,G,Q,ae,ue,ge){const le=[N,V,G,Q],Se=this.options,we=Se.debug;for(;le.length;){Q=le.pop(),G=le.pop(),V=le.pop(),N=le.pop();const de=1<<V,Me=mn(V,G,Q);let ne=this.tiles[Me];if(!ne&&(we>1&&console.time("creation"),ne=this.tiles[Me]=Ln(N,V,G,Q,Se),this.tileCoords.push({z:V,x:G,y:Q}),we)){we>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,G,Q,ne.numFeatures,ne.numPoints,ne.numSimplified),console.timeEnd("creation"));const wi=`z${V}`;this.stats[wi]=(this.stats[wi]||0)+1,this.total++}if(ne.source=N,ae==null){if(V===Se.indexMaxZoom||ne.numPoints<=Se.indexMaxPoints)continue}else{if(V===Se.maxZoom||V===ae)continue;if(ae!=null){const wi=ae-V;if(G!==ue>>wi||Q!==ge>>wi)continue}}if(ne.source=null,N.length===0)continue;we>1&&console.time("clipping");const Ne=.5*Se.buffer/Se.extent,tt=.5-Ne,Ue=.5+Ne,Ye=1+Ne;let nt=null,Zt=null,zt=null,Pt=null,rt=ci(N,de,G-Ne,G+Ue,0,ne.minX,ne.maxX,Se),vt=ci(N,de,G+tt,G+Ye,0,ne.minX,ne.maxX,Se);N=null,rt&&(nt=ci(rt,de,Q-Ne,Q+Ue,1,ne.minY,ne.maxY,Se),Zt=ci(rt,de,Q+tt,Q+Ye,1,ne.minY,ne.maxY,Se),rt=null),vt&&(zt=ci(vt,de,Q-Ne,Q+Ue,1,ne.minY,ne.maxY,Se),Pt=ci(vt,de,Q+tt,Q+Ye,1,ne.minY,ne.maxY,Se),vt=null),we>1&&console.timeEnd("clipping"),le.push(nt||[],V+1,2*G,2*Q),le.push(Zt||[],V+1,2*G,2*Q+1),le.push(zt||[],V+1,2*G+1,2*Q),le.push(Pt||[],V+1,2*G+1,2*Q+1)}}getTile(N,V,G){N=+N,V=+V,G=+G;const Q=this.options,{extent:ae,debug:ue}=Q;if(N<0||N>24)return null;const ge=1<<N,le=mn(N,V=V+ge&ge-1,G);if(this.tiles[le])return rr(this.tiles[le],ae);ue>1&&console.log("drilling down to z%d-%d-%d",N,V,G);let Se,we=N,de=V,Me=G;for(;!Se&&we>0;)we--,de>>=1,Me>>=1,Se=this.tiles[mn(we,de,Me)];return Se&&Se.source?(ue>1&&(console.log("found parent tile z%d-%d-%d",we,de,Me),console.time("drilling down")),this.splitTile(Se.source,we,de,Me,N,V,G),ue>1&&console.timeEnd("drilling down"),this.tiles[le]?rr(this.tiles[le],ae):null):null}}function mn(he,N,V){return 32*((1<<he)*V+N)+he}function mr(he,N){return N?he.properties[N]:he.id}function tn(he,N){if(he==null)return!0;if(he.type==="Feature")return mr(he,N)!=null;if(he.type==="FeatureCollection"){const V=new Set;for(const G of he.features){const Q=mr(G,N);if(Q==null||V.has(Q))return!1;V.add(Q)}return!0}return!1}function ys(he,N){const V=new Map;if(he!=null)if(he.type==="Feature")V.set(mr(he,N),he);else for(const G of he.features)V.set(mr(G,N),G);return V}class Mo extends Ve{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(N,V){return P._(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 Q=this._geoJSONIndex.getTile(G.z,G.x,G.y);if(!Q)return null;const ae=new Lt(Q.features);let ue=dn(ae);return ue.byteOffset===0&&ue.byteLength===ue.buffer.byteLength||(ue=new Uint8Array(ue)),{vectorTile:ae,rawData:ue.buffer}})}loadData(N){return P._(this,void 0,void 0,function*(){var V;(V=this._pendingRequest)===null||V===void 0||V.abort();const G=!!(N&&N.request&&N.request.collectResourceTiming)&&new P.cM(N.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(N,this._pendingRequest),this._geoJSONIndex=N.cluster?new qi(function({superclusterOptions:ue,clusterProperties:ge}){if(!ge||!ue)return ue;const le={},Se={},we={accumulated:null,zoom:0},de={properties:null},Me=Object.keys(ge);for(const ne of Me){const[Ne,tt]=ge[ne],Ue=P.cT(tt),Ye=P.cT(typeof Ne=="string"?[Ne,["accumulated"],["get",ne]]:Ne);le[ne]=Ue.value,Se[ne]=Ye.value}return ue.map=ne=>{de.properties=ne;const Ne={};for(const tt of Me)Ne[tt]=le[tt].evaluate(we,de);return Ne},ue.reduce=(ne,Ne)=>{de.properties=Ne;for(const tt of Me)we.accumulated=ne[tt],ne[tt]=Se[tt].evaluate(we,de)},ue}(N)).load((yield this._pendingData).features):(Q=yield this._pendingData,new ra(Q,N.geojsonVtOptions)),this.loaded={};const ae={};if(G){const ue=G.finish();ue&&(ae.resourceTiming={},ae.resourceTiming[N.source]=JSON.parse(JSON.stringify(ue)))}return ae}catch(ae){if(delete this._pendingRequest,P.cx(ae))return{abandoned:!0};throw ae}var Q})}getData(){return P._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(N){const V=this.loaded;return V&&V[N.uid]?super.reloadTile(N):this.loadTile(N)}loadAndProcessGeoJSON(N,V){return P._(this,void 0,void 0,function*(){let G=yield this.loadGeoJSON(N,V);if(delete this._pendingRequest,typeof G!="object")throw new Error(`Input data given to '${N.source}' is not a valid GeoJSON object.`);if(ft(G,!0),N.filter){const Q=P.cT(N.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Q.result==="error")throw new Error(Q.value.map(ue=>`${ue.key}: ${ue.message}`).join(", "));G={type:"FeatureCollection",features:G.features.filter(ue=>Q.value.evaluate({zoom:0},ue))}}return G})}loadGeoJSON(N,V){return P._(this,void 0,void 0,function*(){const{promoteId:G}=N;if(N.request){const Q=yield P.j(N.request,V);return this._dataUpdateable=tn(Q.data,G)?ys(Q.data,G):void 0,Q.data}if(typeof N.data=="string")try{const Q=JSON.parse(N.data);return this._dataUpdateable=tn(Q,G)?ys(Q,G):void 0,Q}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(Q,ae,ue){var ge,le,Se,we;if(ae.removeAll&&Q.clear(),ae.remove)for(const de of ae.remove)Q.delete(de);if(ae.add)for(const de of ae.add){const Me=mr(de,ue);Me!=null&&Q.set(Me,de)}if(ae.update)for(const de of ae.update){let Me=Q.get(de.id);if(Me==null)continue;const ne=!de.removeAllProperties&&(((ge=de.removeProperties)===null||ge===void 0?void 0:ge.length)>0||((le=de.addOrUpdateProperties)===null||le===void 0?void 0:le.length)>0);if((de.newGeometry||de.removeAllProperties||ne)&&(Me=Object.assign({},Me),Q.set(de.id,Me),ne&&(Me.properties=Object.assign({},Me.properties))),de.newGeometry&&(Me.geometry=de.newGeometry),de.removeAllProperties)Me.properties={};else if(((Se=de.removeProperties)===null||Se===void 0?void 0:Se.length)>0)for(const Ne of de.removeProperties)Object.prototype.hasOwnProperty.call(Me.properties,Ne)&&delete Me.properties[Ne];if(((we=de.addOrUpdateProperties)===null||we===void 0?void 0:we.length)>0)for(const{key:Ne,value:tt}of de.addOrUpdateProperties)Me.properties[Ne]=tt}}(this._dataUpdateable,N.dataDiff,G),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(N){return P._(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 gn{constructor(N){this.self=N,this.actor=new P.J(N),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(V,G)=>{if(this.externalWorkerSourceTypes[V])throw new Error(`Worker source with name "${V}" already registered.`);this.externalWorkerSourceTypes[V]=G},this.self.addProtocol=P.cz,this.self.removeProtocol=P.cA,this.self.registerRTLTextPlugin=V=>{P.cU.setMethods(V)},this.actor.registerMessageHandler("LDT",(V,G)=>this._getDEMWorkerSource(V,G.source).loadTile(G)),this.actor.registerMessageHandler("RDT",(V,G)=>P._(this,void 0,void 0,function*(){this._getDEMWorkerSource(V,G.source).removeTile(G)})),this.actor.registerMessageHandler("GCEZ",(V,G)=>P._(this,void 0,void 0,function*(){return this._getWorkerSource(V,G.type,G.source).getClusterExpansionZoom(G)})),this.actor.registerMessageHandler("GCC",(V,G)=>P._(this,void 0,void 0,function*(){return this._getWorkerSource(V,G.type,G.source).getClusterChildren(G)})),this.actor.registerMessageHandler("GCL",(V,G)=>P._(this,void 0,void 0,function*(){return this._getWorkerSource(V,G.type,G.source).getClusterLeaves(G)})),this.actor.registerMessageHandler("LD",(V,G)=>this._getWorkerSource(V,G.type,G.source).loadData(G)),this.actor.registerMessageHandler("GD",(V,G)=>this._getWorkerSource(V,G.type,G.source).getData()),this.actor.registerMessageHandler("LT",(V,G)=>this._getWorkerSource(V,G.type,G.source).loadTile(G)),this.actor.registerMessageHandler("RT",(V,G)=>this._getWorkerSource(V,G.type,G.source).reloadTile(G)),this.actor.registerMessageHandler("AT",(V,G)=>this._getWorkerSource(V,G.type,G.source).abortTile(G)),this.actor.registerMessageHandler("RMT",(V,G)=>this._getWorkerSource(V,G.type,G.source).removeTile(G)),this.actor.registerMessageHandler("RS",(V,G)=>P._(this,void 0,void 0,function*(){if(!this.workerSources[V]||!this.workerSources[V][G.type]||!this.workerSources[V][G.type][G.source])return;const Q=this.workerSources[V][G.type][G.source];delete this.workerSources[V][G.type][G.source],Q.removeSource!==void 0&&Q.removeSource(G)})),this.actor.registerMessageHandler("RM",V=>P._(this,void 0,void 0,function*(){delete this.layerIndexes[V],delete this.availableImages[V],delete this.workerSources[V],delete this.demWorkerSources[V]})),this.actor.registerMessageHandler("SR",(V,G)=>P._(this,void 0,void 0,function*(){this.referrer=G})),this.actor.registerMessageHandler("SRPS",(V,G)=>this._syncRTLPluginState(V,G)),this.actor.registerMessageHandler("IS",(V,G)=>P._(this,void 0,void 0,function*(){this.self.importScripts(G)})),this.actor.registerMessageHandler("SI",(V,G)=>this._setImages(V,G)),this.actor.registerMessageHandler("UL",(V,G)=>P._(this,void 0,void 0,function*(){this._getLayerIndex(V).update(G.layers,G.removedIds)})),this.actor.registerMessageHandler("SL",(V,G)=>P._(this,void 0,void 0,function*(){this._getLayerIndex(V).replace(G)}))}_setImages(N,V){return P._(this,void 0,void 0,function*(){this.availableImages[N]=V;for(const G in this.workerSources[N]){const Q=this.workerSources[N][G];for(const ae in Q)Q[ae].availableImages=V}})}_syncRTLPluginState(N,V){return P._(this,void 0,void 0,function*(){return yield P.cU.syncState(V,this.self.importScripts)})}_getAvailableImages(N){let V=this.availableImages[N];return V||(V=[]),V}_getLayerIndex(N){let V=this.layerIndexes[N];return V||(V=this.layerIndexes[N]=new o),V}_getWorkerSource(N,V,G){if(this.workerSources[N]||(this.workerSources[N]={}),this.workerSources[N][V]||(this.workerSources[N][V]={}),!this.workerSources[N][V][G]){const Q={sendAsync:(ae,ue)=>(ae.targetMapId=N,this.actor.sendAsync(ae,ue))};switch(V){case"vector":this.workerSources[N][V][G]=new Ve(Q,this._getLayerIndex(N),this._getAvailableImages(N));break;case"geojson":this.workerSources[N][V][G]=new Mo(Q,this._getLayerIndex(N),this._getAvailableImages(N));break;default:this.workerSources[N][V][G]=new this.externalWorkerSourceTypes[V](Q,this._getLayerIndex(N),this._getAvailableImages(N))}}return this.workerSources[N][V][G]}_getDEMWorkerSource(N,V){return this.demWorkerSources[N]||(this.demWorkerSources[N]={}),this.demWorkerSources[N][V]||(this.demWorkerSources[N][V]=new Ae),this.demWorkerSources[N][V]}}return P.i(self)&&(self.worker=new gn(self)),gn}),z("index",["exports","./shared"],function(P,o){var ye="5.6.0";function be(){var u=new o.A(4);return o.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}let Re,Ve;const Ae={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=>(Re||(Re=document.createElement("a")),Re.href=u,Re.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Ve==null&&(Ve=matchMedia("(prefers-reduced-motion: reduce)")),Ve.matches)}};class ce{static testProp(e){if(!ce.docStyle)return e[0];for(let i=0;i<e.length;i++)if(e[i]in ce.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(){ce.docStyle&&ce.selectProp&&(ce.userSelect=ce.docStyle[ce.selectProp],ce.docStyle[ce.selectProp]="none")}static enableDrag(){ce.docStyle&&ce.selectProp&&(ce.docStyle[ce.selectProp]=ce.userSelect)}static setTransform(e,i){e.style[ce.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",ce.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",ce.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",ce.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=ce.getScale(e);return ce.getPoint(e,s,i)}static touchPos(e,i){const s=[],l=ce.getScale(e);for(let h=0;h<i.length;h++)s.push(ce.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 ce.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)ce.removeAttributes(s),ce.clean(s)}static removeAttributes(e){for(const{name:i,value:s}of e.attributes)ce.isPossiblyDangerous(i,s)&&e.removeAttribute(i)}}ce.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,ce.selectProp=ce.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),ce.transformProp=ce.testProp(["transform","WebkitTransform"]);const Be={supported:!1,testSupport:function(u){!di&&ft&&(Dt?Lt(u):Rt=u)}};let Rt,ft,di=!1,Dt=!1;function Lt(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,ft),u.isContextLost())return;Be.supported=!0}catch{}u.deleteTexture(e),di=!0}var li;typeof document<"u"&&(ft=document.createElement("img"),ft.onload=()=>{Rt&&Lt(Rt),Rt=null,Dt=!0},ft.onerror=()=>{di=!0,Rt=null},ft.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=x=>{const T=s++;return l[T]=x,T},u.removeThrottleControl=x=>{delete l[x],f()},u.getImage=(x,T,M=!0)=>new Promise((A,E)=>{Be.supported&&(x.headers||(x.headers={}),x.headers.accept="image/webp,*/*"),o.e(x,{type:"image"}),e.push({abortController:T,requestParameters:x,supportImageRefresh:M,state:"queued",onError:R=>{E(R)},onSuccess:R=>{A(R)}}),f()});const h=x=>o._(this,void 0,void 0,function*(){x.state="running";const{requestParameters:T,supportImageRefresh:M,onError:A,onSuccess:E,abortController:R}=x,O=M===!1&&!o.i(self)&&!o.g(T.url)&&(!T.headers||Object.keys(T.headers).reduce((W,X)=>W&&X==="accept",!0));i++;const q=O?_(T,R):o.m(T,R);try{const W=yield q;delete x.abortController,x.state="completed",W.data instanceof HTMLImageElement||o.b(W.data)?E(W):W.data&&E({data:yield($=W.data,typeof createImageBitmap=="function"?o.f($):o.h($)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete x.abortController,A(W)}finally{i--,f()}var $}),f=()=>{const x=(()=>{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<x&&e.length>0;T++){const M=e.shift();M.abortController.signal.aborted?T--:h(M)}},_=(x,T)=>new Promise((M,A)=>{const E=new Image,R=x.url,O=x.credentials;O&&O==="include"?E.crossOrigin="use-credentials":(O&&O==="same-origin"||!o.d(R))&&(E.crossOrigin="anonymous"),T.signal.addEventListener("abort",()=>{E.src="",A(o.c())}),E.fetchPriority="high",E.onload=()=>{E.onerror=E.onload=null,M({data:E})},E.onerror=()=>{E.onerror=E.onload=null,T.signal.aborted||A(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."))},E.src=R})}(li||(li={})),li.resetRequestQueue();class Ft{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function jt(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 hr(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`)}}function ea(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class dn 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 o.T(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,x=f.y+1,T=this.getImage(h).data,M=T.width,A=T.height;o.R.copy(T,l,{x:0,y:0},{x:_,y:x},{width:M,height:A}),o.R.copy(T,l,{x:0,y:A-1},{x:_,y:x-1},{width:M,height:1}),o.R.copy(T,l,{x:0,y:0},{x:_,y:x+A},{width:M,height:1}),o.R.copy(T,l,{x:M-1,y:0},{x:_-1,y:x},{width:1,height:A}),o.R.copy(T,l,{x:0,y:0},{x:_+M,y:x},{width:1,height:A})}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`),ea(s)&&this.updateImage(i,s)}}}const Kr=1e20;function pn(u,e,i,s,l,h,f,_,x){for(let T=e;T<e+s;T++)Tr(u,i*h+T,h,l,f,_,x);for(let T=i;T<i+l;T++)Tr(u,T*h+e,1,s,f,_,x)}function Tr(u,e,i,s,l,h,f){h[0]=0,f[0]=-1e20,f[1]=Kr,l[0]=u[e];for(let _=1,x=0,T=0;_<s;_++){l[_]=u[e+_*i];const M=_*_;do{const A=h[x];T=(l[_]-l[A]+M-A*A)/(_-A)/2}while(T<=f[x]&&--x>-1);x++,h[x]=_,f[x]=T,f[x+1]=Kr}for(let _=0,x=0;_<s;_++){for(;f[x+1]<_;)x++;const T=h[x],M=_-T;u[e+_*i]=l[T]+M*M}}class qi{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 _=qi.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 qi.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}}}}qi.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 x={};for(const T of o.o(_.data))x[T.id]=T;return x})},qi.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,x=this._createCanvas(_),T=this.ctx=x.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))),x=Math.min(this.size-this.buffer,f+Math.ceil(s)),T=_+2*this.buffer,M=x+2*this.buffer,A=Math.max(T*M,0),E=new Uint8ClampedArray(A),R={data:E,width:T,height:M,glyphWidth:_,glyphHeight:x,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(_===0||x===0)return R;const{ctx:O,buffer:q,gridInner:$,gridOuter:W}=this;O.clearRect(q,q,_,x),O.fillText(u,q,q+f);const X=O.getImageData(q,q,_,x);W.fill(Kr,0,A),$.fill(0,0,A);for(let ee=0;ee<x;ee++)for(let Y=0;Y<_;Y++){const ie=X.data[4*(ee*_+Y)+3]/255;if(ie===0)continue;const re=(ee+q)*T+Y+q;if(ie===1)W[re]=0,$[re]=Kr;else{const K=.5-ie;W[re]=K>0?K*K:0,$[re]=K<0?K*K:0}}pn(W,0,0,T,M,T,this.f,this.v,this.z),pn($,q,q,_,x,T,this.f,this.v,this.z);for(let ee=0;ee<A;ee++){const Y=Math.sqrt(W[ee])-Math.sqrt($[ee]);E[ee]=Math.round(255-255*(Y/this.radius+this.cutoff))}return R}};class Jr{constructor(){this.specification=o.v.light.position}possiblyEvaluate(e,i){return o.B(e.expression.evaluate(i))}interpolate(e,i,s){return{x:o.C.number(e.x,i.x,s),y:o.C.number(e.y,i.y,s),z:o.C.number(e.z,i.z,s)}}}let dr;class St extends o.E{constructor(e){super(),dr=dr||new o.r({anchor:new o.D(o.v.light.anchor),position:new Jr,color:new o.D(o.v.light.color),intensity:new o.D(o.v.light.intensity)}),this._transitionable=new o.t(dr),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(o.x,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.y(this,e.call(o.z,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:o.v}))}}const zi=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 Lr extends o.E{constructor(e){super(),this._transitionable=new o.t(zi),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new o.F(0))}setSky(e,i={}){if(!this._validate(o.G,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.y(this,e.call(o.z,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 tr{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 x=e[0];for(let T=1;T<e.length;T++){_=!_;const M=e[T];h=x*s,x+=M,f=x*s,l.push({left:h,right:f,isDash:_,zeroLength:M===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,x=e[_];for(let T=0;T<this.width;T++){T/x.right>1&&(x=e[++_]);const M=Math.abs(T-x.left),A=Math.abs(T-x.right),E=Math.min(M,A);let R;const O=h/s*(l+1);if(x.isDash){const q=l-Math.abs(O);R=Math.sqrt(E*E+q*q)}else R=l-Math.sqrt(E*E+O*O);this.data[f+T]=Math.max(0,Math.min(255,R+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const x=e[_],T=e[_+1];x.zeroLength?e.splice(_,1):T&&T.isDash===x.isDash&&(T.left=x.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 x=Math.abs(_-f.left),T=Math.abs(_-f.right),M=Math.min(x,T);this.data[l+_]=Math.max(0,Math.min(255,(f.isDash?M:-M)+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,x=this.getDashRanges(e,this.width,_);i?this.addRoundDash(x,_,s):this.addRegularDash(x)}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 Fr="maplibre_preloaded_worker_pool";class Wi{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Wi.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[Fr]}numActive(){return Object.keys(this.active).length}}const At=Math.floor(Ae.hardwareConcurrency/2);let pr,ir;function Qr(){return pr||(pr=new Wi),pr}Wi.workerCount=o.H(globalThis)?Math.max(Math.min(At,3),1):1;class Br{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.J(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 Or(){return ir||(ir=new Br(Qr(),o.K),ir.registerMessageHandler("GR",(u,e,i)=>o.m(e,i))),ir}function ka(u,e){const i=o.L();return o.M(i,i,[1,1,0]),o.N(i,i,[.5*u.width,.5*u.height,1]),u.calculatePosMatrix?o.O(i,i,u.calculatePosMatrix(e.toUnwrapped())):i}function ci(u,e,i,s,l,h,f){var _;const x=function(E,R,O){if(E)for(const q of E){const $=R[q];if($&&$.source===O&&$.type==="fill-extrusion")return!0}else for(const q in R){const $=R[q];if($.source===O&&$.type==="fill-extrusion")return!0}return!1}((_=l==null?void 0:l.layers)!==null&&_!==void 0?_:null,e,u.id),T=h.maxPitchScaleFactor(),M=u.tilesIn(s,T,x);M.sort(Dn);const A=[];for(const E of M)A.push({wrappedTileID:E.tileID.wrapped().key,queryResults:E.tile.queryRenderedFeatures(e,i,u._state,E.queryGeometry,E.cameraQueryGeometry,E.scale,l,h,T,ka(u.transform,E.tileID),f?(R,O)=>f(E.tileID,R,O):void 0)});return function(E,R){for(const O in E)for(const q of E[O])Hi(q,R);return E}(function(E){const R={},O={};for(const q of E){const $=q.queryResults,W=q.wrappedTileID,X=O[W]=O[W]||{};for(const ee in $){const Y=$[ee],ie=X[ee]=X[ee]||{},re=R[ee]=R[ee]||[];for(const K of Y)ie[K.featureIndex]||(ie[K.featureIndex]=!0,re.push(K))}}return R}(A),u)}function Dn(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 Hi(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 gs(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 Ae.frameAsync(i),!s)return null;const l=o.Q(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 ii{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.S?new o.S(e.lng,e.lat):o.S.convert(e),this}setSouthWest(e){return this._sw=e instanceof o.S?new o.S(e.lng,e.lat):o.S.convert(e),this}extend(e){const i=this._sw,s=this._ne;let l,h;if(e instanceof o.S)l=e,h=e;else{if(!(e instanceof ii))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(ii.convert(e)):this.extend(o.S.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(o.S.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.S(l.lng,l.lat),this._ne=new o.S(h.lng,h.lat)),this}getCenter(){return new o.S((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.S(this.getWest(),this.getNorth())}getSouthEast(){return new o.S(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.S.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 ii?e:e&&new ii(e)}static fromLngLat(e,i=0){const s=360*i/40075017,l=s/Math.cos(Math.PI/180*e.lat);return new ii(new o.S(e.lng-l,e.lat-s),new o.S(e.lng+l,e.lat+s))}adjustAntiMeridian(){const e=new o.S(this._sw.lng,this._sw.lat),i=new o.S(this._ne.lng,this._ne.lat);return new ii(e,e.lng>i.lng?new o.S(i.lng+360,i.lat):i)}}class en{constructor(e,i,s){this.bounds=ii.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.V(this.bounds.getWest())*i),l=Math.floor(o.U(this.bounds.getNorth())*i),h=Math.ceil(o.V(this.bounds.getEast())*i),f=Math.ceil(o.U(this.bounds.getSouth())*i);return e.x>=s&&e.x<h&&e.y>=l&&e.y<f}}class Sr 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.Q(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 gs(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 en(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,globalState:this.map.getGlobalState()};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 Ra 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.Q(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 gs(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(o.e(this,i),i.bounds&&(this.tileBounds=new en(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 li.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 o.T(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 ki extends Ra{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 li.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.W()?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 x=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=x,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.X()){const i=e.width+2,s=e.height+2;try{return new o.R({width:i,height:s},yield o.Y(e,-1,-1,i,s))}catch{}}return Ae.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,x={};return x[new o.Z(e.overscaledZ,h,i.z,l,i.y).key]={backfilled:!1},x[new o.Z(e.overscaledZ,_,i.z,f,i.y).key]={backfilled:!1},i.y>0&&(x[new o.Z(e.overscaledZ,h,i.z,l,i.y-1).key]={backfilled:!1},x[new o.Z(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},x[new o.Z(e.overscaledZ,_,i.z,f,i.y-1).key]={backfilled:!1}),i.y+1<s&&(x[new o.Z(e.overscaledZ,h,i.z,l,i.y+1).key]={backfilled:!1},x[new o.Z(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},x[new o.Z(e.overscaledZ,_,i.z,f,i.y+1).key]={backfilled:!1}),x}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 fr 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.$,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:this._getClusterMaxZoom(i.clusterMaxZoom),minPoints:Math.max(2,i.clusterMinPoints||2),extent:o.$,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.$/this.tileSize)}_getClusterMaxZoom(e){const i=e?Math.round(e):this.maxzoom-1;return Number.isInteger(e)||e===void 0||o.w(`Integer expected for option 'clusterMaxZoom': provided value "${e}" rounded to "${i}"`),i}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 ii,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=this._getClusterMaxZoom(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(Ae.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,globalState:this.map.getGlobalState()};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 rr 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 li.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.a0.fromLngLat);var s;return this.tileID=function(l){const h=o.a1.fromPoints(l),f=h.width(),_=h.height(),x=Math.max(f,_),T=Math.max(0,Math.floor(-Math.log(x)/Math.LN2)),M=Math.pow(2,T);return new o.a3(T,Math.floor((h.minX+h.maxX)/2*M),Math.floor((h.minY+h.maxY)/2*M))}(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 o.T(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){const{minX:i,minY:s,maxX:l,maxY:h}=o.a1.fromPoints(e),f={};for(let _=0;_<=o.a2;_++){const x=Math.pow(2,_),T=Math.floor(i*x),M=Math.floor(s*x),A=Math.floor(l*x),E=Math.floor(h*x);f[_]={minTileX:T,minTileY:M,maxTileX:A,maxTileY:E}}return f}}class ta extends rr{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.a4(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.a5(`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 o.T(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 Ln extends rr{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.a5(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new o.k(new o.a5(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new o.k(new o.a5(`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.a5(`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.a5(`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 o.T(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 _s={},ia=u=>{switch(u){case"geojson":return fr;case"image":return rr;case"raster":return Ra;case"raster-dem":return ki;case"vector":return Sr;case"video":return ta;case"canvas":return Ln}return _s[u]},fn="RTLPluginLoaded";class ra extends o.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Or()}_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=Ae.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(fn))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let mn=null;function mr(){return mn||(mn=new ra),mn}class tn{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=o.a6(),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 x=_.layerIds.map(T=>h.getLayer(T)).filter(Boolean);if(x.length!==0){_.layers=x,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(T=>x.filter(M=>M.id===T)[0]));for(const T of x)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.a8){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.a8&&h.hasRTLText){this.hasRTLText=!0,mr().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.a7}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 o.T(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new o.T(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,_,x,T,M,A){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:l,cameraQueryGeometry:h,scale:f,tileSize:this.tileSize,pixelPosMatrix:M,transform:x,params:_,queryPadding:this.queryPadding*T,getElevation:A},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.a9(i&&i.filter),{z:x,x:T,y:M}=this.tileID.canonical,A={z:x,x:T,y:M};for(let E=0;E<f.length;E++){const R=f.feature(E);if(_.needGeometry){const $=o.aa(R,!0);if(!_.filter(new o.F(this.tileID.overscaledZ),$,this.tileID.canonical))continue}else if(!_.filter(new o.F(this.tileID.overscaledZ),R))continue;const O=s.getId(R,h),q=new o.ab(R,x,T,M,O);q.tile=A,e.push(q)}}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.ac(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],x=e[f];if(!_||!x||Object.keys(x).length===0)continue;h.update(x,_,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<Ae.now()}clearFadeHold(){this.symbolFadeHoldUntil=void 0}setHoldDuration(e){this.symbolFadeHoldUntil=Ae.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 ys{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 Mo{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 gn=89.25;function he(u,e){const i=o.ag(e.lat,-85.051129,o.ah);return new o.P(o.V(e.lng)*u,o.U(i)*u)}function N(u,e){return new o.a0(e.x/u,e.y/u).toLngLat()}function V(u){return u.cameraToCenterDistance*Math.min(.85*Math.tan(o.ad(90-u.pitch)),Math.tan(o.ad(gn-u.pitch)))}function G(u,e){const i=u.canonical,s=e/o.ae(i.z),l=i.x+Math.pow(2,i.z)*u.wrap,h=o.af(new Float64Array(16));return o.M(h,h,[l*s,i.y*s,0]),o.N(h,h,[s/o.$,s/o.$,1]),h}function Q(u,e,i,s,l){const h=o.a0.fromLngLat(u,e),f=l*o.ai(1,u.lat),_=f*Math.cos(o.ad(i)),x=Math.sqrt(f*f-_*_),T=x*Math.sin(o.ad(-s)),M=x*Math.cos(o.ad(-s));return new o.a0(h.x+T,h.y+M,h.z+_)}function ae(u,e,i){const s=e.intersectsFrustum(u);if(!i||s===0)return s;const l=e.intersectsPlane(i);return l===0?0:s===2&&l===2?2:1}function ue(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 ge(u,e){return function(i,s,l,h,f){const _=2*((u-1)/o.aj(Math.cos(o.ad(gn-f))/Math.cos(o.ad(gn)))-1),x=Math.acos(l/h),T=2*ue(_-1,0,o.ad(f/2)),M=Math.min(o.ad(gn),x+o.ad(f/2)),A=ue(_-1,Math.min(M,x-o.ad(f/2)),M),E=Math.atan(s/l),R=Math.hypot(s,l);let O=i;return O+=o.aj(h/R/Math.max(.5,Math.cos(o.ad(f/2)))),O+=_*o.aj(Math.cos(E))/2,O-=o.aj(Math.max(1,A/T/e))/2,O}}const le=ge(9.314,3);function Se(u,e){const i=(e.roundZoom?Math.round:Math.floor)(u.zoom+o.aj(u.tileSize/e.tileSize));return Math.max(0,i)}function we(u,e){const i=u.getCameraFrustum(),s=u.getClippingPlane(),l=u.screenPointToMercatorCoordinate(u.getCameraPoint()),h=o.a0.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),x=Se(u,e),T=e.minzoom||0,M=e.maxzoom!==void 0?e.maxzoom:u.maxZoom,A=Math.min(Math.max(0,x),M),E=Math.pow(2,A),R=[E*l.x,E*l.y,0],O=[E*h.x,E*h.y,0],q=Math.hypot(h.x-l.x,h.y-l.y),$=Math.abs(h.z-l.z),W=Math.hypot(q,$),X=ie=>({zoom:0,x:0,y:0,wrap:ie,fullyVisible:!1}),ee=[],Y=[];if(u.renderWorldCopies&&f.allowWorldCopies())for(let ie=1;ie<=3;ie++)ee.push(X(-ie)),ee.push(X(ie));for(ee.push(X(0));ee.length>0;){const ie=ee.pop(),re=ie.x,K=ie.y;let oe=ie.fullyVisible;const _e={x:re,y:K,z:ie.zoom},pe=f.getTileBoundingVolume(_e,ie.wrap,u.elevation,e);if(!oe){const Le=ae(i,pe,s);if(Le===0)continue;oe=Le===2}const fe=f.distanceToTile2d(l.x,l.y,_e,pe);let xe=x;_&&(xe=(e.calculateTileZoom||le)(u.zoom+o.aj(u.tileSize/e.tileSize),fe,$,W,u.fov)),xe=(e.roundZoom?Math.round:Math.floor)(xe),xe=Math.max(0,xe);const Fe=Math.min(xe,M);if(ie.wrap=f.getWrap(h,_e,ie.wrap),ie.zoom>=Fe){if(ie.zoom<T)continue;const Le=A-ie.zoom,Ie=R[0]-.5-(re<<Le),$e=R[1]-.5-(K<<Le),ot=e.reparseOverscaled?Math.max(ie.zoom,xe):ie.zoom;Y.push({tileID:new o.Z(ie.zoom===M?ot:ie.zoom,ie.wrap,ie.zoom,re,K),distanceSq:o.ak([O[0]-.5-re,O[1]-.5-K]),tileDistanceToCamera:Math.sqrt(Ie*Ie+$e*$e)})}else for(let Le=0;Le<4;Le++)ee.push({zoom:ie.zoom+1,x:(re<<1)+Le%2,y:(K<<1)+(Le>>1),wrap:ie.wrap,fullyVisible:oe})}return Y.sort((ie,re)=>ie.distanceSq-re.distanceSq).map(ie=>ie.tileID)}const de=o.a1.fromPoints([new o.P(0,0),new o.P(o.$,o.$)]);class Me 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 x=new(ia(h.type))(l,h,f,_);if(x.id!==l)throw new Error(`Expected Source id to be ${l} instead of ${x.id}`);return x})(e,i,s,this),this._tiles={},this._cache=new ys(0,l=>this._unloadTile(l)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Mo,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(ne).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),x=new o.P(f.canonical.x,f.canonical.y)._rotate(-this.transform.bearingInRadians);return h.overscaledZ-f.overscaledZ||x.y-_.y||x.x-_.x}).map(s=>s.tileID.key):i.map(s=>s.tileID).sort(ne).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._reloadTile(i,"expired"):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=Ae.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,x=Math.pow(2,l.tileID.canonical.z),T=h.tileID.key;f===0&&_===0||Math.abs(_)>1||(Math.abs(f)>1&&(Math.abs(f+x)===1?f+=x:Math.abs(f-x)===1&&(f-=x)),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 x=_;for(;x.overscaledZ>i;)if(x=x.scaledTo(x.overscaledZ-1),e[x.key]||e[x.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 _={},x={},T=Object.keys(e),M=Ae.now();for(const A of T){const E=e[A],R=this._tiles[A];if(!R||R.fadeEndTime!==0&&R.fadeEndTime<=M)continue;const O=this.findLoadedParent(E,i),q=this.findLoadedSibling(E),$=O||q||null;$&&(this._addTile($.tileID),_[$.tileID.key]=$.tileID),x[A]=E}this._retainLoadedChildren(x,l,s,e);for(const A in _)e[A]||(this._coveredTiles[A]=!0,e[A]=_[A]);if(f){const A={},E={};for(const R of h)this._tiles[R.key].hasData()?A[R.key]=R:E[R.key]=R;for(const R in E){const O=E[R].children(this._source.maxzoom);this._tiles[O[0].key]&&this._tiles[O[1].key]&&this._tiles[O[2].key]&&this._tiles[O[3].key]&&(A[O[0].key]=e[O[0].key]=O[0],A[O[1].key]=e[O[1].key]=O[1],A[O[2].key]=e[O[2].key]=O[2],A[O[3].key]=e[O[3].key]=O[3],delete E[R])}for(const R in E){const O=E[R],q=this.findLoadedParent(O,this._source.minzoom),$=this.findLoadedSibling(O),W=q||$||null;if(W){A[W.tileID.key]=e[W.tileID.key]=W.tileID;for(const X in A)A[X].isChildOf(W.tileID)&&delete A[X]}}for(const R in this._tiles)A[R]||(this._coveredTiles[R]=!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(M=>new o.Z(M.canonical.z,M.wrap,M.canonical.z,M.canonical.x,M.canonical.y)):(s=we(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(M=>this._source.hasTile(M)))):s=[];const l=Se(e,this._source),h=Math.max(l-Me.maxOverzooming,this._source.minzoom),f=Math.max(l+Me.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const M={};for(const A of s)if(A.canonical.z>this._source.minzoom){const E=A.scaledTo(A.canonical.z-1);M[E.key]=E;const R=A.scaledTo(Math.max(this._source.minzoom,Math.min(A.canonical.z,5)));M[R.key]=R}s=s.concat(Object.values(M))}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 x=this._updateRetainedTiles(s,l);Ne(this._source.type)&&this._updateCoveredAndRetainedTiles(x,h,f,l,s,i);for(const M in x)this._tiles[M].clearFadeHold();const T=o.al(this._tiles,x);for(const M of T){const A=this._tiles[M];A.hasSymbolBuckets&&!A.holdingForFade()?A.setHoldDuration(this.map._fadeDuration):A.hasSymbolBuckets&&!A.symbolFadeFinished()||this._removeTile(M)}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-Me.maxOverzooming,this._source.minzoom),_=Math.max(i+Me.maxUnderzooming,this._source.minzoom),x={};for(const T of e){const M=this._addTile(T);l[T.key]=T,M.hasData()||i<this._source.maxzoom&&(x[T.key]=T)}this._retainLoadedChildren(x,i,_,l);for(const T of e){let M=this._tiles[T.key];if(M.hasData())continue;if(i+1>this._source.maxzoom){const E=T.children(this._source.maxzoom)[0],R=this.getTile(E);if(R&&R.hasData()){l[E.key]=E;continue}}else{const E=T.children(this._source.maxzoom);if(l[E[0].key]&&l[E[1].key]&&l[E[2].key]&&l[E[3].key])continue}let A=M.wasRequested();for(let E=T.overscaledZ-1;E>=f;--E){const R=T.scaledTo(E);if(h[R.key])break;if(h[R.key]=!0,M=this.getTile(R),!M&&A&&(M=this._addTile(R)),M){const O=M.hasData();if((O||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||A)&&(l[R.key]=R),A=M.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 tn(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))}refreshTiles(e){for(const i in this._tiles)(this._isIdRenderable(i)||this._tiles[i].state=="errored")&&e.some(s=>s.equals(this._tiles[i].tileID.canonical))&&this._reloadTile(i,"expired")}_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=h.getCoveringTilesDetailsProvider().allowWorldCopies(),_=s?h.getCameraQueryGeometry(e):e,x=R=>h.screenPointToMercatorCoordinate(R,this.terrain),T=this.transformBbox(e,x,!f),M=this.transformBbox(_,x,!f),A=this.getIds(),E=o.a1.fromPoints(M);for(let R=0;R<A.length;R++){const O=this._tiles[A[R]];if(O.holdingForFade())continue;const q=f?[O.tileID]:[O.tileID.unwrapTo(-1),O.tileID.unwrapTo(0)],$=Math.pow(2,h.zoom-O.tileID.overscaledZ),W=i*O.queryPadding*o.$/O.tileSize/$;for(const X of q){const ee=E.map(Y=>X.getTilePoint(new o.a0(Y.x,Y.y)));if(ee.expandBy(W),ee.intersects(de)){const Y=T.map(re=>X.getTilePoint(re)),ie=M.map(re=>X.getTilePoint(re));l.push({tile:O,tileID:f?X:X.unwrapTo(0),queryGeometry:Y,cameraQueryGeometry:ie,scale:$})}}}return l}transformBbox(e,i,s){let l=e.map(i);if(s){const h=o.a1.fromPoints(e);h.shrinkBy(.001*Math.min(h.width(),h.height()));const f=h.map(i);o.a1.fromPoints(l).covers(f)||(l=l.map(_=>_.x>.5?new o.a0(_.x-1,_.y,_.z):_))}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(Ne(this._source.type)){const e=Ae.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 ne(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 Ne(u){return u==="raster"||u==="image"||u==="video"}Me.maxOverzooming=10,Me.maxUnderzooming=3;class tt{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.ag(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,x=_>0?(l-f)/_:0;return this.points[h].mult(1-x).add(this.points[i].mult(x))}}function Ue(u,e){let i=!0;return u==="always"||u!=="never"&&e!=="never"||(i=!1),i}class Ye{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 x=[];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++)x.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 M=this.circles[3*T],A=this.circles[3*T+1],E=this.circles[3*T+2];x.push({key:this.circleKeys[T],x1:M-E,y1:A-E,x2:M+E,y2:A+E})}}else this._forEachCell(e,i,s,l,this._queryCell,x,{hitTest:h,overlapMode:f,seenUids:{box:{},circle:{}}},_);return x}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,x=i-s,T=i+s;if(_<0||f>this.width||T<0||x>this.height)return!1;const M=[];return this._forEachCell(f,x,_,T,this._queryCellCircle,M,{hitTest:!0,overlapMode:l,circle:{x:e,y:i,radius:s},seenUids:{box:{},circle:{}}},h),M.length>0}_queryCell(e,i,s,l,h,f,_,x){const{seenUids:T,hitTest:M,overlapMode:A}=_,E=this.boxCells[h];if(E!==null){const O=this.bboxes;for(const q of E)if(!T.box[q]){T.box[q]=!0;const $=4*q,W=this.boxKeys[q];if(e<=O[$+2]&&i<=O[$+3]&&s>=O[$+0]&&l>=O[$+1]&&(!x||x(W))&&(!M||!Ue(A,W.overlapMode))&&(f.push({key:W,x1:O[$],y1:O[$+1],x2:O[$+2],y2:O[$+3]}),M))return!0}}const R=this.circleCells[h];if(R!==null){const O=this.circles;for(const q of R)if(!T.circle[q]){T.circle[q]=!0;const $=3*q,W=this.circleKeys[q];if(this._circleAndRectCollide(O[$],O[$+1],O[$+2],e,i,s,l)&&(!x||x(W))&&(!M||!Ue(A,W.overlapMode))){const X=O[$],ee=O[$+1],Y=O[$+2];if(f.push({key:W,x1:X-Y,y1:ee-Y,x2:X+Y,y2:ee+Y}),M)return!0}}}return!1}_queryCellCircle(e,i,s,l,h,f,_,x){const{circle:T,seenUids:M,overlapMode:A}=_,E=this.boxCells[h];if(E!==null){const O=this.bboxes;for(const q of E)if(!M.box[q]){M.box[q]=!0;const $=4*q,W=this.boxKeys[q];if(this._circleAndRectCollide(T.x,T.y,T.radius,O[$+0],O[$+1],O[$+2],O[$+3])&&(!x||x(W))&&!Ue(A,W.overlapMode))return f.push(!0),!0}}const R=this.circleCells[h];if(R!==null){const O=this.circles;for(const q of R)if(!M.circle[q]){M.circle[q]=!0;const $=3*q,W=this.circleKeys[q];if(this._circlesCollide(O[$],O[$+1],O[$+2],T.x,T.y,T.radius)&&(!x||x(W))&&!Ue(A,W.overlapMode))return f.push(!0),!0}}}_forEachCell(e,i,s,l,h,f,_,x){const T=this._convertToXCellCoord(e),M=this._convertToYCellCoord(i),A=this._convertToXCellCoord(s),E=this._convertToYCellCoord(l);for(let R=T;R<=A;R++)for(let O=M;O<=E;O++)if(h.call(this,e,i,s,l,this.xCellCount*O+R,f,_,x))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,x=h-i,T=s+f;return T*T>_*_+x*x}_circleAndRectCollide(e,i,s,l,h,f,_){const x=(f-l)/2,T=Math.abs(e-(l+x));if(T>x+s)return!1;const M=(_-h)/2,A=Math.abs(i-(h+M));if(A>M+s)return!1;if(T<=x||A<=M)return!0;const E=T-x,R=A-M;return E*E+R*R<=s*s}}function nt(u,e,i){const s=o.L();if(!u){const{vecSouth:A,vecEast:E}=zt(e),R=be();R[0]=E[0],R[1]=E[1],R[2]=A[0],R[3]=A[1],l=R,(M=(f=(h=R)[0])*(T=h[3])-(x=h[2])*(_=h[1]))&&(l[0]=T*(M=1/M),l[1]=-_*M,l[2]=-x*M,l[3]=f*M),s[0]=R[0],s[1]=R[1],s[4]=R[2],s[5]=R[3]}var l,h,f,_,x,T,M;return o.N(s,s,[1/i,1/i,1]),s}function Zt(u,e,i,s){if(u){const l=o.L();if(!e){const{vecSouth:h,vecEast:f}=zt(i);l[0]=f[0],l[1]=f[1],l[4]=h[0],l[5]=h[1]}return o.N(l,l,[s,s,1]),l}return i.pixelsToClipSpaceMatrix}function zt(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.aq();f[0]=-l*s*i-h*e,f[1]=-h*s*i+l*e;const _=o.ar(f);_<1e-9?o.as(f):o.at(f,f,1/_);const x=o.aq();x[0]=l*s*e-h*i,x[1]=h*s*e+l*i;const T=o.ar(x);return T<1e-9?o.as(x):o.at(x,x,1/T),{vecEast:x,vecSouth:f}}function Pt(u,e,i,s){let l;s?(l=[u,e,s(u,e),1],o.av(l,l,i)):(l=[u,e,0,1],aa(l,l,i));const h=l[3];return{point:new o.P(l[0]/h,l[1]/h),signedDistanceFromCamera:h,isOccluded:!1}}function rt(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 wi(u,e,i,s,l,h,f,_,x,T,M,A,E){const R=i?u.textSizeData:u.iconSizeData,O=o.am(R,e.transform.zoom),q=[256/e.width*2+1,256/e.height*2+1],$=i?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;$.clear();const W=u.lineVertexArray,X=i?u.text.placedSymbolArray:u.icon.placedSymbolArray,ee=e.transform.width/e.transform.height;let Y=!1;for(let ie=0;ie<X.length;ie++){const re=X.get(ie);if(re.hidden||re.writingMode===o.an.vertical&&!Y){_n(re.numGlyphs,$);continue}Y=!1;const K=new o.P(re.anchorX,re.anchorY),oe={getElevation:E,pitchedLabelPlaneMatrix:s,lineVertexArray:W,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:K,unwrappedTileID:x,width:T,height:M,translation:A},_e=dt(re.anchorX,re.anchorY,oe);if(!vt(_e.point,q)){_n(re.numGlyphs,$);continue}const pe=rt(e.transform.cameraToCenterDistance,_e.signedDistanceFromCamera),fe=o.ao(R,O,re),xe=h?fe*e.transform.getPitchedTextCorrection(re.anchorX,re.anchorY,x)/pe:fe*pe,Fe=Ht({projectionContext:oe,pitchedLabelPlaneMatrixInverse:l,symbol:re,fontSize:xe,flip:!1,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:$,aspectRatio:ee,rotateToLine:_});Y=Fe.useVertical,(Fe.notEnoughRoom||Y||Fe.needsFlipping&&Ht({projectionContext:oe,pitchedLabelPlaneMatrixInverse:l,symbol:re,fontSize:xe,flip:!0,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:$,aspectRatio:ee,rotateToLine:_}).notEnoughRoom)&&_n(re.numGlyphs,$)}i?u.text.dynamicLayoutVertexBuffer.updateData($):u.icon.dynamicLayoutVertexBuffer.updateData($)}function De(u,e,i,s,l,h,f,_){const x=h.glyphStartIndex+h.numGlyphs,T=h.lineStartIndex,M=h.lineStartIndex+h.lineLength,A=e.getoffsetX(h.glyphStartIndex),E=e.getoffsetX(x-1),R=rn(u*A,i,s,l,h.segment,T,M,_,f);if(!R)return null;const O=rn(u*E,i,s,l,h.segment,T,M,_,f);return O?_.projectionCache.anyProjectionOccluded?null:{first:R,last:O}:null}function Ri(u,e,i,s){return u===o.an.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*s?{useVertical:!0}:(u===o.an.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function Ht(u){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:s,fontSize:l,flip:h,keepUpright:f,glyphOffsetArray:_,dynamicLayoutVertexArray:x,aspectRatio:T,rotateToLine:M}=u,A=l/24,E=s.lineOffsetX*A,R=s.lineOffsetY*A;let O;if(s.numGlyphs>1){const q=s.glyphStartIndex+s.numGlyphs,$=s.lineStartIndex,W=s.lineStartIndex+s.lineLength,X=De(A,_,E,R,h,s,M,e);if(!X)return{notEnoughRoom:!0};const ee=ht(X.first.point.x,X.first.point.y,e,i),Y=ht(X.last.point.x,X.last.point.y,e,i);if(f&&!h){const ie=Ri(s.writingMode,ee,Y,T);if(ie)return ie}O=[X.first];for(let ie=s.glyphStartIndex+1;ie<q-1;ie++){const re=rn(A*_.getoffsetX(ie),E,R,h,s.segment,$,W,e,M);if(!re)return{notEnoughRoom:!0};O.push(re)}O.push(X.last)}else{if(f&&!h){const $=Oe(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,W=s.lineStartIndex+s.segment+1,X=new o.P(e.lineVertexArray.getx(W),e.lineVertexArray.gety(W)),ee=Oe(X.x,X.y,e),Y=ee.signedDistanceFromCamera>0?ee.point:Fn(e.tileAnchorPoint,X,$,1,e),ie=ht($.x,$.y,e,i),re=ht(Y.x,Y.y,e,i),K=Ri(s.writingMode,ie,re,T);if(K)return K}const q=rn(A*_.getoffsetX(s.glyphStartIndex),E,R,h,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,e,M);if(!q||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};O=[q]}for(const q of O)o.au(x,q.point,q.angle);return{}}function Fn(u,e,i,s,l){const h=u.add(u.sub(e)._unit()),f=Oe(h.x,h.y,l).point,_=i.sub(f);return i.add(_._mult(s/_.mag()))}function na(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=Oe(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 Fn(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 Oe(u,e,i){const s=u+i.translation[0],l=e+i.translation[1];let h;return i.pitchWithMap?(h=Pt(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 ht(u,e,i,s){if(i.pitchWithMap){const l=[u,e,0,1];return o.av(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 dt(u,e,i){return i.transform.projectTileCoordinates(u,e,i.unwrappedTileID,i.getElevation)}function gr(u,e,i){return u._unit()._perp()._mult(e*i)}function Co(u,e,i,s,l,h,f,_,x){if(_.projectionCache.offsets[u])return _.projectionCache.offsets[u];const T=i.add(e);if(u+x.direction<s||u+x.direction>=l)return _.projectionCache.offsets[u]=T,T;const M=na(u+x.direction,_,x),A=gr(M.sub(i),f,x.direction),E=i.add(A),R=M.add(A);return _.projectionCache.offsets[u]=o.aw(h,T,E,R)||T,_.projectionCache.offsets[u]}function rn(u,e,i,s,l,h,f,_,x){const T=s?u-e:u+e;let M=T>0?1:-1,A=0;s&&(M*=-1,A=Math.PI),M<0&&(A+=Math.PI);let E,R=M>0?h+l:h+l+1;_.projectionCache.cachedAnchorPoint?E=_.projectionCache.cachedAnchorPoint:(E=Oe(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=E);let O,q,$=E,W=E,X=0,ee=0;const Y=Math.abs(T),ie=[];let re;for(;X+ee<=Y;){if(R+=M,R<h||R>=f)return null;X+=ee,W=$,q=O;const _e={absOffsetX:Y,direction:M,distanceFromAnchor:X,previousVertex:W};if($=na(R,_,_e),i===0)ie.push(W),re=$.sub(W);else{let pe;const fe=$.sub(W);pe=fe.mag()===0?gr(na(R+M,_,_e).sub($),i,M):gr(fe,i,M),q||(q=W.add(pe)),O=Co(R,pe,$,h,f,q,i,_,_e),ie.push(q),re=O.sub(q)}ee=re.mag()}const K=re._mult((Y-X)/ee)._add(q||W),oe=A+Math.atan2($.y-W.y,$.x-W.x);return ie.push(K),{point:K,angle:x?oe:0,path:ie}}const pt=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function _n(u,e){for(let i=0;i<u;i++){const s=e.length;e.resize(s+4),e.float32.set(pt,3*s)}}function aa(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 ui=100;class xs{constructor(e,i=new Ye(e.width+200,e.height+200,25),s=new Ye(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+ui,this.screenBottomBoundary=e.height+ui,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,i,s,l,h,f,_,x,T,M,A,E){const R=this.projectAndGetPerspectiveRatio(e.anchorPointX+x[0],e.anchorPointY+x[1],h,M,E),O=s*R.perspectiveRatio;let q;if(f||_)q=this._projectCollisionBox(e,O,l,h,f,_,x,R,M,A,E);else{const re=R.x+(A?A.x*O:0),K=R.y+(A?A.y*O:0);q={allPointsOccluded:!1,box:[re+e.x1*O,K+e.y1*O,re+e.x2*O,K+e.y2*O]}}const[$,W,X,ee]=q.box,Y=f?q.allPointsOccluded:R.isOccluded;let ie=Y;return ie||(ie=R.perspectiveRatio<this.perspectiveRatioCutoff),ie||(ie=!this.isInsideGrid($,W,X,ee)),ie||i!=="always"&&this.grid.hitTest($,W,X,ee,i,T)?{box:[$,W,X,ee],placeable:!1,offscreen:!1,occluded:Y}:{box:[$,W,X,ee],placeable:!0,offscreen:this.isOffscreen($,W,X,ee),occluded:Y}}placeCollisionCircles(e,i,s,l,h,f,_,x,T,M,A,E,R,O){const q=[],$=new o.P(i.anchorX,i.anchorY),W=this.getPerspectiveRatio($.x,$.y,f,O),X=(T?h*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,f)/W:h*W)/o.aA,ee={getElevation:O,pitchedLabelPlaneMatrix:_,lineVertexArray:s,pitchWithMap:T,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:$,unwrappedTileID:f,width:this.transform.width,height:this.transform.height,translation:R},Y=De(X,l,i.lineOffsetX*X,i.lineOffsetY*X,!1,i,!1,ee);let ie=!1,re=!1,K=!0;if(Y){const oe=.5*A*W+E,_e=new o.P(-100,-100),pe=new o.P(this.screenRightBoundary,this.screenBottomBoundary),fe=new tt,xe=Y.first,Fe=Y.last;let Le=[];for(let ot=xe.path.length-1;ot>=1;ot--)Le.push(xe.path[ot]);for(let ot=1;ot<Fe.path.length;ot++)Le.push(Fe.path[ot]);const Ie=2.5*oe;if(T){const ot=this.projectPathToScreenSpace(Le,ee);Le=ot.some(Ct=>Ct.signedDistanceFromCamera<=0)?[]:ot.map(Ct=>Ct.point)}let $e=[];if(Le.length>0){const ot=Le[0].clone(),Ct=Le[0].clone();for(let Jt=1;Jt<Le.length;Jt++)ot.x=Math.min(ot.x,Le[Jt].x),ot.y=Math.min(ot.y,Le[Jt].y),Ct.x=Math.max(Ct.x,Le[Jt].x),Ct.y=Math.max(Ct.y,Le[Jt].y);$e=ot.x>=_e.x&&Ct.x<=pe.x&&ot.y>=_e.y&&Ct.y<=pe.y?[Le]:Ct.x<_e.x||ot.x>pe.x||Ct.y<_e.y||ot.y>pe.y?[]:o.ax([Le],_e.x,_e.y,pe.x,pe.y)}for(const ot of $e){fe.reset(ot,.25*oe);let Ct=0;Ct=fe.length<=.5*oe?1:Math.ceil(fe.paddedLength/Ie)+1;for(let Jt=0;Jt<Ct;Jt++){const Bt=Jt/Math.max(Ct-1,1),Qt=fe.lerp(Bt),Nt=Qt.x+ui,Ot=Qt.y+ui;q.push(Nt,Ot,oe,0);const Vt=Nt-oe,Li=Ot-oe,Tt=Nt+oe,Pi=Ot+oe;if(K=K&&this.isOffscreen(Vt,Li,Tt,Pi),re=re||this.isInsideGrid(Vt,Li,Tt,Pi),e!=="always"&&this.grid.hitTestCircle(Nt,Ot,oe,e,M)&&(ie=!0,!x))return{circles:[],offscreen:!1,collisionDetected:ie}}}}return{circles:!x&&ie||!re||W<this.perspectiveRatioCutoff?[]:q,offscreen:K,collisionDetected:ie}}projectPathToScreenSpace(e,i){const s=function(l,h){const f=o.L();return o.ap(f,h.pitchedLabelPlaneMatrix),l.map(_=>{const x=Pt(_.x,_.y,f,h.getElevation),T=h.transform.projectTileCoordinates(x.point.x,x.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,x=0;for(let T=0;T<l.length;T++)l[T].isOccluded?(_=T+1,x=0):(x++,x>f&&(f=x,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=[],s=new o.a1;for(const A of e){const E=new o.P(A.x+ui,A.y+ui);s.extend(E),i.push(E)}const{minX:l,minY:h,maxX:f,maxY:_}=s,x=this.grid.query(l,h,f,_).concat(this.ignoredGrid.query(l,h,f,_)),T={},M={};for(const A of x){const E=A.key;if(T[E.bucketInstanceId]===void 0&&(T[E.bucketInstanceId]={}),T[E.bucketInstanceId][E.featureIndex])continue;const R=[new o.P(A.x1,A.y1),new o.P(A.x2,A.y1),new o.P(A.x2,A.y2),new o.P(A.x1,A.y2)];o.ay(i,R)&&(T[E.bucketInstanceId][E.featureIndex]=!0,M[E.bucketInstanceId]===void 0&&(M[E.bucketInstanceId]=[]),M[E.bucketInstanceId].push(E.featureIndex))}return M}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,x={bucketInstanceId:l,featureIndex:h,collisionGroupID:f,overlapMode:i};for(let T=0;T<e.length;T+=4)_.insertCircle(x,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.av(f,f,h)):(f=[e,i,0,1],aa(f,f,h));const _=f[3];return{x:(f[0]/_+1)/2*this.transform.width+ui,y:(-f[1]/_+1)/2*this.transform.height+ui,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+ui,y:(1-f.point.y)/2*this.transform.height+ui,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<ui||e>=this.screenRightBoundary||l<ui||i>this.screenBottomBoundary}isInsideGrid(e,i,s,l){return s>=0&&e<this.gridRightBoundary&&l>=0&&i<this.gridBottomBoundary}getViewportMatrix(){const e=o.af([]);return o.M(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,s,l,h,f,_,x,T,M,A){let E=1,R=0,O=0,q=1;const $=e.anchorPointX+_[0],W=e.anchorPointY+_[1];if(f&&!h){const Le=this.projectAndGetPerspectiveRatio($+1,W,l,T,A),Ie=Le.x-x.x,$e=Math.atan((Le.y-x.y)/Ie)+(Ie<0?Math.PI:0),ot=Math.sin($e),Ct=Math.cos($e);E=Ct,R=ot,O=-ot,q=Ct}else if(!f&&h){const Le=zt(this.transform);E=Le.vecEast[0],R=Le.vecEast[1],O=Le.vecSouth[0],q=Le.vecSouth[1]}let X=x.x,ee=x.y,Y=i;h&&(X=$,ee=W,Y=Math.pow(2,-(this.transform.zoom-s.overscaledZ)),Y*=this.transform.getPitchedTextCorrection($,W,l),M||(Y*=o.ag(.5+x.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),M&&(X+=E*M.x*Y+O*M.y*Y,ee+=R*M.x*Y+q*M.y*Y);const ie=e.x1*Y,re=e.x2*Y,K=(ie+re)/2,oe=e.y1*Y,_e=e.y2*Y,pe=(oe+_e)/2,fe=[{offsetX:ie,offsetY:oe},{offsetX:K,offsetY:oe},{offsetX:re,offsetY:oe},{offsetX:re,offsetY:pe},{offsetX:re,offsetY:_e},{offsetX:K,offsetY:_e},{offsetX:ie,offsetY:_e},{offsetX:ie,offsetY:pe}];let xe=[];for(const{offsetX:Le,offsetY:Ie}of fe)xe.push(new o.P(X+E*Le+O*Ie,ee+R*Le+q*Ie));let Fe=!1;if(h){const Le=xe.map(Ie=>this.projectAndGetPerspectiveRatio(Ie.x,Ie.y,l,T,A));Fe=Le.some(Ie=>!Ie.isOccluded),xe=Le.map(Ie=>new o.P(Ie.x,Ie.y))}else Fe=!0;return{box:o.az(xe),allPointsOccluded:!Fe}}}class vs{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 yn{constructor(e,i,s,l,h){this.text=new vs(e?e.text:null,i,s,h),this.icon=new vs(e?e.icon:null,i,l,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class bs{constructor(e,i,s){this.text=e,this.icon=i,this.skipFade=s}}class _r{constructor(e,i,s,l,h){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=s,this.bucketIndex=l,this.tileID=h}}class Xt{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 _u(u,e,i,s,l){const{horizontalAlign:h,verticalAlign:f}=o.aG(u);return new o.P(-(h-.5)*e+s[0]*l,-(f-.5)*i+s[1]*l)}class ws{constructor(e,i,s,l,h){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new xs(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Xt(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,x=h.layers[0].layout,T=h.layers[0].paint,M=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),A=s.tileSize/o.$,E=s.tileID.toUnwrapped(),R=x.get("text-rotation-alignment")==="map",O=o.aB(s,1,this.transform.zoom),q=o.aC(this.collisionIndex.transform,s,T.get("text-translate"),T.get("text-translate-anchor")),$=o.aC(this.collisionIndex.transform,s,T.get("icon-translate"),T.get("icon-translate-anchor")),W=nt(R,this.transform,O);this.retainedQueryData[h.bucketInstanceId]=new _r(h.bucketInstanceId,f,h.sourceLayerIndex,h.index,s.tileID);const X={bucket:h,layout:x,translationText:q,translationIcon:$,unwrappedTileID:E,pitchedLabelPlaneMatrix:W,scale:M,textPixelRatio:A,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:o.am(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(l)for(const ee of h.sortKeyRanges){const{sortKey:Y,symbolInstanceStart:ie,symbolInstanceEnd:re}=ee;e.push({sortKey:Y,symbolInstanceStart:ie,symbolInstanceEnd:re,parameters:X})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:X})}attemptAnchorPlacement(e,i,s,l,h,f,_,x,T,M,A,E,R,O,q,$,W,X,ee,Y){const ie=o.aD[e.textAnchor],re=[e.textOffset0,e.textOffset1],K=_u(ie,s,l,re,h),oe=this.collisionIndex.placeCollisionBox(i,E,x,T,M,_,f,$,A.predicate,ee,K,Y);if((!X||this.collisionIndex.placeCollisionBox(X,E,x,T,M,_,f,W,A.predicate,ee,K,Y).placeable)&&oe.placeable){let _e;if(this.prevPlacement&&this.prevPlacement.variableOffsets[R.crossTileID]&&this.prevPlacement.placements[R.crossTileID]&&this.prevPlacement.placements[R.crossTileID].text&&(_e=this.prevPlacement.variableOffsets[R.crossTileID].anchor),R.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[R.crossTileID]={textOffset:re,width:s,height:l,anchor:ie,textBoxScale:h,prevAnchor:_e},this.markUsedJustification(O,ie,R,q),O.allowVerticalPlacement&&(this.markUsedOrientation(O,q,R),this.placedOrientations[R.crossTileID]=q),{shift:K,placedGlyphBoxes:oe}}}placeLayerBucketPart(e,i,s){const{bucket:l,layout:h,translationText:f,translationIcon:_,unwrappedTileID:x,pitchedLabelPlaneMatrix:T,textPixelRatio:M,holdingForFade:A,collisionBoxArray:E,partiallyEvaluatedTextSize:R,collisionGroup:O}=e.parameters,q=h.get("text-optional"),$=h.get("icon-optional"),W=o.aE(h,"text-overlap","text-allow-overlap"),X=W==="always",ee=o.aE(h,"icon-overlap","icon-allow-overlap"),Y=ee==="always",ie=h.get("text-rotation-alignment")==="map",re=h.get("text-pitch-alignment")==="map",K=h.get("icon-text-fit")!=="none",oe=h.get("symbol-z-order")==="viewport-y",_e=X&&(Y||!l.hasIconData()||$),pe=Y&&(X||!l.hasTextData()||q);!l.collisionArrays&&E&&l.deserializeCollisionBoxes(E);const fe=this.retainedQueryData[l.bucketInstanceId].tileID,xe=this._getTerrainElevationFunc(fe),Fe=this.transform.getFastPathSimpleProjectionMatrix(fe),Le=(Ie,$e,ot)=>{var Ct,Jt;if(i[Ie.crossTileID])return;if(A)return void(this.placements[Ie.crossTileID]=new bs(!1,!1,!1));let Bt=!1,Qt=!1,Nt=!0,Ot=null,Vt={box:null,placeable:!1,offscreen:null,occluded:!1},Li={placeable:!1},Tt=null,Pi=null,Fi=null,$n=0,Gn=0,qn=0;$e.textFeatureIndex?$n=$e.textFeatureIndex:Ie.useRuntimeCollisionCircles&&($n=Ie.featureIndex),$e.verticalTextFeatureIndex&&(Gn=$e.verticalTextFeatureIndex);const cn=$e.textBox;if(cn){const or=si=>{let Ut=o.an.horizontal;if(l.allowVerticalPlacement&&!si&&this.prevPlacement){const Qi=this.prevPlacement.placedOrientations[Ie.crossTileID];Qi&&(this.placedOrientations[Ie.crossTileID]=Qi,Ut=Qi,this.markUsedOrientation(l,Ut,Ie))}return Ut},Zr=(si,Ut)=>{if(l.allowVerticalPlacement&&Ie.numVerticalGlyphVertices>0&&$e.verticalTextBox){for(const Qi of l.writingModes)if(Qi===o.an.vertical?(Vt=Ut(),Li=Vt):Vt=si(),Vt&&Vt.placeable)break}else Vt=si()},Wn=Ie.textAnchorOffsetStartIndex,_a=Ie.textAnchorOffsetEndIndex;if(_a===Wn){const si=(Ut,Qi)=>{const _i=this.collisionIndex.placeCollisionBox(Ut,W,M,fe,x,re,ie,f,O.predicate,xe,void 0,Fe);return _i&&_i.placeable&&(this.markUsedOrientation(l,Qi,Ie),this.placedOrientations[Ie.crossTileID]=Qi),_i};Zr(()=>si(cn,o.an.horizontal),()=>{const Ut=$e.verticalTextBox;return l.allowVerticalPlacement&&Ie.numVerticalGlyphVertices>0&&Ut?si(Ut,o.an.vertical):{box:null,offscreen:null}}),or(Vt&&Vt.placeable)}else{let si=o.aD[(Jt=(Ct=this.prevPlacement)===null||Ct===void 0?void 0:Ct.variableOffsets[Ie.crossTileID])===null||Jt===void 0?void 0:Jt.anchor];const Ut=(_i,uh,Fd)=>{const Pc=_i.x2-_i.x1,Qs=_i.y2-_i.y1,os=Ie.textBoxScale,Tn=K&&ee==="never"?uh:null;let Bi=null,Sn=W==="never"?1:2,Mc="never";si&&Sn++;for(let Hn=0;Hn<Sn;Hn++){for(let Cc=Wn;Cc<_a;Cc++){const Ic=l.textAnchorOffsets.get(Cc);if(si&&Ic.textAnchor!==si)continue;const eo=this.attemptAnchorPlacement(Ic,_i,Pc,Qs,os,ie,re,M,fe,x,O,Mc,Ie,l,Fd,f,_,Tn,xe);if(eo&&(Bi=eo.placedGlyphBoxes,Bi&&Bi.placeable))return Bt=!0,Ot=eo.shift,Bi}si?si=null:Mc=W}return s&&!Bi&&(Bi={box:this.collisionIndex.placeCollisionBox(cn,"always",M,fe,x,re,ie,f,O.predicate,xe,void 0,Fe).box,offscreen:!1,placeable:!1,occluded:!1}),Bi};Zr(()=>Ut(cn,$e.iconBox,o.an.horizontal),()=>{const _i=$e.verticalTextBox;return l.allowVerticalPlacement&&(!Vt||!Vt.placeable)&&Ie.numVerticalGlyphVertices>0&&_i?Ut(_i,$e.verticalIconBox,o.an.vertical):{box:null,occluded:!0,offscreen:null}}),Vt&&(Bt=Vt.placeable,Nt=Vt.offscreen);const Qi=or(Vt&&Vt.placeable);if(!Bt&&this.prevPlacement){const _i=this.prevPlacement.variableOffsets[Ie.crossTileID];_i&&(this.variableOffsets[Ie.crossTileID]=_i,this.markUsedJustification(l,_i.anchor,Ie,Qi))}}}if(Tt=Vt,Bt=Tt&&Tt.placeable,Nt=Tt&&Tt.offscreen,Ie.useRuntimeCollisionCircles){const or=l.text.placedSymbolArray.get(Ie.centerJustifiedTextSymbolIndex),Zr=o.ao(l.textSizeData,R,or),Wn=h.get("text-padding");Pi=this.collisionIndex.placeCollisionCircles(W,or,l.lineVertexArray,l.glyphOffsetArray,Zr,x,T,s,re,O.predicate,Ie.collisionCircleDiameter,Wn,f,xe),Pi.circles.length&&Pi.collisionDetected&&!s&&o.w("Collisions detected, but collision boxes are not shown"),Bt=X||Pi.circles.length>0&&!Pi.collisionDetected,Nt=Nt&&Pi.offscreen}if($e.iconFeatureIndex&&(qn=$e.iconFeatureIndex),$e.iconBox){const or=Zr=>this.collisionIndex.placeCollisionBox(Zr,ee,M,fe,x,re,ie,_,O.predicate,xe,K&&Ot?Ot:void 0,Fe);Li&&Li.placeable&&$e.verticalIconBox?(Fi=or($e.verticalIconBox),Qt=Fi.placeable):(Fi=or($e.iconBox),Qt=Fi.placeable),Nt=Nt&&Fi.offscreen}const Ks=q||Ie.numHorizontalGlyphVertices===0&&Ie.numVerticalGlyphVertices===0,Js=$||Ie.numIconVertices===0;Ks||Js?Js?Ks||(Qt=Qt&&Bt):Bt=Qt&&Bt:Qt=Bt=Qt&&Bt;const ss=Qt&&Fi.placeable;if(Bt&&Tt.placeable&&this.collisionIndex.insertCollisionBox(Tt.box,W,h.get("text-ignore-placement"),l.bucketInstanceId,Li&&Li.placeable&&Gn?Gn:$n,O.ID),ss&&this.collisionIndex.insertCollisionBox(Fi.box,ee,h.get("icon-ignore-placement"),l.bucketInstanceId,qn,O.ID),Pi&&Bt&&this.collisionIndex.insertCollisionCircles(Pi.circles,W,h.get("text-ignore-placement"),l.bucketInstanceId,$n,O.ID),s&&this.storeCollisionData(l.bucketInstanceId,ot,$e,Tt,Fi,Pi),Ie.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[Ie.crossTileID]=new bs((Bt||_e)&&!(Tt!=null&&Tt.occluded),(Qt||pe)&&!(Fi!=null&&Fi.occluded),Nt||l.justReloaded),i[Ie.crossTileID]=!0};if(oe){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Ie=l.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let $e=Ie.length-1;$e>=0;--$e){const ot=Ie[$e];Le(l.symbolInstances.get(ot),l.collisionArrays[ot],ot)}}else for(let Ie=e.symbolInstanceStart;Ie<e.symbolInstanceEnd;Ie++)Le(l.symbolInstances.get(Ie),l.collisionArrays[Ie],Ie);l.justReloaded=!1}storeCollisionData(e,i,s,l,h,f){if(s.textBox||s.iconBox){let _,x;this.collisionBoxArrays.has(e)?_=this.collisionBoxArrays.get(e):(_=new Map,this.collisionBoxArrays.set(e,_)),_.has(i)?x=_.get(i):(x={text:null,icon:null},_.set(i,x)),s.textBox&&(x.text=l.box),s.iconBox&&(x.icon=h.box)}if(f){let _=this.collisionCircleArrays[e];_===void 0&&(_=this.collisionCircleArrays[e]=[]);for(let x=0;x<f.circles.length;x+=4)_.push(f.circles[x+0]-ui),_.push(f.circles[x+1]-ui),_.push(f.circles[x+2]),_.push(f.collisionDetected?1:0)}}markUsedJustification(e,i,s,l){let h;h=l===o.an.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[o.aF(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.an.horizontal||i===o.an.horizontalOnly?i:0,h=i===o.an.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 x in this.placements){const T=this.placements[x],M=h[x];M?(this.opacities[x]=new yn(M,l,T.text,T.icon),s=s||T.text!==M.text.placed||T.icon!==M.icon.placed):(this.opacities[x]=new yn(null,l,T.text,T.icon,T.skipFade),s=s||T.text||T.icon)}for(const x in h){const T=h[x];if(!this.opacities[x]){const M=new yn(T,l,!1,!1);M.isHidden()||(this.opacities[x]=M,s=s||T.text.placed||T.icon.placed)}}for(const x in f)this.variableOffsets[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.variableOffsets[x]=f[x]);for(const x in _)this.placedOrientations[x]||!this.opacities[x]||this.opacities[x].isHidden()||(this.placedOrientations[x]=_[x]);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 yn(null,0,!1,!1,!0),x=f.get("text-allow-overlap"),T=f.get("icon-allow-overlap"),M=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),A=f.get("text-rotation-alignment")==="map",E=f.get("text-pitch-alignment")==="map",R=f.get("icon-text-fit")!=="none",O=new yn(null,0,x&&(T||!e.hasIconData()||f.get("icon-optional")),T&&(x||!e.hasTextData()||f.get("text-optional")),!0);!e.collisionArrays&&l&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(l);const q=(W,X,ee)=>{for(let Y=0;Y<X/4;Y++)W.opacityVertexArray.emplaceBack(ee);W.hasVisibleVertices=W.hasVisibleVertices||ee!==Ts},$=this.collisionBoxArrays.get(e.bucketInstanceId);for(let W=0;W<e.symbolInstances.length;W++){const X=e.symbolInstances.get(W),{numHorizontalGlyphVertices:ee,numVerticalGlyphVertices:Y,crossTileID:ie}=X;let re=this.opacities[ie];s[ie]?re=_:re||(re=O,this.opacities[ie]=re),s[ie]=!0;const K=X.numIconVertices>0,oe=this.placedOrientations[X.crossTileID],_e=oe===o.an.vertical,pe=oe===o.an.horizontal||oe===o.an.horizontalOnly;if(ee>0||Y>0){const xe=wu(re.text);q(e.text,ee,_e?Ts:xe),q(e.text,Y,pe?Ts:xe);const Fe=re.text.isHidden();[X.rightJustifiedTextSymbolIndex,X.centerJustifiedTextSymbolIndex,X.leftJustifiedTextSymbolIndex].forEach($e=>{$e>=0&&(e.text.placedSymbolArray.get($e).hidden=Fe||_e?1:0)}),X.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(X.verticalPlacedTextSymbolIndex).hidden=Fe||pe?1:0);const Le=this.variableOffsets[X.crossTileID];Le&&this.markUsedJustification(e,Le.anchor,X,oe);const Ie=this.placedOrientations[X.crossTileID];Ie&&(this.markUsedJustification(e,"left",X,Ie),this.markUsedOrientation(e,Ie,X))}if(K){const xe=wu(re.icon),Fe=!(R&&X.verticalPlacedIconSymbolIndex&&_e);X.placedIconSymbolIndex>=0&&(q(e.icon,X.numIconVertices,Fe?xe:Ts),e.icon.placedSymbolArray.get(X.placedIconSymbolIndex).hidden=re.icon.isHidden()),X.verticalPlacedIconSymbolIndex>=0&&(q(e.icon,X.numVerticalIconVertices,Fe?Ts:xe),e.icon.placedSymbolArray.get(X.verticalPlacedIconSymbolIndex).hidden=re.icon.isHidden())}const fe=$&&$.has(W)?$.get(W):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const xe=e.collisionArrays[W];if(xe){let Fe=new o.P(0,0);if(xe.textBox||xe.verticalTextBox){let Le=!0;if(M){const Ie=this.variableOffsets[ie];Ie?(Fe=_u(Ie.anchor,Ie.width,Ie.height,Ie.textOffset,Ie.textBoxScale),A&&Fe._rotate(E?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Le=!1}if(xe.textBox||xe.verticalTextBox){let Ie;xe.textBox&&(Ie=_e),xe.verticalTextBox&&(Ie=pe),Io(e.textCollisionBox.collisionVertexArray,re.text.placed,!Le||Ie,fe.text,Fe.x,Fe.y)}}if(xe.iconBox||xe.verticalIconBox){const Le=!!(!pe&&xe.verticalIconBox);let Ie;xe.iconBox&&(Ie=Le),xe.verticalIconBox&&(Ie=!Le),Io(e.iconCollisionBox.collisionVertexArray,re.icon.placed,Ie,fe.icon,R?Fe.x:0,R?Fe.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 Io(u,e,i,s,l,h){s&&s.length!==0||(s=[0,0,0,0]);const f=s[0]-ui,_=s[1]-ui,x=s[2]-ui,T=s[3]-ui;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,x,_),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,x,T),u.emplaceBack(e?1:0,i?1:0,l||0,h||0,f,T)}const sa=Math.pow(2,25),Bn=Math.pow(2,24),yu=Math.pow(2,17),xu=Math.pow(2,16),vu=Math.pow(2,9),Da=Math.pow(2,8),bu=Math.pow(2,1);function wu(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*sa+e*Bn+i*yu+e*xu+i*vu+e*Da+i*bu+e}const Ts=0;class ud{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((_,x)=>_.sortKey-x.sortKey));this._currentPartIndex<f.length;)if(i.placeLayerBucketPart(f[this._currentPartIndex],this._seenCrossTileIDs,s),this._currentPartIndex++,h())return!0;return!1}}class Tu{constructor(e,i,s,l,h,f,_,x){this.placement=new ws(e,i,f,_,x),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=l,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(e,i,s){const l=Ae.now(),h=()=>!this._forceFullPlacement&&Ae.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 ud(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 La=512/o.$/2;class Dl{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,x=l.get(_);x?x.push(f):l.set(_,[f])}for(const[h,f]of l){const _={positions:f.map(x=>({x:Math.floor(x.anchorX*La),y:Math.floor(x.anchorY*La)})),crossTileIDs:f.map(x=>x.crossTileID)};if(_.positions.length>128){const x=new o.aH(_.positions.length,16,Uint16Array);for(const{x:T,y:M}of _.positions)x.add(T,M);x.finish(),delete _.positions,_.index=x}this._symbolsByKey[h]=_}}getScaledCoordinates(e,i){const{x:s,y:l,z:h}=this.tileID.canonical,{x:f,y:_,z:x}=i.canonical,T=La/Math.pow(2,x-h),M=(_*o.$+e.anchorY)*T,A=l*o.$*La;return{x:Math.floor((f*o.$+e.anchorX)*T-s*o.$*La),y:Math.floor(M-A)}}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 x=this.getScaledCoordinates(f,i);if(_.index){const T=_.index.range(x.x-l,x.y-l,x.x+l,x.y+l).sort();for(const M of T){const A=_.crossTileIDs[M];if(!s[A]){s[A]=!0,f.crossTileID=A;break}}}else if(_.positions)for(let T=0;T<_.positions.length;T++){const M=_.positions[T],A=_.crossTileIDs[T];if(Math.abs(M.x-x.x)<=l&&Math.abs(M.y-x.y)<=l&&!s[A]){s[A]=!0,f.crossTileID=A;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class Ll{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Su{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 x=f[_];x.tileID.isChildOf(e)&&x.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 Dl(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 Eo{constructor(){this.layerIndexes={},this.crossTileIDs=new Ll,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,s){let l=this.layerIndexes[e.id];l===void 0&&(l=this.layerIndexes[e.id]=new Su);let h=!1;const f={};l.handleWrapJump(s);for(const _ of i){const x=_.getBucket(e);x&&e.id===x.layerIds[0]&&(x.bucketInstanceId||(x.bucketInstanceId=++this.maxBucketInstanceId),l.addBucket(_.tileID,x,this.crossTileIDs)&&(h=!0),f[x.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 Ao="void main() {fragColor=vec4(1.0);}";const nn={prelude:mt(`#ifdef GL_ES
|
|
7
|
-
precision mediump float;
|
|
8
|
-
#else
|
|
9
|
-
#if !defined(lowp)
|
|
10
|
-
#define lowp
|
|
11
|
-
#endif
|
|
12
|
-
#if !defined(mediump)
|
|
13
|
-
#define mediump
|
|
14
|
-
#endif
|
|
15
|
-
#if !defined(highp)
|
|
16
|
-
#define highp
|
|
17
|
-
#endif
|
|
18
|
-
#endif
|
|
19
|
-
out highp vec4 fragColor;`,`#ifdef GL_ES
|
|
20
|
-
precision highp float;
|
|
21
|
-
#else
|
|
22
|
-
#if !defined(lowp)
|
|
23
|
-
#define lowp
|
|
24
|
-
#endif
|
|
25
|
-
#if !defined(mediump)
|
|
26
|
-
#define mediump
|
|
27
|
-
#endif
|
|
28
|
-
#if !defined(highp)
|
|
29
|
-
#define highp
|
|
30
|
-
#endif
|
|
31
|
-
#endif
|
|
32
|
-
vec2 unpack_float(const float packedValue) {int packedIntValue=int(packedValue);int v0=packedIntValue/256;return vec2(v0,packedIntValue-v0*256);}vec2 unpack_opacity(const float packedOpacity) {int intOpacity=int(packedOpacity)/2;return vec2(float(intOpacity)/127.0,mod(packedOpacity,2.0));}vec4 decode_color(const vec2 encodedColor) {return vec4(unpack_float(encodedColor[0])/255.0,unpack_float(encodedColor[1])/255.0
|
|
33
|
-
);}float unpack_mix_vec2(const vec2 packedValue,const float t) {return mix(packedValue[0],packedValue[1],t);}vec4 unpack_mix_color(const vec4 packedColors,const float t) {vec4 minColor=decode_color(vec2(packedColors[0],packedColors[1]));vec4 maxColor=decode_color(vec2(packedColors[2],packedColors[3]));return mix(minColor,maxColor,t);}vec2 get_pattern_pos(const vec2 pixel_coord_upper,const vec2 pixel_coord_lower,const vec2 pattern_size,const float tile_units_to_pixels,const vec2 pos) {vec2 offset=mod(mod(mod(pixel_coord_upper,pattern_size)*256.0,pattern_size)*256.0+pixel_coord_lower,pattern_size);return (tile_units_to_pixels*pos+offset)/pattern_size;}mat3 rotationMatrixFromAxisAngle(vec3 u,float angle) {float c=cos(angle);float s=sin(angle);float c2=1.0-c;return mat3(u.x*u.x*c2+ c,u.x*u.y*c2-u.z*s,u.x*u.z*c2+u.y*s,u.y*u.x*c2+u.z*s,u.y*u.y*c2+ c,u.y*u.z*c2-u.x*s,u.z*u.x*c2-u.y*s,u.z*u.y*c2+u.x*s,u.z*u.z*c2+ c
|
|
34
|
-
);}
|
|
35
|
-
#ifdef TERRAIN3D
|
|
36
|
-
uniform sampler2D u_terrain;uniform float u_terrain_dim;uniform mat4 u_terrain_matrix;uniform vec4 u_terrain_unpack;uniform float u_terrain_exaggeration;uniform highp sampler2D u_depth;
|
|
37
|
-
#endif
|
|
38
|
-
const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitShifts=vec4(1.)/bitSh;highp float unpack(highp vec4 color) {return dot(color,bitShifts);}highp float depthOpacity(vec3 frag) {
|
|
39
|
-
#ifdef TERRAIN3D
|
|
40
|
-
highp float d=unpack(texture(u_depth,frag.xy*0.5+0.5))+0.0001-frag.z;return 1.0-max(0.0,min(1.0,-d*500.0));
|
|
41
|
-
#else
|
|
42
|
-
return 1.0;
|
|
43
|
-
#endif
|
|
44
|
-
}float calculate_visibility(vec4 pos) {
|
|
45
|
-
#ifdef TERRAIN3D
|
|
46
|
-
vec3 frag=pos.xyz/pos.w;highp float d=depthOpacity(frag);if (d > 0.95) return 1.0;return (d+depthOpacity(frag+vec3(0.0,0.01,0.0)))/2.0;
|
|
47
|
-
#else
|
|
48
|
-
return 1.0;
|
|
49
|
-
#endif
|
|
50
|
-
}float ele(vec2 pos) {
|
|
51
|
-
#ifdef TERRAIN3D
|
|
52
|
-
vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
|
|
53
|
-
#else
|
|
54
|
-
return 0.0;
|
|
55
|
-
#endif
|
|
56
|
-
}float get_elevation(vec2 pos) {
|
|
57
|
-
#ifdef TERRAIN3D
|
|
58
|
-
#ifdef GLOBE
|
|
59
|
-
if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
|
|
60
|
-
#endif
|
|
61
|
-
vec2 coord=(u_terrain_matrix*vec4(pos,0.0,1.0)).xy*u_terrain_dim+1.0;vec2 f=fract(coord);vec2 c=(floor(coord)+0.5)/(u_terrain_dim+2.0);float d=1.0/(u_terrain_dim+2.0);float tl=ele(c);float tr=ele(c+vec2(d,0.0));float bl=ele(c+vec2(0.0,d));float br=ele(c+vec2(d,d));float elevation=mix(mix(tl,tr,f.x),mix(bl,br,f.x),f.y);return elevation*u_terrain_exaggeration;
|
|
62
|
-
#else
|
|
63
|
-
return 0.0;
|
|
64
|
-
#endif
|
|
65
|
-
}const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:mt("","float projectLineThickness(float tileY) {return 1.0;}float projectCircleRadius(float tileY) {return 1.0;}vec4 projectTile(vec2 p) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);return result;}vec4 projectTile(vec2 p,vec2 rawPos) {vec4 result=u_projection_matrix*vec4(p,0.0,1.0);if (rawPos.y <-32767.5 || rawPos.y > 32766.5) {result.z=-10000000.0;}return result;}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return u_projection_matrix*vec4(posInTile,elevation,1.0);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {return projectTileWithElevation(posInTile,elevation);}"),projectionGlobe:mt("",`#define GLOBE_RADIUS 6371008.8
|
|
66
|
-
uniform highp vec4 u_projection_tile_mercator_coords;uniform highp vec4 u_projection_clipping_plane;uniform highp float u_projection_transition;uniform mat4 u_projection_fallback_matrix;vec3 globeRotateVector(vec3 vec,vec2 angles) {vec3 axisRight=vec3(vec.z,0.0,-vec.x);vec3 axisUp=cross(axisRight,vec);axisRight=normalize(axisRight);axisUp=normalize(axisUp);vec2 t=tan(angles);return normalize(vec+axisRight*t.x+axisUp*t.y);}mat3 globeGetRotationMatrix(vec3 spherePos) {vec3 axisRight=vec3(spherePos.z,0.0,-spherePos.x);vec3 axisDown=cross(axisRight,spherePos);axisRight=normalize(axisRight);axisDown=normalize(axisDown);return mat3(axisRight,axisDown,spherePos
|
|
67
|
-
);}float circumferenceRatioAtTileY(float tileY) {float mercator_pos_y=u_projection_tile_mercator_coords.y+u_projection_tile_mercator_coords.w*tileY;float spherical_y=2.0*atan(exp(PI-(mercator_pos_y*PI*2.0)))-PI*0.5;return cos(spherical_y);}float projectLineThickness(float tileY) {float thickness=1.0/circumferenceRatioAtTileY(tileY);
|
|
68
|
-
if (u_projection_transition < 0.999) {return mix(1.0,thickness,u_projection_transition);} else {return thickness;}}vec3 projectToSphere(vec2 translatedPos,vec2 rawPos) {vec2 mercator_pos=u_projection_tile_mercator_coords.xy+u_projection_tile_mercator_coords.zw*translatedPos;vec2 spherical;spherical.x=mercator_pos.x*PI*2.0+PI;spherical.y=2.0*atan(exp(PI-(mercator_pos.y*PI*2.0)))-PI*0.5;float len=cos(spherical.y);vec3 pos=vec3(sin(spherical.x)*len,sin(spherical.y),cos(spherical.x)*len
|
|
69
|
-
);if (rawPos.y <-32767.5) {pos=vec3(0.0,1.0,0.0);}if (rawPos.y > 32766.5) {pos=vec3(0.0,-1.0,0.0);}return pos;}vec3 projectToSphere(vec2 posInTile) {return projectToSphere(posInTile,vec2(0.0,0.0));}float globeComputeClippingZ(vec3 spherePos) {return (1.0-(dot(spherePos,u_projection_clipping_plane.xyz)+u_projection_clipping_plane.w));}vec4 interpolateProjection(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);globePosition.z=globeComputeClippingZ(elevatedPos)*globePosition.w;if (u_projection_transition > 0.999) {return globePosition;}vec4 flatPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);const float z_globeness_threshold=0.2;vec4 result=globePosition;result.z=mix(0.0,globePosition.z,clamp((u_projection_transition-z_globeness_threshold)/(1.0-z_globeness_threshold),0.0,1.0));result.xyw=mix(flatPosition.xyw,globePosition.xyw,u_projection_transition);if ((posInTile.y <-32767.5) || (posInTile.y > 32766.5)) {result=globePosition;const float poles_hidden_anim_percentage=0.02;result.z=mix(globePosition.z,100.0,pow(max((1.0-u_projection_transition)/poles_hidden_anim_percentage,0.0),8.0));}return result;}vec4 interpolateProjectionFor3D(vec2 posInTile,vec3 spherePos,float elevation) {vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);vec4 globePosition=u_projection_matrix*vec4(elevatedPos,1.0);if (u_projection_transition > 0.999) {return globePosition;}vec4 fallbackPosition=u_projection_fallback_matrix*vec4(posInTile,elevation,1.0);return mix(fallbackPosition,globePosition,u_projection_transition);}vec4 projectTile(vec2 posInTile) {return interpolateProjection(posInTile,projectToSphere(posInTile),0.0);}vec4 projectTile(vec2 posInTile,vec2 rawPos) {return interpolateProjection(posInTile,projectToSphere(posInTile,rawPos),0.0);}vec4 projectTileWithElevation(vec2 posInTile,float elevation) {return interpolateProjection(posInTile,projectToSphere(posInTile),elevation);}vec4 projectTileFor3D(vec2 posInTile,float elevation) {vec3 spherePos=projectToSphere(posInTile,posInTile);return interpolateProjectionFor3D(posInTile,spherePos,elevation);}`),background:mt(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
|
|
70
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
71
|
-
fragColor=vec4(1.0);
|
|
72
|
-
#endif
|
|
73
|
-
}`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:mt(`uniform vec2 u_pattern_tl_a;uniform vec2 u_pattern_br_a;uniform vec2 u_pattern_tl_b;uniform vec2 u_pattern_br_b;uniform vec2 u_texsize;uniform float u_mix;uniform float u_opacity;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;void main() {vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(u_pattern_tl_a/u_texsize,u_pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(u_pattern_tl_b/u_texsize,u_pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_mix)*u_opacity;
|
|
74
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
75
|
-
fragColor=vec4(1.0);
|
|
76
|
-
#endif
|
|
77
|
-
}`,"uniform vec2 u_pattern_size_a;uniform vec2 u_pattern_size_b;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_scale_a;uniform float u_scale_b;uniform float u_tile_units_to_pixels;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;void main() {gl_Position=projectTile(a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_a*u_pattern_size_a,u_tile_units_to_pixels,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,u_scale_b*u_pattern_size_b,u_tile_units_to_pixels,a_pos);}"),circle:mt(`in vec3 v_data;in float v_visibility;
|
|
78
|
-
#pragma mapbox: define highp vec4 color
|
|
79
|
-
#pragma mapbox: define mediump float radius
|
|
80
|
-
#pragma mapbox: define lowp float blur
|
|
81
|
-
#pragma mapbox: define lowp float opacity
|
|
82
|
-
#pragma mapbox: define highp vec4 stroke_color
|
|
83
|
-
#pragma mapbox: define mediump float stroke_width
|
|
84
|
-
#pragma mapbox: define lowp float stroke_opacity
|
|
85
|
-
void main() {
|
|
86
|
-
#pragma mapbox: initialize highp vec4 color
|
|
87
|
-
#pragma mapbox: initialize mediump float radius
|
|
88
|
-
#pragma mapbox: initialize lowp float blur
|
|
89
|
-
#pragma mapbox: initialize lowp float opacity
|
|
90
|
-
#pragma mapbox: initialize highp vec4 stroke_color
|
|
91
|
-
#pragma mapbox: initialize mediump float stroke_width
|
|
92
|
-
#pragma mapbox: initialize lowp float stroke_opacity
|
|
93
|
-
vec2 extrude=v_data.xy;float extrude_length=length(extrude);float antialiased_blur=v_data.z;float opacity_t=smoothstep(0.0,antialiased_blur,extrude_length-1.0);float color_t=stroke_width < 0.01 ? 0.0 : smoothstep(antialiased_blur,0.0,extrude_length-radius/(radius+stroke_width));fragColor=v_visibility*opacity_t*mix(color*opacity,stroke_color*stroke_opacity,color_t);const float epsilon=0.5/255.0;if (fragColor.r < epsilon && fragColor.g < epsilon && fragColor.b < epsilon && fragColor.a < epsilon) {discard;}
|
|
94
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
95
|
-
fragColor=vec4(1.0);
|
|
96
|
-
#endif
|
|
97
|
-
}`,`uniform bool u_scale_with_map;uniform bool u_pitch_with_map;uniform vec2 u_extrude_scale;uniform highp float u_globe_extrude_scale;uniform lowp float u_device_pixel_ratio;uniform highp float u_camera_to_center_distance;uniform vec2 u_translate;in vec2 a_pos;out vec3 v_data;out float v_visibility;
|
|
98
|
-
#pragma mapbox: define highp vec4 color
|
|
99
|
-
#pragma mapbox: define mediump float radius
|
|
100
|
-
#pragma mapbox: define lowp float blur
|
|
101
|
-
#pragma mapbox: define lowp float opacity
|
|
102
|
-
#pragma mapbox: define highp vec4 stroke_color
|
|
103
|
-
#pragma mapbox: define mediump float stroke_width
|
|
104
|
-
#pragma mapbox: define lowp float stroke_opacity
|
|
105
|
-
void main(void) {
|
|
106
|
-
#pragma mapbox: initialize highp vec4 color
|
|
107
|
-
#pragma mapbox: initialize mediump float radius
|
|
108
|
-
#pragma mapbox: initialize lowp float blur
|
|
109
|
-
#pragma mapbox: initialize lowp float opacity
|
|
110
|
-
#pragma mapbox: initialize highp vec4 stroke_color
|
|
111
|
-
#pragma mapbox: initialize mediump float stroke_width
|
|
112
|
-
#pragma mapbox: initialize lowp float stroke_opacity
|
|
113
|
-
vec2 pos_raw=a_pos+32768.0;vec2 extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);vec2 circle_center=floor(pos_raw/8.0)+u_translate;float ele=get_elevation(circle_center);v_visibility=calculate_visibility(projectTileWithElevation(circle_center,ele));if (u_pitch_with_map) {
|
|
114
|
-
#ifdef GLOBE
|
|
115
|
-
vec3 center_vector=projectToSphere(circle_center);
|
|
116
|
-
#endif
|
|
117
|
-
float angle_scale=u_globe_extrude_scale;vec2 corner_position=circle_center;if (u_scale_with_map) {angle_scale*=(radius+stroke_width);corner_position+=extrude*u_extrude_scale*(radius+stroke_width);} else {
|
|
118
|
-
#ifdef GLOBE
|
|
119
|
-
vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
|
|
120
|
-
#else
|
|
121
|
-
vec4 projected_center=projectTileWithElevation(circle_center,ele);
|
|
122
|
-
#endif
|
|
123
|
-
corner_position+=extrude*u_extrude_scale*(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);angle_scale*=(radius+stroke_width)*(projected_center.w/u_camera_to_center_distance);}
|
|
124
|
-
#ifdef GLOBE
|
|
125
|
-
vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
|
|
126
|
-
#else
|
|
127
|
-
gl_Position=projectTileWithElevation(corner_position,ele);
|
|
128
|
-
#endif
|
|
129
|
-
} else {gl_Position=projectTileWithElevation(circle_center,ele);if (gl_Position.z/gl_Position.w > 1.0) {gl_Position.xy=vec2(10000.0);}if (u_scale_with_map) {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*u_camera_to_center_distance;} else {gl_Position.xy+=extrude*(radius+stroke_width)*u_extrude_scale*gl_Position.w;}}float antialiasblur=-max(1.0/u_device_pixel_ratio/(radius+stroke_width),blur);v_data=vec3(extrude.x,extrude.y,antialiasblur);}`),clippingMask:mt(Ao,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:mt(`uniform highp float u_intensity;in vec2 v_extrude;
|
|
130
|
-
#pragma mapbox: define highp float weight
|
|
131
|
-
#define GAUSS_COEF 0.3989422804014327
|
|
132
|
-
void main() {
|
|
133
|
-
#pragma mapbox: initialize highp float weight
|
|
134
|
-
float d=-0.5*3.0*3.0*dot(v_extrude,v_extrude);float val=weight*u_intensity*GAUSS_COEF*exp(d);fragColor=vec4(val,1.0,1.0,1.0);
|
|
135
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
136
|
-
fragColor=vec4(1.0);
|
|
137
|
-
#endif
|
|
138
|
-
}`,`uniform float u_extrude_scale;uniform float u_opacity;uniform float u_intensity;uniform highp float u_globe_extrude_scale;in vec2 a_pos;out vec2 v_extrude;
|
|
139
|
-
#pragma mapbox: define highp float weight
|
|
140
|
-
#pragma mapbox: define mediump float radius
|
|
141
|
-
const highp float ZERO=1.0/255.0/16.0;
|
|
142
|
-
#define GAUSS_COEF 0.3989422804014327
|
|
143
|
-
void main(void) {
|
|
144
|
-
#pragma mapbox: initialize highp float weight
|
|
145
|
-
#pragma mapbox: initialize mediump float radius
|
|
146
|
-
vec2 pos_raw=a_pos+32768.0;vec2 unscaled_extrude=vec2(mod(pos_raw,8.0)/7.0*2.0-1.0);float S=sqrt(-2.0*log(ZERO/weight/u_intensity/GAUSS_COEF))/3.0;v_extrude=S*unscaled_extrude;vec2 extrude=v_extrude*radius*u_extrude_scale;vec2 circle_center=floor(pos_raw/8.0);
|
|
147
|
-
#ifdef GLOBE
|
|
148
|
-
vec2 angles=v_extrude*radius*u_globe_extrude_scale;vec3 center_vector=projectToSphere(circle_center);vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(circle_center+extrude,corner_vector,0.0);
|
|
149
|
-
#else
|
|
150
|
-
gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
|
|
151
|
-
#endif
|
|
152
|
-
}`),heatmapTexture:mt(`uniform sampler2D u_image;uniform sampler2D u_color_ramp;uniform float u_opacity;in vec2 v_pos;void main() {float t=texture(u_image,v_pos).r;vec4 color=texture(u_color_ramp,vec2(t,0.5));fragColor=color*u_opacity;
|
|
153
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
154
|
-
fragColor=vec4(0.0);
|
|
155
|
-
#endif
|
|
156
|
-
}`,"uniform mat4 u_matrix;uniform vec2 u_world;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos*u_world,0,1);v_pos.x=a_pos.x;v_pos.y=1.0-a_pos.y;}"),collisionBox:mt("in float v_placed;in float v_notUsed;void main() {float alpha=0.5;fragColor=vec4(1.0,0.0,0.0,1.0)*alpha;if (v_placed > 0.5) {fragColor=vec4(0.0,0.0,1.0,0.5)*alpha;}if (v_notUsed > 0.5) {fragColor*=.1;}}","in vec2 a_anchor_pos;in vec2 a_placed;in vec2 a_box_real;uniform vec2 u_pixel_extrude_scale;out float v_placed;out float v_notUsed;void main() {gl_Position=projectTileWithElevation(a_anchor_pos,get_elevation(a_anchor_pos));gl_Position.xy=((a_box_real+0.5)*u_pixel_extrude_scale*2.0-1.0)*vec2(1.0,-1.0)*gl_Position.w;if (gl_Position.z/gl_Position.w < 1.1) {gl_Position.z=0.5;}v_placed=a_placed.x;v_notUsed=a_placed.y;}"),collisionCircle:mt("in float v_radius;in vec2 v_extrude;in float v_collision;void main() {float alpha=0.5;float stroke_radius=0.9;float distance_to_center=length(v_extrude);float distance_to_edge=abs(distance_to_center-v_radius);float opacity_t=smoothstep(-stroke_radius,0.0,-distance_to_edge);vec4 color=mix(vec4(0.0,0.0,1.0,0.5),vec4(1.0,0.0,0.0,1.0),v_collision);fragColor=color*alpha*opacity_t;}","in vec2 a_pos;in float a_radius;in vec2 a_flags;uniform vec2 u_viewport_size;out float v_radius;out vec2 v_extrude;out float v_collision;void main() {float radius=a_radius;float collision=a_flags.x;float vertexIdx=a_flags.y;vec2 quadVertexOffset=vec2(mix(-1.0,1.0,float(vertexIdx >=2.0)),mix(-1.0,1.0,float(vertexIdx >=1.0 && vertexIdx <=2.0)));vec2 quadVertexExtent=quadVertexOffset*radius;float padding_factor=1.2;v_radius=radius;v_extrude=quadVertexExtent*padding_factor;v_collision=collision;gl_Position=vec4((a_pos/u_viewport_size*2.0-1.0)*vec2(1.0,-1.0),0.0,1.0)+vec4(quadVertexExtent*padding_factor/u_viewport_size*2.0,0.0,0.0);}"),colorRelief:mt(`#ifdef GL_ES
|
|
157
|
-
precision highp float;
|
|
158
|
-
#endif
|
|
159
|
-
uniform sampler2D u_image;uniform vec4 u_unpack;uniform sampler2D u_elevation_stops;uniform sampler2D u_color_stops;uniform float u_opacity;in vec2 v_pos;float getElevation(vec2 coord) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}float getElevationStop(int stop) {float x=(float(stop)+0.5)/float(textureSize(u_elevation_stops,0)[0]);vec4 data=texture(u_elevation_stops,vec2(x,0))*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {float el=getElevation(v_pos);int num_elevation_stops=textureSize(u_elevation_stops,0)[0];int r=(num_elevation_stops-1);int l=0;float el_l=getElevationStop(l);float el_r=getElevationStop(r);while(r-l > 1){int m=(r+l)/2;float el_m=getElevationStop(m);if(el < el_m){r=m;el_r=el_m;}else
|
|
160
|
-
{l=m;el_l=el_m;}}float x=(float(l)+(el-el_l)/(el_r-el_l)+0.5)/float(textureSize(u_color_stops,0)[0]);fragColor=u_opacity*texture(u_color_stops,vec2(x,0));
|
|
161
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
162
|
-
fragColor=vec4(1.0);
|
|
163
|
-
#endif
|
|
164
|
-
}`,"uniform vec2 u_dimension;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_pos/8192.0)*scale+epsilon;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),debug:mt("uniform highp vec4 u_color;uniform sampler2D u_overlay;in vec2 v_uv;void main() {vec4 overlay_color=texture(u_overlay,v_uv);fragColor=mix(u_color,overlay_color,overlay_color.a);}","in vec2 a_pos;out vec2 v_uv;uniform float u_overlay_scale;void main() {v_uv=a_pos/8192.0;gl_Position=projectTileWithElevation(a_pos*u_overlay_scale,get_elevation(a_pos));}"),depth:mt(Ao,`in vec2 a_pos;void main() {
|
|
165
|
-
#ifdef GLOBE
|
|
166
|
-
gl_Position=projectTileFor3D(a_pos,0.0);
|
|
167
|
-
#else
|
|
168
|
-
gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
|
|
169
|
-
#endif
|
|
170
|
-
}`),fill:mt(`#pragma mapbox: define highp vec4 color
|
|
171
|
-
#pragma mapbox: define lowp float opacity
|
|
172
|
-
void main() {
|
|
173
|
-
#pragma mapbox: initialize highp vec4 color
|
|
174
|
-
#pragma mapbox: initialize lowp float opacity
|
|
175
|
-
fragColor=color*opacity;
|
|
176
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
177
|
-
fragColor=vec4(1.0);
|
|
178
|
-
#endif
|
|
179
|
-
}`,`uniform vec2 u_fill_translate;in vec2 a_pos;
|
|
180
|
-
#pragma mapbox: define highp vec4 color
|
|
181
|
-
#pragma mapbox: define lowp float opacity
|
|
182
|
-
void main() {
|
|
183
|
-
#pragma mapbox: initialize highp vec4 color
|
|
184
|
-
#pragma mapbox: initialize lowp float opacity
|
|
185
|
-
gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:mt(`in vec2 v_pos;
|
|
186
|
-
#ifdef GLOBE
|
|
187
|
-
in float v_depth;
|
|
188
|
-
#endif
|
|
189
|
-
#pragma mapbox: define highp vec4 outline_color
|
|
190
|
-
#pragma mapbox: define lowp float opacity
|
|
191
|
-
void main() {
|
|
192
|
-
#pragma mapbox: initialize highp vec4 outline_color
|
|
193
|
-
#pragma mapbox: initialize lowp float opacity
|
|
194
|
-
float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
|
|
195
|
-
#ifdef GLOBE
|
|
196
|
-
if (v_depth > 1.0) {discard;}
|
|
197
|
-
#endif
|
|
198
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
199
|
-
fragColor=vec4(1.0);
|
|
200
|
-
#endif
|
|
201
|
-
}`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
|
|
202
|
-
#ifdef GLOBE
|
|
203
|
-
out float v_depth;
|
|
204
|
-
#endif
|
|
205
|
-
#pragma mapbox: define highp vec4 outline_color
|
|
206
|
-
#pragma mapbox: define lowp float opacity
|
|
207
|
-
void main() {
|
|
208
|
-
#pragma mapbox: initialize highp vec4 outline_color
|
|
209
|
-
#pragma mapbox: initialize lowp float opacity
|
|
210
|
-
gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
|
|
211
|
-
#ifdef GLOBE
|
|
212
|
-
v_depth=gl_Position.z/gl_Position.w;
|
|
213
|
-
#endif
|
|
214
|
-
}`),fillOutlinePattern:mt(`uniform vec2 u_texsize;uniform sampler2D u_image;uniform float u_fade;in vec2 v_pos_a;in vec2 v_pos_b;in vec2 v_pos;
|
|
215
|
-
#ifdef GLOBE
|
|
216
|
-
in float v_depth;
|
|
217
|
-
#endif
|
|
218
|
-
#pragma mapbox: define lowp float opacity
|
|
219
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
220
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
221
|
-
void main() {
|
|
222
|
-
#pragma mapbox: initialize lowp float opacity
|
|
223
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
224
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
225
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=mix(color1,color2,u_fade)*alpha*opacity;
|
|
226
|
-
#ifdef GLOBE
|
|
227
|
-
if (v_depth > 1.0) {discard;}
|
|
228
|
-
#endif
|
|
229
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
230
|
-
fragColor=vec4(1.0);
|
|
231
|
-
#endif
|
|
232
|
-
}`,`uniform vec2 u_world;uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;out vec2 v_pos;
|
|
233
|
-
#ifdef GLOBE
|
|
234
|
-
out float v_depth;
|
|
235
|
-
#endif
|
|
236
|
-
#pragma mapbox: define lowp float opacity
|
|
237
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
238
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
239
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
240
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
241
|
-
void main() {
|
|
242
|
-
#pragma mapbox: initialize lowp float opacity
|
|
243
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
244
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
245
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
246
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
247
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
|
|
248
|
-
#ifdef GLOBE
|
|
249
|
-
v_depth=gl_Position.z/gl_Position.w;
|
|
250
|
-
#endif
|
|
251
|
-
}`),fillPattern:mt(`#ifdef GL_ES
|
|
252
|
-
precision highp float;
|
|
253
|
-
#endif
|
|
254
|
-
uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
|
|
255
|
-
#pragma mapbox: define lowp float opacity
|
|
256
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
257
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
258
|
-
void main() {
|
|
259
|
-
#pragma mapbox: initialize lowp float opacity
|
|
260
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
261
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
262
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);fragColor=mix(color1,color2,u_fade)*opacity;
|
|
263
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
264
|
-
fragColor=vec4(1.0);
|
|
265
|
-
#endif
|
|
266
|
-
}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform vec3 u_scale;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos_a;out vec2 v_pos_b;
|
|
267
|
-
#pragma mapbox: define lowp float opacity
|
|
268
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
269
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
270
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
271
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
272
|
-
void main() {
|
|
273
|
-
#pragma mapbox: initialize lowp float opacity
|
|
274
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
275
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
276
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
277
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
278
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileZoomRatio,a_pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileZoomRatio,a_pos);}`),fillExtrusion:mt(`in vec4 v_color;void main() {fragColor=v_color;
|
|
279
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
280
|
-
fragColor=vec4(1.0);
|
|
281
|
-
#endif
|
|
282
|
-
}`,`uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;in vec2 a_pos;in vec4 a_normal_ed;
|
|
283
|
-
#ifdef TERRAIN3D
|
|
284
|
-
in vec2 a_centroid;
|
|
285
|
-
#endif
|
|
286
|
-
out vec4 v_color;
|
|
287
|
-
#pragma mapbox: define highp float base
|
|
288
|
-
#pragma mapbox: define highp float height
|
|
289
|
-
#pragma mapbox: define highp vec4 color
|
|
290
|
-
void main() {
|
|
291
|
-
#pragma mapbox: initialize highp float base
|
|
292
|
-
#pragma mapbox: initialize highp float height
|
|
293
|
-
#pragma mapbox: initialize highp vec4 color
|
|
294
|
-
vec3 normal=a_normal_ed.xyz;
|
|
295
|
-
#ifdef TERRAIN3D
|
|
296
|
-
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|
297
|
-
#else
|
|
298
|
-
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|
299
|
-
#endif
|
|
300
|
-
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
|
|
301
|
-
#ifdef GLOBE
|
|
302
|
-
vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
|
|
303
|
-
#else
|
|
304
|
-
gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
|
|
305
|
-
#endif
|
|
306
|
-
float colorvalue=color.r*0.2126+color.g*0.7152+color.b*0.0722;v_color=vec4(0.0,0.0,0.0,1.0);vec4 ambientlight=vec4(0.03,0.03,0.03,1.0);color+=ambientlight;vec3 normalForLighting=normal/16384.0;float directional=clamp(dot(normalForLighting,u_lightpos),0.0,1.0);
|
|
307
|
-
#ifdef GLOBE
|
|
308
|
-
mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
|
|
309
|
-
#endif
|
|
310
|
-
directional=mix((1.0-u_lightintensity),max((1.0-colorvalue+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_color.r+=clamp(color.r*directional*u_lightcolor.r,mix(0.0,0.3,1.0-u_lightcolor.r),1.0);v_color.g+=clamp(color.g*directional*u_lightcolor.g,mix(0.0,0.3,1.0-u_lightcolor.g),1.0);v_color.b+=clamp(color.b*directional*u_lightcolor.b,mix(0.0,0.3,1.0-u_lightcolor.b),1.0);v_color*=u_opacity;}`),fillExtrusionPattern:mt(`uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;in vec4 v_lighting;
|
|
311
|
-
#pragma mapbox: define lowp float base
|
|
312
|
-
#pragma mapbox: define lowp float height
|
|
313
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
314
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
315
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
316
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
317
|
-
void main() {
|
|
318
|
-
#pragma mapbox: initialize lowp float base
|
|
319
|
-
#pragma mapbox: initialize lowp float height
|
|
320
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
321
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
322
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
323
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
324
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;vec2 imagecoord=mod(v_pos_a,1.0);vec2 pos=mix(pattern_tl_a/u_texsize,pattern_br_a/u_texsize,imagecoord);vec4 color1=texture(u_image,pos);vec2 imagecoord_b=mod(v_pos_b,1.0);vec2 pos2=mix(pattern_tl_b/u_texsize,pattern_br_b/u_texsize,imagecoord_b);vec4 color2=texture(u_image,pos2);vec4 mixedColor=mix(color1,color2,u_fade);fragColor=mixedColor*v_lighting;
|
|
325
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
326
|
-
fragColor=vec4(1.0);
|
|
327
|
-
#endif
|
|
328
|
-
}`,`uniform vec2 u_pixel_coord_upper;uniform vec2 u_pixel_coord_lower;uniform float u_height_factor;uniform vec3 u_scale;uniform float u_vertical_gradient;uniform lowp float u_opacity;uniform vec2 u_fill_translate;uniform vec3 u_lightcolor;uniform lowp vec3 u_lightpos;uniform lowp vec3 u_lightpos_globe;uniform lowp float u_lightintensity;in vec2 a_pos;in vec4 a_normal_ed;
|
|
329
|
-
#ifdef TERRAIN3D
|
|
330
|
-
in vec2 a_centroid;
|
|
331
|
-
#endif
|
|
332
|
-
#ifdef GLOBE
|
|
333
|
-
out vec3 v_sphere_pos;
|
|
334
|
-
#endif
|
|
335
|
-
out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
|
|
336
|
-
#pragma mapbox: define lowp float base
|
|
337
|
-
#pragma mapbox: define lowp float height
|
|
338
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
339
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
340
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
341
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
342
|
-
void main() {
|
|
343
|
-
#pragma mapbox: initialize lowp float base
|
|
344
|
-
#pragma mapbox: initialize lowp float height
|
|
345
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
346
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
347
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
348
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
349
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec3 normal=a_normal_ed.xyz;float edgedistance=a_normal_ed.w;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;
|
|
350
|
-
#ifdef TERRAIN3D
|
|
351
|
-
float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
|
|
352
|
-
#else
|
|
353
|
-
float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
|
|
354
|
-
#endif
|
|
355
|
-
base=max(0.0,base)+base_terrain3d_offset;height=max(0.0,height)+height_terrain3d_offset;float t=mod(normal.x,2.0);float elevation=t > 0.0 ? height : base;vec2 posInTile=a_pos+u_fill_translate;
|
|
356
|
-
#ifdef GLOBE
|
|
357
|
-
vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
|
|
358
|
-
#else
|
|
359
|
-
gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
|
|
360
|
-
#endif
|
|
361
|
-
vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
|
|
362
|
-
? a_pos
|
|
363
|
-
: vec2(edgedistance,elevation*u_height_factor);v_pos_a=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,fromScale*display_size_a,tileRatio,pos);v_pos_b=get_pattern_pos(u_pixel_coord_upper,u_pixel_coord_lower,toScale*display_size_b,tileRatio,pos);v_lighting=vec4(0.0,0.0,0.0,1.0);float directional=clamp(dot(normal/16383.0,u_lightpos),0.0,1.0);directional=mix((1.0-u_lightintensity),max((0.5+u_lightintensity),1.0),directional);if (normal.y !=0.0) {directional*=((1.0-u_vertical_gradient)+(u_vertical_gradient*clamp((t+base)*pow(height/150.0,0.5),mix(0.7,0.98,1.0-u_lightintensity),1.0)));}v_lighting.rgb+=clamp(directional*u_lightcolor,mix(vec3(0.0),vec3(0.3),1.0-u_lightcolor),vec3(1.0));v_lighting*=u_opacity;}`),hillshadePrepare:mt(`#ifdef GL_ES
|
|
364
|
-
precision highp float;
|
|
365
|
-
#endif
|
|
366
|
-
uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_dimension;uniform float u_zoom;uniform vec4 u_unpack;float getElevation(vec2 coord,float bias) {vec4 data=texture(u_image,coord)*255.0;data.a=-1.0;return dot(data,u_unpack);}void main() {vec2 epsilon=1.0/u_dimension;float tileSize=u_dimension.x-2.0;float a=getElevation(v_pos+vec2(-epsilon.x,-epsilon.y),0.0);float b=getElevation(v_pos+vec2(0,-epsilon.y),0.0);float c=getElevation(v_pos+vec2(epsilon.x,-epsilon.y),0.0);float d=getElevation(v_pos+vec2(-epsilon.x,0),0.0);float e=getElevation(v_pos,0.0);float f=getElevation(v_pos+vec2(epsilon.x,0),0.0);float g=getElevation(v_pos+vec2(-epsilon.x,epsilon.y),0.0);float h=getElevation(v_pos+vec2(0,epsilon.y),0.0);float i=getElevation(v_pos+vec2(epsilon.x,epsilon.y),0.0);float exaggerationFactor=u_zoom < 2.0 ? 0.4 : u_zoom < 4.5 ? 0.35 : 0.3;float exaggeration=u_zoom < 15.0 ? (u_zoom-15.0)*exaggerationFactor : 0.0;vec2 deriv=vec2((c+f+f+i)-(a+d+d+g),(g+h+h+i)-(a+b+b+c))*tileSize/pow(2.0,exaggeration+(28.2562-u_zoom));fragColor=clamp(vec4(deriv.x/8.0+0.5,deriv.y/8.0+0.5,1.0,1.0),0.0,1.0);
|
|
367
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
368
|
-
fragColor=vec4(1.0);
|
|
369
|
-
#endif
|
|
370
|
-
}`,"uniform mat4 u_matrix;uniform vec2 u_dimension;in vec2 a_pos;in vec2 a_texture_pos;out vec2 v_pos;void main() {gl_Position=u_matrix*vec4(a_pos,0,1);highp vec2 epsilon=1.0/u_dimension;float scale=(u_dimension.x-2.0)/u_dimension.x;v_pos=(a_texture_pos/8192.0)*scale+epsilon;}"),hillshade:mt(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform float u_exaggeration;uniform vec4 u_accent;uniform int u_method;uniform float u_altitudes[NUM_ILLUMINATION_SOURCES];uniform float u_azimuths[NUM_ILLUMINATION_SOURCES];uniform vec4 u_shadows[NUM_ILLUMINATION_SOURCES];uniform vec4 u_highlights[NUM_ILLUMINATION_SOURCES];
|
|
371
|
-
#define PI 3.141592653589793
|
|
372
|
-
#define STANDARD 0
|
|
373
|
-
#define COMBINED 1
|
|
374
|
-
#define IGOR 2
|
|
375
|
-
#define MULTIDIRECTIONAL 3
|
|
376
|
-
#define BASIC 4
|
|
377
|
-
float get_aspect(vec2 deriv){return deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);}void igor_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float aspect=get_aspect(deriv);float azimuth=u_azimuths[0]+PI;float slope_stength=atan(length(deriv))*2.0/PI;float aspect_strength=1.0-abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);float shadow_strength=slope_stength*aspect_strength;float highlight_strength=slope_stength*(1.0-aspect_strength);fragColor=u_shadows[0]*shadow_strength+u_highlights[0]*highlight_strength;}void standard_hillshade(vec2 deriv){float azimuth=u_azimuths[0]+PI;float slope=atan(0.625*length(deriv));float aspect=get_aspect(deriv);float intensity=u_exaggeration;float base=1.875-intensity*1.75;float maxValue=0.5*PI;float scaledSlope=intensity !=0.5 ? ((pow(base,slope)-1.0)/(pow(base,maxValue)-1.0))*maxValue : slope;float accent=cos(scaledSlope);vec4 accent_color=(1.0-accent)*u_accent*clamp(intensity*2.0,0.0,1.0);float shade=abs(mod((aspect+azimuth)/PI+0.5,2.0)-1.0);vec4 shade_color=mix(u_shadows[0],u_highlights[0],shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;}void basic_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor=u_highlights[0]*(2.0*shade-1.0);}else
|
|
378
|
-
{fragColor=u_shadows[0]*(1.0-2.0*shade);}}void multidirectional_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;fragColor=vec4(0,0,0,0);for(int i=0; i < NUM_ILLUMINATION_SOURCES; i++){float cos_alt=cos(u_altitudes[i]);float sin_alt=sin(u_altitudes[i]);float cos_az=-cos(u_azimuths[i]);float sin_az=-sin(u_azimuths[i]);float cang=(sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv));float shade=clamp(cang,0.0,1.0);if(shade > 0.5){fragColor+=u_highlights[i]*(2.0*shade-1.0)/float(NUM_ILLUMINATION_SOURCES);}else
|
|
379
|
-
{fragColor+=u_shadows[i]*(1.0-2.0*shade)/float(NUM_ILLUMINATION_SOURCES);}}}void combined_hillshade(vec2 deriv){deriv=deriv*u_exaggeration*2.0;float azimuth=u_azimuths[0]+PI;float cos_az=cos(azimuth);float sin_az=sin(azimuth);float cos_alt=cos(u_altitudes[0]);float sin_alt=sin(u_altitudes[0]);float cang=acos((sin_alt-(deriv.y*cos_az*cos_alt-deriv.x*sin_az*cos_alt))/sqrt(1.0+dot(deriv,deriv)));cang=clamp(cang,0.0,PI/2.0);float shade=cang*atan(length(deriv))*4.0/PI/PI;float highlight=(PI/2.0-cang)*atan(length(deriv))*4.0/PI/PI;fragColor=u_shadows[0]*shade+u_highlights[0]*highlight;}void main() {vec4 pixel=texture(u_image,v_pos);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));vec2 deriv=((pixel.rg*8.0)-4.0)/scaleFactor;switch(u_method){case BASIC:
|
|
380
|
-
basic_hillshade(deriv);break;case COMBINED:
|
|
381
|
-
combined_hillshade(deriv);break;case IGOR:
|
|
382
|
-
igor_hillshade(deriv);break;case MULTIDIRECTIONAL:
|
|
383
|
-
multidirectional_hillshade(deriv);break;case STANDARD:
|
|
384
|
-
default:
|
|
385
|
-
standard_hillshade(deriv);break;}
|
|
386
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
387
|
-
fragColor=vec4(1.0);
|
|
388
|
-
#endif
|
|
389
|
-
}`,"uniform mat4 u_matrix;in vec2 a_pos;out vec2 v_pos;void main() {gl_Position=projectTile(a_pos,a_pos);v_pos=a_pos/8192.0;if (a_pos.y <-32767.5) {v_pos.y=0.0;}if (a_pos.y > 32766.5) {v_pos.y=1.0;}}"),line:mt(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
|
|
390
|
-
#ifdef GLOBE
|
|
391
|
-
in float v_depth;
|
|
392
|
-
#endif
|
|
393
|
-
#pragma mapbox: define highp vec4 color
|
|
394
|
-
#pragma mapbox: define lowp float blur
|
|
395
|
-
#pragma mapbox: define lowp float opacity
|
|
396
|
-
void main() {
|
|
397
|
-
#pragma mapbox: initialize highp vec4 color
|
|
398
|
-
#pragma mapbox: initialize lowp float blur
|
|
399
|
-
#pragma mapbox: initialize lowp float opacity
|
|
400
|
-
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);fragColor=color*(alpha*opacity);
|
|
401
|
-
#ifdef GLOBE
|
|
402
|
-
if (v_depth > 1.0) {discard;}
|
|
403
|
-
#endif
|
|
404
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
405
|
-
fragColor=vec4(1.0);
|
|
406
|
-
#endif
|
|
407
|
-
}`,`
|
|
408
|
-
#define scale 0.015873016
|
|
409
|
-
in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform vec2 u_units_to_pixels;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp float v_linesofar;
|
|
410
|
-
#ifdef GLOBE
|
|
411
|
-
out float v_depth;
|
|
412
|
-
#endif
|
|
413
|
-
#pragma mapbox: define highp vec4 color
|
|
414
|
-
#pragma mapbox: define lowp float blur
|
|
415
|
-
#pragma mapbox: define lowp float opacity
|
|
416
|
-
#pragma mapbox: define mediump float gapwidth
|
|
417
|
-
#pragma mapbox: define lowp float offset
|
|
418
|
-
#pragma mapbox: define mediump float width
|
|
419
|
-
void main() {
|
|
420
|
-
#pragma mapbox: initialize highp vec4 color
|
|
421
|
-
#pragma mapbox: initialize lowp float blur
|
|
422
|
-
#pragma mapbox: initialize lowp float opacity
|
|
423
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
424
|
-
#pragma mapbox: initialize lowp float offset
|
|
425
|
-
#pragma mapbox: initialize mediump float width
|
|
426
|
-
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;v_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*2.0;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
427
|
-
#ifdef GLOBE
|
|
428
|
-
v_depth=gl_Position.z/gl_Position.w;
|
|
429
|
-
#endif
|
|
430
|
-
#ifdef TERRAIN3D
|
|
431
|
-
v_gamma_scale=1.0;
|
|
432
|
-
#else
|
|
433
|
-
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
434
|
-
#endif
|
|
435
|
-
v_width2=vec2(outset,inset);}`),lineGradient:mt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;in highp vec2 v_uv;
|
|
436
|
-
#ifdef GLOBE
|
|
437
|
-
in float v_depth;
|
|
438
|
-
#endif
|
|
439
|
-
#pragma mapbox: define lowp float blur
|
|
440
|
-
#pragma mapbox: define lowp float opacity
|
|
441
|
-
void main() {
|
|
442
|
-
#pragma mapbox: initialize lowp float blur
|
|
443
|
-
#pragma mapbox: initialize lowp float opacity
|
|
444
|
-
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);vec4 color=texture(u_image,v_uv);fragColor=color*(alpha*opacity);
|
|
445
|
-
#ifdef GLOBE
|
|
446
|
-
if (v_depth > 1.0) {discard;}
|
|
447
|
-
#endif
|
|
448
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
449
|
-
fragColor=vec4(1.0);
|
|
450
|
-
#endif
|
|
451
|
-
}`,`
|
|
452
|
-
#define scale 0.015873016
|
|
453
|
-
in vec2 a_pos_normal;in vec4 a_data;in float a_uv_x;in float a_split_index;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_units_to_pixels;uniform float u_image_height;out vec2 v_normal;out vec2 v_width2;out float v_gamma_scale;out highp vec2 v_uv;
|
|
454
|
-
#ifdef GLOBE
|
|
455
|
-
out float v_depth;
|
|
456
|
-
#endif
|
|
457
|
-
#pragma mapbox: define lowp float blur
|
|
458
|
-
#pragma mapbox: define lowp float opacity
|
|
459
|
-
#pragma mapbox: define mediump float gapwidth
|
|
460
|
-
#pragma mapbox: define lowp float offset
|
|
461
|
-
#pragma mapbox: define mediump float width
|
|
462
|
-
void main() {
|
|
463
|
-
#pragma mapbox: initialize lowp float blur
|
|
464
|
-
#pragma mapbox: initialize lowp float opacity
|
|
465
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
466
|
-
#pragma mapbox: initialize lowp float offset
|
|
467
|
-
#pragma mapbox: initialize mediump float width
|
|
468
|
-
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;highp float texel_height=1.0/u_image_height;highp float half_texel_height=0.5*texel_height;v_uv=vec2(a_uv_x,a_split_index*texel_height-half_texel_height);vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
469
|
-
#ifdef GLOBE
|
|
470
|
-
v_depth=gl_Position.z/gl_Position.w;
|
|
471
|
-
#endif
|
|
472
|
-
#ifdef TERRAIN3D
|
|
473
|
-
v_gamma_scale=1.0;
|
|
474
|
-
#else
|
|
475
|
-
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
476
|
-
#endif
|
|
477
|
-
v_width2=vec2(outset,inset);}`),linePattern:mt(`#ifdef GL_ES
|
|
478
|
-
precision highp float;
|
|
479
|
-
#endif
|
|
480
|
-
uniform lowp float u_device_pixel_ratio;uniform vec2 u_texsize;uniform float u_fade;uniform mediump vec3 u_scale;uniform sampler2D u_image;in vec2 v_normal;in vec2 v_width2;in float v_linesofar;in float v_gamma_scale;in float v_width;
|
|
481
|
-
#ifdef GLOBE
|
|
482
|
-
in float v_depth;
|
|
483
|
-
#endif
|
|
484
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
485
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
486
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
487
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
488
|
-
#pragma mapbox: define lowp float blur
|
|
489
|
-
#pragma mapbox: define lowp float opacity
|
|
490
|
-
void main() {
|
|
491
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
492
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
493
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
494
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
495
|
-
#pragma mapbox: initialize lowp float blur
|
|
496
|
-
#pragma mapbox: initialize lowp float opacity
|
|
497
|
-
vec2 pattern_tl_a=pattern_from.xy;vec2 pattern_br_a=pattern_from.zw;vec2 pattern_tl_b=pattern_to.xy;vec2 pattern_br_b=pattern_to.zw;float tileZoomRatio=u_scale.x;float fromScale=u_scale.y;float toScale=u_scale.z;vec2 display_size_a=(pattern_br_a-pattern_tl_a)/pixel_ratio_from;vec2 display_size_b=(pattern_br_b-pattern_tl_b)/pixel_ratio_to;vec2 pattern_size_a=vec2(display_size_a.x*fromScale/tileZoomRatio,display_size_a.y);vec2 pattern_size_b=vec2(display_size_b.x*toScale/tileZoomRatio,display_size_b.y);float aspect_a=display_size_a.y/v_width;float aspect_b=display_size_b.y/v_width;float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float x_a=mod(v_linesofar/pattern_size_a.x*aspect_a,1.0);float x_b=mod(v_linesofar/pattern_size_b.x*aspect_b,1.0);float y=0.5*v_normal.y+0.5;vec2 texel_size=1.0/u_texsize;vec2 pos_a=mix(pattern_tl_a*texel_size-texel_size,pattern_br_a*texel_size+texel_size,vec2(x_a,y));vec2 pos_b=mix(pattern_tl_b*texel_size-texel_size,pattern_br_b*texel_size+texel_size,vec2(x_b,y));vec4 color=mix(texture(u_image,pos_a),texture(u_image,pos_b),u_fade);fragColor=color*alpha*opacity;
|
|
498
|
-
#ifdef GLOBE
|
|
499
|
-
if (v_depth > 1.0) {discard;}
|
|
500
|
-
#endif
|
|
501
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
502
|
-
fragColor=vec4(1.0);
|
|
503
|
-
#endif
|
|
504
|
-
}`,`
|
|
505
|
-
#define scale 0.015873016
|
|
506
|
-
#define LINE_DISTANCE_SCALE 2.0
|
|
507
|
-
in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform vec2 u_units_to_pixels;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;out vec2 v_normal;out vec2 v_width2;out float v_linesofar;out float v_gamma_scale;out float v_width;
|
|
508
|
-
#ifdef GLOBE
|
|
509
|
-
out float v_depth;
|
|
510
|
-
#endif
|
|
511
|
-
#pragma mapbox: define lowp float blur
|
|
512
|
-
#pragma mapbox: define lowp float opacity
|
|
513
|
-
#pragma mapbox: define lowp float offset
|
|
514
|
-
#pragma mapbox: define mediump float gapwidth
|
|
515
|
-
#pragma mapbox: define mediump float width
|
|
516
|
-
#pragma mapbox: define lowp float floorwidth
|
|
517
|
-
#pragma mapbox: define lowp vec4 pattern_from
|
|
518
|
-
#pragma mapbox: define lowp vec4 pattern_to
|
|
519
|
-
#pragma mapbox: define lowp float pixel_ratio_from
|
|
520
|
-
#pragma mapbox: define lowp float pixel_ratio_to
|
|
521
|
-
void main() {
|
|
522
|
-
#pragma mapbox: initialize lowp float blur
|
|
523
|
-
#pragma mapbox: initialize lowp float opacity
|
|
524
|
-
#pragma mapbox: initialize lowp float offset
|
|
525
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
526
|
-
#pragma mapbox: initialize mediump float width
|
|
527
|
-
#pragma mapbox: initialize lowp float floorwidth
|
|
528
|
-
#pragma mapbox: initialize mediump vec4 pattern_from
|
|
529
|
-
#pragma mapbox: initialize mediump vec4 pattern_to
|
|
530
|
-
#pragma mapbox: initialize lowp float pixel_ratio_from
|
|
531
|
-
#pragma mapbox: initialize lowp float pixel_ratio_to
|
|
532
|
-
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
533
|
-
#ifdef GLOBE
|
|
534
|
-
v_depth=gl_Position.z/gl_Position.w;
|
|
535
|
-
#endif
|
|
536
|
-
#ifdef TERRAIN3D
|
|
537
|
-
v_gamma_scale=1.0;
|
|
538
|
-
#else
|
|
539
|
-
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
540
|
-
#endif
|
|
541
|
-
v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:mt(`uniform lowp float u_device_pixel_ratio;uniform sampler2D u_image;uniform float u_sdfgamma;uniform float u_mix;in vec2 v_normal;in vec2 v_width2;in vec2 v_tex_a;in vec2 v_tex_b;in float v_gamma_scale;
|
|
542
|
-
#ifdef GLOBE
|
|
543
|
-
in float v_depth;
|
|
544
|
-
#endif
|
|
545
|
-
#pragma mapbox: define highp vec4 color
|
|
546
|
-
#pragma mapbox: define lowp float blur
|
|
547
|
-
#pragma mapbox: define lowp float opacity
|
|
548
|
-
#pragma mapbox: define mediump float width
|
|
549
|
-
#pragma mapbox: define lowp float floorwidth
|
|
550
|
-
void main() {
|
|
551
|
-
#pragma mapbox: initialize highp vec4 color
|
|
552
|
-
#pragma mapbox: initialize lowp float blur
|
|
553
|
-
#pragma mapbox: initialize lowp float opacity
|
|
554
|
-
#pragma mapbox: initialize mediump float width
|
|
555
|
-
#pragma mapbox: initialize lowp float floorwidth
|
|
556
|
-
float dist=length(v_normal)*v_width2.s;float blur2=(blur+1.0/u_device_pixel_ratio)*v_gamma_scale;float alpha=clamp(min(dist-(v_width2.t-blur2),v_width2.s-dist)/blur2,0.0,1.0);float sdfdist_a=texture(u_image,v_tex_a).a;float sdfdist_b=texture(u_image,v_tex_b).a;float sdfdist=mix(sdfdist_a,sdfdist_b,u_mix);alpha*=smoothstep(0.5-u_sdfgamma/floorwidth,0.5+u_sdfgamma/floorwidth,sdfdist);fragColor=color*(alpha*opacity);
|
|
557
|
-
#ifdef GLOBE
|
|
558
|
-
if (v_depth > 1.0) {discard;}
|
|
559
|
-
#endif
|
|
560
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
561
|
-
fragColor=vec4(1.0);
|
|
562
|
-
#endif
|
|
563
|
-
}`,`
|
|
564
|
-
#define scale 0.015873016
|
|
565
|
-
#define LINE_DISTANCE_SCALE 2.0
|
|
566
|
-
in vec2 a_pos_normal;in vec4 a_data;uniform vec2 u_translation;uniform mediump float u_ratio;uniform lowp float u_device_pixel_ratio;uniform vec2 u_patternscale_a;uniform float u_tex_y_a;uniform vec2 u_patternscale_b;uniform float u_tex_y_b;uniform vec2 u_units_to_pixels;out vec2 v_normal;out vec2 v_width2;out vec2 v_tex_a;out vec2 v_tex_b;out float v_gamma_scale;
|
|
567
|
-
#ifdef GLOBE
|
|
568
|
-
out float v_depth;
|
|
569
|
-
#endif
|
|
570
|
-
#pragma mapbox: define highp vec4 color
|
|
571
|
-
#pragma mapbox: define lowp float blur
|
|
572
|
-
#pragma mapbox: define lowp float opacity
|
|
573
|
-
#pragma mapbox: define mediump float gapwidth
|
|
574
|
-
#pragma mapbox: define lowp float offset
|
|
575
|
-
#pragma mapbox: define mediump float width
|
|
576
|
-
#pragma mapbox: define lowp float floorwidth
|
|
577
|
-
void main() {
|
|
578
|
-
#pragma mapbox: initialize highp vec4 color
|
|
579
|
-
#pragma mapbox: initialize lowp float blur
|
|
580
|
-
#pragma mapbox: initialize lowp float opacity
|
|
581
|
-
#pragma mapbox: initialize mediump float gapwidth
|
|
582
|
-
#pragma mapbox: initialize lowp float offset
|
|
583
|
-
#pragma mapbox: initialize mediump float width
|
|
584
|
-
#pragma mapbox: initialize lowp float floorwidth
|
|
585
|
-
float ANTIALIASING=1.0/u_device_pixel_ratio/2.0;vec2 a_extrude=a_data.xy-128.0;float a_direction=mod(a_data.z,4.0)-1.0;float a_linesofar=(floor(a_data.z/4.0)+a_data.w*64.0)*LINE_DISTANCE_SCALE;vec2 pos=floor(a_pos_normal*0.5);mediump vec2 normal=a_pos_normal-2.0*pos;normal.y=normal.y*2.0-1.0;v_normal=normal;gapwidth=gapwidth/2.0;float halfwidth=width/2.0;offset=-1.0*offset;float inset=gapwidth+(gapwidth > 0.0 ? ANTIALIASING : 0.0);float outset=gapwidth+halfwidth*(gapwidth > 0.0 ? 2.0 : 1.0)+(halfwidth==0.0 ? 0.0 : ANTIALIASING);mediump vec2 dist=outset*a_extrude*scale;mediump float u=0.5*a_direction;mediump float t=1.0-abs(u);mediump vec2 offset2=offset*a_extrude*scale*normal.y*mat2(t,-u,u,t);float adjustedThickness=projectLineThickness(pos.y);vec4 projected_no_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation);vec4 projected_with_extrude=projectTile(pos+offset2/u_ratio*adjustedThickness+u_translation+dist/u_ratio*adjustedThickness);gl_Position=projected_with_extrude;
|
|
586
|
-
#ifdef GLOBE
|
|
587
|
-
v_depth=gl_Position.z/gl_Position.w;
|
|
588
|
-
#endif
|
|
589
|
-
#ifdef TERRAIN3D
|
|
590
|
-
v_gamma_scale=1.0;
|
|
591
|
-
#else
|
|
592
|
-
float extrude_length_without_perspective=length(dist);float extrude_length_with_perspective=length((projected_with_extrude.xy-projected_no_extrude.xy)/projected_with_extrude.w*u_units_to_pixels);v_gamma_scale=extrude_length_without_perspective/extrude_length_with_perspective;
|
|
593
|
-
#endif
|
|
594
|
-
v_tex_a=vec2(a_linesofar*u_patternscale_a.x/floorwidth,normal.y*u_patternscale_a.y+u_tex_y_a);v_tex_b=vec2(a_linesofar*u_patternscale_b.x/floorwidth,normal.y*u_patternscale_b.y+u_tex_y_b);v_width2=vec2(outset,inset);}`),raster:mt(`uniform float u_fade_t;uniform float u_opacity;uniform sampler2D u_image0;uniform sampler2D u_image1;in vec2 v_pos0;in vec2 v_pos1;uniform float u_brightness_low;uniform float u_brightness_high;uniform float u_saturation_factor;uniform float u_contrast_factor;uniform vec3 u_spin_weights;void main() {vec4 color0=texture(u_image0,v_pos0);vec4 color1=texture(u_image1,v_pos1);if (color0.a > 0.0) {color0.rgb=color0.rgb/color0.a;}if (color1.a > 0.0) {color1.rgb=color1.rgb/color1.a;}vec4 color=mix(color0,color1,u_fade_t);color.a*=u_opacity;vec3 rgb=color.rgb;rgb=vec3(dot(rgb,u_spin_weights.xyz),dot(rgb,u_spin_weights.zxy),dot(rgb,u_spin_weights.yzx));float average=(color.r+color.g+color.b)/3.0;rgb+=(average-rgb)*u_saturation_factor;rgb=(rgb-0.5)*u_contrast_factor+0.5;vec3 u_high_vec=vec3(u_brightness_low,u_brightness_low,u_brightness_low);vec3 u_low_vec=vec3(u_brightness_high,u_brightness_high,u_brightness_high);fragColor=vec4(mix(u_high_vec,u_low_vec,rgb)*color.a,color.a);
|
|
595
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
596
|
-
fragColor=vec4(1.0);
|
|
597
|
-
#endif
|
|
598
|
-
}`,`uniform vec2 u_tl_parent;uniform float u_scale_parent;uniform float u_buffer_scale;uniform vec4 u_coords_top;uniform vec4 u_coords_bottom;in vec2 a_pos;out vec2 v_pos0;out vec2 v_pos1;void main() {vec2 fractionalPos=a_pos/8192.0;vec2 position=mix(mix(u_coords_top.xy,u_coords_top.zw,fractionalPos.x),mix(u_coords_bottom.xy,u_coords_bottom.zw,fractionalPos.x),fractionalPos.y);gl_Position=projectTile(position,position);v_pos0=((fractionalPos-0.5)/u_buffer_scale)+0.5;
|
|
599
|
-
#ifdef GLOBE
|
|
600
|
-
if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
|
|
601
|
-
#endif
|
|
602
|
-
v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:mt(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
|
|
603
|
-
#pragma mapbox: define lowp float opacity
|
|
604
|
-
void main() {
|
|
605
|
-
#pragma mapbox: initialize lowp float opacity
|
|
606
|
-
lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
|
|
607
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
608
|
-
fragColor=vec4(1.0);
|
|
609
|
-
#endif
|
|
610
|
-
}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform highp float u_camera_to_center_distance;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform float u_fade_change;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform vec2 u_texsize;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_tex;out float v_fade_opacity;
|
|
611
|
-
#pragma mapbox: define lowp float opacity
|
|
612
|
-
void main() {
|
|
613
|
-
#pragma mapbox: initialize lowp float opacity
|
|
614
|
-
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;vec2 a_minFontScale=a_pixeloffset.zw/256.0;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
615
|
-
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
616
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
|
|
617
|
-
#ifdef GLOBE
|
|
618
|
-
if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
|
|
619
|
-
#endif
|
|
620
|
-
vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*max(a_minFontScale,fontScale)+a_pxoffset/16.0)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}gl_Position=finalPos;v_tex=a_tex/u_texsize;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float visibility=calculate_visibility(projectedPoint);v_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));}`),symbolSDF:mt(`#define SDF_PX 8.0
|
|
621
|
-
uniform bool u_is_halo;uniform sampler2D u_texture;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;uniform bool u_is_text;in vec2 v_data0;in vec3 v_data1;
|
|
622
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
623
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
624
|
-
#pragma mapbox: define lowp float opacity
|
|
625
|
-
#pragma mapbox: define lowp float halo_width
|
|
626
|
-
#pragma mapbox: define lowp float halo_blur
|
|
627
|
-
void main() {
|
|
628
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
629
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
630
|
-
#pragma mapbox: initialize lowp float opacity
|
|
631
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
632
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
633
|
-
float EDGE_GAMMA=0.105/u_device_pixel_ratio;vec2 tex=v_data0.xy;float gamma_scale=v_data1.x;float size=v_data1.y;float fade_opacity=v_data1[2];float fontScale=u_is_text ? size/24.0 : size;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float inner_edge=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);inner_edge=inner_edge+gamma*gamma_scale;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(inner_edge-gamma_scaled,inner_edge+gamma_scaled,dist);if (u_is_halo) {lowp float halo_edge=(6.0-halo_width/fontScale)/SDF_PX;alpha=min(smoothstep(halo_edge-gamma_scaled,halo_edge+gamma_scaled,dist),1.0-alpha);}fragColor=color*(alpha*opacity*fade_opacity);
|
|
634
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
635
|
-
fragColor=vec4(1.0);
|
|
636
|
-
#endif
|
|
637
|
-
}`,`in vec4 a_pos_offset;in vec4 a_data;in vec4 a_pixeloffset;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_translation;uniform float u_pitched_scale;out vec2 v_data0;out vec3 v_data1;
|
|
638
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
639
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
640
|
-
#pragma mapbox: define lowp float opacity
|
|
641
|
-
#pragma mapbox: define lowp float halo_width
|
|
642
|
-
#pragma mapbox: define lowp float halo_blur
|
|
643
|
-
void main() {
|
|
644
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
645
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
646
|
-
#pragma mapbox: initialize lowp float opacity
|
|
647
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
648
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
649
|
-
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);vec2 a_pxoffset=a_pixeloffset.xy;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
650
|
-
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
651
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=u_is_text ? size/24.0 : size;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
|
|
652
|
-
#ifdef GLOBE
|
|
653
|
-
if(u_pitch_with_map) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
|
|
654
|
-
#endif
|
|
655
|
-
vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale+a_pxoffset)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0=a_tex/u_texsize;v_data1=vec3(gamma_scale,size,interpolated_fade_opacity);}`),symbolTextAndIcon:mt(`#define SDF_PX 8.0
|
|
656
|
-
#define SDF 1.0
|
|
657
|
-
#define ICON 0.0
|
|
658
|
-
uniform bool u_is_halo;uniform sampler2D u_texture;uniform sampler2D u_texture_icon;uniform highp float u_gamma_scale;uniform lowp float u_device_pixel_ratio;in vec4 v_data0;in vec4 v_data1;
|
|
659
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
660
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
661
|
-
#pragma mapbox: define lowp float opacity
|
|
662
|
-
#pragma mapbox: define lowp float halo_width
|
|
663
|
-
#pragma mapbox: define lowp float halo_blur
|
|
664
|
-
void main() {
|
|
665
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
666
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
667
|
-
#pragma mapbox: initialize lowp float opacity
|
|
668
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
669
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
670
|
-
float fade_opacity=v_data1[2];if (v_data1.w==ICON) {vec2 tex_icon=v_data0.zw;lowp float alpha=opacity*fade_opacity;fragColor=texture(u_texture_icon,tex_icon)*alpha;
|
|
671
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
672
|
-
fragColor=vec4(1.0);
|
|
673
|
-
#endif
|
|
674
|
-
return;}vec2 tex=v_data0.xy;float EDGE_GAMMA=0.105/u_device_pixel_ratio;float gamma_scale=v_data1.x;float size=v_data1.y;float fontScale=size/24.0;lowp vec4 color=fill_color;highp float gamma=EDGE_GAMMA/(fontScale*u_gamma_scale);lowp float buff=(256.0-64.0)/256.0;if (u_is_halo) {color=halo_color;gamma=(halo_blur*1.19/SDF_PX+EDGE_GAMMA)/(fontScale*u_gamma_scale);buff=(6.0-halo_width/fontScale)/SDF_PX;}lowp float dist=texture(u_texture,tex).a;highp float gamma_scaled=gamma*gamma_scale;highp float alpha=smoothstep(buff-gamma_scaled,buff+gamma_scaled,dist);fragColor=color*(alpha*opacity*fade_opacity);
|
|
675
|
-
#ifdef OVERDRAW_INSPECTOR
|
|
676
|
-
fragColor=vec4(1.0);
|
|
677
|
-
#endif
|
|
678
|
-
}`,`in vec4 a_pos_offset;in vec4 a_data;in vec3 a_projected_pos;in float a_fade_opacity;uniform bool u_is_size_zoom_constant;uniform bool u_is_size_feature_constant;uniform highp float u_size_t;uniform highp float u_size;uniform mat4 u_label_plane_matrix;uniform mat4 u_coord_matrix;uniform bool u_is_text;uniform bool u_pitch_with_map;uniform highp float u_pitch;uniform bool u_rotate_symbol;uniform highp float u_aspect_ratio;uniform highp float u_camera_to_center_distance;uniform float u_fade_change;uniform vec2 u_texsize;uniform vec2 u_texsize_icon;uniform bool u_is_along_line;uniform bool u_is_variable_anchor;uniform vec2 u_translation;uniform float u_pitched_scale;out vec4 v_data0;out vec4 v_data1;
|
|
679
|
-
#pragma mapbox: define highp vec4 fill_color
|
|
680
|
-
#pragma mapbox: define highp vec4 halo_color
|
|
681
|
-
#pragma mapbox: define lowp float opacity
|
|
682
|
-
#pragma mapbox: define lowp float halo_width
|
|
683
|
-
#pragma mapbox: define lowp float halo_blur
|
|
684
|
-
void main() {
|
|
685
|
-
#pragma mapbox: initialize highp vec4 fill_color
|
|
686
|
-
#pragma mapbox: initialize highp vec4 halo_color
|
|
687
|
-
#pragma mapbox: initialize lowp float opacity
|
|
688
|
-
#pragma mapbox: initialize lowp float halo_width
|
|
689
|
-
#pragma mapbox: initialize lowp float halo_blur
|
|
690
|
-
vec2 a_pos=a_pos_offset.xy;vec2 a_offset=a_pos_offset.zw;vec2 a_tex=a_data.xy;vec2 a_size=a_data.zw;float a_size_min=floor(a_size[0]*0.5);float is_sdf=a_size[0]-2.0*a_size_min;float ele=get_elevation(a_pos);highp float segment_angle=-a_projected_pos[2];float size;if (!u_is_size_zoom_constant && !u_is_size_feature_constant) {size=mix(a_size_min,a_size[1],u_size_t)/128.0;} else if (u_is_size_zoom_constant && !u_is_size_feature_constant) {size=a_size_min/128.0;} else {size=u_size;}vec2 translated_a_pos=a_pos+u_translation;vec4 projectedPoint=projectTileWithElevation(translated_a_pos,ele);highp float camera_to_anchor_distance=projectedPoint.w;highp float distance_ratio=u_pitch_with_map ?
|
|
691
|
-
camera_to_anchor_distance/u_camera_to_center_distance :
|
|
692
|
-
u_camera_to_center_distance/camera_to_anchor_distance;highp float perspective_ratio=clamp(0.5+0.5*distance_ratio,0.0,4.0);size*=perspective_ratio;float fontScale=size/24.0;highp float symbol_rotation=0.0;if (u_rotate_symbol) {vec4 offsetProjectedPoint=projectTileWithElevation(translated_a_pos+vec2(1,0),ele);vec2 a=projectedPoint.xy/projectedPoint.w;vec2 b=offsetProjectedPoint.xy/offsetProjectedPoint.w;symbol_rotation=atan((b.y-a.y)/u_aspect_ratio,b.x-a.x);}highp float angle_sin=sin(segment_angle+symbol_rotation);highp float angle_cos=cos(segment_angle+symbol_rotation);mat2 rotation_matrix=mat2(angle_cos,-1.0*angle_sin,angle_sin,angle_cos);vec4 projected_pos;if (u_is_along_line || u_is_variable_anchor) {projected_pos=vec4(a_projected_pos.xy,ele,1.0);} else if (u_pitch_with_map) {projected_pos=u_label_plane_matrix*vec4(a_projected_pos.xy+u_translation,ele,1.0);} else {projected_pos=u_label_plane_matrix*projectTileWithElevation(a_projected_pos.xy+u_translation,ele);}float z=float(u_pitch_with_map)*projected_pos.z/projected_pos.w;float projectionScaling=1.0;
|
|
693
|
-
#ifdef GLOBE
|
|
694
|
-
if(u_pitch_with_map && !u_is_along_line) {float anchor_pos_tile_y=(u_coord_matrix*vec4(projected_pos.xy/projected_pos.w,z,1.0)).y;projectionScaling=mix(projectionScaling,1.0/circumferenceRatioAtTileY(anchor_pos_tile_y)*u_pitched_scale,u_projection_transition);}
|
|
695
|
-
#endif
|
|
696
|
-
vec4 finalPos=u_coord_matrix*vec4(projected_pos.xy/projected_pos.w+rotation_matrix*(a_offset/32.0*fontScale)*projectionScaling,z,1.0);if(u_pitch_with_map) {finalPos=projectTileWithElevation(finalPos.xy,finalPos.z);}float gamma_scale=finalPos.w;gl_Position=finalPos;vec2 fade_opacity=unpack_opacity(a_fade_opacity);float visibility=calculate_visibility(projectedPoint);float fade_change=fade_opacity[1] > 0.5 ? u_fade_change :-u_fade_change;float interpolated_fade_opacity=max(0.0,min(visibility,fade_opacity[0]+fade_change));v_data0.xy=a_tex/u_texsize;v_data0.zw=a_tex/u_texsize_icon;v_data1=vec4(gamma_scale,size,interpolated_fade_opacity,is_sdf);}`),terrain:mt("uniform sampler2D u_texture;uniform vec4 u_fog_color;uniform vec4 u_horizon_color;uniform float u_fog_ground_blend;uniform float u_fog_ground_blend_opacity;uniform float u_horizon_fog_blend;uniform bool u_is_globe_mode;in vec2 v_texture_pos;in float v_fog_depth;const float gamma=2.2;vec4 gammaToLinear(vec4 color) {return pow(color,vec4(gamma));}vec4 linearToGamma(vec4 color) {return pow(color,vec4(1.0/gamma));}void main() {vec4 surface_color=texture(u_texture,vec2(v_texture_pos.x,1.0-v_texture_pos.y));if (!u_is_globe_mode && v_fog_depth > u_fog_ground_blend) {vec4 surface_color_linear=gammaToLinear(surface_color);float blend_color=smoothstep(0.0,1.0,max((v_fog_depth-u_horizon_fog_blend)/(1.0-u_horizon_fog_blend),0.0));vec4 fog_horizon_color_linear=mix(gammaToLinear(u_fog_color),gammaToLinear(u_horizon_color),blend_color);float factor_fog=max(v_fog_depth-u_fog_ground_blend,0.0)/(1.0-u_fog_ground_blend);fragColor=linearToGamma(mix(surface_color_linear,fog_horizon_color_linear,pow(factor_fog,2.0)*u_fog_ground_blend_opacity));} else {fragColor=surface_color;}}","in vec3 a_pos3d;uniform mat4 u_fog_matrix;uniform float u_ele_delta;out vec2 v_texture_pos;out float v_fog_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,get_elevation(a_pos3d.xy)-ele_delta);vec4 pos=u_fog_matrix*vec4(a_pos3d.xy,ele,1.0);v_fog_depth=pos.z/pos.w*0.5+0.5;}"),terrainDepth:mt("in float v_depth;const highp vec4 bitSh=vec4(256.*256.*256.,256.*256.,256.,1.);const highp vec4 bitMsk=vec4(0.,vec3(1./256.0));highp vec4 pack(highp float value) {highp vec4 comp=fract(value*bitSh);comp-=comp.xxyz*bitMsk;return comp;}void main() {fragColor=pack(v_depth);}","in vec3 a_pos3d;uniform float u_ele_delta;out float v_depth;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);v_depth=gl_Position.z/gl_Position.w;}"),terrainCoords:mt("precision mediump float;uniform sampler2D u_texture;uniform float u_terrain_coords_id;in vec2 v_texture_pos;void main() {vec4 rgba=texture(u_texture,v_texture_pos);fragColor=vec4(rgba.r,rgba.g,rgba.b,u_terrain_coords_id);}","in vec3 a_pos3d;uniform float u_ele_delta;out vec2 v_texture_pos;void main() {float ele=get_elevation(a_pos3d.xy);float ele_delta=a_pos3d.z==1.0 ? u_ele_delta : 0.0;v_texture_pos=a_pos3d.xy/8192.0;gl_Position=projectTileFor3D(a_pos3d.xy,ele-ele_delta);}"),projectionErrorMeasurement:mt("in vec4 v_output_error_encoded;void main() {fragColor=v_output_error_encoded;}","in vec2 a_pos;uniform highp float u_input;uniform highp float u_output_expected;out vec4 v_output_error_encoded;void main() {float real_output=2.0*atan(exp(PI-(u_input*PI*2.0)))-PI*0.5;float error=real_output-u_output_expected;float abs_error=abs(error)*128.0;v_output_error_encoded.x=min(floor(abs_error*256.0),255.0)/255.0;abs_error-=v_output_error_encoded.x;v_output_error_encoded.y=min(floor(abs_error*65536.0),255.0)/255.0;abs_error-=v_output_error_encoded.x/255.0;v_output_error_encoded.z=min(floor(abs_error*16777216.0),255.0)/255.0;v_output_error_encoded.w=error >=0.0 ? 1.0 : 0.0;gl_Position=vec4(a_pos,0.0,1.0);}"),atmosphere:mt(`in vec3 view_direction;uniform vec3 u_sun_pos;uniform vec3 u_globe_position;uniform float u_globe_radius;uniform float u_atmosphere_blend;/**Shader use from https:*Made some change to adapt to MapLibre Globe geometry*/const float PI=3.141592653589793;const int iSteps=5;const int jSteps=3;/*radius of the planet*/const float EARTH_RADIUS=6371e3;/*radius of the atmosphere*/const float ATMOS_RADIUS=6471e3;vec2 rsi(vec3 r0,vec3 rd,float sr) {float a=dot(rd,rd);float b=2.0*dot(rd,r0);float c=dot(r0,r0)-(sr*sr);float d=(b*b)-4.0*a*c;if (d < 0.0) return vec2(1e5,-1e5);return vec2((-b-sqrt(d))/(2.0*a),(-b+sqrt(d))/(2.0*a));}vec4 atmosphere(vec3 r,vec3 r0,vec3 pSun,float iSun,float rPlanet,float rAtmos,vec3 kRlh,float kMie,float shRlh,float shMie,float g) {pSun=normalize(pSun);r=normalize(r);vec2 p=rsi(r0,r,rAtmos);if (p.x > p.y) {return vec4(0.0,0.0,0.0,1.0);}if (p.x < 0.0) {p.x=0.0;}vec3 pos=r0+r*p.x;vec2 p2=rsi(r0,r,rPlanet);if (p2.x <=p2.y && p2.x > 0.0) {p.y=min(p.y,p2.x);}float iStepSize=(p.y-p.x)/float(iSteps);float iTime=p.x+iStepSize*0.5;vec3 totalRlh=vec3(0,0,0);vec3 totalMie=vec3(0,0,0);float iOdRlh=0.0;float iOdMie=0.0;float mu=dot(r,pSun);float mumu=mu*mu;float gg=g*g;float pRlh=3.0/(16.0*PI)*(1.0+mumu);float pMie=3.0/(8.0*PI)*((1.0-gg)*(mumu+1.0))/(pow(1.0+gg-2.0*mu*g,1.5)*(2.0+gg));for (int i=0; i < iSteps; i++) {vec3 iPos=r0+r*iTime;float iHeight=length(iPos)-rPlanet;float odStepRlh=exp(-iHeight/shRlh)*iStepSize;float odStepMie=exp(-iHeight/shMie)*iStepSize;iOdRlh+=odStepRlh;iOdMie+=odStepMie;float jStepSize=rsi(iPos,pSun,rAtmos).y/float(jSteps);float jTime=jStepSize*0.5;float jOdRlh=0.0;float jOdMie=0.0;for (int j=0; j < jSteps; j++) {vec3 jPos=iPos+pSun*jTime;float jHeight=length(jPos)-rPlanet;jOdRlh+=exp(-jHeight/shRlh)*jStepSize;jOdMie+=exp(-jHeight/shMie)*jStepSize;jTime+=jStepSize;}vec3 attn=exp(-(kMie*(iOdMie+jOdMie)+kRlh*(iOdRlh+jOdRlh)));totalRlh+=odStepRlh*attn;totalMie+=odStepMie*attn;iTime+=iStepSize;}float opacity=exp(-(length(kRlh)*length(totalRlh)+kMie*length(totalMie)));vec3 color=iSun*(pRlh*kRlh*totalRlh+pMie*kMie*totalMie);return vec4(color,opacity);}void main() {vec3 scale_camera_pos=-u_globe_position*EARTH_RADIUS/u_globe_radius;vec4 color=atmosphere(normalize(view_direction),scale_camera_pos,u_sun_pos,22.0,EARTH_RADIUS,ATMOS_RADIUS,vec3(5.5e-6,13.0e-6,22.4e-6),21e-6,8e3,1.2e3,0.758
|
|
697
|
-
);color.rgb=1.0-exp(-1.0*color.rgb);color=pow(color,vec4(1.0/2.2));fragColor=vec4(color.rgb,1.0-color.a)*u_atmosphere_blend;}`,"in vec2 a_pos;uniform mat4 u_inv_proj_matrix;out vec3 view_direction;void main() {view_direction=(u_inv_proj_matrix*vec4(a_pos,0.0,1.0)).xyz;gl_Position=vec4(a_pos,0.0,1.0);}"),sky:mt("uniform vec4 u_sky_color;uniform vec4 u_horizon_color;uniform vec2 u_horizon;uniform vec2 u_horizon_normal;uniform float u_sky_horizon_blend;uniform float u_sky_blend;void main() {float x=gl_FragCoord.x;float y=gl_FragCoord.y;float blend=(y-u_horizon.y)*u_horizon_normal.y+(x-u_horizon.x)*u_horizon_normal.x;if (blend > 0.0) {if (blend < u_sky_horizon_blend) {fragColor=mix(u_sky_color,u_horizon_color,pow(1.0-blend/u_sky_horizon_blend,2.0));} else {fragColor=u_sky_color;}}fragColor=mix(fragColor,vec4(vec3(0.0),0.0),u_sky_blend);}","in vec2 a_pos;void main() {gl_Position=vec4(a_pos,1.0,1.0);}")};function mt(u,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=e.match(/in ([\w]+) ([\w]+)/g),l=u.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),h=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=h?h.concat(l):l,_={};return{fragmentSource:u=u.replace(i,(x,T,M,A,E)=>(_[E]=!0,T==="define"?`
|
|
698
|
-
#ifndef HAS_UNIFORM_u_${E}
|
|
699
|
-
in ${M} ${A} ${E};
|
|
700
|
-
#else
|
|
701
|
-
uniform ${M} ${A} u_${E};
|
|
702
|
-
#endif
|
|
703
|
-
`:`
|
|
704
|
-
#ifdef HAS_UNIFORM_u_${E}
|
|
705
|
-
${M} ${A} ${E} = u_${E};
|
|
706
|
-
#endif
|
|
707
|
-
`)),vertexSource:e=e.replace(i,(x,T,M,A,E)=>{const R=A==="float"?"vec2":"vec4",O=E.match(/color/)?"color":R;return _[E]?T==="define"?`
|
|
708
|
-
#ifndef HAS_UNIFORM_u_${E}
|
|
709
|
-
uniform lowp float u_${E}_t;
|
|
710
|
-
in ${M} ${R} a_${E};
|
|
711
|
-
out ${M} ${A} ${E};
|
|
712
|
-
#else
|
|
713
|
-
uniform ${M} ${A} u_${E};
|
|
714
|
-
#endif
|
|
715
|
-
`:O==="vec4"?`
|
|
716
|
-
#ifndef HAS_UNIFORM_u_${E}
|
|
717
|
-
${E} = a_${E};
|
|
718
|
-
#else
|
|
719
|
-
${M} ${A} ${E} = u_${E};
|
|
720
|
-
#endif
|
|
721
|
-
`:`
|
|
722
|
-
#ifndef HAS_UNIFORM_u_${E}
|
|
723
|
-
${E} = unpack_mix_${O}(a_${E}, u_${E}_t);
|
|
724
|
-
#else
|
|
725
|
-
${M} ${A} ${E} = u_${E};
|
|
726
|
-
#endif
|
|
727
|
-
`:T==="define"?`
|
|
728
|
-
#ifndef HAS_UNIFORM_u_${E}
|
|
729
|
-
uniform lowp float u_${E}_t;
|
|
730
|
-
in ${M} ${R} a_${E};
|
|
731
|
-
#else
|
|
732
|
-
uniform ${M} ${A} u_${E};
|
|
733
|
-
#endif
|
|
734
|
-
`:O==="vec4"?`
|
|
735
|
-
#ifndef HAS_UNIFORM_u_${E}
|
|
736
|
-
${M} ${A} ${E} = a_${E};
|
|
737
|
-
#else
|
|
738
|
-
${M} ${A} ${E} = u_${E};
|
|
739
|
-
#endif
|
|
740
|
-
`:`
|
|
741
|
-
#ifndef HAS_UNIFORM_u_${E}
|
|
742
|
-
${M} ${A} ${E} = unpack_mix_${O}(a_${E}, u_${E}_t);
|
|
743
|
-
#else
|
|
744
|
-
${M} ${A} ${E} = u_${E};
|
|
745
|
-
#endif
|
|
746
|
-
`}),staticAttributes:s,staticUniforms:f}}class xn{constructor(e,i,s){this.vertexBuffer=e,this.indexBuffer=i,this.segments=s}destroy(){this.vertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.vertexBuffer=null,this.indexBuffer=null,this.segments=null}}var vn=o.aI([{name:"a_pos",type:"Int16",components:2}]);const oa="#define PROJECTION_MERCATOR",Fl="mercator";class Bl{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Fl}get shaderDefine(){return oa}get shaderPreludeCode(){return nn.projectionMercator}get vertexShaderPreludeCode(){return nn.projectionMercator.vertexSource}get subdivisionGranularity(){return o.aJ.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,i,s,l,h){if(this._cachedMesh)return this._cachedMesh;const f=new o.aK;f.emplaceBack(0,0),f.emplaceBack(o.$,0),f.emplaceBack(0,o.$),f.emplaceBack(o.$,o.$);const _=e.createVertexBuffer(f,vn.members),x=o.aL.simpleSegment(0,0,4,2),T=new o.aM;T.emplaceBack(1,0,2),T.emplaceBack(1,2,3);const M=e.createIndexBuffer(T);return this._cachedMesh=new xn(_,M,x),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}class Pr{constructor(e=0,i=0,s=0,l=0){if(isNaN(e)||e<0||isNaN(i)||i<0||isNaN(s)||s<0||isNaN(l)||l<0)throw new Error("Invalid value for edge-insets, top, bottom, left and right must all be numbers");this.top=e,this.bottom=i,this.left=s,this.right=l}interpolate(e,i,s){return i.top!=null&&e.top!=null&&(this.top=o.C.number(e.top,i.top,s)),i.bottom!=null&&e.bottom!=null&&(this.bottom=o.C.number(e.bottom,i.bottom,s)),i.left!=null&&e.left!=null&&(this.left=o.C.number(e.left,i.left,s)),i.right!=null&&e.right!=null&&(this.right=o.C.number(e.right,i.right,s)),this}getCenter(e,i){const s=o.ag((this.left+e-this.right)/2,0,e),l=o.ag((this.top+i-this.bottom)/2,0,i);return new o.P(s,l)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new Pr(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function bn(u,e){if(!u.renderWorldCopies||u.lngRange)return;const i=e.lng-u.center.lng;e.lng+=i>180?-360:i<-180?360:0}function gt(u){return Math.max(0,Math.floor(u))}class Ss{constructor(e,i,s,l,h,f){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=f===void 0||!!f,this._minZoom=i||0,this._maxZoom=s||22,this._minPitch=l??0,this._maxPitch=h??60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new o.S(0,0),this._elevation=0,this._zoom=0,this._tileZoom=gt(this._zoom),this._scale=o.ae(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new Pr,this._minElevationForCurrentTile=0,this._autoCalculateNearFarZ=!0}apply(e,i,s){this._latRange=e.latRange,this._lngRange=e.lngRange,this._width=e.width,this._height=e.height,this._center=e.center,this._elevation=e.elevation,this._minElevationForCurrentTile=e.minElevationForCurrentTile,this._zoom=e.zoom,this._tileZoom=gt(this._zoom),this._scale=o.ae(this._zoom),this._bearingInRadians=e.bearingInRadians,this._fovInRadians=e.fovInRadians,this._pitchInRadians=e.pitchInRadians,this._rollInRadians=e.rollInRadians,this._unmodified=e.unmodified,this._edgeInsets=new Pr(e.padding.top,e.padding.bottom,e.padding.left,e.padding.right),this._minZoom=e.minZoom,this._maxZoom=e.maxZoom,this._minPitch=e.minPitch,this._maxPitch=e.maxPitch,this._renderWorldCopies=e.renderWorldCopies,this._cameraToCenterDistance=e.cameraToCenterDistance,this._nearZ=e.nearZ,this._farZ=e.farZ,this._autoCalculateNearFarZ=!s&&e.autoCalculateNearFarZ,i&&this._constrain(),this._calcMatrices()}get pixelsToClipSpaceMatrix(){return this._pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._clipSpaceToPixelsMatrix}get minElevationForCurrentTile(){return this._minElevationForCurrentTile}setMinElevationForCurrentTile(e){this._minElevationForCurrentTile=e}get tileSize(){return this._tileSize}get tileZoom(){return this._tileZoom}get scale(){return this._scale}get width(){return this._width}get height(){return this._height}get bearingInRadians(){return this._bearingInRadians}get lngRange(){return this._lngRange}get latRange(){return this._latRange}get pixelsToGLUnits(){return this._pixelsToGLUnits}get minZoom(){return this._minZoom}setMinZoom(e){this._minZoom!==e&&(this._minZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get maxZoom(){return this._maxZoom}setMaxZoom(e){this._maxZoom!==e&&(this._maxZoom=e,this.setZoom(this.getConstrained(this._center,this.zoom).zoom))}get minPitch(){return this._minPitch}setMinPitch(e){this._minPitch!==e&&(this._minPitch=e,this.setPitch(Math.max(this.pitch,e)))}get maxPitch(){return this._maxPitch}setMaxPitch(e){this._maxPitch!==e&&(this._maxPitch=e,this.setPitch(Math.min(this.pitch,e)))}get renderWorldCopies(){return this._renderWorldCopies}setRenderWorldCopies(e){e===void 0?e=!0:e===null&&(e=!1),this._renderWorldCopies=e}get worldSize(){return this._tileSize*this._scale}get centerOffset(){return this.centerPoint._sub(this.size._div(2))}get size(){return new o.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const i=o.aN(e,-180,180)*Math.PI/180;var s,l,h,f,_,x,T,M,A;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=be(),s=this._rotationMatrix,h=-this._bearingInRadians,f=(l=this._rotationMatrix)[0],_=l[1],x=l[2],T=l[3],M=Math.sin(h),A=Math.cos(h),s[0]=f*A+x*M,s[1]=_*A+T*M,s[2]=f*-M+x*A,s[3]=_*-M+T*A)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const i=o.ag(e,this.minPitch,this.maxPitch)/180*Math.PI;this._pitchInRadians!==i&&(this._unmodified=!1,this._pitchInRadians=i,this._calcMatrices())}get rollInRadians(){return this._rollInRadians}get roll(){return this._rollInRadians/Math.PI*180}setRoll(e){const i=e/180*Math.PI;this._rollInRadians!==i&&(this._unmodified=!1,this._rollInRadians=i,this._calcMatrices())}get fovInRadians(){return this._fovInRadians}get fov(){return o.aO(this._fovInRadians)}setFov(e){e=o.ag(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=o.ad(e),this._calcMatrices())}get zoom(){return this._zoom}setZoom(e){const i=this.getConstrained(this._center,e).zoom;this._zoom!==i&&(this._unmodified=!1,this._zoom=i,this._tileZoom=Math.max(0,Math.floor(i)),this._scale=o.ae(i),this._constrain(),this._calcMatrices())}get center(){return this._center}setCenter(e){e.lat===this._center.lat&&e.lng===this._center.lng||(this._unmodified=!1,this._center=e,this._constrain(),this._calcMatrices())}get elevation(){return this._elevation}setElevation(e){e!==this._elevation&&(this._elevation=e,this._constrain(),this._calcMatrices())}get padding(){return this._edgeInsets.toJSON()}setPadding(e){this._edgeInsets.equals(e)||(this._unmodified=!1,this._edgeInsets.interpolate(this._edgeInsets,e,1),this._calcMatrices())}get centerPoint(){return this._edgeInsets.getCenter(this._width,this._height)}get pixelsPerMeter(){return this._pixelPerMeter}get unmodified(){return this._unmodified}get cameraToCenterDistance(){return this._cameraToCenterDistance}get nearZ(){return this._nearZ}get farZ(){return this._farZ}get autoCalculateNearFarZ(){return this._autoCalculateNearFarZ}overrideNearFarZ(e,i){this._autoCalculateNearFarZ=!1,this._nearZ=e,this._farZ=i,this._calcMatrices()}clearNearFarZOverride(){this._autoCalculateNearFarZ=!0,this._calcMatrices()}isPaddingEqual(e){return this._edgeInsets.equals(e)}interpolatePadding(e,i,s){this._unmodified=!1,this._edgeInsets.interpolate(e,i,s),this._constrain(),this._calcMatrices()}resize(e,i,s=!0){this._width=e,this._height=i,s&&this._constrain(),this._calcMatrices()}getMaxBounds(){return this._latRange&&this._latRange.length===2&&this._lngRange&&this._lngRange.length===2?new ii([this._lngRange[0],this._latRange[0]],[this._lngRange[1],this._latRange[1]]):null}setMaxBounds(e){e?(this._lngRange=[e.getWest(),e.getEast()],this._latRange=[e.getSouth(),e.getNorth()],this._constrain()):(this._lngRange=null,this._latRange=[-85.051129,o.ah])}getConstrained(e,i){return this._callbacks.getConstrained(e,i)}getCameraQueryGeometry(e,i){if(i.length===1)return[i[0],e];{const{minX:s,minY:l,maxX:h,maxY:f}=o.a1.fromPoints(i).extend(e);return[new o.P(s,l),new o.P(h,l),new o.P(h,f),new o.P(s,f),new o.P(s,l)]}}_constrain(){if(!this.center||!this._width||!this._height||this._constraining)return;this._constraining=!0;const e=this._unmodified,{center:i,zoom:s}=this.getConstrained(this.center,this.zoom);this.setCenter(i),this.setZoom(s),this._unmodified=e,this._constraining=!1}_calcMatrices(){if(this._width&&this._height){this._pixelsToGLUnits=[2/this._width,-2/this._height];let e=o.af(new Float64Array(16));o.N(e,e,[this._width/2,-this._height/2,1]),o.M(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=o.af(new Float64Array(16)),o.N(e,e,[1,-1,1]),o.M(e,e,[-1,-1,0]),o.N(e,e,[2/this._width,2/this._height,1]),this._pixelsToClipSpaceMatrix=e,this._cameraToCenterDistance=.5/Math.tan(this.fovInRadians/2)*this._height}this._callbacks.calcMatrices()}calculateCenterFromCameraLngLatAlt(e,i,s,l){const h=s!==void 0?s:this.bearing,f=l=l!==void 0?l:this.pitch,_=o.a0.fromLngLat(e,i),x=-Math.cos(o.ad(f)),T=Math.sin(o.ad(f)),M=T*Math.sin(o.ad(h)),A=-T*Math.cos(o.ad(h));let E=this.elevation;const R=i-E;let O;x*R>=0||Math.abs(x)<.1?(O=1e4,E=i+O*x):O=-R/x;let q,$,W=o.aP(1,_.y),X=0;do{if(X+=1,X>10)break;$=O/W,q=new o.a0(_.x+M*$,_.y+A*$),W=1/q.meterInMercatorCoordinateUnits()}while(Math.abs(O-$*W)>1e-12);return{center:q.toLngLat(),elevation:E,zoom:o.aj(this.height/2/Math.tan(this.fovInRadians/2)/$/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const i=o.ai(1,this.center.lat)*this.worldSize,s=this.cameraToCenterDistance/i,l=o.a0.fromLngLat(this.center,this.elevation),h=Q(this.center,this.elevation,this.pitch,this.bearing,s);this._elevation=e;const f=this.calculateCenterFromCameraLngLatAlt(h.toLngLat(),o.aP(h.z,l.y),this.bearing,this.pitch);this._elevation=f.elevation,this._center=f.center,this.setZoom(f.zoom)}getCameraPoint(){const e=Math.tan(this.pitchInRadians)*(this.cameraToCenterDistance||1);return this.centerPoint.add(new o.P(e*Math.sin(this.rollInRadians),e*Math.cos(this.rollInRadians)))}getCameraAltitude(){return Math.cos(this.pitchInRadians)*this._cameraToCenterDistance/this._pixelPerMeter+this.elevation}getCameraLngLat(){const e=o.ai(1,this.center.lat)*this.worldSize;return Q(this.center,this.elevation,this.pitch,this.bearing,this.cameraToCenterDistance/e).toLngLat()}getMercatorTileCoordinates(e){if(!e)return[0,0,1,1];const i=e.canonical.z>=0?1<<e.canonical.z:Math.pow(2,e.canonical.z);return[e.canonical.x/i,e.canonical.y/i,1/i/o.$,1/i/o.$]}}class zo{constructor(e,i){this.min=e,this.max=i,this.center=o.aQ([],o.aR([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],s=o.aS(this.min),l=o.aS(this.max);for(let h=0;h<i.length;h++)s[h]=i[h]?this.min[h]:this.center[h],l[h]=i[h]?this.center[h]:this.max[h];return l[2]=this.max[2],new zo(s,l)}distanceX(e){return Math.max(Math.min(this.max[0],e[0]),this.min[0])-e[0]}distanceY(e){return Math.max(Math.min(this.max[1],e[1]),this.min[1])-e[1]}intersectsFrustum(e){let i=!0;for(let s=0;s<e.planes.length;s++){const l=this.intersectsPlane(e.planes[s]);if(l===0)return 0;l===1&&(i=!1)}return i?2:e.aabb.min[0]>this.max[0]||e.aabb.min[1]>this.max[1]||e.aabb.min[2]>this.max[2]||e.aabb.max[0]<this.min[0]||e.aabb.max[1]<this.min[1]||e.aabb.max[2]<this.min[2]?0:1}intersectsPlane(e){let i=e[3],s=e[3];for(let l=0;l<3;l++)e[l]>0?(i+=e[l]*this.min[l],s+=e[l]*this.max[l]):(s+=e[l]*this.min[l],i+=e[l]*this.max[l]);return i>=0?2:s<0?0:1}}class Ol{distanceToTile2d(e,i,s,l){const h=l.distanceX([e,i]),f=l.distanceY([e,i]);return Math.hypot(h,f)}getWrap(e,i,s){return s}getTileBoundingVolume(e,i,s,l){var h,f;let _=s,x=s;if(l!=null&&l.terrain){const M=new o.Z(e.z,i,e.z,e.x,e.y),A=l.terrain.getMinMaxElevation(M);_=(h=A.minElevation)!==null&&h!==void 0?h:s,x=(f=A.maxElevation)!==null&&f!==void 0?f:s}const T=1<<e.z;return new zo([i+e.x/T,e.y/T,_],[i+(e.x+1)/T,(e.y+1)/T,x])}allowVariableZoom(e,i){const s=e.fov*(Math.abs(Math.cos(e.rollInRadians))*e.height+Math.abs(Math.sin(e.rollInRadians))*e.width)/e.height,l=o.ag(78.5-s/2,0,60);return!!i.terrain||e.pitch>l}allowWorldCopies(){return!0}prepareNextFrame(){}}class Vi{constructor(e,i,s){this.points=e,this.planes=i,this.aabb=s}static fromInvProjectionMatrix(e,i=1,s=0,l,h){const f=h?[[6,5,4],[0,1,2],[0,3,7],[2,1,5],[3,2,6],[0,4,5]]:[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]],_=Math.pow(2,s),x=[[-1,1,-1,1],[1,1,-1,1],[1,-1,-1,1],[-1,-1,-1,1],[-1,1,1,1],[1,1,1,1],[1,-1,1,1],[-1,-1,1,1]].map(E=>function(R,O,q,$){const W=o.av([],R,O),X=1/W[3]/q*$;return o.aX(W,W,[X,X,1/W[3],X])}(E,e,i,_));l&&function(E,R,O,q){const $=q?4:0,W=q?0:4;let X=0;const ee=[],Y=[];for(let K=0;K<4;K++){const oe=o.aT([],E[K+W],E[K+$]),_e=o.aY(oe);o.aQ(oe,oe,1/_e),ee.push(_e),Y.push(oe)}for(let K=0;K<4;K++){const oe=o.aZ(E[K+$],Y[K],O);X=oe!==null&&oe>=0?Math.max(X,oe):Math.max(X,ee[K])}const ie=function(K,oe){const _e=o.aT([],K[oe[0]],K[oe[1]]),pe=o.aT([],K[oe[2]],K[oe[1]]),fe=[0,0,0,0];return o.aU(fe,o.aV([],_e,pe)),fe[3]=-o.aW(fe,K[oe[0]]),fe}(E,R),re=function(K,oe){const _e=o.a_(K),pe=o.a$([],K,1/_e),fe=o.aT([],oe,o.aQ([],pe,o.aW(oe,pe))),xe=o.a_(fe);if(xe>0){const Fe=Math.sqrt(1-pe[3]*pe[3]),Le=o.aQ([],pe,-pe[3]),Ie=o.aR([],Le,o.aQ([],fe,Fe/xe));return o.b0(oe,Ie)}return null}(O,ie);if(re!==null){const K=re/o.aW(Y[0],ie);X=Math.min(X,K)}for(let K=0;K<4;K++){const oe=Math.min(X,ee[K]);E[K+W]=[E[K+$][0]+Y[K][0]*oe,E[K+$][1]+Y[K][1]*oe,E[K+$][2]+Y[K][2]*oe,1]}}(x,f[0],l,h);const T=f.map(E=>{const R=o.aT([],x[E[0]],x[E[1]]),O=o.aT([],x[E[2]],x[E[1]]),q=o.aU([],o.aV([],R,O)),$=-o.aW(q,x[E[1]]);return q.concat($)}),M=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],A=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const E of x)for(let R=0;R<3;R++)M[R]=Math.min(M[R],E[R]),A[R]=Math.max(A[R],E[R]);return new Vi(x,T,new zo(M,A))}}class pi{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,s){return this._helper.interpolatePadding(e,i,s)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i,s=!0){this._helper.resize(e,i,s)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e,i){}constructor(e,i,s,l,h){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new Ss({calcMatrices:()=>{this._calcMatrices()},getConstrained:(f,_)=>this.getConstrained(f,_)},e,i,s,l,h),this._coveringTilesDetailsProvider=new Ol}clone(){const e=new pi;return e.apply(this),e}apply(e,i,s){this._helper.apply(e,i,s)}get cameraPosition(){return this._cameraPosition}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._viewProjMatrix}get inverseProjectionMatrix(){return this._invProjMatrix}get mercatorMatrix(){return this._mercatorMatrix}getVisibleUnwrappedCoordinates(e){const i=[new o.b1(0,e)];if(this._helper._renderWorldCopies){const s=this.screenPointToMercatorCoordinate(new o.P(0,0)),l=this.screenPointToMercatorCoordinate(new o.P(this._helper._width,0)),h=this.screenPointToMercatorCoordinate(new o.P(this._helper._width,this._helper._height)),f=this.screenPointToMercatorCoordinate(new o.P(0,this._helper._height)),_=Math.floor(Math.min(s.x,l.x,h.x,f.x)),x=Math.floor(Math.max(s.x,l.x,h.x,f.x)),T=1;for(let M=_-T;M<=x+T;M++)M!==0&&i.push(new o.b1(M,e))}return i}getCameraFrustum(){return Vi.fromInvProjectionMatrix(this._invViewProjMatrix,this.worldSize)}getClippingPlane(){return null}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){const i=this.screenPointToLocation(this.centerPoint,e),s=e?e.getElevationForLngLatZoom(i,this._helper._tileZoom):0;this._helper.recalculateZoomAndCenter(s)}setLocationAtPoint(e,i){const s=o.ai(this.elevation,this.center.lat),l=this.screenPointToMercatorCoordinateAtZ(i,s),h=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,s),f=o.a0.fromLngLat(e),_=new o.a0(f.x-(l.x-h.x),f.y-(l.y-h.y));this.setCenter(_==null?void 0:_.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(o.a0.fromLngLat(e),i.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(o.a0.fromLngLat(e))}screenPointToLocation(e,i){var s;return(s=this.screenPointToMercatorCoordinate(e,i))===null||s===void 0?void 0:s.toLngLat()}screenPointToMercatorCoordinate(e,i){if(i){const s=i.pointCoordinate(e);if(s!=null)return s}return this.screenPointToMercatorCoordinateAtZ(e)}screenPointToMercatorCoordinateAtZ(e,i){const s=i||0,l=[e.x,e.y,0,1],h=[e.x,e.y,1,1];o.av(l,l,this._pixelMatrixInverse),o.av(h,h,this._pixelMatrixInverse);const f=l[3],_=h[3],x=l[1]/f,T=h[1]/_,M=l[2]/f,A=h[2]/_,E=M===A?0:(s-M)/(A-M);return new o.a0(o.C.number(l[0]/f,h[0]/_,E)/this.worldSize,o.C.number(x,T,E)/this.worldSize,s)}coordinatePoint(e,i=0,s=this._pixelMatrix){const l=[e.x*this.worldSize,e.y*this.worldSize,i,1];return o.av(l,l,s),new o.P(l[0]/l[3],l[1]/l[3])}getBounds(){const e=Math.max(0,this._helper._height/2-V(this));return new ii().extend(this.screenPointToLocation(new o.P(0,e))).extend(this.screenPointToLocation(new o.P(this._helper._width,e))).extend(this.screenPointToLocation(new o.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new o.P(0,this._helper._height)))}isPointOnMapSurface(e,i){return i?i.pointCoordinate(e)!=null:e.y>this.height/2-V(this)}calculatePosMatrix(e,i=!1,s){var l;const h=(l=e.key)!==null&&l!==void 0?l:o.b2(e.wrap,e.canonical.z,e.canonical.z,e.canonical.x,e.canonical.y),f=i?this._alignedPosMatrixCache:this._posMatrixCache;if(f.has(h)){const T=f.get(h);return s?T.f32:T.f64}const _=G(e,this.worldSize);o.O(_,i?this._alignedProjMatrix:this._viewProjMatrix,_);const x={f64:_,f32:new Float32Array(_)};return f.set(h,x),s?x.f32:x.f64}calculateFogMatrix(e){const i=e.key,s=this._fogMatrixCacheF32;if(s.has(i))return s.get(i);const l=G(e,this.worldSize);return o.O(l,this._fogMatrix,l),s.set(i,new Float32Array(l)),s.get(i)}getConstrained(e,i){i=o.ag(+i,this.minZoom,this.maxZoom);const s={center:new o.S(e.lng,e.lat),zoom:i};let l=this._helper._lngRange;this._helper._renderWorldCopies||l!==null||(l=[-179.9999999999,180-1e-10]);const h=this.tileSize*o.ae(s.zoom);let f=0,_=h,x=0,T=h,M=0,A=0;const{x:E,y:R}=this.size;if(this._helper._latRange){const ee=this._helper._latRange;f=o.U(ee[1])*h,_=o.U(ee[0])*h,_-f<R&&(M=R/(_-f))}l&&(x=o.aN(o.V(l[0])*h,0,h),T=o.aN(o.V(l[1])*h,0,h),T<x&&(T+=h),T-x<E&&(A=E/(T-x)));const{x:O,y:q}=he(h,e);let $,W;const X=Math.max(A||0,M||0);if(X){const ee=new o.P(A?(T+x)/2:O,M?(_+f)/2:q);return s.center=N(h,ee).wrap(),s.zoom+=o.aj(X),s}if(this._helper._latRange){const ee=R/2;q-ee<f&&(W=f+ee),q+ee>_&&(W=_-ee)}if(l){const ee=(x+T)/2;let Y=O;this._helper._renderWorldCopies&&(Y=o.aN(O,ee-h/2,ee+h/2));const ie=E/2;Y-ie<x&&($=x+ie),Y+ie>T&&($=T-ie)}if($!==void 0||W!==void 0){const ee=new o.P($??O,W??q);s.center=N(h,ee).wrap()}return s}calculateCenterFromCameraLngLatAlt(e,i,s,l){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,s,l)}_calculateNearFarZIfNeeded(e,i,s){if(!this._helper.autoCalculateNearFarZ)return;const l=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),h=e-l*this._helper._pixelPerMeter/Math.cos(i),f=l<0?h:e,_=Math.PI/2+this.pitchInRadians,x=o.ad(this.fov)*(Math.abs(Math.cos(o.ad(this.roll)))*this.height+Math.abs(Math.sin(o.ad(this.roll)))*this.width)/this.height*(.5+s.y/this.height),T=Math.sin(x)*f/Math.sin(o.ag(Math.PI-_-x,.01,Math.PI-.01)),M=V(this),A=Math.atan(M/this._helper.cameraToCenterDistance),E=o.ad(.75),R=A>E?2*A*(.5+s.y/(2*M)):E,O=Math.sin(R)*f/Math.sin(o.ag(Math.PI-_-R,.01,Math.PI-.01)),q=Math.min(T,O);this._helper._farZ=1.01*(Math.cos(Math.PI/2-i)*q+f),this._helper._nearZ=this._helper._height/50}_calcMatrices(){if(!this._helper._height)return;const e=this.centerOffset,i=he(this.worldSize,this.center),s=i.x,l=i.y;this._helper._pixelPerMeter=o.ai(1,this.center.lat)*this.worldSize;const h=o.ad(Math.min(this.pitch,gn)),f=Math.max(this._helper.cameraToCenterDistance/2,this._helper.cameraToCenterDistance+this._helper._elevation*this._helper._pixelPerMeter/Math.cos(h));let _;this._calculateNearFarZIfNeeded(f,h,e),_=new Float64Array(16),o.b3(_,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),o.ap(this._invProjMatrix,_),_[8]=2*-e.x/this._helper._width,_[9]=2*e.y/this._helper._height,this._projectionMatrix=o.b4(_),o.N(_,_,[1,-1,1]),o.M(_,_,[0,0,-this._helper.cameraToCenterDistance]),o.b5(_,_,-this.rollInRadians),o.b6(_,_,this.pitchInRadians),o.b5(_,_,-this.bearingInRadians),o.M(_,_,[-s,-l,0]),this._mercatorMatrix=o.N([],_,[this.worldSize,this.worldSize,this.worldSize]),o.N(_,_,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=o.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,_),o.M(_,_,[0,0,-this.elevation]),this._viewProjMatrix=_,this._invViewProjMatrix=o.ap([],_);const x=[0,0,-1,1];o.av(x,x,this._invViewProjMatrix),this._cameraPosition=[x[0]/x[3],x[1]/x[3],x[2]/x[3]],this._fogMatrix=new Float64Array(16),o.b3(this._fogMatrix,this.fovInRadians,this.width/this.height,f,this._helper._farZ),this._fogMatrix[8]=2*-e.x/this.width,this._fogMatrix[9]=2*e.y/this.height,o.N(this._fogMatrix,this._fogMatrix,[1,-1,1]),o.M(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),o.b5(this._fogMatrix,this._fogMatrix,-this.rollInRadians),o.b6(this._fogMatrix,this._fogMatrix,this.pitchInRadians),o.b5(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),o.M(this._fogMatrix,this._fogMatrix,[-s,-l,0]),o.N(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),o.M(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=o.O(new Float64Array(16),this.clipSpaceToPixelsMatrix,_);const T=this._helper._width%2/2,M=this._helper._height%2/2,A=Math.cos(this.bearingInRadians),E=Math.sin(-this.bearingInRadians),R=s-Math.round(s)+A*T+E*M,O=l-Math.round(l)+A*M+E*T,q=new Float64Array(_);if(o.M(q,q,[R>.5?R-1:R,O>.5?O-1:O,0]),this._alignedProjMatrix=q,_=o.ap(new Float64Array(16),this._pixelMatrix),!_)throw new Error("failed to invert matrix");this._pixelMatrixInverse=_,this._clearMatrixCaches()}_clearMatrixCaches(){this._posMatrixCache.clear(),this._alignedPosMatrixCache.clear(),this._fogMatrixCacheF32.clear()}maxPitchScaleFactor(){if(!this._pixelMatrixInverse)return 1;const e=this.screenPointToMercatorCoordinate(new o.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return o.av(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=o.ai(1,this.center.lat)*this.worldSize;return Q(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){const s=o.a0.fromLngLat(e),l=[s.x*this.worldSize,s.y*this.worldSize,i,1];return o.av(l,l,this._viewProjMatrix),l[2]/l[3]}getProjectionData(e){const{overscaledTileID:i,aligned:s,applyTerrainMatrix:l}=e,h=this._helper.getMercatorTileCoordinates(i),f=i?this.calculatePosMatrix(i,s,!0):null;let _;return _=i&&i.terrainRttPosMatrix32f&&l?i.terrainRttPosMatrix32f:f||o.b7(),{mainMatrix:_,tileMercatorCoords:h,clippingPlane:[0,0,0,0],projectionTransition:0,fallbackMatrix:_}}isLocationOccluded(e){return!1}getPixelScale(){return 1}getCircleRadiusCorrection(){return 1}getPitchedTextCorrection(e,i,s){return 1}transformLightDirection(e){return o.aS(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,i,s,l){const h=this.calculatePosMatrix(s);let f;l?(f=[e,i,l(e,i),1],o.av(f,f,h)):(f=[e,i,0,1],aa(f,f,h));const _=f[3];return{point:new o.P(f[0]/_,f[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}populateCache(e){for(const i of e)this.calculatePosMatrix(i)}getMatrixForModel(e,i){const s=o.a0.fromLngLat(e,i),l=s.meterInMercatorCoordinateUnits(),h=o.b8();return o.M(h,h,[s.x,s.y,s.z]),o.b5(h,h,Math.PI),o.b6(h,h,Math.PI/2),o.N(h,h,[-l,l,l]),h}getProjectionDataForCustomLayer(e=!0){const i=new o.Z(0,0,0,0,0),s=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),l=G(i,this.worldSize);o.O(l,this._viewProjMatrix,l),s.tileMercatorCoords=[0,0,1,1];const h=[o.$,o.$,this.worldSize/this._helper.pixelsPerMeter],f=o.b9();return o.N(f,l,h),s.fallbackMatrix=f,s.mainMatrix=f,s}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function Zi(){o.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Ti(u){if(u.useSlerp)if(u.k<1){const e=o.ba(u.startEulerAngles.roll,u.startEulerAngles.pitch,u.startEulerAngles.bearing),i=o.ba(u.endEulerAngles.roll,u.endEulerAngles.pitch,u.endEulerAngles.bearing),s=new Float64Array(4);o.bb(s,e,i,u.k);const l=o.bc(s);u.tr.setRoll(l.roll),u.tr.setPitch(l.pitch),u.tr.setBearing(l.bearing)}else u.tr.setRoll(u.endEulerAngles.roll),u.tr.setPitch(u.endEulerAngles.pitch),u.tr.setBearing(u.endEulerAngles.bearing);else u.tr.setRoll(o.C.number(u.startEulerAngles.roll,u.endEulerAngles.roll,u.k)),u.tr.setPitch(o.C.number(u.startEulerAngles.pitch,u.endEulerAngles.pitch,u.k)),u.tr.setBearing(o.C.number(u.startEulerAngles.bearing,u.endEulerAngles.bearing,u.k))}function Yt(u,e,i,s,l){const h=l.padding,f=he(l.worldSize,i.getNorthWest()),_=he(l.worldSize,i.getNorthEast()),x=he(l.worldSize,i.getSouthEast()),T=he(l.worldSize,i.getSouthWest()),M=o.ad(-s),A=f.rotate(M),E=_.rotate(M),R=x.rotate(M),O=T.rotate(M),q=new o.P(Math.max(A.x,E.x,O.x,R.x),Math.max(A.y,E.y,O.y,R.y)),$=new o.P(Math.min(A.x,E.x,O.x,R.x),Math.min(A.y,E.y,O.y,R.y)),W=q.sub($),X=(l.width-(h.left+h.right+e.left+e.right))/W.x,ee=(l.height-(h.top+h.bottom+e.top+e.bottom))/W.y;if(ee<0||X<0)return void Zi();const Y=Math.min(o.aj(l.scale*Math.min(X,ee)),u.maxZoom),ie=o.P.convert(u.offset),re=new o.P((e.left-e.right)/2,(e.top-e.bottom)/2).rotate(o.ad(s)),K=ie.add(re).mult(l.scale/o.ae(Y));return{center:N(l.worldSize,f.add(x).div(2).sub(K)),zoom:Y,bearing:s}}class ko{get useGlobeControls(){return!1}handlePanInertia(e,i){return{easingOffset:e,easingCenter:i.center}}handleMapControlsRollPitchBearingZoom(e,i){e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta),e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta)}handleMapControlsPan(e,i,s){e.around.distSqr(i.centerPoint)<.01||i.setLocationAtPoint(s,e.around)}cameraForBoxAndBearing(e,i,s,l,h){return Yt(e,i,s,l,h)}handleJumpToCenterZoom(e,i){e.zoom!==(i.zoom!==void 0?+i.zoom:e.zoom)&&e.setZoom(+i.zoom),i.center!==void 0&&e.setCenter(o.S.convert(i.center))}handleEaseTo(e,i){const s=e.zoom,l=e.padding,h={roll:e.roll,pitch:e.pitch,bearing:e.bearing},f={roll:i.roll===void 0?e.roll:i.roll,pitch:i.pitch===void 0?e.pitch:i.pitch,bearing:i.bearing===void 0?e.bearing:i.bearing},_=i.zoom!==void 0,x=!e.isPaddingEqual(i.padding);let T=!1;const M=_?+i.zoom:e.zoom;let A=e.centerPoint.add(i.offsetAsPoint);const E=e.screenPointToLocation(A),{center:R,zoom:O}=e.getConstrained(o.S.convert(i.center||E),M??s);bn(e,R);const q=he(e.worldSize,E),$=he(e.worldSize,R).sub(q),W=o.ae(O-s);return T=O!==s,{easeFunc:X=>{if(T&&e.setZoom(o.C.number(s,O,X)),o.bd(h,f)||Ti({startEulerAngles:h,endEulerAngles:f,tr:e,k:X,useSlerp:h.roll!=f.roll}),x&&(e.interpolatePadding(l,i.padding,X),A=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{const ee=o.ae(e.zoom-s),Y=O>s?Math.min(2,W):Math.max(.5,W),ie=Math.pow(Y,1-X),re=N(e.worldSize,q.add($.mult(X*ie)).mult(ee));e.setLocationAtPoint(e.renderWorldCopies?re.wrap():re,A)}},isZooming:T,elevationCenter:R}}handleFlyTo(e,i){const s=i.zoom!==void 0,l=e.zoom,h=e.getConstrained(o.S.convert(i.center||i.locationAtOffset),s?+i.zoom:l),f=h.center,_=h.zoom;bn(e,f);const x=he(e.worldSize,i.locationAtOffset),T=he(e.worldSize,f).sub(x),M=T.mag(),A=o.ae(_-l);let E;if(i.minZoom!==void 0){const R=Math.min(+i.minZoom,l,_),O=e.getConstrained(f,R).zoom;E=o.ae(O-l)}return{easeFunc:(R,O,q,$)=>{e.setZoom(R===1?_:l+o.aj(O));const W=R===1?f:N(e.worldSize,x.add(T.mult(q)).mult(O));e.setLocationAtPoint(e.renderWorldCopies?W.wrap():W,$)},scaleOfZoom:A,targetCenter:f,scaleOfMinZoom:E,pixelPathLength:M}}}class bt{constructor(e,i,s){this.blendFunction=e,this.blendColor=i,this.mask=s}}bt.Replace=[1,0],bt.disabled=new bt(bt.Replace,o.be.transparent,[!1,!1,!1,!1]),bt.unblended=new bt(bt.Replace,o.be.transparent,[!0,!0,!0,!0]),bt.alphaBlended=new bt([1,771],o.be.transparent,[!0,!0,!0,!0]);const nr=2305;class at{constructor(e,i,s){this.enable=e,this.mode=i,this.frontFace=s}}at.disabled=new at(!1,1029,nr),at.backCCW=new at(!0,1029,nr),at.frontCCW=new at(!0,1028,nr);class st{constructor(e,i,s){this.func=e,this.mask=i,this.range=s}}st.ReadOnly=!1,st.ReadWrite=!0,st.disabled=new st(519,st.ReadOnly,[0,1]);const la=7680;class it{constructor(e,i,s,l,h,f){this.test=e,this.ref=i,this.mask=s,this.fail=l,this.depthFail=h,this.pass=f}}it.disabled=new it({func:519,mask:0},0,0,la,la,la);const ca=new WeakMap;function Xi(u){var e;if(ca.has(u))return ca.get(u);{const i=(e=u.getParameter(u.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return ca.set(u,i),i}}class Fa{get awaitingQuery(){return!!this._readbackQueue}constructor(e){this._readbackWaitFrames=4,this._measureWaitFrames=6,this._texWidth=1,this._texHeight=1,this._measuredError=0,this._updateCount=0,this._lastReadbackFrame=-1e3,this._readbackQueue=null,this._cachedRenderContext=e;const i=e.context,s=i.gl;this._texFormat=s.RGBA,this._texType=s.UNSIGNED_BYTE;const l=new o.aK;l.emplaceBack(-1,-1),l.emplaceBack(2,-1),l.emplaceBack(-1,2);const h=new o.aM;h.emplaceBack(0,1,2),this._fullscreenTriangle=new xn(i.createVertexBuffer(l,vn.members),i.createIndexBuffer(h),o.aL.simpleSegment(0,0,l.length,h.length)),this._resultBuffer=new Uint8Array(4),i.activeTexture.set(s.TEXTURE1);const f=s.createTexture();s.bindTexture(s.TEXTURE_2D,f),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_S,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_WRAP_T,s.CLAMP_TO_EDGE),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MIN_FILTER,s.NEAREST),s.texParameteri(s.TEXTURE_2D,s.TEXTURE_MAG_FILTER,s.NEAREST),s.texImage2D(s.TEXTURE_2D,0,this._texFormat,this._texWidth,this._texHeight,0,this._texFormat,this._texType,null),this._fbo=i.createFramebuffer(this._texWidth,this._texHeight,!1,!1),this._fbo.colorAttachment.set(f),Xi(s)&&(this._pbo=s.createBuffer(),s.bindBuffer(s.PIXEL_PACK_BUFFER,this._pbo),s.bufferData(s.PIXEL_PACK_BUFFER,4,s.STREAM_READ),s.bindBuffer(s.PIXEL_PACK_BUFFER,null))}destroy(){const e=this._cachedRenderContext.context.gl;this._fullscreenTriangle.destroy(),this._fbo.destroy(),e.deleteBuffer(this._pbo),this._fullscreenTriangle=null,this._fbo=null,this._pbo=null,this._resultBuffer=null}updateErrorLoop(e,i){const s=this._updateCount;return this._readbackQueue?s>=this._readbackQueue.frameNumberIssued+this._readbackWaitFrames&&this._tryReadback():s>=this._lastReadbackFrame+this._measureWaitFrames&&this._renderErrorTexture(e,i),this._updateCount++,this._measuredError}_bindFramebuffer(){const e=this._cachedRenderContext.context,i=e.gl;e.activeTexture.set(i.TEXTURE1),i.bindTexture(i.TEXTURE_2D,this._fbo.colorAttachment.get()),e.bindFramebuffer.set(this._fbo.framebuffer)}_renderErrorTexture(e,i){const s=this._cachedRenderContext.context,l=s.gl;if(this._bindFramebuffer(),s.viewport.set([0,0,this._texWidth,this._texHeight]),s.clear({color:o.be.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(s,l.TRIANGLES,st.disabled,it.disabled,bt.unblended,at.disabled,((h,f)=>({u_input:h,u_output_expected:f}))(e,i),null,null,"$clipping",this._fullscreenTriangle.vertexBuffer,this._fullscreenTriangle.indexBuffer,this._fullscreenTriangle.segments),this._pbo&&Xi(l)){l.bindBuffer(l.PIXEL_PACK_BUFFER,this._pbo),l.readBuffer(l.COLOR_ATTACHMENT0),l.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),l.bindBuffer(l.PIXEL_PACK_BUFFER,null);const h=l.fenceSync(l.SYNC_GPU_COMMANDS_COMPLETE,0);l.flush(),this._readbackQueue={frameNumberIssued:this._updateCount,sync:h}}else this._readbackQueue={frameNumberIssued:this._updateCount,sync:null}}_tryReadback(){const e=this._cachedRenderContext.context.gl;if(this._pbo&&this._readbackQueue&&Xi(e)){const i=e.clientWaitSync(this._readbackQueue.sync,0,0);if(i===e.WAIT_FAILED)return o.w("WebGL2 clientWaitSync failed."),this._readbackQueue=null,void(this._lastReadbackFrame=this._updateCount);if(i===e.TIMEOUT_EXPIRED)return;e.bindBuffer(e.PIXEL_PACK_BUFFER,this._pbo),e.getBufferSubData(e.PIXEL_PACK_BUFFER,0,this._resultBuffer,0,4),e.bindBuffer(e.PIXEL_PACK_BUFFER,null)}else this._bindFramebuffer(),e.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,this._resultBuffer);this._readbackQueue=null,this._measuredError=Fa._parseRGBA8float(this._resultBuffer),this._lastReadbackFrame=this._updateCount}static _parseRGBA8float(e){let i=0;return i+=e[0]/256,i+=e[1]/65536,i+=e[2]/16777216,e[3]<127&&(i=-i),i/128}}const Mr=o.$/128;function jl(u,e){const i=u.granularity!==void 0?Math.max(u.granularity,1):1,s=i+(u.generateBorders?2:0),l=i+(u.extendToNorthPole||u.generateBorders?1:0)+(u.extendToSouthPole||u.generateBorders?1:0),h=s+1,f=l+1,_=u.generateBorders?-1:0,x=u.generateBorders||u.extendToNorthPole?-1:0,T=i+(u.generateBorders?1:0),M=i+(u.generateBorders||u.extendToSouthPole?1:0),A=h*f,E=s*l*6,R=h*f>65536;if(R&&e==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const O=R||e==="32bit",q=new Int16Array(2*A);let $=0;for(let ee=x;ee<=M;ee++)for(let Y=_;Y<=T;Y++){let ie=Y/i*o.$;Y===-1&&(ie=-64),Y===i+1&&(ie=o.$+Mr);let re=ee/i*o.$;ee===-1&&(re=u.extendToNorthPole?o.bg:-64),ee===i+1&&(re=u.extendToSouthPole?o.bh:o.$+Mr),q[$++]=ie,q[$++]=re}const W=O?new Uint32Array(E):new Uint16Array(E);let X=0;for(let ee=0;ee<l;ee++)for(let Y=0;Y<s;Y++){const ie=Y+1+ee*h,re=Y+(ee+1)*h,K=Y+1+(ee+1)*h;W[X++]=Y+ee*h,W[X++]=re,W[X++]=ie,W[X++]=ie,W[X++]=re,W[X++]=K}return{vertices:q.buffer.slice(0),indices:W.buffer.slice(0),uses32bitIndices:O}}const an=new o.aJ({fill:new o.bi(128,2),line:new o.bi(512,0),tile:new o.bi(128,32),stencil:new o.bi(128,1),circle:3});class Pu{constructor(){this._tileMeshCache={},this._errorCorrectionUsable=0,this._errorMeasurementLastValue=0,this._errorCorrectionPreviousValue=0,this._errorMeasurementLastChangeTime=-1e3}get name(){return"vertical-perspective"}get transitionState(){return 1}get useSubdivision(){return!0}get shaderVariantName(){return"globe"}get shaderDefine(){return"#define GLOBE"}get shaderPreludeCode(){return nn.projectionGlobe}get vertexShaderPreludeCode(){return nn.projectionMercator.vertexSource}get subdivisionGranularity(){return an}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new Fa(e));const i=o.U(this._errorQueryLatitudeDegrees),s=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,l=this._errorMeasurement.updateErrorLoop(i,s),h=Ae.now();l!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=l,this._errorMeasurementLastChangeTime=h);const f=Math.min(Math.max((h-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=o.bj(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,o.bk(f))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,i,s,l,h){const f=(h==="stencil"?an.stencil:an.tile).getGranularityForZoomLevel(i.z);return this._getMesh(e,{granularity:f,generateBorders:s,extendToNorthPole:i.y===0&&l,extendToSouthPole:i.y===(1<<i.z)-1&&l})}_getMesh(e,i){const s=this._getMeshKey(i);if(s in this._tileMeshCache)return this._tileMeshCache[s];const l=function(h,f){const _=jl(f,"16bit"),x=o.aK.deserialize({arrayBuffer:_.vertices,length:_.vertices.byteLength/2/2}),T=o.aM.deserialize({arrayBuffer:_.indices,length:_.indices.byteLength/2/3});return new xn(h.createVertexBuffer(x,vn.members),h.createIndexBuffer(T),o.aL.simpleSegment(0,0,x.length,T.length))}(e,i);return this._tileMeshCache[s]=l,l}recalculate(e){}hasTransition(){const e=Ae.now();let i=!1;return i=i||(e-this._errorMeasurementLastChangeTime)/1e3<.7,i=i||this._errorMeasurement&&this._errorMeasurement.awaitingQuery,i}setErrorQueryLatitudeDegrees(e){this._errorQueryLatitudeDegrees=e}}const Mu=new o.r({type:new o.D(o.v.projection.type)});class Ps extends o.E{constructor(e){super(),this._transitionable=new o.t(Mu),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new o.F(0)),this._mercatorProjection=new Bl,this._verticalPerspectiveProjection=new Pu}get transitionState(){const e=this.properties.get("type");if(typeof e=="string"&&e==="mercator")return 0;if(typeof e=="string"&&e==="vertical-perspective")return 1;if(e instanceof o.bl){if(e.from==="vertical-perspective"&&e.to==="mercator")return 1-e.transition;if(e.from==="mercator"&&e.to==="vertical-perspective")return e.transition}return 1}get useGlobeRendering(){return this.transitionState>0}get latitudeErrorCorrectionRadians(){return this._verticalPerspectiveProjection.latitudeErrorCorrectionRadians}get currentProjection(){return this.useGlobeRendering?this._verticalPerspectiveProjection:this._mercatorProjection}get name(){return"globe"}get useSubdivision(){return this.currentProjection.useSubdivision}get shaderVariantName(){return this.currentProjection.shaderVariantName}get shaderDefine(){return this.currentProjection.shaderDefine}get shaderPreludeCode(){return this.currentProjection.shaderPreludeCode}get vertexShaderPreludeCode(){return this.currentProjection.vertexShaderPreludeCode}get subdivisionGranularity(){return this.currentProjection.subdivisionGranularity}get useGlobeControls(){return this.transitionState>0}destroy(){this._mercatorProjection.destroy(),this._verticalPerspectiveProjection.destroy()}updateGPUdependent(e){this._mercatorProjection.updateGPUdependent(e),this._verticalPerspectiveProjection.updateGPUdependent(e)}getMeshFromTileID(e,i,s,l,h){return this.currentProjection.getMeshFromTileID(e,i,s,l,h)}setProjection(e){this._transitionable.setValue("type",(e==null?void 0:e.type)||"mercator")}updateTransitions(e){this._transitioning=this._transitionable.transitioned(e,this._transitioning)}hasTransition(){return this._transitioning.hasTransition()||this.currentProjection.hasTransition()}recalculate(e){this.properties=this._transitioning.possiblyEvaluate(e)}setErrorQueryLatitudeDegrees(e){this._verticalPerspectiveProjection.setErrorQueryLatitudeDegrees(e),this._mercatorProjection.setErrorQueryLatitudeDegrees(e)}}function Ms(u){const e=Ba(u.worldSize,u.center.lat);return 2*Math.PI*e}function jr(u,e,i,s,l){const h=1/(1<<l),f=e/o.$*h+s*h,_=o.bn((u/o.$*h+i*h)*Math.PI*2+Math.PI,2*Math.PI),x=2*Math.atan(Math.exp(Math.PI-f*Math.PI*2))-.5*Math.PI,T=Math.cos(x),M=new Float64Array(3);return M[0]=Math.sin(_)*T,M[1]=Math.sin(x),M[2]=Math.cos(_)*T,M}function Si(u){return function(e,i){const s=Math.cos(i),l=new Float64Array(3);return l[0]=Math.sin(e)*s,l[1]=Math.sin(i),l[2]=Math.cos(e)*s,l}(u.lng*Math.PI/180,u.lat*Math.PI/180)}function Ba(u,e){return u/(2*Math.PI)/Math.cos(e*Math.PI/180)}function Cs(u){const e=Math.asin(u[1])/Math.PI*180,i=Math.sqrt(u[0]*u[0]+u[2]*u[2]);if(i>1e-6){const s=u[0]/i,l=Math.acos(u[2]/i),h=(s>0?l:-l)/Math.PI*180;return new o.S(o.aN(h,-180,180),e)}return new o.S(0,e)}function Oa(u){return Math.cos(u*Math.PI/180)}function fi(u,e){const i=Oa(u),s=Oa(e);return o.aj(s/i)}function Is(u,e){const i=u.rotate(e.bearingInRadians),s=e.zoom+fi(e.center.lat,0),l=o.bj(1/Oa(e.center.lat),1/Oa(Math.min(Math.abs(e.center.lat),60)),o.bm(s,7,3,0,1)),h=360/Ms({worldSize:e.worldSize,center:{lat:e.center.lat}});return new o.S(e.center.lng-i.x*h*l,o.ag(e.center.lat+i.y*h,-85.051129,o.ah))}function ja(u){const e=.5*u,i=Math.sin(e),s=Math.cos(e);return Math.log(i+s)-Math.log(s-i)}function Na(u,e,i,s){const l=u.lat+i*s;if(Math.abs(i)>1){const h=(Math.sign(u.lat+i)!==Math.sign(u.lat)?-Math.abs(u.lat):Math.abs(u.lat))*Math.PI/180,f=Math.abs(u.lat+i)*Math.PI/180,_=ja(h+s*(f-h)),x=ja(h),T=ja(f);return new o.S(u.lng+e*((_-x)/(T-x)),l)}return new o.S(u.lng+e*s,l)}class hd{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._boundingVolumeFactory=e}swapBuffers(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileBoundingVolume(e,i,s,l){const h=`${e.z}_${e.x}_${e.y}_${l!=null&&l.terrain?"t":""}`,f=this._cache.get(h);if(f)return f;const _=this._cachePrevious.get(h);if(_)return this._cache.set(h,_),_;const x=this._boundingVolumeFactory(e,i,s,l);return this._cache.set(h,x),this._hadAnyChanges=!0,x}}class On{constructor(e,i,s,l){this.min=s,this.max=l,this.points=e,this.planes=i}static fromAabb(e,i){const s=[];for(let l=0;l<8;l++)s.push([1&~l?e[0]:i[0],(l>>1&1)==1?i[1]:e[1],(l>>2&1)==1?i[2]:e[2]]);return new On(s,[[-1,0,0,i[0]],[1,0,0,-e[0]],[0,-1,0,i[1]],[0,1,0,-e[1]],[0,0,-1,i[2]],[0,0,1,-e[2]]],e,i)}static fromCenterSizeAngles(e,i,s){const l=o.bq([],s[0],s[1],s[2]),h=o.br([],[i[0],0,0],l),f=o.br([],[0,i[1],0],l),_=o.br([],[0,0,i[2]],l),x=[...e],T=[...e];for(let A=0;A<8;A++)for(let E=0;E<3;E++){const R=e[E]+h[E]*(1&~A?-1:1)+f[E]*((A>>1&1)==1?1:-1)+_[E]*((A>>2&1)==1?1:-1);x[E]=Math.min(x[E],R),T[E]=Math.max(T[E],R)}const M=[];for(let A=0;A<8;A++){const E=[...e];o.aR(E,E,o.aQ([],h,1&~A?-1:1)),o.aR(E,E,o.aQ([],f,(A>>1&1)==1?1:-1)),o.aR(E,E,o.aQ([],_,(A>>2&1)==1?1:-1)),M.push(E)}return new On(M,[[...h,-o.aW(h,M[0])],[...f,-o.aW(f,M[0])],[..._,-o.aW(_,M[0])],[-h[0],-h[1],-h[2],-o.aW(h,M[7])],[-f[0],-f[1],-f[2],-o.aW(f,M[7])],[-_[0],-_[1],-_[2],-o.aW(_,M[7])]],x,T)}intersectsFrustum(e){let i=!0;const s=this.points.length,l=this.planes.length,h=e.planes.length,f=e.points.length;for(let _=0;_<h;_++){const x=e.planes[_];let T=0;for(let M=0;M<s;M++){const A=this.points[M];x[0]*A[0]+x[1]*A[1]+x[2]*A[2]+x[3]>=0&&T++}if(T===0)return 0;T<s&&(i=!1)}if(i)return 2;for(let _=0;_<l;_++){const x=this.planes[_];let T=0;for(let M=0;M<f;M++){const A=e.points[M];x[0]*A[0]+x[1]*A[1]+x[2]*A[2]+x[3]>=0&&T++}if(T===0)return 0}return 1}intersectsPlane(e){const i=this.points.length;let s=0;for(let l=0;l<i;l++){const h=this.points[l];e[0]*h[0]+e[1]*h[1]+e[2]*h[2]+e[3]>=0&&s++}return s===i?2:s===0?0:1}}function Es(u,e,i){const s=u-e;return s<0?-s:Math.max(0,s-i)}function Nl(u,e,i,s,l){const h=u-i;let f;return f=h<0?Math.min(-h,1+h-l):h>1?Math.min(Math.max(h-l,0),1-h):0,Math.max(f,Es(e,s,l))}class dd{constructor(){this._boundingVolumeCache=new hd(this._computeTileBoundingVolume)}prepareNextFrame(){this._boundingVolumeCache.swapBuffers()}distanceToTile2d(e,i,s,l){const h=1<<s.z,f=1/h,_=s.x/h,x=s.y/h;let T=2;return T=Math.min(T,Nl(e,i,_,x,f)),T=Math.min(T,Nl(e,i,_+.5,-x-f,f)),T=Math.min(T,Nl(e,i,_+.5,2-x-f,f)),T}getWrap(e,i,s){const l=1<<i.z,h=1/l,f=i.x/l,_=Es(e.x,f,h),x=Es(e.x,f-1,h),T=Es(e.x,f+1,h),M=Math.min(_,x,T);return M===T?1:M===x?-1:0}allowVariableZoom(e,i){return Se(e,i)>4}allowWorldCopies(){return!1}getTileBoundingVolume(e,i,s,l){return this._boundingVolumeCache.getTileBoundingVolume(e,i,s,l)}_computeTileBoundingVolume(e,i,s,l){var h,f;let _=s,x=s;if(l!=null&&l.terrain){const T=new o.Z(e.z,i,e.z,e.x,e.y),M=l.terrain.getMinMaxElevation(T);_=(h=M.minElevation)!==null&&h!==void 0?h:s,x=(f=M.maxElevation)!==null&&f!==void 0?f:s}if(_/=o.bt,x/=o.bt,_+=1,x+=1,e.z<=0)return On.fromAabb([-x,-x,-x],[x,x,x]);if(e.z===1)return On.fromAabb([e.x===0?-x:0,e.y===0?0:-x,-x],[e.x===0?0:x,e.y===0?x:0,x]);{const T=[jr(0,0,e.x,e.y,e.z),jr(o.$,0,e.x,e.y,e.z),jr(o.$,o.$,e.x,e.y,e.z),jr(0,o.$,e.x,e.y,e.z)],M=[];for(const fe of T)M.push(o.aQ([],fe,x));if(x!==_)for(const fe of T)M.push(o.aQ([],fe,_));e.y===0&&M.push([0,1,0]),e.y===(1<<e.z)-1&&M.push([0,-1,0]);const A=[1,1,1],E=[-1,-1,-1];for(const fe of M)for(let xe=0;xe<3;xe++)A[xe]=Math.min(A[xe],fe[xe]),E[xe]=Math.max(E[xe],fe[xe]);const R=jr(o.$/2,o.$/2,e.x,e.y,e.z),O=o.aV([],[0,1,0],R);o.aU(O,O);const q=o.aV([],R,O);o.aU(q,q);const $=o.aV([],T[2],T[1]);o.aU($,$);const W=o.aV([],T[0],T[3]);o.aU(W,W),M.push(o.aQ([],R,x)),e.y>=(1<<e.z)/2&&M.push(o.aQ([],jr(o.$/2,0,e.x,e.y,e.z),x)),e.y<(1<<e.z)/2&&M.push(o.aQ([],jr(o.$/2,o.$,e.x,e.y,e.z),x));const X=Yi(R,M),ee=Yi(q,M),Y=[-R[0],-R[1],-R[2],X.max],ie=[R[0],R[1],R[2],-X.min],re=[-q[0],-q[1],-q[2],ee.max],K=[q[0],q[1],q[2],-ee.min],oe=[...$,0],_e=[...W,0],pe=[];return e.y===0?pe.push(o.bs(_e,oe,Y),o.bs(_e,oe,ie)):pe.push(o.bs(re,oe,Y),o.bs(re,oe,ie),o.bs(re,_e,Y),o.bs(re,_e,ie)),e.y===(1<<e.z)-1?pe.push(o.bs(_e,oe,Y),o.bs(_e,oe,ie)):pe.push(o.bs(K,oe,Y),o.bs(K,oe,ie),o.bs(K,_e,Y),o.bs(K,_e,ie)),new On(pe,[Y,ie,re,K,oe,_e],A,E)}}}function Yi(u,e){let i=1/0,s=-1/0;for(const l of e){const h=o.aW(u,l);i=Math.min(i,h),s=Math.max(s,h)}return{min:i,max:s}}class Va{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,s){return this._helper.interpolatePadding(e,i,s)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i){this._helper.resize(e,i)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}setTransitionState(e){}constructor(){this._cachedClippingPlane=o.bu(),this._projectionMatrix=o.b8(),this._globeViewProjMatrix32f=o.b7(),this._globeViewProjMatrixNoCorrection=o.b8(),this._globeViewProjMatrixNoCorrectionInverted=o.b8(),this._globeProjMatrixInverted=o.b8(),this._cameraPosition=o.bo(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new Ss({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._coveringTilesDetailsProvider=new dd}clone(){const e=new Va;return e.apply(this),e}apply(e,i){this._globeLatitudeErrorCorrectionRadians=i||0,this._helper.apply(e)}get projectionMatrix(){return this._projectionMatrix}get modelViewProjectionMatrix(){return this._globeViewProjMatrixNoCorrection}get inverseProjectionMatrix(){return this._globeProjMatrixInverted}get cameraPosition(){const e=o.bo();return e[0]=this._cameraPosition[0],e[1]=this._cameraPosition[1],e[2]=this._cameraPosition[2],e}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}getProjectionData(e){const{overscaledTileID:i,applyGlobeMatrix:s}=e,l=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:l,clippingPlane:this._cachedClippingPlane,projectionTransition:s?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const i=this.pitchInRadians,s=this.cameraToCenterDistance/e,l=Math.sin(i)*s,h=Math.cos(i)*s+1,f=1/Math.sqrt(l*l+h*h)*1;let _=-l,x=h;const T=Math.sqrt(_*_+x*x);_/=T,x/=T;const M=[0,_,x];o.bv(M,M,[0,0,0],-this.bearingInRadians),o.bw(M,M,[0,0,0],-1*this.center.lat*Math.PI/180),o.bx(M,M,[0,0,0],this.center.lng*Math.PI/180);const A=1/o.aY(M);return o.aQ(M,M,A),[...M,-f*A]}isLocationOccluded(e){return!this.isSurfacePointVisible(Si(e))}transformLightDirection(e){const i=this._helper._center.lng*Math.PI/180,s=this._helper._center.lat*Math.PI/180,l=Math.cos(s),h=[Math.sin(i)*l,Math.sin(s),Math.cos(i)*l],f=[h[2],0,-h[0]],_=[0,0,0];o.aV(_,f,h),o.aU(f,f),o.aU(_,_);const x=[0,0,0];return o.aU(x,[f[0]*e[0]+_[0]*e[1]+h[0]*e[2],f[1]*e[0]+_[1]*e[1]+h[1]*e[2],f[2]*e[0]+_[2]*e[1]+h[2]*e[2]]),x}getPixelScale(){return 1/Math.cos(this._helper._center.lat*Math.PI/180)}getCircleRadiusCorrection(){return Math.cos(this._helper._center.lat*Math.PI/180)}getPitchedTextCorrection(e,i,s){const l=function(_,x,T){const M=1/(1<<T.z);return new o.a0(_/o.$*M+T.x*M,x/o.$*M+T.y*M)}(e,i,s.canonical),h=(f=l.y,[o.bn(l.x*Math.PI*2+Math.PI,2*Math.PI),2*Math.atan(Math.exp(Math.PI-f*Math.PI*2))-.5*Math.PI]);var f;return this.getCircleRadiusCorrection()/Math.cos(h[1])}projectTileCoordinates(e,i,s,l){const h=s.canonical,f=jr(e,i,h.x,h.y,h.z),_=1+(l?l(e,i):0)/o.bt,x=[f[0]*_,f[1]*_,f[2]*_,1];o.av(x,x,this._globeViewProjMatrixNoCorrection);const T=this._cachedClippingPlane,M=T[0]*f[0]+T[1]*f[1]+T[2]*f[2]+T[3]<0;return{point:new o.P(x[0]/x[3],x[1]/x[3]),signedDistanceFromCamera:x[3],isOccluded:M}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const e=Ba(this.worldSize,this.center.lat),i=o.b9(),s=o.b9();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),o.b3(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const l=this.centerOffset;i[8]=2*-l.x/this._helper._width,i[9]=2*l.y/this._helper._height,this._projectionMatrix=o.b4(i),this._globeProjMatrixInverted=o.b9(),o.ap(this._globeProjMatrixInverted,i),o.M(i,i,[0,0,-this.cameraToCenterDistance]),o.b5(i,i,this.rollInRadians),o.b6(i,i,-this.pitchInRadians),o.b5(i,i,this.bearingInRadians),o.M(i,i,[0,0,-e]);const h=o.bo();h[0]=e,h[1]=e,h[2]=e,o.b6(s,i,this.center.lat*Math.PI/180),o.by(s,s,-this.center.lng*Math.PI/180),o.N(s,s,h),this._globeViewProjMatrixNoCorrection=s,o.b6(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),o.by(i,i,-this.center.lng*Math.PI/180),o.N(i,i,h),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=o.b9(),o.ap(this._globeViewProjMatrixNoCorrectionInverted,s);const f=o.bo();this._cameraPosition=o.bo(),this._cameraPosition[2]=this.cameraToCenterDistance/e,o.bv(this._cameraPosition,this._cameraPosition,f,-this.rollInRadians),o.bw(this._cameraPosition,this._cameraPosition,f,this.pitchInRadians),o.bv(this._cameraPosition,this._cameraPosition,f,-this.bearingInRadians),o.aR(this._cameraPosition,this._cameraPosition,[0,0,1]),o.bw(this._cameraPosition,this._cameraPosition,f,-this.center.lat*Math.PI/180),o.bx(this._cameraPosition,this._cameraPosition,f,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const _=o.b4(this._globeViewProjMatrixNoCorrectionInverted);o.N(_,_,[1,1,-1]),this._cachedFrustum=Vi.fromInvProjectionMatrix(_,1,0,this._cachedClippingPlane,!0)}calculateFogMatrix(e){o.w("calculateFogMatrix is not supported on globe projection.");const i=o.b9();return o.af(i),i}getVisibleUnwrappedCoordinates(e){return[new o.b1(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&o.w("terrain is not fully supported on vertical perspective projection."),this._helper.recalculateZoomAndCenter(0)}maxPitchScaleFactor(){return 1}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,i){if(!this._globeViewProjMatrixNoCorrection)return 1;const s=Si(e);o.aQ(s,s,1+i/o.bt);const l=o.bu();return o.av(l,[s[0],s[1],s[2],1],this._globeViewProjMatrixNoCorrection),l[2]/l[3]}populateCache(e){}getBounds(){const e=.5*this.width,i=.5*this.height,s=[new o.P(0,0),new o.P(e,0),new o.P(this.width,0),new o.P(this.width,i),new o.P(this.width,this.height),new o.P(e,this.height),new o.P(0,this.height),new o.P(0,i)],l=[];for(const A of s)l.push(this.unprojectScreenPoint(A));let h=0,f=0,_=0,x=0;const T=this.center;for(const A of l){const E=o.bz(T.lng,A.lng),R=o.bz(T.lat,A.lat);E<f&&(f=E),E>h&&(h=E),R<x&&(x=R),R>_&&(_=R)}const M=[T.lng+f,T.lat+x,T.lng+h,T.lat+_];return this.isSurfacePointOnScreen([0,1,0])&&(M[3]=90,M[0]=-180,M[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(M[1]=-90,M[0]=-180,M[2]=180),new ii(M)}getConstrained(e,i){const s=o.ag(e.lat,-85.051129,o.ah),l=o.ag(+i,this.minZoom+fi(0,s),this.maxZoom);return{center:new o.S(e.lng,s),zoom:l}}calculateCenterFromCameraLngLatAlt(e,i,s,l){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,s,l)}setLocationAtPoint(e,i){const s=Si(this.unprojectScreenPoint(i)),l=Si(e),h=o.bo();o.bA(h);const f=o.bo();o.bx(f,s,h,-this.center.lng*Math.PI/180),o.bw(f,f,h,this.center.lat*Math.PI/180);const _=l[0]*l[0]+l[2]*l[2],x=f[0]*f[0];if(_<x)return;const T=Math.sqrt(_-x),M=-T,A=o.bB(l[0],l[2],f[0],T),E=o.bB(l[0],l[2],f[0],M),R=o.bo();o.bx(R,l,h,-A);const O=o.bB(R[1],R[2],f[1],f[2]),q=o.bo();o.bx(q,l,h,-E);const $=o.bB(q[1],q[2],f[1],f[2]),W=.5*Math.PI,X=O>=-W&&O<=W,ee=$>=-W&&$<=W;let Y,ie;if(X&&ee){const _e=this.center.lng*Math.PI/180,pe=this.center.lat*Math.PI/180;o.bC(A,_e)+o.bC(O,pe)<o.bC(E,_e)+o.bC($,pe)?(Y=A,ie=O):(Y=E,ie=$)}else if(X)Y=A,ie=O;else{if(!ee)return;Y=E,ie=$}const re=Y/Math.PI*180,K=ie/Math.PI*180,oe=this.center.lat;this.setCenter(new o.S(re,o.ag(K,-90,90))),this.setZoom(this.zoom+fi(oe,this.center.lat))}locationToScreenPoint(e,i){const s=Si(e);if(i){const l=i.getElevationForLngLatZoom(e,this._helper._tileZoom);o.aQ(s,s,1+l/o.bt)}return this._projectSurfacePointToScreen(s)}_projectSurfacePointToScreen(e){const i=o.bu();return o.av(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new o.P((.5*i[0]+.5)*this.width,(.5*-i[1]+.5)*this.height)}screenPointToMercatorCoordinate(e,i){if(i){const s=i.pointCoordinate(e);if(s)return s}return o.a0.fromLngLat(this.unprojectScreenPoint(e))}screenPointToLocation(e,i){var s;return(s=this.screenPointToMercatorCoordinate(e,i))===null||s===void 0?void 0:s.toLngLat()}isPointOnMapSurface(e,i){const s=this._cameraPosition,l=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(s,l)}getRayDirectionFromPixel(e){const i=o.bu();i[0]=e.x/this.width*2-1,i[1]=-1*(e.y/this.height*2-1),i[2]=1,i[3]=1,o.av(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];const s=o.bo();s[0]=i[0]-this._cameraPosition[0],s[1]=i[1]-this._cameraPosition[1],s[2]=i[2]-this._cameraPosition[2];const l=o.bo();return o.aU(l,s),l}isSurfacePointVisible(e){const i=this._cachedClippingPlane;return i[0]*e[0]+i[1]*e[1]+i[2]*e[2]+i[3]>=0}isSurfacePointOnScreen(e){if(!this.isSurfacePointVisible(e))return!1;const i=o.bu();return o.av(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3],i[0]>-1&&i[0]<1&&i[1]>-1&&i[1]<1&&i[2]>-1&&i[2]<1}rayPlanetIntersection(e,i){const s=o.aW(e,i),l=o.bo(),h=o.bo();o.aQ(h,i,s),o.aT(l,e,h);const f=1-o.aW(l,l);if(f<0)return null;const _=o.aW(e,e)-1,x=-s+(s<0?1:-1)*Math.sqrt(f),T=_/x,M=x;return{tMin:Math.min(T,M),tMax:Math.max(T,M)}}unprojectScreenPoint(e){const i=this._cameraPosition,s=this.getRayDirectionFromPixel(e),l=this.rayPlanetIntersection(i,s);if(l){const M=o.bo();o.aR(M,i,[s[0]*l.tMin,s[1]*l.tMin,s[2]*l.tMin]);const A=o.bo();return o.aU(A,M),Cs(A)}const h=this._cachedClippingPlane,f=h[0]*s[0]+h[1]*s[1]+h[2]*s[2],_=-o.b0(h,i)/f,x=o.bo();if(_>0)o.aR(x,i,[s[0]*_,s[1]*_,s[2]*_]);else{const M=o.bo();o.aR(M,i,[2*s[0],2*s[1],2*s[2]]);const A=o.b0(this._cachedClippingPlane,M);o.aT(x,M,[this._cachedClippingPlane[0]*A,this._cachedClippingPlane[1]*A,this._cachedClippingPlane[2]*A])}const T=function(M){const A=o.bo();return A[0]=M[0]*-M[3],A[1]=M[1]*-M[3],A[2]=M[2]*-M[3],{center:A,radius:Math.sqrt(1-M[3]*M[3])}}(h);return Cs(function(M,A,E){const R=o.bo();o.aT(R,E,M);const O=o.bo();return o.bp(O,M,R,A/o.a_(R)),O}(T.center,T.radius,x))}getMatrixForModel(e,i){const s=o.S.convert(e),l=1/o.bt,h=o.b8();return o.by(h,h,s.lng/180*Math.PI),o.b6(h,h,-s.lat/180*Math.PI),o.M(h,h,[0,0,1+i/o.bt]),o.b6(h,h,.5*Math.PI),o.N(h,h,[l,l,l]),h}getProjectionDataForCustomLayer(e=!0){const i=this.getProjectionData({overscaledTileID:new o.Z(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class yr{get pixelsToClipSpaceMatrix(){return this._helper.pixelsToClipSpaceMatrix}get clipSpaceToPixelsMatrix(){return this._helper.clipSpaceToPixelsMatrix}get pixelsToGLUnits(){return this._helper.pixelsToGLUnits}get centerOffset(){return this._helper.centerOffset}get size(){return this._helper.size}get rotationMatrix(){return this._helper.rotationMatrix}get centerPoint(){return this._helper.centerPoint}get pixelsPerMeter(){return this._helper.pixelsPerMeter}setMinZoom(e){this._helper.setMinZoom(e)}setMaxZoom(e){this._helper.setMaxZoom(e)}setMinPitch(e){this._helper.setMinPitch(e)}setMaxPitch(e){this._helper.setMaxPitch(e)}setRenderWorldCopies(e){this._helper.setRenderWorldCopies(e)}setBearing(e){this._helper.setBearing(e)}setPitch(e){this._helper.setPitch(e)}setRoll(e){this._helper.setRoll(e)}setFov(e){this._helper.setFov(e)}setZoom(e){this._helper.setZoom(e)}setCenter(e){this._helper.setCenter(e)}setElevation(e){this._helper.setElevation(e)}setMinElevationForCurrentTile(e){this._helper.setMinElevationForCurrentTile(e)}setPadding(e){this._helper.setPadding(e)}interpolatePadding(e,i,s){return this._helper.interpolatePadding(e,i,s)}isPaddingEqual(e){return this._helper.isPaddingEqual(e)}resize(e,i,s=!0){this._helper.resize(e,i,s)}getMaxBounds(){return this._helper.getMaxBounds()}setMaxBounds(e){this._helper.setMaxBounds(e)}overrideNearFarZ(e,i){this._helper.overrideNearFarZ(e,i)}clearNearFarZOverride(){this._helper.clearNearFarZOverride()}getCameraQueryGeometry(e){return this._helper.getCameraQueryGeometry(this.getCameraPoint(),e)}get tileSize(){return this._helper.tileSize}get tileZoom(){return this._helper.tileZoom}get scale(){return this._helper.scale}get worldSize(){return this._helper.worldSize}get width(){return this._helper.width}get height(){return this._helper.height}get lngRange(){return this._helper.lngRange}get latRange(){return this._helper.latRange}get minZoom(){return this._helper.minZoom}get maxZoom(){return this._helper.maxZoom}get zoom(){return this._helper.zoom}get center(){return this._helper.center}get minPitch(){return this._helper.minPitch}get maxPitch(){return this._helper.maxPitch}get pitch(){return this._helper.pitch}get pitchInRadians(){return this._helper.pitchInRadians}get roll(){return this._helper.roll}get rollInRadians(){return this._helper.rollInRadians}get bearing(){return this._helper.bearing}get bearingInRadians(){return this._helper.bearingInRadians}get fov(){return this._helper.fov}get fovInRadians(){return this._helper.fovInRadians}get elevation(){return this._helper.elevation}get minElevationForCurrentTile(){return this._helper.minElevationForCurrentTile}get padding(){return this._helper.padding}get unmodified(){return this._helper.unmodified}get renderWorldCopies(){return this._helper.renderWorldCopies}get cameraToCenterDistance(){return this._helper.cameraToCenterDistance}get nearZ(){return this._helper.nearZ}get farZ(){return this._helper.farZ}get autoCalculateNearFarZ(){return this._helper.autoCalculateNearFarZ}get isGlobeRendering(){return this._globeness>0}setTransitionState(e,i){this._globeness=e,this._globeLatitudeErrorCorrectionRadians=i,this._calcMatrices(),this._verticalPerspectiveTransform.getCoveringTilesDetailsProvider().prepareNextFrame(),this._mercatorTransform.getCoveringTilesDetailsProvider().prepareNextFrame()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new Ss({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._globeness=1,this._mercatorTransform=new pi,this._verticalPerspectiveTransform=new Va}clone(){const e=new yr;return e._globeness=this._globeness,e._globeLatitudeErrorCorrectionRadians=this._globeLatitudeErrorCorrectionRadians,e.apply(this),e}apply(e){this._helper.apply(e),this._mercatorTransform.apply(this),this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians)}get projectionMatrix(){return this.currentTransform.projectionMatrix}get modelViewProjectionMatrix(){return this.currentTransform.modelViewProjectionMatrix}get inverseProjectionMatrix(){return this.currentTransform.inverseProjectionMatrix}get cameraPosition(){return this.currentTransform.cameraPosition}getProjectionData(e){const i=this._mercatorTransform.getProjectionData(e),s=this._verticalPerspectiveTransform.getProjectionData(e);return{mainMatrix:this.isGlobeRendering?s.mainMatrix:i.mainMatrix,clippingPlane:s.clippingPlane,tileMercatorCoords:s.tileMercatorCoords,projectionTransition:e.applyGlobeMatrix?this._globeness:0,fallbackMatrix:i.fallbackMatrix}}isLocationOccluded(e){return this.currentTransform.isLocationOccluded(e)}transformLightDirection(e){return this.currentTransform.transformLightDirection(e)}getPixelScale(){return o.bj(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return o.bj(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,i,s){const l=this._mercatorTransform.getPitchedTextCorrection(e,i,s),h=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,i,s);return o.bj(l,h,this._globeness)}projectTileCoordinates(e,i,s,l){return this.currentTransform.projectTileCoordinates(e,i,s,l)}_calcMatrices(){this._helper._width&&this._helper._height&&(this._verticalPerspectiveTransform.apply(this,this._globeLatitudeErrorCorrectionRadians),this._helper._nearZ=this._verticalPerspectiveTransform.nearZ,this._helper._farZ=this._verticalPerspectiveTransform.farZ,this._mercatorTransform.apply(this,!0,this.isGlobeRendering),this._helper._nearZ=this._mercatorTransform.nearZ,this._helper._farZ=this._mercatorTransform.farZ)}calculateFogMatrix(e){return this.currentTransform.calculateFogMatrix(e)}getVisibleUnwrappedCoordinates(e){return this.currentTransform.getVisibleUnwrappedCoordinates(e)}getCameraFrustum(){return this.currentTransform.getCameraFrustum()}getClippingPlane(){return this.currentTransform.getClippingPlane()}getCoveringTilesDetailsProvider(){return this.currentTransform.getCoveringTilesDetailsProvider()}recalculateZoomAndCenter(e){this._mercatorTransform.recalculateZoomAndCenter(e),this._verticalPerspectiveTransform.recalculateZoomAndCenter(e)}maxPitchScaleFactor(){return this._mercatorTransform.maxPitchScaleFactor()}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){return this._helper.getCameraLngLat()}lngLatToCameraDepth(e,i){return this.currentTransform.lngLatToCameraDepth(e,i)}populateCache(e){this._mercatorTransform.populateCache(e),this._verticalPerspectiveTransform.populateCache(e)}getBounds(){return this.currentTransform.getBounds()}getConstrained(e,i){return this.currentTransform.getConstrained(e,i)}calculateCenterFromCameraLngLatAlt(e,i,s,l){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,s,l)}setLocationAtPoint(e,i){if(!this.isGlobeRendering)return this._mercatorTransform.setLocationAtPoint(e,i),void this.apply(this._mercatorTransform);this._verticalPerspectiveTransform.setLocationAtPoint(e,i),this.apply(this._verticalPerspectiveTransform)}locationToScreenPoint(e,i){return this.currentTransform.locationToScreenPoint(e,i)}screenPointToMercatorCoordinate(e,i){return this.currentTransform.screenPointToMercatorCoordinate(e,i)}screenPointToLocation(e,i){return this.currentTransform.screenPointToLocation(e,i)}isPointOnMapSurface(e,i){return this.currentTransform.isPointOnMapSurface(e,i)}getRayDirectionFromPixel(e){return this._verticalPerspectiveTransform.getRayDirectionFromPixel(e)}getMatrixForModel(e,i){return this.currentTransform.getMatrixForModel(e,i)}getProjectionDataForCustomLayer(e=!0){const i=this._mercatorTransform.getProjectionDataForCustomLayer(e);if(!this.isGlobeRendering)return i;const s=this._verticalPerspectiveTransform.getProjectionDataForCustomLayer(e);return s.fallbackMatrix=i.mainMatrix,s}getFastPathSimpleProjectionMatrix(e){return this.currentTransform.getFastPathSimpleProjectionMatrix(e)}}class ar{get useGlobeControls(){return!0}handlePanInertia(e,i){const s=Is(e,i);return Math.abs(s.lng-i.center.lng)>180&&(s.lng=i.center.lng+179.5*Math.sign(s.lng-i.center.lng)),{easingCenter:s,easingOffset:new o.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,i){const s=e.around,l=i.screenPointToLocation(s);e.bearingDelta&&i.setBearing(i.bearing+e.bearingDelta),e.pitchDelta&&i.setPitch(i.pitch+e.pitchDelta),e.rollDelta&&i.setRoll(i.roll+e.rollDelta);const h=i.zoom;e.zoomDelta&&i.setZoom(i.zoom+e.zoomDelta);const f=i.zoom-h;if(f===0)return;const _=o.bz(i.center.lng,l.lng),x=_/(Math.abs(_/180)+1),T=o.bz(i.center.lat,l.lat),M=i.getRayDirectionFromPixel(s),A=i.cameraPosition,E=-1*o.aW(A,M),R=o.bo();o.aR(R,A,[M[0]*E,M[1]*E,M[2]*E]);const O=o.aY(R)-1,q=Math.exp(.5*-Math.max(O-.3,0)),$=Ba(i.worldSize,i.center.lat)/Math.min(i.width,i.height),W=o.bm($,.9,.5,1,.25),X=(1-o.ae(-f))*Math.min(q,W),ee=i.center.lat,Y=i.zoom,ie=new o.S(i.center.lng+x*X,o.ag(i.center.lat+T*X,-85.051129,o.ah));i.setLocationAtPoint(l,s);const re=i.center,K=o.bm(Math.abs(_),45,85,0,1),oe=o.bm($,.75,.35,0,1),_e=Math.pow(Math.max(K,oe),.25),pe=o.bz(re.lng,ie.lng),fe=o.bz(re.lat,ie.lat);i.setCenter(new o.S(re.lng+pe*_e,re.lat+fe*_e).wrap()),i.setZoom(Y+fi(ee,i.center.lat))}handleMapControlsPan(e,i,s){if(!e.panDelta)return;const l=i.center.lat,h=i.zoom;i.setCenter(Is(e.panDelta,i).wrap()),i.setZoom(h+fi(l,i.center.lat))}cameraForBoxAndBearing(e,i,s,l,h){const f=Yt(e,i,s,l,h),_=i.left/h.width*2-1,x=(h.width-i.right)/h.width*2-1,T=i.top/h.height*-2+1,M=(h.height-i.bottom)/h.height*-2+1,A=o.bz(s.getWest(),s.getEast())<0,E=A?s.getEast():s.getWest(),R=A?s.getWest():s.getEast(),O=Math.max(s.getNorth(),s.getSouth()),q=Math.min(s.getNorth(),s.getSouth()),$=E+.5*o.bz(E,R),W=O+.5*o.bz(O,q),X=h.clone();X.setCenter(f.center),X.setBearing(f.bearing),X.setPitch(0),X.setRoll(0),X.setZoom(f.zoom);const ee=X.modelViewProjectionMatrix,Y=[Si(s.getNorthWest()),Si(s.getNorthEast()),Si(s.getSouthWest()),Si(s.getSouthEast()),Si(new o.S(R,W)),Si(new o.S(E,W)),Si(new o.S($,O)),Si(new o.S($,q))],ie=Si(f.center);let re=Number.POSITIVE_INFINITY;for(const K of Y)_<0&&(re=ar.getLesserNonNegativeNonNull(re,ar.solveVectorScale(K,ie,ee,"x",_))),x>0&&(re=ar.getLesserNonNegativeNonNull(re,ar.solveVectorScale(K,ie,ee,"x",x))),T>0&&(re=ar.getLesserNonNegativeNonNull(re,ar.solveVectorScale(K,ie,ee,"y",T))),M<0&&(re=ar.getLesserNonNegativeNonNull(re,ar.solveVectorScale(K,ie,ee,"y",M)));if(Number.isFinite(re)&&re!==0)return f.zoom=X.zoom+o.aj(re),f;Zi()}handleJumpToCenterZoom(e,i){const s=e.center.lat,l=e.getConstrained(i.center?o.S.convert(i.center):e.center,e.zoom).center;e.setCenter(l.wrap());const h=i.zoom!==void 0?+i.zoom:e.zoom+fi(s,l.lat);e.zoom!==h&&e.setZoom(h)}handleEaseTo(e,i){const s=e.zoom,l=e.center,h=e.padding,f={roll:e.roll,pitch:e.pitch,bearing:e.bearing},_={roll:i.roll===void 0?e.roll:i.roll,pitch:i.pitch===void 0?e.pitch:i.pitch,bearing:i.bearing===void 0?e.bearing:i.bearing},x=i.zoom!==void 0,T=!e.isPaddingEqual(i.padding);let M=!1;const A=i.center?o.S.convert(i.center):l,E=e.getConstrained(A,s).center;bn(e,E);const R=e.clone();R.setCenter(E),R.setZoom(x?+i.zoom:s+fi(l.lat,A.lat)),R.setBearing(i.bearing);const O=new o.P(o.ag(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),o.ag(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));R.setLocationAtPoint(E,O);const q=(i.offset&&i.offsetAsPoint.mag())>0?R.center:E,$=x?+i.zoom:s+fi(l.lat,q.lat),W=s+fi(l.lat,0),X=$+fi(q.lat,0),ee=o.bz(l.lng,q.lng),Y=o.bz(l.lat,q.lat),ie=o.ae(X-W);return M=$!==s,{easeFunc:re=>{if(o.bd(f,_)||Ti({startEulerAngles:f,endEulerAngles:_,tr:e,k:re,useSlerp:f.roll!=_.roll}),T&&e.interpolatePadding(h,i.padding,re),i.around)o.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{const K=X>W?Math.min(2,ie):Math.max(.5,ie),oe=Math.pow(K,1-re),_e=Na(l,ee,Y,re*oe);e.setCenter(_e.wrap())}if(M){const K=o.C.number(W,X,re)+fi(0,e.center.lat);e.setZoom(K)}},isZooming:M,elevationCenter:q}}handleFlyTo(e,i){const s=i.zoom!==void 0,l=e.center,h=e.zoom,f=e.padding,_=!e.isPaddingEqual(i.padding),x=e.getConstrained(o.S.convert(i.center||i.locationAtOffset),h).center,T=s?+i.zoom:e.zoom+fi(e.center.lat,x.lat),M=e.clone();M.setCenter(x),M.setZoom(T),M.setBearing(i.bearing);const A=new o.P(o.ag(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),o.ag(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));M.setLocationAtPoint(x,A);const E=M.center;bn(e,E);const R=function(Y,ie,re){const K=Si(ie),oe=Si(re),_e=o.aW(K,oe),pe=Math.acos(_e),fe=Ms(Y);return pe/(2*Math.PI)*fe}(e,l,E),O=h+fi(l.lat,0),q=T+fi(E.lat,0),$=o.ae(q-O);let W;if(typeof i.minZoom=="number"){const Y=+i.minZoom+fi(E.lat,0),ie=Math.min(Y,O,q)+fi(0,E.lat),re=e.getConstrained(E,ie).zoom+fi(E.lat,0);W=o.ae(re-O)}const X=o.bz(l.lng,E.lng),ee=o.bz(l.lat,E.lat);return{easeFunc:(Y,ie,re,K)=>{const oe=Na(l,X,ee,re);_&&e.interpolatePadding(f,i.padding,Y);const _e=Y===1?E:oe;e.setCenter(_e.wrap());const pe=O+o.aj(ie);e.setZoom(Y===1?T:pe+fi(0,_e.lat))},scaleOfZoom:$,targetCenter:E,scaleOfMinZoom:W,pixelPathLength:R}}static solveVectorScale(e,i,s,l,h){const f=l==="x"?[s[0],s[4],s[8],s[12]]:[s[1],s[5],s[9],s[13]],_=[s[3],s[7],s[11],s[15]],x=e[0]*f[0]+e[1]*f[1]+e[2]*f[2],T=e[0]*_[0]+e[1]*_[1]+e[2]*_[2],M=i[0]*f[0]+i[1]*f[1]+i[2]*f[2],A=i[0]*_[0]+i[1]*_[1]+i[2]*_[2];return M+h*T===x+h*A||_[3]*(x-M)+f[3]*(A-T)+x*A==M*T?null:(M+f[3]-h*A-h*_[3])/(M-x-h*A+h*T)}static getLesserNonNegativeNonNull(e,i){return i!==null&&i>=0&&i<e?i:e}}class Vl{constructor(e){this._globe=e,this._mercatorCameraHelper=new ko,this._verticalPerspectiveCameraHelper=new ar}get useGlobeControls(){return this._globe.useGlobeRendering}get currentHelper(){return this.useGlobeControls?this._verticalPerspectiveCameraHelper:this._mercatorCameraHelper}handlePanInertia(e,i){return this.currentHelper.handlePanInertia(e,i)}handleMapControlsRollPitchBearingZoom(e,i){return this.currentHelper.handleMapControlsRollPitchBearingZoom(e,i)}handleMapControlsPan(e,i,s){this.currentHelper.handleMapControlsPan(e,i,s)}cameraForBoxAndBearing(e,i,s,l,h){return this.currentHelper.cameraForBoxAndBearing(e,i,s,l,h)}handleJumpToCenterZoom(e,i){this.currentHelper.handleJumpToCenterZoom(e,i)}handleEaseTo(e,i){return this.currentHelper.handleEaseTo(e,i)}handleFlyTo(e,i){return this.currentHelper.handleFlyTo(e,i)}}const As=(u,e)=>o.y(u,e&&e.filter(i=>i.identifier!=="source.canvas")),Za=o.bD();class Zl extends o.E{constructor(e,i={}){super(),this._rtlPluginLoaded=()=>{for(const s in this.sourceCaches){const l=this.sourceCaches[s].getSource().type;l!=="vector"&&l!=="geojson"||this.sourceCaches[s].reload()}},this.map=e,this.dispatcher=new Br(Qr(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(s,l)=>this.getGlyphs(s,l)),this.dispatcher.registerMessageHandler("GI",(s,l)=>this.getImages(s,l)),this.imageManager=new dn,this.imageManager.setEventedParent(this),this.glyphManager=new qi(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new tr(256,512),this.crossTileSymbolIndex=new Eo,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new o.bE,this._loaded=!1,this._availableImages=[],this._globalState={},this._resetUpdates(),this.dispatcher.broadcast("SR",o.bF()),mr().on(fn,this._rtlPluginLoaded),this.on("data",s=>{if(s.dataType!=="source"||s.sourceDataType!=="metadata")return;const l=this.sourceCaches[s.sourceId];if(!l)return;const h=l.getSource();if(h&&h.vectorLayerIds)for(const f in this._layers){const _=this._layers[f];_.source===h.id&&this._validateLayer(_)}})}setGlobalStateProperty(e,i){var s,l,h;this._checkLoaded();const f=i===null?(h=(l=(s=this.stylesheet.state)===null||s===void 0?void 0:s[e])===null||l===void 0?void 0:l.default)!==null&&h!==void 0?h:null:i;if(o.bG(f,this._globalState[e]))return this;this._globalState[e]=f;const _=this._findGlobalStateAffectedSources([e]);for(const x in this.sourceCaches)_.has(x)&&(this._reloadSource(x),this._changed=!0)}getGlobalState(){return this._globalState}setGlobalState(e){this._checkLoaded();const i=[];for(const l in e)!o.bG(this._globalState[l],e[l].default)&&(i.push(l),this._globalState[l]=e[l].default);const s=this._findGlobalStateAffectedSources(i);for(const l in this.sourceCaches)s.has(l)&&(this._reloadSource(l),this._changed=!0)}_findGlobalStateAffectedSources(e){if(e.length===0)return new Set;const i=new Set;for(const s in this._layers){const l=this._layers[s],h=l.getLayoutAffectingGlobalStateRefs();for(const f of e)h.has(f)&&i.add(l.source)}return i}loadURL(e,i={},s){this.fire(new o.l("dataloading",{dataType:"style"})),i.validate=typeof i.validate!="boolean"||i.validate;const l=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const h=this._loadStyleRequest;o.j(l,this._loadStyleRequest).then(f=>{this._loadStyleRequest=null,this._load(f.data,i,s)}).catch(f=>{this._loadStyleRequest=null,f&&!h.signal.aborted&&this.fire(new o.k(f))})}loadJSON(e,i={},s){this.fire(new o.l("dataloading",{dataType:"style"})),this._frameRequest=new AbortController,Ae.frameAsync(this._frameRequest).then(()=>{this._frameRequest=null,i.validate=i.validate!==!1,this._load(e,i,s)}).catch(()=>{})}loadEmpty(){this.fire(new o.l("dataloading",{dataType:"style"})),this._load(Za,{validate:!1})}_load(e,i,s){var l,h,f;const _=i.transformStyle?i.transformStyle(s,e):e;if(!i.validate||!As(this,o.z(_))){this._loaded=!0,this.stylesheet=_;for(const x in _.sources)this.addSource(x,_.sources[x],{validate:!1});_.sprite?this._loadSprite(_.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(_.glyphs),this._createLayers(),this.light=new St(this.stylesheet.light),this._setProjectionInternal(((l=this.stylesheet.projection)===null||l===void 0?void 0:l.type)||"mercator"),this.sky=new Lr(this.stylesheet.sky),this.map.setTerrain((h=this.stylesheet.terrain)!==null&&h!==void 0?h:null),this.setGlobalState((f=this.stylesheet.state)!==null&&f!==void 0?f:null),this.fire(new o.l("data",{dataType:"style"})),this.fire(new o.l("style.load"))}}_createLayers(){const e=o.bH(this.stylesheet.layers);this.dispatcher.broadcast("SL",e),this._order=e.map(i=>i.id),this._layers={},this._serializedLayers=null;for(const i of e){const s=o.bI(i);s.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=s}}_loadSprite(e,i=!1,s=void 0){let l;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(h,f,_,x){return o._(this,void 0,void 0,function*(){const T=jt(h),M=_>1?"@2x":"",A={},E={};for(const{id:R,url:O}of T){const q=f.transformRequest(hr(O,M,".json"),"SpriteJSON");A[R]=o.j(q,x);const $=f.transformRequest(hr(O,M,".png"),"SpriteImage");E[R]=li.getImage($,x)}return yield Promise.all([...Object.values(A),...Object.values(E)]),function(R,O){return o._(this,void 0,void 0,function*(){const q={};for(const $ in R){q[$]={};const W=Ae.getImageCanvasContext((yield O[$]).data),X=(yield R[$]).data;for(const ee in X){const{width:Y,height:ie,x:re,y:K,sdf:oe,pixelRatio:_e,stretchX:pe,stretchY:fe,content:xe,textFitWidth:Fe,textFitHeight:Le}=X[ee];q[$][ee]={data:null,pixelRatio:_e,sdf:oe,stretchX:pe,stretchY:fe,content:xe,textFitWidth:Fe,textFitHeight:Le,spriteData:{width:Y,height:ie,x:re,y:K,context:W}}}}return q})}(A,E)})}(e,this.map._requestManager,this.map.getPixelRatio(),this._spriteRequest).then(h=>{if(this._spriteRequest=null,h)for(const f in h){this._spritesImagesIds[f]=[];const _=this._spritesImagesIds[f]?this._spritesImagesIds[f].filter(x=>!(x in h)):[];for(const x of _)this.imageManager.removeImage(x),this._changedImages[x]=!0;for(const x in h[f]){const T=f==="default"?x:`${f}:${x}`;this._spritesImagesIds[f].push(T),T in this.imageManager.images?this.imageManager.updateImage(T,h[f][x],!1):this.imageManager.addImage(T,h[f][x]),i&&(this._changedImages[T]=!0)}}}).catch(h=>{this._spriteRequest=null,l=h,this.fire(new o.k(l))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new o.l("data",{dataType:"style"})),s&&s(l)})}_unloadSprite(){for(const e of Object.values(this._spritesImagesIds).flat())this.imageManager.removeImage(e),this._changedImages[e]=!0;this._spritesImagesIds={},this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new o.l("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const s=e.sourceLayer;if(!s)return;const l=i.getSource();(l.type==="geojson"||l.vectorLayerIds&&l.vectorLayerIds.indexOf(s)===-1)&&this.fire(new o.k(new Error(`Source layer "${s}" does not exist on source "${l.id}" as specified by style layer "${e.id}".`)))}loaded(){if(!this._loaded||Object.keys(this._updatedSources).length)return!1;for(const e in this.sourceCaches)if(!this.sourceCaches[e].loaded())return!1;return!!this.imageManager.isLoaded()}_serializeByIds(e,i=!1){const s=this._serializedAllLayers();if(!e||e.length===0)return Object.values(i?o.bJ(s):s);const l=[];for(const h of e)if(s[h]){const f=i?o.bJ(s[h]):s[h];l.push(f)}return l}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const i=Object.keys(this._layers);for(const s of i){const l=this._layers[s];l.type!=="custom"&&(e[s]=l.serialize())}return e}hasTransitions(){var e,i,s;if(!((e=this.light)===null||e===void 0)&&e.hasTransition()||!((i=this.sky)===null||i===void 0)&&i.hasTransition()||!((s=this.projection)===null||s===void 0)&&s.hasTransition())return!0;for(const l in this.sourceCaches)if(this.sourceCaches[l].hasTransition())return!0;for(const l in this._layers)if(this._layers[l].hasTransition())return!0;return!1}_checkLoaded(){if(!this._loaded)throw new Error("Style is not done loading.")}update(e){if(!this._loaded)return;const i=this._changed;if(i){const l=Object.keys(this._updatedLayers),h=Object.keys(this._removedLayers);(l.length||h.length)&&this._updateWorkerLayers(l,h);for(const f in this._updatedSources){const _=this._updatedSources[f];if(_==="reload")this._reloadSource(f);else{if(_!=="clear")throw new Error(`Invalid action ${_}`);this._clearSource(f)}}this._updateTilesForChangedImages(),this._updateTilesForChangedGlyphs();for(const f in this._updatedPaintProps)this._layers[f].updateTransitions(e);this.light.updateTransitions(e),this.sky.updateTransitions(e),this._resetUpdates()}const s={};for(const l in this.sourceCaches){const h=this.sourceCaches[l];s[l]=h.used,h.used=!1}for(const l of this._order){const h=this._layers[l];h.recalculate(e,this._availableImages),!h.isHidden(e.zoom)&&h.source&&(this.sourceCaches[h.source].used=!0)}for(const l in s){const h=this.sourceCaches[l];!!s[l]!=!!h.used&&h.fire(new o.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:l}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,i&&this.fire(new o.l("data",{dataType:"style"}))}_updateTilesForChangedImages(){const e=Object.keys(this._changedImages);if(e.length){for(const i in this.sourceCaches)this.sourceCaches[i].reloadTilesForDependencies(["icons","patterns"],e);this._changedImages={}}}_updateTilesForChangedGlyphs(){if(this._glyphsDidChange){for(const e in this.sourceCaches)this.sourceCaches[e].reloadTilesForDependencies(["glyphs"],[""]);this._glyphsDidChange=!1}}_updateWorkerLayers(e,i){this.dispatcher.broadcast("UL",{layers:this._serializeByIds(e,!1),removedIds:i})}_resetUpdates(){this._changed=!1,this._updatedLayers={},this._removedLayers={},this._updatedSources={},this._updatedPaintProps={},this._changedImages={},this._glyphsDidChange=!1}setState(e,i={}){var s;this._checkLoaded();const l=this.serialize();if(e=i.transformStyle?i.transformStyle(l,e):e,((s=i.validate)===null||s===void 0||s)&&As(this,o.z(e)))return!1;(e=o.bJ(e)).layers=o.bH(e.layers);const h=o.bK(l,e),f=this._getOperationsToPerform(h);if(f.unimplemented.length>0)throw new Error(`Unimplemented: ${f.unimplemented.join(", ")}.`);if(f.operations.length===0)return!1;for(const _ of f.operations)_();return this.stylesheet=e,this._serializedLayers=null,!0}_getOperationsToPerform(e){const i=[],s=[];for(const l of e)switch(l.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":i.push(()=>this.addLayer.apply(this,l.args));break;case"removeLayer":i.push(()=>this.removeLayer.apply(this,l.args));break;case"setPaintProperty":i.push(()=>this.setPaintProperty.apply(this,l.args));break;case"setLayoutProperty":i.push(()=>this.setLayoutProperty.apply(this,l.args));break;case"setFilter":i.push(()=>this.setFilter.apply(this,l.args));break;case"addSource":i.push(()=>this.addSource.apply(this,l.args));break;case"removeSource":i.push(()=>this.removeSource.apply(this,l.args));break;case"setLayerZoomRange":i.push(()=>this.setLayerZoomRange.apply(this,l.args));break;case"setLight":i.push(()=>this.setLight.apply(this,l.args));break;case"setGeoJSONSourceData":i.push(()=>this.setGeoJSONSourceData.apply(this,l.args));break;case"setGlyphs":i.push(()=>this.setGlyphs.apply(this,l.args));break;case"setSprite":i.push(()=>this.setSprite.apply(this,l.args));break;case"setTerrain":i.push(()=>this.map.setTerrain.apply(this,l.args));break;case"setSky":i.push(()=>this.setSky.apply(this,l.args));break;case"setProjection":this.setProjection.apply(this,l.args);break;case"setGlobalState":i.push(()=>this.setGlobalState.apply(this,l.args));break;case"setTransition":i.push(()=>{});break;default:s.push(l.command)}return{operations:i,unimplemented:s}}addImage(e,i){if(this.getImage(e))return this.fire(new o.k(new Error(`An image named "${e}" already exists.`)));this.imageManager.addImage(e,i),this._afterImageUpdated(e)}updateImage(e,i){this.imageManager.updateImage(e,i)}getImage(e){return this.imageManager.getImage(e)}removeImage(e){if(!this.getImage(e))return this.fire(new o.k(new Error(`An image named "${e}" does not exist.`)));this.imageManager.removeImage(e),this._afterImageUpdated(e)}_afterImageUpdated(e){this._availableImages=this.imageManager.listImages(),this._changedImages[e]=!0,this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new o.l("data",{dataType:"style"}))}listImages(){return this._checkLoaded(),this.imageManager.listImages()}addSource(e,i,s={}){if(this._checkLoaded(),this.sourceCaches[e]!==void 0)throw new Error(`Source "${e}" already exists.`);if(!i.type)throw new Error(`The type property must be defined, but only the following properties were given: ${Object.keys(i).join(", ")}.`);if(["vector","raster","geojson","video","image"].indexOf(i.type)>=0&&this._validate(o.z.source,`sources.${e}`,i,null,s))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const l=this.sourceCaches[e]=new Me(e,i,this.dispatcher);l.style=this,l.setEventedParent(this,()=>({isSourceLoaded:l.loaded(),source:l.serialize(),sourceId:e})),l.onAdd(this.map),this._changed=!0}removeSource(e){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error("There is no source with this ID");for(const s in this._layers)if(this._layers[s].source===e)return this.fire(new o.k(new Error(`Source "${e}" cannot be removed while layer "${s}" is using it.`)));const i=this.sourceCaches[e];delete this.sourceCaches[e],delete this._updatedSources[e],i.fire(new o.l("data",{sourceDataType:"metadata",dataType:"source",sourceId:e})),i.setEventedParent(null),i.onRemove(this.map),this._changed=!0}setGeoJSONSourceData(e,i){if(this._checkLoaded(),this.sourceCaches[e]===void 0)throw new Error(`There is no source with this ID=${e}`);const s=this.sourceCaches[e].getSource();if(s.type!=="geojson")throw new Error(`geojsonSource.type is ${s.type}, which is !== 'geojson`);s.setData(i),this._changed=!0}getSource(e){return this.sourceCaches[e]&&this.sourceCaches[e].getSource()}addLayer(e,i,s={}){this._checkLoaded();const l=e.id;if(this.getLayer(l))return void this.fire(new o.k(new Error(`Layer "${l}" already exists on this map.`)));let h;if(e.type==="custom"){if(As(this,o.bL(e)))return;h=o.bI(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(l,e.source),e=o.bJ(e),e=o.e(e,{source:l})),this._validate(o.z.layer,`layers.${l}`,e,{arrayIndex:-1},s))return;h=o.bI(e),this._validateLayer(h),h.setEventedParent(this,{layer:{id:l}})}const f=i?this._order.indexOf(i):this._order.length;if(i&&f===-1)this.fire(new o.k(new Error(`Cannot add layer "${l}" before non-existing layer "${i}".`)));else{if(this._order.splice(f,0,l),this._layerOrderChanged=!0,this._layers[l]=h,this._removedLayers[l]&&h.source&&h.type!=="custom"){const _=this._removedLayers[l];delete this._removedLayers[l],_.type!==h.type?this._updatedSources[h.source]="clear":(this._updatedSources[h.source]="reload",this.sourceCaches[h.source].pause())}this._updateLayer(h),h.onAdd&&h.onAdd(this.map)}}moveLayer(e,i){if(this._checkLoaded(),this._changed=!0,!this._layers[e])return void this.fire(new o.k(new Error(`The layer '${e}' does not exist in the map's style and cannot be moved.`)));if(e===i)return;const s=this._order.indexOf(e);this._order.splice(s,1);const l=i?this._order.indexOf(i):this._order.length;i&&l===-1?this.fire(new o.k(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(l,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new o.k(new Error(`Cannot remove non-existing layer "${e}".`)));i.setEventedParent(null);const s=this._order.indexOf(e);this._order.splice(s,1),this._layerOrderChanged=!0,this._changed=!0,this._removedLayers[e]=i,delete this._layers[e],this._serializedLayers&&delete this._serializedLayers[e],delete this._updatedLayers[e],delete this._updatedPaintProps[e],i.onRemove&&i.onRemove(this.map)}getLayer(e){return this._layers[e]}getLayersOrder(){return[...this._order]}hasLayer(e){return e in this._layers}setLayerZoomRange(e,i,s){this._checkLoaded();const l=this.getLayer(e);l?l.minzoom===i&&l.maxzoom===s||(i!=null&&(l.minzoom=i),s!=null&&(l.maxzoom=s),this._updateLayer(l)):this.fire(new o.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,s={}){this._checkLoaded();const l=this.getLayer(e);if(l){if(!o.bG(l.filter,i))return i==null?(l.setFilter(void 0),void this._updateLayer(l)):void(this._validate(o.z.filter,`layers.${l.id}.filter`,i,null,s)||(l.setFilter(o.bJ(i)),this._updateLayer(l)))}else this.fire(new o.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return o.bJ(this.getLayer(e).filter)}setLayoutProperty(e,i,s,l={}){this._checkLoaded();const h=this.getLayer(e);h?o.bG(h.getLayoutProperty(i),s)||(h.setLayoutProperty(i,s,l),this._updateLayer(h)):this.fire(new o.k(new Error(`Cannot style non-existing layer "${e}".`)))}getLayoutProperty(e,i){const s=this.getLayer(e);if(s)return s.getLayoutProperty(i);this.fire(new o.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,s,l={}){this._checkLoaded();const h=this.getLayer(e);h?o.bG(h.getPaintProperty(i),s)||(h.setPaintProperty(i,s,l)&&this._updateLayer(h),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new o.k(new Error(`Cannot style non-existing layer "${e}".`)))}getPaintProperty(e,i){return this.getLayer(e).getPaintProperty(i)}setFeatureState(e,i){this._checkLoaded();const s=e.source,l=e.sourceLayer,h=this.sourceCaches[s];if(h===void 0)return void this.fire(new o.k(new Error(`The source '${s}' does not exist in the map's style.`)));const f=h.getSource().type;f==="geojson"&&l?this.fire(new o.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||l?(e.id===void 0&&this.fire(new o.k(new Error("The feature id parameter must be provided."))),h.setFeatureState(l,e.id,i)):this.fire(new o.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const s=e.source,l=this.sourceCaches[s];if(l===void 0)return void this.fire(new o.k(new Error(`The source '${s}' does not exist in the map's style.`)));const h=l.getSource().type,f=h==="vector"?e.sourceLayer:void 0;h!=="vector"||f?i&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new o.k(new Error("A feature id is required to remove its specific state property."))):l.removeFeatureState(f,e.id,i):this.fire(new o.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,s=e.sourceLayer,l=this.sourceCaches[i];if(l!==void 0)return l.getSource().type!=="vector"||s?(e.id===void 0&&this.fire(new o.k(new Error("The feature id parameter must be provided."))),l.getFeatureState(s,e.id)):void this.fire(new o.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new o.k(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return o.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=o.bM(this.sourceCaches,h=>h.serialize()),i=this._serializeByIds(this._order,!0),s=this.map.getTerrain()||void 0,l=this.stylesheet;return o.bN({version:l.version,name:l.name,metadata:l.metadata,light:l.light,sky:l.sky,center:l.center,zoom:l.zoom,bearing:l.bearing,pitch:l.pitch,sprite:l.sprite,glyphs:l.glyphs,transition:l.transition,projection:l.projection,sources:e,layers:i,terrain:s},h=>h!==void 0)}_updateLayer(e){this._updatedLayers[e.id]=!0,e.source&&!this._updatedSources[e.source]&&this.sourceCaches[e.source].getSource().type!=="raster"&&(this._updatedSources[e.source]="reload",this.sourceCaches[e.source].pause()),this._serializedLayers=null,this._changed=!0}_flattenAndSortRenderedFeatures(e){const i=f=>this._layers[f].type==="fill-extrusion",s={},l=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(i(_)){s[_]=f;for(const x of e){const T=x[_];if(T)for(const M of T)l.push(M)}}}l.sort((f,_)=>_.intersectionZ-f.intersectionZ);const h=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(i(_))for(let x=l.length-1;x>=0;x--){const T=l[x].feature;if(s[T.layer.id]<f)break;h.push(T),l.pop()}else for(const x of e){const T=x[_];if(T)for(const M of T)h.push(M.feature)}}return h}queryRenderedFeatures(e,i,s){i&&i.filter&&this._validate(o.z.filter,"queryRenderedFeatures.filter",i.filter,null,i);const l={};if(i&&i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new o.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const T of i.layers){const M=this._layers[T];if(!M)return this.fire(new o.k(new Error(`The layer '${T}' does not exist in the map's style and cannot be queried for features.`))),[];l[M.source]=!0}}const h=[];i.availableImages=this._availableImages;const f=this._serializedAllLayers(),_=i.layers instanceof Set?i.layers:Array.isArray(i.layers)?new Set(i.layers):null,x=Object.assign(Object.assign({},i),{layers:_});for(const T in this.sourceCaches)i.layers&&!l[T]||h.push(ci(this.sourceCaches[T],this._layers,f,e,x,s,this.map.terrain?(M,A,E)=>this.map.terrain.getElevation(M,A,E):void 0));return this.placement&&h.push(function(T,M,A,E,R,O,q){const $={},W=O.queryRenderedSymbols(E),X=[];for(const ee of Object.keys(W).map(Number))X.push(q[ee]);X.sort(Dn);for(const ee of X){const Y=ee.featureIndex.lookupSymbolFeatures(W[ee.bucketInstanceId],M,ee.bucketIndex,ee.sourceLayerIndex,R.filter,R.layers,R.availableImages,T);for(const ie in Y){const re=$[ie]=$[ie]||[],K=Y[ie];K.sort((oe,_e)=>{const pe=ee.featureSortOrder;if(pe){const fe=pe.indexOf(oe.featureIndex);return pe.indexOf(_e.featureIndex)-fe}return _e.featureIndex-oe.featureIndex});for(const oe of K)re.push(oe)}}return function(ee,Y,ie){for(const re in ee)for(const K of ee[re])Hi(K,ie[Y[re].source]);return ee}($,T,A)}(this._layers,f,this.sourceCaches,e,x,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)}querySourceFeatures(e,i){i&&i.filter&&this._validate(o.z.filter,"querySourceFeatures.filter",i.filter,null,i);const s=this.sourceCaches[e];return s?function(l,h){const f=l.getRenderableIds().map(T=>l.getTileByID(T)),_=[],x={};for(let T=0;T<f.length;T++){const M=f[T],A=M.tileID.canonical.key;x[A]||(x[A]=!0,M.querySourceFeatures(_,h))}return _}(s,i):[]}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const s=this.light.getLight();let l=!1;for(const f in e)if(!o.bG(e[f],s[f])){l=!0;break}if(!l)return;const h={now:Ae.now(),transition:o.e({duration:300,delay:0},this.stylesheet.transition)};this.light.setLight(e,i),this.light.updateTransitions(h)}getProjection(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.projection}setProjection(e){if(this._checkLoaded(),this.projection){if(this.projection.name===e.type)return;this.projection.destroy(),delete this.projection}this.stylesheet.projection=e,this._setProjectionInternal(e.type)}getSky(){var e;return(e=this.stylesheet)===null||e===void 0?void 0:e.sky}setSky(e,i={}){this._checkLoaded();const s=this.getSky();let l=!1;if(!e&&!s)return;if(e&&!s)l=!0;else if(!e&&s)l=!0;else for(const f in e)if(!o.bG(e[f],s[f])){l=!0;break}if(!l)return;const h={now:Ae.now(),transition:o.e({duration:300,delay:0},this.stylesheet.transition)};this.stylesheet.sky=e,this.sky.setSky(e,i),this.sky.updateTransitions(h)}_setProjectionInternal(e){const i=function(s){if(Array.isArray(s)){const l=new Ps({type:s});return{projection:l,transform:new yr,cameraHelper:new Vl(l)}}switch(s){case"mercator":return{projection:new Bl,transform:new pi,cameraHelper:new ko};case"globe":{const l=new Ps({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:l,transform:new yr,cameraHelper:new Vl(l)}}case"vertical-perspective":return{projection:new Pu,transform:new Va,cameraHelper:new ar};default:return o.w(`Unknown projection name: ${s}. Falling back to mercator projection.`),{projection:new Bl,transform:new pi,cameraHelper:new ko}}}(e);this.projection=i.projection,this.map.migrateProjection(i.transform,i.cameraHelper);for(const s in this.sourceCaches)this.sourceCaches[s].reload()}_validate(e,i,s,l,h={}){return(!h||h.validate!==!1)&&As(this,e.call(o.z,o.e({key:i,style:this.serialize(),value:s,styleSpec:o.v},l)))}_remove(e=!0){this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this._loadStyleRequest&&(this._loadStyleRequest.abort(),this._loadStyleRequest=null),this._spriteRequest&&(this._spriteRequest.abort(),this._spriteRequest=null),mr().off(fn,this._rtlPluginLoaded);for(const i in this._layers)this._layers[i].setEventedParent(null);for(const i in this.sourceCaches){const s=this.sourceCaches[i];s.setEventedParent(null),s.onRemove(this.map)}this.imageManager.setEventedParent(null),this.setEventedParent(null),e&&this.dispatcher.broadcast("RM",void 0),this.dispatcher.remove(e)}_clearSource(e){this.sourceCaches[e].clearTiles()}_reloadSource(e){this.sourceCaches[e].resume(),this.sourceCaches[e].reload()}_updateSources(e){for(const i in this.sourceCaches)this.sourceCaches[i].update(e,this.map.terrain)}_generateCollisionBoxes(){for(const e in this.sourceCaches)this._reloadSource(e)}_updatePlacement(e,i,s,l,h=!1){let f=!1,_=!1;const x={};for(const T of this._order){const M=this._layers[T];if(M.type!=="symbol")continue;if(!x[M.source]){const E=this.sourceCaches[M.source];x[M.source]=E.getRenderableIds(!0).map(R=>E.getTileByID(R)).sort((R,O)=>O.tileID.overscaledZ-R.tileID.overscaledZ||(R.tileID.isLessThan(O.tileID)?-1:1))}const A=this.crossTileSymbolIndex.addLayer(M,x[M.source],e.center.lng);f=f||A}if(this.crossTileSymbolIndex.pruneUnusedLayers(this._order),((h=h||this._layerOrderChanged||s===0)||!this.pauseablePlacement||this.pauseablePlacement.isDone()&&!this.placement.stillRecent(Ae.now(),e.zoom))&&(this.pauseablePlacement=new Tu(e,this.map.terrain,this._order,h,i,s,l,this.placement),this._layerOrderChanged=!1),this.pauseablePlacement.isDone()?this.placement.setStale():(this.pauseablePlacement.continuePlacement(this._order,this._layers,x),this.pauseablePlacement.isDone()&&(this.placement=this.pauseablePlacement.commit(Ae.now()),_=!0),f&&this.pauseablePlacement.placement.setStale()),_||f)for(const T of this._order){const M=this._layers[T];M.type==="symbol"&&this.placement.updateLayerOpacities(M,x[M.source])}return!this.pauseablePlacement.isDone()||this.placement.hasTransitions(Ae.now())}_releaseSymbolFadeTiles(){for(const e in this.sourceCaches)this.sourceCaches[e].releaseSymbolFadeTiles()}getImages(e,i){return o._(this,void 0,void 0,function*(){const s=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const l=this.sourceCaches[i.source];return l&&l.setDependencies(i.tileID.key,i.type,i.icons),s})}getGlyphs(e,i){return o._(this,void 0,void 0,function*(){const s=yield this.glyphManager.getGlyphs(i.stacks),l=this.sourceCaches[i.source];return l&&l.setDependencies(i.tileID.key,i.type,[""]),s})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(o.z.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,s={},l){this._checkLoaded();const h=[{id:e,url:i}],f=[...jt(this.stylesheet.sprite),...h];this._validate(o.z.sprite,"sprite",f,null,s)||(this.stylesheet.sprite=f,this._loadSprite(h,!0,l))}removeSprite(e){this._checkLoaded();const i=jt(this.stylesheet.sprite);if(i.find(s=>s.id===e)){if(this._spritesImagesIds[e])for(const s of this._spritesImagesIds[e])this.imageManager.removeImage(s),this._changedImages[s]=!0;i.splice(i.findIndex(s=>s.id===e),1),this.stylesheet.sprite=i.length>0?i:void 0,delete this._spritesImagesIds[e],this._availableImages=this.imageManager.listImages(),this._changed=!0,this.dispatcher.broadcast("SI",this._availableImages),this.fire(new o.l("data",{dataType:"style"}))}else this.fire(new o.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return jt(this.stylesheet.sprite)}setSprite(e,i={},s){this._checkLoaded(),e&&this._validate(o.z.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,s):(this._unloadSprite(),s&&s(null)))}}var pd=o.aI([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class fd{constructor(){this.boundProgram=null,this.boundLayoutVertexBuffer=null,this.boundPaintVertexBuffers=[],this.boundIndexBuffer=null,this.boundVertexOffset=null,this.boundDynamicVertexBuffer=null,this.vao=null}bind(e,i,s,l,h,f,_,x,T){this.context=e;let M=this.boundPaintVertexBuffers.length!==l.length;for(let A=0;!M&&A<l.length;A++)this.boundPaintVertexBuffers[A]!==l[A]&&(M=!0);!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==s||M||this.boundIndexBuffer!==h||this.boundVertexOffset!==f||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==x||this.boundDynamicVertexBuffer3!==T?this.freshBind(i,s,l,h,f,_,x,T):(e.bindVertexArray.set(this.vao),_&&_.bind(),h&&h.dynamicDraw&&h.bind(),x&&x.bind(),T&&T.bind())}freshBind(e,i,s,l,h,f,_,x){const T=e.numAttributes,M=this.context,A=M.gl;this.vao&&this.destroy(),this.vao=M.createVertexArray(),M.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=l,this.boundVertexOffset=h,this.boundDynamicVertexBuffer=f,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=x,i.enableAttributes(A,e);for(const E of s)E.enableAttributes(A,e);f&&f.enableAttributes(A,e),_&&_.enableAttributes(A,e),x&&x.enableAttributes(A,e),i.bind(),i.setVertexAttribPointers(A,e,h);for(const E of s)E.bind(),E.setVertexAttribPointers(A,e,h);f&&(f.bind(),f.setVertexAttribPointers(A,e,h)),l&&l.bind(),_&&(_.bind(),_.setVertexAttribPointers(A,e,h)),x&&(x.bind(),x.setVertexAttribPointers(A,e,h)),M.currentNumAttributes=T}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const md=(u,e,i,s,l)=>({u_texture:0,u_ele_delta:u,u_fog_matrix:e,u_fog_color:i?i.properties.get("fog-color"):o.be.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:l?0:i?i.calculateFogBlendOpacity(s):0,u_horizon_color:i?i.properties.get("horizon-color"):o.be.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:l?1:0}),gd={mainMatrix:"u_projection_matrix",tileMercatorCoords:"u_projection_tile_mercator_coords",clippingPlane:"u_projection_clipping_plane",projectionTransition:"u_projection_transition",fallbackMatrix:"u_projection_fallback_matrix"};function Ro(u){const e=[];for(let i=0;i<u.length;i++){if(u[i]===null)continue;const s=u[i].split(" ");e.push(s.pop())}return e}class Do{constructor(e,i,s,l,h,f,_,x,T=[]){const M=e.gl;this.program=M.createProgram();const A=Ro(i.staticAttributes),E=s?s.getBinderAttributes():[],R=A.concat(E),O=nn.prelude.staticUniforms?Ro(nn.prelude.staticUniforms):[],q=_.staticUniforms?Ro(_.staticUniforms):[],$=i.staticUniforms?Ro(i.staticUniforms):[],W=s?s.getBinderUniforms():[],X=O.concat(q).concat($).concat(W),ee=[];for(const pe of X)ee.indexOf(pe)<0&&ee.push(pe);const Y=s?s.defines():[];Xi(M)&&Y.unshift("#version 300 es"),h&&Y.push("#define OVERDRAW_INSPECTOR;"),f&&Y.push("#define TERRAIN3D;"),x&&Y.push(x),T&&Y.push(...T);let ie=Y.concat(nn.prelude.fragmentSource,_.fragmentSource,i.fragmentSource).join(`
|
|
747
|
-
`),re=Y.concat(nn.prelude.vertexSource,_.vertexSource,i.vertexSource).join(`
|
|
748
|
-
`);Xi(M)||(ie=function(pe){return pe.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(ie),re=function(pe){return pe.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(re));const K=M.createShader(M.FRAGMENT_SHADER);if(M.isContextLost())return void(this.failedToCreate=!0);if(M.shaderSource(K,ie),M.compileShader(K),!M.getShaderParameter(K,M.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${M.getShaderInfoLog(K)}`);M.attachShader(this.program,K);const oe=M.createShader(M.VERTEX_SHADER);if(M.isContextLost())return void(this.failedToCreate=!0);if(M.shaderSource(oe,re),M.compileShader(oe),!M.getShaderParameter(oe,M.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${M.getShaderInfoLog(oe)}`);M.attachShader(this.program,oe),this.attributes={};const _e={};this.numAttributes=R.length;for(let pe=0;pe<this.numAttributes;pe++)R[pe]&&(M.bindAttribLocation(this.program,pe,R[pe]),this.attributes[R[pe]]=pe);if(M.linkProgram(this.program),!M.getProgramParameter(this.program,M.LINK_STATUS))throw new Error(`Program failed to link: ${M.getProgramInfoLog(this.program)}`);M.deleteShader(oe),M.deleteShader(K);for(let pe=0;pe<ee.length;pe++){const fe=ee[pe];if(fe&&!_e[fe]){const xe=M.getUniformLocation(this.program,fe);xe&&(_e[fe]=xe)}}this.fixedUniforms=l(e,_e),this.terrainUniforms=((pe,fe)=>({u_depth:new o.bO(pe,fe.u_depth),u_terrain:new o.bO(pe,fe.u_terrain),u_terrain_dim:new o.bf(pe,fe.u_terrain_dim),u_terrain_matrix:new o.bQ(pe,fe.u_terrain_matrix),u_terrain_unpack:new o.bR(pe,fe.u_terrain_unpack),u_terrain_exaggeration:new o.bf(pe,fe.u_terrain_exaggeration)}))(e,_e),this.projectionUniforms=((pe,fe)=>({u_projection_matrix:new o.bQ(pe,fe.u_projection_matrix),u_projection_tile_mercator_coords:new o.bR(pe,fe.u_projection_tile_mercator_coords),u_projection_clipping_plane:new o.bR(pe,fe.u_projection_clipping_plane),u_projection_transition:new o.bf(pe,fe.u_projection_transition),u_projection_fallback_matrix:new o.bQ(pe,fe.u_projection_fallback_matrix)}))(e,_e),this.binderUniforms=s?s.getUniforms(e,_e):[]}draw(e,i,s,l,h,f,_,x,T,M,A,E,R,O,q,$,W,X,ee){const Y=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(s),e.setStencilMode(l),e.setColorMode(h),e.setCullFace(f),x){e.activeTexture.set(Y.TEXTURE2),Y.bindTexture(Y.TEXTURE_2D,x.depthTexture),e.activeTexture.set(Y.TEXTURE3),Y.bindTexture(Y.TEXTURE_2D,x.texture);for(const re in this.terrainUniforms)this.terrainUniforms[re].set(x[re])}if(T)for(const re in T)this.projectionUniforms[gd[re]].set(T[re]);if(_)for(const re in this.fixedUniforms)this.fixedUniforms[re].set(_[re]);$&&$.setUniforms(e,this.binderUniforms,O,{zoom:q});let ie=0;switch(i){case Y.LINES:ie=2;break;case Y.TRIANGLES:ie=3;break;case Y.LINE_STRIP:ie=1}for(const re of R.get()){const K=re.vaos||(re.vaos={});(K[M]||(K[M]=new fd)).bind(e,this,A,$?$.getPaintVertexBuffers():[],E,re.vertexOffset,W,X,ee),Y.drawElements(i,re.primitiveLength*ie,Y.UNSIGNED_SHORT,re.primitiveOffset*ie*2)}}}function Lo(u,e,i){const s=1/o.aB(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 zs=(u,e,i,s)=>{const l=u.style.light,h=l.properties.get("position"),f=[h.x,h.y,h.z],_=o.bU();l.properties.get("anchor")==="viewport"&&o.bV(_,u.transform.bearingInRadians),o.bW(f,f,_);const x=u.transform.transformLightDirection(f),T=l.properties.get("color");return{u_lightpos:f,u_lightpos_globe:x,u_lightintensity:l.properties.get("intensity"),u_lightcolor:[T.r,T.g,T.b],u_vertical_gradient:+e,u_opacity:i,u_fill_translate:s}},Ul=(u,e,i,s,l,h,f)=>o.e(zs(u,e,i,s),Lo(h,u,f),{u_height_factor:-Math.pow(2,l.overscaledZ)/f.tileSize/8}),Fo=(u,e,i,s)=>o.e(Lo(e,u,i),{u_fill_translate:s}),sn=(u,e)=>({u_world:u,u_fill_translate:e}),_d=(u,e,i,s,l)=>o.e(Fo(u,e,i,l),{u_world:s}),$l=(u,e,i,s,l)=>{const h=u.transform;let f,_,x=0;if(i.paint.get("circle-pitch-alignment")==="map"){const T=o.aB(e,1,h.zoom);f=!0,_=[T,T],x=T/(o.$*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*l}else f=!1,_=h.pixelsToGLUnits;return{u_camera_to_center_distance:h.cameraToCenterDistance,u_scale_with_map:+(i.paint.get("circle-pitch-scale")==="map"),u_pitch_with_map:+f,u_device_pixel_ratio:u.pixelRatio,u_extrude_scale:_,u_globe_extrude_scale:x,u_translate:s}},ks=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),Rs=u=>({u_viewport_size:[u.width,u.height]}),Cu=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),Ds=(u,e,i,s)=>{const l=o.aB(u,1,e)/(o.$*Math.pow(2,u.tileID.overscaledZ))*2*Math.PI*s;return{u_extrude_scale:o.aB(u,1,e),u_intensity:i,u_globe_extrude_scale:l}},Iu=(u,e,i,s)=>{const l=o.L();o.bX(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")}},Ua=(u,e,i)=>{const s=i.paint.get("hillshade-accent-color");let l;switch(i.paint.get("hillshade-method")){case"basic":l=4;break;case"combined":l=1;break;case"igor":l=2;break;case"multidirectional":l=3;break;default:l=0}const h=i.getIlluminationProperties();for(let f=0;f<h.directionRadians.length;f++)i.paint.get("hillshade-illumination-anchor")==="viewport"&&(h.directionRadians[f]+=u.transform.bearingInRadians);return{u_image:0,u_latrange:Eu(0,e.tileID),u_exaggeration:i.paint.get("hillshade-exaggeration"),u_altitudes:h.altitudeRadians,u_azimuths:h.directionRadians,u_accent:s,u_method:l,u_highlights:h.highlightColor,u_shadows:h.shadowColor}},yd=(u,e)=>{const i=e.stride,s=o.L();return o.bX(s,0,o.$,-8192,0,0,1),o.M(s,s,[0,-8192,0]),{u_matrix:s,u_image:1,u_dimension:[i,i],u_zoom:u.overscaledZ,u_unpack:e.getUnpackVector()}};function Eu(u,e){const i=Math.pow(2,e.canonical.z),s=e.canonical.y;return[new o.a0(0,s/i).toLngLat().lat,new o.a0(0,(s+1)/i).toLngLat().lat]}const xd=(u,e)=>({u_image:0,u_unpack:e.getUnpackVector(),u_dimension:[e.stride,e.stride],u_elevation_stops:1,u_color_stops:4,u_opacity:u.paint.get("color-relief-opacity")}),Bo=(u,e,i,s)=>{const l=u.transform;return{u_translation:Wl(u,e,i),u_ratio:s/o.aB(e,1,l.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/l.pixelsToGLUnits[0],1/l.pixelsToGLUnits[1]]}},Gl=(u,e,i,s,l)=>o.e(Bo(u,e,i,s),{u_image:0,u_image_height:l}),Au=(u,e,i,s,l)=>{const h=u.transform,f=ql(e,h);return{u_translation:Wl(u,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:s/o.aB(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]]}},zu=(u,e,i,s,l,h)=>{const f=u.lineAtlas,_=ql(e,u.transform),x=i.layout.get("line-cap")==="round",T=f.getDash(l.from,x),M=f.getDash(l.to,x),A=T.width*h.fromScale,E=M.width*h.toScale;return o.e(Bo(u,e,i,s),{u_patternscale_a:[_/A,-T.height/2],u_patternscale_b:[_/E,-M.height/2],u_sdfgamma:f.width/(256*Math.min(A,E)*u.pixelRatio)/2,u_image:0,u_tex_y_a:T.y,u_tex_y_b:M.y,u_mix:h.t})};function ql(u,e){return 1/o.aB(u,1,e.tileZoom)}function Wl(u,e,i){return o.aC(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const ua=(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:ku(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 ku(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 Hl=(u,e,i,s,l,h,f,_,x,T,M,A,E)=>{const R=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:R.cameraToCenterDistance,u_pitch:R.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:R.width/R.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:x,u_is_text:+M,u_pitch_with_map:+s,u_is_along_line:l,u_is_variable_anchor:h,u_texsize:A,u_texture:0,u_translation:T,u_pitched_scale:E}},$a=(u,e,i,s,l,h,f,_,x,T,M,A,E,R)=>{const O=f.transform;return o.e(Hl(u,e,i,s,l,h,f,_,x,T,M,A,R),{u_gamma_scale:s?Math.cos(O.pitch*Math.PI/180)*O.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},vd=(u,e,i,s,l,h,f,_,x,T,M,A,E)=>o.e($a(u,e,i,s,l,h,f,_,x,T,!0,M,0,E),{u_texsize_icon:A,u_texture_icon:1}),Oo=(u,e)=>({u_opacity:u,u_color:e}),bd=(u,e,i,s,l)=>o.e(function(h,f,_,x){const T=_.imageManager.getPattern(h.from.toString()),M=_.imageManager.getPattern(h.to.toString()),{width:A,height:E}=_.imageManager.getPixelSize(),R=Math.pow(2,x.tileID.overscaledZ),O=x.tileSize*Math.pow(2,_.transform.tileZoom)/R,q=O*(x.tileID.canonical.x+x.tileID.wrap*R),$=O*x.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:T.tl,u_pattern_br_a:T.br,u_pattern_tl_b:M.tl,u_pattern_br_b:M.br,u_texsize:[A,E],u_mix:f.t,u_pattern_size_a:T.displaySize,u_pattern_size_b:M.displaySize,u_scale_a:f.fromScale,u_scale_b:f.toScale,u_tile_units_to_pixels:1/o.aB(x,1,_.transform.tileZoom),u_pixel_coord_upper:[q>>16,$>>16],u_pixel_coord_lower:[65535&q,65535&$]}}(i,l,e,s),{u_opacity:u}),Ru=(u,e)=>{},Du={fillExtrusion:(u,e)=>({u_lightpos:new o.bS(u,e.u_lightpos),u_lightpos_globe:new o.bS(u,e.u_lightpos_globe),u_lightintensity:new o.bf(u,e.u_lightintensity),u_lightcolor:new o.bS(u,e.u_lightcolor),u_vertical_gradient:new o.bf(u,e.u_vertical_gradient),u_opacity:new o.bf(u,e.u_opacity),u_fill_translate:new o.bT(u,e.u_fill_translate)}),fillExtrusionPattern:(u,e)=>({u_lightpos:new o.bS(u,e.u_lightpos),u_lightpos_globe:new o.bS(u,e.u_lightpos_globe),u_lightintensity:new o.bf(u,e.u_lightintensity),u_lightcolor:new o.bS(u,e.u_lightcolor),u_vertical_gradient:new o.bf(u,e.u_vertical_gradient),u_height_factor:new o.bf(u,e.u_height_factor),u_opacity:new o.bf(u,e.u_opacity),u_fill_translate:new o.bT(u,e.u_fill_translate),u_image:new o.bO(u,e.u_image),u_texsize:new o.bT(u,e.u_texsize),u_pixel_coord_upper:new o.bT(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bT(u,e.u_pixel_coord_lower),u_scale:new o.bS(u,e.u_scale),u_fade:new o.bf(u,e.u_fade)}),fill:(u,e)=>({u_fill_translate:new o.bT(u,e.u_fill_translate)}),fillPattern:(u,e)=>({u_image:new o.bO(u,e.u_image),u_texsize:new o.bT(u,e.u_texsize),u_pixel_coord_upper:new o.bT(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bT(u,e.u_pixel_coord_lower),u_scale:new o.bS(u,e.u_scale),u_fade:new o.bf(u,e.u_fade),u_fill_translate:new o.bT(u,e.u_fill_translate)}),fillOutline:(u,e)=>({u_world:new o.bT(u,e.u_world),u_fill_translate:new o.bT(u,e.u_fill_translate)}),fillOutlinePattern:(u,e)=>({u_world:new o.bT(u,e.u_world),u_image:new o.bO(u,e.u_image),u_texsize:new o.bT(u,e.u_texsize),u_pixel_coord_upper:new o.bT(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bT(u,e.u_pixel_coord_lower),u_scale:new o.bS(u,e.u_scale),u_fade:new o.bf(u,e.u_fade),u_fill_translate:new o.bT(u,e.u_fill_translate)}),circle:(u,e)=>({u_camera_to_center_distance:new o.bf(u,e.u_camera_to_center_distance),u_scale_with_map:new o.bO(u,e.u_scale_with_map),u_pitch_with_map:new o.bO(u,e.u_pitch_with_map),u_extrude_scale:new o.bT(u,e.u_extrude_scale),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_globe_extrude_scale:new o.bf(u,e.u_globe_extrude_scale),u_translate:new o.bT(u,e.u_translate)}),collisionBox:(u,e)=>({u_pixel_extrude_scale:new o.bT(u,e.u_pixel_extrude_scale)}),collisionCircle:(u,e)=>({u_viewport_size:new o.bT(u,e.u_viewport_size)}),debug:(u,e)=>({u_color:new o.bP(u,e.u_color),u_overlay:new o.bO(u,e.u_overlay),u_overlay_scale:new o.bf(u,e.u_overlay_scale)}),depth:Ru,clippingMask:Ru,heatmap:(u,e)=>({u_extrude_scale:new o.bf(u,e.u_extrude_scale),u_intensity:new o.bf(u,e.u_intensity),u_globe_extrude_scale:new o.bf(u,e.u_globe_extrude_scale)}),heatmapTexture:(u,e)=>({u_matrix:new o.bQ(u,e.u_matrix),u_world:new o.bT(u,e.u_world),u_image:new o.bO(u,e.u_image),u_color_ramp:new o.bO(u,e.u_color_ramp),u_opacity:new o.bf(u,e.u_opacity)}),hillshade:(u,e)=>({u_image:new o.bO(u,e.u_image),u_latrange:new o.bT(u,e.u_latrange),u_exaggeration:new o.bf(u,e.u_exaggeration),u_altitudes:new o.bZ(u,e.u_altitudes),u_azimuths:new o.bZ(u,e.u_azimuths),u_accent:new o.bP(u,e.u_accent),u_method:new o.bO(u,e.u_method),u_shadows:new o.bY(u,e.u_shadows),u_highlights:new o.bY(u,e.u_highlights)}),hillshadePrepare:(u,e)=>({u_matrix:new o.bQ(u,e.u_matrix),u_image:new o.bO(u,e.u_image),u_dimension:new o.bT(u,e.u_dimension),u_zoom:new o.bf(u,e.u_zoom),u_unpack:new o.bR(u,e.u_unpack)}),colorRelief:(u,e)=>({u_image:new o.bO(u,e.u_image),u_unpack:new o.bR(u,e.u_unpack),u_dimension:new o.bT(u,e.u_dimension),u_elevation_stops:new o.bO(u,e.u_elevation_stops),u_color_stops:new o.bO(u,e.u_color_stops),u_opacity:new o.bf(u,e.u_opacity)}),line:(u,e)=>({u_translation:new o.bT(u,e.u_translation),u_ratio:new o.bf(u,e.u_ratio),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bT(u,e.u_units_to_pixels)}),lineGradient:(u,e)=>({u_translation:new o.bT(u,e.u_translation),u_ratio:new o.bf(u,e.u_ratio),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bT(u,e.u_units_to_pixels),u_image:new o.bO(u,e.u_image),u_image_height:new o.bf(u,e.u_image_height)}),linePattern:(u,e)=>({u_translation:new o.bT(u,e.u_translation),u_texsize:new o.bT(u,e.u_texsize),u_ratio:new o.bf(u,e.u_ratio),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_image:new o.bO(u,e.u_image),u_units_to_pixels:new o.bT(u,e.u_units_to_pixels),u_scale:new o.bS(u,e.u_scale),u_fade:new o.bf(u,e.u_fade)}),lineSDF:(u,e)=>({u_translation:new o.bT(u,e.u_translation),u_ratio:new o.bf(u,e.u_ratio),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_units_to_pixels:new o.bT(u,e.u_units_to_pixels),u_patternscale_a:new o.bT(u,e.u_patternscale_a),u_patternscale_b:new o.bT(u,e.u_patternscale_b),u_sdfgamma:new o.bf(u,e.u_sdfgamma),u_image:new o.bO(u,e.u_image),u_tex_y_a:new o.bf(u,e.u_tex_y_a),u_tex_y_b:new o.bf(u,e.u_tex_y_b),u_mix:new o.bf(u,e.u_mix)}),raster:(u,e)=>({u_tl_parent:new o.bT(u,e.u_tl_parent),u_scale_parent:new o.bf(u,e.u_scale_parent),u_buffer_scale:new o.bf(u,e.u_buffer_scale),u_fade_t:new o.bf(u,e.u_fade_t),u_opacity:new o.bf(u,e.u_opacity),u_image0:new o.bO(u,e.u_image0),u_image1:new o.bO(u,e.u_image1),u_brightness_low:new o.bf(u,e.u_brightness_low),u_brightness_high:new o.bf(u,e.u_brightness_high),u_saturation_factor:new o.bf(u,e.u_saturation_factor),u_contrast_factor:new o.bf(u,e.u_contrast_factor),u_spin_weights:new o.bS(u,e.u_spin_weights),u_coords_top:new o.bR(u,e.u_coords_top),u_coords_bottom:new o.bR(u,e.u_coords_bottom)}),symbolIcon:(u,e)=>({u_is_size_zoom_constant:new o.bO(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bO(u,e.u_is_size_feature_constant),u_size_t:new o.bf(u,e.u_size_t),u_size:new o.bf(u,e.u_size),u_camera_to_center_distance:new o.bf(u,e.u_camera_to_center_distance),u_pitch:new o.bf(u,e.u_pitch),u_rotate_symbol:new o.bO(u,e.u_rotate_symbol),u_aspect_ratio:new o.bf(u,e.u_aspect_ratio),u_fade_change:new o.bf(u,e.u_fade_change),u_label_plane_matrix:new o.bQ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bQ(u,e.u_coord_matrix),u_is_text:new o.bO(u,e.u_is_text),u_pitch_with_map:new o.bO(u,e.u_pitch_with_map),u_is_along_line:new o.bO(u,e.u_is_along_line),u_is_variable_anchor:new o.bO(u,e.u_is_variable_anchor),u_texsize:new o.bT(u,e.u_texsize),u_texture:new o.bO(u,e.u_texture),u_translation:new o.bT(u,e.u_translation),u_pitched_scale:new o.bf(u,e.u_pitched_scale)}),symbolSDF:(u,e)=>({u_is_size_zoom_constant:new o.bO(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bO(u,e.u_is_size_feature_constant),u_size_t:new o.bf(u,e.u_size_t),u_size:new o.bf(u,e.u_size),u_camera_to_center_distance:new o.bf(u,e.u_camera_to_center_distance),u_pitch:new o.bf(u,e.u_pitch),u_rotate_symbol:new o.bO(u,e.u_rotate_symbol),u_aspect_ratio:new o.bf(u,e.u_aspect_ratio),u_fade_change:new o.bf(u,e.u_fade_change),u_label_plane_matrix:new o.bQ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bQ(u,e.u_coord_matrix),u_is_text:new o.bO(u,e.u_is_text),u_pitch_with_map:new o.bO(u,e.u_pitch_with_map),u_is_along_line:new o.bO(u,e.u_is_along_line),u_is_variable_anchor:new o.bO(u,e.u_is_variable_anchor),u_texsize:new o.bT(u,e.u_texsize),u_texture:new o.bO(u,e.u_texture),u_gamma_scale:new o.bf(u,e.u_gamma_scale),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_is_halo:new o.bO(u,e.u_is_halo),u_translation:new o.bT(u,e.u_translation),u_pitched_scale:new o.bf(u,e.u_pitched_scale)}),symbolTextAndIcon:(u,e)=>({u_is_size_zoom_constant:new o.bO(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new o.bO(u,e.u_is_size_feature_constant),u_size_t:new o.bf(u,e.u_size_t),u_size:new o.bf(u,e.u_size),u_camera_to_center_distance:new o.bf(u,e.u_camera_to_center_distance),u_pitch:new o.bf(u,e.u_pitch),u_rotate_symbol:new o.bO(u,e.u_rotate_symbol),u_aspect_ratio:new o.bf(u,e.u_aspect_ratio),u_fade_change:new o.bf(u,e.u_fade_change),u_label_plane_matrix:new o.bQ(u,e.u_label_plane_matrix),u_coord_matrix:new o.bQ(u,e.u_coord_matrix),u_is_text:new o.bO(u,e.u_is_text),u_pitch_with_map:new o.bO(u,e.u_pitch_with_map),u_is_along_line:new o.bO(u,e.u_is_along_line),u_is_variable_anchor:new o.bO(u,e.u_is_variable_anchor),u_texsize:new o.bT(u,e.u_texsize),u_texsize_icon:new o.bT(u,e.u_texsize_icon),u_texture:new o.bO(u,e.u_texture),u_texture_icon:new o.bO(u,e.u_texture_icon),u_gamma_scale:new o.bf(u,e.u_gamma_scale),u_device_pixel_ratio:new o.bf(u,e.u_device_pixel_ratio),u_is_halo:new o.bO(u,e.u_is_halo),u_translation:new o.bT(u,e.u_translation),u_pitched_scale:new o.bf(u,e.u_pitched_scale)}),background:(u,e)=>({u_opacity:new o.bf(u,e.u_opacity),u_color:new o.bP(u,e.u_color)}),backgroundPattern:(u,e)=>({u_opacity:new o.bf(u,e.u_opacity),u_image:new o.bO(u,e.u_image),u_pattern_tl_a:new o.bT(u,e.u_pattern_tl_a),u_pattern_br_a:new o.bT(u,e.u_pattern_br_a),u_pattern_tl_b:new o.bT(u,e.u_pattern_tl_b),u_pattern_br_b:new o.bT(u,e.u_pattern_br_b),u_texsize:new o.bT(u,e.u_texsize),u_mix:new o.bf(u,e.u_mix),u_pattern_size_a:new o.bT(u,e.u_pattern_size_a),u_pattern_size_b:new o.bT(u,e.u_pattern_size_b),u_scale_a:new o.bf(u,e.u_scale_a),u_scale_b:new o.bf(u,e.u_scale_b),u_pixel_coord_upper:new o.bT(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new o.bT(u,e.u_pixel_coord_lower),u_tile_units_to_pixels:new o.bf(u,e.u_tile_units_to_pixels)}),terrain:(u,e)=>({u_texture:new o.bO(u,e.u_texture),u_ele_delta:new o.bf(u,e.u_ele_delta),u_fog_matrix:new o.bQ(u,e.u_fog_matrix),u_fog_color:new o.bP(u,e.u_fog_color),u_fog_ground_blend:new o.bf(u,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new o.bf(u,e.u_fog_ground_blend_opacity),u_horizon_color:new o.bP(u,e.u_horizon_color),u_horizon_fog_blend:new o.bf(u,e.u_horizon_fog_blend),u_is_globe_mode:new o.bf(u,e.u_is_globe_mode)}),terrainDepth:(u,e)=>({u_ele_delta:new o.bf(u,e.u_ele_delta)}),terrainCoords:(u,e)=>({u_texture:new o.bO(u,e.u_texture),u_terrain_coords_id:new o.bf(u,e.u_terrain_coords_id),u_ele_delta:new o.bf(u,e.u_ele_delta)}),projectionErrorMeasurement:(u,e)=>({u_input:new o.bf(u,e.u_input),u_output_expected:new o.bf(u,e.u_output_expected)}),atmosphere:(u,e)=>({u_sun_pos:new o.bS(u,e.u_sun_pos),u_atmosphere_blend:new o.bf(u,e.u_atmosphere_blend),u_globe_position:new o.bS(u,e.u_globe_position),u_globe_radius:new o.bf(u,e.u_globe_radius),u_inv_proj_matrix:new o.bQ(u,e.u_inv_proj_matrix)}),sky:(u,e)=>({u_sky_color:new o.bP(u,e.u_sky_color),u_horizon_color:new o.bP(u,e.u_horizon_color),u_horizon:new o.bT(u,e.u_horizon),u_horizon_normal:new o.bT(u,e.u_horizon_normal),u_sky_horizon_blend:new o.bf(u,e.u_sky_horizon_blend),u_sky_blend:new o.bf(u,e.u_sky_blend)})};class Lu{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 Fu={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Xl{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[Fu[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 jo extends Mt{getDefault(){return o.be.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 wn extends Mt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Yl extends Mt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class Kl 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 Jl extends Mt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Bu extends Mt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Ql 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 ha 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 ec 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 wd 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 Td 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 Sd 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 Pd 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 Ou 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 Md extends Mt{getDefault(){return o.be.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 ju 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 No 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 Vo 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 Zo 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 tc extends Mt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class da 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 Ls 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 Ga 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 Cr 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 Nu 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 Vu 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 ic 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 pa extends Mt{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const s=this.gl;Xi(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 Uo 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 $o 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 Fs 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 qa extends Mt{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class Zu extends qa{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 Wa extends qa{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 Ha extends qa{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 rc="Framebuffer is not complete";class nc{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 Zu(e,_),l)this.depthAttachment=h?new Ha(e,_):new Wa(e,_);else if(h)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(rc)}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 _t{constructor(e){var i,s;if(this.gl=e,this.clearColor=new jo(this),this.clearDepth=new wn(this),this.clearStencil=new Yl(this),this.colorMask=new Kl(this),this.depthMask=new Jl(this),this.stencilMask=new Bu(this),this.stencilFunc=new Ql(this),this.stencilOp=new ha(this),this.stencilTest=new ec(this),this.depthRange=new wd(this),this.depthTest=new Td(this),this.depthFunc=new Sd(this),this.blend=new Pd(this),this.blendFunc=new Ou(this),this.blendColor=new Md(this),this.blendEquation=new ju(this),this.cullFace=new No(this),this.cullFaceSide=new Vo(this),this.frontFace=new Zo(this),this.program=new tc(this),this.activeTexture=new da(this),this.viewport=new Ls(this),this.bindFramebuffer=new Ga(this),this.bindRenderbuffer=new Cr(this),this.bindTexture=new Nu(this),this.bindVertexBuffer=new Vu(this),this.bindElementBuffer=new ic(this),this.bindVertexArray=new pa(this),this.pixelStoreUnpack=new Uo(this),this.pixelStoreUnpackPremultiplyAlpha=new $o(this),this.pixelStoreUnpackFlipY=new Fs(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),Xi(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 Lu(this,e,i)}createVertexBuffer(e,i,s){return new Xl(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 nc(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.bG(e.blendFunction,bt.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 Xi(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 Xi(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 fa;function Uu(u,e,i,s,l){const h=u.context,f=u.transform,_=h.gl,x=u.useProgram("collisionBox"),T=[];let M=0,A=0;for(let W=0;W<s.length;W++){const X=s[W],ee=e.getTile(X).getBucket(i);if(!ee)continue;const Y=l?ee.textCollisionBox:ee.iconCollisionBox,ie=ee.collisionCircleArray;ie.length>0&&(T.push({circleArray:ie,circleOffset:A,coord:X}),M+=ie.length/4,A=M),Y&&x.draw(h,_.LINES,st.disabled,it.disabled,u.colorModeForRenderPass(),at.disabled,ks(u.transform),u.style.map.terrain&&u.style.map.terrain.getTerrainData(X),f.getProjectionData({overscaledTileID:X,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,Y.layoutVertexBuffer,Y.indexBuffer,Y.segments,null,u.transform.zoom,null,null,Y.collisionVertexBuffer)}if(!l||!T.length)return;const E=u.useProgram("collisionCircle"),R=new o.b_;R.resize(4*M),R._trim();let O=0;for(const W of T)for(let X=0;X<W.circleArray.length/4;X++){const ee=4*X,Y=W.circleArray[ee+0],ie=W.circleArray[ee+1],re=W.circleArray[ee+2],K=W.circleArray[ee+3];R.emplace(O++,Y,ie,re,K,0),R.emplace(O++,Y,ie,re,K,1),R.emplace(O++,Y,ie,re,K,2),R.emplace(O++,Y,ie,re,K,3)}(!fa||fa.length<2*M)&&(fa=function(W){const X=2*W,ee=new o.c0;ee.resize(X),ee._trim();for(let Y=0;Y<X;Y++){const ie=6*Y;ee.uint16[ie+0]=4*Y+0,ee.uint16[ie+1]=4*Y+1,ee.uint16[ie+2]=4*Y+2,ee.uint16[ie+3]=4*Y+2,ee.uint16[ie+4]=4*Y+3,ee.uint16[ie+5]=4*Y+0}return ee}(M));const q=h.createIndexBuffer(fa,!0),$=h.createVertexBuffer(R,o.b$.members,!0);for(const W of T){const X=Rs(u.transform);E.draw(h,_.TRIANGLES,st.disabled,it.disabled,u.colorModeForRenderPass(),at.disabled,X,u.style.map.terrain&&u.style.map.terrain.getTerrainData(W.coord),null,i.id,$,q,o.aL.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,u.transform.zoom,null,null,null)}$.destroy(),q.destroy()}const $u=o.af(new Float32Array(16));function Bs(u,e,i,s,l,h){const{horizontalAlign:f,verticalAlign:_}=o.aG(u);return new o.P((-(f-.5)*e/l+s[0])*h,(-(_-.5)*i/l+s[1])*h)}function Cd(u,e,i,s,l,h){const f=e.tileAnchorPoint.add(new o.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=s.mult(h);i||(_=_.rotate(-l));const x=f.add(_);return Pt(x.x,x.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const _=Oe(e.tileAnchorPoint.x+1,e.tileAnchorPoint.y,e).point.sub(u),x=Math.atan(_.y/_.x)+(_.x<0?Math.PI:0);return u.add(s.rotate(x))}return u.add(s)}function Id(u,e,i,s,l,h,f,_,x,T,M,A){const E=u.text.placedSymbolArray,R=u.text.dynamicLayoutVertexArray,O=u.icon.dynamicLayoutVertexArray,q={};R.clear();for(let $=0;$<E.length;$++){const W=E.get($),X=W.hidden||!W.crossTileID||u.allowVerticalPlacement&&!W.placedOrientation?null:s[W.crossTileID];if(X){const ee=new o.P(W.anchorX,W.anchorY),Y={getElevation:A,width:l.width,height:l.height,pitchedLabelPlaneMatrix:h,pitchWithMap:i,transform:l,tileAnchorPoint:ee,translation:T,unwrappedTileID:M},ie=i?dt(ee.x,ee.y,Y):Oe(ee.x,ee.y,Y),re=rt(l.cameraToCenterDistance,ie.signedDistanceFromCamera);let K=o.ao(u.textSizeData,_,W)*re/o.aA;i&&(K*=u.tilePixelRatio/f);const{width:oe,height:_e,anchor:pe,textOffset:fe,textBoxScale:xe}=X,Fe=Bs(pe,oe,_e,fe,xe,K),Le=l.getPitchedTextCorrection(ee.x+T[0],ee.y+T[1],M),Ie=Cd(ie.point,Y,e,Fe,-l.bearingInRadians,Le),$e=u.allowVerticalPlacement&&W.placedOrientation===o.an.vertical?Math.PI/2:0;for(let ot=0;ot<W.numGlyphs;ot++)o.au(R,Ie,$e);x&&W.associatedIconIndex>=0&&(q[W.associatedIconIndex]={shiftedAnchor:Ie,angle:$e})}else _n(W.numGlyphs,R)}if(x){O.clear();const $=u.icon.placedSymbolArray;for(let W=0;W<$.length;W++){const X=$.get(W);if(X.hidden)_n(X.numGlyphs,O);else{const ee=q[W];if(ee)for(let Y=0;Y<X.numGlyphs;Y++)o.au(O,ee.shiftedAnchor,ee.angle);else _n(X.numGlyphs,O)}}u.icon.dynamicLayoutVertexBuffer.updateData(O)}u.text.dynamicLayoutVertexBuffer.updateData(R)}function Gu(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function qu(u,e,i,s,l,h,f,_,x,T,M,A,E){const R=u.context,O=R.gl,q=u.transform,$=_==="map",W=x==="map",X=_!=="viewport"&&i.layout.get("symbol-placement")!=="point",ee=$&&!W&&!X,Y=!i.layout.get("symbol-sort-key").isConstant();let ie=!1;const re=u.getDepthModeForSublayer(0,st.ReadOnly),K=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),oe=[],_e=q.getCircleRadiusCorrection();for(const pe of s){const fe=e.getTile(pe),xe=fe.getBucket(i);if(!xe)continue;const Fe=l?xe.text:xe.icon;if(!Fe||!Fe.segments.get().length||!Fe.hasVisibleVertices)continue;const Le=Fe.programConfigurations.get(i.id),Ie=l||xe.sdfIcons,$e=l?xe.textSizeData:xe.iconSizeData,ot=W||q.pitch!==0,Ct=u.useProgram(Gu(Ie,l,xe),Le),Jt=o.am($e,q.zoom),Bt=u.style.map.terrain&&u.style.map.terrain.getTerrainData(pe);let Qt,Nt,Ot,Vt,Li=[0,0],Tt=null;if(l)Nt=fe.glyphAtlasTexture,Ot=O.LINEAR,Qt=fe.glyphAtlasTexture.size,xe.iconsInText&&(Li=fe.imageAtlasTexture.size,Tt=fe.imageAtlasTexture,Vt=ot||u.options.rotating||u.options.zooming||$e.kind==="composite"||$e.kind==="camera"?O.LINEAR:O.NEAREST);else{const si=i.layout.get("icon-size").constantOr(0)!==1||xe.iconsNeedLinear;Nt=fe.imageAtlasTexture,Ot=Ie||u.options.rotating||u.options.zooming||si||ot?O.LINEAR:O.NEAREST,Qt=fe.imageAtlasTexture.size}const Pi=o.aB(fe,1,u.transform.zoom),Fi=nt($,u.transform,Pi),$n=o.L();o.ap($n,Fi);const Gn=Zt(W,$,u.transform,Pi),qn=o.aC(q,fe,h,f),cn=q.getProjectionData({overscaledTileID:pe,applyGlobeMatrix:!E,applyTerrainMatrix:!0}),Ks=K&&xe.hasTextData(),Js=i.layout.get("icon-text-fit")!=="none"&&Ks&&xe.hasIconData();if(X){const si=u.style.map.terrain?(Qi,_i)=>u.style.map.terrain.getElevation(pe,Qi,_i):null,Ut=i.layout.get("text-rotation-alignment")==="map";wi(xe,u,l,Fi,$n,W,T,Ut,pe.toUnwrapped(),q.width,q.height,qn,si)}const ss=l&&K||Js,or=X||ss?$u:W?Fi:u.transform.clipSpaceToPixelsMatrix,Zr=Ie&&i.paint.get(l?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let Wn;Wn=Ie?xe.iconsInText?vd($e.kind,Jt,ee,W,X,ss,u,or,Gn,qn,Qt,Li,_e):$a($e.kind,Jt,ee,W,X,ss,u,or,Gn,qn,l,Qt,0,_e):Hl($e.kind,Jt,ee,W,X,ss,u,or,Gn,qn,l,Qt,_e);const _a={program:Ct,buffers:Fe,uniformValues:Wn,projectionData:cn,atlasTexture:Nt,atlasTextureIcon:Tt,atlasInterpolation:Ot,atlasInterpolationIcon:Vt,isSDF:Ie,hasHalo:Zr};if(Y&&xe.canOverlap){ie=!0;const si=Fe.segments.get();for(const Ut of si)oe.push({segments:new o.aL([Ut]),sortKey:Ut.sortKey,state:_a,terrainData:Bt})}else oe.push({segments:Fe.segments,sortKey:0,state:_a,terrainData:Bt})}ie&&oe.sort((pe,fe)=>pe.sortKey-fe.sortKey);for(const pe of oe){const fe=pe.state;if(R.activeTexture.set(O.TEXTURE0),fe.atlasTexture.bind(fe.atlasInterpolation,O.CLAMP_TO_EDGE),fe.atlasTextureIcon&&(R.activeTexture.set(O.TEXTURE1),fe.atlasTextureIcon&&fe.atlasTextureIcon.bind(fe.atlasInterpolationIcon,O.CLAMP_TO_EDGE)),fe.isSDF){const xe=fe.uniformValues;fe.hasHalo&&(xe.u_is_halo=1,Go(fe.buffers,pe.segments,i,u,fe.program,re,M,A,xe,fe.projectionData,pe.terrainData)),xe.u_is_halo=0}Go(fe.buffers,pe.segments,i,u,fe.program,re,M,A,fe.uniformValues,fe.projectionData,pe.terrainData)}}function Go(u,e,i,s,l,h,f,_,x,T,M){const A=s.context;l.draw(A,A.gl.TRIANGLES,h,f,_,at.backCCW,x,M,T,i.id,u.layoutVertexBuffer,u.indexBuffer,e,i.paint,s.transform.zoom,u.programConfigurations.get(i.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function qo(u,e,i,s,l){const h=u.context,f=h.gl,_=it.disabled,x=new bt([f.ONE,f.ONE],o.be.transparent,[!0,!0,!0,!0]),T=e.getBucket(i);if(!T)return;const M=s.key;let A=i.heatmapFbos.get(M);A||(A=Os(h,e.tileSize,e.tileSize),i.heatmapFbos.set(M,A)),h.bindFramebuffer.set(A.framebuffer),h.viewport.set([0,0,e.tileSize,e.tileSize]),h.clear({color:o.be.transparent});const E=T.programConfigurations.get(i.id),R=u.useProgram("heatmap",E,!l),O=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),q=u.style.map.terrain.getTerrainData(s);R.draw(h,f.TRIANGLES,st.disabled,_,x,at.disabled,Ds(e,u.transform.zoom,i.paint.get("heatmap-intensity"),1),q,O,i.id,T.layoutVertexBuffer,T.indexBuffer,T.segments,i.paint,u.transform.zoom,E)}function Wo(u,e,i,s,l){const h=u.context,f=h.gl,_=u.transform;h.setColorMode(u.colorModeForRenderPass());const x=Ho(h,e),T=i.key,M=e.heatmapFbos.get(T);if(!M)return;h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,M.colorAttachment.get()),h.activeTexture.set(f.TEXTURE1),x.bind(f.LINEAR,f.CLAMP_TO_EDGE);const A=_.getProjectionData({overscaledTileID:i,applyTerrainMatrix:l,applyGlobeMatrix:!s});u.useProgram("heatmapTexture").draw(h,f.TRIANGLES,st.disabled,it.disabled,u.colorModeForRenderPass(),at.disabled,Iu(u,e,0,1),null,A,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,_.zoom),M.destroy(),e.heatmapFbos.delete(T)}function Os(u,e,i){var s,l;const h=u.gl,f=h.createTexture();h.bindTexture(h.TEXTURE_2D,f),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,h.CLAMP_TO_EDGE),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,h.LINEAR),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,h.LINEAR);const _=(s=u.HALF_FLOAT)!==null&&s!==void 0?s:h.UNSIGNED_BYTE,x=(l=u.RGBA16F)!==null&&l!==void 0?l:h.RGBA;h.texImage2D(h.TEXTURE_2D,0,x,e,i,0,h.RGBA,_,null);const T=u.createFramebuffer(e,i,!1,!1);return T.colorAttachment.set(f),T}function Ho(u,e){return e.colorRampTexture||(e.colorRampTexture=new o.T(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function ac(u,e,i,s,l){if(!i||!s||!s.imageAtlas)return;const h=s.imageAtlas.patternPositions;let f=h[i.to.toString()],_=h[i.from.toString()];if(!f&&_&&(f=_),!_&&f&&(_=f),!f||!_){const x=l.getPaintProperty(e);f=h[x],_=h[x]}f&&_&&u.setConstantPatternPositions(f,_)}function js(u,e,i,s,l,h,f,_){const x=u.context.gl,T="fill-pattern",M=i.paint.get(T),A=M&&M.constantOr(1),E=i.getCrossfadeParameters();let R,O,q,$,W;const X=u.transform,ee=i.paint.get("fill-translate"),Y=i.paint.get("fill-translate-anchor");f?(O=A&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",R=x.LINES):(O=A?"fillPattern":"fill",R=x.TRIANGLES);const ie=M.constantOr(null);for(const re of s){const K=e.getTile(re);if(A&&!K.patternsLoaded())continue;const oe=K.getBucket(i);if(!oe)continue;const _e=oe.programConfigurations.get(i.id),pe=u.useProgram(O,_e),fe=u.style.map.terrain&&u.style.map.terrain.getTerrainData(re);A&&(u.context.activeTexture.set(x.TEXTURE0),K.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),_e.updatePaintBuffers(E)),ac(_e,T,ie,K,i);const xe=X.getProjectionData({overscaledTileID:re,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),Fe=o.aC(X,K,ee,Y);if(f){$=oe.indexBuffer2,W=oe.segments2;const Ie=[x.drawingBufferWidth,x.drawingBufferHeight];q=O==="fillOutlinePattern"&&A?_d(u,E,K,Ie,Fe):sn(Ie,Fe)}else $=oe.indexBuffer,W=oe.segments,q=A?Fo(u,E,K,Fe):{u_fill_translate:Fe};const Le=u.stencilModeForClipping(re);pe.draw(u.context,R,l,Le,h,at.backCCW,q,fe,xe,i.id,oe.layoutVertexBuffer,$,W,i.paint,u.transform.zoom,_e)}}function Xa(u,e,i,s,l,h,f,_){const x=u.context,T=x.gl,M="fill-extrusion-pattern",A=i.paint.get(M),E=A.constantOr(1),R=i.getCrossfadeParameters(),O=i.paint.get("fill-extrusion-opacity"),q=A.constantOr(null),$=u.transform;for(const W of s){const X=e.getTile(W),ee=X.getBucket(i);if(!ee)continue;const Y=u.style.map.terrain&&u.style.map.terrain.getTerrainData(W),ie=ee.programConfigurations.get(i.id),re=u.useProgram(E?"fillExtrusionPattern":"fillExtrusion",ie);E&&(u.context.activeTexture.set(T.TEXTURE0),X.imageAtlasTexture.bind(T.LINEAR,T.CLAMP_TO_EDGE),ie.updatePaintBuffers(R));const K=$.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!_,applyTerrainMatrix:!0});ac(ie,M,q,X,i);const oe=o.aC($,X,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),_e=i.paint.get("fill-extrusion-vertical-gradient"),pe=E?Ul(u,_e,O,oe,W,R,X):zs(u,_e,O,oe);re.draw(x,x.gl.TRIANGLES,l,h,f,at.backCCW,pe,Y,K,i.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,i.paint,u.transform.zoom,ie,u.style.map.terrain&&ee.centroidVertexBuffer)}}function Ya(u,e,i,s,l,h,f,_,x){var T;const M=u.style.projection,A=u.context,E=u.transform,R=A.gl,O=[`#define NUM_ILLUMINATION_SOURCES ${i.paint.get("hillshade-highlight-color").values.length}`],q=u.useProgram("hillshade",null,!1,O),$=!u.options.moving;for(const W of s){const X=e.getTile(W),ee=X.fbo;if(!ee)continue;const Y=M.getMeshFromTileID(A,W.canonical,_,!0,"raster"),ie=(T=u.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(W);A.activeTexture.set(R.TEXTURE0),R.bindTexture(R.TEXTURE_2D,ee.colorAttachment.get());const re=E.getProjectionData({overscaledTileID:W,aligned:$,applyGlobeMatrix:!x,applyTerrainMatrix:!0});q.draw(A,R.TRIANGLES,h,l[W.overscaledZ],f,at.backCCW,Ua(u,X,i),ie,re,i.id,Y.vertexBuffer,Y.indexBuffer,Y.segments)}}function Ns(u,e,i,s,l,h,f,_,x){var T;const M=u.style.projection,A=u.context,E=u.transform,R=A.gl,O=u.useProgram("colorRelief"),q=!u.options.moving;let $=!0;for(const W of s){const X=e.getTile(W),ee=X.dem;if($){const _e=R.getParameter(R.MAX_TEXTURE_SIZE),{elevationTexture:pe,colorTexture:fe}=i.getColorRampTextures(A,_e,ee.getUnpackVector());A.activeTexture.set(R.TEXTURE1),pe.bind(R.NEAREST,R.CLAMP_TO_EDGE),A.activeTexture.set(R.TEXTURE4),fe.bind(R.LINEAR,R.CLAMP_TO_EDGE),$=!1}if(!ee||!ee.data)continue;const Y=ee.stride,ie=ee.getPixels();if(A.activeTexture.set(R.TEXTURE0),A.pixelStoreUnpackPremultiplyAlpha.set(!1),X.demTexture=X.demTexture||u.getTileTexture(Y),X.demTexture){const _e=X.demTexture;_e.update(ie,{premultiply:!1}),_e.bind(R.LINEAR,R.CLAMP_TO_EDGE)}else X.demTexture=new o.T(A,ie,R.RGBA,{premultiply:!1}),X.demTexture.bind(R.LINEAR,R.CLAMP_TO_EDGE);const re=M.getMeshFromTileID(A,W.canonical,_,!0,"raster"),K=(T=u.style.map.terrain)===null||T===void 0?void 0:T.getTerrainData(W),oe=E.getProjectionData({overscaledTileID:W,aligned:q,applyGlobeMatrix:!x,applyTerrainMatrix:!0});O.draw(A,R.TRIANGLES,h,l[W.overscaledZ],f,at.backCCW,xd(i,X.dem),K,oe,i.id,re.vertexBuffer,re.indexBuffer,re.segments)}}const sc=[new o.P(0,0),new o.P(o.$,0),new o.P(o.$,o.$),new o.P(0,o.$)];function jn(u,e,i,s,l,h,f,_,x=!1,T=!1){const M=s[s.length-1].overscaledZ,A=u.context,E=A.gl,R=u.useProgram("raster"),O=u.transform,q=u.style.projection,$=u.colorModeForRenderPass(),W=!u.options.moving;for(const X of s){const ee=u.getDepthModeForSublayer(X.overscaledZ-M,i.paint.get("raster-opacity")===1?st.ReadWrite:st.ReadOnly,E.LESS),Y=e.getTile(X);Y.registerFadeDuration(i.paint.get("raster-fade-duration"));const ie=e.findLoadedParent(X,0),re=e.findLoadedSibling(X),K=Ed(Y,ie||re||null,e,i,u.transform,u.style.map.terrain);let oe,_e;const pe=i.paint.get("raster-resampling")==="nearest"?E.NEAREST:E.LINEAR;A.activeTexture.set(E.TEXTURE0),Y.texture.bind(pe,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),A.activeTexture.set(E.TEXTURE1),ie?(ie.texture.bind(pe,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),oe=Math.pow(2,ie.tileID.overscaledZ-Y.tileID.overscaledZ),_e=[Y.tileID.canonical.x*oe%1,Y.tileID.canonical.y*oe%1]):Y.texture.bind(pe,E.CLAMP_TO_EDGE,E.LINEAR_MIPMAP_NEAREST),Y.texture.useMipmap&&A.extTextureFilterAnisotropic&&u.transform.pitch>20&&E.texParameterf(E.TEXTURE_2D,A.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,A.extTextureFilterAnisotropicMax);const fe=u.style.map.terrain&&u.style.map.terrain.getTerrainData(X),xe=O.getProjectionData({overscaledTileID:X,aligned:W,applyGlobeMatrix:!T,applyTerrainMatrix:!0}),Fe=ua(_e||[0,0],oe||1,K,i,_),Le=q.getMeshFromTileID(A,X.canonical,h,f,"raster");R.draw(A,E.TRIANGLES,ee,l?l[X.overscaledZ]:it.disabled,$,x?at.frontCCW:at.backCCW,Fe,fe,xe,i.id,Le.vertexBuffer,Le.indexBuffer,Le.segments)}}function Ed(u,e,i,s,l,h){const f=s.paint.get("raster-fade-duration");if(!h&&f>0){const _=Ae.now(),x=(_-u.timeAdded)/f,T=e?(_-e.timeAdded)/f:-1,M=i.getSource(),A=Se(l,{tileSize:M.tileSize,roundZoom:M.roundZoom}),E=!e||Math.abs(e.tileID.overscaledZ-A)>Math.abs(u.tileID.overscaledZ-A),R=E&&u.refreshedUponExpiration?1:o.ag(E?x:1-T,0,1);return u.refreshedUponExpiration&&x>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-R}:{opacity:R,mix:0}}return{opacity:1,mix:0}}const Wu=new o.be(1,0,0,1),Xo=new o.be(0,1,0,1),oc=new o.be(0,0,1,1),Hu=new o.be(1,0,1,1),Xu=new o.be(0,1,1,1);function Vs(u,e,i,s){Ko(u,0,e+i/2,u.transform.width,i,s)}function Yo(u,e,i,s){Ko(u,e-i/2,0,i,u.transform.height,s)}function Ko(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 Yu(u,e,i){const s=u.context,l=s.gl,h=u.useProgram("debug"),f=st.disabled,_=it.disabled,x=u.colorModeForRenderPass(),T="$debug",M=u.style.map.terrain&&u.style.map.terrain.getTerrainData(i);s.activeTexture.set(l.TEXTURE0);const A=e.getTileByID(i.key).latestRawTileData,E=Math.floor((A&&A.byteLength||0)/1024),R=e.getTile(i).tileSize,O=512/Math.min(R,512)*(i.overscaledZ/u.transform.zoom)*.5;let q=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(q+=` => ${i.overscaledZ}`),function(W,X){W.initDebugOverlayCanvas();const ee=W.debugOverlayCanvas,Y=W.context.gl,ie=W.debugOverlayCanvas.getContext("2d");ie.clearRect(0,0,ee.width,ee.height),ie.shadowColor="white",ie.shadowBlur=2,ie.lineWidth=1.5,ie.strokeStyle="white",ie.textBaseline="top",ie.font="bold 36px Open Sans, sans-serif",ie.fillText(X,5,5),ie.strokeText(X,5,5),W.debugOverlayTexture.update(ee),W.debugOverlayTexture.bind(Y.LINEAR,Y.CLAMP_TO_EDGE)}(u,`${q} ${E}kB`);const $=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(s,l.TRIANGLES,f,_,bt.alphaBlended,at.disabled,Cu(o.be.transparent,O),null,$,T,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(s,l.LINE_STRIP,f,_,x,at.disabled,Cu(o.be.red),M,$,T,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function ri(u,e,i,s){const{isRenderingGlobe:l}=s,h=u.context,f=h.gl,_=u.transform,x=u.colorModeForRenderPass(),T=u.getDepthModeFor3D(),M=u.useProgram("terrain");h.bindFramebuffer.set(null),h.viewport.set([0,0,u.width,u.height]);for(const A of i){const E=e.getTerrainMesh(A.tileID),R=u.renderToTexture.getTexture(A),O=e.getTerrainData(A.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,R.texture);const q=e.getMeshFrameDelta(_.zoom),$=_.calculateFogMatrix(A.tileID.toUnwrapped()),W=md(q,$,u.style.sky,_.pitch,l),X=_.getProjectionData({overscaledTileID:A.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});M.draw(h,f.TRIANGLES,T,it.disabled,x,at.backCCW,W,O,X,"terrain",E.vertexBuffer,E.indexBuffer,E.segments)}}function Nn(u,e){if(!e.mesh){const i=new o.aK;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const s=new o.aM;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),e.mesh=new xn(u.createVertexBuffer(i,vn.members),u.createIndexBuffer(s),o.aL.simpleSegment(0,0,i.length,s.length))}return e.mesh}class Ir{constructor(e,i){this.context=new _t(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:o.af(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=Me.maxUnderzooming+Me.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new Eo}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.aK;i.emplaceBack(0,0),i.emplaceBack(o.$,0),i.emplaceBack(0,o.$),i.emplaceBack(o.$,o.$),this.tileExtentBuffer=e.createVertexBuffer(i,vn.members),this.tileExtentSegments=o.aL.simpleSegment(0,0,4,2);const s=new o.aK;s.emplaceBack(0,0),s.emplaceBack(o.$,0),s.emplaceBack(0,o.$),s.emplaceBack(o.$,o.$),this.debugBuffer=e.createVertexBuffer(s,vn.members),this.debugSegments=o.aL.simpleSegment(0,0,4,5);const l=new o.c5;l.emplaceBack(0,0,0,0),l.emplaceBack(o.$,0,o.$,0),l.emplaceBack(0,o.$,0,o.$),l.emplaceBack(o.$,o.$,o.$,o.$),this.rasterBoundsBuffer=e.createVertexBuffer(l,pd.members),this.rasterBoundsSegments=o.aL.simpleSegment(0,0,4,2);const h=new o.aK;h.emplaceBack(0,0),h.emplaceBack(o.$,0),h.emplaceBack(0,o.$),h.emplaceBack(o.$,o.$),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(h,vn.members),this.rasterBoundsSegmentsPosOnly=o.aL.simpleSegment(0,0,4,5);const f=new o.aK;f.emplaceBack(0,0),f.emplaceBack(1,0),f.emplaceBack(0,1),f.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(f,vn.members),this.viewportSegments=o.aL.simpleSegment(0,0,4,2);const _=new o.c6;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const x=new o.aM;x.emplaceBack(1,0,2),x.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(x);const T=this.context.gl;this.stencilClearMode=new it({func:T.ALWAYS,mask:0},0,255,T.ZERO,T.ZERO,T.ZERO),this.tileExtentMesh=new xn(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=o.L();o.bX(s,0,this.width,this.height,0,0,1),o.N(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,st.disabled,this.stencilClearMode,bt.disabled,at.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(bt.disabled),l.setDepthMode(st.disabled);const h={};for(const f of i)h[f.key]=this.nextStencilID++;this._renderTileMasks(h,i,s,!0),this._renderTileMasks(h,i,s,!1),this._tileClippingMaskIDs=h}_renderTileMasks(e,i,s,l){const h=this.context,f=h.gl,_=this.style.projection,x=this.transform,T=this.useProgram("clippingMask");for(const M of i){const A=e[M.key],E=this.style.map.terrain&&this.style.map.terrain.getTerrainData(M),R=_.getMeshFromTileID(this.context,M.canonical,l,!0,"stencil"),O=x.getProjectionData({overscaledTileID:M,applyGlobeMatrix:!s,applyTerrainMatrix:!0});T.draw(h,f.TRIANGLES,st.disabled,new it({func:f.ALWAYS,mask:0},A,255,f.KEEP,f.KEEP,f.REPLACE),bt.disabled,s?at.disabled:at.backCCW,null,E,O,"$clipping",R.vertexBuffer,R.indexBuffer,R.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,s=this.style.projection,l=this.transform,h=this.useProgram("depth"),f=this.getDepthModeFor3D(),_=we(l,{tileSize:l.tileSize});for(const x of _){const T=this.style.map.terrain&&this.style.map.terrain.getTerrainData(x),M=s.getMeshFromTileID(this.context,x.canonical,!0,!0,"raster"),A=l.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(e,i.TRIANGLES,f,it.disabled,bt.disabled,at.backCCW,null,T,A,"$clipping",M.vertexBuffer,M.indexBuffer,M.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new it({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new it({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 it({func:i.GEQUAL,mask:255},_+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[f,s]}return[{[l]:it.disabled},s]}stencilConfigForOverlapTwoPass(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),l=s[s.length-1].overscaledZ,h=s[0].overscaledZ-l+1;if(this.clearStencil(),h>1){const f={},_={};for(let x=0;x<h;x++)f[x+l]=new it({func:i.GREATER,mask:255},h+1+x,255,i.KEEP,i.KEEP,i.REPLACE),_[x+l]=new it({func:i.GREATER,mask:255},1+x,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID=2*h+1,[f,_,s]}return this.nextStencilID=3,[{[l]:new it({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[l]:new it({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},s]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new bt([e.CONSTANT_COLOR,e.ONE],new o.be(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?bt.unblended:bt.alphaBlended}getDepthModeForSublayer(e,i,s){if(!this.opaquePassEnabledForLayer())return st.disabled;const l=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new st(s||this.context.gl.LEQUAL,i,[l,l])}getDepthModeFor3D(){return new st(this.context.gl.LEQUAL,st.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(Ae.now()),this.imageManager.beginFrame();const h=this.style._order,f=this.style.sourceCaches,_={},x={},T={},M={isRenderingToTexture:!1,isRenderingGlobe:((s=e.projection)===null||s===void 0?void 0:s.transitionState)>0};for(const E in f){const R=f[E];R.used&&R.prepare(this.context),_[E]=R.getVisibleCoordinates(!1),x[E]=_[E].slice().reverse(),T[E]=R.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let E=0;E<h.length;E++)if(this.style._layers[h[E]].is3D()){this.opaquePassCutoff=E;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const E of h){const R=this.style._layers[E];if(!R.hasOffscreenPass()||R.isHidden(this.transform.zoom))continue;const O=x[R.source];(R.type==="custom"||O.length)&&this.renderLayer(this,f[R.source],R,O,M)}if((l=this.style.projection)===null||l===void 0||l.updateGPUdependent({context:this.context,useProgram:E=>this.useProgram(E)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?o.be.black:o.be.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(E,R){const O=E.context,q=O.gl,$=((re,K,oe)=>{const _e=Math.cos(K.rollInRadians),pe=Math.sin(K.rollInRadians),fe=V(K),xe=K.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:re.properties.get("sky-color"),u_horizon_color:re.properties.get("horizon-color"),u_horizon:[(K.width/2-fe*pe)*oe,(K.height/2+fe*_e)*oe],u_horizon_normal:[-pe,_e],u_sky_horizon_blend:re.properties.get("sky-horizon-blend")*K.height/2*oe,u_sky_blend:xe}})(R,E.style.map.transform,E.pixelRatio),W=new st(q.LEQUAL,st.ReadWrite,[0,1]),X=it.disabled,ee=E.colorModeForRenderPass(),Y=E.useProgram("sky"),ie=Nn(O,R);Y.draw(O,q.TRIANGLES,W,X,ee,at.disabled,$,null,void 0,"sky",ie.vertexBuffer,ie.indexBuffer,ie.segments)}(this,this.style.sky),this._showOverdrawInspector=i.showOverdrawInspector,this.depthRangeFor3D=[0,1-(e._order.length+2)*this.numSublayers*this.depthEpsilon],!this.renderToTexture)for(this.renderPass="opaque",this.currentLayer=h.length-1;this.currentLayer>=0;this.currentLayer--){const E=this.style._layers[h[this.currentLayer]],R=f[E.source],O=_[E.source];this._renderTileClippingMasks(E,O,!1),this.renderLayer(this,R,E,O,M)}this.renderPass="translucent";let A=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const E=this.style._layers[h[this.currentLayer]],R=f[E.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(E,M))continue;this.opaquePassEnabledForLayer()||A||(A=!0,M.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const O=(E.type==="symbol"?T:x)[E.source];this._renderTileClippingMasks(E,_[E.source],!!this.renderToTexture),this.renderLayer(this,R,E,O,M)}if(M.isRenderingGlobe&&function(E,R,O){const q=E.context,$=q.gl,W=E.useProgram("atmosphere"),X=new st($.LEQUAL,st.ReadOnly,[0,1]),ee=E.transform,Y=function(xe,Fe){const Le=xe.properties.get("position"),Ie=[-Le.x,-Le.y,-Le.z],$e=o.af(new Float64Array(16));return xe.properties.get("anchor")==="map"&&(o.b5($e,$e,Fe.rollInRadians),o.b6($e,$e,-Fe.pitchInRadians),o.b5($e,$e,Fe.bearingInRadians),o.b6($e,$e,Fe.center.lat*Math.PI/180),o.by($e,$e,-Fe.center.lng*Math.PI/180)),o.c4(Ie,Ie,$e),Ie}(O,E.transform),ie=ee.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),re=R.properties.get("atmosphere-blend")*ie.projectionTransition;if(re===0)return;const K=Ba(ee.worldSize,ee.center.lat),oe=ee.inverseProjectionMatrix,_e=new Float64Array(4);_e[3]=1,o.av(_e,_e,ee.modelViewProjectionMatrix),_e[0]/=_e[3],_e[1]/=_e[3],_e[2]/=_e[3],_e[3]=1,o.av(_e,_e,oe),_e[0]/=_e[3],_e[1]/=_e[3],_e[2]/=_e[3],_e[3]=1;const pe=((xe,Fe,Le,Ie,$e)=>({u_sun_pos:xe,u_atmosphere_blend:Fe,u_globe_position:Le,u_globe_radius:Ie,u_inv_proj_matrix:$e}))(Y,re,[_e[0],_e[1],_e[2]],K,oe),fe=Nn(q,R);W.draw(q,$.TRIANGLES,X,it.disabled,bt.alphaBlended,at.disabled,pe,null,null,"atmosphere",fe.vertexBuffer,fe.indexBuffer,fe.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const E=function(R,O){let q=null;const $=Object.values(R._layers).flatMap(Y=>Y.source&&!Y.isHidden(O)?[R.sourceCaches[Y.source]]:[]),W=$.filter(Y=>Y.getSource().type==="vector"),X=$.filter(Y=>Y.getSource().type!=="vector"),ee=Y=>{(!q||q.getSource().maxzoom<Y.getSource().maxzoom)&&(q=Y)};return W.forEach(Y=>ee(Y)),q||X.forEach(Y=>ee(Y)),q}(this.style,this.transform.zoom);E&&function(R,O,q){for(let $=0;$<q.length;$++)Yu(R,O,q[$])}(this,E,E.getVisibleCoordinates())}this.options.showPadding&&function(E){const R=E.transform.padding;Vs(E,E.transform.height-(R.top||0),3,Wu),Vs(E,R.bottom||0,3,Xo),Yo(E,R.left||0,3,oc),Yo(E,E.transform.width-(R.right||0),3,Hu);const O=E.transform.centerPoint;(function(q,$,W,X){Ko(q,$-1,W-10,2,20,X),Ko(q,$-10,W-1,20,2,X)})(E,O.x,E.transform.height-O.y,Xu)}(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.c7(i,s):!o.c8(i,s)),l||(l=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),l&&(o.c9(i,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,f){const _=h.context,x=_.gl,T=h.transform,M=bt.unblended,A=new st(x.LEQUAL,st.ReadWrite,[0,1]),E=f.sourceCache.getRenderableTiles(),R=h.useProgram("terrainDepth");_.bindFramebuffer.set(f.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:o.be.transparent,depth:1});for(const O of E){const q=f.getTerrainMesh(O.tileID),$=f.getTerrainData(O.tileID),W=T.getProjectionData({overscaledTileID:O.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),X={u_ele_delta:f.getMeshFrameDelta(T.zoom)};R.draw(_,x.TRIANGLES,A,it.disabled,M,at.backCCW,X,$,W,"terrain",q.vertexBuffer,q.indexBuffer,q.segments)}_.bindFramebuffer.set(null),_.viewport.set([0,0,h.width,h.height])}(this,this.style.map.terrain),function(h,f){const _=h.context,x=_.gl,T=h.transform,M=bt.unblended,A=new st(x.LEQUAL,st.ReadWrite,[0,1]),E=f.getCoordsTexture(),R=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.be.transparent,depth:1}),f.coordsIndex=[];for(const q of R){const $=f.getTerrainMesh(q.tileID),W=f.getTerrainData(q.tileID);_.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,E.texture);const X={u_terrain_coords_id:(255-f.coordsIndex.length)/255,u_texture:0,u_ele_delta:f.getMeshFrameDelta(T.zoom)},ee=T.getProjectionData({overscaledTileID:q.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});O.draw(_,x.TRIANGLES,A,it.disabled,M,at.backCCW,X,W,ee,"terrain",$.vertexBuffer,$.indexBuffer,$.segments),f.coordsIndex.push(q.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.ca(s)?function(f,_,x,T,M,A){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:E}=A,R=it.disabled,O=f.colorModeForRenderPass();(x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(q,$,W,X,ee,Y,ie,re,K){const oe=$.transform,_e=$.style.map.terrain,pe=ee==="map",fe=Y==="map";for(const xe of q){const Fe=X.getTile(xe),Le=Fe.getBucket(W);if(!Le||!Le.text||!Le.text.segments.get().length)continue;const Ie=o.am(Le.textSizeData,oe.zoom),$e=o.aB(Fe,1,$.transform.zoom),ot=nt(pe,$.transform,$e),Ct=W.layout.get("icon-text-fit")!=="none"&&Le.hasIconData();if(Ie){const Jt=Math.pow(2,oe.zoom-Fe.tileID.overscaledZ),Bt=_e?(Qt,Nt)=>_e.getElevation(xe,Qt,Nt):null;Id(Le,pe,fe,K,oe,ot,Jt,Ie,Ct,o.aC(oe,Fe,ie,re),xe.toUnwrapped(),Bt)}}}(T,f,x,_,x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),M),x.paint.get("icon-opacity").constantOr(1)!==0&&qu(f,_,x,T,!1,x.paint.get("icon-translate"),x.paint.get("icon-translate-anchor"),x.layout.get("icon-rotation-alignment"),x.layout.get("icon-pitch-alignment"),x.layout.get("icon-keep-upright"),R,O,E),x.paint.get("text-opacity").constantOr(1)!==0&&qu(f,_,x,T,!0,x.paint.get("text-translate"),x.paint.get("text-translate-anchor"),x.layout.get("text-rotation-alignment"),x.layout.get("text-pitch-alignment"),x.layout.get("text-keep-upright"),R,O,E),_.map.showCollisionBoxes&&(Uu(f,_,x,T,!0),Uu(f,_,x,T,!1))}(e,i,s,l,this.style.placement.variableOffsets,h):o.cb(s)?function(f,_,x,T,M){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=M,E=x.paint.get("circle-opacity"),R=x.paint.get("circle-stroke-width"),O=x.paint.get("circle-stroke-opacity"),q=!x.layout.get("circle-sort-key").isConstant();if(E.constantOr(1)===0&&(R.constantOr(1)===0||O.constantOr(1)===0))return;const $=f.context,W=$.gl,X=f.transform,ee=f.getDepthModeForSublayer(0,st.ReadOnly),Y=it.disabled,ie=f.colorModeForRenderPass(),re=[],K=X.getCircleRadiusCorrection();for(let oe=0;oe<T.length;oe++){const _e=T[oe],pe=_.getTile(_e),fe=pe.getBucket(x);if(!fe)continue;const xe=x.paint.get("circle-translate"),Fe=x.paint.get("circle-translate-anchor"),Le=o.aC(X,pe,xe,Fe),Ie=fe.programConfigurations.get(x.id),$e=f.useProgram("circle",Ie),ot=fe.layoutVertexBuffer,Ct=fe.indexBuffer,Jt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(_e),Bt={programConfiguration:Ie,program:$e,layoutVertexBuffer:ot,indexBuffer:Ct,uniformValues:$l(f,pe,x,Le,K),terrainData:Jt,projectionData:X.getProjectionData({overscaledTileID:_e,applyGlobeMatrix:!A,applyTerrainMatrix:!0})};if(q){const Qt=fe.segments.get();for(const Nt of Qt)re.push({segments:new o.aL([Nt]),sortKey:Nt.sortKey,state:Bt})}else re.push({segments:fe.segments,sortKey:0,state:Bt})}q&&re.sort((oe,_e)=>oe.sortKey-_e.sortKey);for(const oe of re){const{programConfiguration:_e,program:pe,layoutVertexBuffer:fe,indexBuffer:xe,uniformValues:Fe,terrainData:Le,projectionData:Ie}=oe.state;pe.draw($,W.TRIANGLES,ee,Y,ie,at.backCCW,Fe,Le,Ie,x.id,fe,xe,oe.segments,x.paint,f.transform.zoom,_e)}}(e,i,s,l,h):o.cc(s)?function(f,_,x,T,M){if(x.paint.get("heatmap-opacity")===0)return;const A=f.context,{isRenderingToTexture:E,isRenderingGlobe:R}=M;if(f.style.map.terrain){for(const O of T){const q=_.getTile(O);_.hasRenderableParent(O)||(f.renderPass==="offscreen"?qo(f,q,x,O,R):f.renderPass==="translucent"&&Wo(f,x,O,E,R))}A.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(O,q,$,W){const X=O.context,ee=X.gl,Y=O.transform,ie=it.disabled,re=new bt([ee.ONE,ee.ONE],o.be.transparent,[!0,!0,!0,!0]);(function(K,oe,_e){const pe=K.gl;K.activeTexture.set(pe.TEXTURE1),K.viewport.set([0,0,oe.width/4,oe.height/4]);let fe=_e.heatmapFbos.get(o.c1);fe?(pe.bindTexture(pe.TEXTURE_2D,fe.colorAttachment.get()),K.bindFramebuffer.set(fe.framebuffer)):(fe=Os(K,oe.width/4,oe.height/4),_e.heatmapFbos.set(o.c1,fe))})(X,O,$),X.clear({color:o.be.transparent});for(let K=0;K<W.length;K++){const oe=W[K];if(q.hasRenderableParent(oe))continue;const _e=q.getTile(oe),pe=_e.getBucket($);if(!pe)continue;const fe=pe.programConfigurations.get($.id),xe=O.useProgram("heatmap",fe),Fe=Y.getProjectionData({overscaledTileID:oe,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Le=Y.getCircleRadiusCorrection();xe.draw(X,ee.TRIANGLES,st.disabled,ie,re,at.backCCW,Ds(_e,Y.zoom,$.paint.get("heatmap-intensity"),Le),null,Fe,$.id,pe.layoutVertexBuffer,pe.indexBuffer,pe.segments,$.paint,Y.zoom,fe)}X.viewport.set([0,0,O.width,O.height])}(f,_,x,T):f.renderPass==="translucent"&&function(O,q){const $=O.context,W=$.gl;$.setColorMode(O.colorModeForRenderPass());const X=q.heatmapFbos.get(o.c1);X&&($.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,X.colorAttachment.get()),$.activeTexture.set(W.TEXTURE1),Ho($,q).bind(W.LINEAR,W.CLAMP_TO_EDGE),O.useProgram("heatmapTexture").draw($,W.TRIANGLES,st.disabled,it.disabled,O.colorModeForRenderPass(),at.disabled,Iu(O,q,0,1),null,null,q.id,O.viewportBuffer,O.quadTriangleIndexBuffer,O.viewportSegments,q.paint,O.transform.zoom))}(f,x)}(e,i,s,l,h):o.cd(s)?function(f,_,x,T,M){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=M,E=x.paint.get("line-opacity"),R=x.paint.get("line-width");if(E.constantOr(1)===0||R.constantOr(1)===0)return;const O=f.getDepthModeForSublayer(0,st.ReadOnly),q=f.colorModeForRenderPass(),$=x.paint.get("line-dasharray"),W=x.paint.get("line-pattern"),X=W.constantOr(1),ee=x.paint.get("line-gradient"),Y=x.getCrossfadeParameters(),ie=X?"linePattern":$?"lineSDF":ee?"lineGradient":"line",re=f.context,K=re.gl,oe=f.transform;let _e=!0;for(const pe of T){const fe=_.getTile(pe);if(X&&!fe.patternsLoaded())continue;const xe=fe.getBucket(x);if(!xe)continue;const Fe=xe.programConfigurations.get(x.id),Le=f.context.program.get(),Ie=f.useProgram(ie,Fe),$e=_e||Ie.program!==Le,ot=f.style.map.terrain&&f.style.map.terrain.getTerrainData(pe),Ct=W.constantOr(null);if(Ct&&fe.imageAtlas){const Ot=fe.imageAtlas,Vt=Ot.patternPositions[Ct.to.toString()],Li=Ot.patternPositions[Ct.from.toString()];Vt&&Li&&Fe.setConstantPatternPositions(Vt,Li)}const Jt=oe.getProjectionData({overscaledTileID:pe,applyGlobeMatrix:!A,applyTerrainMatrix:!0}),Bt=oe.getPixelScale(),Qt=X?Au(f,fe,x,Bt,Y):$?zu(f,fe,x,Bt,$,Y):ee?Gl(f,fe,x,Bt,xe.lineClipsArray.length):Bo(f,fe,x,Bt);if(X)re.activeTexture.set(K.TEXTURE0),fe.imageAtlasTexture.bind(K.LINEAR,K.CLAMP_TO_EDGE),Fe.updatePaintBuffers(Y);else if($&&($e||f.lineAtlas.dirty))re.activeTexture.set(K.TEXTURE0),f.lineAtlas.bind(re);else if(ee){const Ot=xe.gradients[x.id];let Vt=Ot.texture;if(x.gradientVersion!==Ot.version){let Li=256;if(x.stepInterpolant){const Tt=_.getSource().maxzoom,Pi=pe.canonical.z===Tt?Math.ceil(1<<f.transform.maxZoom-pe.canonical.z):1;Li=o.ag(o.c2(xe.maxLineLength/o.$*1024*Pi),256,re.maxTextureSize)}Ot.gradient=o.c3({expression:x.gradientExpression(),evaluationKey:"lineProgress",resolution:Li,image:Ot.gradient||void 0,clips:xe.lineClipsArray}),Ot.texture?Ot.texture.update(Ot.gradient):Ot.texture=new o.T(re,Ot.gradient,K.RGBA),Ot.version=x.gradientVersion,Vt=Ot.texture}re.activeTexture.set(K.TEXTURE0),Vt.bind(x.stepInterpolant?K.NEAREST:K.LINEAR,K.CLAMP_TO_EDGE)}const Nt=f.stencilModeForClipping(pe);Ie.draw(re,K.TRIANGLES,O,Nt,q,at.disabled,Qt,ot,Jt,x.id,xe.layoutVertexBuffer,xe.indexBuffer,xe.segments,x.paint,f.transform.zoom,Fe,xe.layoutVertexBuffer2),_e=!1}}(e,i,s,l,h):o.ce(s)?function(f,_,x,T,M){const A=x.paint.get("fill-color"),E=x.paint.get("fill-opacity");if(E.constantOr(1)===0)return;const{isRenderingToTexture:R}=M,O=f.colorModeForRenderPass(),q=x.paint.get("fill-pattern"),$=f.opaquePassEnabledForLayer()&&!q.constantOr(1)&&A.constantOr(o.be.transparent).a===1&&E.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===$){const W=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?st.ReadWrite:st.ReadOnly);js(f,_,x,T,W,O,!1,R)}if(f.renderPass==="translucent"&&x.paint.get("fill-antialias")){const W=f.getDepthModeForSublayer(x.getPaintProperty("fill-outline-color")?2:0,st.ReadOnly);js(f,_,x,T,W,O,!0,R)}}(e,i,s,l,h):o.cf(s)?function(f,_,x,T,M){const A=x.paint.get("fill-extrusion-opacity");if(A===0)return;const{isRenderingToTexture:E}=M;if(f.renderPass==="translucent"){const R=new st(f.context.gl.LEQUAL,st.ReadWrite,f.depthRangeFor3D);if(A!==1||x.paint.get("fill-extrusion-pattern").constantOr(1))Xa(f,_,x,T,R,it.disabled,bt.disabled,E),Xa(f,_,x,T,R,f.stencilModeFor3D(),f.colorModeForRenderPass(),E);else{const O=f.colorModeForRenderPass();Xa(f,_,x,T,R,it.disabled,O,E)}}}(e,i,s,l,h):o.cg(s)?function(f,_,x,T,M){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:A}=M,E=f.context,R=f.style.projection.useSubdivision,O=f.getDepthModeForSublayer(0,st.ReadOnly),q=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function($,W,X,ee,Y,ie,re){const K=$.context,oe=K.gl;for(const _e of X){const pe=W.getTile(_e),fe=pe.dem;if(!fe||!fe.data||!pe.needsHillshadePrepare)continue;const xe=fe.dim,Fe=fe.stride,Le=fe.getPixels();if(K.activeTexture.set(oe.TEXTURE1),K.pixelStoreUnpackPremultiplyAlpha.set(!1),pe.demTexture=pe.demTexture||$.getTileTexture(Fe),pe.demTexture){const $e=pe.demTexture;$e.update(Le,{premultiply:!1}),$e.bind(oe.NEAREST,oe.CLAMP_TO_EDGE)}else pe.demTexture=new o.T(K,Le,oe.RGBA,{premultiply:!1}),pe.demTexture.bind(oe.NEAREST,oe.CLAMP_TO_EDGE);K.activeTexture.set(oe.TEXTURE0);let Ie=pe.fbo;if(!Ie){const $e=new o.T(K,{width:xe,height:xe,data:null},oe.RGBA);$e.bind(oe.LINEAR,oe.CLAMP_TO_EDGE),Ie=pe.fbo=K.createFramebuffer(xe,xe,!0,!1),Ie.colorAttachment.set($e.texture)}K.bindFramebuffer.set(Ie.framebuffer),K.viewport.set([0,0,xe,xe]),$.useProgram("hillshadePrepare").draw(K,oe.TRIANGLES,Y,ie,re,at.disabled,yd(pe.tileID,fe),null,null,ee.id,$.rasterBoundsBuffer,$.quadTriangleIndexBuffer,$.rasterBoundsSegments),pe.needsHillshadePrepare=!1}})(f,_,T,x,O,it.disabled,q),E.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(R){const[$,W,X]=f.stencilConfigForOverlapTwoPass(T);Ya(f,_,x,X,$,O,q,!1,A),Ya(f,_,x,X,W,O,q,!0,A)}else{const[$,W]=f.getStencilConfigForOverlapAndUpdateStencilID(T);Ya(f,_,x,W,$,O,q,!1,A)}}(e,i,s,l,h):o.ch(s)?function(f,_,x,T,M){if(f.renderPass!=="translucent"||!T.length)return;const{isRenderingToTexture:A}=M,E=f.style.projection.useSubdivision,R=f.getDepthModeForSublayer(0,st.ReadOnly),O=f.colorModeForRenderPass();if(E){const[q,$,W]=f.stencilConfigForOverlapTwoPass(T);Ns(f,_,x,W,q,R,O,!1,A),Ns(f,_,x,W,$,R,O,!0,A)}else{const[q,$]=f.getStencilConfigForOverlapAndUpdateStencilID(T);Ns(f,_,x,$,q,R,O,!1,A)}}(e,i,s,l,h):o.ci(s)?function(f,_,x,T,M){if(f.renderPass!=="translucent"||x.paint.get("raster-opacity")===0||!T.length)return;const{isRenderingToTexture:A}=M,E=_.getSource(),R=f.style.projection.useSubdivision;if(E instanceof rr)jn(f,_,x,T,null,!1,!1,E.tileCoords,E.flippedWindingOrder,A);else if(R){const[O,q,$]=f.stencilConfigForOverlapTwoPass(T);jn(f,_,x,$,O,!1,!0,sc,!1,A),jn(f,_,x,$,q,!0,!0,sc,!1,A)}else{const[O,q]=f.getStencilConfigForOverlapAndUpdateStencilID(T);jn(f,_,x,q,O,!1,!0,sc,!1,A)}}(e,i,s,l,h):o.cj(s)?function(f,_,x,T,M){const A=x.paint.get("background-color"),E=x.paint.get("background-opacity");if(E===0)return;const{isRenderingToTexture:R}=M,O=f.context,q=O.gl,$=f.style.projection,W=f.transform,X=W.tileSize,ee=x.paint.get("background-pattern");if(f.isPatternMissing(ee))return;const Y=!ee&&A.a===1&&E===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==Y)return;const ie=it.disabled,re=f.getDepthModeForSublayer(0,Y==="opaque"?st.ReadWrite:st.ReadOnly),K=f.colorModeForRenderPass(),oe=f.useProgram(ee?"backgroundPattern":"background"),_e=T||we(W,{tileSize:X,terrain:f.style.map.terrain});ee&&(O.activeTexture.set(q.TEXTURE0),f.imageManager.bind(f.context));const pe=x.getCrossfadeParameters();for(const fe of _e){const xe=W.getProjectionData({overscaledTileID:fe,applyGlobeMatrix:!R,applyTerrainMatrix:!0}),Fe=ee?bd(E,f,ee,{tileID:fe,tileSize:X},pe):Oo(E,A),Le=f.style.map.terrain&&f.style.map.terrain.getTerrainData(fe),Ie=$.getMeshFromTileID(O,fe.canonical,!1,!0,"raster");oe.draw(O,q.TRIANGLES,re,ie,K,at.backCCW,Fe,Le,xe,x.id,Ie.vertexBuffer,Ie.indexBuffer,Ie.segments)}}(e,0,s,l,h):o.ck(s)&&function(f,_,x,T){const{isRenderingGlobe:M}=T,A=f.context,E=x.implementation,R=f.style.projection,O=f.transform,q=O.getProjectionDataForCustomLayer(M),$={farZ:O.farZ,nearZ:O.nearZ,fov:O.fov*Math.PI/180,modelViewProjectionMatrix:O.modelViewProjectionMatrix,projectionMatrix:O.projectionMatrix,shaderData:{variantName:R.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
|
|
749
|
-
uniform mat4 u_projection_matrix;
|
|
750
|
-
${R.shaderPreludeCode.vertexSource}`,define:R.shaderDefine},defaultProjectionData:q},W=E.renderingMode?E.renderingMode:"2d";if(f.renderPass==="offscreen"){const X=E.prerender;X&&(f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),X.call(E,A.gl,$),A.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),A.setColorMode(f.colorModeForRenderPass()),A.setStencilMode(it.disabled);const X=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,st.ReadOnly);A.setDepthMode(X),E.render(A.gl,$),A.setDirty(),f.setBaseState(),A.bindFramebuffer.set(null)}}(e,0,s,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!i||!s}useProgram(e,i,s=!1,l=[]){this.cache=this.cache||{};const h=!!this.style.map.terrain,f=this.style.projection,_=s?nn.projectionMercator:f.shaderPreludeCode,x=s?oa:f.shaderDefine,T=e+(i?i.cacheKey:"")+`/${s?Fl:f.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(h?"/terrain":"")+(l?`/${l.join("/")}`:"");return this.cache[T]||(this.cache[T]=new Do(this.context,nn[e],i,Du[e],this._showOverdrawInspector,h,_,x,l)),this.cache[T]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new o.T(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 Jo(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 Zs{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=Jo(this._updateHashUnthrottled,300),this._hashName=e&&encodeURIComponent(e)}addTo(e){return this._map=e,addEventListener("hashchange",this._onHashChange,!1),this._map.on("moveend",this._updateHash),this}remove(){return removeEventListener("hashchange",this._onHashChange,!1),this._map.off("moveend",this._updateHash),clearTimeout(this._updateHash()),this._removeHash(),delete this._map,this}getHashString(e){const i=this._map.getCenter(),s=Math.round(100*this._map.getZoom())/100,l=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,l),f=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,x=this._map.getBearing(),T=this._map.getPitch();let M="";if(M+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(x||T)&&(M+="/"+Math.round(10*x)/10),T&&(M+=`/${Math.round(T)}`),this._hashName){const A=this._hashName;let E=!1;const R=window.location.hash.slice(1).split("&").map(O=>{const q=O.split("=")[0];return q===A?(E=!0,`${q}=${M}`):O}).filter(O=>O);return E||R.push(`${A}=${M}`),`#${R.join("&")}`}return`#${M}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new o.S(+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 Ka={linearity:.3,easing:o.cl(0,0,.3,1)},Ja=o.e({deceleration:2500,maxSpeed:1400},Ka),lc=o.e({deceleration:20,maxSpeed:1400},Ka),Us=o.e({deceleration:1e3,maxSpeed:360},Ka),cc=o.e({deceleration:1e3,maxSpeed:90},Ka),Ku=o.e({deceleration:1e3,maxSpeed:360},Ka);class Ju{constructor(e){this._map=e,this.clear()}clear(){this._inertiaBuffer=[]}record(e){this._drainInertiaBuffer(),this._inertiaBuffer.push({time:Ae.now(),settings:e})}_drainInertiaBuffer(){const e=this._inertiaBuffer,i=Ae.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=es(i.pan.mag(),s,o.e({},Ja,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);l.center=_.easingCenter,l.offset=_.easingOffset,Qa(l,h)}if(i.zoom){const h=es(i.zoom,s,lc);l.zoom=this._map.transform.zoom+h.amount,Qa(l,h)}if(i.bearing){const h=es(i.bearing,s,Us);l.bearing=this._map.transform.bearing+o.ag(h.amount,-179,179),Qa(l,h)}if(i.pitch){const h=es(i.pitch,s,cc);l.pitch=this._map.transform.pitch+h.amount,Qa(l,h)}if(i.roll){const h=es(i.roll,s,Ku);l.roll=this._map.transform.roll+o.ag(h.amount,-179,179),Qa(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 Qa(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function es(u,e,i){const{maxSpeed:s,linearity:l,deceleration:h}=i,f=o.ag(u*l/(e/1e3),-s,s),_=Math.abs(f)/(h*l);return{easing:i.easing,duration:1e3*_,amount:f*(_/2)}}class sr 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=ce.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 Nr 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=ce.touchPos(i.getCanvasContainer(),l),f=h.map(x=>i.unproject(x)),_=h.reduce((x,T,M,A)=>x.add(T.div(A.length)),new o.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class uc extends o.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class Qu{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new uc(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new sr(e.type,this._map,e))}mouseup(e){this._map.fire(new sr(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new sr(e.type,this._map,e))}dblclick(e){return this._firePreventable(new sr(e.type,this._map,e))}mouseover(e){this._map.fire(new sr(e.type,this._map,e))}mouseout(e){this._map.fire(new sr(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Nr(e.type,this._map,e))}touchmove(e){this._map.fire(new Nr(e.type,this._map,e))}touchend(e){this._map.fire(new Nr(e.type,this._map,e))}touchcancel(e){this._map.fire(new Nr(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class eh{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new sr(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new sr("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new sr(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class ts{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 hc{constructor(e,i){this._map=e,this._tr=new ts(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&&(ce.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=ce.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(l.x,s.x),f=Math.max(l.x,s.x),_=Math.min(l.y,s.y),x=Math.max(l.y,s.y);ce.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,l=i;if(this.reset(),ce.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&&(ce.remove(this._box),this._box=null),ce.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new o.l(e,{originalEvent:i}))}}function Qo(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 th{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=Qo(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const l=Qo(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 el{constructor(e){this.singleTap=new th(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 tl{constructor(e){this._tr=new ts(e),this._zoomIn=new el({numTouches:1,numTaps:2}),this._zoomOut=new el({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 is{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&&ce.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 Er=0,Vr=2,ih={[Er]:1,[Vr]:2};class Ki{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=ce.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const l=ih[s];return i.buttons===void 0||(i.buttons&l)!==l}(e,this._eventButton)}isValidEndEvent(e){return ce.mouseButton(e)===this._eventButton}}class rs{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 Ad{constructor(e=new Ki({checkCorrectEvent:()=>!0}),i=new rs){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 il=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class zd{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=Qo(s,i),h=new o.P(0,0),f=new o.P(0,0);let _=0;for(const T in l){const M=l[T],A=this._touches[T];A&&(h._add(M),f._add(M.sub(A)),_++,l[T]=M)}if(this._touches=l,this._shouldBePrevented(_)||!f.mag())return;const x=f.div(_);return this._sum._add(x),this._sum.mag()<this._clickTolerance?void 0:{around:h.div(_),panDelta:x}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class dc{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 x=this._aroundCenter?null:f.add(_).div(2);return this._move([f,_],x,e)}touchend(e,i,s){if(!this._firstTwoTouches)return;const[l,h]=this._firstTwoTouches,f=$s(s,i,l),_=$s(s,i,h);f&&_||(this._active&&ce.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 ns(u,e){return Math.log(u/e)/Math.LN2}class on extends dc{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(ns(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:ns(this._distance,s),pinchAround:i}}}function Ze(u,e){return 180*u.angleWith(e)/Math.PI}class pc extends dc{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:Ze(this._vector,l),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=Ze(e,this._startVector);return Math.abs(s)<i}}function Gs(u){return Math.abs(u.y)>Math.abs(u.x)}class fc extends dc{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,Gs(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 Gs(e)&&Gs(i)&&f}}const qs={panStep:100,bearingStep:15,pitchStep:10};class as{constructor(e){this._tr=new ts(e);const i=qs;this._panStep=i.panStep,this._bearingStep=i.bearingStep,this._pitchStep=i.pitchStep,this._rotationDisabled=!1}reset(){this._active=!1}keydown(e){if(e.altKey||e.ctrlKey||e.metaKey)return;let i=0,s=0,l=0,h=0,f=0;switch(e.keyCode){case 61:case 107:case 171:case 187:i=1;break;case 189:case 109:case 173:i=-1;break;case 37:e.shiftKey?s=-1:(e.preventDefault(),h=-1);break;case 39:e.shiftKey?s=1:(e.preventDefault(),h=1);break;case 38:e.shiftKey?l=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?l=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,l=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:mc,zoom:i?Math.round(x.zoom)+i*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+l*this._pitchStep,offset:[-h*this._panStep,-f*this._panStep],center:x.center},{originalEvent:e})}}}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}disableRotation(){this._rotationDisabled=!0}enableRotation(){this._rotationDisabled=!1}}function mc(u){return u*(2-u)}const yt=4.000244140625,gc=1/450;class rh{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new ts(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=gc}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=Ae.now(),l=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%yt==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=ce.mousePos(this._map.getCanvas(),e),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(o.S.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)>yt?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const T=typeof this._targetZoom!="number"?e.scale:o.ae(this._targetZoom);this._targetZoom=e.getConstrained(e.getCameraLngLat(),o.aj(T*x)).zoom,this._type==="wheel"&&(this._startZoom=e.zoom,this._easing=this._smoothOutEasing(200)),this._delta=0}const i=typeof this._targetZoom!="number"?e.zoom:this._targetZoom,s=this._startZoom,l=this._easing;let h,f=!1;if(this._type==="wheel"&&s&&l){const _=Ae.now()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),T=l(x);h=o.C.number(s,i,T),x<1?this._frameId||(this._frameId=!0):f=!0}else h=i,f=!0;return this._active=!0,f&&(this._active=!1,this._finishTimeout=setTimeout(()=>{this._zooming=!1,this._triggerRenderFrame(),delete this._targetZoom,delete this._lastExpectedZoom,delete this._finishTimeout},200)),this._lastExpectedZoom=h,{noInertia:!0,needsRenderFrame:!f,zoomDelta:h-e.zoom,around:this._aroundPoint,originalEvent:this._lastWheelEvent}}_smoothOutEasing(e){let i=o.cn;if(this._prevEase){const s=this._prevEase,l=(Ae.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.cl(f,_,.25,1)}return this._prevEase={start:Ae.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 rl{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 kd{constructor(e){this._tr=new ts(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 Rd{constructor(){this._tap=new el({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 _c{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 nl{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 yc{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 nh{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=ce.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&&(ce.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 Ws=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Dd extends o.l{}function xc(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class Vn{constructor(e,i){this.handleWindowEvent=l=>{this.handleEvent(l,`${l.type}Window`)},this.handleEvent=(l,h)=>{if(l.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=l.type==="renderFrame"?void 0:l,_={needsRenderFrame:!1},x={},T={};for(const{handlerName:E,handler:R,allowed:O}of this._handlers){if(!R.isEnabled())continue;let q;if(this._blockedByActive(T,O,E))R.reset();else if(R[h||l.type]){if(o.co(l,h||l.type)){const $=ce.mousePos(this._map.getCanvas(),l);q=R[h||l.type](l,$)}else if(o.cp(l,h||l.type)){const $=this._getMapTouches(l.touches),W=ce.touchPos(this._map.getCanvas(),$);q=R[h||l.type](l,W,$)}else o.cq(h||l.type)||(q=R[h||l.type](l));this.mergeHandlerResult(_,x,q,E,f),q&&q.needsRenderFrame&&this._triggerRenderFrame()}(q||R.isActive())&&(T[E]=R)}const M={};for(const E in this._previousActiveHandlers)T[E]||(M[E]=f);this._previousActiveHandlers=T,(Object.keys(M).length||xc(_))&&(this._changes.push([_,x,M]),this._triggerRenderFrame()),(Object.keys(T).length||xc(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:A}=_;A&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],A(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new Ju(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)ce.addEventListener(l,h,l===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)ce.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new Qu(i,e));const l=i.boxZoom=new hc(i,e);this._add("boxZoom",l),e.interactive&&e.boxZoom&&l.enable();const h=i.cooperativeGestures=new nh(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new tl(i),_=new kd(i);i.doubleClickZoom=new rl(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new Rd;this._add("tapDragZoom",x);const T=i.touchPitch=new fc(i);this._add("touchPitch",T),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const M=()=>i.project(i.getCenter()),A=function({enable:Y,clickTolerance:ie,aroundCenter:re=!0,minPixelCenterThreshold:K=100,rotateDegreesPerPixelMoved:oe=.8},_e){const pe=new Ki({checkCorrectEvent:fe=>ce.mouseButton(fe)===0&&fe.ctrlKey||ce.mouseButton(fe)===2&&!fe.ctrlKey});return new is({clickTolerance:ie,move:(fe,xe)=>{const Fe=_e();if(re&&Math.abs(Fe.y-fe.y)>K)return{bearingDelta:o.cm(new o.P(fe.x,xe.y),xe,Fe)};let Le=(xe.x-fe.x)*oe;return re&&xe.y<Fe.y&&(Le=-Le),{bearingDelta:Le}},moveStateManager:pe,enable:Y,assignEvents:il})}(e,M),E=function({enable:Y,clickTolerance:ie,pitchDegreesPerPixelMoved:re=-.5}){const K=new Ki({checkCorrectEvent:oe=>ce.mouseButton(oe)===0&&oe.ctrlKey||ce.mouseButton(oe)===2});return new is({clickTolerance:ie,move:(oe,_e)=>({pitchDelta:(_e.y-oe.y)*re}),moveStateManager:K,enable:Y,assignEvents:il})}(e),R=function({enable:Y,clickTolerance:ie,rollDegreesPerPixelMoved:re=.3},K){const oe=new Ki({checkCorrectEvent:_e=>ce.mouseButton(_e)===2&&_e.ctrlKey});return new is({clickTolerance:ie,move:(_e,pe)=>{const fe=K();let xe=(pe.x-_e.x)*re;return pe.y<fe.y&&(xe=-xe),{rollDelta:xe}},moveStateManager:oe,enable:Y,assignEvents:il})}(e,M);i.dragRotate=new nl(e,A,E,R),this._add("mouseRotate",A,["mousePitch"]),this._add("mousePitch",E,["mouseRotate","mouseRoll"]),this._add("mouseRoll",R,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const O=function({enable:Y,clickTolerance:ie}){const re=new Ki({checkCorrectEvent:K=>ce.mouseButton(K)===0&&!K.ctrlKey});return new is({clickTolerance:ie,move:(K,oe)=>({around:oe,panDelta:oe.sub(K)}),activateOnStart:!0,moveStateManager:re,enable:Y,assignEvents:il})}(e),q=new zd(e,i);i.dragPan=new _c(s,O,q),this._add("mousePan",O),this._add("touchPan",q,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const $=new pc,W=new on;i.touchZoomRotate=new yc(s,W,$,x),this._add("touchRotate",$,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const X=i.scrollZoom=new rh(i,()=>this._triggerRenderFrame());this._add("scrollZoom",X,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const ee=i.keyboard=new as(i);this._add("keyboard",ee),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new eh(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!!Ws(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(!(xc(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);l._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:T,pitchDelta:M,rollDelta:A,around:E,pinchAround:R}=e;R!==void 0&&(E=R),E=E||l.transform.centerPoint,f&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const O={panDelta:_,zoomDelta:x,rollDelta:A,pitchDelta:M,bearingDelta:T,around:E};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(E)&&(E=h.centerPoint);const q=E.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?E.sub(_):E);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,q):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(O,h,q))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(O,h),this._map.cameraHelper.handleMapControlsPan(O,h,q)),l._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const l=Ws(this._eventsInProgress),h=Ws(e),f={};for(const A in e){const{originalEvent:E}=e[A];this._eventsInProgress[A]||(f[`${A}start`]=E),this._eventsInProgress[A]=e[A]}!l&&h&&this._fireEvent("movestart",h.originalEvent);for(const A in f)this._fireEvent(A,f[A]);h&&this._fireEvent("move",h.originalEvent);for(const A in e){const{originalEvent:E}=e[A];this._fireEvent(A,E)}const _={};let x;for(const A in this._eventsInProgress){const{handlerName:E,originalEvent:R}=this._eventsInProgress[A];this._handlersById[E].isActive()||(delete this._eventsInProgress[A],x=i[E]||R,_[`${A}end`]=x)}for(const A in _)this._fireEvent(A,_[A]);const T=Ws(this._eventsInProgress),M=(l||h)&&!T;if(M&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const A=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&A.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(A)}if(s&&M){this._updatingCamera=!0;const A=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),E=R=>R!==0&&-this._bearingSnap<R&&R<this._bearingSnap;!A||!A.essential&&Ae.prefersReducedMotion?(this._map.fire(new o.l("moveend",{originalEvent:x})),E(this._map.getBearing())&&this._map.resetNorth()):(E(A.bearing||this._map.getBearing())&&(A.bearing=0),A.freezeElevation=!0,this._map.easeTo(A,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new o.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Dd("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Wt extends o.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const l=Math.min((Ae.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.S(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=ii.convert(e).adjustAntiMeridian();const s=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,i)}_cameraForBoxAndBearing(e,i,s,l){const h={top:0,bottom:0,right:0,left:0};if(typeof(l=o.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},l)).padding=="number"){const T=l.padding;l.padding={top:T,bottom:T,right:T,left:T}}const f=o.e(h,l.padding);l.padding=f;const _=this.transform,x=new ii(e,i);return this.cameraHelper.cameraForBoxAndBearing(l,f,x,s,_)}fitBounds(e,i,s){return this._fitInternal(this.cameraForBounds(e,i),i,s)}fitScreenCoordinates(e,i,s,l,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(o.P.convert(e)),this.transform.screenPointToLocation(o.P.convert(i)),s,l),l,h)}_fitInternal(e,i,s){return e?(delete(i=o.e(e,i)).padding,i.linear?this.easeTo(i,s):this.flyTo(i,s)):this}jumpTo(e,i){this.stop();const s=this._getTransformForUpdate();let l=!1,h=!1,f=!1;const _=s.zoom;this.cameraHelper.handleJumpToCenterZoom(s,e);const x=s.zoom!==_;return"elevation"in e&&s.elevation!==+e.elevation&&s.setElevation(+e.elevation),"bearing"in e&&s.bearing!==+e.bearing&&(l=!0,s.setBearing(+e.bearing)),"pitch"in e&&s.pitch!==+e.pitch&&(h=!0,s.setPitch(+e.pitch)),"roll"in e&&s.roll!==+e.roll&&(f=!0,s.setRoll(+e.roll)),e.padding==null||s.isPaddingEqual(e.padding)||s.setPadding(e.padding),this._applyUpdatedTransform(s),this.fire(new o.l("movestart",i)).fire(new o.l("move",i)),x&&this.fire(new o.l("zoomstart",i)).fire(new o.l("zoom",i)).fire(new o.l("zoomend",i)),l&&this.fire(new o.l("rotatestart",i)).fire(new o.l("rotate",i)).fire(new o.l("rotateend",i)),h&&this.fire(new o.l("pitchstart",i)).fire(new o.l("pitch",i)).fire(new o.l("pitchend",i)),f&&this.fire(new o.l("rollstart",i)).fire(new o.l("roll",i)).fire(new o.l("rollend",i)),this.fire(new o.l("moveend",i))}calculateCameraOptionsFromTo(e,i,s,l=0){const h=o.a0.fromLngLat(e,i),f=o.a0.fromLngLat(s,l),_=f.x-h.x,x=f.y-h.y,T=f.z-h.z,M=Math.hypot(_,x,T);if(M===0)throw new Error("Can't calculate camera options with same From and To");const A=Math.hypot(_,x),E=o.aj(this.transform.cameraToCenterDistance/M/this.transform.tileSize),R=180*Math.atan2(_,-x)/Math.PI;let O=180*Math.acos(A/M)/Math.PI;return O=T<0?90-O:90+O,{center:f.toLngLat(),elevation:l,zoom:E,pitch:O,bearing:R}}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.cn},e)).animate===!1||!e.essential&&Ae.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),l=this.getBearing(),h=s.pitch,f=s.roll,_="bearing"in e?this._normalizeBearing(e.bearing,l):l,x="pitch"in e?+e.pitch:h,T="roll"in e?this._normalizeBearing(e.roll,f):f,M="padding"in e?e.padding:s.padding,A=o.P.convert(e.offset);let E,R;e.around&&(E=o.S.convert(e.around),R=s.locationToScreenPoint(E));const O={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},q=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:T,padding:M,around:E,aroundPoint:R,offsetAsPoint:A,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||l!==_,this._pitching=this._pitching||x!==h,this._rolling=this._rolling||T!==f,this._padding=!s.isPaddingEqual(M),this._zooming=this._zooming||q.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,O),this.terrain&&this._prepareElevation(q.elevationCenter),this._ease($=>{q.easeFunc($),this.terrain&&!e.freezeElevation&&this._updateElevation($),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},$=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,$)},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.C.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),l=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<l){const h=this.calculateCameraOptionsFromTo(i,l,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(l=>this._elevateCameraIfInsideTerrain(l)),this.transformCameraUpdate&&i.push(l=>this.transformCameraUpdate(l)),!i.length)return;const s=e.clone();for(const l of i){const h=s.clone(),{center:f,zoom:_,roll:x,pitch:T,bearing:M,elevation:A}=l(h);f&&h.setCenter(f),A!==void 0&&h.setElevation(A),_!==void 0&&h.setZoom(_),x!==void 0&&h.setRoll(x),T!==void 0&&h.setPitch(T),M!==void 0&&h.setBearing(M),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&&Ae.prefersReducedMotion){const xe=o.Q(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(xe,i)}this.stop(),e=o.e({offset:[0,0],speed:1.2,curve:1.42,easing:o.cn},e);const s=this._getTransformForUpdate(),l=s.bearing,h=s.pitch,f=s.roll,_=s.padding,x="bearing"in e?this._normalizeBearing(e.bearing,l):l,T="pitch"in e?+e.pitch:h,M="roll"in e?this._normalizeBearing(e.roll,f):f,A="padding"in e?e.padding:s.padding,E=o.P.convert(e.offset);let R=s.centerPoint.add(E);const O=s.screenPointToLocation(R),q=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:T,roll:M,padding:A,locationAtOffset:O,offsetAsPoint:E,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let $=e.curve;const W=Math.max(s.width,s.height),X=W/q.scaleOfZoom,ee=q.pixelPathLength;typeof q.scaleOfMinZoom=="number"&&($=Math.sqrt(W/q.scaleOfMinZoom/ee*2));const Y=$*$;function ie(xe){const Fe=(X*X-W*W+(xe?-1:1)*Y*Y*ee*ee)/(2*(xe?X:W)*Y*ee);return Math.log(Math.sqrt(Fe*Fe+1)-Fe)}function re(xe){return(Math.exp(xe)-Math.exp(-xe))/2}function K(xe){return(Math.exp(xe)+Math.exp(-xe))/2}const oe=ie(!1);let _e=function(xe){return K(oe)/K(oe+$*xe)},pe=function(xe){return W*((K(oe)*(re(Fe=oe+$*xe)/K(Fe))-re(oe))/Y)/ee;var Fe},fe=(ie(!0)-oe)/$;if(Math.abs(ee)<2e-6||!isFinite(fe)){if(Math.abs(W-X)<1e-6)return this.easeTo(e,i);const xe=X<W?-1:1;fe=Math.abs(Math.log(X/W))/$,pe=()=>0,_e=Fe=>Math.exp(xe*$*Fe)}return e.duration="duration"in e?+e.duration:1e3*fe/("screenSpeed"in e?+e.screenSpeed/$:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=l!==x,this._pitching=T!==h,this._rolling=M!==f,this._padding=!s.isPaddingEqual(A),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(q.targetCenter),this._ease(xe=>{const Fe=xe*fe,Le=1/_e(Fe),Ie=pe(Fe);this._rotating&&s.setBearing(o.C.number(l,x,xe)),this._pitching&&s.setPitch(o.C.number(h,T,xe)),this._rolling&&s.setRoll(o.C.number(f,M,xe)),this._padding&&(s.interpolatePadding(_,A,xe),R=s.centerPoint.add(E)),q.easeFunc(xe,Le,Ie,R),this.terrain&&!e.freezeElevation&&this._updateElevation(xe),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=Ae.now(),this._easeOptions=s,this._onEaseFrame=e,this._onEaseEnd=i,this._easeFrameId=this._requestRenderFrame(this._renderFrameCallback))}_normalizeBearing(e,i){e=o.aN(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.S.convert(e),this.transform.tileZoom):null}}const Hs={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class al{constructor(e=Hs){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=ce.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=ce.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=ce.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(){ce.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=ce.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class vc{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=ce.create("div","maplibregl-ctrl");const i=ce.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(){ce.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class ah{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 sh=o.aI([{name:"a_pos3d",type:"Int16",components:3}]);class Ld extends o.E{constructor(e){super(),this._lastTilesetChange=Ae.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 we(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.bX(l.terrainRttPosMatrix32f,0,o.$,o.$,0,0,1),this._tiles[l.key]=new tn(l,this.tileSize),this._lastTilesetChange=Ae.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.b9();if(l.canonical.equals(e.canonical))o.bX(f,0,o.$,o.$,0,0,1);else if(l.canonical.isChildOf(e.canonical)){const _=l.canonical.z-e.canonical.z,x=l.canonical.x-(l.canonical.x>>_<<_),T=l.canonical.y-(l.canonical.y>>_<<_),M=o.$>>_;o.bX(f,0,M,M,0,0,1),o.M(f,f,[-x*M,-T*M,0])}else{if(!e.canonical.isChildOf(l.canonical))continue;{const _=e.canonical.z-l.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),T=e.canonical.y-(e.canonical.y>>_<<_),M=o.$>>_;o.bX(f,0,o.$,o.$,0,0,1),o.M(f,f,[x*M,T*M,0]),o.N(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.b9();if(h.canonical.z===e.canonical.z){const x=e.canonical.x-h.canonical.x,T=e.canonical.y-h.canonical.y;o.bX(_,0,o.$,o.$,0,0,1),o.M(_,_,[x*o.$,T*o.$,0])}else if(h.canonical.z>e.canonical.z){const x=h.canonical.z-e.canonical.z,T=h.canonical.x-(h.canonical.x>>x<<x),M=h.canonical.y-(h.canonical.y>>x<<x),A=e.canonical.x-(h.canonical.x>>x),E=e.canonical.y-(h.canonical.y>>x),R=o.$>>x;o.bX(_,0,R,R,0,0,1),o.M(_,_,[-T*R+A*o.$,-M*R+E*o.$,0])}else{const x=e.canonical.z-h.canonical.z,T=e.canonical.x-(e.canonical.x>>x<<x),M=e.canonical.y-(e.canonical.y>>x<<x),A=(e.canonical.x>>x)-h.canonical.x,E=(e.canonical.y>>x)-h.canonical.y,R=o.$<<x;o.bX(_,0,R,R,0,0,1),o.M(_,_,[T*o.$+A*R,M*o.$+E*R,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 ln{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new Ld(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.$){var h;if(!(i>=0&&i<l&&s>=0&&s<l))return 0;const f=this.getTerrainData(e),_=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const x=o.cr([],[i/l*o.$,s/l*o.$],f.u_terrain_matrix),T=[x[0]*_.dim,x[1]*_.dim],M=Math.floor(T[0]),A=Math.floor(T[1]),E=T[0]-M,R=T[1]-A;return _.get(M,A)*(1-E)*(1-R)+_.get(M+1,A)*E*(1-R)+_.get(M,A+1)*(1-E)*R+_.get(M+1,A+1)*E*R}getElevationForLngLatZoom(e,i){if(!o.cs(i,e.wrap()))return 0;const{tileID:s,mercatorX:l,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(s,l%o.$,h%o.$,o.$)}getElevation(e,i,s,l=o.$){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 o.T(l,h,l.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new o.T(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.af([])}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 o.T(l,i.dem.getPixels(),l.gl.RGBA,{premultiply:!1}),i.demTexture.bind(l.gl.NEAREST,l.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const l=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=l?h=e.canonical.z-l:o.w("cannot calculate elevation if elevation maxzoom > source.maxzoom"));const f=e.canonical.x-(e.canonical.x>>h<<h),_=e.canonical.y-(e.canonical.y>>h<<h),x=o.ct(new Float64Array(16),[1/(o.$<<h),1/(o.$<<h),0]);o.M(x,x,[f*o.$,_*o.$,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,s=i.width/devicePixelRatio,l=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===l||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new o.T(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 o.T(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 o.T(e,s,e.gl.RGBA,{premultiply:!1});return l.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=l,l}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),s=this.painter.context,l=s.gl,h=Math.round(e.x*this.painter.pixelRatio/devicePixelRatio),f=Math.round(e.y*this.painter.pixelRatio/devicePixelRatio),_=Math.round(this.painter.height/devicePixelRatio);s.bindFramebuffer.set(this.getFramebuffer("coords").framebuffer),l.readPixels(h,_-f-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const x=i[0]+(i[2]>>4<<8),T=i[1]+((15&i[2])<<8),M=this.coordsIndex[255-i[3]],A=M&&this.sourceCache.getTileByID(M);if(!A)return null;const E=this._coordsTextureSize,R=(1<<A.tileID.canonical.z)*E;return new o.a0((A.tileID.canonical.x*E+x)/R+A.tileID.wrap,(A.tileID.canonical.y*E+T)/R,this.getElevation(A.tileID,x,T,E))}depthAtPoint(e){const i=new Uint8Array(4),s=this.painter.context,l=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),l.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,l.RGBA,l.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null),(i[0]/16777216+i[1]/65536+i[2]/256+i[3])/256}getTerrainMesh(e){var i;const s=((i=this.painter.style.projection)===null||i===void 0?void 0:i.transitionState)>0,l=s&&e.canonical.y===0,h=s&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${l?"n":""}_${h?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,x=new o.cu,T=new o.aM,M=this.meshSize,A=o.$/M,E=M*M;for(let K=0;K<=M;K++)for(let oe=0;oe<=M;oe++)x.emplaceBack(oe*A,K*A,0);for(let K=0;K<E;K+=M+1)for(let oe=0;oe<M;oe++)T.emplaceBack(oe+K,M+oe+K+1,M+oe+K+2),T.emplaceBack(oe+K,M+oe+K+2,oe+K+1);const R=x.length,O=R+(M+1),q=(M+1)*M,$=l?o.bg:0,W=l?0:1,X=h?o.bh:o.$,ee=h?0:1;for(let K=0;K<=M;K++)x.emplaceBack(K*A,$,W);for(let K=0;K<=M;K++)x.emplaceBack(K*A,X,ee);for(let K=0;K<M;K++)T.emplaceBack(q+K,O+K,O+K+1),T.emplaceBack(q+K,O+K+1,q+K+1),T.emplaceBack(0+K,R+K+1,R+K),T.emplaceBack(0+K,0+K+1,R+K+1);const Y=x.length,ie=Y+2*(M+1);for(const K of[0,1])for(let oe=0;oe<=M;oe++)for(const _e of[0,1])x.emplaceBack(K*o.$,oe*A,_e);for(let K=0;K<2*M;K+=2)T.emplaceBack(Y+K,Y+K+1,Y+K+3),T.emplaceBack(Y+K,Y+K+3,Y+K+2),T.emplaceBack(ie+K,ie+K+3,ie+K+1),T.emplaceBack(ie+K,ie+K+2,ie+K+3);const re=new xn(_.createVertexBuffer(x,sh.members),_.createIndexBuffer(T),o.aL.simpleSegment(0,0,x.length,T.length));return this._meshCache[f]=re,re}getMeshFrameDelta(e){return 2*Math.PI*o.bt/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.a0.fromLngLat(e.wrap()),l=(1<<i)*o.$,h=s.x*l,f=s.y*l,_=Math.floor(h/o.$),x=Math.floor(f/o.$);return{tileID:new o.Z(i,0,i,_,x),mercatorX:h,mercatorY:f}}}class sl{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 o.T(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 qe={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0,"color-relief":!0};class et{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new sl(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 rr?h.terrainTileRanges:null;for(const _ of l){const x=this.terrain.sourceCache.getTerrainCoords(_,f);for(const T in x)this._coordsAscending[s][T]||(this._coordsAscending[s][T]=[]),this._coordsAscending[s][T].push(x[T])}}this._coordsAscendingStr={};for(const s of e._order){const l=e._layers[s],h=l.source;if(qe[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(qe[l]&&(this._prevType&&qe[this._prevType]||this._stacks.push([]),this._prevType=l,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(qe[this._prevType]||qe[l]&&f){this._prevType=l;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const T of this._renderableTiles){if(this.pool.isFull()&&(ri(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(T),T.rtt[_]){const A=this.pool.getObjectForId(T.rtt[_].id);if(A.stamp===T.rtt[_].stamp){this.pool.useObject(A);continue}}const M=this.pool.getOrCreateFreeObject();this.pool.useObject(M),this.pool.stampObject(M),T.rtt[_]={id:M.id,stamp:M.stamp},h.context.bindFramebuffer.set(M.fbo.framebuffer),h.context.clear({color:o.be.transparent,stencil:0}),h.currentStencilSource=void 0;for(let A=0;A<x.length;A++){const E=h.style._layers[x[A]],R=E.source?this._coordsAscending[E.source][T.tileID.key]:[T.tileID];h.context.viewport.set([0,0,M.fbo.width,M.fbo.height]),h._renderTileClippingMasks(E,R,!0),h.renderLayer(h,h.style.sourceCaches[E.source],E,R,s),E.source&&(T.rttCoords[E.source]=this._coordsAscendingStr[E.source][T.tileID.key])}}return ri(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),qe[l]}return!1}}const ol={"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"},bc=ye,Xs={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Hs,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},Ji={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class oh{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,ce.mousePos(this.element,h)),ce.addEventListener(window,"mousemove",this.mousemove),ce.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,ce.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=ce.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),ce.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),ce.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=ce.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 Ad;this._rotatePitchHanlder=new is({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),x=new o.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:o.cm(new o.P(h.x,f.y),f,x),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:l,enable:!0,assignEvents:()=>{}}),this.map=e,ce.addEventListener(i,"mousedown",this.mousedown),ce.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),ce.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),ce.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;ce.removeEventListener(e,"mousedown",this.mousedown),ce.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),ce.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ce.removeEventListener(window,"touchend",this.touchend),ce.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){ce.enableDrag(),ce.removeEventListener(window,"mousemove",this.mousemove),ce.removeEventListener(window,"mouseup",this.mouseup),ce.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),ce.removeEventListener(window,"touchend",this.touchend)}}let Di;function lh(u,e,i,s=!1){if(s||!i.getCoveringTilesDetailsProvider().allowWorldCopies())return u==null?void 0:u.wrap();const l=new o.S(u.lng,u.lat);if(u=new o.S(u.lng,u.lat),e){const h=new o.S(u.lng-360,u.lat),f=new o.S(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 ma={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 Kt(u,e,i){const s=u.classList;for(const l in ma)s.remove(`maplibregl-${i}-anchor-${l}`);s.add(`maplibregl-${i}-anchor-${e}`)}class ni 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=lh(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()),ce.setTransform(this._element,`${ma[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${h} ${l}`),Ae.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=ce.create("div");const i=ce.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=ce.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=ce.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=ce.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const W of x){const X=ce.createNS("http://www.w3.org/2000/svg","ellipse");X.setAttributeNS(null,"opacity","0.04"),X.setAttributeNS(null,"cx","10.5"),X.setAttributeNS(null,"cy","5.80029008"),X.setAttributeNS(null,"rx",W.rx),X.setAttributeNS(null,"ry",W.ry),_.appendChild(X)}const T=ce.createNS("http://www.w3.org/2000/svg","g");T.setAttributeNS(null,"fill",this._color);const M=ce.createNS("http://www.w3.org/2000/svg","path");M.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(M);const A=ce.createNS("http://www.w3.org/2000/svg","g");A.setAttributeNS(null,"opacity","0.25"),A.setAttributeNS(null,"fill","#000000");const E=ce.createNS("http://www.w3.org/2000/svg","path");E.setAttributeNS(null,"d","M13.5,0 C6.0441559,0 0,6.0441559 0,13.5 C0,19.222562 6.7499993,27 12.25,34.5 C13,35.522727 14.016664,35.500004 14.75,34.5 C20.250001,27 27,19.074644 27,13.5 C27,6.0441559 20.955844,0 13.5,0 Z M13.5,1 C20.415404,1 26,6.584596 26,13.5 C26,15.898657 24.495584,19.181431 22.220703,22.738281 C19.945823,26.295132 16.705119,30.142167 13.943359,33.908203 C13.743445,34.180814 13.612715,34.322738 13.5,34.441406 C13.387285,34.322738 13.256555,34.180814 13.056641,33.908203 C10.284481,30.127985 7.4148684,26.314159 5.015625,22.773438 C2.6163816,19.232715 1,15.953538 1,13.5 C1,6.584596 6.584596,1 13.5,1 Z"),A.appendChild(E);const R=ce.createNS("http://www.w3.org/2000/svg","g");R.setAttributeNS(null,"transform","translate(6.0, 7.0)"),R.setAttributeNS(null,"fill","#FFFFFF");const O=ce.createNS("http://www.w3.org/2000/svg","g");O.setAttributeNS(null,"transform","translate(8.0, 8.0)");const q=ce.createNS("http://www.w3.org/2000/svg","circle");q.setAttributeNS(null,"fill","#000000"),q.setAttributeNS(null,"opacity","0.25"),q.setAttributeNS(null,"cx","5.5"),q.setAttributeNS(null,"cy","5.5"),q.setAttributeNS(null,"r","5.4999962");const $=ce.createNS("http://www.w3.org/2000/svg","circle");$.setAttributeNS(null,"fill","#FFFFFF"),$.setAttributeNS(null,"cx","5.5"),$.setAttributeNS(null,"cy","5.5"),$.setAttributeNS(null,"r","5.4999962"),O.appendChild(q),O.appendChild($),f.appendChild(_),f.appendChild(T),f.appendChild(A),f.appendChild(R),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()}),Kt(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),ce.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=o.S.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const l=Math.abs(13.5)/Math.SQRT2;e.options.offset=this._defaultMarker?{top:[0,0],"top-left":[0,0],"top-right":[0,0],bottom:[0,-38.1],"bottom-left":[l,-1*(38.1-13.5+l)],"bottom-right":[-l,-1*(38.1-13.5+l)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,s;const l=(i=this._map)===null||i===void 0?void 0:i.terrain,h=this._map.transform.isLocationOccluded(this._lngLat);if(!l||h){const R=h?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==R&&(this._element.style.opacity=R))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const f=this._map,_=f.terrain.depthAtPoint(this._pos),x=f.terrain.getElevationForLngLatZoom(this._lngLat,f.transform.tileZoom);if(f.transform.lngLatToCameraDepth(this._lngLat,x)-_<.006)return void(this._element.style.opacity=this._opacity);const T=-this._offset.y/f.transform.pixelsPerMeter,M=Math.sin(f.getPitch()*Math.PI/180)*T,A=f.terrain.depthAtPoint(new o.P(this._pos.x,this._pos.y-this._offset.y)),E=f.transform.lngLatToCameraDepth(this._lngLat,x+M)-A>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&E&&this._popup.remove(),this._element.style.opacity=E?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 ch={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let Zn=0,Un=!1;const wc={maxWidth:100,unit:"metric"};function ll(u,e,i){const s=i&&i.maxWidth||100,l=u._container.clientHeight/2,h=u._container.clientWidth/2,f=u.unproject([h-s/2,l]),_=u.unproject([h+s/2,l]),x=Math.round(u.project(_).x-u.project(f).x),T=Math.min(s,x,u._container.clientWidth),M=f.distanceTo(_);if(i&&i.unit==="imperial"){const A=3.2808*M;A>5280?ga(e,T,A/5280,u._getUIString("ScaleControl.Miles")):ga(e,T,A,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?ga(e,T,M/1852,u._getUIString("ScaleControl.NauticalMiles")):M>=1e3?ga(e,T,M/1e3,u._getUIString("ScaleControl.Kilometers")):ga(e,T,M,u._getUIString("ScaleControl.Meters"))}function ga(u,e,i,s){const l=function(h){const f=Math.pow(10,`${Math.floor(h)}`.length-1);let _=h/f;return _=_>=10?10:_>=5?5:_>=3?3:_>=2?2:_>=1?1:function(x){const T=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*T)/T}(_),f*_}(i);u.style.width=e*(l/i)+"px",u.innerHTML=`${l} ${s}`}const Ys={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},Tc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function 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 Sc=ye;P.AJAXError=o.cy,P.Event=o.l,P.Evented=o.E,P.LngLat=o.S,P.MercatorCoordinate=o.a0,P.Point=o.P,P.addProtocol=o.cz,P.config=o.a,P.removeProtocol=o.cA,P.AttributionControl=al,P.BoxZoomHandler=hc,P.CanvasSource=Ln,P.CooperativeGesturesHandler=nh,P.DoubleClickZoomHandler=rl,P.DragPanHandler=_c,P.DragRotateHandler=nl,P.EdgeInsets=Pr,P.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=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){ce.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=ce.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);ce.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()}},P.GeoJSONSource=fr,P.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.S(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,l=this._map.getBearing(),h=o.e({bearing:l},this.options.fitBoundsOptions),f=ii.fromLngLat(i,s);this._map.fitBounds(f,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new o.S(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&Un)return;this.options.trackUserLocation&&this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new o.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=ce.create("button","maplibregl-ctrl-geolocate",this._container),ce.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=ce.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new ni({element:this._dotElement}),this._circleElement=ce.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new ni({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({},ch,u)}onAdd(u){return this._map=u,this._container=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return o._(this,arguments,void 0,function*(e=!1){if(Di!==void 0&&!e)return Di;if(window.navigator.permissions===void 0)return Di=!!window.navigator.geolocation,Di;try{Di=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Di=!!window.navigator.geolocation}return Di})}().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(),ce.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,Zn=0,Un=!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":Zn--,Un=!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"),Zn++,Zn>1?(u={maximumAge:6e5,timeout:0},Un=!0):(u=this.options.positionOptions,Un=!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)}},P.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=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=ce.create("button","maplibregl-ctrl-globe",this._container),ce.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(){ce.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},P.Hash=Zs,P.ImageSource=rr,P.KeyboardHandler=as,P.LngLatBounds=ii,P.LogoControl=vc,P.Map=class extends Wt{constructor(u){var e,i;o.cv.mark(o.cw.create);const s=Object.assign(Object.assign(Object.assign({},Xs),u),{canvasContextAttributes:Object.assign(Object.assign({},Xs.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 pi,h=new ko;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 ah,this._controls=[],this._mapId=o.a6(),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({},ol),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=li.addThrottleControl(()=>this.isMoving()),this._requestManager=new Ft(s.transformRequest),typeof s.container=="string"){if(this._container=document.getElementById(s.container),!this._container)throw new Error(`Container '${s.container}' not found.`)}else{if(!(s.container instanceof HTMLElement))throw new Error("Invalid type: 'container' must be a String or HTMLElement.");this._container=s.container}if(s.maxBounds&&this.setMaxBounds(s.maxBounds),this._setupContainer(),this._setupPainter(),this.on("move",()=>this._update(!1)),this.on("moveend",()=>this._update(!1)),this.on("zoom",()=>this._update(!0)),this.on("terrain",()=>{this.painter.terrainFacilitator.dirty=!0,this._update(!0)}),this.once("idle",()=>{this._idleTriggered=!0}),typeof window<"u"){addEventListener("online",this._onWindowOnline,!1);let _=!1;const x=Jo(T=>{this._trackResize&&!this._removed&&(this.resize(T),this.redraw())},50);this._resizeObserver=new ResizeObserver(T=>{_?x(T):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new Vn(this,s),this._hash=s.hash&&new Zs(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 al(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new vc,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=o.Q(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}setGlobalStateProperty(u,e){return this.style.setGlobalStateProperty(u,e),this._update(!0)}getGlobalState(){return this.style.getGlobalState()}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(ii.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.S.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(o.P.convert(u),this.terrain)}isMoving(){var u;return this._moving||((u=this.handlers)===null||u===void 0?void 0:u.isMoving())}isZooming(){var u;return this._zooming||((u=this.handlers)===null||u===void 0?void 0:u.isZooming())}isRotating(){var u;return this._rotating||((u=this.handlers)===null||u===void 0?void 0:u.isRotating())}_createDelegatedListener(u,e,i){if(u==="mouseenter"||u==="mouseover"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:h=>{const f=e.filter(x=>this.getLayer(x)),_=f.length!==0?this.queryRenderedFeatures(h.point,{layers:f}):[];_.length?s||(s=!0,i.call(this,new sr(u,this,h.originalEvent,{features:_}))):s=!1},mouseout:()=>{s=!1}}}}if(u==="mouseleave"||u==="mouseout"){let s=!1;return{layers:e,listener:i,delegates:{mousemove:f=>{const _=e.filter(x=>this.getLayer(x));(_.length!==0?this.queryRenderedFeatures(f.point,{layers:_}):[]).length?s=!0:s&&(s=!1,i.call(this,new sr(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new sr(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 Zl(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 Zl(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."),s.type==="color-relief"&&s.source===u.source&&o.w("You are using the same source for a color-relief layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new ln(this.painter,e,u),this.painter.renderToTexture=new et(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=ge(Math.max(1,u),Math.max(1,e))}else for(const s in this.style.sourceCaches)this.style.sourceCaches[s].getSource().calculateTileZoom=ge(Math.max(1,u),Math.max(1,e));return this._update(!0),this}refreshTiles(u,e){const i=this.style.sourceCaches[u];if(!i)throw new Error(`There is no source cache with ID "${u}", cannot refresh tile`);e===void 0?i.reload(!0):i.refreshTiles(e.map(s=>new o.a3(s.z,s.x,s.y)))}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:l=!1,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||o.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new o.k(new Error("Invalid arguments to map.addImage(). The second argument must be an `HTMLImageElement`, `ImageData`, `ImageBitmap`, or object with `width`, `height`, and `data` properties with the same format as `ImageData`")));{const{width:M,height:A,data:E}=e,R=e;return this.style.addImage(u,{data:new o.R({width:M,height:A},new Uint8Array(E)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0,userImage:R}),R.onAdd&&R.onAdd(this,u),this}}{const{width:M,height:A,data:E}=Ae.getImageData(e);this.style.addImage(u,{data:new o.R({width:M,height:A},E),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:T,sdf:l,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new o.k(new Error("The map has no image with that id. If you are adding a new image use `map.addImage(...)` instead.")));const s=e instanceof HTMLImageElement||o.b(e)?Ae.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 li.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=ce.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=ce.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=ce.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=ce.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 Ir(i,this.transform),Be.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new o.l("projectiontransition",{newProjection:this.style.projection.name}))}loaded(){return!this._styleDirty&&!this._sourcesDirty&&!!this.style&&this.style.loaded()}_update(u){return this.style&&this.style._loaded?(this._styleDirty=this._styleDirty||u,this._sourcesDirty=!0,this.triggerRepaint(),this):this}_requestRenderFrame(u){return this._update(),this._renderTaskQueue.add(u)}_cancelRenderFrame(u){this._renderTaskQueue.remove(u)}_render(u){var e,i,s,l,h;const f=this._idleTriggered?this._fadeDuration:0,_=((e=this.style.projection)===null||e===void 0?void 0:e.transitionState)>0;if(this.painter.context.setDirty(),this.painter.setBaseState(),this._renderTaskQueue.run(u),this._removed)return;let x=!1;if(this.style&&this._styleDirty){this._styleDirty=!1;const A=this.transform.zoom,E=Ae.now();this.style.zoomHistory.update(A,E);const R=new o.F(A,{now:E,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition(),globalState:this.style.getGlobalState()}),O=R.crossFadingFactor();O===1&&O===this._crossFadingFactor||(x=!0,this._crossFadingFactor=O),this.style.update(R)}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.cv.mark(o.cw.load),this.fire(new o.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const M=this._sourcesDirty||this._styleDirty||this._placementDirty;return M||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new o.l("idle")),!this._loaded||this._fullyLoaded||M||(this._fullyLoaded=!0,o.cv.mark(o.cw.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),li.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),ce.remove(this._canvasContainer),ce.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),o.cv.clearMetrics(),this._removed=!0,this.fire(new o.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ae.frame(this._frameRequest,u=>{o.cv.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!o.cx(e)&&!function(i){return i.message===rc}(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 bc}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},P.MapMouseEvent=sr,P.MapTouchEvent=Nr,P.MapWheelEvent=uc,P.Marker=ni,P.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({},Ji,u),this._container=ce.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})),ce.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})),ce.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=ce.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 oh(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){ce.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=ce.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},P.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&&ce.remove(this._content),this._container&&(ce.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=ce.create("div","maplibregl-popup",this._map.getContainer()),this._tip=ce.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=lh(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 x;x=i.y+l.bottom.y<_?["top"]:i.y>this._map.transform.height-_?["bottom"]:[],i.x<f/2?x.push("left"):i.x>this._map.transform.width-f/2&&x.push("right"),s=x.length===0?"bottom":x.join("-")}let h=i.add(l[s]);this.options.subpixelPositioning||(h=h.round()),ce.setTransform(this._container,`${ma[s]} translate(${h.x}px,${h.y}px)`),Kt(this._container,s,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=o.e(Object.create(Ys),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.S.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=ce.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=ce.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="×",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(Tc);u&&u.focus()}},P.RasterDEMTileSource=ki,P.RasterTileSource=Ra,P.ScaleControl=class{constructor(u){this._onMove=()=>{ll(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,ll(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},wc),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=ce.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){ce.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},P.ScrollZoomHandler=rh,P.Style=Zl,P.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=ce.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=ce.create("button","maplibregl-ctrl-terrain",this._container),ce.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(){ce.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},P.TwoFingersTouchPitchHandler=fc,P.TwoFingersTouchRotateHandler=pc,P.TwoFingersTouchZoomHandler=on,P.TwoFingersTouchZoomRotateHandler=yc,P.VectorTileSource=Sr,P.VideoSource=ta,P.addSourceType=(u,e)=>o._(void 0,void 0,void 0,function*(){if(ia(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{_s[i]=s})(u,e)}),P.clearPrewarmedResources=function(){const u=pr;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Fr),pr=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()"))},P.createTileMesh=jl,P.getMaxParallelImageRequests=function(){return o.a.MAX_PARALLEL_IMAGE_REQUESTS},P.getRTLTextPluginStatus=function(){return mr().getRTLTextPluginStatus()},P.getVersion=function(){return Sc},P.getWorkerCount=function(){return Wi.workerCount},P.getWorkerUrl=function(){return o.a.WORKER_URL},P.importScriptInWorkers=function(u){return Or().broadcast("IS",u)},P.prewarm=function(){Qr().acquire(Fr)},P.setMaxParallelImageRequests=function(u){o.a.MAX_PARALLEL_IMAGE_REQUESTS=u},P.setRTLTextPlugin=function(u,e){return mr().setRTLTextPlugin(u,e)},P.setWorkerCount=function(u){Wi.workerCount=u},P.setWorkerUrl=function(u){o.a.WORKER_URL=u}});var B=v;return B})}(fu)),fu.exports}var Ry=ky();const jf=Ay(Ry);var Dy=jh('<div id="map" class="svelte-1biavlq"></div>');function Ly(w,g){var Ve,Ae;Kc(g,!0);let v=((Ve=g.options)==null?void 0:Ve.minZoom)??Z_,I=((Ae=g.options)==null?void 0:Ae.maxZoom)??Xh,z=kr(0),B=new jf.Map({...g.options,container:"map",minZoom:o(v),maxZoom:I,pitchWithRotate:!1,attributionControl:{customAttribution:"@arenarium/maps"}});B.dragRotate.disable(),B.keyboard.disable(),B.touchZoomRotate.disableRotation(),B.touchPitch.disable();let P=new Lf(B,ce=>new jf.Marker(ce));function o(ce){const Be=ff,Rt=Math.ceil(Math.log2(oi(z)/Be));return Math.max(ce,Rt)}const ye=()=>B,be=()=>P;var Re=Dy();return T_("resize",Dh,()=>B.setMinZoom(o(v))),R_(Re,"clientWidth",ce=>Gi(z,ce)),Nh(w,Re),Jc({map:ye,manager:be})}const Fy={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}}]},By={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}}]};function Oy(w){const g=typeof w.container=="string"?document.getElementById(w.container):w.container;if(!g)throw new Error(`Container not found: ${w.container}`);const v=Vh(Ly,{target:g,props:{options:w}});return{map:v.map(),manager:v.manager(),unmount:()=>C_(v)}}Et.MapDarkStyle=Fy,Et.MapManager=Lf,Et.MapStyleLight=By,Et.mountMap=Oy,Object.defineProperty(Et,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(S,M){typeof exports=="object"&&typeof module<"u"?M(exports):typeof define=="function"&&define.amd?define(["exports"],M):(S=typeof globalThis<"u"?globalThis:S||self,M(S.arenarium={}))})(this,function(S){"use strict";var Ni=Object.defineProperty;var kn=S=>{throw TypeError(S)};var Ti=(S,M,j)=>M in S?Ni(S,M,{enumerable:!0,configurable:!0,writable:!0,value:j}):S[M]=j;var g=(S,M,j)=>Ti(S,typeof M!="symbol"?M+"":M,j),zn=(S,M,j)=>M.has(S)||kn("Cannot "+j);var V=(S,M,j)=>(zn(S,M,"read from private field"),j?j.call(S):M.get(S)),Ke=(S,M,j)=>M.has(S)?kn("Cannot add the same private member more than once"):M instanceof WeakSet?M.add(S):M.set(S,j),aa=(S,M,j,Qe)=>(zn(S,M,"write to private field"),Qe?Qe.call(S,j):M.set(S,j),j);var mn,se,Fe,Je,ke;var j=Array.isArray,Qe=Array.prototype.indexOf,Sn=Array.from,Cn=Object.defineProperty,Be=Object.getOwnPropertyDescriptor,En=Object.prototype,An=Array.prototype,Mn=Object.getPrototypeOf,na=Object.isExtensible;function Nn(a){for(var e=0;e<a.length;e++)a[e]()}const Q=2,ra=4,et=8,kt=16,ce=32,Se=64,zt=128,B=256,tt=512,W=1024,ue=2048,xe=4096,at=8192,St=16384,ia=32768,Tn=65536,Rn=1<<19,oa=1<<20,Ct=1<<21,nt=Symbol("$state");function sa(a){return a===this.v}function Pn(a){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Ln(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function On(a){throw new Error("https://svelte.dev/e/effect_orphan")}function jn(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function In(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Dn(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Zn(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let Ri=!1;const $=Symbol();let Y=null;function la(a){Y=a}function Et(a,e=!1,t){var n=Y={p:Y,c:null,d:!1,e:null,m:!1,s:a,x:null,l:null};Xn(()=>{n.d=!0})}function At(a){const e=Y;if(e!==null){a!==void 0&&(e.x=a);const o=e.e;if(o!==null){var t=N,n=A;e.e=null;try{for(var r=0;r<o.length;r++){var i=o[r];Me(i.effect),de(i.reaction),Rt(i.fn)}}finally{Me(t),de(n)}}Y=e.p,e.m=!0}return a||{}}function ca(){return!0}function Ce(a){if(typeof a!="object"||a===null||nt in a)return a;const e=Mn(a);if(e!==En&&e!==An)return a;var t=new Map,n=j(a),r=X(0),i=A,o=s=>{var l=A;de(i);var c=s();return de(l),c};return n&&t.set("length",X(a.length)),new Proxy(a,{defineProperty(s,l,c){(!("value"in c)||c.configurable===!1||c.enumerable===!1||c.writable===!1)&&In();var d=t.get(l);return d===void 0?(d=o(()=>X(c.value)),t.set(l,d)):I(d,o(()=>Ce(c.value))),!0},deleteProperty(s,l){var c=t.get(l);if(c===void 0)l in s&&(t.set(l,o(()=>X($))),Mt(r));else{if(n&&typeof l=="string"){var d=t.get("length"),p=Number(l);Number.isInteger(p)&&p<d.v&&I(d,p)}I(c,$),Mt(r)}return!0},get(s,l,c){var x;if(l===nt)return a;var d=t.get(l),p=l in s;if(d===void 0&&(!p||(x=Be(s,l))!=null&&x.writable)&&(d=o(()=>X(Ce(p?s[l]:$))),t.set(l,d)),d!==void 0){var h=R(d);return h===$?void 0:h}return Reflect.get(s,l,c)},getOwnPropertyDescriptor(s,l){var c=Reflect.getOwnPropertyDescriptor(s,l);if(c&&"value"in c){var d=t.get(l);d&&(c.value=R(d))}else if(c===void 0){var p=t.get(l),h=p==null?void 0:p.v;if(p!==void 0&&h!==$)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return c},has(s,l){var h;if(l===nt)return!0;var c=t.get(l),d=c!==void 0&&c.v!==$||Reflect.has(s,l);if(c!==void 0||N!==null&&(!d||(h=Be(s,l))!=null&&h.writable)){c===void 0&&(c=o(()=>X(d?Ce(s[l]):$)),t.set(l,c));var p=R(c);if(p===$)return!1}return d},set(s,l,c,d){var P;var p=t.get(l),h=l in s;if(n&&l==="length")for(var x=c;x<p.v;x+=1){var C=t.get(x+"");C!==void 0?I(C,$):x in s&&(C=o(()=>X($)),t.set(x+"",C))}p===void 0?(!h||(P=Be(s,l))!=null&&P.writable)&&(p=o(()=>X(void 0)),I(p,o(()=>Ce(c))),t.set(l,p)):(h=p.v!==$,I(p,o(()=>Ce(c))));var O=Reflect.getOwnPropertyDescriptor(s,l);if(O!=null&&O.set&&O.set.call(d,c),!h){if(n&&typeof l=="string"){var z=t.get("length"),K=Number(l);Number.isInteger(K)&&K>=z.v&&I(z,K+1)}Mt(r)}return!0},ownKeys(s){R(r);var l=Reflect.ownKeys(s).filter(p=>{var h=t.get(p);return h===void 0||h.v!==$});for(var[c,d]of t)d.v!==$&&!(c in s)&&l.push(c);return l},setPrototypeOf(){Dn()}})}function Mt(a,e=1){I(a,a.v+e)}function Fn(a){var e=Q|ue,t=A!==null&&(A.f&Q)!==0?A:null;return N===null||t!==null&&(t.f&B)!==0?e|=B:N.f|=oa,{ctx:Y,deps:null,effects:null,equals:sa,f:e,fn:a,reactions:null,rv:0,v:null,wv:0,parent:t??N}}function ua(a){var e=a.effects;if(e!==null){a.effects=null;for(var t=0;t<e.length;t+=1)we(e[t])}}function Vn(a){for(var e=a.parent;e!==null;){if((e.f&Q)===0)return e;e=e.parent}return null}function da(a){var e,t=N;Me(Vn(a));try{ua(a),e=Ta(a)}finally{Me(t)}return e}function pa(a){var e=da(a);if(a.equals(e)||(a.v=e,a.wv=Ma()),!Ae){var t=(pe||(a.f&B)!==0)&&a.deps!==null?xe:W;te(a,t)}}const $e=new Map;function Nt(a,e){var t={f:0,v:a,reactions:null,equals:sa,rv:0,wv:0};return t}function X(a,e){const t=Nt(a);return ir(t),t}function I(a,e,t=!1){A!==null&&!ee&&ca()&&(A.f&(Q|kt))!==0&&!(D!=null&&D.includes(a))&&Zn();let n=t?Ce(e):e;return Bn(a,n)}function Bn(a,e){if(!a.equals(e)){var t=a.v;Ae?$e.set(a,e):$e.set(a,t),a.v=e,(a.f&Q)!==0&&((a.f&ue)!==0&&da(a),te(a,(a.f&B)===0?W:xe)),a.wv=Ma(),fa(a,ue),N!==null&&(N.f&W)!==0&&(N.f&(ce|Se))===0&&(H===null?or([a]):H.push(a))}return e}function fa(a,e){var t=a.reactions;if(t!==null)for(var n=t.length,r=0;r<n;r++){var i=t[r],o=i.f;(o&ue)===0&&(te(i,e),(o&(W|B))!==0&&((o&Q)!==0?fa(i,xe):Ot(i)))}}var ma,ha,ya,ga;function $n(){if(ma===void 0){ma=window,ha=/Firefox/.test(navigator.userAgent);var a=Element.prototype,e=Node.prototype,t=Text.prototype;ya=Be(e,"firstChild").get,ga=Be(e,"nextSibling").get,na(a)&&(a.__click=void 0,a.__className=void 0,a.__attributes=null,a.__style=void 0,a.__e=void 0),na(t)&&(t.__t=void 0)}}function Un(a=""){return document.createTextNode(a)}function _a(a){return ya.call(a)}function va(a){return ga.call(a)}function Tt(a,e){return _a(a)}function qn(a,e=1,t=!1){let n=a;for(;e--;)n=va(n);return n}function Wn(a){N===null&&A===null&&On(),A!==null&&(A.f&B)!==0&&N===null&&Ln(),Ae&&Pn()}function Yn(a,e){var t=e.last;t===null?e.last=e.first=a:(t.next=a,a.prev=t,e.last=a)}function Ee(a,e,t,n=!0){var r=N,i={ctx:Y,deps:null,nodes_start:null,nodes_end:null,f:a|ue,first:null,fn:e,last:null,next:null,parent:r,prev:null,teardown:null,transitions:null,wv:0};if(t)try{Lt(i),i.f|=ia}catch(l){throw we(i),l}else e!==null&&Ot(i);var o=t&&i.deps===null&&i.first===null&&i.nodes_start===null&&i.teardown===null&&(i.f&(oa|zt))===0;if(!o&&n&&(r!==null&&Yn(i,r),A!==null&&(A.f&Q)!==0)){var s=A;(s.effects??(s.effects=[])).push(i)}return i}function Xn(a){const e=Ee(et,null,!1);return te(e,W),e.teardown=a,e}function re(a){Wn();var e=N!==null&&(N.f&ce)!==0&&Y!==null&&!Y.m;if(e){var t=Y;(t.e??(t.e=[])).push({fn:a,effect:N,reaction:A})}else{var n=Rt(a);return n}}function Hn(a){const e=Ee(Se,a,!0);return(t={})=>new Promise(n=>{t.outro?er(e,()=>{we(e),n(void 0)}):(we(e),n(void 0))})}function Rt(a){return Ee(ra,a,!1)}function xa(a){return Ee(et,a,!0)}function wa(a,e=[],t=Fn){const n=e.map(t);return Jn(()=>a(...n.map(R)))}function Jn(a,e=0){return Ee(et|kt|e,a,!0)}function Gn(a,e=!0){return Ee(et|ce,a,!0,e)}function ba(a){var e=a.teardown;if(e!==null){const t=Ae,n=A;Ea(!0),de(null);try{e.call(null)}finally{Ea(t),de(n)}}}function ka(a,e=!1){var t=a.first;for(a.first=a.last=null;t!==null;){var n=t.next;(t.f&Se)!==0?t.parent=null:we(t,e),t=n}}function Kn(a){for(var e=a.first;e!==null;){var t=e.next;(e.f&ce)===0&&we(e),e=t}}function we(a,e=!0){var t=!1;(e||(a.f&Rn)!==0)&&a.nodes_start!==null&&a.nodes_end!==null&&(Qn(a.nodes_start,a.nodes_end),t=!0),ka(a,e&&!t),ct(a,0),te(a,St);var n=a.transitions;if(n!==null)for(const i of n)i.stop();ba(a);var r=a.parent;r!==null&&r.first!==null&&za(a),a.next=a.prev=a.teardown=a.ctx=a.deps=a.fn=a.nodes_start=a.nodes_end=null}function Qn(a,e){for(;a!==null;){var t=a===e?null:va(a);a.remove(),a=t}}function za(a){var e=a.parent,t=a.prev,n=a.next;t!==null&&(t.next=n),n!==null&&(n.prev=t),e!==null&&(e.first===a&&(e.first=n),e.last===a&&(e.last=t))}function er(a,e){var t=[];Sa(a,t,!0),tr(t,()=>{we(a),e&&e()})}function tr(a,e){var t=a.length;if(t>0){var n=()=>--t||e();for(var r of a)r.out(n)}else e()}function Sa(a,e,t){if((a.f&at)===0){if(a.f^=at,a.transitions!==null)for(const o of a.transitions)(o.is_global||t)&&e.push(o);for(var n=a.first;n!==null;){var r=n.next,i=(n.f&Tn)!==0||(n.f&ce)!==0;Sa(n,e,i?t:!1),n=r}}}let rt=[];function ar(){var a=rt;rt=[],Nn(a)}function nr(a){rt.length===0&&queueMicrotask(ar),rt.push(a)}function rr(a){var e=N;if((e.f&ia)===0){if((e.f&zt)===0)throw a;e.fn(a)}else Ca(a,e)}function Ca(a,e){for(;e!==null;){if((e.f&zt)!==0)try{e.fn(a);return}catch{}e=e.parent}throw a}let Pt=!1,it=null,be=!1,Ae=!1;function Ea(a){Ae=a}let ot=[],Pi=[],A=null,ee=!1;function de(a){A=a}let N=null;function Me(a){N=a}let D=null;function ir(a){A!==null&&A.f&Ct&&(D===null?D=[a]:D.push(a))}let Z=null,U=0,H=null;function or(a){H=a}let Aa=1,st=0,pe=!1;function Ma(){return++Aa}function lt(a){var p;var e=a.f;if((e&ue)!==0)return!0;if((e&xe)!==0){var t=a.deps,n=(e&B)!==0;if(t!==null){var r,i,o=(e&tt)!==0,s=n&&N!==null&&!pe,l=t.length;if(o||s){var c=a,d=c.parent;for(r=0;r<l;r++)i=t[r],(o||!((p=i==null?void 0:i.reactions)!=null&&p.includes(c)))&&(i.reactions??(i.reactions=[])).push(c);o&&(c.f^=tt),s&&d!==null&&(d.f&B)===0&&(c.f^=B)}for(r=0;r<l;r++)if(i=t[r],lt(i)&&pa(i),i.wv>a.wv)return!0}(!n||N!==null&&!pe)&&te(a,W)}return!1}function Na(a,e,t=!0){var n=a.reactions;if(n!==null)for(var r=0;r<n.length;r++){var i=n[r];D!=null&&D.includes(a)||((i.f&Q)!==0?Na(i,e,!1):e===i&&(t?te(i,ue):(i.f&W)!==0&&te(i,xe),Ot(i)))}}function Ta(a){var x;var e=Z,t=U,n=H,r=A,i=pe,o=D,s=Y,l=ee,c=a.f;Z=null,U=0,H=null,pe=(c&B)!==0&&(ee||!be||A===null),A=(c&(ce|Se))===0?a:null,D=null,la(a.ctx),ee=!1,st++,a.f|=Ct;try{var d=(0,a.fn)(),p=a.deps;if(Z!==null){var h;if(ct(a,U),p!==null&&U>0)for(p.length=U+Z.length,h=0;h<Z.length;h++)p[U+h]=Z[h];else a.deps=p=Z;if(!pe)for(h=U;h<p.length;h++)((x=p[h]).reactions??(x.reactions=[])).push(a)}else p!==null&&U<p.length&&(ct(a,U),p.length=U);if(ca()&&H!==null&&!ee&&p!==null&&(a.f&(Q|xe|ue))===0)for(h=0;h<H.length;h++)Na(H[h],a);return r!==null&&r!==a&&(st++,H!==null&&(n===null?n=H:n.push(...H))),d}catch(C){rr(C)}finally{Z=e,U=t,H=n,A=r,pe=i,D=o,la(s),ee=l,a.f^=Ct}}function sr(a,e){let t=e.reactions;if(t!==null){var n=Qe.call(t,a);if(n!==-1){var r=t.length-1;r===0?t=e.reactions=null:(t[n]=t[r],t.pop())}}t===null&&(e.f&Q)!==0&&(Z===null||!Z.includes(e))&&(te(e,xe),(e.f&(B|tt))===0&&(e.f^=tt),ua(e),ct(e,0))}function ct(a,e){var t=a.deps;if(t!==null)for(var n=e;n<t.length;n++)sr(a,t[n])}function Lt(a){var e=a.f;if((e&St)===0){te(a,W);var t=N,n=be;N=a,be=!0;try{(e&kt)!==0?Kn(a):ka(a),ba(a);var r=Ta(a);a.teardown=typeof r=="function"?r:null,a.wv=Aa;var i=a.deps,o}finally{be=n,N=t}}}function lr(){try{jn()}catch(a){if(it!==null)Ca(a,it);else throw a}}function cr(){var a=be;try{var e=0;for(be=!0;ot.length>0;){e++>1e3&&lr();var t=ot,n=t.length;ot=[];for(var r=0;r<n;r++){var i=dr(t[r]);ur(i)}$e.clear()}}finally{Pt=!1,be=a,it=null}}function ur(a){var e=a.length;if(e!==0)for(var t=0;t<e;t++){var n=a[t];(n.f&(St|at))===0&<(n)&&(Lt(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?za(n):n.fn=null))}}function Ot(a){Pt||(Pt=!0,queueMicrotask(cr));for(var e=it=a;e.parent!==null;){e=e.parent;var t=e.f;if((t&(Se|ce))!==0){if((t&W)===0)return;e.f^=W}}ot.push(e)}function dr(a){for(var e=[],t=a;t!==null;){var n=t.f,r=(n&(ce|Se))!==0,i=r&&(n&W)!==0;if(!i&&(n&at)===0){(n&ra)!==0?e.push(t):r?t.f^=W:lt(t)&&Lt(t);var o=t.first;if(o!==null){t=o;continue}}var s=t.parent;for(t=t.next;t===null&&s!==null;)t=s.next,s=s.parent}return e}function R(a){var e=a.f,t=(e&Q)!==0;if(A!==null&&!ee){if(!(D!=null&&D.includes(a))){var n=A.deps;a.rv<st&&(a.rv=st,Z===null&&n!==null&&n[U]===a?U++:Z===null?Z=[a]:(!pe||!Z.includes(a))&&Z.push(a))}}else if(t&&a.deps===null&&a.effects===null){var r=a,i=r.parent;i!==null&&(i.f&B)===0&&(r.f^=B)}return t&&(r=a,lt(r)&&pa(r)),Ae&&$e.has(a)?$e.get(a):a.v}function pr(a){var e=ee;try{return ee=!0,a()}finally{ee=e}}const fr=-7169;function te(a,e){a.f=a.f&fr|e}const mr=["touchstart","touchmove"];function hr(a){return mr.includes(a)}const yr=new Set,Ra=new Set;function ut(a){var P;var e=this,t=e.ownerDocument,n=a.type,r=((P=a.composedPath)==null?void 0:P.call(a))||[],i=r[0]||a.target,o=0,s=a.__root;if(s){var l=r.indexOf(s);if(l!==-1&&(e===document||e===window)){a.__root=e;return}var c=r.indexOf(e);if(c===-1)return;l<=c&&(o=l)}if(i=r[o]||a.target,i!==e){Cn(a,"currentTarget",{configurable:!0,get(){return i||t}});var d=A,p=N;de(null),Me(null);try{for(var h,x=[];i!==null;){var C=i.assignedSlot||i.parentNode||i.host||null;try{var O=i["__"+n];if(O!=null&&(!i.disabled||a.target===i))if(j(O)){var[z,...K]=O;z.apply(i,[a,...K])}else O.call(i,a)}catch(T){h?x.push(T):h=T}if(a.cancelBubble||C===e||C===null)break;i=C}if(h){for(let T of x)queueMicrotask(()=>{throw T});throw h}}finally{a.__root=e,delete a.currentTarget,de(d),Me(p)}}}function gr(a){var e=document.createElement("template");return e.innerHTML=a.replaceAll("<!>","<!---->"),e.content}function _r(a,e){var t=N;t.nodes_start===null&&(t.nodes_start=a,t.nodes_end=e)}function Pa(a,e){var t,n=!a.startsWith("<!>");return()=>{t===void 0&&(t=gr(n?a:"<!>"+a),t=_a(t));var r=ha?document.importNode(t,!0):t.cloneNode(!0);return _r(r,r),r}}function La(a,e){a!==null&&a.before(e)}function Oa(a,e){return vr(a,e)}const Ne=new Map;function vr(a,{target:e,anchor:t,props:n={},events:r,context:i,intro:o=!0}){$n();var s=new Set,l=p=>{for(var h=0;h<p.length;h++){var x=p[h];if(!s.has(x)){s.add(x);var C=hr(x);e.addEventListener(x,ut,{passive:C});var O=Ne.get(x);O===void 0?(document.addEventListener(x,ut,{passive:C}),Ne.set(x,1)):Ne.set(x,O+1)}}};l(Sn(yr)),Ra.add(l);var c=void 0,d=Hn(()=>{var p=t??e.appendChild(Un());return Gn(()=>{if(i){Et({});var h=Y;h.c=i}r&&(n.$$events=r),c=a(p,n)||{},i&&At()}),()=>{var C;for(var h of s){e.removeEventListener(h,ut);var x=Ne.get(h);--x===0?(document.removeEventListener(h,ut),Ne.delete(h)):Ne.set(h,x)}Ra.delete(l),p!==t&&((C=p.parentNode)==null||C.removeChild(p))}});return xr.set(c,d),c}let xr=new WeakMap;const ja=[...`
|
|
2
|
+
\r\f \v\uFEFF`];function wr(a,e,t){var n=a==null?"":""+a;if(t){for(var r in t)if(t[r])n=n?n+" "+r:r;else if(n.length)for(var i=r.length,o=0;(o=n.indexOf(r,o))>=0;){var s=o+i;(o===0||ja.includes(n[o-1]))&&(s===n.length||ja.includes(n[s]))?n=(o===0?"":n.substring(0,o))+n.substring(s+1):o=s}}return n===""?null:n}function Ia(a,e=!1){var t=e?" !important;":";",n="";for(var r in a){var i=a[r];i!=null&&i!==""&&(n+=" "+r+": "+i+t)}return n}function br(a,e){if(e){var t="",n,r;return Array.isArray(e)?(n=e[0],r=e[1]):n=e,n&&(t+=Ia(n)),r&&(t+=Ia(r,!0)),t=t.trim(),t===""?null:t}return String(a)}function Da(a,e,t,n,r,i){var o=a.__className;if(o!==t||o===void 0){var s=wr(t,n,i);s==null?a.removeAttribute("class"):a.className=s,a.__className=t}else if(i&&r!==i)for(var l in i){var c=!!i[l];(r==null||c!==!!r[l])&&a.classList.toggle(l,c)}return i}function jt(a,e={},t,n){for(var r in t){var i=t[r];e[r]!==i&&(t[r]==null?a.style.removeProperty(r):a.style.setProperty(r,i,n))}}function Za(a,e,t,n){var r=a.__style;if(r!==e){var i=br(e,n);i==null?a.removeAttribute("style"):a.style.cssText=i,a.__style=e}else n&&(Array.isArray(n)?(jt(a,t==null?void 0:t[0],n[0]),jt(a,t==null?void 0:t[1],n[1],"important")):jt(a,t,n));return n}const kr=()=>performance.now(),ae={tick:a=>requestAnimationFrame(a),now:()=>kr(),tasks:new Set};function Fa(){const a=ae.now();ae.tasks.forEach(e=>{e.c(a)||(ae.tasks.delete(e),e.f())}),ae.tasks.size!==0&&ae.tick(Fa)}function zr(a){let e;return ae.tasks.size===0&&ae.tick(Fa),{promise:new Promise(t=>{ae.tasks.add(e={c:a,f:t})}),abort(){ae.tasks.delete(e)}}}function Va(a,e){return a===e||(a==null?void 0:a[nt])===e}function Te(a={},e,t,n){return Rt(()=>{var r,i;return xa(()=>{r=i,i=[],pr(()=>{a!==t(...i)&&(e(a,...i),r&&Va(t(...r),a)&&e(null,...r))})}),()=>{nr(()=>{i&&Va(t(...i),a)&&e(null,...i)})}}),a}const Sr="5";typeof window<"u"&&((mn=window.__svelte??(window.__svelte={})).v??(mn.v=new Set)).add(Sr);function Cr(a){return a}function It(a){return-.5*(Math.cos(Math.PI*a)-1)}function Er(a){const e=Math.cos(a*Math.PI*.5);return Math.abs(e)<1e-14?1:1-e}function Ar(a){return Math.sin(a*Math.PI/2)}const Mr=128,Nr=0,Dt=1,Tr=2;class Rr{constructor(){g(this,"animationsStarted",!1);g(this,"animationsCount",0);g(this,"animationsLimit",Mr);g(this,"layers",new Array)}start(){window.requestAnimationFrame(this.tick.bind(this))}tick(){try{this.animationsCount=0;for(let e=0;e<this.layers.length;e++){const t=this.layers[e];if(t==null)continue;const n=t.animations;if(n!=null)for(let r=0;r<n.length;r++){const i=n[r];if(i!=null){for(const o of i.values())if(!o.executed&&(o.executed=!0,o.function(),this.animationsCount++,this.animationsCount==this.animationsLimit))return}}}}finally{window.requestAnimationFrame(this.tick.bind(this))}}equeue(e,t,n,r){let i=this.layers[e];i==null&&(i=this.layers[e]={animations:new Array});let o=i.animations[t];o==null&&(o=i.animations[t]=new Map);let s={id:n,priority:t,executed:!1,function:r};o.set(n,s),this.animationsStarted==!1&&(this.animationsStarted=!0,this.start())}clear(e,t){for(let n=0;n<this.layers.length;n++){let r=this.layers[n];if(r==null)continue;let i=r.animations[e];if(i==null)return;let o=i.get(t);if(o==null||o.executed==!1)return;i.delete(t)}}speed(){return Math.pow(2,2*this.animationsCount/this.animationsLimit)}stacked(){return this.animationsCount==this.animationsLimit}setLimit(e){this.animationsLimit=e}}const ie=new Rr;function Ba(a){return Object.prototype.toString.call(a)==="[object Date]"}function Zt(a,e){if(a===e||a!==a)return()=>a;const t=typeof a;if(t!==typeof e||Array.isArray(a)!==Array.isArray(e))throw new Error("Cannot interpolate values of different type");if(Array.isArray(a)){const n=e.map((r,i)=>Zt(a[i],r));return r=>n.map(i=>i(r))}if(t==="object"){if(!a||!e)throw new Error("Object cannot be null");if(Ba(a)&&Ba(e)){const i=a.getTime(),s=e.getTime()-i;return l=>new Date(i+l*s)}const n=Object.keys(e),r={};return n.forEach(i=>{r[i]=Zt(a[i],e[i])}),i=>{const o={};return n.forEach(s=>{o[s]=r[s](i)}),o}}if(t==="number"){const n=e-a;return r=>a+r*n}return()=>e}const Qt=class Qt{constructor(e,t={}){Ke(this,se,Nt(void 0));Ke(this,Fe,Nt(void 0));Ke(this,Je);Ke(this,ke,null);V(this,se).v=V(this,Fe).v=e,aa(this,Je,t)}static of(e,t){const n=new Qt(e(),t);return xa(()=>{n.set(e())}),n}set(e,t){var p;I(V(this,Fe),e);let{delay:n=0,duration:r=400,easing:i=Cr,interpolate:o=Zt}={...V(this,Je),...t};if(r===0)return(p=V(this,ke))==null||p.abort(),I(V(this,se),e),Promise.resolve();const s=ae.now()+n;let l,c=!1,d=V(this,ke);return aa(this,ke,zr(h=>{if(h<s)return!0;if(!c){c=!0;const C=V(this,se).v;l=o(C,e),typeof r=="function"&&(r=r(C,e)),d==null||d.abort()}const x=h-s;return x>r?(I(V(this,se),e),!1):(I(V(this,se),l(i(x/r))),!0)})),V(this,ke).promise}get current(){return R(V(this,se))}get target(){return R(V(this,Fe))}set target(e){this.set(e)}};se=new WeakMap,Fe=new WeakMap,Je=new WeakMap,ke=new WeakMap;let Ft=Qt;class dt{constructor(e,t){g(this,"value");g(this,"motion");this.value=e,this.motion=new Ft(e,t)}set(e,t){this.value=e,this.motion.set(e,t)}update(e){this.motion.set(this.value,e)}snap(){this.motion.set(this.value,{duration:0})}}function $a(a,e,t){const n=t*(Math.PI/180),r=a/2,i=e/2,o=Math.sqrt(r*r+i*i),s=Math.atan(i/r)*(180/Math.PI),l=s,c=180-s,d=180+s,p=360-s;switch(!0){case(l<=t&&t<=c):return{offsetX:o*Math.cos(n)-r,offsetY:0};case(c<=t&&t<=d):return{offsetX:-a,offsetY:o*Math.sin(n)-i};case(d<=t&&t<=p):return{offsetX:o*Math.cos(n)-r,offsetY:-e};default:return{offsetX:0,offsetY:o*Math.sin(n)-i}}}var Pr=Pa('<div><div class="pin svelte-11owlij"></div> <div class="marker svelte-11owlij"><div class="body svelte-11owlij"></div></div></div>');function Lr(a,e){Et(e,!0);let t,n,r,i;const o=e.width+2*e.padding,s=e.height+2*e.padding,l=()=>i;re(()=>{r.style.width=`${Math.min(o,s)/4}px`,r.style.height=`${Math.min(o,s)/4}px`});let c=X(!0);function d(E){I(c,E,!0)}function p(){return R(c)}let h=X(!0);function x(E){I(h,E,!0)}function C(){return z.motion.current==0}function O(){return R(h)==!1}let z=new dt(0),K=Dt;re(()=>{P(z.motion.current)}),re(()=>{R(c)==!1&&(z.snap(),ie.clear(e.priority,e.id+"_scale"))}),re(()=>{R(h)==!0&&z.value!=0&&(K=Nr,ie.stacked()?z.set(0,{duration:0}):z.set(0,{duration:150,easing:Er})),R(h)==!1&&z.value!=1&&(K=Dt,z.set(1,{duration:150,easing:Ar}))});function P(E){!t||!n||!r||ie.equeue(K,e.priority,e.id+"_scale",()=>{t.style.opacity=`${E}`,n.style.scale=`${E}`,r.style.scale=`${E}`})}let T=NaN,Ge=X(!1),ve=new dt(-o/2,{easing:It}),vt=new dt(-s/2,{easing:It});re(()=>{hn(ve.motion.current,vt.motion.current)}),re(()=>{R(c)==!1&&(ve.snap(),ve.snap(),ie.clear(e.priority,e.id+"_angle"))}),re(()=>{R(h)==!0&&R(Ge)&&(ve.update({duration:75}),ve.update({duration:75}))});function hn(E,le){if(!t||!n||!r)return;const Ve=E+o/2,ze=le+s/2,wt=s<o?Ve*s/o:Ve,zi=s>o?ze*o/s:ze,Si=Math.atan2(zi,wt)/Math.PI*180-45,wn=0,Ci=30,ta=Math.sqrt(Ve*Ve+ze*ze),bt=Math.min(o,s)/2,Ei=Math.sqrt(o*o+s*s)/2,Ai=(ta-bt)/(Ei-bt),bn=wn+Ai*(Ci-wn),Mi=ta<bt?ta/bt:1;ie.equeue(Dt,e.priority,e.id+"_angle",()=>{n.style.transform=`translate(${Math.round(E)}px, ${Math.round(le)}px)`,r.style.transform=`scale(${Mi}) rotate(${Si}deg) skew(${bn}deg, ${bn}deg)`})}function ki(E){if(R(Ge)==!1){let le=$a(o,s,E);ve.set(Math.round(le.offsetX),{duration:0}),vt.set(Math.round(le.offsetY),{duration:0}),hn(ve.value,vt.value),T=E,I(Ge,!0)}else if(E!=T){let le=Math.abs(E-T),Ve=le<180?le:360-le,ze=Math.log(Ve)*75,wt=$a(o,s,E);ve.set(Math.round(wt.offsetX),{duration:R(Ge)?ze:0}),vt.set(Math.round(wt.offsetY),{duration:R(Ge)?ze:0}),T=E}}var xt=Pr();let yn;var gn=Tt(xt);Te(gn,E=>r=E,()=>r);var ea=qn(gn,2);let _n;var vn=Tt(ea);let xn;return Te(vn,E=>i=E,()=>i),Te(ea,E=>n=E,()=>n),Te(xt,E=>t=E,()=>t),wa(E=>{yn=Da(xt,1,"anchor svelte-11owlij",null,yn,E),_n=Za(ea,"",_n,{padding:e.padding+"px"}),xn=Za(vn,"",xn,{width:`${e.width}px`,height:`${e.height}px`})},[()=>({displayed:R(c)})]),La(a,xt),At({getBody:l,setDisplayed:d,getDisplayed:p,setCollapsed:x,getCollapsed:C,getExpanded:O,setAngle:ki})}var Or=Pa('<div><div class="body svelte-piqgmq"></div></div>');function jr(a,e){Et(e,!0);let t,n;function r(){return n}let i=X(!1);function o(z){I(i,z,!0)}function s(){return R(i)}let l=new dt(0,{easing:It});re(()=>{c(l.motion.current)}),re(()=>{R(i)==!1&&(l.snap(),ie.clear(e.priority,e.id))});function c(z){t&&ie.equeue(Tr,e.priority,e.id,()=>{t.style.scale=z.toString(),t.style.filter=`brightness(${.25+.75*z})`,n.style.opacity=z.toString()})}function d(z){z!=l.value&&l.set(z,{duration:75})}function p(){return l.motion.current==0}function h(){return l.value}var x=Or();let C;var O=Tt(x);return Te(O,z=>n=z,()=>n),Te(x,z=>t=z,()=>t),wa(z=>C=Da(x,1,"circle svelte-piqgmq",null,C,z),[()=>({displayed:R(i)})]),La(a,x),At({getBody:r,setDisplayed:o,getDisplayed:s,setScale:d,getCollapsed:p,getScale:h})}async function pt(a,e){try{await fetch("https://arenarium.dev/api/public/v1/log?log="+encodeURIComponent(JSON.stringify({title:a,content:e})))}catch(t){console.error(t)}}class Re{constructor(e,t,n,r){g(this,"swLat");g(this,"swLng");g(this,"neLat");g(this,"neLng");g(this,"contains",(e,t)=>this.swLat<=e&&e<=this.neLat&&this.swLng<=t&&t<=this.neLng);this.swLat=t,this.swLng=e,this.neLat=r,this.neLng=n}}class Ua{constructor(e,t,n,r,i){g(this,"bounds1");g(this,"bounds2");g(this,"contains",(e,t)=>this.bounds1.contains(e,t)||this.bounds2.contains(e,t));const o=e.unproject([t,n]),s=e.unproject([r,i]);if(o.lng<-180){this.bounds1=new Re(-180,o.lat,s.lng,s.lat),this.bounds2=new Re(o.wrap().lng,o.lat,180,s.lat);return}if(s.lng>180){this.bounds1=new Re(o.lng,o.lat,180,s.lat),this.bounds2=new Re(-180,o.lat,s.wrap().lng,s.lat);return}this.bounds1=new Re(o.lng,o.lat,s.lng,s.lat),this.bounds2=new Re(0,0,0,0)}}var k;(function(a){a.assertEqual=r=>{};function e(r){}a.assertIs=e;function t(r){throw new Error}a.assertNever=t,a.arrayToEnum=r=>{const i={};for(const o of r)i[o]=o;return i},a.getValidEnumValues=r=>{const i=a.objectKeys(r).filter(s=>typeof r[r[s]]!="number"),o={};for(const s of i)o[s]=r[s];return a.objectValues(o)},a.objectValues=r=>a.objectKeys(r).map(function(i){return r[i]}),a.objectKeys=typeof Object.keys=="function"?r=>Object.keys(r):r=>{const i=[];for(const o in r)Object.prototype.hasOwnProperty.call(r,o)&&i.push(o);return i},a.find=(r,i)=>{for(const o of r)if(i(o))return o},a.isInteger=typeof Number.isInteger=="function"?r=>Number.isInteger(r):r=>typeof r=="number"&&Number.isFinite(r)&&Math.floor(r)===r;function n(r,i=" | "){return r.map(o=>typeof o=="string"?`'${o}'`:o).join(i)}a.joinValues=n,a.jsonStringifyReplacer=(r,i)=>typeof i=="bigint"?i.toString():i})(k||(k={}));var qa;(function(a){a.mergeShapes=(e,t)=>({...e,...t})})(qa||(qa={}));const m=k.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),fe=a=>{switch(typeof a){case"undefined":return m.undefined;case"string":return m.string;case"number":return Number.isNaN(a)?m.nan:m.number;case"boolean":return m.boolean;case"function":return m.function;case"bigint":return m.bigint;case"symbol":return m.symbol;case"object":return Array.isArray(a)?m.array:a===null?m.null:a.then&&typeof a.then=="function"&&a.catch&&typeof a.catch=="function"?m.promise:typeof Map<"u"&&a instanceof Map?m.map:typeof Set<"u"&&a instanceof Set?m.set:typeof Date<"u"&&a instanceof Date?m.date:m.object;default:return m.unknown}},u=k.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class J extends Error{get errors(){return this.issues}constructor(e){super(),this.issues=[],this.addIssue=n=>{this.issues=[...this.issues,n]},this.addIssues=(n=[])=>{this.issues=[...this.issues,...n]};const t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}format(e){const t=e||function(i){return i.message},n={_errors:[]},r=i=>{for(const o of i.issues)if(o.code==="invalid_union")o.unionErrors.map(r);else if(o.code==="invalid_return_type")r(o.returnTypeError);else if(o.code==="invalid_arguments")r(o.argumentsError);else if(o.path.length===0)n._errors.push(t(o));else{let s=n,l=0;for(;l<o.path.length;){const c=o.path[l];l===o.path.length-1?(s[c]=s[c]||{_errors:[]},s[c]._errors.push(t(o))):s[c]=s[c]||{_errors:[]},s=s[c],l++}}};return r(this),n}static assert(e){if(!(e instanceof J))throw new Error(`Not a ZodError: ${e}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,k.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(e=t=>t.message){const t={},n=[];for(const r of this.issues)r.path.length>0?(t[r.path[0]]=t[r.path[0]]||[],t[r.path[0]].push(e(r))):n.push(e(r));return{formErrors:n,fieldErrors:t}}get formErrors(){return this.flatten()}}J.create=a=>new J(a);const Ue=(a,e)=>{let t;switch(a.code){case u.invalid_type:a.received===m.undefined?t="Required":t=`Expected ${a.expected}, received ${a.received}`;break;case u.invalid_literal:t=`Invalid literal value, expected ${JSON.stringify(a.expected,k.jsonStringifyReplacer)}`;break;case u.unrecognized_keys:t=`Unrecognized key(s) in object: ${k.joinValues(a.keys,", ")}`;break;case u.invalid_union:t="Invalid input";break;case u.invalid_union_discriminator:t=`Invalid discriminator value. Expected ${k.joinValues(a.options)}`;break;case u.invalid_enum_value:t=`Invalid enum value. Expected ${k.joinValues(a.options)}, received '${a.received}'`;break;case u.invalid_arguments:t="Invalid function arguments";break;case u.invalid_return_type:t="Invalid function return type";break;case u.invalid_date:t="Invalid date";break;case u.invalid_string:typeof a.validation=="object"?"includes"in a.validation?(t=`Invalid input: must include "${a.validation.includes}"`,typeof a.validation.position=="number"&&(t=`${t} at one or more positions greater than or equal to ${a.validation.position}`)):"startsWith"in a.validation?t=`Invalid input: must start with "${a.validation.startsWith}"`:"endsWith"in a.validation?t=`Invalid input: must end with "${a.validation.endsWith}"`:k.assertNever(a.validation):a.validation!=="regex"?t=`Invalid ${a.validation}`:t="Invalid";break;case u.too_small:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at least":"more than"} ${a.minimum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at least":"over"} ${a.minimum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${a.minimum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly equal to ":a.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(a.minimum))}`:t="Invalid input";break;case u.too_big:a.type==="array"?t=`Array must contain ${a.exact?"exactly":a.inclusive?"at most":"less than"} ${a.maximum} element(s)`:a.type==="string"?t=`String must contain ${a.exact?"exactly":a.inclusive?"at most":"under"} ${a.maximum} character(s)`:a.type==="number"?t=`Number must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="bigint"?t=`BigInt must be ${a.exact?"exactly":a.inclusive?"less than or equal to":"less than"} ${a.maximum}`:a.type==="date"?t=`Date must be ${a.exact?"exactly":a.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(a.maximum))}`:t="Invalid input";break;case u.custom:t="Invalid input";break;case u.invalid_intersection_types:t="Intersection results could not be merged";break;case u.not_multiple_of:t=`Number must be a multiple of ${a.multipleOf}`;break;case u.not_finite:t="Number must be finite";break;default:t=e.defaultError,k.assertNever(a)}return{message:t}};let Ir=Ue;function Vt(){return Ir}const Bt=a=>{const{data:e,path:t,errorMaps:n,issueData:r}=a,i=[...t,...r.path||[]],o={...r,path:i};if(r.message!==void 0)return{...r,path:i,message:r.message};let s="";const l=n.filter(c=>!!c).slice().reverse();for(const c of l)s=c(o,{data:e,defaultError:s}).message;return{...r,path:i,message:s}};function f(a,e){const t=Vt(),n=Bt({issueData:e,data:a.data,path:a.path,errorMaps:[a.common.contextualErrorMap,a.schemaErrorMap,t,t===Ue?void 0:Ue].filter(r=>!!r)});a.common.issues.push(n)}class q{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(e,t){const n=[];for(const r of t){if(r.status==="aborted")return _;r.status==="dirty"&&e.dirty(),n.push(r.value)}return{status:e.value,value:n}}static async mergeObjectAsync(e,t){const n=[];for(const r of t){const i=await r.key,o=await r.value;n.push({key:i,value:o})}return q.mergeObjectSync(e,n)}static mergeObjectSync(e,t){const n={};for(const r of t){const{key:i,value:o}=r;if(i.status==="aborted"||o.status==="aborted")return _;i.status==="dirty"&&e.dirty(),o.status==="dirty"&&e.dirty(),i.value!=="__proto__"&&(typeof o.value<"u"||r.alwaysSet)&&(n[i.value]=o.value)}return{status:e.value,value:n}}}const _=Object.freeze({status:"aborted"}),qe=a=>({status:"dirty",value:a}),F=a=>({status:"valid",value:a}),Wa=a=>a.status==="aborted",Ya=a=>a.status==="dirty",Pe=a=>a.status==="valid",ft=a=>typeof Promise<"u"&&a instanceof Promise;var y;(function(a){a.errToObj=e=>typeof e=="string"?{message:e}:e||{},a.toString=e=>typeof e=="string"?e:e==null?void 0:e.message})(y||(y={}));class me{constructor(e,t,n,r){this._cachedPath=[],this.parent=e,this.data=t,this._path=n,this._key=r}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const Xa=(a,e)=>{if(Pe(e))return{success:!0,data:e.value};if(!a.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const t=new J(a.common.issues);return this._error=t,this._error}}};function w(a){if(!a)return{};const{errorMap:e,invalid_type_error:t,required_error:n,description:r}=a;if(e&&(t||n))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return e?{errorMap:e,description:r}:{errorMap:(o,s)=>{const{message:l}=a;return o.code==="invalid_enum_value"?{message:l??s.defaultError}:typeof s.data>"u"?{message:l??n??s.defaultError}:o.code!=="invalid_type"?{message:s.defaultError}:{message:l??t??s.defaultError}},description:r}}class b{get description(){return this._def.description}_getType(e){return fe(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:fe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new q,ctx:{common:e.parent.common,data:e.data,parsedType:fe(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){const t=this._parse(e);if(ft(t))throw new Error("Synchronous parse encountered promise.");return t}_parseAsync(e){const t=this._parse(e);return Promise.resolve(t)}parse(e,t){const n=this.safeParse(e,t);if(n.success)return n.data;throw n.error}safeParse(e,t){const n={common:{issues:[],async:(t==null?void 0:t.async)??!1,contextualErrorMap:t==null?void 0:t.errorMap},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:fe(e)},r=this._parseSync({data:e,path:n.path,parent:n});return Xa(n,r)}"~validate"(e){var n,r;const t={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:fe(e)};if(!this["~standard"].async)try{const i=this._parseSync({data:e,path:[],parent:t});return Pe(i)?{value:i.value}:{issues:t.common.issues}}catch(i){(r=(n=i==null?void 0:i.message)==null?void 0:n.toLowerCase())!=null&&r.includes("encountered")&&(this["~standard"].async=!0),t.common={issues:[],async:!0}}return this._parseAsync({data:e,path:[],parent:t}).then(i=>Pe(i)?{value:i.value}:{issues:t.common.issues})}async parseAsync(e,t){const n=await this.safeParseAsync(e,t);if(n.success)return n.data;throw n.error}async safeParseAsync(e,t){const n={common:{issues:[],contextualErrorMap:t==null?void 0:t.errorMap,async:!0},path:(t==null?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:fe(e)},r=this._parse({data:e,path:n.path,parent:n}),i=await(ft(r)?r:Promise.resolve(r));return Xa(n,i)}refine(e,t){const n=r=>typeof t=="string"||typeof t>"u"?{message:t}:typeof t=="function"?t(r):t;return this._refinement((r,i)=>{const o=e(r),s=()=>i.addIssue({code:u.custom,...n(r)});return typeof Promise<"u"&&o instanceof Promise?o.then(l=>l?!0:(s(),!1)):o?!0:(s(),!1)})}refinement(e,t){return this._refinement((n,r)=>e(n)?!0:(r.addIssue(typeof t=="function"?t(n,r):t),!1))}_refinement(e){return new De({schema:this,typeName:v.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:t=>this["~validate"](t)}}optional(){return ge.create(this,this._def)}nullable(){return Ze.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ne.create(this)}promise(){return He.create(this,this._def)}or(e){return ht.create([this,e],this._def)}and(e){return yt.create(this,e,this._def)}transform(e){return new De({...w(this._def),schema:this,typeName:v.ZodEffects,effect:{type:"transform",transform:e}})}default(e){const t=typeof e=="function"?e:()=>e;return new Yt({...w(this._def),innerType:this,defaultValue:t,typeName:v.ZodDefault})}brand(){return new oi({typeName:v.ZodBranded,type:this,...w(this._def)})}catch(e){const t=typeof e=="function"?e:()=>e;return new Xt({...w(this._def),innerType:this,catchValue:t,typeName:v.ZodCatch})}describe(e){const t=this.constructor;return new t({...this._def,description:e})}pipe(e){return Ht.create(this,e)}readonly(){return Jt.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Dr=/^c[^\s-]{8,}$/i,Zr=/^[0-9a-z]+$/,Fr=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Vr=/^[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,Br=/^[a-z0-9_-]{21}$/i,$r=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Ur=/^[-+]?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)?)??$/,qr=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Wr="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let $t;const Yr=/^(?:(?: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])$/,Xr=/^(?:(?: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])$/,Hr=/^(([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]))$/,Jr=/^(([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])$/,Gr=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,Kr=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ha="((\\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])))",Qr=new RegExp(`^${Ha}$`);function Ja(a){let e="[0-5]\\d";a.precision?e=`${e}\\.\\d{${a.precision}}`:a.precision==null&&(e=`${e}(\\.\\d+)?`);const t=a.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`}function ei(a){return new RegExp(`^${Ja(a)}$`)}function ti(a){let e=`${Ha}T${Ja(a)}`;const t=[];return t.push(a.local?"Z?":"Z"),a.offset&&t.push("([+-]\\d{2}:?\\d{2})"),e=`${e}(${t.join("|")})`,new RegExp(`^${e}$`)}function ai(a,e){return!!((e==="v4"||!e)&&Yr.test(a)||(e==="v6"||!e)&&Hr.test(a))}function ni(a,e){if(!$r.test(a))return!1;try{const[t]=a.split("."),n=t.replace(/-/g,"+").replace(/_/g,"/").padEnd(t.length+(4-t.length%4)%4,"="),r=JSON.parse(atob(n));return!(typeof r!="object"||r===null||"typ"in r&&(r==null?void 0:r.typ)!=="JWT"||!r.alg||e&&r.alg!==e)}catch{return!1}}function ri(a,e){return!!((e==="v4"||!e)&&Xr.test(a)||(e==="v6"||!e)&&Jr.test(a))}class he extends b{_parse(e){if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==m.string){const i=this._getOrReturnCtx(e);return f(i,{code:u.invalid_type,expected:m.string,received:i.parsedType}),_}const n=new q;let r;for(const i of this._def.checks)if(i.kind==="min")e.data.length<i.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="max")e.data.length>i.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!1,message:i.message}),n.dirty());else if(i.kind==="length"){const o=e.data.length>i.value,s=e.data.length<i.value;(o||s)&&(r=this._getOrReturnCtx(e,r),o?f(r,{code:u.too_big,maximum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}):s&&f(r,{code:u.too_small,minimum:i.value,type:"string",inclusive:!0,exact:!0,message:i.message}),n.dirty())}else if(i.kind==="email")qr.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"email",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="emoji")$t||($t=new RegExp(Wr,"u")),$t.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"emoji",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="uuid")Vr.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"uuid",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="nanoid")Br.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"nanoid",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid")Dr.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"cuid",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="cuid2")Zr.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"cuid2",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="ulid")Fr.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"ulid",code:u.invalid_string,message:i.message}),n.dirty());else if(i.kind==="url")try{new URL(e.data)}catch{r=this._getOrReturnCtx(e,r),f(r,{validation:"url",code:u.invalid_string,message:i.message}),n.dirty()}else i.kind==="regex"?(i.regex.lastIndex=0,i.regex.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"regex",code:u.invalid_string,message:i.message}),n.dirty())):i.kind==="trim"?e.data=e.data.trim():i.kind==="includes"?e.data.includes(i.value,i.position)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.invalid_string,validation:{includes:i.value,position:i.position},message:i.message}),n.dirty()):i.kind==="toLowerCase"?e.data=e.data.toLowerCase():i.kind==="toUpperCase"?e.data=e.data.toUpperCase():i.kind==="startsWith"?e.data.startsWith(i.value)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.invalid_string,validation:{startsWith:i.value},message:i.message}),n.dirty()):i.kind==="endsWith"?e.data.endsWith(i.value)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.invalid_string,validation:{endsWith:i.value},message:i.message}),n.dirty()):i.kind==="datetime"?ti(i).test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.invalid_string,validation:"datetime",message:i.message}),n.dirty()):i.kind==="date"?Qr.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.invalid_string,validation:"date",message:i.message}),n.dirty()):i.kind==="time"?ei(i).test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{code:u.invalid_string,validation:"time",message:i.message}),n.dirty()):i.kind==="duration"?Ur.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"duration",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="ip"?ai(e.data,i.version)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"ip",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="jwt"?ni(e.data,i.alg)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"jwt",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="cidr"?ri(e.data,i.version)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"cidr",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="base64"?Gr.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"base64",code:u.invalid_string,message:i.message}),n.dirty()):i.kind==="base64url"?Kr.test(e.data)||(r=this._getOrReturnCtx(e,r),f(r,{validation:"base64url",code:u.invalid_string,message:i.message}),n.dirty()):k.assertNever(i);return{status:n.value,value:e.data}}_regex(e,t,n){return this.refinement(r=>e.test(r),{validation:t,code:u.invalid_string,...y.errToObj(n)})}_addCheck(e){return new he({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...y.errToObj(e)})}url(e){return this._addCheck({kind:"url",...y.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...y.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...y.errToObj(e)})}nanoid(e){return this._addCheck({kind:"nanoid",...y.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...y.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...y.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...y.errToObj(e)})}base64(e){return this._addCheck({kind:"base64",...y.errToObj(e)})}base64url(e){return this._addCheck({kind:"base64url",...y.errToObj(e)})}jwt(e){return this._addCheck({kind:"jwt",...y.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...y.errToObj(e)})}cidr(e){return this._addCheck({kind:"cidr",...y.errToObj(e)})}datetime(e){return typeof e=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:e}):this._addCheck({kind:"datetime",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,offset:(e==null?void 0:e.offset)??!1,local:(e==null?void 0:e.local)??!1,...y.errToObj(e==null?void 0:e.message)})}date(e){return this._addCheck({kind:"date",message:e})}time(e){return typeof e=="string"?this._addCheck({kind:"time",precision:null,message:e}):this._addCheck({kind:"time",precision:typeof(e==null?void 0:e.precision)>"u"?null:e==null?void 0:e.precision,...y.errToObj(e==null?void 0:e.message)})}duration(e){return this._addCheck({kind:"duration",...y.errToObj(e)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...y.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:t==null?void 0:t.position,...y.errToObj(t==null?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...y.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...y.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...y.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...y.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...y.errToObj(t)})}nonempty(e){return this.min(1,y.errToObj(e))}trim(){return new he({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new he({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new he({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>e.kind==="datetime")}get isDate(){return!!this._def.checks.find(e=>e.kind==="date")}get isTime(){return!!this._def.checks.find(e=>e.kind==="time")}get isDuration(){return!!this._def.checks.find(e=>e.kind==="duration")}get isEmail(){return!!this._def.checks.find(e=>e.kind==="email")}get isURL(){return!!this._def.checks.find(e=>e.kind==="url")}get isEmoji(){return!!this._def.checks.find(e=>e.kind==="emoji")}get isUUID(){return!!this._def.checks.find(e=>e.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(e=>e.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(e=>e.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(e=>e.kind==="cuid2")}get isULID(){return!!this._def.checks.find(e=>e.kind==="ulid")}get isIP(){return!!this._def.checks.find(e=>e.kind==="ip")}get isCIDR(){return!!this._def.checks.find(e=>e.kind==="cidr")}get isBase64(){return!!this._def.checks.find(e=>e.kind==="base64")}get isBase64url(){return!!this._def.checks.find(e=>e.kind==="base64url")}get minLength(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}he.create=a=>new he({checks:[],typeName:v.ZodString,coerce:(a==null?void 0:a.coerce)??!1,...w(a)});function ii(a,e){const t=(a.toString().split(".")[1]||"").length,n=(e.toString().split(".")[1]||"").length,r=t>n?t:n,i=Number.parseInt(a.toFixed(r).replace(".","")),o=Number.parseInt(e.toFixed(r).replace(".",""));return i%o/10**r}class Le extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==m.number){const i=this._getOrReturnCtx(e);return f(i,{code:u.invalid_type,expected:m.number,received:i.parsedType}),_}let n;const r=new q;for(const i of this._def.checks)i.kind==="int"?k.isInteger(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:u.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):i.kind==="multipleOf"?ii(e.data,i.value)!==0&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):i.kind==="finite"?Number.isFinite(e.data)||(n=this._getOrReturnCtx(e,n),f(n,{code:u.not_finite,message:i.message}),r.dirty()):k.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,n,r){return new Le({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new Le({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:y.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:y.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:y.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:y.toString(e)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>e.kind==="int"||e.kind==="multipleOf"&&k.isInteger(e.value))}get isFinite(){let e=null,t=null;for(const n of this._def.checks){if(n.kind==="finite"||n.kind==="int"||n.kind==="multipleOf")return!0;n.kind==="min"?(t===null||n.value>t)&&(t=n.value):n.kind==="max"&&(e===null||n.value<e)&&(e=n.value)}return Number.isFinite(t)&&Number.isFinite(e)}}Le.create=a=>new Le({checks:[],typeName:v.ZodNumber,coerce:(a==null?void 0:a.coerce)||!1,...w(a)});class We extends b{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){if(this._def.coerce)try{e.data=BigInt(e.data)}catch{return this._getInvalidInput(e)}if(this._getType(e)!==m.bigint)return this._getInvalidInput(e);let n;const r=new q;for(const i of this._def.checks)i.kind==="min"?(i.inclusive?e.data<i.value:e.data<=i.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="max"?(i.inclusive?e.data>i.value:e.data>=i.value)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):i.kind==="multipleOf"?e.data%i.value!==BigInt(0)&&(n=this._getOrReturnCtx(e,n),f(n,{code:u.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):k.assertNever(i);return{status:r.value,value:e.data}}_getInvalidInput(e){const t=this._getOrReturnCtx(e);return f(t,{code:u.invalid_type,expected:m.bigint,received:t.parsedType}),_}gte(e,t){return this.setLimit("min",e,!0,y.toString(t))}gt(e,t){return this.setLimit("min",e,!1,y.toString(t))}lte(e,t){return this.setLimit("max",e,!0,y.toString(t))}lt(e,t){return this.setLimit("max",e,!1,y.toString(t))}setLimit(e,t,n,r){return new We({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:n,message:y.toString(r)}]})}_addCheck(e){return new We({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:y.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:y.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:y.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:y.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:y.toString(t)})}get minValue(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e}}We.create=a=>new We({checks:[],typeName:v.ZodBigInt,coerce:(a==null?void 0:a.coerce)??!1,...w(a)});class Ut extends b{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==m.boolean){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.boolean,received:n.parsedType}),_}return F(e.data)}}Ut.create=a=>new Ut({typeName:v.ZodBoolean,coerce:(a==null?void 0:a.coerce)||!1,...w(a)});class mt extends b{_parse(e){if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==m.date){const i=this._getOrReturnCtx(e);return f(i,{code:u.invalid_type,expected:m.date,received:i.parsedType}),_}if(Number.isNaN(e.data.getTime())){const i=this._getOrReturnCtx(e);return f(i,{code:u.invalid_date}),_}const n=new q;let r;for(const i of this._def.checks)i.kind==="min"?e.data.getTime()<i.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),n.dirty()):i.kind==="max"?e.data.getTime()>i.value&&(r=this._getOrReturnCtx(e,r),f(r,{code:u.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),n.dirty()):k.assertNever(i);return{status:n.value,value:new Date(e.data.getTime())}}_addCheck(e){return new mt({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:y.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:y.toString(t)})}get minDate(){let e=null;for(const t of this._def.checks)t.kind==="min"&&(e===null||t.value>e)&&(e=t.value);return e!=null?new Date(e):null}get maxDate(){let e=null;for(const t of this._def.checks)t.kind==="max"&&(e===null||t.value<e)&&(e=t.value);return e!=null?new Date(e):null}}mt.create=a=>new mt({checks:[],coerce:(a==null?void 0:a.coerce)||!1,typeName:v.ZodDate,...w(a)});class Ga extends b{_parse(e){if(this._getType(e)!==m.symbol){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.symbol,received:n.parsedType}),_}return F(e.data)}}Ga.create=a=>new Ga({typeName:v.ZodSymbol,...w(a)});class Ka extends b{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.undefined,received:n.parsedType}),_}return F(e.data)}}Ka.create=a=>new Ka({typeName:v.ZodUndefined,...w(a)});class Qa extends b{_parse(e){if(this._getType(e)!==m.null){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.null,received:n.parsedType}),_}return F(e.data)}}Qa.create=a=>new Qa({typeName:v.ZodNull,...w(a)});class qt extends b{constructor(){super(...arguments),this._any=!0}_parse(e){return F(e.data)}}qt.create=a=>new qt({typeName:v.ZodAny,...w(a)});class Oe extends b{constructor(){super(...arguments),this._unknown=!0}_parse(e){return F(e.data)}}Oe.create=a=>new Oe({typeName:v.ZodUnknown,...w(a)});class ye extends b{_parse(e){const t=this._getOrReturnCtx(e);return f(t,{code:u.invalid_type,expected:m.never,received:t.parsedType}),_}}ye.create=a=>new ye({typeName:v.ZodNever,...w(a)});class en extends b{_parse(e){if(this._getType(e)!==m.undefined){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.void,received:n.parsedType}),_}return F(e.data)}}en.create=a=>new en({typeName:v.ZodVoid,...w(a)});class ne extends b{_parse(e){const{ctx:t,status:n}=this._processInputParams(e),r=this._def;if(t.parsedType!==m.array)return f(t,{code:u.invalid_type,expected:m.array,received:t.parsedType}),_;if(r.exactLength!==null){const o=t.data.length>r.exactLength.value,s=t.data.length<r.exactLength.value;(o||s)&&(f(t,{code:o?u.too_big:u.too_small,minimum:s?r.exactLength.value:void 0,maximum:o?r.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:r.exactLength.message}),n.dirty())}if(r.minLength!==null&&t.data.length<r.minLength.value&&(f(t,{code:u.too_small,minimum:r.minLength.value,type:"array",inclusive:!0,exact:!1,message:r.minLength.message}),n.dirty()),r.maxLength!==null&&t.data.length>r.maxLength.value&&(f(t,{code:u.too_big,maximum:r.maxLength.value,type:"array",inclusive:!0,exact:!1,message:r.maxLength.message}),n.dirty()),t.common.async)return Promise.all([...t.data].map((o,s)=>r.type._parseAsync(new me(t,o,t.path,s)))).then(o=>q.mergeArray(n,o));const i=[...t.data].map((o,s)=>r.type._parseSync(new me(t,o,t.path,s)));return q.mergeArray(n,i)}get element(){return this._def.type}min(e,t){return new ne({...this._def,minLength:{value:e,message:y.toString(t)}})}max(e,t){return new ne({...this._def,maxLength:{value:e,message:y.toString(t)}})}length(e,t){return new ne({...this._def,exactLength:{value:e,message:y.toString(t)}})}nonempty(e){return this.min(1,e)}}ne.create=(a,e)=>new ne({type:a,minLength:null,maxLength:null,exactLength:null,typeName:v.ZodArray,...w(e)});function je(a){if(a instanceof L){const e={};for(const t in a.shape){const n=a.shape[t];e[t]=ge.create(je(n))}return new L({...a._def,shape:()=>e})}else return a instanceof ne?new ne({...a._def,type:je(a.element)}):a instanceof ge?ge.create(je(a.unwrap())):a instanceof Ze?Ze.create(je(a.unwrap())):a instanceof oe?oe.create(a.items.map(e=>je(e))):a}class L extends b{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const e=this._def.shape(),t=k.objectKeys(e);return this._cached={shape:e,keys:t},this._cached}_parse(e){if(this._getType(e)!==m.object){const c=this._getOrReturnCtx(e);return f(c,{code:u.invalid_type,expected:m.object,received:c.parsedType}),_}const{status:n,ctx:r}=this._processInputParams(e),{shape:i,keys:o}=this._getCached(),s=[];if(!(this._def.catchall instanceof ye&&this._def.unknownKeys==="strip"))for(const c in r.data)o.includes(c)||s.push(c);const l=[];for(const c of o){const d=i[c],p=r.data[c];l.push({key:{status:"valid",value:c},value:d._parse(new me(r,p,r.path,c)),alwaysSet:c in r.data})}if(this._def.catchall instanceof ye){const c=this._def.unknownKeys;if(c==="passthrough")for(const d of s)l.push({key:{status:"valid",value:d},value:{status:"valid",value:r.data[d]}});else if(c==="strict")s.length>0&&(f(r,{code:u.unrecognized_keys,keys:s}),n.dirty());else if(c!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const c=this._def.catchall;for(const d of s){const p=r.data[d];l.push({key:{status:"valid",value:d},value:c._parse(new me(r,p,r.path,d)),alwaysSet:d in r.data})}}return r.common.async?Promise.resolve().then(async()=>{const c=[];for(const d of l){const p=await d.key,h=await d.value;c.push({key:p,value:h,alwaysSet:d.alwaysSet})}return c}).then(c=>q.mergeObjectSync(n,c)):q.mergeObjectSync(n,l)}get shape(){return this._def.shape()}strict(e){return y.errToObj,new L({...this._def,unknownKeys:"strict",...e!==void 0?{errorMap:(t,n)=>{var i,o;const r=((o=(i=this._def).errorMap)==null?void 0:o.call(i,t,n).message)??n.defaultError;return t.code==="unrecognized_keys"?{message:y.errToObj(e).message??r}:{message:r}}}:{}})}strip(){return new L({...this._def,unknownKeys:"strip"})}passthrough(){return new L({...this._def,unknownKeys:"passthrough"})}extend(e){return new L({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new L({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:v.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new L({...this._def,catchall:e})}pick(e){const t={};for(const n of k.objectKeys(e))e[n]&&this.shape[n]&&(t[n]=this.shape[n]);return new L({...this._def,shape:()=>t})}omit(e){const t={};for(const n of k.objectKeys(this.shape))e[n]||(t[n]=this.shape[n]);return new L({...this._def,shape:()=>t})}deepPartial(){return je(this)}partial(e){const t={};for(const n of k.objectKeys(this.shape)){const r=this.shape[n];e&&!e[n]?t[n]=r:t[n]=r.optional()}return new L({...this._def,shape:()=>t})}required(e){const t={};for(const n of k.objectKeys(this.shape))if(e&&!e[n])t[n]=this.shape[n];else{let i=this.shape[n];for(;i instanceof ge;)i=i._def.innerType;t[n]=i}return new L({...this._def,shape:()=>t})}keyof(){return rn(k.objectKeys(this.shape))}}L.create=(a,e)=>new L({shape:()=>a,unknownKeys:"strip",catchall:ye.create(),typeName:v.ZodObject,...w(e)}),L.strictCreate=(a,e)=>new L({shape:()=>a,unknownKeys:"strict",catchall:ye.create(),typeName:v.ZodObject,...w(e)}),L.lazycreate=(a,e)=>new L({shape:a,unknownKeys:"strip",catchall:ye.create(),typeName:v.ZodObject,...w(e)});class ht extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=this._def.options;function r(i){for(const s of i)if(s.result.status==="valid")return s.result;for(const s of i)if(s.result.status==="dirty")return t.common.issues.push(...s.ctx.common.issues),s.result;const o=i.map(s=>new J(s.ctx.common.issues));return f(t,{code:u.invalid_union,unionErrors:o}),_}if(t.common.async)return Promise.all(n.map(async i=>{const o={...t,common:{...t.common,issues:[]},parent:null};return{result:await i._parseAsync({data:t.data,path:t.path,parent:o}),ctx:o}})).then(r);{let i;const o=[];for(const l of n){const c={...t,common:{...t.common,issues:[]},parent:null},d=l._parseSync({data:t.data,path:t.path,parent:c});if(d.status==="valid")return d;d.status==="dirty"&&!i&&(i={result:d,ctx:c}),c.common.issues.length&&o.push(c.common.issues)}if(i)return t.common.issues.push(...i.ctx.common.issues),i.result;const s=o.map(l=>new J(l));return f(t,{code:u.invalid_union,unionErrors:s}),_}}get options(){return this._def.options}}ht.create=(a,e)=>new ht({options:a,typeName:v.ZodUnion,...w(e)});function Wt(a,e){const t=fe(a),n=fe(e);if(a===e)return{valid:!0,data:a};if(t===m.object&&n===m.object){const r=k.objectKeys(e),i=k.objectKeys(a).filter(s=>r.indexOf(s)!==-1),o={...a,...e};for(const s of i){const l=Wt(a[s],e[s]);if(!l.valid)return{valid:!1};o[s]=l.data}return{valid:!0,data:o}}else if(t===m.array&&n===m.array){if(a.length!==e.length)return{valid:!1};const r=[];for(let i=0;i<a.length;i++){const o=a[i],s=e[i],l=Wt(o,s);if(!l.valid)return{valid:!1};r.push(l.data)}return{valid:!0,data:r}}else return t===m.date&&n===m.date&&+a==+e?{valid:!0,data:a}:{valid:!1}}class yt extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=(i,o)=>{if(Wa(i)||Wa(o))return _;const s=Wt(i.value,o.value);return s.valid?((Ya(i)||Ya(o))&&t.dirty(),{status:t.value,value:s.data}):(f(n,{code:u.invalid_intersection_types}),_)};return n.common.async?Promise.all([this._def.left._parseAsync({data:n.data,path:n.path,parent:n}),this._def.right._parseAsync({data:n.data,path:n.path,parent:n})]).then(([i,o])=>r(i,o)):r(this._def.left._parseSync({data:n.data,path:n.path,parent:n}),this._def.right._parseSync({data:n.data,path:n.path,parent:n}))}}yt.create=(a,e,t)=>new yt({left:a,right:e,typeName:v.ZodIntersection,...w(t)});class oe extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.array)return f(n,{code:u.invalid_type,expected:m.array,received:n.parsedType}),_;if(n.data.length<this._def.items.length)return f(n,{code:u.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),_;!this._def.rest&&n.data.length>this._def.items.length&&(f(n,{code:u.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());const i=[...n.data].map((o,s)=>{const l=this._def.items[s]||this._def.rest;return l?l._parse(new me(n,o,n.path,s)):null}).filter(o=>!!o);return n.common.async?Promise.all(i).then(o=>q.mergeArray(t,o)):q.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new oe({...this._def,rest:e})}}oe.create=(a,e)=>{if(!Array.isArray(a))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new oe({items:a,typeName:v.ZodTuple,rest:null,...w(e)})};class tn extends b{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.map)return f(n,{code:u.invalid_type,expected:m.map,received:n.parsedType}),_;const r=this._def.keyType,i=this._def.valueType,o=[...n.data.entries()].map(([s,l],c)=>({key:r._parse(new me(n,s,n.path,[c,"key"])),value:i._parse(new me(n,l,n.path,[c,"value"]))}));if(n.common.async){const s=new Map;return Promise.resolve().then(async()=>{for(const l of o){const c=await l.key,d=await l.value;if(c.status==="aborted"||d.status==="aborted")return _;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),s.set(c.value,d.value)}return{status:t.value,value:s}})}else{const s=new Map;for(const l of o){const c=l.key,d=l.value;if(c.status==="aborted"||d.status==="aborted")return _;(c.status==="dirty"||d.status==="dirty")&&t.dirty(),s.set(c.value,d.value)}return{status:t.value,value:s}}}}tn.create=(a,e,t)=>new tn({valueType:e,keyType:a,typeName:v.ZodMap,...w(t)});class Ye extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.parsedType!==m.set)return f(n,{code:u.invalid_type,expected:m.set,received:n.parsedType}),_;const r=this._def;r.minSize!==null&&n.data.size<r.minSize.value&&(f(n,{code:u.too_small,minimum:r.minSize.value,type:"set",inclusive:!0,exact:!1,message:r.minSize.message}),t.dirty()),r.maxSize!==null&&n.data.size>r.maxSize.value&&(f(n,{code:u.too_big,maximum:r.maxSize.value,type:"set",inclusive:!0,exact:!1,message:r.maxSize.message}),t.dirty());const i=this._def.valueType;function o(l){const c=new Set;for(const d of l){if(d.status==="aborted")return _;d.status==="dirty"&&t.dirty(),c.add(d.value)}return{status:t.value,value:c}}const s=[...n.data.values()].map((l,c)=>i._parse(new me(n,l,n.path,c)));return n.common.async?Promise.all(s).then(l=>o(l)):o(s)}min(e,t){return new Ye({...this._def,minSize:{value:e,message:y.toString(t)}})}max(e,t){return new Ye({...this._def,maxSize:{value:e,message:y.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}Ye.create=(a,e)=>new Ye({valueType:a,minSize:null,maxSize:null,typeName:v.ZodSet,...w(e)});class Xe extends b{constructor(){super(...arguments),this.validate=this.implement}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.function)return f(t,{code:u.invalid_type,expected:m.function,received:t.parsedType}),_;function n(s,l){return Bt({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Vt(),Ue].filter(c=>!!c),issueData:{code:u.invalid_arguments,argumentsError:l}})}function r(s,l){return Bt({data:s,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,Vt(),Ue].filter(c=>!!c),issueData:{code:u.invalid_return_type,returnTypeError:l}})}const i={errorMap:t.common.contextualErrorMap},o=t.data;if(this._def.returns instanceof He){const s=this;return F(async function(...l){const c=new J([]),d=await s._def.args.parseAsync(l,i).catch(x=>{throw c.addIssue(n(l,x)),c}),p=await Reflect.apply(o,this,d);return await s._def.returns._def.type.parseAsync(p,i).catch(x=>{throw c.addIssue(r(p,x)),c})})}else{const s=this;return F(function(...l){const c=s._def.args.safeParse(l,i);if(!c.success)throw new J([n(l,c.error)]);const d=Reflect.apply(o,this,c.data),p=s._def.returns.safeParse(d,i);if(!p.success)throw new J([r(d,p.error)]);return p.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new Xe({...this._def,args:oe.create(e).rest(Oe.create())})}returns(e){return new Xe({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,n){return new Xe({args:e||oe.create([]).rest(Oe.create()),returns:t||Oe.create(),typeName:v.ZodFunction,...w(n)})}}class an extends b{get schema(){return this._def.getter()}_parse(e){const{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}an.create=(a,e)=>new an({getter:a,typeName:v.ZodLazy,...w(e)});class nn extends b{_parse(e){if(e.data!==this._def.value){const t=this._getOrReturnCtx(e);return f(t,{received:t.data,code:u.invalid_literal,expected:this._def.value}),_}return{status:"valid",value:e.data}}get value(){return this._def.value}}nn.create=(a,e)=>new nn({value:a,typeName:v.ZodLiteral,...w(e)});function rn(a,e){return new Ie({values:a,typeName:v.ZodEnum,...w(e)})}class Ie extends b{_parse(e){if(typeof e.data!="string"){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{expected:k.joinValues(n),received:t.parsedType,code:u.invalid_type}),_}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(e.data)){const t=this._getOrReturnCtx(e),n=this._def.values;return f(t,{received:t.data,code:u.invalid_enum_value,options:n}),_}return F(e.data)}get options(){return this._def.values}get enum(){const e={};for(const t of this._def.values)e[t]=t;return e}get Values(){const e={};for(const t of this._def.values)e[t]=t;return e}get Enum(){const e={};for(const t of this._def.values)e[t]=t;return e}extract(e,t=this._def){return Ie.create(e,{...this._def,...t})}exclude(e,t=this._def){return Ie.create(this.options.filter(n=>!e.includes(n)),{...this._def,...t})}}Ie.create=rn;class on extends b{_parse(e){const t=k.getValidEnumValues(this._def.values),n=this._getOrReturnCtx(e);if(n.parsedType!==m.string&&n.parsedType!==m.number){const r=k.objectValues(t);return f(n,{expected:k.joinValues(r),received:n.parsedType,code:u.invalid_type}),_}if(this._cache||(this._cache=new Set(k.getValidEnumValues(this._def.values))),!this._cache.has(e.data)){const r=k.objectValues(t);return f(n,{received:n.data,code:u.invalid_enum_value,options:r}),_}return F(e.data)}get enum(){return this._def.values}}on.create=(a,e)=>new on({values:a,typeName:v.ZodNativeEnum,...w(e)});class He extends b{unwrap(){return this._def.type}_parse(e){const{ctx:t}=this._processInputParams(e);if(t.parsedType!==m.promise&&t.common.async===!1)return f(t,{code:u.invalid_type,expected:m.promise,received:t.parsedType}),_;const n=t.parsedType===m.promise?t.data:Promise.resolve(t.data);return F(n.then(r=>this._def.type.parseAsync(r,{path:t.path,errorMap:t.common.contextualErrorMap})))}}He.create=(a,e)=>new He({type:a,typeName:v.ZodPromise,...w(e)});class De extends b{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===v.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){const{status:t,ctx:n}=this._processInputParams(e),r=this._def.effect||null,i={addIssue:o=>{f(n,o),o.fatal?t.abort():t.dirty()},get path(){return n.path}};if(i.addIssue=i.addIssue.bind(i),r.type==="preprocess"){const o=r.transform(n.data,i);if(n.common.async)return Promise.resolve(o).then(async s=>{if(t.value==="aborted")return _;const l=await this._def.schema._parseAsync({data:s,path:n.path,parent:n});return l.status==="aborted"?_:l.status==="dirty"||t.value==="dirty"?qe(l.value):l});{if(t.value==="aborted")return _;const s=this._def.schema._parseSync({data:o,path:n.path,parent:n});return s.status==="aborted"?_:s.status==="dirty"||t.value==="dirty"?qe(s.value):s}}if(r.type==="refinement"){const o=s=>{const l=r.refinement(s,i);if(n.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return s};if(n.common.async===!1){const s=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});return s.status==="aborted"?_:(s.status==="dirty"&&t.dirty(),o(s.value),{status:t.value,value:s.value})}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(s=>s.status==="aborted"?_:(s.status==="dirty"&&t.dirty(),o(s.value).then(()=>({status:t.value,value:s.value}))))}if(r.type==="transform")if(n.common.async===!1){const o=this._def.schema._parseSync({data:n.data,path:n.path,parent:n});if(!Pe(o))return _;const s=r.transform(o.value,i);if(s instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}else return this._def.schema._parseAsync({data:n.data,path:n.path,parent:n}).then(o=>Pe(o)?Promise.resolve(r.transform(o.value,i)).then(s=>({status:t.value,value:s})):_);k.assertNever(r)}}De.create=(a,e,t)=>new De({schema:a,typeName:v.ZodEffects,effect:e,...w(t)}),De.createWithPreprocess=(a,e,t)=>new De({schema:e,effect:{type:"preprocess",transform:a},typeName:v.ZodEffects,...w(t)});class ge extends b{_parse(e){return this._getType(e)===m.undefined?F(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ge.create=(a,e)=>new ge({innerType:a,typeName:v.ZodOptional,...w(e)});class Ze extends b{_parse(e){return this._getType(e)===m.null?F(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}Ze.create=(a,e)=>new Ze({innerType:a,typeName:v.ZodNullable,...w(e)});class Yt extends b{_parse(e){const{ctx:t}=this._processInputParams(e);let n=t.data;return t.parsedType===m.undefined&&(n=this._def.defaultValue()),this._def.innerType._parse({data:n,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}Yt.create=(a,e)=>new Yt({innerType:a,typeName:v.ZodDefault,defaultValue:typeof e.default=="function"?e.default:()=>e.default,...w(e)});class Xt extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n={...t,common:{...t.common,issues:[]}},r=this._def.innerType._parse({data:n.data,path:n.path,parent:{...n}});return ft(r)?r.then(i=>({status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new J(n.common.issues)},input:n.data})})):{status:"valid",value:r.status==="valid"?r.value:this._def.catchValue({get error(){return new J(n.common.issues)},input:n.data})}}removeCatch(){return this._def.innerType}}Xt.create=(a,e)=>new Xt({innerType:a,typeName:v.ZodCatch,catchValue:typeof e.catch=="function"?e.catch:()=>e.catch,...w(e)});class sn extends b{_parse(e){if(this._getType(e)!==m.nan){const n=this._getOrReturnCtx(e);return f(n,{code:u.invalid_type,expected:m.nan,received:n.parsedType}),_}return{status:"valid",value:e.data}}}sn.create=a=>new sn({typeName:v.ZodNaN,...w(a)});class oi extends b{_parse(e){const{ctx:t}=this._processInputParams(e),n=t.data;return this._def.type._parse({data:n,path:t.path,parent:t})}unwrap(){return this._def.type}}class Ht extends b{_parse(e){const{status:t,ctx:n}=this._processInputParams(e);if(n.common.async)return(async()=>{const i=await this._def.in._parseAsync({data:n.data,path:n.path,parent:n});return i.status==="aborted"?_:i.status==="dirty"?(t.dirty(),qe(i.value)):this._def.out._parseAsync({data:i.value,path:n.path,parent:n})})();{const r=this._def.in._parseSync({data:n.data,path:n.path,parent:n});return r.status==="aborted"?_:r.status==="dirty"?(t.dirty(),{status:"dirty",value:r.value}):this._def.out._parseSync({data:r.value,path:n.path,parent:n})}}static create(e,t){return new Ht({in:e,out:t,typeName:v.ZodPipeline})}}class Jt extends b{_parse(e){const t=this._def.innerType._parse(e),n=r=>(Pe(r)&&(r.value=Object.freeze(r.value)),r);return ft(t)?t.then(r=>n(r)):n(t)}unwrap(){return this._def.innerType}}Jt.create=(a,e)=>new Jt({innerType:a,typeName:v.ZodReadonly,...w(e)});var v;(function(a){a.ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly"})(v||(v={}));const Gt=he.create,G=Le.create,si=Ut.create,li=qt.create;Oe.create,ye.create;const Kt=ne.create,_e=L.create;ht.create,yt.create;const ln=oe.create,ci=Xe.create;Ie.create;const ui=He.create;ge.create,Ze.create,_e({pin:_e({fade:si().optional(),maxCount:G().optional(),maxZoom:G().optional()}).optional(),animation:_e({queue:_e({limit:G().optional()}).optional()}).optional()});const cn=_e({id:Gt().min(1),rank:G(),lat:G().min(-90).max(90),lng:G().min(-180).max(180),width:G().min(56),height:G().min(56),padding:G().min(2).max(16)}).refine(a=>Math.min(a.width,a.height)/a.padding>=4,"Popup width and height must be at least 4 times the padding"),di=ln([G(),Kt(ln([G(),G()]))]),un=ci().args(Gt()).returns(ui(li())),pi=_e({data:cn,state:di,callbacks:_e({body:un,pin:un.optional()})}),fi=Kt(pi);_e({key:Gt(),data:Kt(cn)});const mi=512,dn=24,gt=10,hi=1e6,yi=2,gi=128;var _t;(a=>{a.COUNT=12,a.DEFAULT=270,a.DEGREES=[0,30,60,90,120,150,180,210,240,270,300,330]})(_t||(_t={}));class _i{constructor(e,t,n){g(this,"MapClass");g(this,"MapMarkerClass");g(this,"map");g(this,"mapConfiguration",null);g(this,"mapPopupDataArray",new Array);g(this,"mapPopupDataMap",new Map);g(this,"mapPopupDataUpdating",!1);this.MapClass=e,this.MapMarkerClass=t,this.map=new this.MapClass({...n,pitchWithRotate:!1,attributionControl:{customAttribution:"@arenarium/maps"}}),this.map.dragRotate.disable(),this.map.keyboard.disable(),this.map.touchZoomRotate.disableRotation(),this.map.touchPitch.disable(),this.map.on("load",this.onMapLoad.bind(this)),this.setConfiguration(null)}get maplibre(){return this.map}setConfiguration(e){var t,n;this.mapConfiguration=e,(n=(t=e==null?void 0:e.animation)==null?void 0:t.queue)!=null&&n.limit?ie.setLimit(e.animation.queue.limit):ie.setLimit(8*navigator.hardwareConcurrency)}setColors(e,t,n){const r=this.map.getContainer();r.style.setProperty("--map-style-primary",e),r.style.setProperty("--map-style-background",t),r.style.setProperty("--map-style-text",n)}async updatePopups(e){try{await fi.parseAsync(e),await this.updatePopupData(e)}catch(t){throw console.error(t),pt("[Error] Failed to update popups",{message:t.message,stack:t.stack}),t}}removePopups(){try{this.removePopupData()}catch(e){throw console.error(e),pt("[Error] Failed to remove popups",{message:e.message,stack:e.stack}),e}}togglePopups(e){try{this.togglePopupData(e)}catch(t){throw console.error(t),pt("[Error] Failed to toggle popups",{message:t.message,stack:t.stack}),t}}onMapLoad(){this.processPopupDataCallback()}processPopupDataCallback(){if(!this.map._removed)try{this.processPopupData(),window.setTimeout(this.processPopupDataCallback.bind(this),25)}catch(e){console.error(e),pt("[Error] Failed to process popups",{message:e.message,stack:e.stack})}}processPopupData(){var d,p,h,x,C,O;if(this.mapPopupDataArray.length==0||this.mapPopupDataUpdating)return;const e=this.map.getZoom();if(!e)return;const t=this.map.getCanvas().width,n=this.map.getCanvas().height,r=mi,i=new Ua(this.map,-r,n+r,t+r,-r),o=new Ua(this.map,0,n,t,0);let s=0,l=((p=(d=this.mapConfiguration)==null?void 0:d.pin)==null?void 0:p.maxCount)??Math.max(gi,8*navigator.hardwareConcurrency),c=((x=(h=this.mapConfiguration)==null?void 0:h.pin)==null?void 0:x.maxZoom)??yi;for(const z of this.mapPopupDataArray){const K=z.supressed?-1:e,P=z.circle;o.contains(P.lat,P.lng)?K<=P.zoom&&P.zoom<=e+c?(s<l&&(((O=(C=this.mapConfiguration)==null?void 0:C.pin)==null?void 0:O.fade)==!0?P.updateState(e):P.setExpanded(),P.updateMap(this.map),P.isPinLoaded()==!1&&P.updatePin()),s++):(P.setCollapsed(),P.isCollapsed()&&P.updateMap(null)):P.updateMap(null);const T=z.marker;i.contains(T.lat,T.lng)?T.zoom<=K?(T.updateState(e),T.setCollapsed(!1),T.updateMap(this.map),T.isExpanded()&&T.isBodyLoaded()==!1&&T.updateBody()):(T.setCollapsed(!0),T.isCollapsed()&&T.updateMap(null)):T.updateMap(null)}}async updatePopupData(e){try{this.mapPopupDataUpdating=!0;const t=new Map(e.map(r=>[r.data.id,new fn(r)])),n=Array.from(this.mapPopupDataArray);for(const r of n)t.has(r.id)==!1&&(r.remove(),this.mapPopupDataMap.delete(r.id),this.mapPopupDataArray.splice(this.mapPopupDataArray.indexOf(r),1));for(const r of e){const i=this.mapPopupDataMap.get(r.data.id);if(i)i.update(r);else{const o=new fn(r);o.create(this.MapMarkerClass),this.mapPopupDataMap.set(r.data.id,o),this.mapPopupDataArray.push(o)}}this.mapPopupDataArray.sort((r,i)=>r.zoom-i.zoom)}catch(t){throw console.error(t),this.mapPopupDataArray.length=0,this.mapPopupDataMap.clear(),t}finally{this.mapPopupDataUpdating=!1}}removePopupData(){try{this.mapPopupDataUpdating=!0,this.mapPopupDataArray.forEach(e=>e.remove()),this.mapPopupDataArray.length=0,this.mapPopupDataMap.clear()}catch(e){throw console.error(e),this.mapPopupDataArray.forEach(t=>t.remove()),this.mapPopupDataArray.length=0,this.mapPopupDataMap.clear(),e}finally{this.mapPopupDataUpdating=!1}}togglePopupData(e){e.forEach(t=>{const n=this.mapPopupDataMap.get(t.id);n&&(n.supressed=!t.toggled)})}}class pn{constructor(e){g(this,"id");g(this,"lat");g(this,"lng");g(this,"zoom");g(this,"element");g(this,"component");g(this,"libreMarker");this.id=e.data.id,this.lat=e.data.lat,this.lng=e.data.lng,this.zoom=e.state[0]}create(e){this.createElement(),this.createLibreMarker(e),this.updateZIndex()}createElement(){throw new Error("Create element not implemented")}createLibreMarker(e){const t=this.element;if(!t)throw new Error("Failed to create libre marker");const n=new e({element:t});n.setLngLat([this.lng,this.lat]),this.libreMarker=n}update(e){this.zoom=e.state[0],this.updateZIndex()}updateZIndex(){throw new Error("Update z-index not implemented")}updateMap(e){const t=this.libreMarker,n=this.component;if(t==null||n==null)throw new Error("Failed to update popup map");e?t._map!=e&&t.addTo(e):t._map!=null&&t.remove()}isInBlock(e,t){return this.zoom<=e&&t.contains(this.lat,this.lng)}remove(){var e,t;(e=this.libreMarker)==null||e.remove(),(t=this.element)==null||t.remove()}}class vi extends pn{constructor(t){super(t);g(this,"pinLoading",!1);g(this,"pinLoaded",!1);g(this,"pinCallback");this.pinCallback=t.callbacks.pin}createElement(){this.element=document.createElement("div"),this.element.classList.add("circle"),this.component=Oa(jr,{target:this.element,props:{id:this.id+"_circle",priority:this.zoom*gt}})}updateZIndex(){const t=this.element;if(!t)return;const n=Math.round((dn-this.zoom)*gt);t.style.zIndex=n.toString()}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t!=null)}updateState(t){const n=this.component;if(!n)throw new Error("Failed to update circle state");n.setScale(this.getScale(t))}updatePin(){var n;if(this.pinCallback==null||this.pinLoaded||this.pinLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.pinLoading=!0,this.pinCallback(this.id).then(r=>{t.appendChild(r),this.pinLoaded=!0,this.pinLoading=!1}))}setExpanded(){if(this.component==null)throw new Error("Failed to set circle expanded");this.component.setScale(1)}setCollapsed(){if(this.component==null)throw new Error("Failed to set circle collapsed");this.component.setScale(0)}getScale(t){return this.zoom<t?1:Math.max(0,1-(this.zoom-t)*.125)}isCollapsed(){return this.component==null?!1:this.component.getCollapsed()}isPinLoaded(){return this.pinCallback==null||this.pinLoaded}}class xi extends pn{constructor(t){super(t);g(this,"width");g(this,"height");g(this,"padding");g(this,"states");g(this,"bodyLoading",!1);g(this,"bodyLoaded",!1);g(this,"bodyCallback");this.id=t.data.id,this.width=t.data.width,this.height=t.data.height,this.padding=t.data.padding,this.states=t.state[1].map(n=>[n[0],_t.DEGREES[n[1]]]),this.bodyCallback=t.callbacks.body}createElement(){this.element=document.createElement("div"),this.element.classList.add("marker"),this.component=Oa(Lr,{target:this.element,props:{id:this.id+"_marker",priority:this.zoom*gt,width:this.width,height:this.height,padding:this.padding}})}update(t){super.update(t),this.states=t.state[1].map(n=>[n[0],_t.DEGREES[n[1]]])}updateZIndex(){const t=this.element;if(!t)return;const n=Math.round((dn-this.zoom)*gt)+hi;t.style.zIndex=n.toString()}updateMap(t){var n;super.updateMap(t),(n=this.component)==null||n.setDisplayed(t!=null)}updateState(t){const n=this.component;if(!n)throw new Error("Failed to update marker state");n.setAngle(this.getAngle(t))}updateBody(){var n;if(this.bodyLoaded||this.bodyLoading)return;const t=(n=this.component)==null?void 0:n.getBody();t!=null&&(this.bodyLoading=!0,this.bodyCallback(this.id).then(r=>{t.appendChild(r),this.bodyLoading=!1,this.bodyLoaded=!0}))}getAngle(t){const n=this.states.findLast(r=>r[0]<=t);if(!n)throw new Error("Angle not found");return n[1]}setCollapsed(t){if(this.component==null)throw new Error("Failed to set marker collapsed");this.component.setCollapsed(t)}isExpanded(){return this.component?this.component.getExpanded():!1}isCollapsed(){return this.component?this.component.getCollapsed():!1}isBodyLoaded(){return this.bodyLoaded}}class fn{constructor(e){g(this,"id");g(this,"rank");g(this,"lat");g(this,"lng");g(this,"zoom");g(this,"supressed");g(this,"circle");g(this,"marker");this.id=e.data.id,this.rank=e.data.rank,this.lat=e.data.lat,this.lng=e.data.lng,this.zoom=e.state[0],this.supressed=!1,this.circle=new vi(e),this.marker=new xi(e)}create(e){this.circle.create(e),this.marker.create(e)}update(e){this.circle.update(e),this.marker.update(e)}remove(){this.circle.remove(),this.marker.remove()}}const wi={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}}]},bi={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}}]};S.MapDarkStyle=wi,S.MapManager=_i,S.MapStyleLight=bi,Object.defineProperty(S,Symbol.toStringTag,{value:"Module"})});
|