@arenarium/maps 1.0.22 → 1.0.24

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.js DELETED
@@ -1,728 +0,0 @@
1
- (function(pa,Dc){typeof exports=="object"&&typeof module<"u"?Dc(exports):typeof define=="function"&&define.amd?define(["exports"],Dc):(pa=typeof globalThis<"u"?globalThis:pa||self,Dc(pa.arenarium={}))})(this,function(pa){"use strict";var $p;var wh=Array.isArray,Em=Array.prototype.indexOf,zm=Array.from,km=Object.defineProperty,rl=Object.getOwnPropertyDescriptor,Xd=Object.prototype,Am=Array.prototype,Yd=Object.getPrototypeOf,Jd=Object.isExtensible;function Rm(b){for(var g=0;g<b.length;g++)b[g]()}const on=2,Qd=4,Lc=8,Th=16,fa=32,Ys=64,Fc=128,Mr=256,Bc=512,Or=1024,os=2048,Js=4096,Oc=8192,jc=16384,Dm=32768,Lm=65536,Fm=1<<19,ep=1<<20,Ph=1<<21,Nc=Symbol("$state");function tp(b){return b===this.v}function Bm(b){throw new Error("https://svelte.dev/e/effect_in_teardown")}function Om(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function jm(b){throw new Error("https://svelte.dev/e/effect_orphan")}function Nm(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function Zm(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function Vm(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function Um(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let Ux=!1;const $m=2,cr=Symbol(),Gm=[];function qm(b,g=!1){return Zc(b,new Map,"",Gm)}function Zc(b,g,T,E,B=null){if(typeof b=="object"&&b!==null){var Z=g.get(b);if(Z!==void 0)return Z;if(b instanceof Map)return new Map(b);if(b instanceof Set)return new Set(b);if(wh(b)){var M=Array(b.length);g.set(b,M),B!==null&&g.set(B,M);for(var c=0;c<b.length;c+=1){var Te=b[c];c in b&&(M[c]=Zc(Te,g,T,E))}return M}if(Yd(b)===Xd){M={},g.set(b,M),B!==null&&g.set(B,M);for(var ge in b)M[ge]=Zc(b[ge],g,T,E);return M}if(b instanceof Date)return structuredClone(b);if(typeof b.toJSON=="function")return Zc(b.toJSON(),g,T,E,b)}if(b instanceof EventTarget)return b;try{return structuredClone(b)}catch{return b}}function Wm(b){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let ir=null;function ip(b){ir=b}function rp(b,g=!1,T){var E=ir={p:ir,c:null,d:!1,e:null,m:!1,s:b,x:null,l:null};fp(()=>{E.d=!0})}function np(b){const g=ir;if(g!==null){b!==void 0&&(g.x=b);const M=g.e;if(M!==null){var T=Kt,E=Et;g.e=null;try{for(var B=0;B<M.length;B++){var Z=M[B];ma(Z.effect),hn(Z.reaction),Mh(Z.fn)}}finally{ma(T),hn(E)}}ir=g.p,g.m=!0}return b||{}}function ap(){return!0}function ls(b,g){if(typeof b!="object"||b===null||Nc in b)return b;const T=Yd(b);if(T!==Xd&&T!==Am)return b;var E=new Map,B=wh(b),Z=ln(0),M=Et,c=Te=>{var ge=Et;hn(M);var ke;return ke=Te(),hn(ge),ke};return B&&E.set("length",ln(b.length)),new Proxy(b,{defineProperty(Te,ge,ke){(!("value"in ke)||ke.configurable===!1||ke.enumerable===!1||ke.writable===!1)&&Zm();var Ue=E.get(ge);return Ue===void 0?(Ue=c(()=>ln(ke.value)),E.set(ge,Ue)):cn(Ue,c(()=>ls(ke.value))),!0},deleteProperty(Te,ge){var ke=E.get(ge);if(ke===void 0)ge in Te&&E.set(ge,c(()=>ln(cr)));else{if(B&&typeof ge=="string"){var Ue=E.get("length"),Ae=Number(ge);Number.isInteger(Ae)&&Ae<Ue.v&&cn(Ue,Ae)}cn(ke,cr),sp(Z)}return!0},get(Te,ge,ke){var Ze;if(ge===Nc)return b;var Ue=E.get(ge),Ae=ge in Te;if(Ue===void 0&&(!Ae||(Ze=rl(Te,ge))!=null&&Ze.writable)&&(Ue=c(()=>ln(ls(Ae?Te[ge]:cr))),E.set(ge,Ue)),Ue!==void 0){var le=Rn(Ue);return le===cr?void 0:le}return Reflect.get(Te,ge,ke)},getOwnPropertyDescriptor(Te,ge){var ke=Reflect.getOwnPropertyDescriptor(Te,ge);if(ke&&"value"in ke){var Ue=E.get(ge);Ue&&(ke.value=Rn(Ue))}else if(ke===void 0){var Ae=E.get(ge),le=Ae==null?void 0:Ae.v;if(Ae!==void 0&&le!==cr)return{enumerable:!0,configurable:!0,value:le,writable:!0}}return ke},has(Te,ge){var le;if(ge===Nc)return!0;var ke=E.get(ge),Ue=ke!==void 0&&ke.v!==cr||Reflect.has(Te,ge);if(ke!==void 0||Kt!==null&&(!Ue||(le=rl(Te,ge))!=null&&le.writable)){ke===void 0&&(ke=c(()=>ln(Ue?ls(Te[ge]):cr)),E.set(ge,ke));var Ae=Rn(ke);if(Ae===cr)return!1}return Ue},set(Te,ge,ke,Ue){var Ri;var Ae=E.get(ge),le=ge in Te;if(B&&ge==="length")for(var Ze=ke;Ze<Ae.v;Ze+=1){var Xt=E.get(Ze+"");Xt!==void 0?cn(Xt,cr):Ze in Te&&(Xt=c(()=>ln(cr)),E.set(Ze+"",Xt))}Ae===void 0?(!le||(Ri=rl(Te,ge))!=null&&Ri.writable)&&(Ae=c(()=>ln(void 0)),cn(Ae,c(()=>ls(ke))),E.set(ge,Ae)):(le=Ae.v!==cr,cn(Ae,c(()=>ls(ke))));var xi=Reflect.getOwnPropertyDescriptor(Te,ge);if(xi!=null&&xi.set&&xi.set.call(Ue,ke),!le){if(B&&typeof ge=="string"){var ji=E.get("length"),Mi=Number(ge);Number.isInteger(Mi)&&Mi>=ji.v&&cn(ji,Mi+1)}sp(Z)}return!0},ownKeys(Te){Rn(Z);var ge=Reflect.ownKeys(Te).filter(Ae=>{var le=E.get(Ae);return le===void 0||le.v!==cr});for(var[ke,Ue]of E)Ue.v!==cr&&!(ke in Te)&&ge.push(ke);return ge},setPrototypeOf(){Vm()}})}function sp(b,g=1){cn(b,b.v+g)}const nl=new Map;function Hm(b,g){var T={f:0,v:b,reactions:null,equals:tp,rv:0,wv:0};return T}function ln(b,g){const T=Hm(b);return mg(T),T}function cn(b,g,T=!1){Et!==null&&!un&&ap()&&(Et.f&(on|Th))!==0&&!(Wi!=null&&Wi.includes(b))&&Um();let E=T?ls(g):g;return Km(b,E)}function Km(b,g){if(!b.equals(g)){var T=b.v;al?nl.set(b,g):nl.set(b,T),b.v=g,b.wv=Tp(),op(b,os),Kt!==null&&(Kt.f&Or)!==0&&(Kt.f&(fa|Ys))===0&&(Ir===null?gg([b]):Ir.push(b))}return g}function op(b,g){var T=b.reactions;if(T!==null)for(var E=T.length,B=0;B<E;B++){var Z=T[B],M=Z.f;(M&os)===0&&(Dn(Z,g),(M&(Or|Mr))!==0&&((M&on)!==0?op(Z,Js):Eh(Z)))}}var Sh,lp,cp,up;function Xm(){if(Sh===void 0){Sh=window,lp=/Firefox/.test(navigator.userAgent);var b=Element.prototype,g=Node.prototype,T=Text.prototype;cp=rl(g,"firstChild").get,up=rl(g,"nextSibling").get,Jd(b)&&(b.__click=void 0,b.__className=void 0,b.__attributes=null,b.__style=void 0,b.__e=void 0),Jd(T)&&(T.__t=void 0)}}function Ym(b=""){return document.createTextNode(b)}function hp(b){return cp.call(b)}function Jm(b){return up.call(b)}function Qm(b,g){return hp(b)}function eg(b){var g=on|os,T=Et!==null&&(Et.f&on)!==0?Et:null;return Kt===null||T!==null&&(T.f&Mr)!==0?g|=Mr:Kt.f|=ep,{ctx:ir,deps:null,effects:null,equals:tp,f:g,fn:b,reactions:null,rv:0,v:null,wv:0,parent:T??Kt}}function dp(b){var g=b.effects;if(g!==null){b.effects=null;for(var T=0;T<g.length;T+=1)cs(g[T])}}function tg(b){for(var g=b.parent;g!==null;){if((g.f&on)===0)return g;g=g.parent}return null}function ig(b){var g,T=Kt;ma(tg(b));try{dp(b),g=Sp(b)}finally{ma(T)}return g}function pp(b){var g=ig(b),T=(ga||(b.f&Mr)!==0)&&b.deps!==null?Js:Or;Dn(b,T),b.equals(g)||(b.v=g,b.wv=Tp())}function rg(b){Kt===null&&Et===null&&jm(),Et!==null&&(Et.f&Mr)!==0&&Kt===null&&Om(),al&&Bm()}function ng(b,g){var T=g.last;T===null?g.last=g.first=b:(T.next=b,b.prev=T,g.last=b)}function Qs(b,g,T,E=!0){var B=Kt,Z={ctx:ir,deps:null,nodes_start:null,nodes_end:null,f:b|os,first:null,fn:g,last:null,next:null,parent:B,prev:null,teardown:null,transitions:null,wv:0};if(T)try{Ch(Z),Z.f|=Dm}catch(Te){throw cs(Z),Te}else g!==null&&Eh(Z);var M=T&&Z.deps===null&&Z.first===null&&Z.nodes_start===null&&Z.teardown===null&&(Z.f&(ep|Fc))===0;if(!M&&E&&(B!==null&&ng(Z,B),Et!==null&&(Et.f&on)!==0)){var c=Et;(c.effects??(c.effects=[])).push(Z)}return Z}function fp(b){const g=Qs(Lc,null,!1);return Dn(g,Or),g.teardown=b,g}function mp(b){rg();var g=Kt!==null&&(Kt.f&fa)!==0&&ir!==null&&!ir.m;if(g){var T=ir;(T.e??(T.e=[])).push({fn:b,effect:Kt,reaction:Et})}else{var E=Mh(b);return E}}function ag(b){const g=Qs(Ys,b,!0);return(T={})=>new Promise(E=>{T.outro?hg(g,()=>{cs(g),E(void 0)}):(cs(g),E(void 0))})}function Mh(b){return Qs(Qd,b,!1)}function sg(b){return Qs(Lc,b,!0)}function og(b,g=[],T=eg){const E=g.map(T);return lg(()=>b(...E.map(Rn)))}function lg(b,g=0){return Qs(Lc|Th|g,b,!0)}function cg(b,g=!0){return Qs(Lc|fa,b,!0,g)}function gp(b){var g=b.teardown;if(g!==null){const T=al,E=Et;bp(!0),hn(null);try{g.call(null)}finally{bp(T),hn(E)}}}function _p(b,g=!1){var T=b.first;for(b.first=b.last=null;T!==null;){var E=T.next;(T.f&Ys)!==0?T.parent=null:cs(T,g),T=E}}function ug(b){for(var g=b.first;g!==null;){var T=g.next;(g.f&fa)===0&&cs(g),g=T}}function cs(b,g=!0){var T=!1;if((g||(b.f&Fm)!==0)&&b.nodes_start!==null){for(var E=b.nodes_start,B=b.nodes_end;E!==null;){var Z=E===B?null:Jm(E);E.remove(),E=Z}T=!0}_p(b,g&&!T),Kc(b,0),Dn(b,jc);var M=b.transitions;if(M!==null)for(const Te of M)Te.stop();gp(b);var c=b.parent;c!==null&&c.first!==null&&yp(b),b.next=b.prev=b.teardown=b.ctx=b.deps=b.fn=b.nodes_start=b.nodes_end=null}function yp(b){var g=b.parent,T=b.prev,E=b.next;T!==null&&(T.next=E),E!==null&&(E.prev=T),g!==null&&(g.first===b&&(g.first=E),g.last===b&&(g.last=T))}function hg(b,g){var T=[];xp(b,T,!0),dg(T,()=>{cs(b),g&&g()})}function dg(b,g){var T=b.length;if(T>0){var E=()=>--T||g();for(var B of b)B.out(E)}else g()}function xp(b,g,T){if((b.f&Oc)===0){if(b.f^=Oc,b.transitions!==null)for(const M of b.transitions)(M.is_global||T)&&g.push(M);for(var E=b.first;E!==null;){var B=E.next,Z=(E.f&Lm)!==0||(E.f&fa)!==0;xp(E,g,Z?T:!1),E=B}}}let Vc=[];function pg(){var b=Vc;Vc=[],Rm(b)}function vp(b){Vc.length===0&&queueMicrotask(pg),Vc.push(b)}let Uc=!1,Ih=!1,$c=null,us=!1,al=!1;function bp(b){al=b}let Gc=[],$x=[],Et=null,un=!1;function hn(b){Et=b}let Kt=null;function ma(b){Kt=b}let Wi=null;function fg(b){Wi=b}function mg(b){Et!==null&&Et.f&Ph&&(Wi===null?fg([b]):Wi.push(b))}let Hi=null,ur=0,Ir=null;function gg(b){Ir=b}let wp=1,qc=0,ga=!1;function Tp(){return++wp}function Wc(b){var Ue;var g=b.f;if((g&os)!==0)return!0;if((g&Js)!==0){var T=b.deps,E=(g&Mr)!==0;if(T!==null){var B,Z,M=(g&Bc)!==0,c=E&&Kt!==null&&!ga,Te=T.length;if(M||c){var ge=b,ke=ge.parent;for(B=0;B<Te;B++)Z=T[B],(M||!((Ue=Z==null?void 0:Z.reactions)!=null&&Ue.includes(ge)))&&(Z.reactions??(Z.reactions=[])).push(ge);M&&(ge.f^=Bc),c&&ke!==null&&(ke.f&Mr)===0&&(ge.f^=Mr)}for(B=0;B<Te;B++)if(Z=T[B],Wc(Z)&&pp(Z),Z.wv>b.wv)return!0}(!E||Kt!==null&&!ga)&&Dn(b,Or)}return!1}function _g(b,g){for(var T=g;T!==null;){if((T.f&Fc)!==0)try{T.fn(b);return}catch{T.f^=Fc}T=T.parent}throw Uc=!1,b}function yg(b){return(b.f&jc)===0&&(b.parent===null||(b.parent.f&Fc)===0)}function Hc(b,g,T,E){if(Uc){if(T===null&&(Uc=!1),yg(g))throw b;return}T!==null&&(Uc=!0);{_g(b,g);return}}function Pp(b,g,T=!0){var E=b.reactions;if(E!==null)for(var B=0;B<E.length;B++){var Z=E[B];Wi!=null&&Wi.includes(b)||((Z.f&on)!==0?Pp(Z,g,!1):g===Z&&(T?Dn(Z,os):(Z.f&Or)!==0&&Dn(Z,Js),Eh(Z)))}}function Sp(b){var le;var g=Hi,T=ur,E=Ir,B=Et,Z=ga,M=Wi,c=ir,Te=un,ge=b.f;Hi=null,ur=0,Ir=null,ga=(ge&Mr)!==0&&(un||!us||Et===null),Et=(ge&(fa|Ys))===0?b:null,Wi=null,ip(b.ctx),un=!1,qc++,b.f|=Ph;try{var ke=(0,b.fn)(),Ue=b.deps;if(Hi!==null){var Ae;if(Kc(b,ur),Ue!==null&&ur>0)for(Ue.length=ur+Hi.length,Ae=0;Ae<Hi.length;Ae++)Ue[ur+Ae]=Hi[Ae];else b.deps=Ue=Hi;if(!ga)for(Ae=ur;Ae<Ue.length;Ae++)((le=Ue[Ae]).reactions??(le.reactions=[])).push(b)}else Ue!==null&&ur<Ue.length&&(Kc(b,ur),Ue.length=ur);if(ap()&&Ir!==null&&!un&&Ue!==null&&(b.f&(on|Js|os))===0)for(Ae=0;Ae<Ir.length;Ae++)Pp(Ir[Ae],b);return B!==null&&(qc++,Ir!==null&&(E===null?E=Ir:E.push(...Ir))),ke}finally{Hi=g,ur=T,Ir=E,Et=B,ga=Z,Wi=M,ip(c),un=Te,b.f^=Ph}}function xg(b,g){let T=g.reactions;if(T!==null){var E=Em.call(T,b);if(E!==-1){var B=T.length-1;B===0?T=g.reactions=null:(T[E]=T[B],T.pop())}}T===null&&(g.f&on)!==0&&(Hi===null||!Hi.includes(g))&&(Dn(g,Js),(g.f&(Mr|Bc))===0&&(g.f^=Bc),dp(g),Kc(g,0))}function Kc(b,g){var T=b.deps;if(T!==null)for(var E=g;E<T.length;E++)xg(b,T[E])}function Ch(b){var g=b.f;if((g&jc)===0){Dn(b,Or);var T=Kt,E=ir,B=us;Kt=b,us=!0;try{(g&Th)!==0?ug(b):_p(b),gp(b);var Z=Sp(b);b.teardown=typeof Z=="function"?Z:null,b.wv=wp;var M=b.deps,c}catch(Te){Hc(Te,b,T,E||b.ctx)}finally{us=B,Kt=T}}}function vg(){try{Nm()}catch(b){if($c!==null)Hc(b,$c,null);else throw b}}function bg(){var b=us;try{var g=0;for(us=!0;Gc.length>0;){g++>1e3&&vg();var T=Gc,E=T.length;Gc=[];for(var B=0;B<E;B++){var Z=Tg(T[B]);wg(Z)}}}finally{Ih=!1,us=b,$c=null,nl.clear()}}function wg(b){var g=b.length;if(g!==0)for(var T=0;T<g;T++){var E=b[T];if((E.f&(jc|Oc))===0)try{Wc(E)&&(Ch(E),E.deps===null&&E.first===null&&E.nodes_start===null&&(E.teardown===null?yp(E):E.fn=null))}catch(B){Hc(B,E,null,E.ctx)}}}function Eh(b){Ih||(Ih=!0,queueMicrotask(bg));for(var g=$c=b;g.parent!==null;){g=g.parent;var T=g.f;if((T&(Ys|fa))!==0){if((T&Or)===0)return;g.f^=Or}}Gc.push(g)}function Tg(b){for(var g=[],T=b;T!==null;){var E=T.f,B=(E&(fa|Ys))!==0,Z=B&&(E&Or)!==0;if(!Z&&(E&Oc)===0){if((E&Qd)!==0)g.push(T);else if(B)T.f^=Or;else{var M=Et;try{Et=T,Wc(T)&&Ch(T)}catch(ge){Hc(ge,T,null,T.ctx)}finally{Et=M}}var c=T.first;if(c!==null){T=c;continue}}var Te=T.parent;for(T=T.next;T===null&&Te!==null;)T=Te.next,Te=Te.parent}return g}function Rn(b){var g=b.f,T=(g&on)!==0;if(Et!==null&&!un){if(!(Wi!=null&&Wi.includes(b))){var E=Et.deps;b.rv<qc&&(b.rv=qc,Hi===null&&E!==null&&E[ur]===b?ur++:Hi===null?Hi=[b]:(!ga||!Hi.includes(b))&&Hi.push(b))}}else if(T&&b.deps===null&&b.effects===null){var B=b,Z=B.parent;Z!==null&&(Z.f&Mr)===0&&(B.f^=Mr)}return T&&(B=b,Wc(B)&&pp(B)),al&&nl.has(b)?nl.get(b):b.v}function Mp(b){var g=un;try{return un=!0,b()}finally{un=g}}const Pg=-7169;function Dn(b,g){b.f=b.f&Pg|g}const Sg=["touchstart","touchmove"];function Mg(b){return Sg.includes(b)}function Ig(b){var g=Et,T=Kt;hn(null),ma(null);try{return b()}finally{hn(g),ma(T)}}const Cg=new Set,Ip=new Set;function Eg(b,g,T,E={}){function B(Z){if(E.capture||sl.call(g,Z),!Z.cancelBubble)return Ig(()=>T==null?void 0:T.call(this,Z))}return b.startsWith("pointer")||b.startsWith("touch")||b==="wheel"?vp(()=>{g.addEventListener(b,B,E)}):g.addEventListener(b,B,E),B}function zg(b,g,T,E,B){var Z={capture:E,passive:B},M=Eg(b,g,T,Z);(g===document.body||g===window||g===document)&&fp(()=>{g.removeEventListener(b,M,Z)})}function sl(b){var Mi;var g=this,T=g.ownerDocument,E=b.type,B=((Mi=b.composedPath)==null?void 0:Mi.call(b))||[],Z=B[0]||b.target,M=0,c=b.__root;if(c){var Te=B.indexOf(c);if(Te!==-1&&(g===document||g===window)){b.__root=g;return}var ge=B.indexOf(g);if(ge===-1)return;Te<=ge&&(M=Te)}if(Z=B[M]||b.target,Z!==g){km(b,"currentTarget",{configurable:!0,get(){return Z||T}});var ke=Et,Ue=Kt;hn(null),ma(null);try{for(var Ae,le=[];Z!==null;){var Ze=Z.assignedSlot||Z.parentNode||Z.host||null;try{var Xt=Z["__"+E];if(Xt!=null&&(!Z.disabled||b.target===Z))if(wh(Xt)){var[xi,...ji]=Xt;xi.apply(Z,[b,...ji])}else Xt.call(Z,b)}catch(Ri){Ae?le.push(Ri):Ae=Ri}if(b.cancelBubble||Ze===g||Ze===null)break;Z=Ze}if(Ae){for(let Ri of le)queueMicrotask(()=>{throw Ri});throw Ae}}finally{b.__root=g,delete b.currentTarget,hn(ke),ma(Ue)}}}function kg(b){var g=document.createElement("template");return g.innerHTML=b,g.content}function Ag(b,g){var T=Kt;T.nodes_start===null&&(T.nodes_start=b,T.nodes_end=g)}function Rg(b,g){var T=(g&$m)!==0,E,B=!b.startsWith("<!>");return()=>{E===void 0&&(E=kg(B?b:"<!>"+b),E=hp(E));var Z=T||lp?document.importNode(E,!0):E.cloneNode(!0);return Ag(Z,Z),Z}}function Dg(b,g){b!==null&&b.before(g)}function Lg(b,g){return Fg(b,g)}const eo=new Map;function Fg(b,{target:g,anchor:T,props:E={},events:B,context:Z,intro:M=!0}){Xm();var c=new Set,Te=Ue=>{for(var Ae=0;Ae<Ue.length;Ae++){var le=Ue[Ae];if(!c.has(le)){c.add(le);var Ze=Mg(le);g.addEventListener(le,sl,{passive:Ze});var Xt=eo.get(le);Xt===void 0?(document.addEventListener(le,sl,{passive:Ze}),eo.set(le,1)):eo.set(le,Xt+1)}}};Te(zm(Cg)),Ip.add(Te);var ge=void 0,ke=ag(()=>{var Ue=T??g.appendChild(Ym());return cg(()=>{if(Z){rp({});var Ae=ir;Ae.c=Z}B&&(E.$$events=B),ge=b(Ue,E)||{},Z&&np()}),()=>{var Ze;for(var Ae of c){g.removeEventListener(Ae,sl);var le=eo.get(Ae);--le===0?(document.removeEventListener(Ae,sl),eo.delete(Ae)):eo.set(Ae,le)}Ip.delete(Te),Ue!==T&&((Ze=Ue.parentNode)==null||Ze.removeChild(Ue))}});return zh.set(ge,ke),ge}let zh=new WeakMap;function Bg(b,g){const T=zh.get(b);return T?(zh.delete(b),T(g)):Promise.resolve()}function Og(b,g,T){var E=b==null?"":""+b;return E=E?E+" "+g:g,E===""?null:E}function jg(b,g,T,E,B,Z){var M=b.__className;if(M!==T||M===void 0){var c=Og(T,E);c==null?b.removeAttribute("class"):b.className=c,b.__className=T}return Z}function Cp(b,g){return b===g||(b==null?void 0:b[Nc])===g}function Ng(b={},g,T,E){return Mh(()=>{var B,Z;return sg(()=>{B=Z,Z=[],Mp(()=>{b!==T(...Z)&&(g(b,...Z),B&&Cp(T(...B),b)&&g(null,...B))})}),()=>{vp(()=>{Z&&Cp(T(...Z),b)&&g(null,...Z)})}}),b}function Zg(b){ir===null&&Wm(),mp(()=>{const g=Mp(b);if(typeof g=="function")return g})}const Vg="5";typeof window<"u"&&(($p=window.__svelte??(window.__svelte={})).v??($p.v=new Set)).add(Vg);const Ug={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}}]},$g={version:8,sources:{openmaptiles:{type:"vector",url:"https://tiles.openfreemap.org/planet"}},glyphs:"https://tiles.openfreemap.org/fonts/{fontstack}/{range}.pbf",layers:[{id:"background",type:"background",paint:{"background-color":"rgba(220, 220, 220, 1)"}},{id:"park",type:"fill",source:"openmaptiles","source-layer":"park",filter:["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],paint:{"fill-color":"rgba(228, 228, 228, 1)"}},{id:"water",type:"fill",source:"openmaptiles","source-layer":"water",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["!=",["get","brunnel"],"tunnel"]],paint:{"fill-antialias":!0,"fill-color":"rgba(156, 156, 156, 1)"}},{id:"landcover_ice_shelf",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"ice_shelf"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":.7}},{id:"landcover_glacier",type:"fill",source:"openmaptiles","source-layer":"landcover",maxzoom:8,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","subclass"],"glacier"]],paint:{"fill-color":"rgba(253, 253, 253, 1)","fill-opacity":["interpolate",["linear"],["zoom"],0,1,8,.5]}},{id:"landuse_residential",type:"fill",source:"openmaptiles","source-layer":"landuse",maxzoom:16,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"residential"]],paint:{"fill-color":"rgba(204, 204, 204, 1)","fill-opacity":["interpolate",["exponential",.6],["zoom"],8,.8,9,.6]}},{id:"landcover_wood",type:"fill",source:"openmaptiles","source-layer":"landcover",minzoom:10,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"wood"]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],8,0,12,1]}},{id:"waterway",type:"line",source:"openmaptiles","source-layer":"waterway",filter:["==",["geometry-type"],"LineString"],paint:{"line-color":"rgba(156, 156, 156, 1)"}},{id:"building",type:"fill",source:"openmaptiles","source-layer":"building",minzoom:12,paint:{"fill-antialias":!0,"fill-color":"rgba(236, 236, 236, 1)","fill-outline-color":"rgba(202, 202, 202, 1)"}},{id:"tunnel_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"tunnel_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"tunnel"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(185, 185, 185)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"aeroway-taxiway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:12,filter:["match",["get","class"],["taxiway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"aeroway-runway-casing",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["match",["get","class"],["runway"],!0,!1],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,6,17,55]}},{id:"aeroway-area",type:"fill",source:"openmaptiles","source-layer":"aeroway",minzoom:4,filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["match",["get","class"],["runway","taxiway"],!0,!1]],paint:{"fill-color":"rgba(228, 228, 228, 1)","fill-opacity":["interpolate",["linear"],["zoom"],13,0,14,1]}},{id:"aeroway-runway",type:"line",source:"openmaptiles","source-layer":"aeroway",minzoom:11,filter:["all",["match",["get","class"],["runway"],!0,!1],["==",["geometry-type"],"LineString"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-opacity":1,"line-width":["interpolate",["exponential",1.5],["zoom"],11,4,17,50]}},{id:"road_area_pier",type:"fill",source:"openmaptiles","source-layer":"transportation",filter:["all",["in",["geometry-type"],["literal",["Polygon","MultiPolygon"]]],["==",["get","class"],"pier"]],paint:{"fill-antialias":!0,"fill-color":"rgba(150, 150, 150, 1)"}},{id:"road_pier",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["pier"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(152, 152, 152, 1)","line-width":["interpolate",["exponential",1.2],["zoom"],15,1,17,4]}},{id:"highway_path",type:"line",source:"openmaptiles","source-layer":"transportation",filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"path"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgb(188, 188, 188)","line-opacity":.9,"line-width":["interpolate",["exponential",1.2],["zoom"],13,1,20,10]}},{id:"highway_minor",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:8,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-opacity":.9,"line-width":["interpolate",["exponential",1.55],["zoom"],13,1.8,20,20]}},{id:"highway_major_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(185, 185, 185)","line-dasharray":[12,0],"line-width":["interpolate",["exponential",1.3],["zoom"],10,3,20,23]}},{id:"highway_major_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],10,2,20,20]}},{id:"highway_major_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:11,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":2}},{id:"highway_motorway_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,3,20,40]}},{id:"highway_motorway_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["match",["get","brunnel"],["bridge","tunnel"],!1,!0],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"highway_motorway_subtle",type:"line",source:"openmaptiles","source-layer":"transportation",maxzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"motorway"]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3]}},{id:"railway_transit",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":3}},{id:"railway_transit_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"transit"],["match",["get","brunnel"],["tunnel"],!1,!0]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway_service",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","class"],"rail"],["has","service"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(202, 202, 202, 1)","line-width":3}},{id:"railway_service_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:16,filter:["all",["==",["geometry-type"],"LineString"],["==",["get","class"],"rail"],["has","service"]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-dasharray":[3,3],"line-width":2}},{id:"railway",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(185, 185, 185, 1)","line-width":["interpolate",["exponential",1.3],["zoom"],16,3,20,7]}},{id:"railway_dashline",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:13,filter:["all",["==",["geometry-type"],"LineString"],["all",["!",["has","service"]],["==",["get","class"],"rail"]]],layout:{"line-join":"round"},paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[3,3],"line-width":["interpolate",["exponential",1.3],["zoom"],16,2,20,6]}},{id:"highway_motorway_bridge_casing",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"butt","line-join":"miter"},paint:{"line-color":"rgb(168, 168, 168)","line-dasharray":[2,0],"line-opacity":1,"line-width":["interpolate",["exponential",1.4],["zoom"],5.8,0,6,5,20,45]}},{id:"highway_motorway_bridge_inner",type:"line",source:"openmaptiles","source-layer":"transportation",minzoom:6,filter:["all",["==",["geometry-type"],"LineString"],["all",["==",["get","brunnel"],"bridge"],["==",["get","class"],"motorway"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":["interpolate",["linear"],["zoom"],5.8,"rgba(202, 202, 202, 1)",6,"rgba(185, 185, 185, 1)"],"line-width":["interpolate",["exponential",1.4],["zoom"],4,2,6,1.3,20,30]}},{id:"boundary_3",type:"line",source:"openmaptiles","source-layer":"boundary",minzoom:8,filter:["all",[">=",["get","admin_level"],3],["<=",["get","admin_level"],6],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],paint:{"line-color":"rgba(168, 168, 168, 1)","line-dasharray":[1,1],"line-width":["interpolate",["linear"],["zoom"],7,1,11,2]}},{id:"boundary_2",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["==",["get","admin_level"],2],["!=",["get","maritime"],1],["!=",["get","disputed"],1],["!",["has","claimed_by"]]],layout:{"line-cap":"round","line-join":"round"},paint:{"line-color":"rgba(151, 151, 151, 1)","line-opacity":["interpolate",["linear"],["zoom"],0,.4,4,1],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"boundary_disputed",type:"line",source:"openmaptiles","source-layer":"boundary",filter:["all",["!=",["get","maritime"],1],["==",["get","disputed"],1]],paint:{"line-color":"rgba(151, 151, 151, 1)","line-dasharray":[1,2],"line-width":["interpolate",["linear"],["zoom"],3,1,5,1.2,12,3]}},{id:"waterway_line_label",type:"symbol",source:"openmaptiles","source-layer":"waterway",minzoom:10,filter:["==",["geometry-type"],"LineString"],layout:{"symbol-placement":"line","symbol-spacing":350,"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":5,"text-size":14},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1.5}},{id:"water_name_point_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",minzoom:0,filter:["==",["geometry-type"],"Point"],layout:{visibility:"none"}},{id:"water_name_line_label",type:"symbol",source:"openmaptiles","source-layer":"water_name",filter:["==",["geometry-type"],"LineString"],layout:{visibility:"none"}},{id:"highway-name-path",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15.5,filter:["==",["get","class"],"path"],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(158, 158, 158, 1)","text-halo-color":"rgba(244, 244, 244, 1)","text-halo-width":.5}},{id:"highway-name-minor",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:15,filter:["all",["==",["geometry-type"],"LineString"],["match",["get","class"],["minor","service","track"],!0,!1]],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-name-major",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12.2,filter:["match",["get","class"],["primary","secondary","tertiary","trunk"],!0,!1],layout:{"symbol-placement":"line","text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"map","text-size":["interpolate",["linear"],["zoom"],13,12,14,13]},paint:{"text-color":"rgba(34, 34, 34, 1)","text-halo-width":1,"text-halo-color":"rgba(255, 255, 255, 1)"}},{id:"highway-shield-non-us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-interstate","us-state"],!1,!0]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10},paint:{"text-halo-color":"rgba(0, 0, 0, 1)","text-color":"rgba(0, 0, 0, 1)"}},{id:"highway-shield-us-interstate",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:11,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-interstate"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",7,"line",8,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"road_shield_us",type:"symbol",source:"openmaptiles","source-layer":"transportation_name",minzoom:12,filter:["all",["<=",["get","ref_length"],6],["==",["geometry-type"],"LineString"],["match",["get","network"],["us-highway","us-state"],!0,!1]],layout:{"icon-rotation-alignment":"viewport","icon-size":1,"symbol-placement":["step",["zoom"],"point",11,"line"],"symbol-spacing":200,"text-field":["to-string",["get","ref"]],"text-font":["Noto Sans Regular"],"text-rotation-alignment":"viewport","text-size":10}},{id:"airport",type:"symbol",source:"openmaptiles","source-layer":"aerodrome_label",minzoom:11,filter:["all",["has","iata"]],layout:{"icon-size":1,"text-anchor":"top","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":9,"text-offset":[0,.6],"text-optional":!0,"text-padding":2,"text-size":12},paint:{"text-color":"rgba(51, 51, 51, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_other",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:8,filter:["match",["get","class"],["city","continent","country","state","town","village"],!1,!0],layout:{"text-field":["get","name:latin"],"text-font":["Noto Sans Regular"],"text-letter-spacing":.1,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],8,9,12,10],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_village",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:9,filter:["==",["get","class"],"village"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,10,11,12]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_town",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:6,filter:["==",["get","class"],"town"],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.2,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-size":["interpolate",["exponential",1.2],["zoom"],7,12,11,14]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_state",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:5,maxzoom:8,filter:["==",["get","class"],"state"],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-letter-spacing":.2,"text-max-width":9,"text-size":["interpolate",["linear"],["zoom"],5,10,8,14],"text-transform":"uppercase"},paint:{"text-color":"rgba(17, 17, 17, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["!=",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.4,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Regular"],"text-max-width":8,"text-offset":[0,-.1],"text-size":["interpolate",["exponential",1.2],["zoom"],4,11,7,13,11,18]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_city_capital",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:3,filter:["all",["==",["get","class"],"city"],["==",["get","capital"],2]],layout:{"icon-allow-overlap":!0,"icon-optional":!1,"icon-size":.5,"text-anchor":"bottom","text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":8,"text-offset":[0,-.2],"text-size":["interpolate",["exponential",1.2],["zoom"],4,12,7,14,11,20]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_3",type:"symbol",source:"openmaptiles","source-layer":"place",minzoom:2,maxzoom:9,filter:["all",["==",["get","class"],"country"],[">=",["get","rank"],3]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],3,9,7,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_2",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],2]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],2,9,5,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}},{id:"label_country_1",type:"symbol",source:"openmaptiles","source-layer":"place",maxzoom:9,filter:["all",["==",["get","class"],"country"],["==",["get","rank"],1]],layout:{"text-field":["coalesce",["get","name_en"],["get","name:latin"]],"text-font":["Noto Sans Bold"],"text-max-width":6.25,"text-size":["interpolate",["linear"],["zoom"],1,9,4,17]},paint:{"text-color":"rgba(0, 0, 0, 1)","text-halo-color":"rgba(255, 255, 255, 1)","text-halo-width":1}}]};var Pt;(function(b){b.assertEqual=B=>B;function g(B){}b.assertIs=g;function T(B){throw new Error}b.assertNever=T,b.arrayToEnum=B=>{const Z={};for(const M of B)Z[M]=M;return Z},b.getValidEnumValues=B=>{const Z=b.objectKeys(B).filter(c=>typeof B[B[c]]!="number"),M={};for(const c of Z)M[c]=B[c];return b.objectValues(M)},b.objectValues=B=>b.objectKeys(B).map(function(Z){return B[Z]}),b.objectKeys=typeof Object.keys=="function"?B=>Object.keys(B):B=>{const Z=[];for(const M in B)Object.prototype.hasOwnProperty.call(B,M)&&Z.push(M);return Z},b.find=(B,Z)=>{for(const M of B)if(Z(M))return M},b.isInteger=typeof Number.isInteger=="function"?B=>Number.isInteger(B):B=>typeof B=="number"&&isFinite(B)&&Math.floor(B)===B;function E(B,Z=" | "){return B.map(M=>typeof M=="string"?`'${M}'`:M).join(Z)}b.joinValues=E,b.jsonStringifyReplacer=(B,Z)=>typeof Z=="bigint"?Z.toString():Z})(Pt||(Pt={}));var kh;(function(b){b.mergeShapes=(g,T)=>({...g,...T})})(kh||(kh={}));const Ke=Pt.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),Ln=b=>{switch(typeof b){case"undefined":return Ke.undefined;case"string":return Ke.string;case"number":return isNaN(b)?Ke.nan:Ke.number;case"boolean":return Ke.boolean;case"function":return Ke.function;case"bigint":return Ke.bigint;case"symbol":return Ke.symbol;case"object":return Array.isArray(b)?Ke.array:b===null?Ke.null:b.then&&typeof b.then=="function"&&b.catch&&typeof b.catch=="function"?Ke.promise:typeof Map<"u"&&b instanceof Map?Ke.map:typeof Set<"u"&&b instanceof Set?Ke.set:typeof Date<"u"&&b instanceof Date?Ke.date:Ke.object;default:return Ke.unknown}},Fe=Pt.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"]),Gg=b=>JSON.stringify(b,null,2).replace(/"([^"]+)":/g,"$1:");class hr extends Error{get errors(){return this.issues}constructor(g){super(),this.issues=[],this.addIssue=E=>{this.issues=[...this.issues,E]},this.addIssues=(E=[])=>{this.issues=[...this.issues,...E]};const T=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,T):this.__proto__=T,this.name="ZodError",this.issues=g}format(g){const T=g||function(Z){return Z.message},E={_errors:[]},B=Z=>{for(const M of Z.issues)if(M.code==="invalid_union")M.unionErrors.map(B);else if(M.code==="invalid_return_type")B(M.returnTypeError);else if(M.code==="invalid_arguments")B(M.argumentsError);else if(M.path.length===0)E._errors.push(T(M));else{let c=E,Te=0;for(;Te<M.path.length;){const ge=M.path[Te];Te===M.path.length-1?(c[ge]=c[ge]||{_errors:[]},c[ge]._errors.push(T(M))):c[ge]=c[ge]||{_errors:[]},c=c[ge],Te++}}};return B(this),E}static assert(g){if(!(g instanceof hr))throw new Error(`Not a ZodError: ${g}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Pt.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(g=T=>T.message){const T={},E=[];for(const B of this.issues)B.path.length>0?(T[B.path[0]]=T[B.path[0]]||[],T[B.path[0]].push(g(B))):E.push(g(B));return{formErrors:E,fieldErrors:T}}get formErrors(){return this.flatten()}}hr.create=b=>new hr(b);const to=(b,g)=>{let T;switch(b.code){case Fe.invalid_type:b.received===Ke.undefined?T="Required":T=`Expected ${b.expected}, received ${b.received}`;break;case Fe.invalid_literal:T=`Invalid literal value, expected ${JSON.stringify(b.expected,Pt.jsonStringifyReplacer)}`;break;case Fe.unrecognized_keys:T=`Unrecognized key(s) in object: ${Pt.joinValues(b.keys,", ")}`;break;case Fe.invalid_union:T="Invalid input";break;case Fe.invalid_union_discriminator:T=`Invalid discriminator value. Expected ${Pt.joinValues(b.options)}`;break;case Fe.invalid_enum_value:T=`Invalid enum value. Expected ${Pt.joinValues(b.options)}, received '${b.received}'`;break;case Fe.invalid_arguments:T="Invalid function arguments";break;case Fe.invalid_return_type:T="Invalid function return type";break;case Fe.invalid_date:T="Invalid date";break;case Fe.invalid_string:typeof b.validation=="object"?"includes"in b.validation?(T=`Invalid input: must include "${b.validation.includes}"`,typeof b.validation.position=="number"&&(T=`${T} at one or more positions greater than or equal to ${b.validation.position}`)):"startsWith"in b.validation?T=`Invalid input: must start with "${b.validation.startsWith}"`:"endsWith"in b.validation?T=`Invalid input: must end with "${b.validation.endsWith}"`:Pt.assertNever(b.validation):b.validation!=="regex"?T=`Invalid ${b.validation}`:T="Invalid";break;case Fe.too_small:b.type==="array"?T=`Array must contain ${b.exact?"exactly":b.inclusive?"at least":"more than"} ${b.minimum} element(s)`:b.type==="string"?T=`String must contain ${b.exact?"exactly":b.inclusive?"at least":"over"} ${b.minimum} character(s)`:b.type==="number"?T=`Number must be ${b.exact?"exactly equal to ":b.inclusive?"greater than or equal to ":"greater than "}${b.minimum}`:b.type==="date"?T=`Date must be ${b.exact?"exactly equal to ":b.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(b.minimum))}`:T="Invalid input";break;case Fe.too_big:b.type==="array"?T=`Array must contain ${b.exact?"exactly":b.inclusive?"at most":"less than"} ${b.maximum} element(s)`:b.type==="string"?T=`String must contain ${b.exact?"exactly":b.inclusive?"at most":"under"} ${b.maximum} character(s)`:b.type==="number"?T=`Number must be ${b.exact?"exactly":b.inclusive?"less than or equal to":"less than"} ${b.maximum}`:b.type==="bigint"?T=`BigInt must be ${b.exact?"exactly":b.inclusive?"less than or equal to":"less than"} ${b.maximum}`:b.type==="date"?T=`Date must be ${b.exact?"exactly":b.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(b.maximum))}`:T="Invalid input";break;case Fe.custom:T="Invalid input";break;case Fe.invalid_intersection_types:T="Intersection results could not be merged";break;case Fe.not_multiple_of:T=`Number must be a multiple of ${b.multipleOf}`;break;case Fe.not_finite:T="Number must be finite";break;default:T=g.defaultError,Pt.assertNever(b)}return{message:T}};let Ep=to;function qg(b){Ep=b}function Xc(){return Ep}const Yc=b=>{const{data:g,path:T,errorMaps:E,issueData:B}=b,Z=[...T,...B.path||[]],M={...B,path:Z};if(B.message!==void 0)return{...B,path:Z,message:B.message};let c="";const Te=E.filter(ge=>!!ge).slice().reverse();for(const ge of Te)c=ge(M,{data:g,defaultError:c}).message;return{...B,path:Z,message:c}},Wg=[];function Ge(b,g){const T=Xc(),E=Yc({issueData:g,data:b.data,path:b.path,errorMaps:[b.common.contextualErrorMap,b.schemaErrorMap,T,T===to?void 0:to].filter(B=>!!B)});b.common.issues.push(E)}class Oi{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(g,T){const E=[];for(const B of T){if(B.status==="aborted")return ot;B.status==="dirty"&&g.dirty(),E.push(B.value)}return{status:g.value,value:E}}static async mergeObjectAsync(g,T){const E=[];for(const B of T){const Z=await B.key,M=await B.value;E.push({key:Z,value:M})}return Oi.mergeObjectSync(g,E)}static mergeObjectSync(g,T){const E={};for(const B of T){const{key:Z,value:M}=B;if(Z.status==="aborted"||M.status==="aborted")return ot;Z.status==="dirty"&&g.dirty(),M.status==="dirty"&&g.dirty(),Z.value!=="__proto__"&&(typeof M.value<"u"||B.alwaysSet)&&(E[Z.value]=M.value)}return{status:g.value,value:E}}}const ot=Object.freeze({status:"aborted"}),io=b=>({status:"dirty",value:b}),Ki=b=>({status:"valid",value:b}),Ah=b=>b.status==="aborted",Rh=b=>b.status==="dirty",hs=b=>b.status==="valid",ol=b=>typeof Promise<"u"&&b instanceof Promise;function Jc(b,g,T,E){if(typeof g=="function"?b!==g||!0:!g.has(b))throw new TypeError("Cannot read private member from an object whose class did not declare it");return g.get(b)}function zp(b,g,T,E,B){if(typeof g=="function"?b!==g||!0:!g.has(b))throw new TypeError("Cannot write private member to an object whose class did not declare it");return g.set(b,T),T}typeof SuppressedError=="function"&&SuppressedError;var et;(function(b){b.errToObj=g=>typeof g=="string"?{message:g}:g||{},b.toString=g=>typeof g=="string"?g:g==null?void 0:g.message})(et||(et={}));var ll,cl;class dn{constructor(g,T,E,B){this._cachedPath=[],this.parent=g,this.data=T,this._path=E,this._key=B}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const kp=(b,g)=>{if(hs(g))return{success:!0,data:g.value};if(!b.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 hr(b.common.issues);return this._error=T,this._error}}};function ht(b){if(!b)return{};const{errorMap:g,invalid_type_error:T,required_error:E,description:B}=b;if(g&&(T||E))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return g?{errorMap:g,description:B}:{errorMap:(M,c)=>{var Te,ge;const{message:ke}=b;return M.code==="invalid_enum_value"?{message:ke??c.defaultError}:typeof c.data>"u"?{message:(Te=ke??E)!==null&&Te!==void 0?Te:c.defaultError}:M.code!=="invalid_type"?{message:c.defaultError}:{message:(ge=ke??T)!==null&&ge!==void 0?ge:c.defaultError}},description:B}}class mt{get description(){return this._def.description}_getType(g){return Ln(g.data)}_getOrReturnCtx(g,T){return T||{common:g.parent.common,data:g.data,parsedType:Ln(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}_processInputParams(g){return{status:new Oi,ctx:{common:g.parent.common,data:g.data,parsedType:Ln(g.data),schemaErrorMap:this._def.errorMap,path:g.path,parent:g.parent}}}_parseSync(g){const T=this._parse(g);if(ol(T))throw new Error("Synchronous parse encountered promise.");return T}_parseAsync(g){const T=this._parse(g);return Promise.resolve(T)}parse(g,T){const E=this.safeParse(g,T);if(E.success)return E.data;throw E.error}safeParse(g,T){var E;const B={common:{issues:[],async:(E=T==null?void 0:T.async)!==null&&E!==void 0?E:!1,contextualErrorMap:T==null?void 0:T.errorMap},path:(T==null?void 0:T.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:Ln(g)},Z=this._parseSync({data:g,path:B.path,parent:B});return kp(B,Z)}"~validate"(g){var T,E;const B={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:g,parsedType:Ln(g)};if(!this["~standard"].async)try{const Z=this._parseSync({data:g,path:[],parent:B});return hs(Z)?{value:Z.value}:{issues:B.common.issues}}catch(Z){!((E=(T=Z==null?void 0:Z.message)===null||T===void 0?void 0:T.toLowerCase())===null||E===void 0)&&E.includes("encountered")&&(this["~standard"].async=!0),B.common={issues:[],async:!0}}return this._parseAsync({data:g,path:[],parent:B}).then(Z=>hs(Z)?{value:Z.value}:{issues:B.common.issues})}async parseAsync(g,T){const E=await this.safeParseAsync(g,T);if(E.success)return E.data;throw E.error}async safeParseAsync(g,T){const E={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:g,parsedType:Ln(g)},B=this._parse({data:g,path:E.path,parent:E}),Z=await(ol(B)?B:Promise.resolve(B));return kp(E,Z)}refine(g,T){const E=B=>typeof T=="string"||typeof T>"u"?{message:T}:typeof T=="function"?T(B):T;return this._refinement((B,Z)=>{const M=g(B),c=()=>Z.addIssue({code:Fe.custom,...E(B)});return typeof Promise<"u"&&M instanceof Promise?M.then(Te=>Te?!0:(c(),!1)):M?!0:(c(),!1)})}refinement(g,T){return this._refinement((E,B)=>g(E)?!0:(B.addIssue(typeof T=="function"?T(E,B):T),!1))}_refinement(g){return new Zr({schema:this,typeName:at.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:T=>this["~validate"](T)}}optional(){return fn.create(this,this._def)}nullable(){return va.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return Nr.create(this)}promise(){return so.create(this,this._def)}or(g){return pl.create([this,g],this._def)}and(g){return fl.create(this,g,this._def)}transform(g){return new Zr({...ht(this._def),schema:this,typeName:at.ZodEffects,effect:{type:"transform",transform:g}})}default(g){const T=typeof g=="function"?g:()=>g;return new xl({...ht(this._def),innerType:this,defaultValue:T,typeName:at.ZodDefault})}brand(){return new Fh({typeName:at.ZodBranded,type:this,...ht(this._def)})}catch(g){const T=typeof g=="function"?g:()=>g;return new vl({...ht(this._def),innerType:this,catchValue:T,typeName:at.ZodCatch})}describe(g){const T=this.constructor;return new T({...this._def,description:g})}pipe(g){return bl.create(this,g)}readonly(){return wl.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const Hg=/^c[^\s-]{8,}$/i,Kg=/^[0-9a-z]+$/,Xg=/^[0-9A-HJKMNP-TV-Z]{26}$/i,Yg=/^[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,Jg=/^[a-z0-9_-]{21}$/i,Qg=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,e_=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,t_=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,i_="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let Dh;const r_=/^(?:(?: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])$/,n_=/^(?:(?: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])$/,a_=/^(([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]))$/,s_=/^(([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])$/,o_=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,l_=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,Ap="((\\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])))",c_=new RegExp(`^${Ap}$`);function Rp(b){let g="([01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d";return b.precision?g=`${g}\\.\\d{${b.precision}}`:b.precision==null&&(g=`${g}(\\.\\d+)?`),g}function u_(b){return new RegExp(`^${Rp(b)}$`)}function Dp(b){let g=`${Ap}T${Rp(b)}`;const T=[];return T.push(b.local?"Z?":"Z"),b.offset&&T.push("([+-]\\d{2}:?\\d{2})"),g=`${g}(${T.join("|")})`,new RegExp(`^${g}$`)}function h_(b,g){return!!((g==="v4"||!g)&&r_.test(b)||(g==="v6"||!g)&&a_.test(b))}function d_(b,g){if(!Qg.test(b))return!1;try{const[T]=b.split("."),E=T.replace(/-/g,"+").replace(/_/g,"/").padEnd(T.length+(4-T.length%4)%4,"="),B=JSON.parse(atob(E));return!(typeof B!="object"||B===null||!B.typ||!B.alg||g&&B.alg!==g)}catch{return!1}}function p_(b,g){return!!((g==="v4"||!g)&&n_.test(b)||(g==="v6"||!g)&&s_.test(b))}class jr extends mt{_parse(g){if(this._def.coerce&&(g.data=String(g.data)),this._getType(g)!==Ke.string){const Z=this._getOrReturnCtx(g);return Ge(Z,{code:Fe.invalid_type,expected:Ke.string,received:Z.parsedType}),ot}const E=new Oi;let B;for(const Z of this._def.checks)if(Z.kind==="min")g.data.length<Z.value&&(B=this._getOrReturnCtx(g,B),Ge(B,{code:Fe.too_small,minimum:Z.value,type:"string",inclusive:!0,exact:!1,message:Z.message}),E.dirty());else if(Z.kind==="max")g.data.length>Z.value&&(B=this._getOrReturnCtx(g,B),Ge(B,{code:Fe.too_big,maximum:Z.value,type:"string",inclusive:!0,exact:!1,message:Z.message}),E.dirty());else if(Z.kind==="length"){const M=g.data.length>Z.value,c=g.data.length<Z.value;(M||c)&&(B=this._getOrReturnCtx(g,B),M?Ge(B,{code:Fe.too_big,maximum:Z.value,type:"string",inclusive:!0,exact:!0,message:Z.message}):c&&Ge(B,{code:Fe.too_small,minimum:Z.value,type:"string",inclusive:!0,exact:!0,message:Z.message}),E.dirty())}else if(Z.kind==="email")t_.test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"email",code:Fe.invalid_string,message:Z.message}),E.dirty());else if(Z.kind==="emoji")Dh||(Dh=new RegExp(i_,"u")),Dh.test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"emoji",code:Fe.invalid_string,message:Z.message}),E.dirty());else if(Z.kind==="uuid")Yg.test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"uuid",code:Fe.invalid_string,message:Z.message}),E.dirty());else if(Z.kind==="nanoid")Jg.test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"nanoid",code:Fe.invalid_string,message:Z.message}),E.dirty());else if(Z.kind==="cuid")Hg.test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"cuid",code:Fe.invalid_string,message:Z.message}),E.dirty());else if(Z.kind==="cuid2")Kg.test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"cuid2",code:Fe.invalid_string,message:Z.message}),E.dirty());else if(Z.kind==="ulid")Xg.test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"ulid",code:Fe.invalid_string,message:Z.message}),E.dirty());else if(Z.kind==="url")try{new URL(g.data)}catch{B=this._getOrReturnCtx(g,B),Ge(B,{validation:"url",code:Fe.invalid_string,message:Z.message}),E.dirty()}else Z.kind==="regex"?(Z.regex.lastIndex=0,Z.regex.test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"regex",code:Fe.invalid_string,message:Z.message}),E.dirty())):Z.kind==="trim"?g.data=g.data.trim():Z.kind==="includes"?g.data.includes(Z.value,Z.position)||(B=this._getOrReturnCtx(g,B),Ge(B,{code:Fe.invalid_string,validation:{includes:Z.value,position:Z.position},message:Z.message}),E.dirty()):Z.kind==="toLowerCase"?g.data=g.data.toLowerCase():Z.kind==="toUpperCase"?g.data=g.data.toUpperCase():Z.kind==="startsWith"?g.data.startsWith(Z.value)||(B=this._getOrReturnCtx(g,B),Ge(B,{code:Fe.invalid_string,validation:{startsWith:Z.value},message:Z.message}),E.dirty()):Z.kind==="endsWith"?g.data.endsWith(Z.value)||(B=this._getOrReturnCtx(g,B),Ge(B,{code:Fe.invalid_string,validation:{endsWith:Z.value},message:Z.message}),E.dirty()):Z.kind==="datetime"?Dp(Z).test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{code:Fe.invalid_string,validation:"datetime",message:Z.message}),E.dirty()):Z.kind==="date"?c_.test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{code:Fe.invalid_string,validation:"date",message:Z.message}),E.dirty()):Z.kind==="time"?u_(Z).test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{code:Fe.invalid_string,validation:"time",message:Z.message}),E.dirty()):Z.kind==="duration"?e_.test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"duration",code:Fe.invalid_string,message:Z.message}),E.dirty()):Z.kind==="ip"?h_(g.data,Z.version)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"ip",code:Fe.invalid_string,message:Z.message}),E.dirty()):Z.kind==="jwt"?d_(g.data,Z.alg)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"jwt",code:Fe.invalid_string,message:Z.message}),E.dirty()):Z.kind==="cidr"?p_(g.data,Z.version)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"cidr",code:Fe.invalid_string,message:Z.message}),E.dirty()):Z.kind==="base64"?o_.test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"base64",code:Fe.invalid_string,message:Z.message}),E.dirty()):Z.kind==="base64url"?l_.test(g.data)||(B=this._getOrReturnCtx(g,B),Ge(B,{validation:"base64url",code:Fe.invalid_string,message:Z.message}),E.dirty()):Pt.assertNever(Z);return{status:E.value,value:g.data}}_regex(g,T,E){return this.refinement(B=>g.test(B),{validation:T,code:Fe.invalid_string,...et.errToObj(E)})}_addCheck(g){return new jr({...this._def,checks:[...this._def.checks,g]})}email(g){return this._addCheck({kind:"email",...et.errToObj(g)})}url(g){return this._addCheck({kind:"url",...et.errToObj(g)})}emoji(g){return this._addCheck({kind:"emoji",...et.errToObj(g)})}uuid(g){return this._addCheck({kind:"uuid",...et.errToObj(g)})}nanoid(g){return this._addCheck({kind:"nanoid",...et.errToObj(g)})}cuid(g){return this._addCheck({kind:"cuid",...et.errToObj(g)})}cuid2(g){return this._addCheck({kind:"cuid2",...et.errToObj(g)})}ulid(g){return this._addCheck({kind:"ulid",...et.errToObj(g)})}base64(g){return this._addCheck({kind:"base64",...et.errToObj(g)})}base64url(g){return this._addCheck({kind:"base64url",...et.errToObj(g)})}jwt(g){return this._addCheck({kind:"jwt",...et.errToObj(g)})}ip(g){return this._addCheck({kind:"ip",...et.errToObj(g)})}cidr(g){return this._addCheck({kind:"cidr",...et.errToObj(g)})}datetime(g){var T,E;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:(T=g==null?void 0:g.offset)!==null&&T!==void 0?T:!1,local:(E=g==null?void 0:g.local)!==null&&E!==void 0?E:!1,...et.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,...et.errToObj(g==null?void 0:g.message)})}duration(g){return this._addCheck({kind:"duration",...et.errToObj(g)})}regex(g,T){return this._addCheck({kind:"regex",regex:g,...et.errToObj(T)})}includes(g,T){return this._addCheck({kind:"includes",value:g,position:T==null?void 0:T.position,...et.errToObj(T==null?void 0:T.message)})}startsWith(g,T){return this._addCheck({kind:"startsWith",value:g,...et.errToObj(T)})}endsWith(g,T){return this._addCheck({kind:"endsWith",value:g,...et.errToObj(T)})}min(g,T){return this._addCheck({kind:"min",value:g,...et.errToObj(T)})}max(g,T){return this._addCheck({kind:"max",value:g,...et.errToObj(T)})}length(g,T){return this._addCheck({kind:"length",value:g,...et.errToObj(T)})}nonempty(g){return this.min(1,et.errToObj(g))}trim(){return new jr({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new jr({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new jr({...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 T of this._def.checks)T.kind==="min"&&(g===null||T.value>g)&&(g=T.value);return g}get maxLength(){let g=null;for(const T of this._def.checks)T.kind==="max"&&(g===null||T.value<g)&&(g=T.value);return g}}jr.create=b=>{var g;return new jr({checks:[],typeName:at.ZodString,coerce:(g=b==null?void 0:b.coerce)!==null&&g!==void 0?g:!1,...ht(b)})};function f_(b,g){const T=(b.toString().split(".")[1]||"").length,E=(g.toString().split(".")[1]||"").length,B=T>E?T:E,Z=parseInt(b.toFixed(B).replace(".","")),M=parseInt(g.toFixed(B).replace(".",""));return Z%M/Math.pow(10,B)}class _a extends mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(g){if(this._def.coerce&&(g.data=Number(g.data)),this._getType(g)!==Ke.number){const Z=this._getOrReturnCtx(g);return Ge(Z,{code:Fe.invalid_type,expected:Ke.number,received:Z.parsedType}),ot}let E;const B=new Oi;for(const Z of this._def.checks)Z.kind==="int"?Pt.isInteger(g.data)||(E=this._getOrReturnCtx(g,E),Ge(E,{code:Fe.invalid_type,expected:"integer",received:"float",message:Z.message}),B.dirty()):Z.kind==="min"?(Z.inclusive?g.data<Z.value:g.data<=Z.value)&&(E=this._getOrReturnCtx(g,E),Ge(E,{code:Fe.too_small,minimum:Z.value,type:"number",inclusive:Z.inclusive,exact:!1,message:Z.message}),B.dirty()):Z.kind==="max"?(Z.inclusive?g.data>Z.value:g.data>=Z.value)&&(E=this._getOrReturnCtx(g,E),Ge(E,{code:Fe.too_big,maximum:Z.value,type:"number",inclusive:Z.inclusive,exact:!1,message:Z.message}),B.dirty()):Z.kind==="multipleOf"?f_(g.data,Z.value)!==0&&(E=this._getOrReturnCtx(g,E),Ge(E,{code:Fe.not_multiple_of,multipleOf:Z.value,message:Z.message}),B.dirty()):Z.kind==="finite"?Number.isFinite(g.data)||(E=this._getOrReturnCtx(g,E),Ge(E,{code:Fe.not_finite,message:Z.message}),B.dirty()):Pt.assertNever(Z);return{status:B.value,value:g.data}}gte(g,T){return this.setLimit("min",g,!0,et.toString(T))}gt(g,T){return this.setLimit("min",g,!1,et.toString(T))}lte(g,T){return this.setLimit("max",g,!0,et.toString(T))}lt(g,T){return this.setLimit("max",g,!1,et.toString(T))}setLimit(g,T,E,B){return new _a({...this._def,checks:[...this._def.checks,{kind:g,value:T,inclusive:E,message:et.toString(B)}]})}_addCheck(g){return new _a({...this._def,checks:[...this._def.checks,g]})}int(g){return this._addCheck({kind:"int",message:et.toString(g)})}positive(g){return this._addCheck({kind:"min",value:0,inclusive:!1,message:et.toString(g)})}negative(g){return this._addCheck({kind:"max",value:0,inclusive:!1,message:et.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:0,inclusive:!0,message:et.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:0,inclusive:!0,message:et.toString(g)})}multipleOf(g,T){return this._addCheck({kind:"multipleOf",value:g,message:et.toString(T)})}finite(g){return this._addCheck({kind:"finite",message:et.toString(g)})}safe(g){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:et.toString(g)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:et.toString(g)})}get minValue(){let g=null;for(const T of this._def.checks)T.kind==="min"&&(g===null||T.value>g)&&(g=T.value);return g}get maxValue(){let g=null;for(const T of this._def.checks)T.kind==="max"&&(g===null||T.value<g)&&(g=T.value);return g}get isInt(){return!!this._def.checks.find(g=>g.kind==="int"||g.kind==="multipleOf"&&Pt.isInteger(g.value))}get isFinite(){let g=null,T=null;for(const E of this._def.checks){if(E.kind==="finite"||E.kind==="int"||E.kind==="multipleOf")return!0;E.kind==="min"?(T===null||E.value>T)&&(T=E.value):E.kind==="max"&&(g===null||E.value<g)&&(g=E.value)}return Number.isFinite(T)&&Number.isFinite(g)}}_a.create=b=>new _a({checks:[],typeName:at.ZodNumber,coerce:(b==null?void 0:b.coerce)||!1,...ht(b)});class ya extends mt{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(g){if(this._def.coerce)try{g.data=BigInt(g.data)}catch{return this._getInvalidInput(g)}if(this._getType(g)!==Ke.bigint)return this._getInvalidInput(g);let E;const B=new Oi;for(const Z of this._def.checks)Z.kind==="min"?(Z.inclusive?g.data<Z.value:g.data<=Z.value)&&(E=this._getOrReturnCtx(g,E),Ge(E,{code:Fe.too_small,type:"bigint",minimum:Z.value,inclusive:Z.inclusive,message:Z.message}),B.dirty()):Z.kind==="max"?(Z.inclusive?g.data>Z.value:g.data>=Z.value)&&(E=this._getOrReturnCtx(g,E),Ge(E,{code:Fe.too_big,type:"bigint",maximum:Z.value,inclusive:Z.inclusive,message:Z.message}),B.dirty()):Z.kind==="multipleOf"?g.data%Z.value!==BigInt(0)&&(E=this._getOrReturnCtx(g,E),Ge(E,{code:Fe.not_multiple_of,multipleOf:Z.value,message:Z.message}),B.dirty()):Pt.assertNever(Z);return{status:B.value,value:g.data}}_getInvalidInput(g){const T=this._getOrReturnCtx(g);return Ge(T,{code:Fe.invalid_type,expected:Ke.bigint,received:T.parsedType}),ot}gte(g,T){return this.setLimit("min",g,!0,et.toString(T))}gt(g,T){return this.setLimit("min",g,!1,et.toString(T))}lte(g,T){return this.setLimit("max",g,!0,et.toString(T))}lt(g,T){return this.setLimit("max",g,!1,et.toString(T))}setLimit(g,T,E,B){return new ya({...this._def,checks:[...this._def.checks,{kind:g,value:T,inclusive:E,message:et.toString(B)}]})}_addCheck(g){return new ya({...this._def,checks:[...this._def.checks,g]})}positive(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:et.toString(g)})}negative(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:et.toString(g)})}nonpositive(g){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:et.toString(g)})}nonnegative(g){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:et.toString(g)})}multipleOf(g,T){return this._addCheck({kind:"multipleOf",value:g,message:et.toString(T)})}get minValue(){let g=null;for(const T of this._def.checks)T.kind==="min"&&(g===null||T.value>g)&&(g=T.value);return g}get maxValue(){let g=null;for(const T of this._def.checks)T.kind==="max"&&(g===null||T.value<g)&&(g=T.value);return g}}ya.create=b=>{var g;return new ya({checks:[],typeName:at.ZodBigInt,coerce:(g=b==null?void 0:b.coerce)!==null&&g!==void 0?g:!1,...ht(b)})};class ul extends mt{_parse(g){if(this._def.coerce&&(g.data=!!g.data),this._getType(g)!==Ke.boolean){const E=this._getOrReturnCtx(g);return Ge(E,{code:Fe.invalid_type,expected:Ke.boolean,received:E.parsedType}),ot}return Ki(g.data)}}ul.create=b=>new ul({typeName:at.ZodBoolean,coerce:(b==null?void 0:b.coerce)||!1,...ht(b)});class ds extends mt{_parse(g){if(this._def.coerce&&(g.data=new Date(g.data)),this._getType(g)!==Ke.date){const Z=this._getOrReturnCtx(g);return Ge(Z,{code:Fe.invalid_type,expected:Ke.date,received:Z.parsedType}),ot}if(isNaN(g.data.getTime())){const Z=this._getOrReturnCtx(g);return Ge(Z,{code:Fe.invalid_date}),ot}const E=new Oi;let B;for(const Z of this._def.checks)Z.kind==="min"?g.data.getTime()<Z.value&&(B=this._getOrReturnCtx(g,B),Ge(B,{code:Fe.too_small,message:Z.message,inclusive:!0,exact:!1,minimum:Z.value,type:"date"}),E.dirty()):Z.kind==="max"?g.data.getTime()>Z.value&&(B=this._getOrReturnCtx(g,B),Ge(B,{code:Fe.too_big,message:Z.message,inclusive:!0,exact:!1,maximum:Z.value,type:"date"}),E.dirty()):Pt.assertNever(Z);return{status:E.value,value:new Date(g.data.getTime())}}_addCheck(g){return new ds({...this._def,checks:[...this._def.checks,g]})}min(g,T){return this._addCheck({kind:"min",value:g.getTime(),message:et.toString(T)})}max(g,T){return this._addCheck({kind:"max",value:g.getTime(),message:et.toString(T)})}get minDate(){let g=null;for(const T of this._def.checks)T.kind==="min"&&(g===null||T.value>g)&&(g=T.value);return g!=null?new Date(g):null}get maxDate(){let g=null;for(const T of this._def.checks)T.kind==="max"&&(g===null||T.value<g)&&(g=T.value);return g!=null?new Date(g):null}}ds.create=b=>new ds({checks:[],coerce:(b==null?void 0:b.coerce)||!1,typeName:at.ZodDate,...ht(b)});class Qc extends mt{_parse(g){if(this._getType(g)!==Ke.symbol){const E=this._getOrReturnCtx(g);return Ge(E,{code:Fe.invalid_type,expected:Ke.symbol,received:E.parsedType}),ot}return Ki(g.data)}}Qc.create=b=>new Qc({typeName:at.ZodSymbol,...ht(b)});class hl extends mt{_parse(g){if(this._getType(g)!==Ke.undefined){const E=this._getOrReturnCtx(g);return Ge(E,{code:Fe.invalid_type,expected:Ke.undefined,received:E.parsedType}),ot}return Ki(g.data)}}hl.create=b=>new hl({typeName:at.ZodUndefined,...ht(b)});class dl extends mt{_parse(g){if(this._getType(g)!==Ke.null){const E=this._getOrReturnCtx(g);return Ge(E,{code:Fe.invalid_type,expected:Ke.null,received:E.parsedType}),ot}return Ki(g.data)}}dl.create=b=>new dl({typeName:at.ZodNull,...ht(b)});class ro extends mt{constructor(){super(...arguments),this._any=!0}_parse(g){return Ki(g.data)}}ro.create=b=>new ro({typeName:at.ZodAny,...ht(b)});class ps extends mt{constructor(){super(...arguments),this._unknown=!0}_parse(g){return Ki(g.data)}}ps.create=b=>new ps({typeName:at.ZodUnknown,...ht(b)});class Fn extends mt{_parse(g){const T=this._getOrReturnCtx(g);return Ge(T,{code:Fe.invalid_type,expected:Ke.never,received:T.parsedType}),ot}}Fn.create=b=>new Fn({typeName:at.ZodNever,...ht(b)});class eu extends mt{_parse(g){if(this._getType(g)!==Ke.undefined){const E=this._getOrReturnCtx(g);return Ge(E,{code:Fe.invalid_type,expected:Ke.void,received:E.parsedType}),ot}return Ki(g.data)}}eu.create=b=>new eu({typeName:at.ZodVoid,...ht(b)});class Nr extends mt{_parse(g){const{ctx:T,status:E}=this._processInputParams(g),B=this._def;if(T.parsedType!==Ke.array)return Ge(T,{code:Fe.invalid_type,expected:Ke.array,received:T.parsedType}),ot;if(B.exactLength!==null){const M=T.data.length>B.exactLength.value,c=T.data.length<B.exactLength.value;(M||c)&&(Ge(T,{code:M?Fe.too_big:Fe.too_small,minimum:c?B.exactLength.value:void 0,maximum:M?B.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:B.exactLength.message}),E.dirty())}if(B.minLength!==null&&T.data.length<B.minLength.value&&(Ge(T,{code:Fe.too_small,minimum:B.minLength.value,type:"array",inclusive:!0,exact:!1,message:B.minLength.message}),E.dirty()),B.maxLength!==null&&T.data.length>B.maxLength.value&&(Ge(T,{code:Fe.too_big,maximum:B.maxLength.value,type:"array",inclusive:!0,exact:!1,message:B.maxLength.message}),E.dirty()),T.common.async)return Promise.all([...T.data].map((M,c)=>B.type._parseAsync(new dn(T,M,T.path,c)))).then(M=>Oi.mergeArray(E,M));const Z=[...T.data].map((M,c)=>B.type._parseSync(new dn(T,M,T.path,c)));return Oi.mergeArray(E,Z)}get element(){return this._def.type}min(g,T){return new Nr({...this._def,minLength:{value:g,message:et.toString(T)}})}max(g,T){return new Nr({...this._def,maxLength:{value:g,message:et.toString(T)}})}length(g,T){return new Nr({...this._def,exactLength:{value:g,message:et.toString(T)}})}nonempty(g){return this.min(1,g)}}Nr.create=(b,g)=>new Nr({type:b,minLength:null,maxLength:null,exactLength:null,typeName:at.ZodArray,...ht(g)});function no(b){if(b instanceof ei){const g={};for(const T in b.shape){const E=b.shape[T];g[T]=fn.create(no(E))}return new ei({...b._def,shape:()=>g})}else return b instanceof Nr?new Nr({...b._def,type:no(b.element)}):b instanceof fn?fn.create(no(b.unwrap())):b instanceof va?va.create(no(b.unwrap())):b instanceof pn?pn.create(b.items.map(g=>no(g))):b}class ei extends mt{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(),T=Pt.objectKeys(g);return this._cached={shape:g,keys:T}}_parse(g){if(this._getType(g)!==Ke.object){const ge=this._getOrReturnCtx(g);return Ge(ge,{code:Fe.invalid_type,expected:Ke.object,received:ge.parsedType}),ot}const{status:E,ctx:B}=this._processInputParams(g),{shape:Z,keys:M}=this._getCached(),c=[];if(!(this._def.catchall instanceof Fn&&this._def.unknownKeys==="strip"))for(const ge in B.data)M.includes(ge)||c.push(ge);const Te=[];for(const ge of M){const ke=Z[ge],Ue=B.data[ge];Te.push({key:{status:"valid",value:ge},value:ke._parse(new dn(B,Ue,B.path,ge)),alwaysSet:ge in B.data})}if(this._def.catchall instanceof Fn){const ge=this._def.unknownKeys;if(ge==="passthrough")for(const ke of c)Te.push({key:{status:"valid",value:ke},value:{status:"valid",value:B.data[ke]}});else if(ge==="strict")c.length>0&&(Ge(B,{code:Fe.unrecognized_keys,keys:c}),E.dirty());else if(ge!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const ge=this._def.catchall;for(const ke of c){const Ue=B.data[ke];Te.push({key:{status:"valid",value:ke},value:ge._parse(new dn(B,Ue,B.path,ke)),alwaysSet:ke in B.data})}}return B.common.async?Promise.resolve().then(async()=>{const ge=[];for(const ke of Te){const Ue=await ke.key,Ae=await ke.value;ge.push({key:Ue,value:Ae,alwaysSet:ke.alwaysSet})}return ge}).then(ge=>Oi.mergeObjectSync(E,ge)):Oi.mergeObjectSync(E,Te)}get shape(){return this._def.shape()}strict(g){return et.errToObj,new ei({...this._def,unknownKeys:"strict",...g!==void 0?{errorMap:(T,E)=>{var B,Z,M,c;const Te=(M=(Z=(B=this._def).errorMap)===null||Z===void 0?void 0:Z.call(B,T,E).message)!==null&&M!==void 0?M:E.defaultError;return T.code==="unrecognized_keys"?{message:(c=et.errToObj(g).message)!==null&&c!==void 0?c:Te}:{message:Te}}}:{}})}strip(){return new ei({...this._def,unknownKeys:"strip"})}passthrough(){return new ei({...this._def,unknownKeys:"passthrough"})}extend(g){return new ei({...this._def,shape:()=>({...this._def.shape(),...g})})}merge(g){return new ei({unknownKeys:g._def.unknownKeys,catchall:g._def.catchall,shape:()=>({...this._def.shape(),...g._def.shape()}),typeName:at.ZodObject})}setKey(g,T){return this.augment({[g]:T})}catchall(g){return new ei({...this._def,catchall:g})}pick(g){const T={};return Pt.objectKeys(g).forEach(E=>{g[E]&&this.shape[E]&&(T[E]=this.shape[E])}),new ei({...this._def,shape:()=>T})}omit(g){const T={};return Pt.objectKeys(this.shape).forEach(E=>{g[E]||(T[E]=this.shape[E])}),new ei({...this._def,shape:()=>T})}deepPartial(){return no(this)}partial(g){const T={};return Pt.objectKeys(this.shape).forEach(E=>{const B=this.shape[E];g&&!g[E]?T[E]=B:T[E]=B.optional()}),new ei({...this._def,shape:()=>T})}required(g){const T={};return Pt.objectKeys(this.shape).forEach(E=>{if(g&&!g[E])T[E]=this.shape[E];else{let Z=this.shape[E];for(;Z instanceof fn;)Z=Z._def.innerType;T[E]=Z}}),new ei({...this._def,shape:()=>T})}keyof(){return Lp(Pt.objectKeys(this.shape))}}ei.create=(b,g)=>new ei({shape:()=>b,unknownKeys:"strip",catchall:Fn.create(),typeName:at.ZodObject,...ht(g)}),ei.strictCreate=(b,g)=>new ei({shape:()=>b,unknownKeys:"strict",catchall:Fn.create(),typeName:at.ZodObject,...ht(g)}),ei.lazycreate=(b,g)=>new ei({shape:b,unknownKeys:"strip",catchall:Fn.create(),typeName:at.ZodObject,...ht(g)});class pl extends mt{_parse(g){const{ctx:T}=this._processInputParams(g),E=this._def.options;function B(Z){for(const c of Z)if(c.result.status==="valid")return c.result;for(const c of Z)if(c.result.status==="dirty")return T.common.issues.push(...c.ctx.common.issues),c.result;const M=Z.map(c=>new hr(c.ctx.common.issues));return Ge(T,{code:Fe.invalid_union,unionErrors:M}),ot}if(T.common.async)return Promise.all(E.map(async Z=>{const M={...T,common:{...T.common,issues:[]},parent:null};return{result:await Z._parseAsync({data:T.data,path:T.path,parent:M}),ctx:M}})).then(B);{let Z;const M=[];for(const Te of E){const ge={...T,common:{...T.common,issues:[]},parent:null},ke=Te._parseSync({data:T.data,path:T.path,parent:ge});if(ke.status==="valid")return ke;ke.status==="dirty"&&!Z&&(Z={result:ke,ctx:ge}),ge.common.issues.length&&M.push(ge.common.issues)}if(Z)return T.common.issues.push(...Z.ctx.common.issues),Z.result;const c=M.map(Te=>new hr(Te));return Ge(T,{code:Fe.invalid_union,unionErrors:c}),ot}}get options(){return this._def.options}}pl.create=(b,g)=>new pl({options:b,typeName:at.ZodUnion,...ht(g)});const Bn=b=>b instanceof gl?Bn(b.schema):b instanceof Zr?Bn(b.innerType()):b instanceof _l?[b.value]:b instanceof xa?b.options:b instanceof yl?Pt.objectValues(b.enum):b instanceof xl?Bn(b._def.innerType):b instanceof hl?[void 0]:b instanceof dl?[null]:b instanceof fn?[void 0,...Bn(b.unwrap())]:b instanceof va?[null,...Bn(b.unwrap())]:b instanceof Fh||b instanceof wl?Bn(b.unwrap()):b instanceof vl?Bn(b._def.innerType):[];class tu extends mt{_parse(g){const{ctx:T}=this._processInputParams(g);if(T.parsedType!==Ke.object)return Ge(T,{code:Fe.invalid_type,expected:Ke.object,received:T.parsedType}),ot;const E=this.discriminator,B=T.data[E],Z=this.optionsMap.get(B);return Z?T.common.async?Z._parseAsync({data:T.data,path:T.path,parent:T}):Z._parseSync({data:T.data,path:T.path,parent:T}):(Ge(T,{code:Fe.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[E]}),ot)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(g,T,E){const B=new Map;for(const Z of T){const M=Bn(Z.shape[g]);if(!M.length)throw new Error(`A discriminator value for key \`${g}\` could not be extracted from all schema options`);for(const c of M){if(B.has(c))throw new Error(`Discriminator property ${String(g)} has duplicate value ${String(c)}`);B.set(c,Z)}}return new tu({typeName:at.ZodDiscriminatedUnion,discriminator:g,options:T,optionsMap:B,...ht(E)})}}function Lh(b,g){const T=Ln(b),E=Ln(g);if(b===g)return{valid:!0,data:b};if(T===Ke.object&&E===Ke.object){const B=Pt.objectKeys(g),Z=Pt.objectKeys(b).filter(c=>B.indexOf(c)!==-1),M={...b,...g};for(const c of Z){const Te=Lh(b[c],g[c]);if(!Te.valid)return{valid:!1};M[c]=Te.data}return{valid:!0,data:M}}else if(T===Ke.array&&E===Ke.array){if(b.length!==g.length)return{valid:!1};const B=[];for(let Z=0;Z<b.length;Z++){const M=b[Z],c=g[Z],Te=Lh(M,c);if(!Te.valid)return{valid:!1};B.push(Te.data)}return{valid:!0,data:B}}else return T===Ke.date&&E===Ke.date&&+b==+g?{valid:!0,data:b}:{valid:!1}}class fl extends mt{_parse(g){const{status:T,ctx:E}=this._processInputParams(g),B=(Z,M)=>{if(Ah(Z)||Ah(M))return ot;const c=Lh(Z.value,M.value);return c.valid?((Rh(Z)||Rh(M))&&T.dirty(),{status:T.value,value:c.data}):(Ge(E,{code:Fe.invalid_intersection_types}),ot)};return E.common.async?Promise.all([this._def.left._parseAsync({data:E.data,path:E.path,parent:E}),this._def.right._parseAsync({data:E.data,path:E.path,parent:E})]).then(([Z,M])=>B(Z,M)):B(this._def.left._parseSync({data:E.data,path:E.path,parent:E}),this._def.right._parseSync({data:E.data,path:E.path,parent:E}))}}fl.create=(b,g,T)=>new fl({left:b,right:g,typeName:at.ZodIntersection,...ht(T)});class pn extends mt{_parse(g){const{status:T,ctx:E}=this._processInputParams(g);if(E.parsedType!==Ke.array)return Ge(E,{code:Fe.invalid_type,expected:Ke.array,received:E.parsedType}),ot;if(E.data.length<this._def.items.length)return Ge(E,{code:Fe.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),ot;!this._def.rest&&E.data.length>this._def.items.length&&(Ge(E,{code:Fe.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),T.dirty());const Z=[...E.data].map((M,c)=>{const Te=this._def.items[c]||this._def.rest;return Te?Te._parse(new dn(E,M,E.path,c)):null}).filter(M=>!!M);return E.common.async?Promise.all(Z).then(M=>Oi.mergeArray(T,M)):Oi.mergeArray(T,Z)}get items(){return this._def.items}rest(g){return new pn({...this._def,rest:g})}}pn.create=(b,g)=>{if(!Array.isArray(b))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new pn({items:b,typeName:at.ZodTuple,rest:null,...ht(g)})};class ml extends mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:T,ctx:E}=this._processInputParams(g);if(E.parsedType!==Ke.object)return Ge(E,{code:Fe.invalid_type,expected:Ke.object,received:E.parsedType}),ot;const B=[],Z=this._def.keyType,M=this._def.valueType;for(const c in E.data)B.push({key:Z._parse(new dn(E,c,E.path,c)),value:M._parse(new dn(E,E.data[c],E.path,c)),alwaysSet:c in E.data});return E.common.async?Oi.mergeObjectAsync(T,B):Oi.mergeObjectSync(T,B)}get element(){return this._def.valueType}static create(g,T,E){return T instanceof mt?new ml({keyType:g,valueType:T,typeName:at.ZodRecord,...ht(E)}):new ml({keyType:jr.create(),valueType:g,typeName:at.ZodRecord,...ht(T)})}}class iu extends mt{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(g){const{status:T,ctx:E}=this._processInputParams(g);if(E.parsedType!==Ke.map)return Ge(E,{code:Fe.invalid_type,expected:Ke.map,received:E.parsedType}),ot;const B=this._def.keyType,Z=this._def.valueType,M=[...E.data.entries()].map(([c,Te],ge)=>({key:B._parse(new dn(E,c,E.path,[ge,"key"])),value:Z._parse(new dn(E,Te,E.path,[ge,"value"]))}));if(E.common.async){const c=new Map;return Promise.resolve().then(async()=>{for(const Te of M){const ge=await Te.key,ke=await Te.value;if(ge.status==="aborted"||ke.status==="aborted")return ot;(ge.status==="dirty"||ke.status==="dirty")&&T.dirty(),c.set(ge.value,ke.value)}return{status:T.value,value:c}})}else{const c=new Map;for(const Te of M){const ge=Te.key,ke=Te.value;if(ge.status==="aborted"||ke.status==="aborted")return ot;(ge.status==="dirty"||ke.status==="dirty")&&T.dirty(),c.set(ge.value,ke.value)}return{status:T.value,value:c}}}}iu.create=(b,g,T)=>new iu({valueType:g,keyType:b,typeName:at.ZodMap,...ht(T)});class fs extends mt{_parse(g){const{status:T,ctx:E}=this._processInputParams(g);if(E.parsedType!==Ke.set)return Ge(E,{code:Fe.invalid_type,expected:Ke.set,received:E.parsedType}),ot;const B=this._def;B.minSize!==null&&E.data.size<B.minSize.value&&(Ge(E,{code:Fe.too_small,minimum:B.minSize.value,type:"set",inclusive:!0,exact:!1,message:B.minSize.message}),T.dirty()),B.maxSize!==null&&E.data.size>B.maxSize.value&&(Ge(E,{code:Fe.too_big,maximum:B.maxSize.value,type:"set",inclusive:!0,exact:!1,message:B.maxSize.message}),T.dirty());const Z=this._def.valueType;function M(Te){const ge=new Set;for(const ke of Te){if(ke.status==="aborted")return ot;ke.status==="dirty"&&T.dirty(),ge.add(ke.value)}return{status:T.value,value:ge}}const c=[...E.data.values()].map((Te,ge)=>Z._parse(new dn(E,Te,E.path,ge)));return E.common.async?Promise.all(c).then(Te=>M(Te)):M(c)}min(g,T){return new fs({...this._def,minSize:{value:g,message:et.toString(T)}})}max(g,T){return new fs({...this._def,maxSize:{value:g,message:et.toString(T)}})}size(g,T){return this.min(g,T).max(g,T)}nonempty(g){return this.min(1,g)}}fs.create=(b,g)=>new fs({valueType:b,minSize:null,maxSize:null,typeName:at.ZodSet,...ht(g)});class ao extends mt{constructor(){super(...arguments),this.validate=this.implement}_parse(g){const{ctx:T}=this._processInputParams(g);if(T.parsedType!==Ke.function)return Ge(T,{code:Fe.invalid_type,expected:Ke.function,received:T.parsedType}),ot;function E(c,Te){return Yc({data:c,path:T.path,errorMaps:[T.common.contextualErrorMap,T.schemaErrorMap,Xc(),to].filter(ge=>!!ge),issueData:{code:Fe.invalid_arguments,argumentsError:Te}})}function B(c,Te){return Yc({data:c,path:T.path,errorMaps:[T.common.contextualErrorMap,T.schemaErrorMap,Xc(),to].filter(ge=>!!ge),issueData:{code:Fe.invalid_return_type,returnTypeError:Te}})}const Z={errorMap:T.common.contextualErrorMap},M=T.data;if(this._def.returns instanceof so){const c=this;return Ki(async function(...Te){const ge=new hr([]),ke=await c._def.args.parseAsync(Te,Z).catch(le=>{throw ge.addIssue(E(Te,le)),ge}),Ue=await Reflect.apply(M,this,ke);return await c._def.returns._def.type.parseAsync(Ue,Z).catch(le=>{throw ge.addIssue(B(Ue,le)),ge})})}else{const c=this;return Ki(function(...Te){const ge=c._def.args.safeParse(Te,Z);if(!ge.success)throw new hr([E(Te,ge.error)]);const ke=Reflect.apply(M,this,ge.data),Ue=c._def.returns.safeParse(ke,Z);if(!Ue.success)throw new hr([B(ke,Ue.error)]);return Ue.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...g){return new ao({...this._def,args:pn.create(g).rest(ps.create())})}returns(g){return new ao({...this._def,returns:g})}implement(g){return this.parse(g)}strictImplement(g){return this.parse(g)}static create(g,T,E){return new ao({args:g||pn.create([]).rest(ps.create()),returns:T||ps.create(),typeName:at.ZodFunction,...ht(E)})}}class gl extends mt{get schema(){return this._def.getter()}_parse(g){const{ctx:T}=this._processInputParams(g);return this._def.getter()._parse({data:T.data,path:T.path,parent:T})}}gl.create=(b,g)=>new gl({getter:b,typeName:at.ZodLazy,...ht(g)});class _l extends mt{_parse(g){if(g.data!==this._def.value){const T=this._getOrReturnCtx(g);return Ge(T,{received:T.data,code:Fe.invalid_literal,expected:this._def.value}),ot}return{status:"valid",value:g.data}}get value(){return this._def.value}}_l.create=(b,g)=>new _l({value:b,typeName:at.ZodLiteral,...ht(g)});function Lp(b,g){return new xa({values:b,typeName:at.ZodEnum,...ht(g)})}class xa extends mt{constructor(){super(...arguments),ll.set(this,void 0)}_parse(g){if(typeof g.data!="string"){const T=this._getOrReturnCtx(g),E=this._def.values;return Ge(T,{expected:Pt.joinValues(E),received:T.parsedType,code:Fe.invalid_type}),ot}if(Jc(this,ll)||zp(this,ll,new Set(this._def.values)),!Jc(this,ll).has(g.data)){const T=this._getOrReturnCtx(g),E=this._def.values;return Ge(T,{received:T.data,code:Fe.invalid_enum_value,options:E}),ot}return Ki(g.data)}get options(){return this._def.values}get enum(){const g={};for(const T of this._def.values)g[T]=T;return g}get Values(){const g={};for(const T of this._def.values)g[T]=T;return g}get Enum(){const g={};for(const T of this._def.values)g[T]=T;return g}extract(g,T=this._def){return xa.create(g,{...this._def,...T})}exclude(g,T=this._def){return xa.create(this.options.filter(E=>!g.includes(E)),{...this._def,...T})}}ll=new WeakMap,xa.create=Lp;class yl extends mt{constructor(){super(...arguments),cl.set(this,void 0)}_parse(g){const T=Pt.getValidEnumValues(this._def.values),E=this._getOrReturnCtx(g);if(E.parsedType!==Ke.string&&E.parsedType!==Ke.number){const B=Pt.objectValues(T);return Ge(E,{expected:Pt.joinValues(B),received:E.parsedType,code:Fe.invalid_type}),ot}if(Jc(this,cl)||zp(this,cl,new Set(Pt.getValidEnumValues(this._def.values))),!Jc(this,cl).has(g.data)){const B=Pt.objectValues(T);return Ge(E,{received:E.data,code:Fe.invalid_enum_value,options:B}),ot}return Ki(g.data)}get enum(){return this._def.values}}cl=new WeakMap,yl.create=(b,g)=>new yl({values:b,typeName:at.ZodNativeEnum,...ht(g)});class so extends mt{unwrap(){return this._def.type}_parse(g){const{ctx:T}=this._processInputParams(g);if(T.parsedType!==Ke.promise&&T.common.async===!1)return Ge(T,{code:Fe.invalid_type,expected:Ke.promise,received:T.parsedType}),ot;const E=T.parsedType===Ke.promise?T.data:Promise.resolve(T.data);return Ki(E.then(B=>this._def.type.parseAsync(B,{path:T.path,errorMap:T.common.contextualErrorMap})))}}so.create=(b,g)=>new so({type:b,typeName:at.ZodPromise,...ht(g)});class Zr extends mt{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===at.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(g){const{status:T,ctx:E}=this._processInputParams(g),B=this._def.effect||null,Z={addIssue:M=>{Ge(E,M),M.fatal?T.abort():T.dirty()},get path(){return E.path}};if(Z.addIssue=Z.addIssue.bind(Z),B.type==="preprocess"){const M=B.transform(E.data,Z);if(E.common.async)return Promise.resolve(M).then(async c=>{if(T.value==="aborted")return ot;const Te=await this._def.schema._parseAsync({data:c,path:E.path,parent:E});return Te.status==="aborted"?ot:Te.status==="dirty"||T.value==="dirty"?io(Te.value):Te});{if(T.value==="aborted")return ot;const c=this._def.schema._parseSync({data:M,path:E.path,parent:E});return c.status==="aborted"?ot:c.status==="dirty"||T.value==="dirty"?io(c.value):c}}if(B.type==="refinement"){const M=c=>{const Te=B.refinement(c,Z);if(E.common.async)return Promise.resolve(Te);if(Te instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return c};if(E.common.async===!1){const c=this._def.schema._parseSync({data:E.data,path:E.path,parent:E});return c.status==="aborted"?ot:(c.status==="dirty"&&T.dirty(),M(c.value),{status:T.value,value:c.value})}else return this._def.schema._parseAsync({data:E.data,path:E.path,parent:E}).then(c=>c.status==="aborted"?ot:(c.status==="dirty"&&T.dirty(),M(c.value).then(()=>({status:T.value,value:c.value}))))}if(B.type==="transform")if(E.common.async===!1){const M=this._def.schema._parseSync({data:E.data,path:E.path,parent:E});if(!hs(M))return M;const c=B.transform(M.value,Z);if(c instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:T.value,value:c}}else return this._def.schema._parseAsync({data:E.data,path:E.path,parent:E}).then(M=>hs(M)?Promise.resolve(B.transform(M.value,Z)).then(c=>({status:T.value,value:c})):M);Pt.assertNever(B)}}Zr.create=(b,g,T)=>new Zr({schema:b,typeName:at.ZodEffects,effect:g,...ht(T)}),Zr.createWithPreprocess=(b,g,T)=>new Zr({schema:g,effect:{type:"preprocess",transform:b},typeName:at.ZodEffects,...ht(T)});class fn extends mt{_parse(g){return this._getType(g)===Ke.undefined?Ki(void 0):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}fn.create=(b,g)=>new fn({innerType:b,typeName:at.ZodOptional,...ht(g)});class va extends mt{_parse(g){return this._getType(g)===Ke.null?Ki(null):this._def.innerType._parse(g)}unwrap(){return this._def.innerType}}va.create=(b,g)=>new va({innerType:b,typeName:at.ZodNullable,...ht(g)});class xl extends mt{_parse(g){const{ctx:T}=this._processInputParams(g);let E=T.data;return T.parsedType===Ke.undefined&&(E=this._def.defaultValue()),this._def.innerType._parse({data:E,path:T.path,parent:T})}removeDefault(){return this._def.innerType}}xl.create=(b,g)=>new xl({innerType:b,typeName:at.ZodDefault,defaultValue:typeof g.default=="function"?g.default:()=>g.default,...ht(g)});class vl extends mt{_parse(g){const{ctx:T}=this._processInputParams(g),E={...T,common:{...T.common,issues:[]}},B=this._def.innerType._parse({data:E.data,path:E.path,parent:{...E}});return ol(B)?B.then(Z=>({status:"valid",value:Z.status==="valid"?Z.value:this._def.catchValue({get error(){return new hr(E.common.issues)},input:E.data})})):{status:"valid",value:B.status==="valid"?B.value:this._def.catchValue({get error(){return new hr(E.common.issues)},input:E.data})}}removeCatch(){return this._def.innerType}}vl.create=(b,g)=>new vl({innerType:b,typeName:at.ZodCatch,catchValue:typeof g.catch=="function"?g.catch:()=>g.catch,...ht(g)});class ru extends mt{_parse(g){if(this._getType(g)!==Ke.nan){const E=this._getOrReturnCtx(g);return Ge(E,{code:Fe.invalid_type,expected:Ke.nan,received:E.parsedType}),ot}return{status:"valid",value:g.data}}}ru.create=b=>new ru({typeName:at.ZodNaN,...ht(b)});const m_=Symbol("zod_brand");class Fh extends mt{_parse(g){const{ctx:T}=this._processInputParams(g),E=T.data;return this._def.type._parse({data:E,path:T.path,parent:T})}unwrap(){return this._def.type}}class bl extends mt{_parse(g){const{status:T,ctx:E}=this._processInputParams(g);if(E.common.async)return(async()=>{const Z=await this._def.in._parseAsync({data:E.data,path:E.path,parent:E});return Z.status==="aborted"?ot:Z.status==="dirty"?(T.dirty(),io(Z.value)):this._def.out._parseAsync({data:Z.value,path:E.path,parent:E})})();{const B=this._def.in._parseSync({data:E.data,path:E.path,parent:E});return B.status==="aborted"?ot:B.status==="dirty"?(T.dirty(),{status:"dirty",value:B.value}):this._def.out._parseSync({data:B.value,path:E.path,parent:E})}}static create(g,T){return new bl({in:g,out:T,typeName:at.ZodPipeline})}}class wl extends mt{_parse(g){const T=this._def.innerType._parse(g),E=B=>(hs(B)&&(B.value=Object.freeze(B.value)),B);return ol(T)?T.then(B=>E(B)):E(T)}unwrap(){return this._def.innerType}}wl.create=(b,g)=>new wl({innerType:b,typeName:at.ZodReadonly,...ht(g)});function Fp(b,g){const T=typeof b=="function"?b(g):typeof b=="string"?{message:b}:b;return typeof T=="string"?{message:T}:T}function Bp(b,g={},T){return b?ro.create().superRefine((E,B)=>{var Z,M;const c=b(E);if(c instanceof Promise)return c.then(Te=>{var ge,ke;if(!Te){const Ue=Fp(g,E),Ae=(ke=(ge=Ue.fatal)!==null&&ge!==void 0?ge:T)!==null&&ke!==void 0?ke:!0;B.addIssue({code:"custom",...Ue,fatal:Ae})}});if(!c){const Te=Fp(g,E),ge=(M=(Z=Te.fatal)!==null&&Z!==void 0?Z:T)!==null&&M!==void 0?M:!0;B.addIssue({code:"custom",...Te,fatal:ge})}}):ro.create()}const g_={object:ei.lazycreate};var at;(function(b){b.ZodString="ZodString",b.ZodNumber="ZodNumber",b.ZodNaN="ZodNaN",b.ZodBigInt="ZodBigInt",b.ZodBoolean="ZodBoolean",b.ZodDate="ZodDate",b.ZodSymbol="ZodSymbol",b.ZodUndefined="ZodUndefined",b.ZodNull="ZodNull",b.ZodAny="ZodAny",b.ZodUnknown="ZodUnknown",b.ZodNever="ZodNever",b.ZodVoid="ZodVoid",b.ZodArray="ZodArray",b.ZodObject="ZodObject",b.ZodUnion="ZodUnion",b.ZodDiscriminatedUnion="ZodDiscriminatedUnion",b.ZodIntersection="ZodIntersection",b.ZodTuple="ZodTuple",b.ZodRecord="ZodRecord",b.ZodMap="ZodMap",b.ZodSet="ZodSet",b.ZodFunction="ZodFunction",b.ZodLazy="ZodLazy",b.ZodLiteral="ZodLiteral",b.ZodEnum="ZodEnum",b.ZodEffects="ZodEffects",b.ZodNativeEnum="ZodNativeEnum",b.ZodOptional="ZodOptional",b.ZodNullable="ZodNullable",b.ZodDefault="ZodDefault",b.ZodCatch="ZodCatch",b.ZodPromise="ZodPromise",b.ZodBranded="ZodBranded",b.ZodPipeline="ZodPipeline",b.ZodReadonly="ZodReadonly"})(at||(at={}));const __=(b,g={message:`Input not instance of ${b.name}`})=>Bp(T=>T instanceof b,g),Op=jr.create,jp=_a.create,y_=ru.create,x_=ya.create,Np=ul.create,v_=ds.create,b_=Qc.create,w_=hl.create,T_=dl.create,P_=ro.create,S_=ps.create,M_=Fn.create,I_=eu.create,C_=Nr.create,E_=ei.create,z_=ei.strictCreate,k_=pl.create,A_=tu.create,R_=fl.create,D_=pn.create,L_=ml.create,F_=iu.create,B_=fs.create,O_=ao.create,j_=gl.create,N_=_l.create,Z_=xa.create,V_=yl.create,U_=so.create,Zp=Zr.create,$_=fn.create,G_=va.create,q_=Zr.createWithPreprocess,W_=bl.create;var On=Object.freeze({__proto__:null,defaultErrorMap:to,setErrorMap:qg,getErrorMap:Xc,makeIssue:Yc,EMPTY_PATH:Wg,addIssueToContext:Ge,ParseStatus:Oi,INVALID:ot,DIRTY:io,OK:Ki,isAborted:Ah,isDirty:Rh,isValid:hs,isAsync:ol,get util(){return Pt},get objectUtil(){return kh},ZodParsedType:Ke,getParsedType:Ln,ZodType:mt,datetimeRegex:Dp,ZodString:jr,ZodNumber:_a,ZodBigInt:ya,ZodBoolean:ul,ZodDate:ds,ZodSymbol:Qc,ZodUndefined:hl,ZodNull:dl,ZodAny:ro,ZodUnknown:ps,ZodNever:Fn,ZodVoid:eu,ZodArray:Nr,ZodObject:ei,ZodUnion:pl,ZodDiscriminatedUnion:tu,ZodIntersection:fl,ZodTuple:pn,ZodRecord:ml,ZodMap:iu,ZodSet:fs,ZodFunction:ao,ZodLazy:gl,ZodLiteral:_l,ZodEnum:xa,ZodNativeEnum:yl,ZodPromise:so,ZodEffects:Zr,ZodTransformer:Zr,ZodOptional:fn,ZodNullable:va,ZodDefault:xl,ZodCatch:vl,ZodNaN:ru,BRAND:m_,ZodBranded:Fh,ZodPipeline:bl,ZodReadonly:wl,custom:Bp,Schema:mt,ZodSchema:mt,late:g_,get ZodFirstPartyTypeKind(){return at},coerce:{string:b=>jr.create({...b,coerce:!0}),number:b=>_a.create({...b,coerce:!0}),boolean:b=>ul.create({...b,coerce:!0}),bigint:b=>ya.create({...b,coerce:!0}),date:b=>ds.create({...b,coerce:!0})},any:P_,array:C_,bigint:x_,boolean:Np,date:v_,discriminatedUnion:A_,effect:Zp,enum:Z_,function:O_,instanceof:__,intersection:R_,lazy:j_,literal:N_,map:F_,nan:y_,nativeEnum:V_,never:M_,null:T_,nullable:G_,number:jp,object:E_,oboolean:()=>Np().optional(),onumber:()=>jp().optional(),optional:$_,ostring:()=>Op().optional(),pipeline:W_,preprocess:q_,promise:U_,record:L_,set:B_,strictObject:z_,string:Op,symbol:b_,transformer:Zp,tuple:D_,undefined:w_,union:k_,unknown:S_,void:I_,NEVER:ot,ZodIssueCode:Fe,quotelessJson:Gg,ZodError:hr});const H_=On.object({container:On.string(),position:On.object({center:On.object({lat:On.number(),lng:On.number()}),zoom:On.number()}),theme:On.literal("dark").or(On.literal("light"))}),K_=512,X_=0,Y_=18;function J_(b){return b&&b.__esModule&&Object.prototype.hasOwnProperty.call(b,"default")?b.default:b}var nu={exports:{}};/**
2
- * MapLibre GL JS
3
- * @license 3-Clause BSD. Full text of license: https://github.com/maplibre/maplibre-gl-js/blob/v5.3.0/LICENSE.txt
4
- */var Q_=nu.exports,Vp;function ey(){return Vp||(Vp=1,function(b,g){(function(T,E){b.exports=E()})(Q_,function(){var T={},E={};function B(M,c,Te){if(E[M]=Te,M==="index"){var ge="var sharedModule = {}; ("+E.shared+")(sharedModule); ("+E.worker+")(sharedModule);",ke={};return E.shared(ke),E.index(T,ke),typeof window<"u"&&T.setWorkerUrl(window.URL.createObjectURL(new Blob([ge],{type:"text/javascript"}))),T}}B("shared",["exports"],function(M){function c(r,t,n,a){return new(n||(n=Promise))(function(l,d){function p(v){try{y(a.next(v))}catch(P){d(P)}}function m(v){try{y(a.throw(v))}catch(P){d(P)}}function y(v){var P;v.done?l(v.value):(P=v.value,P instanceof n?P:new n(function(S){S(P)})).then(p,m)}y((a=a.apply(r,t||[])).next())})}function Te(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var ge,ke;function Ue(){if(ke)return ge;function r(t,n){this.x=t,this.y=n}return ke=1,ge=r,r.prototype={clone:function(){return new r(this.x,this.y)},add:function(t){return this.clone()._add(t)},sub:function(t){return this.clone()._sub(t)},multByPoint:function(t){return this.clone()._multByPoint(t)},divByPoint:function(t){return this.clone()._divByPoint(t)},mult:function(t){return this.clone()._mult(t)},div:function(t){return this.clone()._div(t)},rotate:function(t){return this.clone()._rotate(t)},rotateAround:function(t,n){return this.clone()._rotateAround(t,n)},matMult:function(t){return this.clone()._matMult(t)},unit:function(){return this.clone()._unit()},perp:function(){return this.clone()._perp()},round:function(){return this.clone()._round()},mag:function(){return Math.sqrt(this.x*this.x+this.y*this.y)},equals:function(t){return this.x===t.x&&this.y===t.y},dist:function(t){return Math.sqrt(this.distSqr(t))},distSqr:function(t){var n=t.x-this.x,a=t.y-this.y;return n*n+a*a},angle:function(){return Math.atan2(this.y,this.x)},angleTo:function(t){return Math.atan2(this.y-t.y,this.x-t.x)},angleWith:function(t){return this.angleWithSep(t.x,t.y)},angleWithSep:function(t,n){return Math.atan2(this.x*n-this.y*t,this.x*t+this.y*n)},_matMult:function(t){var n=t[2]*this.x+t[3]*this.y;return this.x=t[0]*this.x+t[1]*this.y,this.y=n,this},_add:function(t){return this.x+=t.x,this.y+=t.y,this},_sub:function(t){return this.x-=t.x,this.y-=t.y,this},_mult:function(t){return this.x*=t,this.y*=t,this},_div:function(t){return this.x/=t,this.y/=t,this},_multByPoint:function(t){return this.x*=t.x,this.y*=t.y,this},_divByPoint:function(t){return this.x/=t.x,this.y/=t.y,this},_unit:function(){return this._div(this.mag()),this},_perp:function(){var t=this.y;return this.y=this.x,this.x=-t,this},_rotate:function(t){var n=Math.cos(t),a=Math.sin(t),l=a*this.x+n*this.y;return this.x=n*this.x-a*this.y,this.y=l,this},_rotateAround:function(t,n){var a=Math.cos(t),l=Math.sin(t),d=n.y+l*(this.x-n.x)+a*(this.y-n.y);return this.x=n.x+a*(this.x-n.x)-l*(this.y-n.y),this.y=d,this},_round:function(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}},r.convert=function(t){return t instanceof r?t:Array.isArray(t)?new r(t[0],t[1]):t},ge}typeof SuppressedError=="function"&&SuppressedError;var Ae,le,Ze=Te(Ue()),Xt=function(){if(le)return Ae;function r(t,n,a,l){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(l-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=a,this.p2y=l}return le=1,Ae=r,r.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,n){if(n===void 0&&(n=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,l=0;l<8;l++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<n)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,l=0;l<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<n));l++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}},Ae}(),xi=Te(Xt);let ji,Mi;function Ri(){return ji==null&&(ji=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")&&typeof createImageBitmap=="function"),ji}function ri(){if(Mi==null&&(Mi=!1,Ri())){const t=new OffscreenCanvas(5,5).getContext("2d",{willReadFrequently:!0});if(t){for(let a=0;a<5*5;a++){const l=4*a;t.fillStyle=`rgb(${l},${l+1},${l+2})`,t.fillRect(a%5,Math.floor(a/5),1,1)}const n=t.getImageData(0,0,5,5).data;for(let a=0;a<5*5*4;a++)if(a%4!=3&&n[a]!==a){Mi=!0;break}}}return Mi||!1}var dr,Rt=1e-6,kt=typeof Float32Array<"u"?Float32Array:Array;function Zt(){var r=new kt(9);return kt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[5]=0,r[6]=0,r[7]=0),r[0]=1,r[4]=1,r[8]=1,r}function Vr(r){return r[0]=1,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=1,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=1,r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r}function ba(){var r=new kt(3);return kt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r}function wt(r,t,n){var a=new kt(3);return a[0]=r,a[1]=t,a[2]=n,a}function Ur(r,t,n){var a=t[0],l=t[1],d=t[2],p=t[3];return r[0]=n[0]*a+n[4]*l+n[8]*d+n[12]*p,r[1]=n[1]*a+n[5]*l+n[9]*d+n[13]*p,r[2]=n[2]*a+n[6]*l+n[10]*d+n[14]*p,r[3]=n[3]*a+n[7]*l+n[11]*d+n[15]*p,r}function rr(){var r=new kt(4);return kt!=Float32Array&&(r[0]=0,r[1]=0,r[2]=0),r[3]=1,r}function Ii(){var r=new kt(2);return kt!=Float32Array&&(r[0]=0,r[1]=0),r}function ms(r,t){var n=new kt(2);return n[0]=r,n[1]=t,n}Math.hypot||(Math.hypot=function(){for(var r=0,t=arguments.length;t--;)r+=arguments[t]*arguments[t];return Math.sqrt(r)}),ba(),dr=new kt(4),kt!=Float32Array&&(dr[0]=0,dr[1]=0,dr[2]=0,dr[3]=0),ba(),wt(1,0,0),wt(0,1,0),rr(),rr(),Zt(),Ii();const St=8192;function wa(r,t,n){return t*(St/(r.tileSize*Math.pow(2,n-r.tileID.overscaledZ)))}function mn(r,t){return(r%t+t)%t}function jn(r,t,n){return r*(1-n)+t*n}function Nn(r){if(r<=0)return 0;if(r>=1)return 1;const t=r*r,n=t*r;return 4*(r<.5?n:3*(r-t)+n-.75)}function Ta(r,t,n,a){const l=new xi(r,t,n,a);return d=>l.solve(d)}const Cr=Ta(.25,.1,.25,1);function pr(r,t,n){return Math.min(n,Math.max(t,r))}function nr(r,t,n){const a=n-t,l=((r-t)%a+a)%a+t;return l===t?n:l}function vi(r,...t){for(const n of t)for(const a in n)r[a]=n[a];return r}let Zn=1;function Vn(r,t,n){const a={};for(const l in r)a[l]=t.call(this,r[l],l,r);return a}function Un(r,t,n){const a={};for(const l in r)t.call(this,r[l],l,r)&&(a[l]=r[l]);return a}function Xi(r){return Array.isArray(r)?r.map(Xi):typeof r=="object"&&r?Vn(r,Xi):r}const gs={};function Ci(r){gs[r]||(typeof console<"u"&&console.warn(r),gs[r]=!0)}function oi(r,t,n){return(n.y-r.y)*(t.x-r.x)>(t.y-r.y)*(n.x-r.x)}function $r(r){return typeof WorkerGlobalScope<"u"&&r!==void 0&&r instanceof WorkerGlobalScope}let Yt=null;function $n(r){return typeof ImageBitmap<"u"&&r instanceof ImageBitmap}const Gn="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQYV2NgAAIAAAUAAarVyFEAAAAASUVORK5CYII=";function fr(r,t,n,a,l){return c(this,void 0,void 0,function*(){if(typeof VideoFrame>"u")throw new Error("VideoFrame not supported");const d=new VideoFrame(r,{timestamp:0});try{const p=d==null?void 0:d.format;if(!p||!p.startsWith("BGR")&&!p.startsWith("RGB"))throw new Error(`Unrecognized format ${p}`);const m=p.startsWith("BGR"),y=new Uint8ClampedArray(a*l*4);if(yield d.copyTo(y,function(v,P,S,k,R){const L=4*Math.max(1,0),O=(Math.max(0,S)-S)*k*4+L,$=4*k,H=Math.max(0,P),re=Math.max(0,S);return{rect:{x:H,y:re,width:Math.min(v.width,P+k)-H,height:Math.min(v.height,S+R)-re},layout:[{offset:O,stride:$}]}}(r,t,n,a,l)),m)for(let v=0;v<y.length;v+=4){const P=y[v];y[v]=y[v+2],y[v+2]=P}return y}finally{d.close()}})}let gn,_n;function mr(r,t,n,a){return r.addEventListener(t,n,a),{unsubscribe:()=>{r.removeEventListener(t,n,a)}}}function gr(r){return r/Math.PI*180}const Pa={touchstart:!0,touchmove:!0,touchmoveWindow:!0,touchend:!0,touchcancel:!0},Sa={dblclick:!0,click:!0,mouseover:!0,mouseout:!0,mousedown:!0,mousemove:!0,mousemoveWindow:!0,mouseup:!0,mouseupWindow:!0,contextmenu:!0,wheel:!0},_s="AbortError";function qn(){return new Error(_s)}const yn={MAX_PARALLEL_IMAGE_REQUESTS:16,MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:8,MAX_TILE_CACHE_ZOOM_LEVELS:5,REGISTERED_PROTOCOLS:{},WORKER_URL:""};function Ma(r){return yn.REGISTERED_PROTOCOLS[r.substring(0,r.indexOf("://"))]}const Gr="global-dispatcher";class Er extends Error{constructor(t,n,a,l){super(`AJAXError: ${n} (${t}): ${a}`),this.status=t,this.statusText=n,this.url=a,this.body=l}}const qr=()=>$r(self)?self.worker&&self.worker.referrer:(window.location.protocol==="blob:"?window.parent:window).location.href,Ia=function(r,t){if(/:\/\//.test(r.url)&&!/^https?:|^file:/.test(r.url)){const a=Ma(r.url);if(a)return a(r,t);if($r(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,targetMapId:Gr},t)}if(!(/^file:/.test(n=r.url)||/^file:/.test(qr())&&!/^\w+:/.test(n))){if(fetch&&Request&&AbortController&&Object.prototype.hasOwnProperty.call(Request.prototype,"signal"))return function(a,l){return c(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:qr(),signal:l.signal});let p,m;a.type!=="json"||d.headers.has("Accept")||d.headers.set("Accept","application/json");try{p=yield fetch(d)}catch(v){throw new Er(0,v.message,a.url,new Blob)}if(!p.ok){const v=yield p.blob();throw new Er(p.status,p.statusText,a.url,v)}m=a.type==="arrayBuffer"||a.type==="image"?p.arrayBuffer():a.type==="json"?p.json():p.text();const y=yield m;if(l.signal.aborted)throw qn();return{data:y,cacheControl:p.headers.get("Cache-Control"),expires:p.headers.get("Expires")}})}(r,t);if($r(self)&&self.worker&&self.worker.actor)return self.worker.actor.sendAsync({type:"GR",data:r,mustQueue:!0,targetMapId:Gr},t)}var n;return function(a,l){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 v in a.headers)y.setRequestHeader(v,a.headers[v]);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(!l.signal.aborted)if((y.status>=200&&y.status<300||y.status===0)&&y.response!==null){let v=y.response;if(a.type==="json")try{v=JSON.parse(y.response)}catch(P){return void p(P)}d({data:v,cacheControl:y.getResponseHeader("Cache-Control"),expires:y.getResponseHeader("Expires")})}else{const v=new Blob([y.response],{type:y.getResponseHeader("Content-Type")});p(new Er(y.status,y.statusText,a.url,v))}},l.signal.addEventListener("abort",()=>{y.abort(),p(qn())}),y.send(a.body)})}(r,t)};function ys(r){if(!r||r.indexOf("://")<=0||r.indexOf("data:image/")===0||r.indexOf("blob:")===0)return!0;const t=new URL(r),n=window.location;return t.protocol===n.protocol&&t.host===n.host}function oo(r,t,n){n[r]&&n[r].indexOf(t)!==-1||(n[r]=n[r]||[],n[r].push(t))}function Wr(r,t,n){if(n&&n[r]){const a=n[r].indexOf(t);a!==-1&&n[r].splice(a,1)}}class ce{constructor(t,n={}){vi(this,n),this.type=t}}class j extends ce{constructor(t,n={}){super("error",vi({error:t},n))}}class V{on(t,n){return this._listeners=this._listeners||{},oo(t,n,this._listeners),{unsubscribe:()=>{this.off(t,n)}}}off(t,n){return Wr(t,n,this._listeners),Wr(t,n,this._oneTimeListeners),this}once(t,n){return n?(this._oneTimeListeners=this._oneTimeListeners||{},oo(t,n,this._oneTimeListeners),this):new Promise(a=>this.once(t,a))}fire(t,n){typeof t=="string"&&(t=new ce(t,n||{}));const a=t.type;if(this.listens(a)){t.target=this;const l=this._listeners&&this._listeners[a]?this._listeners[a].slice():[];for(const m of l)m.call(this,t);const d=this._oneTimeListeners&&this._oneTimeListeners[a]?this._oneTimeListeners[a].slice():[];for(const m of d)Wr(a,m,this._oneTimeListeners),m.call(this,t);const p=this._eventedParent;p&&(vi(t,typeof this._eventedParentData=="function"?this._eventedParentData():this._eventedParentData),p.fire(t))}else t instanceof j&&console.error(t.error);return this}listens(t){return this._listeners&&this._listeners[t]&&this._listeners[t].length>0||this._oneTimeListeners&&this._oneTimeListeners[t]&&this._oneTimeListeners[t].length>0||this._eventedParent&&this._eventedParent.listens(t)}setEventedParent(t,n){return this._eventedParent=t,this._eventedParentData=n,this}}var D={$version:8,$root:{version:{required:!0,type:"enum",values:[8]},name:{type:"string"},metadata:{type:"*"},center:{type:"array",value:"number"},centerAltitude:{type:"number"},zoom:{type:"number"},bearing:{type:"number",default:0,period:360,units:"degrees"},pitch:{type:"number",default:0,units:"degrees"},roll:{type:"number",default:0,units:"degrees"},light:{type:"light"},sky:{type:"sky"},projection:{type:"projection"},terrain:{type:"terrain"},sources:{required:!0,type:"sources"},sprite:{type:"sprite"},glyphs:{type:"string"},transition:{type:"transition"},layers:{required:!0,type:"array",value:"layer"}},sources:{"*":{type:"source"}},source:["source_vector","source_raster","source_raster_dem","source_geojson","source_video","source_image"],source_vector:{type:{required:!0,type:"enum",values:{vector:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},attribution:{type:"string"},promoteId:{type:"promoteId"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster:{type:{required:!0,type:"enum",values:{raster:{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},scheme:{type:"enum",values:{xyz:{},tms:{}},default:"xyz"},attribution:{type:"string"},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_raster_dem:{type:{required:!0,type:"enum",values:{"raster-dem":{}}},url:{type:"string"},tiles:{type:"array",value:"string"},bounds:{type:"array",value:"number",length:4,default:[-180,-85.051129,180,85.051129]},minzoom:{type:"number",default:0},maxzoom:{type:"number",default:22},tileSize:{type:"number",default:512,units:"pixels"},attribution:{type:"string"},encoding:{type:"enum",values:{terrarium:{},mapbox:{},custom:{}},default:"mapbox"},redFactor:{type:"number",default:1},blueFactor:{type:"number",default:1},greenFactor:{type:"number",default:1},baseShift:{type:"number",default:0},volatile:{type:"boolean",default:!1},"*":{type:"*"}},source_geojson:{type:{required:!0,type:"enum",values:{geojson:{}}},data:{required:!0,type:"*"},maxzoom:{type:"number",default:18},attribution:{type:"string"},buffer:{type:"number",default:128,maximum:512,minimum:0},filter:{type:"*"},tolerance:{type:"number",default:.375},cluster:{type:"boolean",default:!1},clusterRadius:{type:"number",default:50,minimum:0},clusterMaxZoom:{type:"number"},clusterMinPoints:{type:"number"},clusterProperties:{type:"*"},lineMetrics:{type:"boolean",default:!1},generateId:{type:"boolean",default:!1},promoteId:{type:"promoteId"}},source_video:{type:{required:!0,type:"enum",values:{video:{}}},urls:{required:!0,type:"array",value:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},source_image:{type:{required:!0,type:"enum",values:{image:{}}},url:{required:!0,type:"string"},coordinates:{required:!0,type:"array",length:4,value:{type:"array",length:2,value:"number"}}},layer:{id:{type:"string",required:!0},type:{type:"enum",values:{fill:{},line:{},symbol:{},circle:{},heatmap:{},"fill-extrusion":{},raster:{},hillshade:{},background:{}},required:!0},metadata:{type:"*"},source:{type:"string"},"source-layer":{type:"string"},minzoom:{type:"number",minimum:0,maximum:24},maxzoom:{type:"number",minimum:0,maximum:24},filter:{type:"filter"},layout:{type:"layout"},paint:{type:"paint"}},layout:["layout_fill","layout_line","layout_circle","layout_heatmap","layout_fill-extrusion","layout_symbol","layout_raster","layout_hillshade","layout_background"],layout_background:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_fill:{"fill-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_circle:{"circle-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_heatmap:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},"layout_fill-extrusion":{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_line:{"line-cap":{type:"enum",values:{butt:{},round:{},square:{}},default:"butt",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-join":{type:"enum",values:{bevel:{},round:{},miter:{}},default:"miter",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"line-miter-limit":{type:"number",default:2,requires:[{"line-join":"miter"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-round-limit":{type:"number",default:1.05,requires:[{"line-join":"round"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_symbol:{"symbol-placement":{type:"enum",values:{point:{},line:{},"line-center":{}},default:"point",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-spacing":{type:"number",default:250,minimum:1,units:"pixels",requires:[{"symbol-placement":"line"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"symbol-avoid-edges":{type:"boolean",default:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"symbol-sort-key":{type:"number",expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"symbol-z-order":{type:"enum",values:{auto:{},"viewport-y":{},source:{}},default:"auto",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-allow-overlap":{type:"boolean",default:!1,requires:["icon-image",{"!":"icon-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-ignore-placement":{type:"boolean",default:!1,requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-optional":{type:"boolean",default:!1,requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-rotation-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-size":{type:"number",default:1,minimum:0,units:"factor of the original icon size",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-text-fit":{type:"enum",values:{none:{},width:{},height:{},both:{}},default:"none",requires:["icon-image","text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-text-fit-padding":{type:"array",value:"number",length:4,default:[0,0,0,0],units:"pixels",requires:["icon-image","text-field",{"icon-text-fit":["both","width","height"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-image":{type:"resolvedImage",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-padding":{type:"padding",default:[2],units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-keep-upright":{type:"boolean",default:!1,requires:["icon-image",{"icon-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"icon-offset":{type:"array",value:"number",length:2,default:[0,0],requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"icon-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-pitch-alignment":{type:"enum",values:{map:{},viewport:{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotation-alignment":{type:"enum",values:{map:{},viewport:{},"viewport-glyph":{},auto:{}},default:"auto",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-field":{type:"formatted",default:"",tokens:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-font":{type:"array",value:"string",default:["Open Sans Regular","Arial Unicode MS Regular"],requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-size":{type:"number",default:16,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-width":{type:"number",default:10,minimum:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-line-height":{type:"number",default:1.2,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-letter-spacing":{type:"number",default:0,units:"ems",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-justify":{type:"enum",values:{auto:{},left:{},center:{},right:{}},default:"center",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-radial-offset":{type:"number",units:"ems",default:0,requires:["text-field"],"property-type":"data-driven",expression:{interpolated:!0,parameters:["zoom","feature"]}},"text-variable-anchor":{type:"array",value:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-variable-anchor-offset":{type:"variableAnchorOffsetCollection",requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-anchor":{type:"enum",values:{center:{},left:{},right:{},top:{},bottom:{},"top-left":{},"top-right":{},"bottom-left":{},"bottom-right":{}},default:"center",requires:["text-field",{"!":"text-variable-anchor"}],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-max-angle":{type:"number",default:45,units:"degrees",requires:["text-field",{"symbol-placement":["line","line-center"]}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-writing-mode":{type:"array",value:"enum",values:{horizontal:{},vertical:{}},requires:["text-field",{"symbol-placement":["point"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-rotate":{type:"number",default:0,period:360,units:"degrees",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-padding":{type:"number",default:2,minimum:0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-keep-upright":{type:"boolean",default:!0,requires:["text-field",{"text-rotation-alignment":"map"},{"symbol-placement":["line","line-center"]}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-transform":{type:"enum",values:{none:{},uppercase:{},lowercase:{}},default:"none",requires:["text-field"],expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-offset":{type:"array",value:"number",units:"ems",length:2,default:[0,0],requires:["text-field",{"!":"text-radial-offset"}],expression:{interpolated:!0,parameters:["zoom","feature"]},"property-type":"data-driven"},"text-allow-overlap":{type:"boolean",default:!1,requires:["text-field",{"!":"text-overlap"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-overlap":{type:"enum",values:{never:{},always:{},cooperative:{}},requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-ignore-placement":{type:"boolean",default:!1,requires:["text-field"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-optional":{type:"boolean",default:!1,requires:["text-field","icon-image"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_raster:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},layout_hillshade:{visibility:{type:"enum",values:{visible:{},none:{}},default:"visible","property-type":"constant"}},filter:{type:"array",value:"*"},filter_operator:{type:"enum",values:{"==":{},"!=":{},">":{},">=":{},"<":{},"<=":{},in:{},"!in":{},all:{},any:{},none:{},has:{},"!has":{}}},geometry_type:{type:"enum",values:{Point:{},LineString:{},Polygon:{}}},function:{expression:{type:"expression"},stops:{type:"array",value:"function_stop"},base:{type:"number",default:1,minimum:0},property:{type:"string",default:"$zoom"},type:{type:"enum",values:{identity:{},exponential:{},interval:{},categorical:{}},default:"exponential"},colorSpace:{type:"enum",values:{rgb:{},lab:{},hcl:{}},default:"rgb"},default:{type:"*",required:!1}},function_stop:{type:"array",minimum:0,maximum:24,value:["number","color"],length:2},expression:{type:"array",value:"*",minimum:1},light:{anchor:{type:"enum",default:"viewport",values:{map:{},viewport:{}},"property-type":"data-constant",transition:!1,expression:{interpolated:!1,parameters:["zoom"]}},position:{type:"array",default:[1.15,210,30],length:3,value:"number","property-type":"data-constant",transition:!0,expression:{interpolated:!0,parameters:["zoom"]}},color:{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},intensity:{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},sky:{"sky-color":{type:"color","property-type":"data-constant",default:"#88C6FC",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-color":{type:"color","property-type":"data-constant",default:"#ffffff",expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"fog-ground-blend":{type:"number","property-type":"data-constant",default:.5,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"horizon-fog-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"sky-horizon-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0},"atmosphere-blend":{type:"number","property-type":"data-constant",default:.8,minimum:0,maximum:1,expression:{interpolated:!0,parameters:["zoom"]},transition:!0}},terrain:{source:{type:"string",required:!0},exaggeration:{type:"number",minimum:0,default:1}},projection:{type:{type:"projectionDefinition",default:"mercator","property-type":"data-constant",transition:!1,expression:{interpolated:!0,parameters:["zoom"]}}},paint:["paint_fill","paint_line","paint_circle","paint_heatmap","paint_fill-extrusion","paint_symbol","paint_raster","paint_hillshade","paint_background"],paint_fill:{"fill-antialias":{type:"boolean",default:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-outline-color":{type:"color",transition:!0,requires:[{"!":"fill-pattern"},{"fill-antialias":!0}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"}},"paint_fill-extrusion":{"fill-extrusion-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"fill-extrusion-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["fill-extrusion-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"fill-extrusion-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"fill-extrusion-height":{type:"number",default:0,minimum:0,units:"meters",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-base":{type:"number",default:0,minimum:0,units:"meters",transition:!0,requires:["fill-extrusion-height"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"fill-extrusion-vertical-gradient":{type:"boolean",default:!0,transition:!1,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_line:{"line-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"line-pattern"}],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"line-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["line-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"line-width":{type:"number",default:1,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-gap-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-offset":{type:"number",default:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"line-dasharray":{type:"array",value:"number",minimum:0,transition:!0,units:"line widths",requires:[{"!":"line-pattern"}],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"line-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom","feature"]},"property-type":"cross-faded-data-driven"},"line-gradient":{type:"color",transition:!1,requires:[{"!":"line-dasharray"},{"!":"line-pattern"},{source:"geojson",has:{lineMetrics:!0}}],expression:{interpolated:!0,parameters:["line-progress"]},"property-type":"color-ramp"}},paint_circle:{"circle-radius":{type:"number",default:5,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-blur":{type:"number",default:0,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"circle-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["circle-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-scale":{type:"enum",values:{map:{},viewport:{}},default:"map",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-pitch-alignment":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"circle-stroke-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"circle-stroke-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"}},paint_heatmap:{"heatmap-radius":{type:"number",default:30,minimum:1,transition:!0,units:"pixels",expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-weight":{type:"number",default:1,minimum:0,transition:!1,expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"heatmap-intensity":{type:"number",default:1,minimum:0,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"heatmap-color":{type:"color",default:["interpolate",["linear"],["heatmap-density"],0,"rgba(0, 0, 255, 0)",.1,"royalblue",.3,"cyan",.5,"lime",.7,"yellow",1,"red"],transition:!1,expression:{interpolated:!0,parameters:["heatmap-density"]},"property-type":"color-ramp"},"heatmap-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_symbol:{"icon-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-color":{type:"color",default:"#000000",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"icon-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["icon-image"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"icon-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["icon-image","icon-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"text-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-color":{type:"color",default:"#000000",transition:!0,overridable:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-color":{type:"color",default:"rgba(0, 0, 0, 0)",transition:!0,requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-width":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-halo-blur":{type:"number",default:0,minimum:0,transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom","feature","feature-state"]},"property-type":"data-driven"},"text-translate":{type:"array",value:"number",length:2,default:[0,0],transition:!0,units:"pixels",requires:["text-field"],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"text-translate-anchor":{type:"enum",values:{map:{},viewport:{}},default:"map",requires:["text-field","text-translate"],expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"}},paint_raster:{"raster-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-hue-rotate":{type:"number",default:0,period:360,transition:!0,units:"degrees",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-min":{type:"number",default:0,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-brightness-max":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-saturation":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-contrast":{type:"number",default:0,minimum:-1,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"raster-resampling":{type:"enum",values:{linear:{},nearest:{}},default:"linear",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"raster-fade-duration":{type:"number",default:300,minimum:0,transition:!1,units:"milliseconds",expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_hillshade:{"hillshade-illumination-direction":{type:"number",default:335,minimum:0,maximum:359,transition:!1,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-illumination-anchor":{type:"enum",values:{map:{},viewport:{}},default:"viewport",expression:{interpolated:!1,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-exaggeration":{type:"number",default:.5,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-shadow-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-highlight-color":{type:"color",default:"#FFFFFF",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"hillshade-accent-color":{type:"color",default:"#000000",transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},paint_background:{"background-color":{type:"color",default:"#000000",transition:!0,requires:[{"!":"background-pattern"}],expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"},"background-pattern":{type:"resolvedImage",transition:!0,expression:{interpolated:!1,parameters:["zoom"]},"property-type":"cross-faded"},"background-opacity":{type:"number",default:1,minimum:0,maximum:1,transition:!0,expression:{interpolated:!0,parameters:["zoom"]},"property-type":"data-constant"}},transition:{duration:{type:"number",default:300,minimum:0,units:"milliseconds"},delay:{type:"number",default:0,minimum:0,units:"milliseconds"}},"property-type":{"data-driven":{type:"property-type"},"cross-faded":{type:"property-type"},"cross-faded-data-driven":{type:"property-type"},"color-ramp":{type:"property-type"},"data-constant":{type:"property-type"},constant:{type:"property-type"}},promoteId:{"*":{type:"string"}}};const Y=["type","source","source-layer","minzoom","maxzoom","filter","layout"];function ae(r,t){const n={};for(const a in r)a!=="ref"&&(n[a]=r[a]);return Y.forEach(a=>{a in t&&(n[a]=t[a])}),n}function ne(r,t){if(Array.isArray(r)){if(!Array.isArray(t)||r.length!==t.length)return!1;for(let n=0;n<r.length;n++)if(!ne(r[n],t[n]))return!1;return!0}if(typeof r=="object"&&r!==null&&t!==null){if(typeof t!="object"||Object.keys(r).length!==Object.keys(t).length)return!1;for(const n in r)if(!ne(r[n],t[n]))return!1;return!0}return r===t}function he(r,t){r.push(t)}function oe(r,t,n){he(n,{command:"addSource",args:[r,t[r]]})}function be(r,t,n){he(t,{command:"removeSource",args:[r]}),n[r]=!0}function _e(r,t,n,a){be(r,n,a),oe(r,t,n)}function ue(r,t,n){let a;for(a in r[n])if(Object.prototype.hasOwnProperty.call(r[n],a)&&a!=="data"&&!ne(r[n][a],t[n][a]))return!1;for(a in t[n])if(Object.prototype.hasOwnProperty.call(t[n],a)&&a!=="data"&&!ne(r[n][a],t[n][a]))return!1;return!0}function Ie(r,t,n,a,l,d){r=r||{},t=t||{};for(const p in r)Object.prototype.hasOwnProperty.call(r,p)&&(ne(r[p],t[p])||n.push({command:d,args:[a,p,t[p],l]}));for(const p in t)Object.prototype.hasOwnProperty.call(t,p)&&!Object.prototype.hasOwnProperty.call(r,p)&&(ne(r[p],t[p])||n.push({command:d,args:[a,p,t[p],l]}))}function je(r){return r.id}function Ne(r,t){return r[t.id]=t,r}class ye{constructor(t,n,a,l){this.message=(t?`${t}: `:"")+a,l&&(this.identifier=l),n!=null&&n.__line__&&(this.line=n.__line__)}}function nt(r,...t){for(const n of t)for(const a in n)r[a]=n[a];return r}class Je extends Error{constructor(t,n){super(n),this.message=n,this.key=t}}class rt{constructor(t,n=[]){this.parent=t,this.bindings={};for(const[a,l]of n)this.bindings[a]=l}concat(t){return new rt(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 _t={kind:"null"},ze={kind:"number"},qe={kind:"string"},Oe={kind:"boolean"},st={kind:"color"},$t={kind:"projectionDefinition"},Hr={kind:"object"},it={kind:"value"},li={kind:"collator"},Dt={kind:"formatted"},lo={kind:"padding"},Ca={kind:"resolvedImage"},xn={kind:"variableAnchorOffsetCollection"};function Ni(r,t){return{kind:"array",itemType:r,N:t}}function Vt(r){if(r.kind==="array"){const t=Vt(r.itemType);return typeof r.N=="number"?`array<${t}, ${r.N}>`:r.itemType.kind==="value"?"array":`array<${t}>`}return r.kind}const Bh=[_t,ze,qe,Oe,st,$t,Dt,Hr,Ni(it),lo,Ca,xn];function Ea(r,t){if(t.kind==="error")return null;if(r.kind==="array"){if(t.kind==="array"&&(t.N===0&&t.itemType.kind==="value"||!Ea(r.itemType,t.itemType))&&(typeof r.N!="number"||r.N===t.N))return null}else{if(r.kind===t.kind)return null;if(r.kind==="value"){for(const n of Bh)if(!Ea(n,t))return null}}return`Expected ${Vt(r)} but found ${Vt(t)} instead.`}function Tl(r,t){return t.some(n=>n.kind===r.kind)}function vn(r,t){return t.some(n=>n==="null"?r===null:n==="array"?Array.isArray(r):n==="object"?r&&!Array.isArray(r)&&typeof r=="object":n===typeof r)}function za(r,t){return r.kind==="array"&&t.kind==="array"?r.itemType.kind===t.itemType.kind&&typeof r.N=="number":r.kind===t.kind}const au=.96422,su=.82521,ou=4/29,ka=6/29,lu=3*ka*ka,Oh=ka*ka*ka,cu=Math.PI/180,xs=180/Math.PI;function uu(r){return(r%=360)<0&&(r+=360),r}function hu([r,t,n,a]){let l,d;const p=Pl((.2225045*(r=Wn(r))+.7168786*(t=Wn(t))+.0606169*(n=Wn(n)))/1);r===t&&t===n?l=d=p:(l=Pl((.4360747*r+.3850649*t+.1430804*n)/au),d=Pl((.0139322*r+.0971045*t+.7141733*n)/su));const m=116*p-16;return[m<0?0:m,500*(l-p),200*(p-d),a]}function Wn(r){return r<=.04045?r/12.92:Math.pow((r+.055)/1.055,2.4)}function Pl(r){return r>Oh?Math.pow(r,1/3):r/lu+ou}function du([r,t,n,a]){let l=(r+16)/116,d=isNaN(t)?l:l+t/500,p=isNaN(n)?l:l-n/200;return l=1*co(l),d=au*co(d),p=su*co(p),[Sl(3.1338561*d-1.6168667*l-.4906146*p),Sl(-.9787684*d+1.9161415*l+.033454*p),Sl(.0719453*d-.2289914*l+1.4052427*p),a]}function Sl(r){return(r=r<=.00304?12.92*r:1.055*Math.pow(r,1/2.4)-.055)<0?0:r>1?1:r}function co(r){return r>ka?r*r*r:lu*(r-ou)}function vs(r){return parseInt(r.padEnd(2,r),16)/255}function _r(r,t){return dt(t?r/100:r,0,1)}function dt(r,t,n){return Math.min(Math.max(t,r),n)}function Hn(r){return!r.some(Number.isNaN)}const bn={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 Kr(r,t,n){return r+n*(t-r)}function Aa(r,t,n){return r.map((a,l)=>Kr(a,t[l],n))}class yt{constructor(t,n,a,l=1,d=!0){this.r=t,this.g=n,this.b=a,this.a=l,d||(this.r*=l,this.g*=l,this.b*=l,l||this.overwriteGetter("rgb",[t,n,a,l]))}static parse(t){if(t instanceof yt)return t;if(typeof t!="string")return;const n=function(a){if((a=a.toLowerCase().trim())==="transparent")return[0,0,0,0];const l=bn[a];if(l){const[p,m,y]=l;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[vs(a.slice(m,m+=p)),vs(a.slice(m,m+=p)),vs(a.slice(m,m+=p)),vs(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,v,P,S,k,R,L,O,$,H,re]=p,X=[P||" ",R||" ",$].join("");if(X===" "||X===" /"||X===",,"||X===",,,"){const A=[v,k,O].join(""),U=A==="%%%"?100:A===""?255:0;if(U){const J=[dt(+y/U,0,1),dt(+S/U,0,1),dt(+L/U,0,1),H?_r(+H,re):1];if(Hn(J))return J}}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,v,P,S,k,R,L]=d,O=[y||" ",P||" ",k].join("");if(O===" "||O===" /"||O===",,"||O===",,,"){const $=[+m,dt(+v,0,100),dt(+S,0,100),R?_r(+R,L):1];if(Hn($))return function([H,re,X,A]){function U(J){const fe=(J+H/30)%12,Ce=re*Math.min(X,1-X);return X-Ce*Math.max(-1,Math.min(fe-3,9-fe,1))}return H=uu(H),re/=100,X/=100,[U(0),U(8),U(4),A]}($)}}}(t);return n?new yt(...n,!1):void 0}get rgb(){const{r:t,g:n,b:a,a:l}=this,d=l||1/0;return this.overwriteGetter("rgb",[t/d,n/d,a/d,l])}get hcl(){return this.overwriteGetter("hcl",function(t){const[n,a,l,d]=hu(t),p=Math.sqrt(a*a+l*l);return[Math.round(1e4*p)?uu(Math.atan2(l,a)*xs):NaN,p,n,d]}(this.rgb))}get lab(){return this.overwriteGetter("lab",hu(this.rgb))}overwriteGetter(t,n){return Object.defineProperty(this,t,{value:n}),n}toString(){const[t,n,a,l]=this.rgb;return`rgba(${[t,n,a].map(d=>Math.round(255*d)).join(",")},${l})`}static interpolate(t,n,a,l="rgb"){switch(l){case"rgb":{const[d,p,m,y]=Aa(t.rgb,n.rgb,a);return new yt(d,p,m,y,!1)}case"hcl":{const[d,p,m,y]=t.hcl,[v,P,S,k]=n.hcl;let R,L;if(isNaN(d)||isNaN(v))isNaN(d)?isNaN(v)?R=NaN:(R=v,m!==1&&m!==0||(L=P)):(R=d,S!==1&&S!==0||(L=p));else{let X=v-d;v>d&&X>180?X-=360:v<d&&d-v>180&&(X+=360),R=d+a*X}const[O,$,H,re]=function([X,A,U,J]){return X=isNaN(X)?0:X*cu,du([U,Math.cos(X)*A,Math.sin(X)*A,J])}([R,L??Kr(p,P,a),Kr(m,S,a),Kr(y,k,a)]);return new yt(O,$,H,re,!1)}case"lab":{const[d,p,m,y]=du(Aa(t.lab,n.lab,a));return new yt(d,p,m,y,!1)}}}}yt.black=new yt(0,0,0,1),yt.white=new yt(1,1,1,1),yt.transparent=new yt(0,0,0,0),yt.red=new yt(1,0,0,1);class ar{constructor(t,n,a){this.sensitivity=t?n?"variant":"case":n?"accent":"base",this.locale=a,this.collator=new Intl.Collator(this.locale?this.locale:[],{sensitivity:this.sensitivity,usage:"search"})}compare(t,n){return this.collator.compare(t,n)}resolvedLocale(){return new Intl.Collator(this.locale?this.locale:[]).resolvedOptions().locale}}const bs=["bottom","center","top"];class Ra{constructor(t,n,a,l,d,p){this.text=t,this.image=n,this.scale=a,this.fontStack=l,this.textColor=d,this.verticalAlign=p}}class Di{constructor(t){this.sections=t}static fromString(t){return new Di([new Ra(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 Di?t:Di.fromString(t)}toString(){return this.sections.length===0?"":this.sections.map(t=>t.text).join("")}}class bi{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof bi)return t;if(typeof t=="number")return new bi([t,t,t,t]);if(Array.isArray(t)&&!(t.length<1||t.length>4)){for(const n of t)if(typeof n!="number")return;switch(t.length){case 1:t=[t[0],t[0],t[0],t[0]];break;case 2:t=[t[0],t[1],t[0],t[1]];break;case 3:t=[t[0],t[1],t[2],t[1]]}return new bi(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,a){return new bi(Aa(t.values,n.values,a))}}class jt{constructor(t){this.name="ExpressionEvaluationError",this.message=t}toJSON(){return this.message}}const uo=new Set(["center","left","right","top","bottom","top-left","top-right","bottom-left","bottom-right"]);class Li{constructor(t){this.values=t.slice()}static parse(t){if(t instanceof Li)return t;if(Array.isArray(t)&&!(t.length<1)&&t.length%2==0){for(let n=0;n<t.length;n+=2){const a=t[n],l=t[n+1];if(typeof a!="string"||!uo.has(a)||!Array.isArray(l)||l.length!==2||typeof l[0]!="number"||typeof l[1]!="number")return}return new Li(t)}}toString(){return JSON.stringify(this.values)}static interpolate(t,n,a){const l=t.values,d=n.values;if(l.length!==d.length)throw new jt(`Cannot interpolate values of different length. from: ${t.toString()}, to: ${n.toString()}`);const p=[];for(let m=0;m<l.length;m+=2){if(l[m]!==d[m])throw new jt(`Cannot interpolate values containing mismatched anchors. from[${m}]: ${l[m]}, to[${m}]: ${d[m]}`);p.push(l[m]);const[y,v]=l[m+1],[P,S]=d[m+1];p.push([Kr(y,P,a),Kr(v,S,a)])}return new Li(p)}}class Zi{constructor(t){this.name=t.name,this.available=t.available}toString(){return this.name}static fromString(t){return t?new Zi({name:t,available:!1}):null}}class ci{constructor(t,n,a){this.from=t,this.to=n,this.transition=a}static interpolate(t,n,a){return new ci(t,n,a)}static parse(t){return t instanceof ci?t:Array.isArray(t)&&t.length===3&&typeof t[0]=="string"&&typeof t[1]=="string"&&typeof t[2]=="number"?new ci(t[0],t[1],t[2]):typeof t=="object"&&typeof t.from=="string"&&typeof t.to=="string"&&typeof t.transition=="number"?new ci(t.from,t.to,t.transition):typeof t=="string"?new ci(t,t,1):void 0}}function pu(r,t,n,a){return typeof r=="number"&&r>=0&&r<=255&&typeof t=="number"&&t>=0&&t<=255&&typeof n=="number"&&n>=0&&n<=255?a===void 0||typeof a=="number"&&a>=0&&a<=1?null:`Invalid rgba value [${[r,t,n,a].join(", ")}]: 'a' must be between 0 and 1.`:`Invalid rgba value [${(typeof a=="number"?[r,t,n,a]:[r,t,n]).join(", ")}]: 'r', 'g', and 'b' must be between 0 and 255.`}function wn(r){if(r===null||typeof r=="string"||typeof r=="boolean"||typeof r=="number"||r instanceof ci||r instanceof yt||r instanceof ar||r instanceof Di||r instanceof bi||r instanceof Li||r instanceof Zi)return!0;if(Array.isArray(r)){for(const t of r)if(!wn(t))return!1;return!0}if(typeof r=="object"){for(const t in r)if(!wn(r[t]))return!1;return!0}return!1}function Nt(r){if(r===null)return _t;if(typeof r=="string")return qe;if(typeof r=="boolean")return Oe;if(typeof r=="number")return ze;if(r instanceof yt)return st;if(r instanceof ci)return $t;if(r instanceof ar)return li;if(r instanceof Di)return Dt;if(r instanceof bi)return lo;if(r instanceof Li)return xn;if(r instanceof Zi)return Ca;if(Array.isArray(r)){const t=r.length;let n;for(const a of r){const l=Nt(a);if(n){if(n===l)continue;n=it;break}n=l}return Ni(n||it,t)}return Hr}function Da(r){const t=typeof r;return r===null?"":t==="string"||t==="number"||t==="boolean"?String(r):r instanceof yt||r instanceof ci||r instanceof Di||r instanceof bi||r instanceof Li||r instanceof Zi?r.toString():JSON.stringify(r)}class Tn{constructor(t,n){this.type=t,this.value=n}static parse(t,n){if(t.length!==2)return n.error(`'literal' expression requires exactly one argument, but found ${t.length-1} instead.`);if(!wn(t[1]))return n.error("invalid value");const a=t[1];let l=Nt(a);const d=n.expectedType;return l.kind!=="array"||l.N!==0||!d||d.kind!=="array"||typeof d.N=="number"&&d.N!==0||(l=d),new Tn(l,a)}evaluate(){return this.value}eachChild(){}outputDefined(){return!0}}const ws={string:qe,number:ze,boolean:Oe,object:Hr};class Vi{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let a,l=1;const d=t[0];if(d==="array"){let m,y;if(t.length>2){const v=t[1];if(typeof v!="string"||!(v in ws)||v==="object")return n.error('The item type argument of "array" must be one of string, number, boolean',1);m=ws[v],l++}else m=it;if(t.length>3){if(t[2]!==null&&(typeof t[2]!="number"||t[2]<0||t[2]!==Math.floor(t[2])))return n.error('The length argument to "array" must be a positive integer literal',2);y=t[2],l++}a=Ni(m,y)}else{if(!ws[d])throw new Error(`Types doesn't contain name = ${d}`);a=ws[d]}const p=[];for(;l<t.length;l++){const m=n.parse(t[l],l,it);if(!m)return null;p.push(m)}return new Vi(a,p)}evaluate(t){for(let n=0;n<this.args.length;n++){const a=this.args[n].evaluate(t);if(!Ea(this.type,Nt(a)))return a;if(n===this.args.length-1)throw new jt(`Expected value to be of type ${Vt(this.type)}, but found ${Vt(Nt(a))} instead.`)}throw new Error}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const Lt={"to-boolean":Oe,"to-color":st,"to-number":ze,"to-string":qe};class zr{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const a=t[0];if(!Lt[a])throw new Error(`Can't parse ${a} as it is not part of the known types`);if((a==="to-boolean"||a==="to-string")&&t.length!==2)return n.error("Expected one argument.");const l=Lt[a],d=[];for(let p=1;p<t.length;p++){const m=n.parse(t[p],p,it);if(!m)return null;d.push(m)}return new zr(l,d)}evaluate(t){switch(this.type.kind){case"boolean":return!!this.args[0].evaluate(t);case"color":{let n,a;for(const l of this.args){if(n=l.evaluate(t),a=null,n instanceof yt)return n;if(typeof n=="string"){const d=t.parseColor(n);if(d)return d}else if(Array.isArray(n)&&(a=n.length<3||n.length>4?`Invalid rgba value ${JSON.stringify(n)}: expected an array containing either three or four numeric values.`:pu(n[0],n[1],n[2],n[3]),!a))return new yt(n[0]/255,n[1]/255,n[2]/255,n[3])}throw new jt(a||`Could not parse color from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"padding":{let n;for(const a of this.args){n=a.evaluate(t);const l=bi.parse(n);if(l)return l}throw new jt(`Could not parse padding from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"variableAnchorOffsetCollection":{let n;for(const a of this.args){n=a.evaluate(t);const l=Li.parse(n);if(l)return l}throw new jt(`Could not parse variableAnchorOffsetCollection from value '${typeof n=="string"?n:JSON.stringify(n)}'`)}case"number":{let n=null;for(const a of this.args){if(n=a.evaluate(t),n===null)return 0;const l=Number(n);if(!isNaN(l))return l}throw new jt(`Could not convert ${JSON.stringify(n)} to number.`)}case"formatted":return Di.fromString(Da(this.args[0].evaluate(t)));case"resolvedImage":return Zi.fromString(Da(this.args[0].evaluate(t)));case"projectionDefinition":return this.args[0].evaluate(t);default:return Da(this.args[0].evaluate(t))}}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}const vt=["Unknown","Point","LineString","Polygon"];class ct{constructor(){this.globals=null,this.feature=null,this.featureState=null,this.formattedSection=null,this._parseColorCache={},this.availableImages=null,this.canonical=null}id(){return this.feature&&"id"in this.feature?this.feature.id:null}geometryType(){return this.feature?typeof this.feature.type=="number"?vt[this.feature.type]:this.feature.type:null}geometry(){return this.feature&&"geometry"in this.feature?this.feature.geometry:null}canonicalID(){return this.canonical}properties(){return this.feature&&this.feature.properties||{}}parseColor(t){let n=this._parseColorCache[t];return n||(n=this._parseColorCache[t]=yt.parse(t)),n}}class La{constructor(t,n,a=[],l,d=new rt,p=[]){this.registry=t,this.path=a,this.key=a.map(m=>`[${m}]`).join(""),this.scope=d,this.errors=p,this.expectedType=l,this._isConstant=n}parse(t,n,a,l,d={}){return n?this.concat(n,a,l)._parse(t,d):this._parse(t,d)}_parse(t,n){function a(l,d,p){return p==="assert"?new Vi(d,[l]):p==="coerce"?new zr(d,[l]):l}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 l=t[0];if(typeof l!="string")return this.error(`Expression name must be a string, but found ${typeof l} instead. If you wanted a literal array, use ["literal", [...]].`,0),null;const d=this.registry[l];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"||y.kind!=="string"&&y.kind!=="array")if(m.kind!=="color"&&m.kind!=="formatted"&&m.kind!=="resolvedImage"||y.kind!=="value"&&y.kind!=="string")if(m.kind!=="padding"||y.kind!=="value"&&y.kind!=="number"&&y.kind!=="array")if(m.kind!=="variableAnchorOffsetCollection"||y.kind!=="value"&&y.kind!=="array"){if(this.checkSubtype(m,y))return null}else p=a(p,m,n.typeAnnotation||"coerce");else p=a(p,m,n.typeAnnotation||"coerce");else p=a(p,m,n.typeAnnotation||"coerce");else p=a(p,m,n.typeAnnotation||"coerce");else p=a(p,m,n.typeAnnotation||"assert")}if(!(p instanceof Tn)&&p.type.kind!=="resolvedImage"&&this._isConstant(p)){const m=new ct;try{p=new Tn(p.type,p.evaluate(m))}catch(y){return this.error(y.message),null}}return p}return this.error(`Unknown expression "${l}". If you wanted a literal array, use ["literal", [...]].`,0)}return this.error(t===void 0?"'undefined' value invalid. Use null instead.":typeof t=="object"?'Bare objects invalid. Use ["literal", {...}] instead.':`Expected an array, but found ${typeof t} instead.`)}concat(t,n,a){const l=typeof t=="number"?this.path.concat(t):this.path,d=a?this.scope.concat(a):this.scope;return new La(this.registry,this._isConstant,l,n||null,d,this.errors)}error(t,...n){const a=`${this.key}${n.map(l=>`[${l}]`).join("")}`;this.errors.push(new Je(a,t))}checkSubtype(t,n){const a=Ea(t,n);return a&&this.error(a),a}}class gt{constructor(t,n){this.type=n.type,this.bindings=[].concat(t),this.result=n}evaluate(t){return this.result.evaluate(t)}eachChild(t){for(const n of this.bindings)t(n[1]);t(this.result)}static parse(t,n){if(t.length<4)return n.error(`Expected at least 3 arguments, but found ${t.length-1} instead.`);const a=[];for(let d=1;d<t.length-1;d+=2){const p=t[d];if(typeof p!="string")return n.error(`Expected string, but found ${typeof p} instead.`,d);if(/[^a-zA-Z0-9_]/.test(p))return n.error("Variable names must contain only alphanumeric characters or '_'.",d);const m=n.parse(t[d+1],d+1);if(!m)return null;a.push([p,m])}const l=n.parse(t[t.length-1],t.length-1,n.expectedType,a);return l?new gt(a,l):null}outputDefined(){return this.result.outputDefined()}}class Fa{constructor(t,n){this.type=n.type,this.name=t,this.boundExpression=n}static parse(t,n){if(t.length!==2||typeof t[1]!="string")return n.error("'var' expression requires exactly one string literal argument.");const a=t[1];return n.scope.has(a)?new Fa(a,n.scope.get(a)):n.error(`Unknown variable "${a}". Make sure "${a}" has been bound in an enclosing "let" expression before using it.`,1)}evaluate(t){return this.boundExpression.evaluate(t)}eachChild(){}outputDefined(){return!1}}class yr{constructor(t,n,a){this.type=t,this.index=n,this.input=a}static parse(t,n){if(t.length!==3)return n.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,ze),l=n.parse(t[2],2,Ni(n.expectedType||it));return a&&l?new yr(l.type.itemType,a,l):null}evaluate(t){const n=this.index.evaluate(t),a=this.input.evaluate(t);if(n<0)throw new jt(`Array index out of bounds: ${n} < 0.`);if(n>=a.length)throw new jt(`Array index out of bounds: ${n} > ${a.length-1}.`);if(n!==Math.floor(n))throw new jt(`Array index must be an integer, but found ${n} instead.`);return a[n]}eachChild(t){t(this.index),t(this.input)}outputDefined(){return!1}}class Ts{constructor(t,n){this.type=Oe,this.needle=t,this.haystack=n}static parse(t,n){if(t.length!==3)return n.error(`Expected 2 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,it),l=n.parse(t[2],2,it);return a&&l?Tl(a.type,[Oe,qe,ze,_t,it])?new Ts(a,l):n.error(`Expected first argument to be of type boolean, string, number or null, but found ${Vt(a.type)} instead`):null}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!a)return!1;if(!vn(n,["boolean","string","number","null"]))throw new jt(`Expected first argument to be of type boolean, string, number or null, but found ${Vt(Nt(n))} instead.`);if(!vn(a,["string","array"]))throw new jt(`Expected second argument to be of type array or string, but found ${Vt(Nt(a))} instead.`);return a.indexOf(n)>=0}eachChild(t){t(this.needle),t(this.haystack)}outputDefined(){return!0}}class Ps{constructor(t,n,a){this.type=ze,this.needle=t,this.haystack=n,this.fromIndex=a}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,it),l=n.parse(t[2],2,it);if(!a||!l)return null;if(!Tl(a.type,[Oe,qe,ze,_t,it]))return n.error(`Expected first argument to be of type boolean, string, number or null, but found ${Vt(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,ze);return d?new Ps(a,l,d):null}return new Ps(a,l)}evaluate(t){const n=this.needle.evaluate(t),a=this.haystack.evaluate(t);if(!vn(n,["boolean","string","number","null"]))throw new jt(`Expected first argument to be of type boolean, string, number or null, but found ${Vt(Nt(n))} instead.`);let l;if(this.fromIndex&&(l=this.fromIndex.evaluate(t)),vn(a,["string"])){const d=a.indexOf(n,l);return d===-1?-1:[...a.slice(0,d)].length}if(vn(a,["array"]))return a.indexOf(n,l);throw new jt(`Expected second argument to be of type array or string, but found ${Vt(Nt(a))} instead.`)}eachChild(t){t(this.needle),t(this.haystack),this.fromIndex&&t(this.fromIndex)}outputDefined(){return!1}}class ho{constructor(t,n,a,l,d,p){this.inputType=t,this.type=n,this.input=a,this.cases=l,this.outputs=d,this.otherwise=p}static parse(t,n){if(t.length<5)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if(t.length%2!=1)return n.error("Expected an even number of arguments.");let a,l;n.expectedType&&n.expectedType.kind!=="value"&&(l=n.expectedType);const d={},p=[];for(let v=2;v<t.length-1;v+=2){let P=t[v];const S=t[v+1];Array.isArray(P)||(P=[P]);const k=n.concat(v);if(P.length===0)return k.error("Expected at least one branch label.");for(const L of P){if(typeof L!="number"&&typeof L!="string")return k.error("Branch labels must be numbers or strings.");if(typeof L=="number"&&Math.abs(L)>Number.MAX_SAFE_INTEGER)return k.error(`Branch labels must be integers no larger than ${Number.MAX_SAFE_INTEGER}.`);if(typeof L=="number"&&Math.floor(L)!==L)return k.error("Numeric branch labels must be integer values.");if(a){if(k.checkSubtype(a,Nt(L)))return null}else a=Nt(L);if(d[String(L)]!==void 0)return k.error("Branch labels must be unique.");d[String(L)]=p.length}const R=n.parse(S,v,l);if(!R)return null;l=l||R.type,p.push(R)}const m=n.parse(t[1],1,it);if(!m)return null;const y=n.parse(t[t.length-1],t.length-1,l);return y?m.type.kind!=="value"&&n.concat(1).checkSubtype(a,m.type)?null:new ho(a,l,m,d,p,y):null}evaluate(t){const n=this.input.evaluate(t);return(Nt(n)===this.inputType&&this.outputs[this.cases[n]]||this.otherwise).evaluate(t)}eachChild(t){t(this.input),this.outputs.forEach(t),t(this.otherwise)}outputDefined(){return this.outputs.every(t=>t.outputDefined())&&this.otherwise.outputDefined()}}class Ss{constructor(t,n,a){this.type=t,this.branches=n,this.otherwise=a}static parse(t,n){if(t.length<4)return n.error(`Expected at least 3 arguments, but found only ${t.length-1}.`);if(t.length%2!=0)return n.error("Expected an odd number of arguments.");let a;n.expectedType&&n.expectedType.kind!=="value"&&(a=n.expectedType);const l=[];for(let p=1;p<t.length-1;p+=2){const m=n.parse(t[p],p,Oe);if(!m)return null;const y=n.parse(t[p+1],p+1,a);if(!y)return null;l.push([m,y]),a=a||y.type}const d=n.parse(t[t.length-1],t.length-1,a);if(!d)return null;if(!a)throw new Error("Can't infer output type");return new Ss(a,l,d)}evaluate(t){for(const[n,a]of this.branches)if(n.evaluate(t))return a.evaluate(t);return this.otherwise.evaluate(t)}eachChild(t){for(const[n,a]of this.branches)t(n),t(a);t(this.otherwise)}outputDefined(){return this.branches.every(([t,n])=>n.outputDefined())&&this.otherwise.outputDefined()}}class Ms{constructor(t,n,a,l){this.type=t,this.input=n,this.beginIndex=a,this.endIndex=l}static parse(t,n){if(t.length<=2||t.length>=5)return n.error(`Expected 3 or 4 arguments, but found ${t.length-1} instead.`);const a=n.parse(t[1],1,it),l=n.parse(t[2],2,ze);if(!a||!l)return null;if(!Tl(a.type,[Ni(it),qe,it]))return n.error(`Expected first argument to be of type array or string, but found ${Vt(a.type)} instead`);if(t.length===4){const d=n.parse(t[3],3,ze);return d?new Ms(a.type,a,l,d):null}return new Ms(a.type,a,l)}evaluate(t){const n=this.input.evaluate(t),a=this.beginIndex.evaluate(t);let l;if(this.endIndex&&(l=this.endIndex.evaluate(t)),vn(n,["string"]))return[...n].slice(a,l).join("");if(vn(n,["array"]))return n.slice(a,l);throw new jt(`Expected first argument to be of type array or string, but found ${Vt(Nt(n))} instead.`)}eachChild(t){t(this.input),t(this.beginIndex),this.endIndex&&t(this.endIndex)}outputDefined(){return!1}}function po(r,t){const n=r.length-1;let a,l,d=0,p=n,m=0;for(;d<=p;)if(m=Math.floor((d+p)/2),a=r[m],l=r[m+1],a<=t){if(m===n||t<l)return m;d=m+1}else{if(!(a>t))throw new jt("Input is not a number.");p=m-1}return 0}class Ba{constructor(t,n,a){this.type=t,this.input=n,this.labels=[],this.outputs=[];for(const[l,d]of a)this.labels.push(l),this.outputs.push(d)}static parse(t,n){if(t.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");const a=n.parse(t[1],1,ze);if(!a)return null;const l=[];let d=null;n.expectedType&&n.expectedType.kind!=="value"&&(d=n.expectedType);for(let p=1;p<t.length;p+=2){const m=p===1?-1/0:t[p],y=t[p+1],v=p,P=p+1;if(typeof m!="number")return n.error('Input/output pairs for "step" expressions must be defined using literal numeric values (not computed expressions) for the input values.',v);if(l.length&&l[l.length-1][0]>=m)return n.error('Input/output pairs for "step" expressions must be arranged with input values in strictly ascending order.',v);const S=n.parse(y,P,d);if(!S)return null;d=d||S.type,l.push([m,S])}return new Ba(d,a,l)}evaluate(t){const n=this.labels,a=this.outputs;if(n.length===1)return a[0].evaluate(t);const l=this.input.evaluate(t);if(l<=n[0])return a[0].evaluate(t);const d=n.length;return l>=n[d-1]?a[d-1].evaluate(t):a[po(n,l)].evaluate(t)}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function fu(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}var Kn,wi,fo=function(){if(wi)return Kn;function r(t,n,a,l){this.cx=3*t,this.bx=3*(a-t)-this.cx,this.ax=1-this.cx-this.bx,this.cy=3*n,this.by=3*(l-n)-this.cy,this.ay=1-this.cy-this.by,this.p1x=t,this.p1y=n,this.p2x=a,this.p2y=l}return wi=1,Kn=r,r.prototype={sampleCurveX:function(t){return((this.ax*t+this.bx)*t+this.cx)*t},sampleCurveY:function(t){return((this.ay*t+this.by)*t+this.cy)*t},sampleCurveDerivativeX:function(t){return(3*this.ax*t+2*this.bx)*t+this.cx},solveCurveX:function(t,n){if(n===void 0&&(n=1e-6),t<0)return 0;if(t>1)return 1;for(var a=t,l=0;l<8;l++){var d=this.sampleCurveX(a)-t;if(Math.abs(d)<n)return a;var p=this.sampleCurveDerivativeX(a);if(Math.abs(p)<1e-6)break;a-=d/p}var m=0,y=1;for(a=t,l=0;l<20&&(d=this.sampleCurveX(a),!(Math.abs(d-t)<n));l++)t>d?m=a:y=a,a=.5*(y-m)+m;return a},solve:function(t,n){return this.sampleCurveY(this.solveCurveX(t,n))}},Kn}(),mu=fu(fo);class Ei{constructor(t,n,a,l,d){this.type=t,this.operator=n,this.interpolation=a,this.input=l,this.labels=[],this.outputs=[];for(const[p,m]of d)this.labels.push(p),this.outputs.push(m)}static interpolationFactor(t,n,a,l){let d=0;if(t.name==="exponential")d=ni(n,t.base,a,l);else if(t.name==="linear")d=ni(n,1,a,l);else if(t.name==="cubic-bezier"){const p=t.controlPoints;d=new mu(p[0],p[1],p[2],p[3]).solve(ni(n,1,a,l))}return d}static parse(t,n){let[a,l,d,...p]=t;if(!Array.isArray(l)||l.length===0)return n.error("Expected an interpolation type expression.",1);if(l[0]==="linear")l={name:"linear"};else if(l[0]==="exponential"){const v=l[1];if(typeof v!="number")return n.error("Exponential interpolation requires a numeric base.",1,1);l={name:"exponential",base:v}}else{if(l[0]!=="cubic-bezier")return n.error(`Unknown interpolation type ${String(l[0])}`,1,0);{const v=l.slice(1);if(v.length!==4||v.some(P=>typeof P!="number"||P<0||P>1))return n.error("Cubic bezier interpolation requires four numeric arguments with values between 0 and 1.",1);l={name:"cubic-bezier",controlPoints:v}}}if(t.length-1<4)return n.error(`Expected at least 4 arguments, but found only ${t.length-1}.`);if((t.length-1)%2!=0)return n.error("Expected an even number of arguments.");if(d=n.parse(d,2,ze),!d)return null;const m=[];let y=null;a==="interpolate-hcl"||a==="interpolate-lab"?y=st:n.expectedType&&n.expectedType.kind!=="value"&&(y=n.expectedType);for(let v=0;v<p.length;v+=2){const P=p[v],S=p[v+1],k=v+3,R=v+4;if(typeof P!="number")return n.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]>=P)return n.error('Input/output pairs for "interpolate" expressions must be arranged with input values in strictly ascending order.',k);const L=n.parse(S,R,y);if(!L)return null;y=y||L.type,m.push([P,L])}return za(y,ze)||za(y,$t)||za(y,st)||za(y,lo)||za(y,xn)||za(y,Ni(ze))?new Ei(y,a,l,d,m):n.error(`Type ${Vt(y)} is not interpolatable.`)}evaluate(t){const n=this.labels,a=this.outputs;if(n.length===1)return a[0].evaluate(t);const l=this.input.evaluate(t);if(l<=n[0])return a[0].evaluate(t);const d=n.length;if(l>=n[d-1])return a[d-1].evaluate(t);const p=po(n,l),m=Ei.interpolationFactor(this.interpolation,l,n[p],n[p+1]),y=a[p].evaluate(t),v=a[p+1].evaluate(t);switch(this.operator){case"interpolate":switch(this.type.kind){case"number":return Kr(y,v,m);case"color":return yt.interpolate(y,v,m);case"padding":return bi.interpolate(y,v,m);case"variableAnchorOffsetCollection":return Li.interpolate(y,v,m);case"array":return Aa(y,v,m);case"projectionDefinition":return ci.interpolate(y,v,m)}case"interpolate-hcl":return yt.interpolate(y,v,m,"hcl");case"interpolate-lab":return yt.interpolate(y,v,m,"lab")}}eachChild(t){t(this.input);for(const n of this.outputs)t(n)}outputDefined(){return this.outputs.every(t=>t.outputDefined())}}function ni(r,t,n,a){const l=a-n,d=r-n;return l===0?0:t===1?d/l:(Math.pow(t,d)-1)/(Math.pow(t,l)-1)}const xr={color:yt.interpolate,number:Kr,padding:bi.interpolate,variableAnchorOffsetCollection:Li.interpolate,array:Aa};class Oa{constructor(t,n){this.type=t,this.args=n}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");let a=null;const l=n.expectedType;l&&l.kind!=="value"&&(a=l);const d=[];for(const m of t.slice(1)){const y=n.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=l&&d.some(m=>Ea(l,m.type));return new Oa(p?it:a,d)}evaluate(t){let n,a=null,l=0;for(const d of this.args)if(l++,a=d.evaluate(t),a&&a instanceof Zi&&!a.available&&(n||(n=a.name),a=null,l===this.args.length&&(a=n)),a!==null)break;return a}eachChild(t){this.args.forEach(t)}outputDefined(){return this.args.every(t=>t.outputDefined())}}function Ml(r,t){return r==="=="||r==="!="?t.kind==="boolean"||t.kind==="string"||t.kind==="number"||t.kind==="null"||t.kind==="value":t.kind==="string"||t.kind==="number"||t.kind==="value"}function gu(r,t,n,a){return a.compare(t,n)===0}function Xr(r,t,n){const a=r!=="=="&&r!=="!=";return class Cm{constructor(d,p,m){this.type=Oe,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,it);if(!y)return null;if(!Ml(m,y.type))return p.concat(1).error(`"${m}" comparisons are not supported for type '${Vt(y.type)}'.`);let v=p.parse(d[2],2,it);if(!v)return null;if(!Ml(m,v.type))return p.concat(2).error(`"${m}" comparisons are not supported for type '${Vt(v.type)}'.`);if(y.type.kind!==v.type.kind&&y.type.kind!=="value"&&v.type.kind!=="value")return p.error(`Cannot compare types '${Vt(y.type)}' and '${Vt(v.type)}'.`);a&&(y.type.kind==="value"&&v.type.kind!=="value"?y=new Vi(v.type,[y]):y.type.kind!=="value"&&v.type.kind==="value"&&(v=new Vi(y.type,[v])));let P=null;if(d.length===4){if(y.type.kind!=="string"&&v.type.kind!=="string"&&y.type.kind!=="value"&&v.type.kind!=="value")return p.error("Cannot use collator to compare non-string types.");if(P=p.parse(d[3],3,li),!P)return null}return new Cm(y,v,P)}evaluate(d){const p=this.lhs.evaluate(d),m=this.rhs.evaluate(d);if(a&&this.hasUntypedArgument){const y=Nt(p),v=Nt(m);if(y.kind!==v.kind||y.kind!=="string"&&y.kind!=="number")throw new jt(`Expected arguments for "${r}" to be (string, string) or (number, number), but found (${y.kind}, ${v.kind}) instead.`)}if(this.collator&&!a&&this.hasUntypedArgument){const y=Nt(p),v=Nt(m);if(y.kind!=="string"||v.kind!=="string")return t(d,p,m)}return this.collator?n(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 Il=Xr("==",function(r,t,n){return t===n},gu),jh=Xr("!=",function(r,t,n){return t!==n},function(r,t,n,a){return!gu(0,t,n,a)}),mo=Xr("<",function(r,t,n){return t<n},function(r,t,n,a){return a.compare(t,n)<0}),go=Xr(">",function(r,t,n){return t>n},function(r,t,n,a){return a.compare(t,n)>0}),vr=Xr("<=",function(r,t,n){return t<=n},function(r,t,n,a){return a.compare(t,n)<=0}),_u=Xr(">=",function(r,t,n){return t>=n},function(r,t,n,a){return a.compare(t,n)>=0});class Xn{constructor(t,n,a){this.type=li,this.locale=a,this.caseSensitive=t,this.diacriticSensitive=n}static parse(t,n){if(t.length!==2)return n.error("Expected one argument.");const a=t[1];if(typeof a!="object"||Array.isArray(a))return n.error("Collator options argument must be an object.");const l=n.parse(a["case-sensitive"]!==void 0&&a["case-sensitive"],1,Oe);if(!l)return null;const d=n.parse(a["diacritic-sensitive"]!==void 0&&a["diacritic-sensitive"],1,Oe);if(!d)return null;let p=null;return a.locale&&(p=n.parse(a.locale,1,qe),!p)?null:new Xn(l,d,p)}evaluate(t){return new ar(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 Cl{constructor(t,n,a,l,d){this.type=qe,this.number=t,this.locale=n,this.currency=a,this.minFractionDigits=l,this.maxFractionDigits=d}static parse(t,n){if(t.length!==3)return n.error("Expected two arguments.");const a=n.parse(t[1],1,ze);if(!a)return null;const l=t[2];if(typeof l!="object"||Array.isArray(l))return n.error("NumberFormat options argument must be an object.");let d=null;if(l.locale&&(d=n.parse(l.locale,1,qe),!d))return null;let p=null;if(l.currency&&(p=n.parse(l.currency,1,qe),!p))return null;let m=null;if(l["min-fraction-digits"]&&(m=n.parse(l["min-fraction-digits"],1,ze),!m))return null;let y=null;return l["max-fraction-digits"]&&(y=n.parse(l["max-fraction-digits"],1,ze),!y)?null:new Cl(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 ja{constructor(t){this.type=Dt,this.sections=t}static parse(t,n){if(t.length<2)return n.error("Expected at least one argument.");const a=t[1];if(!Array.isArray(a)&&typeof a=="object")return n.error("First argument must be an image or text section.");const l=[];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=n.parse(m["font-scale"],1,ze),!y))return null;let v=null;if(m["text-font"]&&(v=n.parse(m["text-font"],1,Ni(qe)),!v))return null;let P=null;if(m["text-color"]&&(P=n.parse(m["text-color"],1,st),!P))return null;let S=null;if(m["vertical-align"]){if(typeof m["vertical-align"]=="string"&&!bs.includes(m["vertical-align"]))return n.error(`'vertical-align' must be one of: 'bottom', 'center', 'top' but found '${m["vertical-align"]}' instead.`);if(S=n.parse(m["vertical-align"],1,qe),!S)return null}const k=l[l.length-1];k.scale=y,k.font=v,k.textColor=P,k.verticalAlign=S}else{const y=n.parse(t[p],1,it);if(!y)return null;const v=y.type.kind;if(v!=="string"&&v!=="value"&&v!=="null"&&v!=="resolvedImage")return n.error("Formatted text type must be 'string', 'value', 'image' or 'null'.");d=!0,l.push({content:y,scale:null,font:null,textColor:null,verticalAlign:null})}}return new ja(l)}evaluate(t){return new Di(this.sections.map(n=>{const a=n.content.evaluate(t);return Nt(a)===Ca?new Ra("",a,null,null,null,n.verticalAlign?n.verticalAlign.evaluate(t):null):new Ra(Da(a),null,n.scale?n.scale.evaluate(t):null,n.font?n.font.evaluate(t).join(","):null,n.textColor?n.textColor.evaluate(t):null,n.verticalAlign?n.verticalAlign.evaluate(t):null)}))}eachChild(t){for(const n of this.sections)t(n.content),n.scale&&t(n.scale),n.font&&t(n.font),n.textColor&&t(n.textColor),n.verticalAlign&&t(n.verticalAlign)}outputDefined(){return!1}}class El{constructor(t){this.type=Ca,this.input=t}static parse(t,n){if(t.length!==2)return n.error("Expected two arguments.");const a=n.parse(t[1],1,qe);return a?new El(a):n.error("No image name provided.")}evaluate(t){const n=this.input.evaluate(t),a=Zi.fromString(n);return a&&t.availableImages&&(a.available=t.availableImages.indexOf(n)>-1),a}eachChild(t){t(this.input)}outputDefined(){return!1}}class zl{constructor(t){this.type=ze,this.input=t}static parse(t,n){if(t.length!==2)return n.error(`Expected 1 argument, but found ${t.length-1} instead.`);const a=n.parse(t[1],1);return a?a.type.kind!=="array"&&a.type.kind!=="string"&&a.type.kind!=="value"?n.error(`Expected argument of type string or array, but found ${Vt(a.type)} instead.`):new zl(a):null}evaluate(t){const n=this.input.evaluate(t);if(typeof n=="string")return[...n].length;if(Array.isArray(n))return n.length;throw new jt(`Expected value to be of type string or array, but found ${Vt(Nt(n))} instead.`)}eachChild(t){t(this.input)}outputDefined(){return!1}}const kr=8192;function Nh(r,t){const n=(180+r[0])/360,a=(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r[1]*Math.PI/360)))/360,l=Math.pow(2,t.z);return[Math.round(n*l*kr),Math.round(a*l*kr)]}function Na(r,t){const n=Math.pow(2,t.z);return[(l=(r[0]/kr+t.x)/n,360*l-180),(a=(r[1]/kr+t.y)/n,360/Math.PI*Math.atan(Math.exp((180-360*a)*Math.PI/180))-90)];var a,l}function Is(r,t){r[0]=Math.min(r[0],t[0]),r[1]=Math.min(r[1],t[1]),r[2]=Math.max(r[2],t[0]),r[3]=Math.max(r[3],t[1])}function Za(r,t){return!(r[0]<=t[0]||r[2]>=t[2]||r[1]<=t[1]||r[3]>=t[3])}function yu(r,t,n){const a=r[0]-t[0],l=r[1]-t[1],d=r[0]-n[0],p=r[1]-n[1];return a*p-d*l==0&&a*d<=0&&l*p<=0}function _o(r,t,n,a){return(l=[a[0]-n[0],a[1]-n[1]])[0]*(d=[t[0]-r[0],t[1]-r[1]])[1]-l[1]*d[0]!=0&&!(!bu(r,t,n,a)||!bu(n,a,r,t));var l,d}function xu(r,t,n){for(const a of n)for(let l=0;l<a.length-1;++l)if(_o(r,t,a[l],a[l+1]))return!0;return!1}function Va(r,t,n=!1){let a=!1;for(const m of t)for(let y=0;y<m.length-1;y++){if(yu(r,m[y],m[y+1]))return n;(d=m[y])[1]>(l=r)[1]!=(p=m[y+1])[1]>l[1]&&l[0]<(p[0]-d[0])*(l[1]-d[1])/(p[1]-d[1])+d[0]&&(a=!a)}var l,d,p;return a}function Zh(r,t){for(const n of t)if(Va(r,n))return!0;return!1}function vu(r,t){for(const n of r)if(!Va(n,t))return!1;for(let n=0;n<r.length-1;++n)if(xu(r[n],r[n+1],t))return!1;return!0}function Vh(r,t){for(const n of t)if(vu(r,n))return!0;return!1}function bu(r,t,n,a){const l=a[0]-n[0],d=a[1]-n[1],p=(r[0]-n[0])*d-l*(r[1]-n[1]),m=(t[0]-n[0])*d-l*(t[1]-n[1]);return p>0&&m<0||p<0&&m>0}function yo(r,t,n){const a=[];for(let l=0;l<r.length;l++){const d=[];for(let p=0;p<r[l].length;p++){const m=Nh(r[l][p],n);Is(t,m),d.push(m)}a.push(d)}return a}function kl(r,t,n){const a=[];for(let l=0;l<r.length;l++){const d=yo(r[l],t,n);a.push(d)}return a}function Al(r,t,n,a){if(r[0]<n[0]||r[0]>n[2]){const l=.5*a;let d=r[0]-n[0]>l?-a:n[0]-r[0]>l?a:0;d===0&&(d=r[0]-n[2]>l?-a:n[2]-r[0]>l?a:0),r[0]+=d}Is(t,r)}function wu(r,t,n,a){const l=Math.pow(2,a.z)*kr,d=[a.x*kr,a.y*kr],p=[];for(const m of r)for(const y of m){const v=[y.x+d[0],y.y+d[1]];Al(v,t,n,l),p.push(v)}return p}function Tu(r,t,n,a){const l=Math.pow(2,a.z)*kr,d=[a.x*kr,a.y*kr],p=[];for(const y of r){const v=[];for(const P of y){const S=[P.x+d[0],P.y+d[1]];Is(t,S),v.push(S)}p.push(v)}if(t[2]-t[0]<=l/2){(m=t)[0]=m[1]=1/0,m[2]=m[3]=-1/0;for(const y of p)for(const v of y)Al(v,t,n,l)}var m;return p}class Yn{constructor(t,n){this.type=Oe,this.geojson=t,this.geometries=n}static parse(t,n){if(t.length!==2)return n.error(`'within' expression requires exactly one argument, but found ${t.length-1} instead.`);if(wn(t[1])){const a=t[1];if(a.type==="FeatureCollection"){const l=[];for(const d of a.features){const{type:p,coordinates:m}=d.geometry;p==="Polygon"&&l.push(m),p==="MultiPolygon"&&l.push(...m)}if(l.length)return new Yn(a,{type:"MultiPolygon",coordinates:l})}else if(a.type==="Feature"){const l=a.geometry.type;if(l==="Polygon"||l==="MultiPolygon")return new Yn(a,a.geometry)}else if(a.type==="Polygon"||a.type==="MultiPolygon")return new Yn(a,a)}return n.error("'within' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(n,a){const l=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=n.canonicalID();if(a.type==="Polygon"){const m=yo(a.coordinates,d,p),y=wu(n.geometry(),l,d,p);if(!Za(l,d))return!1;for(const v of y)if(!Va(v,m))return!1}if(a.type==="MultiPolygon"){const m=kl(a.coordinates,d,p),y=wu(n.geometry(),l,d,p);if(!Za(l,d))return!1;for(const v of y)if(!Zh(v,m))return!1}return!0}(t,this.geometries);if(t.geometryType()==="LineString")return function(n,a){const l=[1/0,1/0,-1/0,-1/0],d=[1/0,1/0,-1/0,-1/0],p=n.canonicalID();if(a.type==="Polygon"){const m=yo(a.coordinates,d,p),y=Tu(n.geometry(),l,d,p);if(!Za(l,d))return!1;for(const v of y)if(!vu(v,m))return!1}if(a.type==="MultiPolygon"){const m=kl(a.coordinates,d,p),y=Tu(n.geometry(),l,d,p);if(!Za(l,d))return!1;for(const v of y)if(!Vh(v,m))return!1}return!0}(t,this.geometries)}return!1}eachChild(){}outputDefined(){return!0}}let xo=class{constructor(r=[],t=(n,a)=>n<a?-1:n>a?1:0){if(this.data=r,this.length=this.data.length,this.compare=t,this.length>0)for(let n=(this.length>>1)-1;n>=0;n--)this._down(n)}push(r){this.data.push(r),this._up(this.length++)}pop(){if(this.length===0)return;const r=this.data[0],t=this.data.pop();return--this.length>0&&(this.data[0]=t,this._down(0)),r}peek(){return this.data[0]}_up(r){const{data:t,compare:n}=this,a=t[r];for(;r>0;){const l=r-1>>1,d=t[l];if(n(a,d)>=0)break;t[r]=d,r=l}t[r]=a}_down(r){const{data:t,compare:n}=this,a=this.length>>1,l=t[r];for(;r<a;){let d=1+(r<<1);const p=d+1;if(p<this.length&&n(t[p],t[d])<0&&(d=p),n(t[d],l)>=0)break;t[r]=t[d],r=d}t[r]=l}};function Pu(r,t,n=0,a=r.length-1,l=Uh){for(;a>n;){if(a-n>600){const y=a-n+1,v=t-n+1,P=Math.log(y),S=.5*Math.exp(2*P/3),k=.5*Math.sqrt(P*S*(y-S)/y)*(v-y/2<0?-1:1);Pu(r,t,Math.max(n,Math.floor(t-v*S/y+k)),Math.min(a,Math.floor(t+(y-v)*S/y+k)),l)}const d=r[t];let p=n,m=a;for(Cs(r,n,t),l(r[a],d)>0&&Cs(r,n,a);p<m;){for(Cs(r,p,m),p++,m--;l(r[p],d)<0;)p++;for(;l(r[m],d)>0;)m--}l(r[n],d)===0?Cs(r,n,m):(m++,Cs(r,m,a)),m<=t&&(n=m+1),t<=m&&(a=m-1)}}function Cs(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function Uh(r,t){return r<t?-1:r>t?1:0}function Es(r,t){if(r.length<=1)return[r];const n=[];let a,l;for(const d of r){const p=$h(d);p!==0&&(d.area=Math.abs(p),l===void 0&&(l=p<0),l===p<0?(a&&n.push(a),a=[d]):a.push(d))}if(a&&n.push(a),t>1)for(let d=0;d<n.length;d++)n[d].length<=t||(Pu(n[d],t,1,n[d].length-1,Su),n[d]=n[d].slice(0,t));return n}function Su(r,t){return t.area-r.area}function $h(r){let t=0;for(let n,a,l=0,d=r.length,p=d-1;l<d;p=l++)n=r[l],a=r[p],t+=(a.x-n.x)*(n.y+a.y);return t}const Mu=1/298.257223563,Rl=Mu*(2-Mu),Dl=Math.PI/180;class Ll{constructor(t){const n=6378.137*Dl*1e3,a=Math.cos(t*Dl),l=1/(1-Rl*(1-a*a)),d=Math.sqrt(l);this.kx=n*d*a,this.ky=n*d*l*(1-Rl)}distance(t,n){const a=this.wrap(t[0]-n[0])*this.kx,l=(t[1]-n[1])*this.ky;return Math.sqrt(a*a+l*l)}pointOnLine(t,n){let a,l,d,p,m=1/0;for(let y=0;y<t.length-1;y++){let v=t[y][0],P=t[y][1],S=this.wrap(t[y+1][0]-v)*this.kx,k=(t[y+1][1]-P)*this.ky,R=0;S===0&&k===0||(R=(this.wrap(n[0]-v)*this.kx*S+(n[1]-P)*this.ky*k)/(S*S+k*k),R>1?(v=t[y+1][0],P=t[y+1][1]):R>0&&(v+=S/this.kx*R,P+=k/this.ky*R)),S=this.wrap(n[0]-v)*this.kx,k=(n[1]-P)*this.ky;const L=S*S+k*k;L<m&&(m=L,a=v,l=P,d=y,p=R)}return{point:[a,l],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 Iu(r,t){return t[0]-r[0]}function vo(r){return r[1]-r[0]+1}function Ar(r,t){return r[1]>=r[0]&&r[1]<t}function Fl(r,t){if(r[0]>r[1])return[null,null];const n=vo(r);if(t){if(n===2)return[r,null];const l=Math.floor(n/2);return[[r[0],r[0]+l],[r[0]+l,r[1]]]}if(n===1)return[r,null];const a=Math.floor(n/2)-1;return[[r[0],r[0]+a],[r[0]+a+1,r[1]]]}function Bl(r,t){if(!Ar(t,r.length))return[1/0,1/0,-1/0,-1/0];const n=[1/0,1/0,-1/0,-1/0];for(let a=t[0];a<=t[1];++a)Is(n,r[a]);return n}function Ol(r){const t=[1/0,1/0,-1/0,-1/0];for(const n of r)for(const a of n)Is(t,a);return t}function Cu(r){return r[0]!==-1/0&&r[1]!==-1/0&&r[2]!==1/0&&r[3]!==1/0}function bt(r,t,n){if(!Cu(r)||!Cu(t))return NaN;let a=0,l=0;return r[2]<t[0]&&(a=t[0]-r[2]),r[0]>t[2]&&(a=r[0]-t[2]),r[1]>t[3]&&(l=r[1]-t[3]),r[3]<t[1]&&(l=t[1]-r[3]),n.distance([0,0],[a,l])}function Jn(r,t,n){const a=n.pointOnLine(t,r);return n.distance(r,a.point)}function jl(r,t,n,a,l){const d=Math.min(Jn(r,[n,a],l),Jn(t,[n,a],l)),p=Math.min(Jn(n,[r,t],l),Jn(a,[r,t],l));return Math.min(d,p)}function Gh(r,t,n,a,l){if(!Ar(t,r.length)||!Ar(a,n.length))return 1/0;let d=1/0;for(let p=t[0];p<t[1];++p){const m=r[p],y=r[p+1];for(let v=a[0];v<a[1];++v){const P=n[v],S=n[v+1];if(_o(m,y,P,S))return 0;d=Math.min(d,jl(m,y,P,S,l))}}return d}function qh(r,t,n,a,l){if(!Ar(t,r.length)||!Ar(a,n.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,l.distance(r[p],n[m])),d===0)return d;return d}function Wh(r,t,n){if(Va(r,t,!0))return 0;let a=1/0;for(const l of t){const d=l[0],p=l[l.length-1];if(d!==p&&(a=Math.min(a,Jn(r,[p,d],n)),a===0))return a;const m=n.pointOnLine(l,r);if(a=Math.min(a,n.distance(r,m.point)),a===0)return a}return a}function Hh(r,t,n,a){if(!Ar(t,r.length))return NaN;for(let d=t[0];d<=t[1];++d)if(Va(r[d],n,!0))return 0;let l=1/0;for(let d=t[0];d<t[1];++d){const p=r[d],m=r[d+1];for(const y of n)for(let v=0,P=y.length,S=P-1;v<P;S=v++){const k=y[S],R=y[v];if(_o(p,m,k,R))return 0;l=Math.min(l,jl(p,m,k,R,a))}}return l}function Eu(r,t){for(const n of r)for(const a of n)if(Va(a,t,!0))return!0;return!1}function Kh(r,t,n,a=1/0){const l=Ol(r),d=Ol(t);if(a!==1/0&&bt(l,d,n)>=a)return a;if(Za(l,d)){if(Eu(r,t))return 0}else if(Eu(t,r))return 0;let p=1/0;for(const m of r)for(let y=0,v=m.length,P=v-1;y<v;P=y++){const S=m[P],k=m[y];for(const R of t)for(let L=0,O=R.length,$=O-1;L<O;$=L++){const H=R[$],re=R[L];if(_o(S,k,H,re))return 0;p=Math.min(p,jl(S,k,H,re,n))}}return p}function zu(r,t,n,a,l,d){if(!d)return;const p=bt(Bl(a,d),l,n);p<t&&r.push([p,d,[0,0]])}function bo(r,t,n,a,l,d,p){if(!d||!p)return;const m=bt(Bl(a,d),Bl(l,p),n);m<t&&r.push([m,d,p])}function wo(r,t,n,a,l=1/0){let d=Math.min(a.distance(r[0],n[0][0]),l);if(d===0)return d;const p=new xo([[0,[0,r.length-1],[0,0]]],Iu),m=Ol(n);for(;p.length>0;){const y=p.pop();if(y[0]>=d)continue;const v=y[1],P=t?50:100;if(vo(v)<=P){if(!Ar(v,r.length))return NaN;if(t){const S=Hh(r,v,n,a);if(isNaN(S)||S===0)return S;d=Math.min(d,S)}else for(let S=v[0];S<=v[1];++S){const k=Wh(r[S],n,a);if(d=Math.min(d,k),d===0)return 0}}else{const S=Fl(v,t);zu(p,d,a,r,m,S[0]),zu(p,d,a,r,m,S[1])}}return d}function To(r,t,n,a,l,d=1/0){let p=Math.min(d,l.distance(r[0],n[0]));if(p===0)return p;const m=new xo([[0,[0,r.length-1],[0,n.length-1]]],Iu);for(;m.length>0;){const y=m.pop();if(y[0]>=p)continue;const v=y[1],P=y[2],S=t?50:100,k=a?50:100;if(vo(v)<=S&&vo(P)<=k){if(!Ar(v,r.length)&&Ar(P,n.length))return NaN;let R;if(t&&a)R=Gh(r,v,n,P,l),p=Math.min(p,R);else if(t&&!a){const L=r.slice(v[0],v[1]+1);for(let O=P[0];O<=P[1];++O)if(R=Jn(n[O],L,l),p=Math.min(p,R),p===0)return p}else if(!t&&a){const L=n.slice(P[0],P[1]+1);for(let O=v[0];O<=v[1];++O)if(R=Jn(r[O],L,l),p=Math.min(p,R),p===0)return p}else R=qh(r,v,n,P,l),p=Math.min(p,R)}else{const R=Fl(v,t),L=Fl(P,a);bo(m,p,l,r,n,R[0],L[0]),bo(m,p,l,r,n,R[0],L[1]),bo(m,p,l,r,n,R[1],L[0]),bo(m,p,l,r,n,R[1],L[1])}}return p}function Nl(r){return r.type==="MultiPolygon"?r.coordinates.map(t=>({type:"Polygon",coordinates:t})):r.type==="MultiLineString"?r.coordinates.map(t=>({type:"LineString",coordinates:t})):r.type==="MultiPoint"?r.coordinates.map(t=>({type:"Point",coordinates:t})):[r]}class Qn{constructor(t,n){this.type=ze,this.geojson=t,this.geometries=n}static parse(t,n){if(t.length!==2)return n.error(`'distance' expression requires exactly one argument, but found ${t.length-1} instead.`);if(wn(t[1])){const a=t[1];if(a.type==="FeatureCollection")return new Qn(a,a.features.map(l=>Nl(l.geometry)).flat());if(a.type==="Feature")return new Qn(a,Nl(a.geometry));if("type"in a&&"coordinates"in a)return new Qn(a,Nl(a))}return n.error("'distance' expression requires valid geojson object that contains polygon geometry type.")}evaluate(t){if(t.geometry()!=null&&t.canonicalID()!=null){if(t.geometryType()==="Point")return function(n,a){const l=n.geometry(),d=l.flat().map(y=>Na([y.x,y.y],n.canonical));if(l.length===0)return NaN;const p=new Ll(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,To(d,!1,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,To(d,!1,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,wo(d,!1,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="LineString")return function(n,a){const l=n.geometry(),d=l.flat().map(y=>Na([y.x,y.y],n.canonical));if(l.length===0)return NaN;const p=new Ll(d[0][1]);let m=1/0;for(const y of a){switch(y.type){case"Point":m=Math.min(m,To(d,!0,[y.coordinates],!1,p,m));break;case"LineString":m=Math.min(m,To(d,!0,y.coordinates,!0,p,m));break;case"Polygon":m=Math.min(m,wo(d,!0,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries);if(t.geometryType()==="Polygon")return function(n,a){const l=n.geometry();if(l.length===0||l[0].length===0)return NaN;const d=Es(l,0).map(y=>y.map(v=>v.map(P=>Na([P.x,P.y],n.canonical)))),p=new Ll(d[0][0][0][1]);let m=1/0;for(const y of a)for(const v of d){switch(y.type){case"Point":m=Math.min(m,wo([y.coordinates],!1,v,p,m));break;case"LineString":m=Math.min(m,wo(y.coordinates,!0,v,p,m));break;case"Polygon":m=Math.min(m,Kh(v,y.coordinates,p,m))}if(m===0)return m}return m}(t,this.geometries)}return NaN}eachChild(){}outputDefined(){return!0}}const Ua={"==":Il,"!=":jh,">":go,"<":mo,">=":_u,"<=":vr,array:Vi,at:yr,boolean:Vi,case:Ss,coalesce:Oa,collator:Xn,format:ja,image:El,in:Ts,"index-of":Ps,interpolate:Ei,"interpolate-hcl":Ei,"interpolate-lab":Ei,length:zl,let:gt,literal:Tn,match:ho,number:Vi,"number-format":Cl,object:Vi,slice:Ms,step:Ba,string:Vi,"to-boolean":zr,"to-color":zr,"to-number":zr,"to-string":zr,var:Fa,within:Yn,distance:Qn};class sr{constructor(t,n,a,l){this.name=t,this.type=n,this._evaluate=a,this.args=l}evaluate(t){return this._evaluate(t,this.args)}eachChild(t){this.args.forEach(t)}outputDefined(){return!1}static parse(t,n){const a=t[0],l=sr.definitions[a];if(!l)return n.error(`Unknown expression "${a}". If you wanted a literal array, use ["literal", [...]].`,0);const d=Array.isArray(l)?l[0]:l.type,p=Array.isArray(l)?[[l[1],l[2]]]:l.overloads,m=p.filter(([v])=>!Array.isArray(v)||v.length===t.length-1);let y=null;for(const[v,P]of m){y=new La(n.registry,Po,n.path,null,n.scope);const S=[];let k=!1;for(let R=1;R<t.length;R++){const L=t[R],O=Array.isArray(v)?v[R-1]:v.type,$=y.parse(L,1+S.length,O);if(!$){k=!0;break}S.push($)}if(!k)if(Array.isArray(v)&&v.length!==S.length)y.error(`Expected ${v.length} arguments, but found ${S.length} instead.`);else{for(let R=0;R<S.length;R++){const L=Array.isArray(v)?v[R]:v.type,O=S[R];y.concat(R+1).checkSubtype(L,O.type)}if(y.errors.length===0)return new sr(a,d,P,S)}}if(m.length===1)n.errors.push(...y.errors);else{const v=(m.length?m:p).map(([S])=>{return k=S,Array.isArray(k)?`(${k.map(Vt).join(", ")})`:`(${Vt(k.type)}...)`;var k}).join(" | "),P=[];for(let S=1;S<t.length;S++){const k=n.parse(t[S],1+P.length);if(!k)return null;P.push(Vt(k.type))}n.error(`Expected arguments of type ${v}, but found (${P.join(", ")}) instead.`)}return null}static register(t,n){sr.definitions=n;for(const a in n)t[a]=sr}}function ku(r,[t,n,a,l]){t=t.evaluate(r),n=n.evaluate(r),a=a.evaluate(r);const d=l?l.evaluate(r):1,p=pu(t,n,a,d);if(p)throw new jt(p);return new yt(t/255,n/255,a/255,d,!1)}function Au(r,t){return r in t}function Zl(r,t){const n=t[r];return n===void 0?null:n}function ea(r){return{type:r}}function Po(r){if(r instanceof Fa)return Po(r.boundExpression);if(r instanceof sr&&r.name==="error"||r instanceof Xn||r instanceof Yn||r instanceof Qn)return!1;const t=r instanceof zr||r instanceof Vi;let n=!0;return r.eachChild(a=>{n=t?n&&Po(a):n&&a instanceof Tn}),!!n&&So(r)&&Mo(r,["zoom","heatmap-density","line-progress","accumulated","is-supported-script"])}function So(r){if(r instanceof sr&&(r.name==="get"&&r.args.length===1||r.name==="feature-state"||r.name==="has"&&r.args.length===1||r.name==="properties"||r.name==="geometry-type"||r.name==="id"||/^filter-/.test(r.name))||r instanceof Yn||r instanceof Qn)return!1;let t=!0;return r.eachChild(n=>{t&&!So(n)&&(t=!1)}),t}function zs(r){if(r instanceof sr&&r.name==="feature-state")return!1;let t=!0;return r.eachChild(n=>{t&&!zs(n)&&(t=!1)}),t}function Mo(r,t){if(r instanceof sr&&t.indexOf(r.name)>=0)return!1;let n=!0;return r.eachChild(a=>{n&&!Mo(a,t)&&(n=!1)}),n}function Ru(r){return{result:"success",value:r}}function $a(r){return{result:"error",value:r}}function Ga(r){return r["property-type"]==="data-driven"||r["property-type"]==="cross-faded-data-driven"}function Du(r){return!!r.expression&&r.expression.parameters.indexOf("zoom")>-1}function Vl(r){return!!r.expression&&r.expression.interpolated}function xt(r){return r instanceof Number?"number":r instanceof String?"string":r instanceof Boolean?"boolean":Array.isArray(r)?"array":r===null?"null":typeof r}function Io(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function Ul(r){return r}function Lu(r,t){const n=t.type==="color",a=r.stops&&typeof r.stops[0][0]=="object",l=a||!(a||r.property!==void 0),d=r.type||(Vl(t)?"exponential":"interval");if(n||t.type==="padding"){const P=n?yt.parse:bi.parse;(r=nt({},r)).stops&&(r.stops=r.stops.map(S=>[S[0],P(S[1])])),r.default=P(r.default?r.default:t.default)}if(r.colorSpace&&(p=r.colorSpace)!=="rgb"&&p!=="hcl"&&p!=="lab")throw new Error(`Unknown color space: "${r.colorSpace}"`);var p;let m,y,v;if(d==="exponential")m=Bu;else if(d==="interval")m=Fu;else if(d==="categorical"){m=Xh,y=Object.create(null);for(const P of r.stops)y[P[0]]=P[1];v=typeof r.stops[0][0]}else{if(d!=="identity")throw new Error(`Unknown function type "${d}"`);m=Yh}if(a){const P={},S=[];for(let L=0;L<r.stops.length;L++){const O=r.stops[L],$=O[0].zoom;P[$]===void 0&&(P[$]={zoom:$,type:r.type,property:r.property,default:r.default,stops:[]},S.push($)),P[$].stops.push([O[0].value,O[1]])}const k=[];for(const L of S)k.push([P[L].zoom,Lu(P[L],t)]);const R={name:"linear"};return{kind:"composite",interpolationType:R,interpolationFactor:Ei.interpolationFactor.bind(void 0,R),zoomStops:k.map(L=>L[0]),evaluate:({zoom:L},O)=>Bu({stops:k,base:r.base},t,L).evaluate(L,O)}}if(l){const P=d==="exponential"?{name:"exponential",base:r.base!==void 0?r.base:1}:null;return{kind:"camera",interpolationType:P,interpolationFactor:Ei.interpolationFactor.bind(void 0,P),zoomStops:r.stops.map(S=>S[0]),evaluate:({zoom:S})=>m(r,t,S,y,v)}}return{kind:"source",evaluate(P,S){const k=S&&S.properties?S.properties[r.property]:void 0;return k===void 0?ks(r.default,t.default):m(r,t,k,y,v)}}}function ks(r,t,n){return r!==void 0?r:t!==void 0?t:n!==void 0?n:void 0}function Xh(r,t,n,a,l){return ks(typeof n===l?a[n]:void 0,r.default,t.default)}function Fu(r,t,n){if(xt(n)!=="number")return ks(r.default,t.default);const a=r.stops.length;if(a===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[a-1][0])return r.stops[a-1][1];const l=po(r.stops.map(d=>d[0]),n);return r.stops[l][1]}function Bu(r,t,n){const a=r.base!==void 0?r.base:1;if(xt(n)!=="number")return ks(r.default,t.default);const l=r.stops.length;if(l===1||n<=r.stops[0][0])return r.stops[0][1];if(n>=r.stops[l-1][0])return r.stops[l-1][1];const d=po(r.stops.map(P=>P[0]),n),p=function(P,S,k,R){const L=R-k,O=P-k;return L===0?0:S===1?O/L:(Math.pow(S,O)-1)/(Math.pow(S,L)-1)}(n,a,r.stops[d][0],r.stops[d+1][0]),m=r.stops[d][1],y=r.stops[d+1][1],v=xr[t.type]||Ul;return typeof m.evaluate=="function"?{evaluate(...P){const S=m.evaluate.apply(void 0,P),k=y.evaluate.apply(void 0,P);if(S!==void 0&&k!==void 0)return v(S,k,p,r.colorSpace)}}:v(m,y,p,r.colorSpace)}function Yh(r,t,n){switch(t.type){case"color":n=yt.parse(n);break;case"formatted":n=Di.fromString(n.toString());break;case"resolvedImage":n=Zi.fromString(n.toString());break;case"padding":n=bi.parse(n);break;default:xt(n)===t.type||t.type==="enum"&&t.values[n]||(n=void 0)}return ks(n,r.default,t.default)}sr.register(Ua,{error:[{kind:"error"},[qe],(r,[t])=>{throw new jt(t.evaluate(r))}],typeof:[qe,[it],(r,[t])=>Vt(Nt(t.evaluate(r)))],"to-rgba":[Ni(ze,4),[st],(r,[t])=>{const[n,a,l,d]=t.evaluate(r).rgb;return[255*n,255*a,255*l,d]}],rgb:[st,[ze,ze,ze],ku],rgba:[st,[ze,ze,ze,ze],ku],has:{type:Oe,overloads:[[[qe],(r,[t])=>Au(t.evaluate(r),r.properties())],[[qe,Hr],(r,[t,n])=>Au(t.evaluate(r),n.evaluate(r))]]},get:{type:it,overloads:[[[qe],(r,[t])=>Zl(t.evaluate(r),r.properties())],[[qe,Hr],(r,[t,n])=>Zl(t.evaluate(r),n.evaluate(r))]]},"feature-state":[it,[qe],(r,[t])=>Zl(t.evaluate(r),r.featureState||{})],properties:[Hr,[],r=>r.properties()],"geometry-type":[qe,[],r=>r.geometryType()],id:[it,[],r=>r.id()],zoom:[ze,[],r=>r.globals.zoom],"heatmap-density":[ze,[],r=>r.globals.heatmapDensity||0],"line-progress":[ze,[],r=>r.globals.lineProgress||0],accumulated:[it,[],r=>r.globals.accumulated===void 0?null:r.globals.accumulated],"+":[ze,ea(ze),(r,t)=>{let n=0;for(const a of t)n+=a.evaluate(r);return n}],"*":[ze,ea(ze),(r,t)=>{let n=1;for(const a of t)n*=a.evaluate(r);return n}],"-":{type:ze,overloads:[[[ze,ze],(r,[t,n])=>t.evaluate(r)-n.evaluate(r)],[[ze],(r,[t])=>-t.evaluate(r)]]},"/":[ze,[ze,ze],(r,[t,n])=>t.evaluate(r)/n.evaluate(r)],"%":[ze,[ze,ze],(r,[t,n])=>t.evaluate(r)%n.evaluate(r)],ln2:[ze,[],()=>Math.LN2],pi:[ze,[],()=>Math.PI],e:[ze,[],()=>Math.E],"^":[ze,[ze,ze],(r,[t,n])=>Math.pow(t.evaluate(r),n.evaluate(r))],sqrt:[ze,[ze],(r,[t])=>Math.sqrt(t.evaluate(r))],log10:[ze,[ze],(r,[t])=>Math.log(t.evaluate(r))/Math.LN10],ln:[ze,[ze],(r,[t])=>Math.log(t.evaluate(r))],log2:[ze,[ze],(r,[t])=>Math.log(t.evaluate(r))/Math.LN2],sin:[ze,[ze],(r,[t])=>Math.sin(t.evaluate(r))],cos:[ze,[ze],(r,[t])=>Math.cos(t.evaluate(r))],tan:[ze,[ze],(r,[t])=>Math.tan(t.evaluate(r))],asin:[ze,[ze],(r,[t])=>Math.asin(t.evaluate(r))],acos:[ze,[ze],(r,[t])=>Math.acos(t.evaluate(r))],atan:[ze,[ze],(r,[t])=>Math.atan(t.evaluate(r))],min:[ze,ea(ze),(r,t)=>Math.min(...t.map(n=>n.evaluate(r)))],max:[ze,ea(ze),(r,t)=>Math.max(...t.map(n=>n.evaluate(r)))],abs:[ze,[ze],(r,[t])=>Math.abs(t.evaluate(r))],round:[ze,[ze],(r,[t])=>{const n=t.evaluate(r);return n<0?-Math.round(-n):Math.round(n)}],floor:[ze,[ze],(r,[t])=>Math.floor(t.evaluate(r))],ceil:[ze,[ze],(r,[t])=>Math.ceil(t.evaluate(r))],"filter-==":[Oe,[qe,it],(r,[t,n])=>r.properties()[t.value]===n.value],"filter-id-==":[Oe,[it],(r,[t])=>r.id()===t.value],"filter-type-==":[Oe,[qe],(r,[t])=>r.geometryType()===t.value],"filter-<":[Oe,[qe,it],(r,[t,n])=>{const a=r.properties()[t.value],l=n.value;return typeof a==typeof l&&a<l}],"filter-id-<":[Oe,[it],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n<a}],"filter->":[Oe,[qe,it],(r,[t,n])=>{const a=r.properties()[t.value],l=n.value;return typeof a==typeof l&&a>l}],"filter-id->":[Oe,[it],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n>a}],"filter-<=":[Oe,[qe,it],(r,[t,n])=>{const a=r.properties()[t.value],l=n.value;return typeof a==typeof l&&a<=l}],"filter-id-<=":[Oe,[it],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n<=a}],"filter->=":[Oe,[qe,it],(r,[t,n])=>{const a=r.properties()[t.value],l=n.value;return typeof a==typeof l&&a>=l}],"filter-id->=":[Oe,[it],(r,[t])=>{const n=r.id(),a=t.value;return typeof n==typeof a&&n>=a}],"filter-has":[Oe,[it],(r,[t])=>t.value in r.properties()],"filter-has-id":[Oe,[],r=>r.id()!==null&&r.id()!==void 0],"filter-type-in":[Oe,[Ni(qe)],(r,[t])=>t.value.indexOf(r.geometryType())>=0],"filter-id-in":[Oe,[Ni(it)],(r,[t])=>t.value.indexOf(r.id())>=0],"filter-in-small":[Oe,[qe,Ni(it)],(r,[t,n])=>n.value.indexOf(r.properties()[t.value])>=0],"filter-in-large":[Oe,[qe,Ni(it)],(r,[t,n])=>function(a,l,d,p){for(;d<=p;){const m=d+p>>1;if(l[m]===a)return!0;l[m]>a?p=m-1:d=m+1}return!1}(r.properties()[t.value],n.value,0,n.value.length-1)],all:{type:Oe,overloads:[[[Oe,Oe],(r,[t,n])=>t.evaluate(r)&&n.evaluate(r)],[ea(Oe),(r,t)=>{for(const n of t)if(!n.evaluate(r))return!1;return!0}]]},any:{type:Oe,overloads:[[[Oe,Oe],(r,[t,n])=>t.evaluate(r)||n.evaluate(r)],[ea(Oe),(r,t)=>{for(const n of t)if(n.evaluate(r))return!0;return!1}]]},"!":[Oe,[Oe],(r,[t])=>!t.evaluate(r)],"is-supported-script":[Oe,[qe],(r,[t])=>{const n=r.globals&&r.globals.isSupportedScript;return!n||n(t.evaluate(r))}],upcase:[qe,[qe],(r,[t])=>t.evaluate(r).toUpperCase()],downcase:[qe,[qe],(r,[t])=>t.evaluate(r).toLowerCase()],concat:[qe,ea(it),(r,t)=>t.map(n=>Da(n.evaluate(r))).join("")],"resolved-locale":[qe,[li],(r,[t])=>t.evaluate(r).resolvedLocale()]});class qa{constructor(t,n){var a;this.expression=t,this._warningHistory={},this._evaluator=new ct,this._defaultValue=n?(a=n).type==="color"&&Io(a.default)?new yt(0,0,0,0):a.type==="color"?yt.parse(a.default)||null:a.type==="padding"?bi.parse(a.default)||null:a.type==="variableAnchorOffsetCollection"?Li.parse(a.default)||null:a.type==="projectionDefinition"?ci.parse(a.default)||null:a.default===void 0?null:a.default:null,this._enumValues=n&&n.type==="enum"?n.values:null}evaluateWithoutErrorHandling(t,n,a,l,d,p){return this._evaluator.globals=t,this._evaluator.feature=n,this._evaluator.featureState=a,this._evaluator.canonical=l,this._evaluator.availableImages=d||null,this._evaluator.formattedSection=p,this.expression.evaluate(this._evaluator)}evaluate(t,n,a,l,d,p){this._evaluator.globals=t,this._evaluator.feature=n||null,this._evaluator.featureState=a||null,this._evaluator.canonical=l,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 jt(`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 As(r){return Array.isArray(r)&&r.length>0&&typeof r[0]=="string"&&r[0]in Ua}function Co(r,t){const n=new La(Ua,Po,[],t?function(l){const d={color:st,string:qe,number:ze,enum:qe,boolean:Oe,formatted:Dt,padding:lo,projectionDefinition:$t,resolvedImage:Ca,variableAnchorOffsetCollection:xn};return l.type==="array"?Ni(d[l.value]||it,l.length):d[l.type]}(t):void 0),a=n.parse(r,void 0,void 0,void 0,t&&t.type==="string"?{typeAnnotation:"coerce"}:void 0);return a?Ru(new qa(a,t)):$a(n.errors)}class $l{constructor(t,n){this.kind=t,this._styleExpression=n,this.isStateDependent=t!=="constant"&&!zs(n.expression)}evaluateWithoutErrorHandling(t,n,a,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,n,a,l,d,p)}evaluate(t,n,a,l,d,p){return this._styleExpression.evaluate(t,n,a,l,d,p)}}class Gl{constructor(t,n,a,l){this.kind=t,this.zoomStops=a,this._styleExpression=n,this.isStateDependent=t!=="camera"&&!zs(n.expression),this.interpolationType=l}evaluateWithoutErrorHandling(t,n,a,l,d,p){return this._styleExpression.evaluateWithoutErrorHandling(t,n,a,l,d,p)}evaluate(t,n,a,l,d,p){return this._styleExpression.evaluate(t,n,a,l,d,p)}interpolationFactor(t,n,a){return this.interpolationType?Ei.interpolationFactor(this.interpolationType,t,n,a):0}}function Ou(r,t){const n=Co(r,t);if(n.result==="error")return n;const a=n.value.expression,l=So(a);if(!l&&!Ga(t))return $a([new Je("","data expressions not supported")]);const d=Mo(a,["zoom"]);if(!d&&!Du(t))return $a([new Je("","zoom expressions not supported")]);const p=Rs(a);return p||d?p instanceof Je?$a([p]):p instanceof Ei&&!Vl(t)?$a([new Je("",'"interpolate" expressions cannot be used with this property')]):Ru(p?new Gl(l?"camera":"composite",n.value,p.labels,p instanceof Ei?p.interpolation:void 0):new $l(l?"constant":"source",n.value)):$a([new Je("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.')])}class Eo{constructor(t,n){this._parameters=t,this._specification=n,nt(this,Lu(this._parameters,this._specification))}static deserialize(t){return new Eo(t._parameters,t._specification)}static serialize(t){return{_parameters:t._parameters,_specification:t._specification}}}function Rs(r){let t=null;if(r instanceof gt)t=Rs(r.result);else if(r instanceof Oa){for(const n of r.args)if(t=Rs(n),t)break}else(r instanceof Ba||r instanceof Ei)&&r.input instanceof sr&&r.input.name==="zoom"&&(t=r);return t instanceof Je||r.eachChild(n=>{const a=Rs(n);a instanceof Je?t=a:!t&&a?t=new Je("",'"zoom" expression may only be used as input to a top-level "step" or "interpolate" expression.'):t&&a&&t!==a&&(t=new Je("",'Only one zoom-based "step" or "interpolate" subexpression may be used in an expression.'))}),t}function zo(r){if(r===!0||r===!1)return!0;if(!Array.isArray(r)||r.length===0)return!1;switch(r[0]){case"has":return r.length>=2&&r[1]!=="$id"&&r[1]!=="$type";case"in":return r.length>=3&&(typeof r[1]!="string"||Array.isArray(r[2]));case"!in":case"!has":case"none":return!1;case"==":case"!=":case">":case">=":case"<":case"<=":return r.length!==3||Array.isArray(r[1])||Array.isArray(r[2]);case"any":case"all":for(const t of r.slice(1))if(!zo(t)&&typeof t!="boolean")return!1;return!0;default:return!0}}const Jh={type:"boolean",default:!1,transition:!1,"property-type":"data-driven",expression:{interpolated:!1,parameters:["zoom","feature"]}};function ql(r){if(r==null)return{filter:()=>!0,needGeometry:!1};zo(r)||(r=Ds(r));const t=Co(r,Jh);if(t.result==="error")throw new Error(t.value.map(n=>`${n.key}: ${n.message}`).join(", "));return{filter:(n,a,l)=>t.value.evaluate(n,a,{},l),needGeometry:Wl(r)}}function ju(r,t){return r<t?-1:r>t?1:0}function Wl(r){if(!Array.isArray(r))return!1;if(r[0]==="within"||r[0]==="distance")return!0;for(let t=1;t<r.length;t++)if(Wl(r[t]))return!0;return!1}function Ds(r){if(!r)return!0;const t=r[0];return r.length<=1?t!=="any":t==="=="?ko(r[1],r[2],"=="):t==="!="?Wa(ko(r[1],r[2],"==")):t==="<"||t===">"||t==="<="||t===">="?ko(r[1],r[2],t):t==="any"?(n=r.slice(1),["any"].concat(n.map(Ds))):t==="all"?["all"].concat(r.slice(1).map(Ds)):t==="none"?["all"].concat(r.slice(1).map(Ds).map(Wa)):t==="in"?Ao(r[1],r.slice(2)):t==="!in"?Wa(Ao(r[1],r.slice(2))):t==="has"?Ro(r[1]):t!=="!has"||Wa(Ro(r[1]));var n}function ko(r,t,n){switch(r){case"$type":return[`filter-type-${n}`,t];case"$id":return[`filter-id-${n}`,t];default:return[`filter-${n}`,r,t]}}function Ao(r,t){if(t.length===0)return!1;switch(r){case"$type":return["filter-type-in",["literal",t]];case"$id":return["filter-id-in",["literal",t]];default:return t.length>200&&!t.some(n=>typeof n!=typeof t[0])?["filter-in-large",r,["literal",t.sort(ju)]]:["filter-in-small",r,["literal",t]]}}function Ro(r){switch(r){case"$type":return!0;case"$id":return["filter-has-id"];default:return["filter-has",r]}}function Wa(r){return["!",r]}function Ha(r){const t=typeof r;if(t==="number"||t==="boolean"||t==="string"||r==null)return JSON.stringify(r);if(Array.isArray(r)){let l="[";for(const d of r)l+=`${Ha(d)},`;return`${l}]`}const n=Object.keys(r).sort();let a="{";for(let l=0;l<n.length;l++)a+=`${JSON.stringify(n[l])}:${Ha(r[n[l]])},`;return`${a}}`}function Qh(r){let t="";for(const n of Y)t+=`/${Ha(r[n])}`;return t}function Nu(r){const t=r.value;return t?[new ye(r.key,t,"constants have been deprecated as of v8")]:[]}function Jt(r){return r instanceof Number||r instanceof String||r instanceof Boolean?r.valueOf():r}function ta(r){if(Array.isArray(r))return r.map(ta);if(r instanceof Object&&!(r instanceof Number||r instanceof String||r instanceof Boolean)){const t={};for(const n in r)t[n]=ta(r[n]);return t}return Jt(r)}function or(r){const t=r.key,n=r.value,a=r.valueSpec||{},l=r.objectElementValidators||{},d=r.style,p=r.styleSpec,m=r.validateSpec;let y=[];const v=xt(n);if(v!=="object")return[new ye(t,n,`object expected, ${v} found`)];for(const P in n){const S=P.split(".")[0],k=a[S]||a["*"];let R;if(l[S])R=l[S];else if(a[S])R=m;else if(l["*"])R=l["*"];else{if(!a["*"]){y.push(new ye(t,n[P],`unknown property "${P}"`));continue}R=m}y=y.concat(R({key:(t&&`${t}.`)+P,value:n[P],valueSpec:k,style:d,styleSpec:p,object:n,objectKey:P,validateSpec:m},n))}for(const P in a)l[P]||a[P].required&&a[P].default===void 0&&n[P]===void 0&&y.push(new ye(t,n,`missing required property "${P}"`));return y}function Hl(r){const t=r.value,n=r.valueSpec,a=r.style,l=r.styleSpec,d=r.key,p=r.arrayElementValidator||r.validateSpec;if(xt(t)!=="array")return[new ye(d,t,`array expected, ${xt(t)} found`)];if(n.length&&t.length!==n.length)return[new ye(d,t,`array length ${n.length} expected, length ${t.length} found`)];if(n["min-length"]&&t.length<n["min-length"])return[new ye(d,t,`array length at least ${n["min-length"]} expected, length ${t.length} found`)];let m={type:n.value,values:n.values};l.$version<7&&(m.function=n.function),xt(n.value)==="object"&&(m=n.value);let y=[];for(let v=0;v<t.length;v++)y=y.concat(p({array:t,arrayIndex:v,value:t[v],valueSpec:m,validateSpec:r.validateSpec,style:a,styleSpec:l,key:`${d}[${v}]`}));return y}function Do(r){const t=r.key,n=r.value,a=r.valueSpec;let l=xt(n);return l==="number"&&n!=n&&(l="NaN"),l!=="number"?[new ye(t,n,`number expected, ${l} found`)]:"minimum"in a&&n<a.minimum?[new ye(t,n,`${n} is less than the minimum value ${a.minimum}`)]:"maximum"in a&&n>a.maximum?[new ye(t,n,`${n} is greater than the maximum value ${a.maximum}`)]:[]}function Kl(r){const t=r.valueSpec,n=Jt(r.value.type);let a,l,d,p={};const m=n!=="categorical"&&r.value.property===void 0,y=!m,v=xt(r.value.stops)==="array"&&xt(r.value.stops[0])==="array"&&xt(r.value.stops[0][0])==="object",P=or({key:r.key,value:r.value,valueSpec:r.styleSpec.function,validateSpec:r.validateSpec,style:r.style,styleSpec:r.styleSpec,objectElementValidators:{stops:function(R){if(n==="identity")return[new ye(R.key,R.value,'identity function may not have a "stops" property')];let L=[];const O=R.value;return L=L.concat(Hl({key:R.key,value:O,valueSpec:R.valueSpec,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec,arrayElementValidator:S})),xt(O)==="array"&&O.length===0&&L.push(new ye(R.key,O,"array must have at least one stop")),L},default:function(R){return R.validateSpec({key:R.key,value:R.value,valueSpec:t,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec})}}});return n==="identity"&&m&&P.push(new ye(r.key,r.value,'missing required property "property"')),n==="identity"||r.value.stops||P.push(new ye(r.key,r.value,'missing required property "stops"')),n==="exponential"&&r.valueSpec.expression&&!Vl(r.valueSpec)&&P.push(new ye(r.key,r.value,"exponential functions not supported")),r.styleSpec.$version>=8&&(y&&!Ga(r.valueSpec)?P.push(new ye(r.key,r.value,"property functions not supported")):m&&!Du(r.valueSpec)&&P.push(new ye(r.key,r.value,"zoom functions not supported"))),n!=="categorical"&&!v||r.value.property!==void 0||P.push(new ye(r.key,r.value,'"property" property is required')),P;function S(R){let L=[];const O=R.value,$=R.key;if(xt(O)!=="array")return[new ye($,O,`array expected, ${xt(O)} found`)];if(O.length!==2)return[new ye($,O,`array length 2 expected, length ${O.length} found`)];if(v){if(xt(O[0])!=="object")return[new ye($,O,`object expected, ${xt(O[0])} found`)];if(O[0].zoom===void 0)return[new ye($,O,"object stop key must have zoom")];if(O[0].value===void 0)return[new ye($,O,"object stop key must have value")];if(d&&d>Jt(O[0].zoom))return[new ye($,O[0].zoom,"stop zoom values must appear in ascending order")];Jt(O[0].zoom)!==d&&(d=Jt(O[0].zoom),l=void 0,p={}),L=L.concat(or({key:`${$}[0]`,value:O[0],valueSpec:{zoom:{}},validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec,objectElementValidators:{zoom:Do,value:k}}))}else L=L.concat(k({key:`${$}[0]`,value:O[0],validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec},O));return As(ta(O[1]))?L.concat([new ye(`${$}[1]`,O[1],"expressions are not allowed in function stops.")]):L.concat(R.validateSpec({key:`${$}[1]`,value:O[1],valueSpec:t,validateSpec:R.validateSpec,style:R.style,styleSpec:R.styleSpec}))}function k(R,L){const O=xt(R.value),$=Jt(R.value),H=R.value!==null?R.value:L;if(a){if(O!==a)return[new ye(R.key,H,`${O} stop domain type must match previous stop domain type ${a}`)]}else a=O;if(O!=="number"&&O!=="string"&&O!=="boolean")return[new ye(R.key,H,"stop domain value must be a number, string, or boolean")];if(O!=="number"&&n!=="categorical"){let re=`number expected, ${O} found`;return Ga(t)&&n===void 0&&(re+='\nIf you intended to use a categorical function, specify `"type": "categorical"`.'),[new ye(R.key,H,re)]}return n!=="categorical"||O!=="number"||isFinite($)&&Math.floor($)===$?n!=="categorical"&&O==="number"&&l!==void 0&&$<l?[new ye(R.key,H,"stop domain values must appear in ascending order")]:(l=$,n==="categorical"&&$ in p?[new ye(R.key,H,"stop domain values must be unique")]:(p[$]=!0,[])):[new ye(R.key,H,`integer expected, found ${$}`)]}}function Yr(r){const t=(r.expressionContext==="property"?Ou:Co)(ta(r.value),r.valueSpec);if(t.result==="error")return t.value.map(a=>new ye(`${r.key}${a.key}`,r.value,a.message));const n=t.value.expression||t.value._styleExpression.expression;if(r.expressionContext==="property"&&r.propertyKey==="text-font"&&!n.outputDefined())return[new ye(r.key,r.value,`Invalid data expression for "${r.propertyKey}". Output values must be contained as literals within the expression.`)];if(r.expressionContext==="property"&&r.propertyType==="layout"&&!zs(n))return[new ye(r.key,r.value,'"feature-state" data expressions are not supported with layout properties.')];if(r.expressionContext==="filter"&&!zs(n))return[new ye(r.key,r.value,'"feature-state" data expressions are not supported with filters.')];if(r.expressionContext&&r.expressionContext.indexOf("cluster")===0){if(!Mo(n,["zoom","feature-state"]))return[new ye(r.key,r.value,'"zoom" and "feature-state" expressions are not supported with cluster properties.')];if(r.expressionContext==="cluster-initial"&&!So(n))return[new ye(r.key,r.value,"Feature data expressions are not supported with initial expression part of cluster properties.")]}return[]}function Ls(r){const t=r.key,n=r.value,a=r.valueSpec,l=[];return Array.isArray(a.values)?a.values.indexOf(Jt(n))===-1&&l.push(new ye(t,n,`expected one of [${a.values.join(", ")}], ${JSON.stringify(n)} found`)):Object.keys(a.values).indexOf(Jt(n))===-1&&l.push(new ye(t,n,`expected one of [${Object.keys(a.values).join(", ")}], ${JSON.stringify(n)} found`)),l}function Lo(r){return zo(ta(r.value))?Yr(nt({},r,{expressionContext:"filter",valueSpec:{value:"boolean"}})):Xl(r)}function Xl(r){const t=r.value,n=r.key;if(xt(t)!=="array")return[new ye(n,t,`array expected, ${xt(t)} found`)];const a=r.styleSpec;let l,d=[];if(t.length<1)return[new ye(n,t,"filter array must have at least 1 element")];switch(d=d.concat(Ls({key:`${n}[0]`,value:t[0],valueSpec:a.filter_operator,style:r.style,styleSpec:r.styleSpec})),Jt(t[0])){case"<":case"<=":case">":case">=":t.length>=2&&Jt(t[1])==="$type"&&d.push(new ye(n,t,`"$type" cannot be use with operator "${t[0]}"`));case"==":case"!=":t.length!==3&&d.push(new ye(n,t,`filter array for operator "${t[0]}" must have 3 elements`));case"in":case"!in":t.length>=2&&(l=xt(t[1]),l!=="string"&&d.push(new ye(`${n}[1]`,t[1],`string expected, ${l} found`)));for(let p=2;p<t.length;p++)l=xt(t[p]),Jt(t[1])==="$type"?d=d.concat(Ls({key:`${n}[${p}]`,value:t[p],valueSpec:a.geometry_type,style:r.style,styleSpec:r.styleSpec})):l!=="string"&&l!=="number"&&l!=="boolean"&&d.push(new ye(`${n}[${p}]`,t[p],`string, number, or boolean expected, ${l} found`));break;case"any":case"all":case"none":for(let p=1;p<t.length;p++)d=d.concat(Xl({key:`${n}[${p}]`,value:t[p],style:r.style,styleSpec:r.styleSpec}));break;case"has":case"!has":l=xt(t[1]),t.length!==2?d.push(new ye(n,t,`filter array for "${t[0]}" operator must have 2 elements`)):l!=="string"&&d.push(new ye(`${n}[1]`,t[1],`string expected, ${l} found`))}return d}function Zu(r,t){const n=r.key,a=r.validateSpec,l=r.style,d=r.styleSpec,p=r.value,m=r.objectKey,y=d[`${t}_${r.layerType}`];if(!y)return[];const v=m.match(/^(.*)-transition$/);if(t==="paint"&&v&&y[v[1]]&&y[v[1]].transition)return a({key:n,value:p,valueSpec:d.transition,style:l,styleSpec:d});const P=r.valueSpec||y[m];if(!P)return[new ye(n,p,`unknown property "${m}"`)];let S;if(xt(p)==="string"&&Ga(P)&&!P.tokens&&(S=/^{([^}]+)}$/.exec(p)))return[new ye(n,p,`"${m}" does not support interpolation syntax
5
- Use an identity property function instead: \`{ "type": "identity", "property": ${JSON.stringify(S[1])} }\`.`)];const k=[];return r.layerType==="symbol"&&(m==="text-field"&&l&&!l.glyphs&&k.push(new ye(n,p,'use of "text-field" requires a style "glyphs" property')),m==="text-font"&&Io(ta(p))&&Jt(p.type)==="identity"&&k.push(new ye(n,p,'"text-font" does not support identity functions'))),k.concat(a({key:r.key,value:p,valueSpec:P,style:l,styleSpec:d,expressionContext:"property",propertyType:t,propertyKey:m}))}function Yl(r){return Zu(r,"paint")}function Jl(r){return Zu(r,"layout")}function Ka(r){let t=[];const n=r.value,a=r.key,l=r.style,d=r.styleSpec;n.type||n.ref||t.push(new ye(a,n,'either "type" or "ref" is required'));let p=Jt(n.type);const m=Jt(n.ref);if(n.id){const y=Jt(n.id);for(let v=0;v<r.arrayIndex;v++){const P=l.layers[v];Jt(P.id)===y&&t.push(new ye(a,n.id,`duplicate layer id "${n.id}", previously used at line ${P.id.__line__}`))}}if("ref"in n){let y;["type","source","source-layer","filter","layout"].forEach(v=>{v in n&&t.push(new ye(a,n[v],`"${v}" is prohibited for ref layers`))}),l.layers.forEach(v=>{Jt(v.id)===m&&(y=v)}),y?y.ref?t.push(new ye(a,n.ref,"ref cannot reference another ref layer")):p=Jt(y.type):t.push(new ye(a,n.ref,`ref layer "${m}" not found`))}else if(p!=="background")if(n.source){const y=l.sources&&l.sources[n.source],v=y&&Jt(y.type);y?v==="vector"&&p==="raster"?t.push(new ye(a,n.source,`layer "${n.id}" requires a raster source`)):v!=="raster-dem"&&p==="hillshade"?t.push(new ye(a,n.source,`layer "${n.id}" requires a raster-dem source`)):v==="raster"&&p!=="raster"?t.push(new ye(a,n.source,`layer "${n.id}" requires a vector source`)):v!=="vector"||n["source-layer"]?v==="raster-dem"&&p!=="hillshade"?t.push(new ye(a,n.source,"raster-dem source can only be used with layer type 'hillshade'.")):p!=="line"||!n.paint||!n.paint["line-gradient"]||v==="geojson"&&y.lineMetrics||t.push(new ye(a,n,`layer "${n.id}" specifies a line-gradient, which requires a GeoJSON source with \`lineMetrics\` enabled.`)):t.push(new ye(a,n,`layer "${n.id}" must specify a "source-layer"`)):t.push(new ye(a,n.source,`source "${n.source}" not found`))}else t.push(new ye(a,n,'missing required property "source"'));return t=t.concat(or({key:a,value:n,valueSpec:d.layer,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,objectElementValidators:{"*":()=>[],type:()=>r.validateSpec({key:`${a}.type`,value:n.type,valueSpec:d.layer.type,style:r.style,styleSpec:r.styleSpec,validateSpec:r.validateSpec,object:n,objectKey:"type"}),filter:Lo,layout:y=>or({layer:n,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":v=>Jl(nt({layerType:p},v))}}),paint:y=>or({layer:n,key:y.key,value:y.value,style:y.style,styleSpec:y.styleSpec,validateSpec:y.validateSpec,objectElementValidators:{"*":v=>Yl(nt({layerType:p},v))}})}})),t}function ia(r){const t=r.value,n=r.key,a=xt(t);return a!=="string"?[new ye(n,t,`string expected, ${a} found`)]:[]}const Vu={promoteId:function({key:r,value:t}){if(xt(t)==="string")return ia({key:r,value:t});{const n=[];for(const a in t)n.push(...ia({key:`${r}.${a}`,value:t[a]}));return n}}};function Uu(r){const t=r.value,n=r.key,a=r.styleSpec,l=r.style,d=r.validateSpec;if(!t.type)return[new ye(n,t,'"type" is required')];const p=Jt(t.type);let m;switch(p){case"vector":case"raster":return m=or({key:n,value:t,valueSpec:a[`source_${p.replace("-","_")}`],style:r.style,styleSpec:a,objectElementValidators:Vu,validateSpec:d}),m;case"raster-dem":return m=function(y){var v;const P=(v=y.sourceName)!==null&&v!==void 0?v:"",S=y.value,k=y.styleSpec,R=k.source_raster_dem,L=y.style;let O=[];const $=xt(S);if(S===void 0)return O;if($!=="object")return O.push(new ye("source_raster_dem",S,`object expected, ${$} found`)),O;const H=Jt(S.encoding)==="custom",re=["redFactor","greenFactor","blueFactor","baseShift"],X=y.value.encoding?`"${y.value.encoding}"`:"Default";for(const A in S)!H&&re.includes(A)?O.push(new ye(A,S[A],`In "${P}": "${A}" is only valid when "encoding" is set to "custom". ${X} encoding found`)):R[A]?O=O.concat(y.validateSpec({key:A,value:S[A],valueSpec:R[A],validateSpec:y.validateSpec,style:L,styleSpec:k})):O.push(new ye(A,S[A],`unknown property "${A}"`));return O}({sourceName:n,value:t,style:r.style,styleSpec:a,validateSpec:d}),m;case"geojson":if(m=or({key:n,value:t,valueSpec:a.source_geojson,style:l,styleSpec:a,validateSpec:d,objectElementValidators:Vu}),t.cluster)for(const y in t.clusterProperties){const[v,P]=t.clusterProperties[y],S=typeof v=="string"?[v,["accumulated"],["get",y]]:v;m.push(...Yr({key:`${n}.${y}.map`,value:P,expressionContext:"cluster-map"})),m.push(...Yr({key:`${n}.${y}.reduce`,value:S,expressionContext:"cluster-reduce"}))}return m;case"video":return or({key:n,value:t,valueSpec:a.source_video,style:l,validateSpec:d,styleSpec:a});case"image":return or({key:n,value:t,valueSpec:a.source_image,style:l,validateSpec:d,styleSpec:a});case"canvas":return[new ye(n,null,"Please use runtime APIs to add canvas sources, rather than including them in stylesheets.","source.canvas")];default:return Ls({key:`${n}.type`,value:t.type,valueSpec:{values:["vector","raster","raster-dem","geojson","video","image"]}})}}function $u(r){const t=r.value,n=r.styleSpec,a=n.light,l=r.style;let d=[];const p=xt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new ye("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?r.validateSpec({key:m,value:t[m],valueSpec:n.transition,validateSpec:r.validateSpec,style:l,styleSpec:n}):a[m]?r.validateSpec({key:m,value:t[m],valueSpec:a[m],validateSpec:r.validateSpec,style:l,styleSpec:n}):[new ye(m,t[m],`unknown property "${m}"`)])}return d}function Gu(r){const t=r.value,n=r.styleSpec,a=n.sky,l=r.style,d=xt(t);if(t===void 0)return[];if(d!=="object")return[new ye("sky",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(a[m]?r.validateSpec({key:m,value:t[m],valueSpec:a[m],style:l,styleSpec:n}):[new ye(m,t[m],`unknown property "${m}"`)]);return p}function qu(r){const t=r.value,n=r.styleSpec,a=n.terrain,l=r.style;let d=[];const p=xt(t);if(t===void 0)return d;if(p!=="object")return d=d.concat([new ye("terrain",t,`object expected, ${p} found`)]),d;for(const m in t)d=d.concat(a[m]?r.validateSpec({key:m,value:t[m],valueSpec:a[m],validateSpec:r.validateSpec,style:l,styleSpec:n}):[new ye(m,t[m],`unknown property "${m}"`)]);return d}function Xa(r){let t=[];const n=r.value,a=r.key;if(Array.isArray(n)){const l=[],d=[];for(const p in n)n[p].id&&l.includes(n[p].id)&&t.push(new ye(a,n,`all the sprites' ids must be unique, but ${n[p].id} is duplicated`)),l.push(n[p].id),n[p].url&&d.includes(n[p].url)&&t.push(new ye(a,n,`all the sprites' URLs must be unique, but ${n[p].url} is duplicated`)),d.push(n[p].url),t=t.concat(or({key:`${a}[${p}]`,value:n[p],valueSpec:{id:{type:"string",required:!0},url:{type:"string",required:!0}},validateSpec:r.validateSpec}));return t}return ia({key:a,value:n})}const Ya={"*":()=>[],array:Hl,boolean:function(r){const t=r.value,n=r.key,a=xt(t);return a!=="boolean"?[new ye(n,t,`boolean expected, ${a} found`)]:[]},number:Do,color:function(r){const t=r.key,n=r.value,a=xt(n);return a!=="string"?[new ye(t,n,`color expected, ${a} found`)]:yt.parse(String(n))?[]:[new ye(t,n,`color expected, "${n}" found`)]},constants:Nu,enum:Ls,filter:Lo,function:Kl,layer:Ka,object:or,source:Uu,light:$u,sky:Gu,terrain:qu,projection:function(r){const t=r.value,n=r.styleSpec,a=n.projection,l=r.style,d=xt(t);if(t===void 0)return[];if(d!=="object")return[new ye("projection",t,`object expected, ${d} found`)];let p=[];for(const m in t)p=p.concat(a[m]?r.validateSpec({key:m,value:t[m],valueSpec:a[m],style:l,styleSpec:n}):[new ye(m,t[m],`unknown property "${m}"`)]);return p},projectionDefinition:function(r){const t=r.key;let n=r.value;n=n instanceof String?n.valueOf():n;const a=xt(n);return a!=="array"||function(l){return Array.isArray(l)&&l.length===3&&typeof l[0]=="string"&&typeof l[1]=="string"&&typeof l[2]=="number"}(n)||function(l){return!!["interpolate","step","literal"].includes(l[0])}(n)?["array","string"].includes(a)?[]:[new ye(t,n,`projection expected, invalid type "${a}" found`)]:[new ye(t,n,`projection expected, invalid array ${JSON.stringify(n)} found`)]},string:ia,formatted:function(r){return ia(r).length===0?[]:Yr(r)},resolvedImage:function(r){return ia(r).length===0?[]:Yr(r)},padding:function(r){const t=r.key,n=r.value;if(xt(n)==="array"){if(n.length<1||n.length>4)return[new ye(t,n,`padding requires 1 to 4 values; ${n.length} values found`)];const a={type:"number"};let l=[];for(let d=0;d<n.length;d++)l=l.concat(r.validateSpec({key:`${t}[${d}]`,value:n[d],validateSpec:r.validateSpec,valueSpec:a}));return l}return Do({key:t,value:n,valueSpec:{}})},variableAnchorOffsetCollection:function(r){const t=r.key,n=r.value,a=xt(n),l=r.styleSpec;if(a!=="array"||n.length<1||n.length%2!=0)return[new ye(t,n,"variableAnchorOffsetCollection requires a non-empty array of even length")];let d=[];for(let p=0;p<n.length;p+=2)d=d.concat(Ls({key:`${t}[${p}]`,value:n[p],valueSpec:l.layout_symbol["text-anchor"]})),d=d.concat(Hl({key:`${t}[${p+1}]`,value:n[p+1],valueSpec:{length:2,value:"number"},validateSpec:r.validateSpec,style:r.style,styleSpec:l}));return d},sprite:Xa};function zi(r){const t=r.value,n=r.valueSpec,a=r.styleSpec;return r.validateSpec=zi,n.expression&&Io(Jt(t))?Kl(r):n.expression&&As(ta(t))?Yr(r):n.type&&Ya[n.type]?Ya[n.type](r):or(nt({},r,{valueSpec:n.type?a[n.type]:n}))}function Ja(r){const t=r.value,n=r.key,a=ia(r);return a.length||(t.indexOf("{fontstack}")===-1&&a.push(new ye(n,t,'"glyphs" url must include a "{fontstack}" token')),t.indexOf("{range}")===-1&&a.push(new ye(n,t,'"glyphs" url must include a "{range}" token'))),a}function lr(r,t=D){let n=[];return n=n.concat(zi({key:"",value:r,valueSpec:t.$root,styleSpec:t,style:r,validateSpec:zi,objectElementValidators:{glyphs:Ja,"*":()=>[]}})),r.constants&&(n=n.concat(Nu({key:"constants",value:r.constants}))),Wu(n)}function Rr(r){return function(t){return r({...t,validateSpec:zi})}}function Wu(r){return[].concat(r).sort((t,n)=>t.line-n.line)}function Ui(r){return function(...t){return Wu(r.apply(this,t))}}lr.source=Ui(Rr(Uu)),lr.sprite=Ui(Rr(Xa)),lr.glyphs=Ui(Rr(Ja)),lr.light=Ui(Rr($u)),lr.sky=Ui(Rr(Gu)),lr.terrain=Ui(Rr(qu)),lr.layer=Ui(Rr(Ka)),lr.filter=Ui(Rr(Lo)),lr.paintProperty=Ui(Rr(Yl)),lr.layoutProperty=Ui(Rr(Jl));const ra=lr,Ql=ra.light,ed=ra.sky,ec=ra.paintProperty,td=ra.layoutProperty;function Qa(r,t){let n=!1;if(t&&t.length)for(const a of t)r.fire(new j(new Error(a.message))),n=!0;return n}class Fs{constructor(t,n,a){const l=this.cells=[];if(t instanceof ArrayBuffer){this.arrayBuffer=t;const p=new Int32Array(this.arrayBuffer);t=p[0],this.d=(n=p[1])+2*(a=p[2]);for(let y=0;y<this.d*this.d;y++){const v=p[3+y],P=p[3+y+1];l.push(v===P?null:p.subarray(v,P))}const m=p[3+l.length+1];this.keys=p.subarray(p[3+l.length],m),this.bboxes=p.subarray(m),this.insert=this._insertReadonly}else{this.d=n+2*a;for(let p=0;p<this.d*this.d;p++)l.push([]);this.keys=[],this.bboxes=[]}this.n=n,this.extent=t,this.padding=a,this.scale=n/t,this.uid=0;const d=a/n*t;this.min=-d,this.max=t+d}insert(t,n,a,l,d){this._forEachCell(n,a,l,d,this._insertCell,this.uid++,void 0,void 0),this.keys.push(t),this.bboxes.push(n),this.bboxes.push(a),this.bboxes.push(l),this.bboxes.push(d)}_insertReadonly(){throw new Error("Cannot insert into a GridIndex created from an ArrayBuffer.")}_insertCell(t,n,a,l,d,p){this.cells[d].push(p)}query(t,n,a,l,d){const p=this.min,m=this.max;if(t<=p&&n<=p&&m<=a&&m<=l&&!d)return Array.prototype.slice.call(this.keys);{const y=[];return this._forEachCell(t,n,a,l,this._queryCell,y,{},d),y}}_queryCell(t,n,a,l,d,p,m,y){const v=this.cells[d];if(v!==null){const P=this.keys,S=this.bboxes;for(let k=0;k<v.length;k++){const R=v[k];if(m[R]===void 0){const L=4*R;(y?y(S[L+0],S[L+1],S[L+2],S[L+3]):t<=S[L+2]&&n<=S[L+3]&&a>=S[L+0]&&l>=S[L+1])?(m[R]=!0,p.push(P[R])):m[R]=!1}}}}_forEachCell(t,n,a,l,d,p,m,y){const v=this._convertToCellCoord(t),P=this._convertToCellCoord(n),S=this._convertToCellCoord(a),k=this._convertToCellCoord(l);for(let R=v;R<=S;R++)for(let L=P;L<=k;L++){const O=this.d*L+R;if((!y||y(this._convertFromCellCoord(R),this._convertFromCellCoord(L),this._convertFromCellCoord(R+1),this._convertFromCellCoord(L+1)))&&d.call(this,t,n,a,l,O,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,n=3+this.cells.length+1+1;let a=0;for(let p=0;p<this.cells.length;p++)a+=this.cells[p].length;const l=new Int32Array(n+a+this.keys.length+this.bboxes.length);l[0]=this.extent,l[1]=this.n,l[2]=this.padding;let d=n;for(let p=0;p<t.length;p++){const m=t[p];l[3+p]=d,l.set(m,d),d+=m.length}return l[3+t.length]=d,l.set(this.keys,d),d+=this.keys.length,l[3+t.length+1]=d,l.set(this.bboxes,d),d+=this.bboxes.length,l.buffer}static serialize(t,n){const a=t.toArrayBuffer();return n&&n.push(a),{buffer:a}}static deserialize(t){return new Fs(t.buffer)}}const Yi={};function Ve(r,t,n={}){if(Yi[r])throw new Error(`${r} is already registered.`);Object.defineProperty(t,"_classRegistryKey",{value:r,writeable:!1}),Yi[r]={klass:t,omit:n.omit||[],shallow:n.shallow||[]}}Ve("Object",Object),Ve("TransferableGridIndex",Fs),Ve("Color",yt),Ve("Error",Error),Ve("AJAXError",Er),Ve("ResolvedImage",Zi),Ve("StylePropertyFunction",Eo),Ve("StyleExpression",qa,{omit:["_evaluator"]}),Ve("ZoomDependentExpression",Gl),Ve("ZoomConstantExpression",$l),Ve("CompoundExpression",sr,{omit:["_evaluate"]});for(const r in Ua)Ua[r]._classRegistryKey||Ve(`Expression_${r}`,Ua[r]);function Hu(r){return r&&typeof ArrayBuffer<"u"&&(r instanceof ArrayBuffer||r.constructor&&r.constructor.name==="ArrayBuffer")}function es(r){return r.$name||r.constructor._classRegistryKey}function Ku(r){return!function(t){if(t===null||typeof t!="object")return!1;const n=es(t);return!(!n||n==="Object")}(r)&&(r==null||typeof r=="boolean"||typeof r=="number"||typeof r=="string"||r instanceof Boolean||r instanceof Number||r instanceof String||r instanceof Date||r instanceof RegExp||r instanceof Blob||r instanceof Error||Hu(r)||$n(r)||ArrayBuffer.isView(r)||r instanceof ImageData)}function na(r,t){if(Ku(r))return(Hu(r)||$n(r))&&t&&t.push(r),ArrayBuffer.isView(r)&&t&&t.push(r.buffer),r instanceof ImageData&&t&&t.push(r.data.buffer),r;if(Array.isArray(r)){const d=[];for(const p of r)d.push(na(p,t));return d}if(typeof r!="object")throw new Error("can't serialize object of type "+typeof r);const n=es(r);if(!n)throw new Error(`can't serialize object of unregistered class ${r.constructor.name}`);if(!Yi[n])throw new Error(`${n} is not registered.`);const{klass:a}=Yi[n],l=a.serialize?a.serialize(r,t):{};if(a.serialize){if(t&&l===t[t.length-1])throw new Error("statically serialized object won't survive transfer of $name property")}else{for(const d in r){if(!r.hasOwnProperty(d)||Yi[n].omit.indexOf(d)>=0)continue;const p=r[d];l[d]=Yi[n].shallow.indexOf(d)>=0?p:na(p,t)}r instanceof Error&&(l.message=r.message)}if(l.$name)throw new Error("$name property is reserved for worker serialization logic.");return n!=="Object"&&(l.$name=n),l}function Pn(r){if(Ku(r))return r;if(Array.isArray(r))return r.map(Pn);if(typeof r!="object")throw new Error("can't deserialize object of type "+typeof r);const t=es(r)||"Object";if(!Yi[t])throw new Error(`can't deserialize unregistered class ${t}`);const{klass:n}=Yi[t];if(!n)throw new Error(`can't deserialize unregistered class ${t}`);if(n.deserialize)return n.deserialize(r);const a=Object.create(n.prototype);for(const l of Object.keys(r)){if(l==="$name")continue;const d=r[l];a[l]=Yi[t].shallow.indexOf(l)>=0?d:Pn(d)}return a}class tc{constructor(){this.first=!0}update(t,n){const a=Math.floor(t);return this.first?(this.first=!1,this.lastIntegerZoom=a,this.lastIntegerZoomTime=0,this.lastZoom=t,this.lastFloorZoom=a,!0):(this.lastFloorZoom>a?(this.lastIntegerZoom=a+1,this.lastIntegerZoomTime=n):this.lastFloorZoom<a&&(this.lastIntegerZoom=a,this.lastIntegerZoomTime=n),t!==this.lastZoom&&(this.lastZoom=t,this.lastFloorZoom=a,!0))}}const pt={"Latin-1 Supplement":r=>r>=128&&r<=255,"Hangul Jamo":r=>r>=4352&&r<=4607,Khmer:r=>r>=6016&&r<=6143,"General Punctuation":r=>r>=8192&&r<=8303,"Letterlike Symbols":r=>r>=8448&&r<=8527,"Number Forms":r=>r>=8528&&r<=8591,"Miscellaneous Technical":r=>r>=8960&&r<=9215,"Control Pictures":r=>r>=9216&&r<=9279,"Optical Character Recognition":r=>r>=9280&&r<=9311,"Enclosed Alphanumerics":r=>r>=9312&&r<=9471,"Geometric Shapes":r=>r>=9632&&r<=9727,"Miscellaneous Symbols":r=>r>=9728&&r<=9983,"Miscellaneous Symbols and Arrows":r=>r>=11008&&r<=11263,"Ideographic Description Characters":r=>r>=12272&&r<=12287,"CJK Symbols and Punctuation":r=>r>=12288&&r<=12351,Hiragana:r=>r>=12352&&r<=12447,Katakana:r=>r>=12448&&r<=12543,Kanbun:r=>r>=12688&&r<=12703,"CJK Strokes":r=>r>=12736&&r<=12783,"Enclosed CJK Letters and Months":r=>r>=12800&&r<=13055,"CJK Compatibility":r=>r>=13056&&r<=13311,"Yijing Hexagram Symbols":r=>r>=19904&&r<=19967,"CJK Unified Ideographs":r=>r>=19968&&r<=40959,"Hangul Syllables":r=>r>=44032&&r<=55215,"Private Use Area":r=>r>=57344&&r<=63743,"Vertical Forms":r=>r>=65040&&r<=65055,"CJK Compatibility Forms":r=>r>=65072&&r<=65103,"Small Form Variants":r=>r>=65104&&r<=65135,"Halfwidth and Fullwidth Forms":r=>r>=65280&&r<=65519};function Fo(r){for(const t of r)if(rc(t.charCodeAt(0)))return!0;return!1}function Xu(r){for(const t of r)if(!id(t.charCodeAt(0)))return!1;return!0}function Bs(r){const t=r.map(n=>{try{return new RegExp(`\\p{sc=${n}}`,"u").source}catch{return null}}).filter(n=>n);return new RegExp(t.join("|"),"u")}const Yu=Bs(["Arab","Dupl","Mong","Ougr","Syrc"]);function id(r){return!Yu.test(String.fromCodePoint(r))}const ic=Bs(["Bopo","Hani","Hira","Kana","Kits","Nshu","Tang","Yiii"]);function rc(r){return!(r!==746&&r!==747&&(r<4352||!(pt["CJK Compatibility Forms"](r)&&!(r>=65097&&r<=65103)||pt["CJK Compatibility"](r)||pt["CJK Strokes"](r)||!(!pt["CJK Symbols and Punctuation"](r)||r>=12296&&r<=12305||r>=12308&&r<=12319||r===12336)||pt["Enclosed CJK Letters and Months"](r)||pt["Ideographic Description Characters"](r)||pt.Kanbun(r)||pt.Katakana(r)&&r!==12540||!(!pt["Halfwidth and Fullwidth Forms"](r)||r===65288||r===65289||r===65293||r>=65306&&r<=65310||r===65339||r===65341||r===65343||r>=65371&&r<=65503||r===65507||r>=65512&&r<=65519)||!(!pt["Small Form Variants"](r)||r>=65112&&r<=65118||r>=65123&&r<=65126)||pt["Vertical Forms"](r)||pt["Yijing Hexagram Symbols"](r)||new RegExp("\\p{sc=Cans}","u").test(String.fromCodePoint(r))||new RegExp("\\p{sc=Hang}","u").test(String.fromCodePoint(r))||ic.test(String.fromCodePoint(r)))))}function nc(r){return!(rc(r)||function(t){return!!(pt["Latin-1 Supplement"](t)&&(t===167||t===169||t===174||t===177||t===188||t===189||t===190||t===215||t===247)||pt["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)||pt["Letterlike Symbols"](t)||pt["Number Forms"](t)||pt["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)||pt["Control Pictures"](t)&&t!==9251||pt["Optical Character Recognition"](t)||pt["Enclosed Alphanumerics"](t)||pt["Geometric Shapes"](t)||pt["Miscellaneous Symbols"](t)&&!(t>=9754&&t<=9759)||pt["Miscellaneous Symbols and Arrows"](t)&&(t>=11026&&t<=11055||t>=11088&&t<=11097||t>=11192&&t<=11243)||pt["CJK Symbols and Punctuation"](t)||pt.Katakana(t)||pt["Private Use Area"](t)||pt["CJK Compatibility Forms"](t)||pt["Small Form Variants"](t)||pt["Halfwidth and Fullwidth Forms"](t)||t===8734||t===8756||t===8757||t>=9984&&t<=10087||t>=10102&&t<=10131||t===65532||t===65533)}(r))}const Ju=Bs(["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 ac(r){return Ju.test(String.fromCodePoint(r))}function rd(r,t){return!(!t&&ac(r)||r>=2304&&r<=3583||r>=3840&&r<=4255||pt.Khmer(r))}function nd(r){for(const t of r)if(ac(t.charCodeAt(0)))return!0;return!1}const Jr=new class{constructor(){this.TIMEOUT=5e3,this.applyArabicShaping=null,this.processBidirectionalText=null,this.processStyledBidirectionalText=null,this.pluginStatus="unavailable",this.pluginURL=null,this.loadScriptResolve=()=>{}}setState(r){this.pluginStatus=r.pluginStatus,this.pluginURL=r.pluginURL}getState(){return{pluginStatus:this.pluginStatus,pluginURL:this.pluginURL}}setMethods(r){if(Jr.isParsed())throw new Error("RTL text plugin already registered.");this.applyArabicShaping=r.applyArabicShaping,this.processBidirectionalText=r.processBidirectionalText,this.processStyledBidirectionalText=r.processStyledBidirectionalText,this.loadScriptResolve()}isParsed(){return this.applyArabicShaping!=null&&this.processBidirectionalText!=null&&this.processStyledBidirectionalText!=null}getRTLTextPluginStatus(){return this.pluginStatus}syncState(r,t){return c(this,void 0,void 0,function*(){if(this.isParsed())return this.getState();if(r.pluginStatus!=="loading")return this.setState(r),r;const n=r.pluginURL,a=new Promise(d=>{this.loadScriptResolve=d});t(n);const l=new Promise(d=>setTimeout(()=>d(),this.TIMEOUT));if(yield Promise.race([a,l]),this.isParsed()){const d={pluginStatus:"loaded",pluginURL:n};return this.setState(d),d}throw this.setState({pluginStatus:"error",pluginURL:""}),new Error(`RTL Text Plugin failed to import scripts from ${n}`)})}};class Ft{constructor(t,n){this.zoom=t,n?(this.now=n.now,this.fadeDuration=n.fadeDuration,this.zoomHistory=n.zoomHistory,this.transition=n.transition):(this.now=0,this.fadeDuration=0,this.zoomHistory=new tc,this.transition={})}isSupportedScript(t){return function(n,a){for(const l of n)if(!rd(l.charCodeAt(0),a))return!1;return!0}(t,Jr.getRTLTextPluginStatus()==="loaded")}crossFadingFactor(){return this.fadeDuration===0?1:Math.min((this.now-this.zoomHistory.lastIntegerZoomTime)/this.fadeDuration,1)}getCrossfadeParameters(){const t=this.zoom,n=t-Math.floor(t),a=this.crossFadingFactor();return t>this.zoomHistory.lastIntegerZoom?{fromScale:2,toScale:1,t:n+(1-n)*a}:{fromScale:.5,toScale:1,t:1-(1-a)*n}}}class Os{constructor(t,n){this.property=t,this.value=n,this.expression=function(a,l){if(Io(a))return new Eo(a,l);if(As(a)){const d=Ou(a,l);if(d.result==="error")throw new Error(d.value.map(p=>`${p.key}: ${p.message}`).join(", "));return d.value}{let d=a;return l.type==="color"&&typeof a=="string"?d=yt.parse(a):l.type!=="padding"||typeof a!="number"&&!Array.isArray(a)?l.type==="variableAnchorOffsetCollection"&&Array.isArray(a)?d=Li.parse(a):l.type==="projectionDefinition"&&typeof a=="string"&&(d=ci.parse(a)):d=bi.parse(a),{kind:"constant",evaluate:()=>d}}}(n===void 0?t.specification.default:n,t.specification)}isDataDriven(){return this.expression.kind==="source"||this.expression.kind==="composite"}possiblyEvaluate(t,n,a){return this.property.possiblyEvaluate(this,t,n,a)}}class Bo{constructor(t){this.property=t,this.value=new Os(t,void 0)}transitioned(t,n){return new Qu(this.property,this.value,n,vi({},t.transition,this.transition),t.now)}untransitioned(){return new Qu(this.property,this.value,null,{},0)}}class js{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitionablePropertyValues)}getValue(t){return Xi(this._values[t].value.value)}setValue(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Bo(this._values[t].property)),this._values[t].value=new Os(this._values[t].property,n===null?void 0:Xi(n))}getTransition(t){return Xi(this._values[t].transition)}setTransition(t,n){Object.prototype.hasOwnProperty.call(this._values,t)||(this._values[t]=new Bo(this._values[t].property)),this._values[t].transition=Xi(n)||void 0}serialize(){const t={};for(const n of Object.keys(this._values)){const a=this.getValue(n);a!==void 0&&(t[n]=a);const l=this.getTransition(n);l!==void 0&&(t[`${n}-transition`]=l)}return t}transitioned(t,n){const a=new Oo(this._properties);for(const l of Object.keys(this._values))a._values[l]=this._values[l].transitioned(t,n._values[l]);return a}untransitioned(){const t=new Oo(this._properties);for(const n of Object.keys(this._values))t._values[n]=this._values[n].untransitioned();return t}}class Qu{constructor(t,n,a,l,d){this.property=t,this.value=n,this.begin=d+l.delay||0,this.end=this.begin+l.duration||0,t.specification.transition&&(l.delay||l.duration)&&(this.prior=a)}possiblyEvaluate(t,n,a){const l=t.now||0,d=this.value.possiblyEvaluate(t,n,a),p=this.prior;if(p){if(l>this.end)return this.prior=null,d;if(this.value.isDataDriven())return this.prior=null,d;if(l<this.begin)return p.possiblyEvaluate(t,n,a);{const m=(l-this.begin)/(this.end-this.begin);return this.property.interpolate(p.possiblyEvaluate(t,n,a),d,Nn(m))}}return d}}class Oo{constructor(t){this._properties=t,this._values=Object.create(t.defaultTransitioningPropertyValues)}possiblyEvaluate(t,n,a){const l=new Ns(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(t,n,a);return l}hasTransition(){for(const t of Object.keys(this._values))if(this._values[t].prior)return!0;return!1}}class ad{constructor(t){this._properties=t,this._values=Object.create(t.defaultPropertyValues)}hasValue(t){return this._values[t].value!==void 0}getValue(t){return Xi(this._values[t].value)}setValue(t,n){this._values[t]=new Os(this._values[t].property,n===null?void 0:Xi(n))}serialize(){const t={};for(const n of Object.keys(this._values)){const a=this.getValue(n);a!==void 0&&(t[n]=a)}return t}possiblyEvaluate(t,n,a){const l=new Ns(this._properties);for(const d of Object.keys(this._values))l._values[d]=this._values[d].possiblyEvaluate(t,n,a);return l}}class Dr{constructor(t,n,a){this.property=t,this.value=n,this.parameters=a}isConstant(){return this.value.kind==="constant"}constantOr(t){return this.value.kind==="constant"?this.value.value:t}evaluate(t,n,a,l){return this.property.evaluate(this.value,this.parameters,t,n,a,l)}}class Ns{constructor(t){this._properties=t,this._values=Object.create(t.defaultPossiblyEvaluatedValues)}get(t){return this._values[t]}}class Xe{constructor(t){this.specification=t}possiblyEvaluate(t,n){if(t.isDataDriven())throw new Error("Value should not be data driven");return t.expression.evaluate(n)}interpolate(t,n,a){const l=xr[this.specification.type];return l?l(t,n,a):t}}class tt{constructor(t,n){this.specification=t,this.overrides=n}possiblyEvaluate(t,n,a,l){return new Dr(this,t.expression.kind==="constant"||t.expression.kind==="camera"?{kind:"constant",value:t.expression.evaluate(n,null,{},a,l)}:t.expression,n)}interpolate(t,n,a){if(t.value.kind!=="constant"||n.value.kind!=="constant")return t;if(t.value.value===void 0||n.value.value===void 0)return new Dr(this,{kind:"constant",value:void 0},t.parameters);const l=xr[this.specification.type];if(l){const d=l(t.value.value,n.value.value,a);return new Dr(this,{kind:"constant",value:d},t.parameters)}return t}evaluate(t,n,a,l,d,p){return t.kind==="constant"?t.value:t.evaluate(n,a,l,d,p)}}class jo extends tt{possiblyEvaluate(t,n,a,l){if(t.value===void 0)return new Dr(this,{kind:"constant",value:void 0},n);if(t.expression.kind==="constant"){const d=t.expression.evaluate(n,null,{},a,l),p=t.property.specification.type==="resolvedImage"&&typeof d!="string"?d.name:d,m=this._calculate(p,p,p,n);return new Dr(this,{kind:"constant",value:m},n)}if(t.expression.kind==="camera"){const d=this._calculate(t.expression.evaluate({zoom:n.zoom-1}),t.expression.evaluate({zoom:n.zoom}),t.expression.evaluate({zoom:n.zoom+1}),n);return new Dr(this,{kind:"constant",value:d},n)}return new Dr(this,t.expression,n)}evaluate(t,n,a,l,d,p){if(t.kind==="source"){const m=t.evaluate(n,a,l,d,p);return this._calculate(m,m,m,n)}return t.kind==="composite"?this._calculate(t.evaluate({zoom:Math.floor(n.zoom)-1},a,l),t.evaluate({zoom:Math.floor(n.zoom)},a,l),t.evaluate({zoom:Math.floor(n.zoom)+1},a,l),n):t.value}_calculate(t,n,a,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:n}:{from:a,to:n}}interpolate(t){return t}}class sc{constructor(t){this.specification=t}possiblyEvaluate(t,n,a,l){if(t.value!==void 0){if(t.expression.kind==="constant"){const d=t.expression.evaluate(n,null,{},a,l);return this._calculate(d,d,d,n)}return this._calculate(t.expression.evaluate(new Ft(Math.floor(n.zoom-1),n)),t.expression.evaluate(new Ft(Math.floor(n.zoom),n)),t.expression.evaluate(new Ft(Math.floor(n.zoom+1),n)),n)}}_calculate(t,n,a,l){return l.zoom>l.zoomHistory.lastIntegerZoom?{from:t,to:n}:{from:a,to:n}}interpolate(t){return t}}class oc{constructor(t){this.specification=t}possiblyEvaluate(t,n,a,l){return!!t.expression.evaluate(n,null,{},a,l)}interpolate(){return!1}}class $i{constructor(t){this.properties=t,this.defaultPropertyValues={},this.defaultTransitionablePropertyValues={},this.defaultTransitioningPropertyValues={},this.defaultPossiblyEvaluatedValues={},this.overridableProperties=[];for(const n in t){const a=t[n];a.specification.overridable&&this.overridableProperties.push(n);const l=this.defaultPropertyValues[n]=new Os(a,void 0),d=this.defaultTransitionablePropertyValues[n]=new Bo(a);this.defaultTransitioningPropertyValues[n]=d.untransitioned(),this.defaultPossiblyEvaluatedValues[n]=l.possiblyEvaluate({})}}}Ve("DataDrivenProperty",tt),Ve("DataConstantProperty",Xe),Ve("CrossFadedDataDrivenProperty",jo),Ve("CrossFadedProperty",sc),Ve("ColorRampProperty",oc);const eh="-transition";class Fi extends V{constructor(t,n){if(super(),this.id=t.id,this.type=t.type,this._featureFilter={filter:()=>!0,needGeometry:!1},t.type!=="custom"&&(this.metadata=t.metadata,this.minzoom=t.minzoom,this.maxzoom=t.maxzoom,t.type!=="background"&&(this.source=t.source,this.sourceLayer=t["source-layer"],this.filter=t.filter),n.layout&&(this._unevaluatedLayout=new ad(n.layout)),n.paint)){this._transitionablePaint=new js(n.paint);for(const a in t.paint)this.setPaintProperty(a,t.paint[a],{validate:!1});for(const a in t.layout)this.setLayoutProperty(a,t.layout[a],{validate:!1});this._transitioningPaint=this._transitionablePaint.untransitioned(),this.paint=new Ns(n.paint)}}getCrossfadeParameters(){return this._crossfadeParameters}getLayoutProperty(t){return t==="visibility"?this.visibility:this._unevaluatedLayout.getValue(t)}setLayoutProperty(t,n,a={}){n!=null&&this._validate(td,`layers.${this.id}.layout.${t}`,t,n,a)||(t!=="visibility"?this._unevaluatedLayout.setValue(t,n):this.visibility=n)}getPaintProperty(t){return t.endsWith(eh)?this._transitionablePaint.getTransition(t.slice(0,-11)):this._transitionablePaint.getValue(t)}setPaintProperty(t,n,a={}){if(n!=null&&this._validate(ec,`layers.${this.id}.paint.${t}`,t,n,a))return!1;if(t.endsWith(eh))return this._transitionablePaint.setTransition(t.slice(0,-11),n||void 0),!1;{const l=this._transitionablePaint._values[t],d=l.property.specification["property-type"]==="cross-faded-data-driven",p=l.value.isDataDriven(),m=l.value;this._transitionablePaint.setValue(t,n),this._handleSpecialPaintPropertyUpdate(t);const y=this._transitionablePaint._values[t].value;return y.isDataDriven()||p||d||this._handleOverridablePaintPropertyUpdate(t,m,y)}}_handleSpecialPaintPropertyUpdate(t){}_handleOverridablePaintPropertyUpdate(t,n,a){return!1}isHidden(t){return!!(this.minzoom&&t<this.minzoom)||!!(this.maxzoom&&t>=this.maxzoom)||this.visibility==="none"}updateTransitions(t){this._transitioningPaint=this._transitionablePaint.transitioned(t,this._transitioningPaint)}hasTransition(){return this._transitioningPaint.hasTransition()}recalculate(t,n){t.getCrossfadeParameters&&(this._crossfadeParameters=t.getCrossfadeParameters()),this._unevaluatedLayout&&(this.layout=this._unevaluatedLayout.possiblyEvaluate(t,void 0,n)),this.paint=this._transitioningPaint.possiblyEvaluate(t,void 0,n)}serialize(){const t={id:this.id,type:this.type,source:this.source,"source-layer":this.sourceLayer,metadata:this.metadata,minzoom:this.minzoom,maxzoom:this.maxzoom,filter:this.filter,layout:this._unevaluatedLayout&&this._unevaluatedLayout.serialize(),paint:this._transitionablePaint&&this._transitionablePaint.serialize()};return this.visibility&&(t.layout=t.layout||{},t.layout.visibility=this.visibility),Un(t,(n,a)=>!(n===void 0||a==="layout"&&!Object.keys(n).length||a==="paint"&&!Object.keys(n).length))}_validate(t,n,a,l,d={}){return(!d||d.validate!==!1)&&Qa(this,t.call(ra,{key:n,layerType:this.type,objectKey:a,value:l,styleSpec:D,style:{glyphs:!0,sprite:!0}}))}is3D(){return!1}isTileClipped(){return!1}hasOffscreenPass(){return!1}resize(){}isStateDependent(){for(const t in this.paint._values){const n=this.paint.get(t);if(n instanceof Dr&&Ga(n.property.specification)&&(n.value.kind==="source"||n.value.kind==="composite")&&n.value.isStateDependent)return!0}return!1}}const sd={Int8:Int8Array,Uint8:Uint8Array,Int16:Int16Array,Uint16:Uint16Array,Int32:Int32Array,Uint32:Uint32Array,Float32:Float32Array};class Zs{constructor(t,n){this._structArray=t,this._pos1=n*this.size,this._pos2=this._pos1/2,this._pos4=this._pos1/4,this._pos8=this._pos1/8}}class Gt{constructor(){this.isTransferred=!1,this.capacity=-1,this.resize(0)}static serialize(t,n){return t._trim(),n&&(t.isTransferred=!0,n.push(t.arrayBuffer)),{length:t.length,arrayBuffer:t.arrayBuffer}}static deserialize(t){const n=Object.create(this.prototype);return n.arrayBuffer=t.arrayBuffer,n.length=t.length,n.capacity=t.arrayBuffer.byteLength/n.bytesPerElement,n._refreshViews(),n}_trim(){this.length!==this.capacity&&(this.capacity=this.length,this.arrayBuffer=this.arrayBuffer.slice(0,this.length*this.bytesPerElement),this._refreshViews())}clear(){this.length=0}resize(t){this.reserve(t),this.length=t}reserve(t){if(t>this.capacity){this.capacity=Math.max(t,Math.floor(5*this.capacity),128),this.arrayBuffer=new ArrayBuffer(this.capacity*this.bytesPerElement);const n=this.uint8;this._refreshViews(),n&&this.uint8.set(n)}}_refreshViews(){throw new Error("_refreshViews() must be implemented by each concrete StructArray layout")}}function Qt(r,t=1){let n=0,a=0;return{members:r.map(l=>{const d=sd[l.type].BYTES_PER_ELEMENT,p=n=th(n,Math.max(t,d)),m=l.components||1;return a=Math.max(a,d),n+=d*m,{name:l.name,type:l.type,components:m,offset:p}}),size:th(n,Math.max(a,t)),alignment:t}}function th(r,t){return Math.ceil(r/t)*t}class Vs extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const l=2*t;return this.int16[l+0]=n,this.int16[l+1]=a,t}}Vs.prototype.bytesPerElement=4,Ve("StructArrayLayout2i4",Vs);class Lr extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,n,a)}emplace(t,n,a,l){const d=3*t;return this.int16[d+0]=n,this.int16[d+1]=a,this.int16[d+2]=l,t}}Lr.prototype.bytesPerElement=6,Ve("StructArrayLayout3i6",Lr);class No extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,l){const d=this.length;return this.resize(d+1),this.emplace(d,t,n,a,l)}emplace(t,n,a,l,d){const p=4*t;return this.int16[p+0]=n,this.int16[p+1]=a,this.int16[p+2]=l,this.int16[p+3]=d,t}}No.prototype.bytesPerElement=8,Ve("StructArrayLayout4i8",No);class Us extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,n,a,l,d,p)}emplace(t,n,a,l,d,p,m){const y=6*t;return this.int16[y+0]=n,this.int16[y+1]=a,this.int16[y+2]=l,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}Us.prototype.bytesPerElement=12,Ve("StructArrayLayout2i4i12",Us);class Zo extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,n,a,l,d,p)}emplace(t,n,a,l,d,p,m){const y=4*t,v=8*t;return this.int16[y+0]=n,this.int16[y+1]=a,this.uint8[v+4]=l,this.uint8[v+5]=d,this.uint8[v+6]=p,this.uint8[v+7]=m,t}}Zo.prototype.bytesPerElement=8,Ve("StructArrayLayout2i4ub8",Zo);class aa extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const l=2*t;return this.float32[l+0]=n,this.float32[l+1]=a,t}}aa.prototype.bytesPerElement=8,Ve("StructArrayLayout2f8",aa);class lc extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,l,d,p,m,y,v,P){const S=this.length;return this.resize(S+1),this.emplace(S,t,n,a,l,d,p,m,y,v,P)}emplace(t,n,a,l,d,p,m,y,v,P,S){const k=10*t;return this.uint16[k+0]=n,this.uint16[k+1]=a,this.uint16[k+2]=l,this.uint16[k+3]=d,this.uint16[k+4]=p,this.uint16[k+5]=m,this.uint16[k+6]=y,this.uint16[k+7]=v,this.uint16[k+8]=P,this.uint16[k+9]=S,t}}lc.prototype.bytesPerElement=20,Ve("StructArrayLayout10ui20",lc);class ts extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,l,d,p,m,y,v,P,S,k){const R=this.length;return this.resize(R+1),this.emplace(R,t,n,a,l,d,p,m,y,v,P,S,k)}emplace(t,n,a,l,d,p,m,y,v,P,S,k,R){const L=12*t;return this.int16[L+0]=n,this.int16[L+1]=a,this.int16[L+2]=l,this.int16[L+3]=d,this.uint16[L+4]=p,this.uint16[L+5]=m,this.uint16[L+6]=y,this.uint16[L+7]=v,this.int16[L+8]=P,this.int16[L+9]=S,this.int16[L+10]=k,this.int16[L+11]=R,t}}ts.prototype.bytesPerElement=24,Ve("StructArrayLayout4i4ui4i24",ts);class sa extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,n,a)}emplace(t,n,a,l){const d=3*t;return this.float32[d+0]=n,this.float32[d+1]=a,this.float32[d+2]=l,t}}sa.prototype.bytesPerElement=12,Ve("StructArrayLayout3f12",sa);class cc extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.uint32[1*t+0]=n,t}}cc.prototype.bytesPerElement=4,Ve("StructArrayLayout1ul4",cc);class Vo extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a,l,d,p,m,y,v){const P=this.length;return this.resize(P+1),this.emplace(P,t,n,a,l,d,p,m,y,v)}emplace(t,n,a,l,d,p,m,y,v,P){const S=10*t,k=5*t;return this.int16[S+0]=n,this.int16[S+1]=a,this.int16[S+2]=l,this.int16[S+3]=d,this.int16[S+4]=p,this.int16[S+5]=m,this.uint32[k+3]=y,this.uint16[S+8]=v,this.uint16[S+9]=P,t}}Vo.prototype.bytesPerElement=20,Ve("StructArrayLayout6i1ul2ui20",Vo);class oa extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,n,a,l,d,p)}emplace(t,n,a,l,d,p,m){const y=6*t;return this.int16[y+0]=n,this.int16[y+1]=a,this.int16[y+2]=l,this.int16[y+3]=d,this.int16[y+4]=p,this.int16[y+5]=m,t}}oa.prototype.bytesPerElement=12,Ve("StructArrayLayout2i2i2i12",oa);class uc extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,l,d){const p=this.length;return this.resize(p+1),this.emplace(p,t,n,a,l,d)}emplace(t,n,a,l,d,p){const m=4*t,y=8*t;return this.float32[m+0]=n,this.float32[m+1]=a,this.float32[m+2]=l,this.int16[y+6]=d,this.int16[y+7]=p,t}}uc.prototype.bytesPerElement=16,Ve("StructArrayLayout2f1f2i16",uc);class hc extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer)}emplaceBack(t,n,a,l,d,p){const m=this.length;return this.resize(m+1),this.emplace(m,t,n,a,l,d,p)}emplace(t,n,a,l,d,p,m){const y=16*t,v=4*t,P=8*t;return this.uint8[y+0]=n,this.uint8[y+1]=a,this.float32[v+1]=l,this.float32[v+2]=d,this.int16[P+6]=p,this.int16[P+7]=m,t}}hc.prototype.bytesPerElement=16,Ve("StructArrayLayout2ub2f2i16",hc);class $s extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,n,a)}emplace(t,n,a,l){const d=3*t;return this.uint16[d+0]=n,this.uint16[d+1]=a,this.uint16[d+2]=l,t}}$s.prototype.bytesPerElement=6,Ve("StructArrayLayout3ui6",$s);class dc extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,l,d,p,m,y,v,P,S,k,R,L,O,$,H){const re=this.length;return this.resize(re+1),this.emplace(re,t,n,a,l,d,p,m,y,v,P,S,k,R,L,O,$,H)}emplace(t,n,a,l,d,p,m,y,v,P,S,k,R,L,O,$,H,re){const X=24*t,A=12*t,U=48*t;return this.int16[X+0]=n,this.int16[X+1]=a,this.uint16[X+2]=l,this.uint16[X+3]=d,this.uint32[A+2]=p,this.uint32[A+3]=m,this.uint32[A+4]=y,this.uint16[X+10]=v,this.uint16[X+11]=P,this.uint16[X+12]=S,this.float32[A+7]=k,this.float32[A+8]=R,this.uint8[U+36]=L,this.uint8[U+37]=O,this.uint8[U+38]=$,this.uint32[A+10]=H,this.int16[X+22]=re,t}}dc.prototype.bytesPerElement=48,Ve("StructArrayLayout2i2ui3ul3ui2f3ub1ul1i48",dc);class u extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.int16=new Int16Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,l,d,p,m,y,v,P,S,k,R,L,O,$,H,re,X,A,U,J,fe,Ce,me,xe,Re,Ee){const De=this.length;return this.resize(De+1),this.emplace(De,t,n,a,l,d,p,m,y,v,P,S,k,R,L,O,$,H,re,X,A,U,J,fe,Ce,me,xe,Re,Ee)}emplace(t,n,a,l,d,p,m,y,v,P,S,k,R,L,O,$,H,re,X,A,U,J,fe,Ce,me,xe,Re,Ee,De){const Pe=32*t,$e=16*t;return this.int16[Pe+0]=n,this.int16[Pe+1]=a,this.int16[Pe+2]=l,this.int16[Pe+3]=d,this.int16[Pe+4]=p,this.int16[Pe+5]=m,this.int16[Pe+6]=y,this.int16[Pe+7]=v,this.uint16[Pe+8]=P,this.uint16[Pe+9]=S,this.uint16[Pe+10]=k,this.uint16[Pe+11]=R,this.uint16[Pe+12]=L,this.uint16[Pe+13]=O,this.uint16[Pe+14]=$,this.uint16[Pe+15]=H,this.uint16[Pe+16]=re,this.uint16[Pe+17]=X,this.uint16[Pe+18]=A,this.uint16[Pe+19]=U,this.uint16[Pe+20]=J,this.uint16[Pe+21]=fe,this.uint16[Pe+22]=Ce,this.uint32[$e+12]=me,this.float32[$e+13]=xe,this.float32[$e+14]=Re,this.uint16[Pe+30]=Ee,this.uint16[Pe+31]=De,t}}u.prototype.bytesPerElement=64,Ve("StructArrayLayout8i15ui1ul2f2ui64",u);class e extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.float32[1*t+0]=n,t}}e.prototype.bytesPerElement=4,Ve("StructArrayLayout1f4",e);class i extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,n,a)}emplace(t,n,a,l){const d=3*t;return this.uint16[6*t+0]=n,this.float32[d+1]=a,this.float32[d+2]=l,t}}i.prototype.bytesPerElement=12,Ve("StructArrayLayout1ui2f12",i);class s extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint32=new Uint32Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n,a){const l=this.length;return this.resize(l+1),this.emplace(l,t,n,a)}emplace(t,n,a,l){const d=4*t;return this.uint32[2*t+0]=n,this.uint16[d+2]=a,this.uint16[d+3]=l,t}}s.prototype.bytesPerElement=8,Ve("StructArrayLayout1ul2ui8",s);class o extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t,n){const a=this.length;return this.resize(a+1),this.emplace(a,t,n)}emplace(t,n,a){const l=2*t;return this.uint16[l+0]=n,this.uint16[l+1]=a,t}}o.prototype.bytesPerElement=4,Ve("StructArrayLayout2ui4",o);class h extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.uint16=new Uint16Array(this.arrayBuffer)}emplaceBack(t){const n=this.length;return this.resize(n+1),this.emplace(n,t)}emplace(t,n){return this.uint16[1*t+0]=n,t}}h.prototype.bytesPerElement=2,Ve("StructArrayLayout1ui2",h);class f extends Gt{_refreshViews(){this.uint8=new Uint8Array(this.arrayBuffer),this.float32=new Float32Array(this.arrayBuffer)}emplaceBack(t,n,a,l){const d=this.length;return this.resize(d+1),this.emplace(d,t,n,a,l)}emplace(t,n,a,l,d){const p=4*t;return this.float32[p+0]=n,this.float32[p+1]=a,this.float32[p+2]=l,this.float32[p+3]=d,t}}f.prototype.bytesPerElement=16,Ve("StructArrayLayout4f16",f);class _ extends Zs{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 Ze(this.anchorPointX,this.anchorPointY)}}_.prototype.size=20;class x extends Vo{get(t){return new _(this,t)}}Ve("CollisionBoxArray",x);class w extends Zs{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]}}w.prototype.size=48;class I extends dc{get(t){return new w(this,t)}}Ve("PlacedSymbolArray",I);class z extends Zs{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]}}z.prototype.size=64;class C extends u{get(t){return new z(this,t)}}Ve("SymbolInstanceArray",C);class F extends e{getoffsetX(t){return this.float32[1*t+0]}}Ve("GlyphOffsetArray",F);class N extends Lr{getx(t){return this.int16[3*t+0]}gety(t){return this.int16[3*t+1]}gettileUnitDistanceFromAnchor(t){return this.int16[3*t+2]}}Ve("SymbolLineVertexArray",N);class q extends Zs{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]}}q.prototype.size=12;class G extends i{get(t){return new q(this,t)}}Ve("TextAnchorOffsetArray",G);class W extends Zs{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]}}W.prototype.size=8;class K extends s{get(t){return new W(this,t)}}Ve("FeatureIndexArray",K);class Q extends Vs{}class ee extends Vs{}class te extends Vs{}class se extends Us{}class ie extends Zo{}class pe extends aa{}class de extends lc{}class we extends ts{}class Se extends sa{}class ve extends cc{}class Be extends oa{}class Le extends hc{}class Me extends $s{}class We extends o{}const lt=Qt([{name:"a_pos",components:2,type:"Int16"}],4),{members:Tt}=lt;class ut{constructor(t=[]){this._forceNewSegmentOnNextPrepare=!1,this.segments=t}prepareSegment(t,n,a,l){const d=this.segments[this.segments.length-1];return t>ut.MAX_VERTEX_ARRAY_LENGTH&&Ci(`Max vertices per segment is ${ut.MAX_VERTEX_ARRAY_LENGTH}: bucket requested ${t}. Consider using the \`fillLargeMeshArrays\` function if you require meshes with more than ${ut.MAX_VERTEX_ARRAY_LENGTH} vertices.`),this._forceNewSegmentOnNextPrepare||!d||d.vertexLength+t>ut.MAX_VERTEX_ARRAY_LENGTH||d.sortKey!==l?this.createNewSegment(n,a,l):d}createNewSegment(t,n,a){const l={vertexOffset:t.length,primitiveOffset:n.length,vertexLength:0,primitiveLength:0,vaos:{}};return a!==void 0&&(l.sortKey=a),this._forceNewSegmentOnNextPrepare=!1,this.segments.push(l),l}getOrCreateLatestSegment(t,n,a){return this.prepareSegment(0,t,n,a)}forceNewSegmentOnNextPrepare(){this._forceNewSegmentOnNextPrepare=!0}get(){return this.segments}destroy(){for(const t of this.segments)for(const n in t.vaos)t.vaos[n].destroy()}static simpleSegment(t,n,a,l){return new ut([{vertexOffset:t,primitiveOffset:n,vertexLength:a,primitiveLength:l,vaos:{},sortKey:0}])}}function It(r,t){return 256*(r=pr(Math.floor(r),0,255))+pr(Math.floor(t),0,255)}ut.MAX_VERTEX_ARRAY_LENGTH=Math.pow(2,16)-1,Ve("SegmentVector",ut);const At=Qt([{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 Bt,Mt,Ct,ti={exports:{}},ui={exports:{}},fi={exports:{}},Gi=function(){if(Ct)return ti.exports;Ct=1;var r=(Bt||(Bt=1,ui.exports=function(n,a){var l,d,p,m,y,v,P,S;for(d=n.length-(l=3&n.length),p=a,y=3432918353,v=461845907,S=0;S<d;)P=255&n.charCodeAt(S)|(255&n.charCodeAt(++S))<<8|(255&n.charCodeAt(++S))<<16|(255&n.charCodeAt(++S))<<24,++S,p=27492+(65535&(m=5*(65535&(p=(p^=P=(65535&(P=(P=(65535&P)*y+(((P>>>16)*y&65535)<<16)&4294967295)<<15|P>>>17))*v+(((P>>>16)*v&65535)<<16)&4294967295)<<13|p>>>19))+((5*(p>>>16)&65535)<<16)&4294967295))+((58964+(m>>>16)&65535)<<16);switch(P=0,l){case 3:P^=(255&n.charCodeAt(S+2))<<16;case 2:P^=(255&n.charCodeAt(S+1))<<8;case 1:p^=P=(65535&(P=(P=(65535&(P^=255&n.charCodeAt(S)))*y+(((P>>>16)*y&65535)<<16)&4294967295)<<15|P>>>17))*v+(((P>>>16)*v&65535)<<16)&4294967295}return p^=n.length,p=2246822507*(65535&(p^=p>>>16))+((2246822507*(p>>>16)&65535)<<16)&4294967295,p=3266489909*(65535&(p^=p>>>13))+((3266489909*(p>>>16)&65535)<<16)&4294967295,(p^=p>>>16)>>>0}),ui.exports),t=(Mt||(Mt=1,fi.exports=function(n,a){for(var l,d=n.length,p=a^d,m=0;d>=4;)l=1540483477*(65535&(l=255&n.charCodeAt(m)|(255&n.charCodeAt(++m))<<8|(255&n.charCodeAt(++m))<<16|(255&n.charCodeAt(++m))<<24))+((1540483477*(l>>>16)&65535)<<16),p=1540483477*(65535&p)+((1540483477*(p>>>16)&65535)<<16)^(l=1540483477*(65535&(l^=l>>>24))+((1540483477*(l>>>16)&65535)<<16)),d-=4,++m;switch(d){case 3:p^=(255&n.charCodeAt(m+2))<<16;case 2:p^=(255&n.charCodeAt(m+1))<<8;case 1:p=1540483477*(65535&(p^=255&n.charCodeAt(m)))+((1540483477*(p>>>16)&65535)<<16)}return p=1540483477*(65535&(p^=p>>>13))+((1540483477*(p>>>16)&65535)<<16),(p^=p>>>15)>>>0}),fi.exports);return ti.exports=r,ti.exports.murmur3=r,ti.exports.murmur2=t,ti.exports}(),Qr=Te(Gi);class Fr{constructor(){this.ids=[],this.positions=[],this.indexed=!1}add(t,n,a,l){this.ids.push(Sn(t)),this.positions.push(n,a,l)}getPositions(t){if(!this.indexed)throw new Error("Trying to get index, but feature positions are not indexed");const n=Sn(t);let a=0,l=this.ids.length-1;for(;a<l;){const p=a+l>>1;this.ids[p]>=n?l=p:a=p+1}const d=[];for(;this.ids[a]===n;)d.push({index:this.positions[3*a],start:this.positions[3*a+1],end:this.positions[3*a+2]}),a++;return d}static serialize(t,n){const a=new Float64Array(t.ids),l=new Uint32Array(t.positions);return Mn(a,l,0,a.length-1),n&&n.push(a.buffer,l.buffer),{ids:a,positions:l}}static deserialize(t){const n=new Fr;return n.ids=t.ids,n.positions=t.positions,n.indexed=!0,n}}function Sn(r){const t=+r;return!isNaN(t)&&t<=Number.MAX_SAFE_INTEGER?t:Qr(String(r))}function Mn(r,t,n,a){for(;n<a;){const l=r[n+a>>1];let d=n-1,p=a+1;for(;;){do d++;while(r[d]<l);do p--;while(r[p]>l);if(d>=p)break;la(r,d,p),la(t,3*d,3*p),la(t,3*d+1,3*p+1),la(t,3*d+2,3*p+2)}p-n<a-p?(Mn(r,t,n,p),n=p+1):(Mn(r,t,p+1,a),a=p)}}function la(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}Ve("FeaturePositionMap",Fr);class Br{constructor(t,n){this.gl=t.gl,this.location=n}}class en extends Br{constructor(t,n){super(t,n),this.current=0}set(t){this.current!==t&&(this.current=t,this.gl.uniform1f(this.location,t))}}class Ji extends Br{constructor(t,n){super(t,n),this.current=[0,0,0,0]}set(t){t[0]===this.current[0]&&t[1]===this.current[1]&&t[2]===this.current[2]&&t[3]===this.current[3]||(this.current=t,this.gl.uniform4f(this.location,t[0],t[1],t[2],t[3]))}}class tn extends Br{constructor(t,n){super(t,n),this.current=yt.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 ca=new Float32Array(16);function ua(r){return[It(255*r.r,255*r.g),It(255*r.b,255*r.a)]}class qt{constructor(t,n,a){this.value=t,this.uniformNames=n.map(l=>`u_${l}`),this.type=a}setUniform(t,n,a){t.set(a.constantOr(this.value))}getBinding(t,n,a){return this.type==="color"?new tn(t,n):new en(t,n)}}class Wt{constructor(t,n){this.uniformNames=n.map(a=>`u_${a}`),this.patternFrom=null,this.patternTo=null,this.pixelRatioFrom=1,this.pixelRatioTo=1}setConstantPatternPositions(t,n){this.pixelRatioFrom=n.pixelRatio,this.pixelRatioTo=t.pixelRatio,this.patternFrom=n.tlbr,this.patternTo=t.tlbr}setUniform(t,n,a,l){const d=l==="u_pattern_to"?this.patternTo:l==="u_pattern_from"?this.patternFrom:l==="u_pixel_ratio_to"?this.pixelRatioTo:l==="u_pixel_ratio_from"?this.pixelRatioFrom:null;d&&t.set(d)}getBinding(t,n,a){return a.substr(0,9)==="u_pattern"?new Ji(t,n):new en(t,n)}}class ai{constructor(t,n,a,l){this.expression=t,this.type=a,this.maxValue=0,this.paintVertexAttributes=n.map(d=>({name:`a_${d}`,type:"Float32",components:a==="color"?2:1,offset:0})),this.paintVertexArray=new l}populatePaintArray(t,n,a,l,d){const p=this.paintVertexArray.length,m=this.expression.evaluate(new Ft(0),n,{},l,[],d);this.paintVertexArray.resize(t),this._setPaintValue(p,t,m)}updatePaintArray(t,n,a,l){const d=this.expression.evaluate({zoom:0},a,l);this._setPaintValue(t,n,d)}_setPaintValue(t,n,a){if(this.type==="color"){const l=ua(a);for(let d=t;d<n;d++)this.paintVertexArray.emplace(d,l[0],l[1])}else{for(let l=t;l<n;l++)this.paintVertexArray.emplace(l,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 zt{constructor(t,n,a,l,d,p){this.expression=t,this.uniformNames=n.map(m=>`u_${m}_t`),this.type=a,this.useIntegerZoom=l,this.zoom=d,this.maxValue=0,this.paintVertexAttributes=n.map(m=>({name:`a_${m}`,type:"Float32",components:a==="color"?4:2,offset:0})),this.paintVertexArray=new p}populatePaintArray(t,n,a,l,d){const p=this.expression.evaluate(new Ft(this.zoom),n,{},l,[],d),m=this.expression.evaluate(new Ft(this.zoom+1),n,{},l,[],d),y=this.paintVertexArray.length;this.paintVertexArray.resize(t),this._setPaintValue(y,t,p,m)}updatePaintArray(t,n,a,l){const d=this.expression.evaluate({zoom:this.zoom},a,l),p=this.expression.evaluate({zoom:this.zoom+1},a,l);this._setPaintValue(t,n,d,p)}_setPaintValue(t,n,a,l){if(this.type==="color"){const d=ua(a),p=ua(l);for(let m=t;m<n;m++)this.paintVertexArray.emplace(m,d[0],d[1],p[0],p[1])}else{for(let d=t;d<n;d++)this.paintVertexArray.emplace(d,a,l);this.maxValue=Math.max(this.maxValue,Math.abs(a),Math.abs(l))}}upload(t){this.paintVertexArray&&this.paintVertexArray.arrayBuffer&&(this.paintVertexBuffer&&this.paintVertexBuffer.buffer?this.paintVertexBuffer.updateData(this.paintVertexArray):this.paintVertexBuffer=t.createVertexBuffer(this.paintVertexArray,this.paintVertexAttributes,this.expression.isStateDependent))}destroy(){this.paintVertexBuffer&&this.paintVertexBuffer.destroy()}setUniform(t,n){const a=this.useIntegerZoom?Math.floor(n.zoom):n.zoom,l=pr(this.expression.interpolationFactor(a,this.zoom,this.zoom+1),0,1);t.set(l)}getBinding(t,n,a){return new en(t,n)}}class In{constructor(t,n,a,l,d,p){this.expression=t,this.type=n,this.useIntegerZoom=a,this.zoom=l,this.layerId=p,this.zoomInPaintVertexArray=new d,this.zoomOutPaintVertexArray=new d}populatePaintArray(t,n,a){const l=this.zoomInPaintVertexArray.length;this.zoomInPaintVertexArray.resize(t),this.zoomOutPaintVertexArray.resize(t),this._setPaintValues(l,t,n.patterns&&n.patterns[this.layerId],a)}updatePaintArray(t,n,a,l,d){this._setPaintValues(t,n,a.patterns&&a.patterns[this.layerId],d)}_setPaintValues(t,n,a,l){if(!l||!a)return;const{min:d,mid:p,max:m}=a,y=l[d],v=l[p],P=l[m];if(y&&v&&P)for(let S=t;S<n;S++)this.zoomInPaintVertexArray.emplace(S,v.tl[0],v.tl[1],v.br[0],v.br[1],y.tl[0],y.tl[1],y.br[0],y.br[1],v.pixelRatio,y.pixelRatio),this.zoomOutPaintVertexArray.emplace(S,v.tl[0],v.tl[1],v.br[0],v.br[1],P.tl[0],P.tl[1],P.br[0],P.br[1],v.pixelRatio,P.pixelRatio)}upload(t){this.zoomInPaintVertexArray&&this.zoomInPaintVertexArray.arrayBuffer&&this.zoomOutPaintVertexArray&&this.zoomOutPaintVertexArray.arrayBuffer&&(this.zoomInPaintVertexBuffer=t.createVertexBuffer(this.zoomInPaintVertexArray,At.members,this.expression.isStateDependent),this.zoomOutPaintVertexBuffer=t.createVertexBuffer(this.zoomOutPaintVertexArray,At.members,this.expression.isStateDependent))}destroy(){this.zoomOutPaintVertexBuffer&&this.zoomOutPaintVertexBuffer.destroy(),this.zoomInPaintVertexBuffer&&this.zoomInPaintVertexBuffer.destroy()}}class ih{constructor(t,n,a){this.binders={},this._buffers=[];const l=[];for(const d in t.paint._values){if(!a(d))continue;const p=t.paint.get(d);if(!(p instanceof Dr&&Ga(p.property.specification)))continue;const m=od(d,t.type),y=p.value,v=p.property.specification.type,P=p.property.useIntegerZoom,S=p.property.specification["property-type"],k=S==="cross-faded"||S==="cross-faded-data-driven";if(y.kind==="constant")this.binders[d]=k?new Wt(y.value,m):new qt(y.value,m,v),l.push(`/u_${d}`);else if(y.kind==="source"||k){const R=rh(d,v,"source");this.binders[d]=k?new In(y,v,P,n,R,t.id):new ai(y,m,v,R),l.push(`/a_${d}`)}else{const R=rh(d,v,"composite");this.binders[d]=new zt(y,m,v,P,n,R),l.push(`/z_${d}`)}}this.cacheKey=l.sort().join("")}getMaxValue(t){const n=this.binders[t];return n instanceof ai||n instanceof zt?n.maxValue:0}populatePaintArrays(t,n,a,l,d){for(const p in this.binders){const m=this.binders[p];(m instanceof ai||m instanceof zt||m instanceof In)&&m.populatePaintArray(t,n,a,l,d)}}setConstantPatternPositions(t,n){for(const a in this.binders){const l=this.binders[a];l instanceof Wt&&l.setConstantPatternPositions(t,n)}}updatePaintArrays(t,n,a,l,d){let p=!1;for(const m in t){const y=n.getPositions(m);for(const v of y){const P=a.feature(v.index);for(const S in this.binders){const k=this.binders[S];if((k instanceof ai||k instanceof zt||k instanceof In)&&k.expression.isStateDependent===!0){const R=l.paint.get(S);k.expression=R.value,k.updatePaintArray(v.start,v.end,P,t[m],d),p=!0}}}}return p}defines(){const t=[];for(const n in this.binders){const a=this.binders[n];(a instanceof qt||a instanceof Wt)&&t.push(...a.uniformNames.map(l=>`#define HAS_UNIFORM_${l}`))}return t}getBinderAttributes(){const t=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof ai||a instanceof zt)for(let l=0;l<a.paintVertexAttributes.length;l++)t.push(a.paintVertexAttributes[l].name);else if(a instanceof In)for(let l=0;l<At.members.length;l++)t.push(At.members[l].name)}return t}getBinderUniforms(){const t=[];for(const n in this.binders){const a=this.binders[n];if(a instanceof qt||a instanceof Wt||a instanceof zt)for(const l of a.uniformNames)t.push(l)}return t}getPaintVertexBuffers(){return this._buffers}getUniforms(t,n){const a=[];for(const l in this.binders){const d=this.binders[l];if(d instanceof qt||d instanceof Wt||d instanceof zt){for(const p of d.uniformNames)if(n[p]){const m=d.getBinding(t,n[p],p);a.push({name:p,property:l,binding:m})}}}return a}setUniforms(t,n,a,l){for(const{name:d,property:p,binding:m}of n)this.binders[p].setUniform(m,l,a.get(p),d)}updatePaintBuffers(t){this._buffers=[];for(const n in this.binders){const a=this.binders[n];if(t&&a instanceof In){const l=t.fromScale===2?a.zoomInPaintVertexBuffer:a.zoomOutPaintVertexBuffer;l&&this._buffers.push(l)}else(a instanceof ai||a instanceof zt)&&a.paintVertexBuffer&&this._buffers.push(a.paintVertexBuffer)}}upload(t){for(const n in this.binders){const a=this.binders[n];(a instanceof ai||a instanceof zt||a instanceof In)&&a.upload(t)}this.updatePaintBuffers()}destroy(){for(const t in this.binders){const n=this.binders[t];(n instanceof ai||n instanceof zt||n instanceof In)&&n.destroy()}}}class ha{constructor(t,n,a=()=>!0){this.programConfigurations={};for(const l of t)this.programConfigurations[l.id]=new ih(l,n,a);this.needsUpload=!1,this._featureMap=new Fr,this._bufferOffset=0}populatePaintArrays(t,n,a,l,d,p){for(const m in this.programConfigurations)this.programConfigurations[m].populatePaintArrays(t,n,l,d,p);n.id!==void 0&&this._featureMap.add(n.id,a,this._bufferOffset,t),this._bufferOffset=t,this.needsUpload=!0}updatePaintArrays(t,n,a,l){for(const d of a)this.needsUpload=this.programConfigurations[d.id].updatePaintArrays(t,this._featureMap,n,d,l)||this.needsUpload}get(t){return this.programConfigurations[t]}upload(t){if(this.needsUpload){for(const n in this.programConfigurations)this.programConfigurations[n].upload(t);this.needsUpload=!1}}destroy(){for(const t in this.programConfigurations)this.programConfigurations[t].destroy()}}function od(r,t){return{"text-opacity":["opacity"],"icon-opacity":["opacity"],"text-color":["fill_color"],"icon-color":["fill_color"],"text-halo-color":["halo_color"],"icon-halo-color":["halo_color"],"text-halo-blur":["halo_blur"],"icon-halo-blur":["halo_blur"],"text-halo-width":["halo_width"],"icon-halo-width":["halo_width"],"line-gap-width":["gapwidth"],"line-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"],"fill-extrusion-pattern":["pattern_to","pattern_from","pixel_ratio_to","pixel_ratio_from"]}[r]||[r.replace(`${t}-`,"").replace(/-/g,"_")]}function rh(r,t,n){const a={color:{source:aa,composite:f},number:{source:e,composite:aa}},l=function(d){return{"line-pattern":{source:de,composite:de},"fill-pattern":{source:de,composite:de},"fill-extrusion-pattern":{source:de,composite:de}}[d]}(r);return l&&l[n]||a[t][n]}Ve("ConstantBinder",qt),Ve("CrossFadedConstantBinder",Wt),Ve("SourceExpressionBinder",ai),Ve("CrossFadedCompositeBinder",In),Ve("CompositeExpressionBinder",zt),Ve("ProgramConfiguration",ih,{omit:["_buffers"]}),Ve("ProgramConfigurationSet",ha);const pc=Math.pow(2,14)-1,Cn=-pc-1;function En(r){const t=St/r.extent,n=r.loadGeometry();for(let a=0;a<n.length;a++){const l=n[a];for(let d=0;d<l.length;d++){const p=l[d],m=Math.round(p.x*t),y=Math.round(p.y*t);p.x=pr(m,Cn,pc),p.y=pr(y,Cn,pc),(m<p.x||m>p.x+1||y<p.y||y>p.y+1)&&Ci("Geometry exceeds allowed extent, reduce your vector tile buffer size")}}return n}function zn(r,t){return{type:r.type,id:r.id,properties:r.properties,geometry:t?En(r):[]}}const fc=-32768;function mc(r,t,n,a,l){r.emplaceBack(fc+8*t+a,fc+8*n+l)}class Uo{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new ee,this.indexArray=new Me,this.segments=new ut,this.programConfigurations=new ha(t.layers,t.zoom),this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){const l=this.layers[0],d=[];let p=null,m=!1,y=l.type==="heatmap";if(l.type==="circle"){const P=l;p=P.layout.get("circle-sort-key"),m=!p.isConstant(),y=y||P.paint.get("circle-pitch-alignment")==="map"}const v=y?n.subdivisionGranularity.circle:1;for(const{feature:P,id:S,index:k,sourceLayerIndex:R}of t){const L=this.layers[0]._featureFilter.needGeometry,O=zn(P,L);if(!this.layers[0]._featureFilter.filter(new Ft(this.zoom),O,a))continue;const $=m?p.evaluate(O,{},a):void 0,H={id:S,properties:P.properties,type:P.type,sourceLayerIndex:R,index:k,geometry:L?O.geometry:En(P),patterns:{},sortKey:$};d.push(H)}m&&d.sort((P,S)=>P.sortKey-S.sortKey);for(const P of d){const{geometry:S,index:k,sourceLayerIndex:R}=P,L=t[k].feature;this.addFeature(P,S,k,a,v),n.featureIndex.insert(L,S,k,R,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Tt),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}addFeature(t,n,a,l,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 n)for(const v of y){const P=v.x,S=v.y;if(P<0||P>=St||S<0||S>=St)continue;const k=this.segments.prepareSegment(m*m,this.layoutVertexArray,this.indexArray,t.sortKey),R=k.vertexLength;for(let L=0;L<m;L++)for(let O=0;O<m;O++)mc(this.layoutVertexArray,P,S,p[O],p[L]);for(let L=0;L<m-1;L++)for(let O=0;O<m-1;O++){const $=R+L*m+O,H=R+(L+1)*m+O;this.indexArray.emplaceBack($,H+1,$+1),this.indexArray.emplaceBack($,H,H+1)}k.vertexLength+=m*m,k.primitiveLength+=(m-1)*(m-1)*2}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,{},l)}}function $o(r,t){for(let n=0;n<r.length;n++)if(Gs(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(Gs(r,t[n]))return!0;return!!ld(r,t)}function sy(r,t,n){return!!Gs(r,t)||!!cd(t,r,n)}function Gp(r,t){if(r.length===1)return Wp(t,r[0]);for(let n=0;n<t.length;n++){const a=t[n];for(let l=0;l<a.length;l++)if(Gs(r,a[l]))return!0}for(let n=0;n<r.length;n++)if(Wp(t,r[n]))return!0;for(let n=0;n<t.length;n++)if(ld(r,t[n]))return!0;return!1}function oy(r,t,n){if(r.length>1){if(ld(r,t))return!0;for(let a=0;a<t.length;a++)if(cd(t[a],r,n))return!0}for(let a=0;a<r.length;a++)if(cd(r[a],t,n))return!0;return!1}function ld(r,t){if(r.length===0||t.length===0)return!1;for(let n=0;n<r.length-1;n++){const a=r[n],l=r[n+1];for(let d=0;d<t.length-1;d++)if(ly(a,l,t[d],t[d+1]))return!0}return!1}function ly(r,t,n,a){return oi(r,n,a)!==oi(t,n,a)&&oi(r,t,n)!==oi(r,t,a)}function cd(r,t,n){const a=n*n;if(t.length===1)return r.distSqr(t[0])<a;for(let l=1;l<t.length;l++)if(qp(r,t[l-1],t[l])<a)return!0;return!1}function qp(r,t,n){const a=t.distSqr(n);if(a===0)return r.distSqr(t);const l=((r.x-t.x)*(n.x-t.x)+(r.y-t.y)*(n.y-t.y))/a;return r.distSqr(l<0?t:l>1?n:n.sub(t)._mult(l)._add(t))}function Wp(r,t){for(let n=0;n<r.length;n++)if(Gs(r[n],t))return!0;return!1}function Gs(r,t){let n=!1;for(let a=0,l=r.length-1;a<r.length;l=a++){const d=r[a],p=r[l];d.y>t.y!=p.y>t.y&&t.x<(p.x-d.x)*(t.y-d.y)/(p.y-d.y)+d.x&&(n=!n)}return n}function cy(r,t,n){const a=n[0],l=n[2];if(r.x<a.x&&t.x<a.x||r.x>l.x&&t.x>l.x||r.y<a.y&&t.y<a.y||r.y>l.y&&t.y>l.y)return!1;const d=oi(r,t,n[0]);return d!==oi(r,t,n[1])||d!==oi(r,t,n[2])||d!==oi(r,t,n[3])}function gc(r,t,n){const a=t.paint.get(r).value;return a.kind==="constant"?a.value:n.programConfigurations.get(t.id).getMaxValue(r)}function nh(r){return Math.sqrt(r[0]*r[0]+r[1]*r[1])}function ah(r,t,n,a,l){if(!t[0]&&!t[1])return r;const d=Ze.convert(t)._mult(l);n==="viewport"&&d._rotate(-a);const p=[];for(let m=0;m<r.length;m++)p.push(r[m].sub(d));return p}let Hp,Kp;Ve("CircleBucket",Uo,{omit:["layers"]});var uy={get paint(){return Kp=Kp||new $i({"circle-radius":new tt(D.paint_circle["circle-radius"]),"circle-color":new tt(D.paint_circle["circle-color"]),"circle-blur":new tt(D.paint_circle["circle-blur"]),"circle-opacity":new tt(D.paint_circle["circle-opacity"]),"circle-translate":new Xe(D.paint_circle["circle-translate"]),"circle-translate-anchor":new Xe(D.paint_circle["circle-translate-anchor"]),"circle-pitch-scale":new Xe(D.paint_circle["circle-pitch-scale"]),"circle-pitch-alignment":new Xe(D.paint_circle["circle-pitch-alignment"]),"circle-stroke-width":new tt(D.paint_circle["circle-stroke-width"]),"circle-stroke-color":new tt(D.paint_circle["circle-stroke-color"]),"circle-stroke-opacity":new tt(D.paint_circle["circle-stroke-opacity"])})},get layout(){return Hp=Hp||new $i({"circle-sort-key":new tt(D.layout_circle["circle-sort-key"])})}};class hy extends Fi{constructor(t){super(t,uy)}createBucket(t){return new Uo(t)}queryRadius(t){const n=t;return gc("circle-radius",this,n)+gc("circle-stroke-width",this,n)+nh(this.paint.get("circle-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:l,transform:d,pixelsToTileUnits:p,unwrappedTileID:m,getElevation:y}){const v=ah(t,this.paint.get("circle-translate"),this.paint.get("circle-translate-anchor"),-d.bearingInRadians,p),P=this.paint.get("circle-radius").evaluate(n,a)+this.paint.get("circle-stroke-width").evaluate(n,a),S=this.paint.get("circle-pitch-alignment")==="map",k=S?v:function(L,O,$,H){return L.map(re=>Xp(re,O,$,H))}(v,d,m,y),R=S?P*p:P;for(const L of l)for(const O of L){const $=S?O:Xp(O,d,m,y);let H=R;const re=d.projectTileCoordinates(O.x,O.y,m,y).signedDistanceFromCamera;if(this.paint.get("circle-pitch-scale")==="viewport"&&this.paint.get("circle-pitch-alignment")==="map"?H*=re/d.cameraToCenterDistance:this.paint.get("circle-pitch-scale")==="map"&&this.paint.get("circle-pitch-alignment")==="viewport"&&(H*=d.cameraToCenterDistance/re),sy(k,$,H))return!0}return!1}}function Xp(r,t,n,a){const l=t.projectTileCoordinates(r.x,r.y,n,a).point;return new Ze((.5*l.x+.5)*t.width,(.5*-l.y+.5)*t.height)}class Yp extends Uo{}let Jp;Ve("HeatmapBucket",Yp,{omit:["layers"]});var dy={get paint(){return Jp=Jp||new $i({"heatmap-radius":new tt(D.paint_heatmap["heatmap-radius"]),"heatmap-weight":new tt(D.paint_heatmap["heatmap-weight"]),"heatmap-intensity":new Xe(D.paint_heatmap["heatmap-intensity"]),"heatmap-color":new oc(D.paint_heatmap["heatmap-color"]),"heatmap-opacity":new Xe(D.paint_heatmap["heatmap-opacity"])})}};function ud(r,{width:t,height:n},a,l){if(l){if(l instanceof Uint8ClampedArray)l=new Uint8Array(l.buffer);else if(l.length!==t*n*a)throw new RangeError(`mismatched image size. expected: ${l.length} but got: ${t*n*a}`)}else l=new Uint8Array(t*n*a);return r.width=t,r.height=n,r.data=l,r}function Qp(r,{width:t,height:n},a){if(t===r.width&&n===r.height)return;const l=ud({},{width:t,height:n},a);hd(r,l,{x:0,y:0},{x:0,y:0},{width:Math.min(r.width,t),height:Math.min(r.height,n)},a),r.width=t,r.height=n,r.data=l.data}function hd(r,t,n,a,l,d){if(l.width===0||l.height===0)return t;if(l.width>r.width||l.height>r.height||n.x>r.width-l.width||n.y>r.height-l.height)throw new RangeError("out of range source coordinates for image copy");if(l.width>t.width||l.height>t.height||a.x>t.width-l.width||a.y>t.height-l.height)throw new RangeError("out of range destination coordinates for image copy");const p=r.data,m=t.data;if(p===m)throw new Error("srcData equals dstData, so image is already copied");for(let y=0;y<l.height;y++){const v=((n.y+y)*r.width+n.x)*d,P=((a.y+y)*t.width+a.x)*d;for(let S=0;S<l.width*d;S++)m[P+S]=p[v+S]}return t}class _c{constructor(t,n){ud(this,t,1,n)}resize(t){Qp(this,t,1)}clone(){return new _c({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,l,d){hd(t,n,a,l,d,1)}}class br{constructor(t,n){ud(this,t,4,n)}resize(t){Qp(this,t,4)}replace(t,n){n?this.data.set(t):this.data=t instanceof Uint8ClampedArray?new Uint8Array(t.buffer):t}clone(){return new br({width:this.width,height:this.height},new Uint8Array(this.data))}static copy(t,n,a,l,d){hd(t,n,a,l,d,4)}}function ef(r){const t={},n=r.resolution||256,a=r.clips?r.clips.length:1,l=r.image||new br({width:n,height:a});if(Math.log(n)/Math.LN2%1!=0)throw new Error(`width is not a power of 2 - ${n}`);const d=(p,m,y)=>{t[r.evaluationKey]=y;const v=r.expression.evaluate(t);l.data[p+m+0]=Math.floor(255*v.r/v.a),l.data[p+m+1]=Math.floor(255*v.g/v.a),l.data[p+m+2]=Math.floor(255*v.b/v.a),l.data[p+m+3]=Math.floor(255*v.a)};if(r.clips)for(let p=0,m=0;p<a;++p,m+=4*n)for(let y=0,v=0;y<n;y++,v+=4){const P=y/(n-1),{start:S,end:k}=r.clips[p];d(m,v,S*(1-P)+k*P)}else for(let p=0,m=0;p<n;p++,m+=4)d(0,m,p/(n-1));return l}Ve("AlphaImage",_c),Ve("RGBAImage",br);const dd="big-fb";class py extends Fi{createBucket(t){return new Yp(t)}constructor(t){super(t,dy),this.heatmapFbos=new Map,this._updateColorRamp()}_handleSpecialPaintPropertyUpdate(t){t==="heatmap-color"&&this._updateColorRamp()}_updateColorRamp(){this.colorRamp=ef({expression:this._transitionablePaint._values["heatmap-color"].value.expression,evaluationKey:"heatmapDensity",image:this.colorRamp}),this.colorRampTexture=null}resize(){this.heatmapFbos.has(dd)&&this.heatmapFbos.delete(dd)}queryRadius(){return 0}queryIntersectsFeature(){return!1}hasOffscreenPass(){return this.paint.get("heatmap-opacity")!==0&&this.visibility!=="none"}}let tf;var fy={get paint(){return tf=tf||new $i({"hillshade-illumination-direction":new Xe(D.paint_hillshade["hillshade-illumination-direction"]),"hillshade-illumination-anchor":new Xe(D.paint_hillshade["hillshade-illumination-anchor"]),"hillshade-exaggeration":new Xe(D.paint_hillshade["hillshade-exaggeration"]),"hillshade-shadow-color":new Xe(D.paint_hillshade["hillshade-shadow-color"]),"hillshade-highlight-color":new Xe(D.paint_hillshade["hillshade-highlight-color"]),"hillshade-accent-color":new Xe(D.paint_hillshade["hillshade-accent-color"])})}};class my extends Fi{constructor(t){super(t,fy)}hasOffscreenPass(){return this.paint.get("hillshade-exaggeration")!==0&&this.visibility!=="none"}}const gy=Qt([{name:"a_pos",components:2,type:"Int16"}],4),{members:_y}=gy;function pd(r,t,n){const a=n.patternDependencies;let l=!1;for(const d of t){const p=d.paint.get(`${r}-pattern`);p.isConstant()||(l=!0);const m=p.constantOr(null);m&&(l=!0,a[m.to]=!0,a[m.from]=!0)}return l}function fd(r,t,n,a,l){const d=l.patternDependencies;for(const p of t){const m=p.paint.get(`${r}-pattern`).value;if(m.kind!=="constant"){let y=m.evaluate({zoom:a-1},n,{},l.availableImages),v=m.evaluate({zoom:a},n,{},l.availableImages),P=m.evaluate({zoom:a+1},n,{},l.availableImages);y=y&&y.name?y.name:y,v=v&&v.name?v.name:v,P=P&&P.name?P.name:P,d[y]=!0,d[v]=!0,d[P]=!0,n.patterns[p.id]={min:y,mid:v,max:P}}}return n}function rf(r,t,n,a,l){let d;if(l===function(p,m,y,v){let P=0;for(let S=m,k=y-v;S<y;S+=v)P+=(p[k]-p[S])*(p[S+1]+p[k+1]),k=S;return P}(r,t,n,a)>0)for(let p=t;p<n;p+=a)d=of(p/a|0,r[p],r[p+1],d);else for(let p=n-a;p>=t;p-=a)d=of(p/a|0,r[p],r[p+1],d);return d&&Go(d,d.next)&&(bc(d),d=d.next),d}function qs(r,t){if(!r)return r;t||(t=r);let n,a=r;do if(n=!1,a.steiner||!Go(a,a.next)&&ii(a.prev,a,a.next)!==0)a=a.next;else{if(bc(a),a=t=a.prev,a===a.next)break;n=!0}while(n||a!==t);return t}function yc(r,t,n,a,l,d,p){if(!r)return;!p&&d&&function(y,v,P,S){let k=y;do k.z===0&&(k.z=md(k.x,k.y,v,P,S)),k.prevZ=k.prev,k.nextZ=k.next,k=k.next;while(k!==y);k.prevZ.nextZ=null,k.prevZ=null,function(R){let L,O=1;do{let $,H=R;R=null;let re=null;for(L=0;H;){L++;let X=H,A=0;for(let J=0;J<O&&(A++,X=X.nextZ,X);J++);let U=O;for(;A>0||U>0&&X;)A!==0&&(U===0||!X||H.z<=X.z)?($=H,H=H.nextZ,A--):($=X,X=X.nextZ,U--),re?re.nextZ=$:R=$,$.prevZ=re,re=$;H=X}re.nextZ=null,O*=2}while(L>1)}(k)}(r,a,l,d);let m=r;for(;r.prev!==r.next;){const y=r.prev,v=r.next;if(d?xy(r,a,l,d):yy(r))t.push(y.i,r.i,v.i),bc(r),r=v.next,m=v.next;else if((r=v)===m){p?p===1?yc(r=vy(qs(r),t),t,n,a,l,d,2):p===2&&by(r,t,n,a,l,d):yc(qs(r),t,n,a,l,d,1);break}}}function yy(r){const t=r.prev,n=r,a=r.next;if(ii(t,n,a)>=0)return!1;const l=t.x,d=n.x,p=a.x,m=t.y,y=n.y,v=a.y,P=Math.min(l,d,p),S=Math.min(m,y,v),k=Math.max(l,d,p),R=Math.max(m,y,v);let L=a.next;for(;L!==t;){if(L.x>=P&&L.x<=k&&L.y>=S&&L.y<=R&&xc(l,m,d,y,p,v,L.x,L.y)&&ii(L.prev,L,L.next)>=0)return!1;L=L.next}return!0}function xy(r,t,n,a){const l=r.prev,d=r,p=r.next;if(ii(l,d,p)>=0)return!1;const m=l.x,y=d.x,v=p.x,P=l.y,S=d.y,k=p.y,R=Math.min(m,y,v),L=Math.min(P,S,k),O=Math.max(m,y,v),$=Math.max(P,S,k),H=md(R,L,t,n,a),re=md(O,$,t,n,a);let X=r.prevZ,A=r.nextZ;for(;X&&X.z>=H&&A&&A.z<=re;){if(X.x>=R&&X.x<=O&&X.y>=L&&X.y<=$&&X!==l&&X!==p&&xc(m,P,y,S,v,k,X.x,X.y)&&ii(X.prev,X,X.next)>=0||(X=X.prevZ,A.x>=R&&A.x<=O&&A.y>=L&&A.y<=$&&A!==l&&A!==p&&xc(m,P,y,S,v,k,A.x,A.y)&&ii(A.prev,A,A.next)>=0))return!1;A=A.nextZ}for(;X&&X.z>=H;){if(X.x>=R&&X.x<=O&&X.y>=L&&X.y<=$&&X!==l&&X!==p&&xc(m,P,y,S,v,k,X.x,X.y)&&ii(X.prev,X,X.next)>=0)return!1;X=X.prevZ}for(;A&&A.z<=re;){if(A.x>=R&&A.x<=O&&A.y>=L&&A.y<=$&&A!==l&&A!==p&&xc(m,P,y,S,v,k,A.x,A.y)&&ii(A.prev,A,A.next)>=0)return!1;A=A.nextZ}return!0}function vy(r,t){let n=r;do{const a=n.prev,l=n.next.next;!Go(a,l)&&af(a,n,n.next,l)&&vc(a,l)&&vc(l,a)&&(t.push(a.i,n.i,l.i),bc(n),bc(n.next),n=r=l),n=n.next}while(n!==r);return qs(n)}function by(r,t,n,a,l,d){let p=r;do{let m=p.next.next;for(;m!==p.prev;){if(p.i!==m.i&&My(p,m)){let y=sf(p,m);return p=qs(p,p.next),y=qs(y,y.next),yc(p,t,n,a,l,d,0),void yc(y,t,n,a,l,d,0)}m=m.next}p=p.next}while(p!==r)}function wy(r,t){let n=r.x-t.x;return n===0&&(n=r.y-t.y,n===0)&&(n=(r.next.y-r.y)/(r.next.x-r.x)-(t.next.y-t.y)/(t.next.x-t.x)),n}function Ty(r,t){const n=function(l,d){let p=d;const m=l.x,y=l.y;let v,P=-1/0;if(Go(l,p))return p;do{if(Go(l,p.next))return p.next;if(y<=p.y&&y>=p.next.y&&p.next.y!==p.y){const O=p.x+(y-p.y)*(p.next.x-p.x)/(p.next.y-p.y);if(O<=m&&O>P&&(P=O,v=p.x<p.next.x?p:p.next,O===m))return v}p=p.next}while(p!==d);if(!v)return null;const S=v,k=v.x,R=v.y;let L=1/0;p=v;do{if(m>=p.x&&p.x>=k&&m!==p.x&&nf(y<R?m:P,y,k,R,y<R?P:m,y,p.x,p.y)){const O=Math.abs(y-p.y)/(m-p.x);vc(p,l)&&(O<L||O===L&&(p.x>v.x||p.x===v.x&&Py(v,p)))&&(v=p,L=O)}p=p.next}while(p!==S);return v}(r,t);if(!n)return t;const a=sf(n,r);return qs(a,a.next),qs(n,n.next)}function Py(r,t){return ii(r.prev,r,t.prev)<0&&ii(t.next,r,r.next)<0}function md(r,t,n,a,l){return(r=1431655765&((r=858993459&((r=252645135&((r=16711935&((r=(r-n)*l|0)|r<<8))|r<<4))|r<<2))|r<<1))|(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-a)*l|0)|t<<8))|t<<4))|t<<2))|t<<1))<<1}function Sy(r){let t=r,n=r;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==r);return n}function nf(r,t,n,a,l,d,p,m){return(l-p)*(t-m)>=(r-p)*(d-m)&&(r-p)*(a-m)>=(n-p)*(t-m)&&(n-p)*(d-m)>=(l-p)*(a-m)}function xc(r,t,n,a,l,d,p,m){return!(r===p&&t===m)&&nf(r,t,n,a,l,d,p,m)}function My(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!function(n,a){let l=n;do{if(l.i!==n.i&&l.next.i!==n.i&&l.i!==a.i&&l.next.i!==a.i&&af(l,l.next,n,a))return!0;l=l.next}while(l!==n);return!1}(r,t)&&(vc(r,t)&&vc(t,r)&&function(n,a){let l=n,d=!1;const p=(n.x+a.x)/2,m=(n.y+a.y)/2;do l.y>m!=l.next.y>m&&l.next.y!==l.y&&p<(l.next.x-l.x)*(m-l.y)/(l.next.y-l.y)+l.x&&(d=!d),l=l.next;while(l!==n);return d}(r,t)&&(ii(r.prev,r,t.prev)||ii(r,t.prev,t))||Go(r,t)&&ii(r.prev,r,r.next)>0&&ii(t.prev,t,t.next)>0)}function ii(r,t,n){return(t.y-r.y)*(n.x-t.x)-(t.x-r.x)*(n.y-t.y)}function Go(r,t){return r.x===t.x&&r.y===t.y}function af(r,t,n,a){const l=oh(ii(r,t,n)),d=oh(ii(r,t,a)),p=oh(ii(n,a,r)),m=oh(ii(n,a,t));return l!==d&&p!==m||!(l!==0||!sh(r,n,t))||!(d!==0||!sh(r,a,t))||!(p!==0||!sh(n,r,a))||!(m!==0||!sh(n,t,a))}function sh(r,t,n){return t.x<=Math.max(r.x,n.x)&&t.x>=Math.min(r.x,n.x)&&t.y<=Math.max(r.y,n.y)&&t.y>=Math.min(r.y,n.y)}function oh(r){return r>0?1:r<0?-1:0}function vc(r,t){return ii(r.prev,r,r.next)<0?ii(r,t,r.next)>=0&&ii(r,r.prev,t)>=0:ii(r,t,r.prev)<0||ii(r,r.next,t)<0}function sf(r,t){const n=gd(r.i,r.x,r.y),a=gd(t.i,t.x,t.y),l=r.next,d=t.prev;return r.next=t,t.prev=r,n.next=l,l.prev=n,a.next=n,n.prev=a,d.next=a,a.prev=d,a}function of(r,t,n,a){const l=gd(r,t,n);return a?(l.next=a.next,l.prev=a,a.next.prev=l,a.next=l):(l.prev=l,l.next=l),l}function bc(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function gd(r,t,n){return{i:r,x:t,y:n,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}class qo{constructor(t,n){if(n>t)throw new Error("Min granularity must not be greater than base granularity.");this._baseZoomGranularity=t,this._minGranularity=n}getGranularityForZoomLevel(t){return Math.max(Math.floor(this._baseZoomGranularity/(1<<t)),this._minGranularity,1)}}class lh{constructor(t){this.fill=t.fill,this.line=t.line,this.tile=t.tile,this.stencil=t.stencil,this.circle=t.circle}}lh.noSubdivision=new lh({fill:new qo(0,0),line:new qo(0,0),tile:new qo(0,0),stencil:new qo(0,0),circle:1}),Ve("SubdivisionGranularityExpression",qo),Ve("SubdivisionGranularitySetting",lh);const Wo=-32768,wc=32767;class Iy{constructor(t,n){this._vertexBuffer=[],this._vertexDictionary=new Map,this._used=!1,this._granularity=t,this._granularityCellSize=St/t,this._canonical=n}_getKey(t,n){return(t+=32768)<<16|(n+=32768)<<0}_vertexToIndex(t,n){if(t<-32768||n<-32768||t>32767||n>32767)throw new Error("Vertex coordinates are out of signed 16 bit integer range.");const a=0|Math.round(t),l=0|Math.round(n),d=this._getKey(a,l);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,l),p}_subdivideTrianglesScanline(t){if(this._granularity<2)return function(l,d){const p=[];for(let m=0;m<d.length;m+=3){const y=d[m],v=d[m+1],P=d[m+2],S=l[2*y],k=l[2*y+1];(l[2*v]-S)*(l[2*P+1]-k)-(l[2*v+1]-k)*(l[2*P]-S)>0?(p.push(y),p.push(P),p.push(v)):(p.push(y),p.push(v),p.push(P))}return p}(this._vertexBuffer,t);const n=[],a=t.length;for(let l=0;l<a;l+=3){const d=[t[l+0],t[l+1],t[l+2]],p=[this._vertexBuffer[2*t[l+0]+0],this._vertexBuffer[2*t[l+0]+1],this._vertexBuffer[2*t[l+1]+0],this._vertexBuffer[2*t[l+1]+1],this._vertexBuffer[2*t[l+2]+0],this._vertexBuffer[2*t[l+2]+1]];let m=1/0,y=1/0,v=-1/0,P=-1/0;for(let O=0;O<3;O++){const $=p[2*O],H=p[2*O+1];m=Math.min(m,$),v=Math.max(v,$),y=Math.min(y,H),P=Math.max(P,H)}if(m===v||y===P)continue;const S=Math.floor(m/this._granularityCellSize),k=Math.ceil(v/this._granularityCellSize),R=Math.floor(y/this._granularityCellSize),L=Math.ceil(P/this._granularityCellSize);if(S!==k||R!==L)for(let O=R;O<L;O++){const $=this._scanlineGenerateVertexRingForCellRow(O,p,d);Cy(this._vertexBuffer,$,n)}else n.push(...d)}return n}_scanlineGenerateVertexRingForCellRow(t,n,a){const l=t*this._granularityCellSize,d=l+this._granularityCellSize,p=[];for(let m=0;m<3;m++){const y=n[2*m],v=n[2*m+1],P=n[2*(m+1)%6],S=n[(2*(m+1)+1)%6],k=n[2*(m+2)%6],R=n[(2*(m+2)+1)%6],L=P-y,O=S-v,$=L===0,H=O===0,re=(l-v)/O,X=(d-v)/O,A=Math.min(re,X),U=Math.max(re,X);if(!H&&(A>=1||U<=0)||H&&(v<l||v>d)){S>=l&&S<=d&&p.push(a[(m+1)%3]);continue}!H&&A>0&&p.push(this._vertexToIndex(y+L*A,v+O*A));const J=y+L*Math.max(A,0),fe=y+L*Math.min(U,1);$||this._generateIntraEdgeVertices(p,y,v,P,S,J,fe),!H&&U<1&&p.push(this._vertexToIndex(y+L*U,v+O*U)),(H||S>=l&&S<=d)&&p.push(a[(m+1)%3]),!H&&(S<=l||S>=d)&&this._generateInterEdgeVertices(p,y,v,P,S,k,R,fe,l,d)}return p}_generateIntraEdgeVertices(t,n,a,l,d,p,m){const y=l-n,v=d-a,P=v===0,S=P?Math.min(n,l):Math.min(p,m),k=P?Math.max(n,l):Math.max(p,m),R=Math.floor(S/this._granularityCellSize)+1,L=Math.ceil(k/this._granularityCellSize)-1;if(P?n<l:p<m)for(let O=R;O<=L;O++){const $=O*this._granularityCellSize;t.push(this._vertexToIndex($,a+v*($-n)/y))}else for(let O=L;O>=R;O--){const $=O*this._granularityCellSize;t.push(this._vertexToIndex($,a+v*($-n)/y))}}_generateInterEdgeVertices(t,n,a,l,d,p,m,y,v,P){const S=d-a,k=p-l,R=m-d,L=(v-d)/R,O=(P-d)/R,$=Math.min(L,O),H=Math.max(L,O),re=l+k*$;let X=Math.floor(Math.min(re,y)/this._granularityCellSize)+1,A=Math.ceil(Math.max(re,y)/this._granularityCellSize)-1,U=y<re;const J=R===0;if(J&&(m===v||m===P))return;if(J||$>=1||H<=0){const Ce=a-m,me=p+(n-p)*Math.min((v-m)/Ce,(P-m)/Ce);X=Math.floor(Math.min(me,y)/this._granularityCellSize)+1,A=Math.ceil(Math.max(me,y)/this._granularityCellSize)-1,U=y<me}const fe=S>0?P:v;if(U)for(let Ce=X;Ce<=A;Ce++)t.push(this._vertexToIndex(Ce*this._granularityCellSize,fe));else for(let Ce=A;Ce>=X;Ce--)t.push(this._vertexToIndex(Ce*this._granularityCellSize,fe))}_generateOutline(t){const n=[];for(const a of t){const l=Ws(a,this._granularity,!0),d=this._pointArrayToIndices(l),p=[];for(let m=1;m<d.length;m++)p.push(d[m-1]),p.push(d[m]);n.push(p)}return n}_handlePoles(t){let n=!1,a=!1;this._canonical&&(this._canonical.y===0&&(n=!0),this._canonical.y===(1<<this._canonical.z)-1&&(a=!0)),(n||a)&&this._fillPoles(t,n,a)}_ensureNoPoleVertices(){const t=this._vertexBuffer;for(let n=0;n<t.length;n+=2){const a=t[n+1];a===Wo&&(t[n+1]=-32767),a===wc&&(t[n+1]=32766)}}_generatePoleQuad(t,n,a,l,d,p){l>d!=(p===Wo)?(t.push(n),t.push(a),t.push(this._vertexToIndex(l,p)),t.push(a),t.push(this._vertexToIndex(d,p)),t.push(this._vertexToIndex(l,p))):(t.push(a),t.push(n),t.push(this._vertexToIndex(l,p)),t.push(this._vertexToIndex(d,p)),t.push(a),t.push(this._vertexToIndex(l,p)))}_fillPoles(t,n,a){const l=this._vertexBuffer,d=St,p=t.length;for(let m=2;m<p;m+=3){const y=t[m-2],v=t[m-1],P=t[m],S=l[2*y],k=l[2*y+1],R=l[2*v],L=l[2*v+1],O=l[2*P],$=l[2*P+1];n&&(k===0&&L===0&&this._generatePoleQuad(t,y,v,S,R,Wo),L===0&&$===0&&this._generatePoleQuad(t,v,P,R,O,Wo),$===0&&k===0&&this._generatePoleQuad(t,P,y,O,S,Wo)),a&&(k===d&&L===d&&this._generatePoleQuad(t,y,v,S,R,wc),L===d&&$===d&&this._generatePoleQuad(t,v,P,R,O,wc),$===d&&k===d&&this._generatePoleQuad(t,P,y,O,S,wc))}}_initializeVertices(t){for(let n=0;n<t.length;n+=2)this._vertexToIndex(t[n],t[n+1])}subdividePolygonInternal(t,n){if(this._used)throw new Error("Subdivision: multiple use not allowed.");this._used=!0;const{flattened:a,holeIndices:l}=function(m){const y=[],v=[];for(const P of m)if(P.length!==0){P!==m[0]&&y.push(v.length/2);for(let S=0;S<P.length;S++)v.push(P[S].x),v.push(P[S].y)}return{flattened:v,holeIndices:y}}(t);let d;this._initializeVertices(a);try{const m=function(v,P,S=2){const k=P&&P.length,R=k?P[0]*S:v.length;let L=rf(v,0,R,S,!0);const O=[];if(!L||L.next===L.prev)return O;let $,H,re;if(k&&(L=function(X,A,U,J){const fe=[];for(let Ce=0,me=A.length;Ce<me;Ce++){const xe=rf(X,A[Ce]*J,Ce<me-1?A[Ce+1]*J:X.length,J,!1);xe===xe.next&&(xe.steiner=!0),fe.push(Sy(xe))}fe.sort(wy);for(let Ce=0;Ce<fe.length;Ce++)U=Ty(fe[Ce],U);return U}(v,P,L,S)),v.length>80*S){$=1/0,H=1/0;let X=-1/0,A=-1/0;for(let U=S;U<R;U+=S){const J=v[U],fe=v[U+1];J<$&&($=J),fe<H&&(H=fe),J>X&&(X=J),fe>A&&(A=fe)}re=Math.max(X-$,A-H),re=re!==0?32767/re:0}return yc(L,O,S,$,H,re,0),O}(a,l),y=this._convertIndices(a,m);d=this._subdivideTrianglesScanline(y)}catch(m){console.error(m)}let p=[];return n&&(p=this._generateOutline(t)),this._ensureNoPoleVertices(),this._handlePoles(d),{verticesFlattened:this._vertexBuffer,indicesTriangles:d,indicesLineList:p}}_convertIndices(t,n){const a=[];for(let l=0;l<n.length;l++)a.push(this._vertexToIndex(t[2*n[l]],t[2*n[l]+1]));return a}_pointArrayToIndices(t){const n=[];for(let a=0;a<t.length;a++){const l=t[a];n.push(this._vertexToIndex(l.x,l.y))}return n}}function lf(r,t,n,a=!0){return new Iy(n,t).subdividePolygonInternal(r,a)}function Ws(r,t,n=!1){if(!r||r.length<1)return[];if(r.length<2)return[];const a=r[0],l=r[r.length-1],d=n&&(a.x!==l.x||a.y!==l.y);if(t<2)return d?[...r,r[0]]:[...r];const p=Math.floor(St/t),m=[];m.push(new Ze(r[0].x,r[0].y));const y=r.length,v=d?y:y-1;for(let P=0;P<v;P++){const S=r[P],k=P<y-1?r[P+1]:r[0],R=S.x,L=S.y,O=k.x,$=k.y,H=R!==O,re=L!==$;if(!H&&!re)continue;const X=O-R,A=$-L,U=Math.abs(X),J=Math.abs(A);let fe=R,Ce=L;for(;;){const xe=X>0?(Math.floor(fe/p)+1)*p:(Math.ceil(fe/p)-1)*p,Re=A>0?(Math.floor(Ce/p)+1)*p:(Math.ceil(Ce/p)-1)*p,Ee=Math.abs(fe-xe),De=Math.abs(Ce-Re),Pe=Math.abs(fe-O),$e=Math.abs(Ce-$),Qe=H?Ee/U:Number.POSITIVE_INFINITY,Ye=re?De/J:Number.POSITIVE_INFINITY;if((Pe<=Ee||!H)&&($e<=De||!re))break;if(Qe<Ye&&H||!re){fe=xe,Ce+=A*Qe;const He=new Ze(fe,Math.round(Ce));m[m.length-1].x===He.x&&m[m.length-1].y===He.y||m.push(He)}else{fe+=X*Ye,Ce=Re;const He=new Ze(Math.round(fe),Ce);m[m.length-1].x===He.x&&m[m.length-1].y===He.y||m.push(He)}}const me=new Ze(O,$);m[m.length-1].x===me.x&&m[m.length-1].y===me.y||m.push(me)}return m}function Cy(r,t,n){if(t.length===0)throw new Error("Subdivision vertex ring is empty.");let a=0,l=r[2*t[0]];for(let y=1;y<t.length;y++){const v=r[2*t[y]];v<l&&(l=v,a=y)}const d=t.length;let p=a,m=(p+1)%d;for(;;){const y=p-1>=0?p-1:d-1,v=(m+1)%d,P=r[2*t[y]],S=r[2*t[v]],k=r[2*t[p]],R=r[2*t[p]+1],L=r[2*t[m]+1];let O=!1;if(P<S)O=!0;else if(P>S)O=!1;else{const $=L-R,H=-(r[2*t[m]]-k),re=R<L?1:-1;((P-k)*$+(r[2*t[y]+1]-R)*H)*re>((S-k)*$+(r[2*t[v]+1]-R)*H)*re&&(O=!0)}if(O){const $=t[y],H=t[p],re=t[m];$!==H&&$!==re&&H!==re&&n.push(re,H,$),p--,p<0&&(p=d-1)}else{const $=t[v],H=t[p],re=t[m];$!==H&&$!==re&&H!==re&&n.push(re,H,$),m++,m>=d&&(m=0)}if(y===v)break}}function cf(r,t,n,a,l,d,p,m,y){const v=l.length/2,P=p&&m&&y;if(v<ut.MAX_VERTEX_ARRAY_LENGTH){const S=t.prepareSegment(v,n,a),k=S.vertexLength;for(let O=0;O<d.length;O+=3)a.emplaceBack(k+d[O],k+d[O+1],k+d[O+2]);let R,L;S.vertexLength+=v,S.primitiveLength+=d.length/3,P&&(L=p.prepareSegment(v,n,m),R=L.vertexLength,L.vertexLength+=v);for(let O=0;O<l.length;O+=2)r(l[O],l[O+1]);if(P)for(let O=0;O<y.length;O++){const $=y[O];for(let H=1;H<$.length;H+=2)m.emplaceBack(R+$[H-1],R+$[H]);L.primitiveLength+=$.length/2}}else(function(S,k,R,L,O,$){const H=[];for(let J=0;J<L.length/2;J++)H.push(-1);const re={count:0};let X=0,A=S.getOrCreateLatestSegment(k,R),U=A.vertexLength;for(let J=2;J<O.length;J+=3){const fe=O[J-2],Ce=O[J-1],me=O[J];let xe=H[fe]<X,Re=H[Ce]<X,Ee=H[me]<X;A.vertexLength+((xe?1:0)+(Re?1:0)+(Ee?1:0))>ut.MAX_VERTEX_ARRAY_LENGTH&&(A=S.createNewSegment(k,R),X=re.count,xe=!0,Re=!0,Ee=!0,U=0);const De=Tc(H,L,$,re,fe,xe,A),Pe=Tc(H,L,$,re,Ce,Re,A),$e=Tc(H,L,$,re,me,Ee,A);R.emplaceBack(U+De-X,U+Pe-X,U+$e-X),A.primitiveLength++}})(t,n,a,l,d,r),P&&function(S,k,R,L,O,$){const H=[];for(let J=0;J<L.length/2;J++)H.push(-1);const re={count:0};let X=0,A=S.getOrCreateLatestSegment(k,R),U=A.vertexLength;for(let J=0;J<O.length;J++){const fe=O[J];for(let Ce=1;Ce<O[J].length;Ce+=2){const me=fe[Ce-1],xe=fe[Ce];let Re=H[me]<X,Ee=H[xe]<X;A.vertexLength+((Re?1:0)+(Ee?1:0))>ut.MAX_VERTEX_ARRAY_LENGTH&&(A=S.createNewSegment(k,R),X=re.count,Re=!0,Ee=!0,U=0);const De=Tc(H,L,$,re,me,Re,A),Pe=Tc(H,L,$,re,xe,Ee,A);R.emplaceBack(U+De-X,U+Pe-X),A.primitiveLength++}}}(p,n,m,l,y,r),t.forceNewSegmentOnNextPrepare(),p==null||p.forceNewSegmentOnNextPrepare()}function Tc(r,t,n,a,l,d,p){if(d){const m=a.count;return n(t[2*l],t[2*l+1]),r[l]=a.count,a.count++,p.vertexLength++,m}return r[l]}class _d{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.layoutVertexArray=new te,this.indexArray=new Me,this.indexArray2=new We,this.programConfigurations=new ha(t.layers,t.zoom),this.segments=new ut,this.segments2=new ut,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.hasPattern=pd("fill",this.layers,n);const l=this.layers[0].layout.get("fill-sort-key"),d=!l.isConstant(),p=[];for(const{feature:m,id:y,index:v,sourceLayerIndex:P}of t){const S=this.layers[0]._featureFilter.needGeometry,k=zn(m,S);if(!this.layers[0]._featureFilter.filter(new Ft(this.zoom),k,a))continue;const R=d?l.evaluate(k,{},a,n.availableImages):void 0,L={id:y,properties:m.properties,type:m.type,sourceLayerIndex:P,index:v,geometry:S?k.geometry:En(m),patterns:{},sortKey:R};p.push(L)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:v,sourceLayerIndex:P}=m;if(this.hasPattern){const S=fd("fill",this.layers,m,this.zoom,n);this.patternFeatures.push(S)}else this.addFeature(m,y,v,a,{},n.subdivisionGranularity);n.featureIndex.insert(t[v].feature,y,v,P,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}addFeatures(t,n,a){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,n,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,_y),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.indexBuffer2=t.createIndexBuffer(this.indexArray2)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.indexBuffer2.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.segments2.destroy())}addFeature(t,n,a,l,d,p){for(const m of Es(n,500)){const y=lf(m,l,p.fill.getGranularityForZoomLevel(l.z)),v=this.layoutVertexArray;cf((P,S)=>{v.emplaceBack(P,S)},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,l)}}let uf,hf;Ve("FillBucket",_d,{omit:["layers","patternFeatures"]});var Ey={get paint(){return hf=hf||new $i({"fill-antialias":new Xe(D.paint_fill["fill-antialias"]),"fill-opacity":new tt(D.paint_fill["fill-opacity"]),"fill-color":new tt(D.paint_fill["fill-color"]),"fill-outline-color":new tt(D.paint_fill["fill-outline-color"]),"fill-translate":new Xe(D.paint_fill["fill-translate"]),"fill-translate-anchor":new Xe(D.paint_fill["fill-translate-anchor"]),"fill-pattern":new jo(D.paint_fill["fill-pattern"])})},get layout(){return uf=uf||new $i({"fill-sort-key":new tt(D.layout_fill["fill-sort-key"])})}};class zy extends Fi{constructor(t){super(t,Ey)}recalculate(t,n){super.recalculate(t,n);const a=this.paint._values["fill-outline-color"];a.value.kind==="constant"&&a.value.value===void 0&&(this.paint._values["fill-outline-color"]=this.paint._values["fill-color"])}createBucket(t){return new _d(t)}queryRadius(){return nh(this.paint.get("fill-translate"))}queryIntersectsFeature({queryGeometry:t,geometry:n,transform:a,pixelsToTileUnits:l}){return Gp(ah(t,this.paint.get("fill-translate"),this.paint.get("fill-translate-anchor"),-a.bearingInRadians,l),n)}isTileClipped(){return!0}}const ky=Qt([{name:"a_pos",components:2,type:"Int16"},{name:"a_normal_ed",components:4,type:"Int16"}],4),Ay=Qt([{name:"a_centroid",components:2,type:"Int16"}],4),{members:Ry}=ky;var yd,df,xd,pf,vd,ff,mf,ch={};function gf(){if(df)return yd;df=1;var r=Ue();function t(l,d,p,m,y){this.properties={},this.extent=p,this.type=0,this._pbf=l,this._geometry=-1,this._keys=m,this._values=y,l.readFields(n,this,d)}function n(l,d,p){l==1?d.id=p.readVarint():l==2?function(m,y){for(var v=m.readVarint()+m.pos;m.pos<v;){var P=y._keys[m.readVarint()],S=y._values[m.readVarint()];y.properties[P]=S}}(p,d):l==3?d.type=p.readVarint():l==4&&(d._geometry=p.pos)}function a(l){for(var d,p,m=0,y=0,v=l.length,P=v-1;y<v;P=y++)m+=((p=l[P]).x-(d=l[y]).x)*(d.y+p.y);return m}return yd=t,t.types=["Unknown","Point","LineString","Polygon"],t.prototype.loadGeometry=function(){var l=this._pbf;l.pos=this._geometry;for(var d,p=l.readVarint()+l.pos,m=1,y=0,v=0,P=0,S=[];l.pos<p;){if(y<=0){var k=l.readVarint();m=7&k,y=k>>3}if(y--,m===1||m===2)v+=l.readSVarint(),P+=l.readSVarint(),m===1&&(d&&S.push(d),d=[]),d.push(new r(v,P));else{if(m!==7)throw new Error("unknown command "+m);d&&d.push(d[0].clone())}}return d&&S.push(d),S},t.prototype.bbox=function(){var l=this._pbf;l.pos=this._geometry;for(var d=l.readVarint()+l.pos,p=1,m=0,y=0,v=0,P=1/0,S=-1/0,k=1/0,R=-1/0;l.pos<d;){if(m<=0){var L=l.readVarint();p=7&L,m=L>>3}if(m--,p===1||p===2)(y+=l.readSVarint())<P&&(P=y),y>S&&(S=y),(v+=l.readSVarint())<k&&(k=v),v>R&&(R=v);else if(p!==7)throw new Error("unknown command "+p)}return[P,k,S,R]},t.prototype.toGeoJSON=function(l,d,p){var m,y,v=this.extent*Math.pow(2,p),P=this.extent*l,S=this.extent*d,k=this.loadGeometry(),R=t.types[this.type];function L(H){for(var re=0;re<H.length;re++){var X=H[re];H[re]=[360*(X.x+P)/v-180,360/Math.PI*Math.atan(Math.exp((180-360*(X.y+S)/v)*Math.PI/180))-90]}}switch(this.type){case 1:var O=[];for(m=0;m<k.length;m++)O[m]=k[m][0];L(k=O);break;case 2:for(m=0;m<k.length;m++)L(k[m]);break;case 3:for(k=function(H){var re=H.length;if(re<=1)return[H];for(var X,A,U=[],J=0;J<re;J++){var fe=a(H[J]);fe!==0&&(A===void 0&&(A=fe<0),A===fe<0?(X&&U.push(X),X=[H[J]]):X.push(H[J]))}return X&&U.push(X),U}(k),m=0;m<k.length;m++)for(y=0;y<k[m].length;y++)L(k[m][y])}k.length===1?k=k[0]:R="Multi"+R;var $={type:"Feature",geometry:{type:R,coordinates:k},properties:this.properties};return"id"in this&&($.id=this.id),$},yd}function _f(){if(pf)return xd;pf=1;var r=gf();function t(a,l){this.version=1,this.name=null,this.extent=4096,this.length=0,this._pbf=a,this._keys=[],this._values=[],this._features=[],a.readFields(n,this,l),this.length=this._features.length}function n(a,l,d){a===15?l.version=d.readVarint():a===1?l.name=d.readString():a===5?l.extent=d.readVarint():a===2?l._features.push(d.pos):a===3?l._keys.push(d.readString()):a===4&&l._values.push(function(p){for(var m=null,y=p.readVarint()+p.pos;p.pos<y;){var v=p.readVarint()>>3;m=v===1?p.readString():v===2?p.readFloat():v===3?p.readDouble():v===4?p.readVarint64():v===5?p.readVarint():v===6?p.readSVarint():v===7?p.readBoolean():null}return m}(d))}return xd=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 l=this._pbf.readVarint()+this._pbf.pos;return new r(this._pbf,l,this.extent,this._keys,this._values)},xd}function yf(){return mf||(mf=1,ch.VectorTile=function(){if(ff)return vd;ff=1;var r=_f();function t(n,a,l){if(n===3){var d=new r(l,l.readVarint()+l.pos);d.length&&(a[d.name]=d)}}return vd=function(n,a){this.layers=n.readFields(t,{},a)},vd}(),ch.VectorTileFeature=gf(),ch.VectorTileLayer=_f()),ch}var Pc=Te(yf());const Dy=Pc.VectorTileFeature.types,bd=Math.pow(2,13);function Sc(r,t,n,a,l,d,p,m){r.emplaceBack(t,n,2*Math.floor(a*bd)+p,l*bd*2,d*bd*2,Math.round(m))}class wd{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.layoutVertexArray=new se,this.centroidVertexArray=new Q,this.indexArray=new Me,this.programConfigurations=new ha(t.layers,t.zoom),this.segments=new ut,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.features=[],this.hasPattern=pd("fill-extrusion",this.layers,n);for(const{feature:l,id:d,index:p,sourceLayerIndex:m}of t){const y=this.layers[0]._featureFilter.needGeometry,v=zn(l,y);if(!this.layers[0]._featureFilter.filter(new Ft(this.zoom),v,a))continue;const P={id:d,sourceLayerIndex:m,index:p,geometry:y?v.geometry:En(l),properties:l.properties,type:l.type,patterns:{}};this.hasPattern?this.features.push(fd("fill-extrusion",this.layers,P,this.zoom,n)):this.addFeature(P,P.geometry,p,a,{},n.subdivisionGranularity),n.featureIndex.insert(l,P.geometry,p,m,this.index,!0)}}addFeatures(t,n,a){for(const l of this.features){const{geometry:d}=l;this.addFeature(l,d,l.index,n,a,t.subdivisionGranularity)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}isEmpty(){return this.layoutVertexArray.length===0&&this.centroidVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ry),this.centroidVertexBuffer=t.createVertexBuffer(this.centroidVertexArray,Ay.members,!0),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy(),this.centroidVertexBuffer.destroy())}addFeature(t,n,a,l,d,p){for(const m of Es(n,500)){const y={x:0,y:0,sampleCount:0},v=this.layoutVertexArray.length;this.processPolygon(y,l,t,m,p);const P=this.layoutVertexArray.length-v,S=Math.floor(y.x/y.sampleCount),k=Math.floor(y.y/y.sampleCount);for(let R=0;R<P;R++)this.centroidVertexArray.emplaceBack(S,k)}this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,l)}processPolygon(t,n,a,l,d){if(l.length<1||xf(l[0]))return;for(const S of l)S.length!==0&&Ly(t,S);const p={segment:this.segments.prepareSegment(4,this.layoutVertexArray,this.indexArray)},m=d.fill.getGranularityForZoomLevel(n.z),y=Dy[a.type]==="Polygon";for(const S of l){if(S.length===0||xf(S))continue;const k=Ws(S,m,y);this._generateSideFaces(k,p)}if(!y)return;const v=lf(l,n,m,!1),P=this.layoutVertexArray;cf((S,k)=>{Sc(P,S,k,0,0,1,1,0)},this.segments,this.layoutVertexArray,this.indexArray,v.verticesFlattened,v.indicesTriangles)}_generateSideFaces(t,n){let a=0;for(let l=1;l<t.length;l++){const d=t[l],p=t[l-1];if(Fy(d,p))continue;n.segment.vertexLength+4>ut.MAX_VERTEX_ARRAY_LENGTH&&(n.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),Sc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,0,a),Sc(this.layoutVertexArray,d.x,d.y,m.x,m.y,0,1,a),a+=y,Sc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,0,a),Sc(this.layoutVertexArray,p.x,p.y,m.x,m.y,0,1,a);const v=n.segment.vertexLength;this.indexArray.emplaceBack(v,v+2,v+1),this.indexArray.emplaceBack(v+1,v+2,v+3),n.segment.vertexLength+=4,n.segment.primitiveLength+=2}}}function Ly(r,t){for(let n=0;n<t.length;n++){const a=t[n];n===t.length-1&&t[0].x===a.x&&t[0].y===a.y||(r.x+=a.x,r.y+=a.y,r.sampleCount++)}}function Fy(r,t){return r.x===t.x&&(r.x<0||r.x>St)||r.y===t.y&&(r.y<0||r.y>St)}function xf(r){return r.every(t=>t.x<0)||r.every(t=>t.x>St)||r.every(t=>t.y<0)||r.every(t=>t.y>St)}let vf;Ve("FillExtrusionBucket",wd,{omit:["layers","features"]});var By={get paint(){return vf=vf||new $i({"fill-extrusion-opacity":new Xe(D["paint_fill-extrusion"]["fill-extrusion-opacity"]),"fill-extrusion-color":new tt(D["paint_fill-extrusion"]["fill-extrusion-color"]),"fill-extrusion-translate":new Xe(D["paint_fill-extrusion"]["fill-extrusion-translate"]),"fill-extrusion-translate-anchor":new Xe(D["paint_fill-extrusion"]["fill-extrusion-translate-anchor"]),"fill-extrusion-pattern":new jo(D["paint_fill-extrusion"]["fill-extrusion-pattern"]),"fill-extrusion-height":new tt(D["paint_fill-extrusion"]["fill-extrusion-height"]),"fill-extrusion-base":new tt(D["paint_fill-extrusion"]["fill-extrusion-base"]),"fill-extrusion-vertical-gradient":new Xe(D["paint_fill-extrusion"]["fill-extrusion-vertical-gradient"])})}};class Oy extends Fi{constructor(t){super(t,By)}createBucket(t){return new wd(t)}queryRadius(){return nh(this.paint.get("fill-extrusion-translate"))}is3D(){return!0}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:l,transform:d,pixelsToTileUnits:p,pixelPosMatrix:m}){const y=ah(t,this.paint.get("fill-extrusion-translate"),this.paint.get("fill-extrusion-translate-anchor"),-d.bearingInRadians,p),v=this.paint.get("fill-extrusion-height").evaluate(n,a),P=this.paint.get("fill-extrusion-base").evaluate(n,a),S=function(R,L,O){const $=[];for(const H of R){const re=[H.x,H.y,0,1];Ur(re,re,L),$.push(new Ze(re[0]/re[3],re[1]/re[3]))}return $}(y,m),k=function(R,L,O,$){const H=[],re=[],X=$[8]*L,A=$[9]*L,U=$[10]*L,J=$[11]*L,fe=$[8]*O,Ce=$[9]*O,me=$[10]*O,xe=$[11]*O;for(const Re of R){const Ee=[],De=[];for(const Pe of Re){const $e=Pe.x,Qe=Pe.y,Ye=$[0]*$e+$[4]*Qe+$[12],He=$[1]*$e+$[5]*Qe+$[13],ft=$[2]*$e+$[6]*Qe+$[14],Ht=$[3]*$e+$[7]*Qe+$[15],di=ft+U,Ai=Ht+J,Tr=Ye+fe,er=He+Ce,Ti=ft+me,Ut=Ht+xe,mi=new Ze((Ye+X)/Ai,(He+A)/Ai);mi.z=di/Ai,Ee.push(mi);const Pi=new Ze(Tr/Ut,er/Ut);Pi.z=Ti/Ut,De.push(Pi)}H.push(Ee),re.push(De)}return[H,re]}(l,P,v,m);return function(R,L,O){let $=1/0;Gp(O,L)&&($=bf(O,L[0]));for(let H=0;H<L.length;H++){const re=L[H],X=R[H];for(let A=0;A<re.length-1;A++){const U=re[A],J=[U,re[A+1],X[A+1],X[A],U];$o(O,J)&&($=Math.min($,bf(O,J)))}}return $!==1/0&&$}(k[0],k[1],S)}}function Mc(r,t){return r.x*t.x+r.y*t.y}function bf(r,t){if(r.length===1){let n=0;const a=t[n++];let l;for(;!l||a.equals(l);)if(l=t[n++],!l)return 1/0;for(;n<t.length;n++){const d=t[n],p=r[0],m=l.sub(a),y=d.sub(a),v=p.sub(a),P=Mc(m,m),S=Mc(m,y),k=Mc(y,y),R=Mc(v,m),L=Mc(v,y),O=P*k-S*S,$=(k*R-S*L)/O,H=(P*L-S*R)/O,re=a.z*(1-$-H)+l.z*$+d.z*H;if(isFinite(re))return re}return 1/0}{let n=1/0;for(const a of t)n=Math.min(n,a.z);return n}}const jy=Qt([{name:"a_pos_normal",components:2,type:"Int16"},{name:"a_data",components:4,type:"Uint8"}],4),{members:Ny}=jy,Zy=Qt([{name:"a_uv_x",components:1,type:"Float32"},{name:"a_split_index",components:1,type:"Float32"}]),{members:Vy}=Zy,Uy=Pc.VectorTileFeature.types,$y=Math.cos(Math.PI/180*37.5),wf=Math.pow(2,14)/.5;class Td{constructor(t){this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(n=>n.id),this.index=t.index,this.hasPattern=!1,this.patternFeatures=[],this.lineClipsArray=[],this.gradients={},this.layers.forEach(n=>{this.gradients[n.id]={}}),this.layoutVertexArray=new ie,this.layoutVertexArray2=new pe,this.indexArray=new Me,this.programConfigurations=new ha(t.layers,t.zoom),this.segments=new ut,this.maxLineLength=0,this.stateDependentLayerIds=this.layers.filter(n=>n.isStateDependent()).map(n=>n.id)}populate(t,n,a){this.hasPattern=pd("line",this.layers,n);const l=this.layers[0].layout.get("line-sort-key"),d=!l.isConstant(),p=[];for(const{feature:m,id:y,index:v,sourceLayerIndex:P}of t){const S=this.layers[0]._featureFilter.needGeometry,k=zn(m,S);if(!this.layers[0]._featureFilter.filter(new Ft(this.zoom),k,a))continue;const R=d?l.evaluate(k,{},a):void 0,L={id:y,properties:m.properties,type:m.type,sourceLayerIndex:P,index:v,geometry:S?k.geometry:En(m),patterns:{},sortKey:R};p.push(L)}d&&p.sort((m,y)=>m.sortKey-y.sortKey);for(const m of p){const{geometry:y,index:v,sourceLayerIndex:P}=m;if(this.hasPattern){const S=fd("line",this.layers,m,this.zoom,n);this.patternFeatures.push(S)}else this.addFeature(m,y,v,a,{},n.subdivisionGranularity);n.featureIndex.insert(t[v].feature,y,v,P,this.index)}}update(t,n,a){this.stateDependentLayers.length&&this.programConfigurations.updatePaintArrays(t,n,this.stateDependentLayers,a)}addFeatures(t,n,a){for(const l of this.patternFeatures)this.addFeature(l,l.geometry,l.index,n,a,t.subdivisionGranularity)}isEmpty(){return this.layoutVertexArray.length===0}uploadPending(){return!this.uploaded||this.programConfigurations.needsUpload}upload(t){this.uploaded||(this.layoutVertexArray2.length!==0&&(this.layoutVertexBuffer2=t.createVertexBuffer(this.layoutVertexArray2,Vy)),this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Ny),this.indexBuffer=t.createIndexBuffer(this.indexArray)),this.programConfigurations.upload(t),this.uploaded=!0}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.programConfigurations.destroy(),this.segments.destroy())}lineFeatureClips(t){if(t.properties&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_start")&&Object.prototype.hasOwnProperty.call(t.properties,"mapbox_clip_end"))return{start:+t.properties.mapbox_clip_start,end:+t.properties.mapbox_clip_end}}addFeature(t,n,a,l,d,p){const m=this.layers[0].layout,y=m.get("line-join").evaluate(t,{}),v=m.get("line-cap"),P=m.get("line-miter-limit"),S=m.get("line-round-limit");this.lineClips=this.lineFeatureClips(t);for(const k of n)this.addLine(k,t,y,v,P,S,l,p);this.programConfigurations.populatePaintArrays(this.layoutVertexArray.length,t,a,d,l)}addLine(t,n,a,l,d,p,m,y){if(this.distance=0,this.scaledDistance=0,this.totalDistance=0,t=Ws(t,m?y.line.getGranularityForZoomLevel(m.z):1),this.lineClips){this.lineClipsArray.push(this.lineClips);for(let X=0;X<t.length-1;X++)this.totalDistance+=t[X].dist(t[X+1]);this.updateScaledDistance(),this.maxLineLength=Math.max(this.maxLineLength,this.totalDistance)}const v=Uy[n.type]==="Polygon";let P=t.length;for(;P>=2&&t[P-1].equals(t[P-2]);)P--;let S=0;for(;S<P-1&&t[S].equals(t[S+1]);)S++;if(P<(v?3:2))return;a==="bevel"&&(d=1.05);const k=this.overscaling<=16?15*St/(512*this.overscaling):0,R=this.segments.prepareSegment(10*P,this.layoutVertexArray,this.indexArray);let L,O,$,H,re;this.e1=this.e2=-1,v&&(L=t[P-2],re=t[S].sub(L)._unit()._perp());for(let X=S;X<P;X++){if($=X===P-1?v?t[S+1]:void 0:t[X+1],$&&t[X].equals($))continue;re&&(H=re),L&&(O=L),L=t[X],re=$?$.sub(L)._unit()._perp():H,H=H||re;let A=H.add(re);A.x===0&&A.y===0||A._unit();const U=H.x*re.x+H.y*re.y,J=A.x*re.x+A.y*re.y,fe=J!==0?1/J:1/0,Ce=2*Math.sqrt(2-2*J),me=J<$y&&O&&$,xe=H.x*re.y-H.y*re.x>0;if(me&&X>S){const De=L.dist(O);if(De>2*k){const Pe=L.sub(L.sub(O)._mult(k/De)._round());this.updateDistance(O,Pe),this.addCurrentVertex(Pe,H,0,0,R),O=Pe}}const Re=O&&$;let Ee=Re?a:v?"butt":l;if(Re&&Ee==="round"&&(fe<p?Ee="miter":fe<=2&&(Ee="fakeround")),Ee==="miter"&&fe>d&&(Ee="bevel"),Ee==="bevel"&&(fe>2&&(Ee="flipbevel"),fe<d&&(Ee="miter")),O&&this.updateDistance(O,L),Ee==="miter")A._mult(fe),this.addCurrentVertex(L,A,0,0,R);else if(Ee==="flipbevel"){if(fe>100)A=re.mult(-1);else{const De=fe*H.add(re).mag()/H.sub(re).mag();A._perp()._mult(De*(xe?-1:1))}this.addCurrentVertex(L,A,0,0,R),this.addCurrentVertex(L,A.mult(-1),0,0,R)}else if(Ee==="bevel"||Ee==="fakeround"){const De=-Math.sqrt(fe*fe-1),Pe=xe?De:0,$e=xe?0:De;if(O&&this.addCurrentVertex(L,H,Pe,$e,R),Ee==="fakeround"){const Qe=Math.round(180*Ce/Math.PI/20);for(let Ye=1;Ye<Qe;Ye++){let He=Ye/Qe;if(He!==.5){const Ht=He-.5;He+=He*Ht*(He-1)*((1.0904+U*(U*(3.55645-1.43519*U)-3.2452))*Ht*Ht+(.848013+U*(.215638*U-1.06021)))}const ft=re.sub(H)._mult(He)._add(H)._unit()._mult(xe?-1:1);this.addHalfVertex(L,ft.x,ft.y,!1,xe,0,R)}}$&&this.addCurrentVertex(L,re,-Pe,-$e,R)}else if(Ee==="butt")this.addCurrentVertex(L,A,0,0,R);else if(Ee==="square"){const De=O?1:-1;this.addCurrentVertex(L,A,De,De,R)}else Ee==="round"&&(O&&(this.addCurrentVertex(L,H,0,0,R),this.addCurrentVertex(L,H,1,1,R,!0)),$&&(this.addCurrentVertex(L,re,-1,-1,R,!0),this.addCurrentVertex(L,re,0,0,R)));if(me&&X<P-1){const De=L.dist($);if(De>2*k){const Pe=L.add($.sub(L)._mult(k/De)._round());this.updateDistance(L,Pe),this.addCurrentVertex(Pe,re,0,0,R),L=Pe}}}}addCurrentVertex(t,n,a,l,d,p=!1){const m=n.y*l-n.x,y=-n.y-n.x*l;this.addHalfVertex(t,n.x+n.y*a,n.y-n.x*a,p,!1,a,d),this.addHalfVertex(t,m,y,p,!0,-l,d),this.distance>wf/2&&this.totalDistance===0&&(this.distance=0,this.updateScaledDistance(),this.addCurrentVertex(t,n,a,l,d,p))}addHalfVertex({x:t,y:n},a,l,d,p,m,y){const v=.5*(this.lineClips?this.scaledDistance*(wf-1):this.scaledDistance);this.layoutVertexArray.emplaceBack((t<<1)+(d?1:0),(n<<1)+(p?1:0),Math.round(63*a)+128,Math.round(63*l)+128,1+(m===0?0:m<0?-1:1)|(63&v)<<2,v>>6),this.lineClips&&this.layoutVertexArray2.emplaceBack((this.scaledDistance-this.lineClips.start)/(this.lineClips.end-this.lineClips.start),this.lineClipsArray.length);const P=y.vertexLength++;this.e1>=0&&this.e2>=0&&(this.indexArray.emplaceBack(this.e1,P,this.e2),y.primitiveLength++),p?this.e2=P:this.e1=P}updateScaledDistance(){this.scaledDistance=this.lineClips?this.lineClips.start+(this.lineClips.end-this.lineClips.start)*this.distance/this.totalDistance:this.distance}updateDistance(t,n){this.distance+=t.dist(n),this.updateScaledDistance()}}let Tf,Pf;Ve("LineBucket",Td,{omit:["layers","patternFeatures"]});var Sf={get paint(){return Pf=Pf||new $i({"line-opacity":new tt(D.paint_line["line-opacity"]),"line-color":new tt(D.paint_line["line-color"]),"line-translate":new Xe(D.paint_line["line-translate"]),"line-translate-anchor":new Xe(D.paint_line["line-translate-anchor"]),"line-width":new tt(D.paint_line["line-width"]),"line-gap-width":new tt(D.paint_line["line-gap-width"]),"line-offset":new tt(D.paint_line["line-offset"]),"line-blur":new tt(D.paint_line["line-blur"]),"line-dasharray":new sc(D.paint_line["line-dasharray"]),"line-pattern":new jo(D.paint_line["line-pattern"]),"line-gradient":new oc(D.paint_line["line-gradient"])})},get layout(){return Tf=Tf||new $i({"line-cap":new Xe(D.layout_line["line-cap"]),"line-join":new tt(D.layout_line["line-join"]),"line-miter-limit":new Xe(D.layout_line["line-miter-limit"]),"line-round-limit":new Xe(D.layout_line["line-round-limit"]),"line-sort-key":new tt(D.layout_line["line-sort-key"])})}};class Gy extends tt{possiblyEvaluate(t,n){return n=new Ft(Math.floor(n.zoom),{now:n.now,fadeDuration:n.fadeDuration,zoomHistory:n.zoomHistory,transition:n.transition}),super.possiblyEvaluate(t,n)}evaluate(t,n,a,l){return n=vi({},n,{zoom:Math.floor(n.zoom)}),super.evaluate(t,n,a,l)}}let uh;class qy extends Fi{constructor(t){super(t,Sf),this.gradientVersion=0,uh||(uh=new Gy(Sf.paint.properties["line-width"].specification),uh.useIntegerZoom=!0)}_handleSpecialPaintPropertyUpdate(t){if(t==="line-gradient"){const n=this.gradientExpression();this.stepInterpolant=!!function(a){return a._styleExpression!==void 0}(n)&&n._styleExpression.expression instanceof Ba,this.gradientVersion=(this.gradientVersion+1)%Number.MAX_SAFE_INTEGER}}gradientExpression(){return this._transitionablePaint._values["line-gradient"].value.expression}recalculate(t,n){super.recalculate(t,n),this.paint._values["line-floorwidth"]=uh.possiblyEvaluate(this._transitioningPaint._values["line-width"].value,t)}createBucket(t){return new Td(t)}queryRadius(t){const n=t,a=Mf(gc("line-width",this,n),gc("line-gap-width",this,n)),l=gc("line-offset",this,n);return a/2+Math.abs(l)+nh(this.paint.get("line-translate"))}queryIntersectsFeature({queryGeometry:t,feature:n,featureState:a,geometry:l,transform:d,pixelsToTileUnits:p}){const m=ah(t,this.paint.get("line-translate"),this.paint.get("line-translate-anchor"),-d.bearingInRadians,p),y=p/2*Mf(this.paint.get("line-width").evaluate(n,a),this.paint.get("line-gap-width").evaluate(n,a)),v=this.paint.get("line-offset").evaluate(n,a);return v&&(l=function(P,S){const k=[];for(let R=0;R<P.length;R++){const L=P[R],O=[];for(let $=0;$<L.length;$++){const H=L[$-1],re=L[$],X=L[$+1],A=$===0?new Ze(0,0):re.sub(H)._unit()._perp(),U=$===L.length-1?new Ze(0,0):X.sub(re)._unit()._perp(),J=A._add(U)._unit(),fe=J.x*U.x+J.y*U.y;fe!==0&&J._mult(1/fe),O.push(J._mult(S)._add(re))}k.push(O)}return k}(l,v*p)),function(P,S,k){for(let R=0;R<S.length;R++){const L=S[R];if(P.length>=3){for(let O=0;O<L.length;O++)if(Gs(P,L[O]))return!0}if(oy(P,L,k))return!0}return!1}(m,l,y)}isTileClipped(){return!0}}function Mf(r,t){return t>0?t+2*r:r}const Wy=Qt([{name:"a_pos_offset",components:4,type:"Int16"},{name:"a_data",components:4,type:"Uint16"},{name:"a_pixeloffset",components:4,type:"Int16"}],4),Hy=Qt([{name:"a_projected_pos",components:3,type:"Float32"}],4);Qt([{name:"a_fade_opacity",components:1,type:"Uint32"}],4);const Ky=Qt([{name:"a_placed",components:2,type:"Uint8"},{name:"a_shift",components:2,type:"Float32"},{name:"a_box_real",components:2,type:"Int16"}]);Qt([{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 If=Qt([{name:"a_pos",components:2,type:"Int16"},{name:"a_anchor_pos",components:2,type:"Int16"},{name:"a_extrude",components:2,type:"Int16"}],4),Xy=Qt([{name:"a_pos",components:2,type:"Float32"},{name:"a_radius",components:1,type:"Float32"},{name:"a_flags",components:2,type:"Int16"}],4);function Yy(r,t,n){return r.sections.forEach(a=>{a.text=function(l,d,p){const m=d.layout.get("text-transform").evaluate(p,{});return m==="uppercase"?l=l.toLocaleUpperCase():m==="lowercase"&&(l=l.toLocaleLowerCase()),Jr.applyArabicShaping&&(l=Jr.applyArabicShaping(l)),l}(a.text,t,n)}),r}Qt([{name:"triangle",components:3,type:"Uint16"}]),Qt([{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"}]),Qt([{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"}]),Qt([{type:"Float32",name:"offsetX"}]),Qt([{type:"Int16",name:"x"},{type:"Int16",name:"y"},{type:"Int16",name:"tileUnitDistanceFromAnchor"}]),Qt([{type:"Uint16",name:"textAnchor"},{type:"Float32",components:2,name:"textOffset"}]);const Ic={"!":"︕","#":"#",$:"$","%":"%","&":"&","(":"︵",")":"︶","*":"*","+":"+",",":"︐","-":"︲",".":"・","/":"/",":":"︓",";":"︔","<":"︿","=":"=",">":"﹀","?":"︖","@":"@","[":"﹇","\\":"\","]":"﹈","^":"^",_:"︳","`":"`","{":"︷","|":"―","}":"︸","~":"~","¢":"¢","£":"£","¥":"¥","¦":"¦","¬":"¬","¯":" ̄","–":"︲","—":"︱","‘":"﹃","’":"﹄","“":"﹁","”":"﹂","…":"︙","‧":"・","₩":"₩","、":"︑","。":"︒","〈":"︿","〉":"﹀","《":"︽","》":"︾","「":"﹁","」":"﹂","『":"﹃","』":"﹄","【":"︻","】":"︼","〔":"︹","〕":"︺","〖":"︗","〗":"︘","!":"︕","(":"︵",")":"︶",",":"︐","-":"︲",".":"・",":":"︓",";":"︔","<":"︿",">":"﹀","?":"︖","[":"﹇","]":"﹈","_":"︳","{":"︷","|":"―","}":"︸","⦅":"︵","⦆":"︶","。":"︒","「":"﹁","」":"﹂"};var Cf,Pd,Ef,hi=24,Sd={};function Jy(){return Cf||(Cf=1,Sd.read=function(r,t,n,a,l){var d,p,m=8*l-a-1,y=(1<<m)-1,v=y>>1,P=-7,S=n?l-1:0,k=n?-1:1,R=r[t+S];for(S+=k,d=R&(1<<-P)-1,R>>=-P,P+=m;P>0;d=256*d+r[t+S],S+=k,P-=8);for(p=d&(1<<-P)-1,d>>=-P,P+=a;P>0;p=256*p+r[t+S],S+=k,P-=8);if(d===0)d=1-v;else{if(d===y)return p?NaN:1/0*(R?-1:1);p+=Math.pow(2,a),d-=v}return(R?-1:1)*p*Math.pow(2,d-a)},Sd.write=function(r,t,n,a,l,d){var p,m,y,v=8*d-l-1,P=(1<<v)-1,S=P>>1,k=l===23?Math.pow(2,-24)-Math.pow(2,-77):0,R=a?0:d-1,L=a?1:-1,O=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=P):(p=Math.floor(Math.log(t)/Math.LN2),t*(y=Math.pow(2,-p))<1&&(p--,y*=2),(t+=p+S>=1?k/y:k*Math.pow(2,1-S))*y>=2&&(p++,y/=2),p+S>=P?(m=0,p=P):p+S>=1?(m=(t*y-1)*Math.pow(2,l),p+=S):(m=t*Math.pow(2,S-1)*Math.pow(2,l),p=0));l>=8;r[n+R]=255&m,R+=L,m/=256,l-=8);for(p=p<<l|m,v+=l;v>0;r[n+R]=255&p,R+=L,p/=256,v-=8);r[n+R-L]|=128*O}),Sd}function zf(){if(Ef)return Pd;Ef=1,Pd=t;var r=Jy();function t(A){this.buf=ArrayBuffer.isView&&ArrayBuffer.isView(A)?A:new Uint8Array(A||0),this.pos=0,this.type=0,this.length=this.buf.length}t.Varint=0,t.Fixed64=1,t.Bytes=2,t.Fixed32=5;var n=4294967296,a=1/n,l=typeof TextDecoder>"u"?null:new TextDecoder("utf-8");function d(A){return A.type===t.Bytes?A.readVarint()+A.pos:A.pos+1}function p(A,U,J){return J?4294967296*U+(A>>>0):4294967296*(U>>>0)+(A>>>0)}function m(A,U,J){var fe=U<=16383?1:U<=2097151?2:U<=268435455?3:Math.floor(Math.log(U)/(7*Math.LN2));J.realloc(fe);for(var Ce=J.pos-1;Ce>=A;Ce--)J.buf[Ce+fe]=J.buf[Ce]}function y(A,U){for(var J=0;J<A.length;J++)U.writeVarint(A[J])}function v(A,U){for(var J=0;J<A.length;J++)U.writeSVarint(A[J])}function P(A,U){for(var J=0;J<A.length;J++)U.writeFloat(A[J])}function S(A,U){for(var J=0;J<A.length;J++)U.writeDouble(A[J])}function k(A,U){for(var J=0;J<A.length;J++)U.writeBoolean(A[J])}function R(A,U){for(var J=0;J<A.length;J++)U.writeFixed32(A[J])}function L(A,U){for(var J=0;J<A.length;J++)U.writeSFixed32(A[J])}function O(A,U){for(var J=0;J<A.length;J++)U.writeFixed64(A[J])}function $(A,U){for(var J=0;J<A.length;J++)U.writeSFixed64(A[J])}function H(A,U){return(A[U]|A[U+1]<<8|A[U+2]<<16)+16777216*A[U+3]}function re(A,U,J){A[J]=U,A[J+1]=U>>>8,A[J+2]=U>>>16,A[J+3]=U>>>24}function X(A,U){return(A[U]|A[U+1]<<8|A[U+2]<<16)+(A[U+3]<<24)}return t.prototype={destroy:function(){this.buf=null},readFields:function(A,U,J){for(J=J||this.length;this.pos<J;){var fe=this.readVarint(),Ce=fe>>3,me=this.pos;this.type=7&fe,A(Ce,U,this),this.pos===me&&this.skip(fe)}return U},readMessage:function(A,U){return this.readFields(A,U,this.readVarint()+this.pos)},readFixed32:function(){var A=H(this.buf,this.pos);return this.pos+=4,A},readSFixed32:function(){var A=X(this.buf,this.pos);return this.pos+=4,A},readFixed64:function(){var A=H(this.buf,this.pos)+H(this.buf,this.pos+4)*n;return this.pos+=8,A},readSFixed64:function(){var A=H(this.buf,this.pos)+X(this.buf,this.pos+4)*n;return this.pos+=8,A},readFloat:function(){var A=r.read(this.buf,this.pos,!0,23,4);return this.pos+=4,A},readDouble:function(){var A=r.read(this.buf,this.pos,!0,52,8);return this.pos+=8,A},readVarint:function(A){var U,J,fe=this.buf;return U=127&(J=fe[this.pos++]),J<128?U:(U|=(127&(J=fe[this.pos++]))<<7,J<128?U:(U|=(127&(J=fe[this.pos++]))<<14,J<128?U:(U|=(127&(J=fe[this.pos++]))<<21,J<128?U:function(Ce,me,xe){var Re,Ee,De=xe.buf;if(Re=(112&(Ee=De[xe.pos++]))>>4,Ee<128||(Re|=(127&(Ee=De[xe.pos++]))<<3,Ee<128)||(Re|=(127&(Ee=De[xe.pos++]))<<10,Ee<128)||(Re|=(127&(Ee=De[xe.pos++]))<<17,Ee<128)||(Re|=(127&(Ee=De[xe.pos++]))<<24,Ee<128)||(Re|=(1&(Ee=De[xe.pos++]))<<31,Ee<128))return p(Ce,Re,me);throw new Error("Expected varint not more than 10 bytes")}(U|=(15&(J=fe[this.pos]))<<28,A,this))))},readVarint64:function(){return this.readVarint(!0)},readSVarint:function(){var A=this.readVarint();return A%2==1?(A+1)/-2:A/2},readBoolean:function(){return!!this.readVarint()},readString:function(){var A=this.readVarint()+this.pos,U=this.pos;return this.pos=A,A-U>=12&&l?function(J,fe,Ce){return l.decode(J.subarray(fe,Ce))}(this.buf,U,A):function(J,fe,Ce){for(var me="",xe=fe;xe<Ce;){var Re,Ee,De,Pe=J[xe],$e=null,Qe=Pe>239?4:Pe>223?3:Pe>191?2:1;if(xe+Qe>Ce)break;Qe===1?Pe<128&&($e=Pe):Qe===2?(192&(Re=J[xe+1]))==128&&($e=(31&Pe)<<6|63&Re)<=127&&($e=null):Qe===3?(Ee=J[xe+2],(192&(Re=J[xe+1]))==128&&(192&Ee)==128&&(($e=(15&Pe)<<12|(63&Re)<<6|63&Ee)<=2047||$e>=55296&&$e<=57343)&&($e=null)):Qe===4&&(Ee=J[xe+2],De=J[xe+3],(192&(Re=J[xe+1]))==128&&(192&Ee)==128&&(192&De)==128&&(($e=(15&Pe)<<18|(63&Re)<<12|(63&Ee)<<6|63&De)<=65535||$e>=1114112)&&($e=null)),$e===null?($e=65533,Qe=1):$e>65535&&($e-=65536,me+=String.fromCharCode($e>>>10&1023|55296),$e=56320|1023&$e),me+=String.fromCharCode($e),xe+=Qe}return me}(this.buf,U,A)},readBytes:function(){var A=this.readVarint()+this.pos,U=this.buf.subarray(this.pos,A);return this.pos=A,U},readPackedVarint:function(A,U){if(this.type!==t.Bytes)return A.push(this.readVarint(U));var J=d(this);for(A=A||[];this.pos<J;)A.push(this.readVarint(U));return A},readPackedSVarint:function(A){if(this.type!==t.Bytes)return A.push(this.readSVarint());var U=d(this);for(A=A||[];this.pos<U;)A.push(this.readSVarint());return A},readPackedBoolean:function(A){if(this.type!==t.Bytes)return A.push(this.readBoolean());var U=d(this);for(A=A||[];this.pos<U;)A.push(this.readBoolean());return A},readPackedFloat:function(A){if(this.type!==t.Bytes)return A.push(this.readFloat());var U=d(this);for(A=A||[];this.pos<U;)A.push(this.readFloat());return A},readPackedDouble:function(A){if(this.type!==t.Bytes)return A.push(this.readDouble());var U=d(this);for(A=A||[];this.pos<U;)A.push(this.readDouble());return A},readPackedFixed32:function(A){if(this.type!==t.Bytes)return A.push(this.readFixed32());var U=d(this);for(A=A||[];this.pos<U;)A.push(this.readFixed32());return A},readPackedSFixed32:function(A){if(this.type!==t.Bytes)return A.push(this.readSFixed32());var U=d(this);for(A=A||[];this.pos<U;)A.push(this.readSFixed32());return A},readPackedFixed64:function(A){if(this.type!==t.Bytes)return A.push(this.readFixed64());var U=d(this);for(A=A||[];this.pos<U;)A.push(this.readFixed64());return A},readPackedSFixed64:function(A){if(this.type!==t.Bytes)return A.push(this.readSFixed64());var U=d(this);for(A=A||[];this.pos<U;)A.push(this.readSFixed64());return A},skip:function(A){var U=7&A;if(U===t.Varint)for(;this.buf[this.pos++]>127;);else if(U===t.Bytes)this.pos=this.readVarint()+this.pos;else if(U===t.Fixed32)this.pos+=4;else{if(U!==t.Fixed64)throw new Error("Unimplemented type: "+U);this.pos+=8}},writeTag:function(A,U){this.writeVarint(A<<3|U)},realloc:function(A){for(var U=this.length||16;U<this.pos+A;)U*=2;if(U!==this.length){var J=new Uint8Array(U);J.set(this.buf),this.buf=J,this.length=U}},finish:function(){return this.length=this.pos,this.pos=0,this.buf.subarray(0,this.length)},writeFixed32:function(A){this.realloc(4),re(this.buf,A,this.pos),this.pos+=4},writeSFixed32:function(A){this.realloc(4),re(this.buf,A,this.pos),this.pos+=4},writeFixed64:function(A){this.realloc(8),re(this.buf,-1&A,this.pos),re(this.buf,Math.floor(A*a),this.pos+4),this.pos+=8},writeSFixed64:function(A){this.realloc(8),re(this.buf,-1&A,this.pos),re(this.buf,Math.floor(A*a),this.pos+4),this.pos+=8},writeVarint:function(A){(A=+A||0)>268435455||A<0?function(U,J){var fe,Ce;if(U>=0?(fe=U%4294967296|0,Ce=U/4294967296|0):(Ce=~(-U/4294967296),4294967295^(fe=~(-U%4294967296))?fe=fe+1|0:(fe=0,Ce=Ce+1|0)),U>=18446744073709552e3||U<-18446744073709552e3)throw new Error("Given varint doesn't fit into 10 bytes");J.realloc(10),function(me,xe,Re){Re.buf[Re.pos++]=127&me|128,me>>>=7,Re.buf[Re.pos++]=127&me|128,me>>>=7,Re.buf[Re.pos++]=127&me|128,me>>>=7,Re.buf[Re.pos++]=127&me|128,Re.buf[Re.pos]=127&(me>>>=7)}(fe,0,J),function(me,xe){var Re=(7&me)<<4;xe.buf[xe.pos++]|=Re|((me>>>=3)?128:0),me&&(xe.buf[xe.pos++]=127&me|((me>>>=7)?128:0),me&&(xe.buf[xe.pos++]=127&me|((me>>>=7)?128:0),me&&(xe.buf[xe.pos++]=127&me|((me>>>=7)?128:0),me&&(xe.buf[xe.pos++]=127&me|((me>>>=7)?128:0),me&&(xe.buf[xe.pos++]=127&me)))))}(Ce,J)}(A,this):(this.realloc(4),this.buf[this.pos++]=127&A|(A>127?128:0),A<=127||(this.buf[this.pos++]=127&(A>>>=7)|(A>127?128:0),A<=127||(this.buf[this.pos++]=127&(A>>>=7)|(A>127?128:0),A<=127||(this.buf[this.pos++]=A>>>7&127))))},writeSVarint:function(A){this.writeVarint(A<0?2*-A-1:2*A)},writeBoolean:function(A){this.writeVarint(!!A)},writeString:function(A){A=String(A),this.realloc(4*A.length),this.pos++;var U=this.pos;this.pos=function(fe,Ce,me){for(var xe,Re,Ee=0;Ee<Ce.length;Ee++){if((xe=Ce.charCodeAt(Ee))>55295&&xe<57344){if(!Re){xe>56319||Ee+1===Ce.length?(fe[me++]=239,fe[me++]=191,fe[me++]=189):Re=xe;continue}if(xe<56320){fe[me++]=239,fe[me++]=191,fe[me++]=189,Re=xe;continue}xe=Re-55296<<10|xe-56320|65536,Re=null}else Re&&(fe[me++]=239,fe[me++]=191,fe[me++]=189,Re=null);xe<128?fe[me++]=xe:(xe<2048?fe[me++]=xe>>6|192:(xe<65536?fe[me++]=xe>>12|224:(fe[me++]=xe>>18|240,fe[me++]=xe>>12&63|128),fe[me++]=xe>>6&63|128),fe[me++]=63&xe|128)}return me}(this.buf,A,this.pos);var J=this.pos-U;J>=128&&m(U,J,this),this.pos=U-1,this.writeVarint(J),this.pos+=J},writeFloat:function(A){this.realloc(4),r.write(this.buf,A,this.pos,!0,23,4),this.pos+=4},writeDouble:function(A){this.realloc(8),r.write(this.buf,A,this.pos,!0,52,8),this.pos+=8},writeBytes:function(A){var U=A.length;this.writeVarint(U),this.realloc(U);for(var J=0;J<U;J++)this.buf[this.pos++]=A[J]},writeRawMessage:function(A,U){this.pos++;var J=this.pos;A(U,this);var fe=this.pos-J;fe>=128&&m(J,fe,this),this.pos=J-1,this.writeVarint(fe),this.pos+=fe},writeMessage:function(A,U,J){this.writeTag(A,t.Bytes),this.writeRawMessage(U,J)},writePackedVarint:function(A,U){U.length&&this.writeMessage(A,y,U)},writePackedSVarint:function(A,U){U.length&&this.writeMessage(A,v,U)},writePackedBoolean:function(A,U){U.length&&this.writeMessage(A,k,U)},writePackedFloat:function(A,U){U.length&&this.writeMessage(A,P,U)},writePackedDouble:function(A,U){U.length&&this.writeMessage(A,S,U)},writePackedFixed32:function(A,U){U.length&&this.writeMessage(A,R,U)},writePackedSFixed32:function(A,U){U.length&&this.writeMessage(A,L,U)},writePackedFixed64:function(A,U){U.length&&this.writeMessage(A,O,U)},writePackedSFixed64:function(A,U){U.length&&this.writeMessage(A,$,U)},writeBytesField:function(A,U){this.writeTag(A,t.Bytes),this.writeBytes(U)},writeFixed32Field:function(A,U){this.writeTag(A,t.Fixed32),this.writeFixed32(U)},writeSFixed32Field:function(A,U){this.writeTag(A,t.Fixed32),this.writeSFixed32(U)},writeFixed64Field:function(A,U){this.writeTag(A,t.Fixed64),this.writeFixed64(U)},writeSFixed64Field:function(A,U){this.writeTag(A,t.Fixed64),this.writeSFixed64(U)},writeVarintField:function(A,U){this.writeTag(A,t.Varint),this.writeVarint(U)},writeSVarintField:function(A,U){this.writeTag(A,t.Varint),this.writeSVarint(U)},writeStringField:function(A,U){this.writeTag(A,t.Bytes),this.writeString(U)},writeFloatField:function(A,U){this.writeTag(A,t.Fixed32),this.writeFloat(U)},writeDoubleField:function(A,U){this.writeTag(A,t.Fixed64),this.writeDouble(U)},writeBooleanField:function(A,U){this.writeVarintField(A,!!U)}},Pd}var Md=Te(zf());const Id=3;function Qy(r,t,n){r===1&&n.readMessage(ex,t)}function ex(r,t,n){if(r===3){const{id:a,bitmap:l,width:d,height:p,left:m,top:y,advance:v}=n.readMessage(tx,{});t.push({id:a,bitmap:new _c({width:d+2*Id,height:p+2*Id},l),metrics:{width:d,height:p,left:m,top:y,advance:v}})}}function tx(r,t,n){r===1?t.id=n.readVarint():r===2?t.bitmap=n.readBytes():r===3?t.width=n.readVarint():r===4?t.height=n.readVarint():r===5?t.left=n.readSVarint():r===6?t.top=n.readSVarint():r===7&&(t.advance=n.readVarint())}const ix=Id;function kf(r){let t=0,n=0;for(const p of r)t+=p.w*p.h,n=Math.max(n,p.w);r.sort((p,m)=>m.h-p.h);const a=[{x:0,y:0,w:Math.max(Math.ceil(Math.sqrt(t/.95)),n),h:1/0}];let l=0,d=0;for(const p of r)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),l=Math.max(l,p.x+p.w),p.w===y.w&&p.h===y.h){const v=a.pop();m<a.length&&(a[m]=v)}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:l,h:d,fill:t/(l*d)||0}}const Qi=1;class Cd{constructor(t,{pixelRatio:n,version:a,stretchX:l,stretchY:d,content:p,textFitWidth:m,textFitHeight:y}){this.paddedRect=t,this.pixelRatio=n,this.stretchX=l,this.stretchY=d,this.content=p,this.version=a,this.textFitWidth=m,this.textFitHeight=y}get tl(){return[this.paddedRect.x+Qi,this.paddedRect.y+Qi]}get br(){return[this.paddedRect.x+this.paddedRect.w-Qi,this.paddedRect.y+this.paddedRect.h-Qi]}get tlbr(){return this.tl.concat(this.br)}get displaySize(){return[(this.paddedRect.w-2*Qi)/this.pixelRatio,(this.paddedRect.h-2*Qi)/this.pixelRatio]}}class Af{constructor(t,n){const a={},l={};this.haveRenderCallbacks=[];const d=[];this.addImages(t,a,d),this.addImages(n,l,d);const{w:p,h:m}=kf(d),y=new br({width:p||1,height:m||1});for(const v in t){const P=t[v],S=a[v].paddedRect;br.copy(P.data,y,{x:0,y:0},{x:S.x+Qi,y:S.y+Qi},P.data)}for(const v in n){const P=n[v],S=l[v].paddedRect,k=S.x+Qi,R=S.y+Qi,L=P.data.width,O=P.data.height;br.copy(P.data,y,{x:0,y:0},{x:k,y:R},P.data),br.copy(P.data,y,{x:0,y:O-1},{x:k,y:R-1},{width:L,height:1}),br.copy(P.data,y,{x:0,y:0},{x:k,y:R+O},{width:L,height:1}),br.copy(P.data,y,{x:L-1,y:0},{x:k-1,y:R},{width:1,height:O}),br.copy(P.data,y,{x:0,y:0},{x:k+L,y:R},{width:1,height:O})}this.image=y,this.iconPositions=a,this.patternPositions=l}addImages(t,n,a){for(const l in t){const d=t[l],p={x:0,y:0,w:d.data.width+2*Qi,h:d.data.height+2*Qi};a.push(p),n[l]=new Cd(p,d),d.hasRenderCallback&&this.haveRenderCallbacks.push(l)}}patchUpdatedImages(t,n){t.dispatchRenderCallbacks(this.haveRenderCallbacks);for(const a in t.updatedImages)this.patchUpdatedImage(this.iconPositions[a],t.getImage(a),n),this.patchUpdatedImage(this.patternPositions[a],t.getImage(a),n)}patchUpdatedImage(t,n,a){if(!t||!n||t.version===n.version)return;t.version=n.version;const[l,d]=t.tl;a.update(n.data,void 0,{x:l,y:d})}}var is;Ve("ImagePosition",Cd),Ve("ImageAtlas",Af),M.ah=void 0,(is=M.ah||(M.ah={}))[is.none=0]="none",is[is.horizontal=1]="horizontal",is[is.vertical=2]="vertical",is[is.horizontalOnly=3]="horizontalOnly";const hh=-17;class Cc{constructor(){this.scale=1,this.fontStack="",this.imageName=null,this.verticalAlign="bottom"}static forText(t,n,a){const l=new Cc;return l.scale=t||1,l.fontStack=n,l.verticalAlign=a||"bottom",l}static forImage(t,n){const a=new Cc;return a.imageName=t,a.verticalAlign=n||"bottom",a}}class Ho{constructor(){this.text="",this.sectionIndex=[],this.sections=[],this.imageSectionID=null}static fromFeature(t,n){const a=new Ho;for(let l=0;l<t.sections.length;l++){const d=t.sections[l];d.image?a.addImageSection(d):a.addTextSection(d,n)}return a}length(){return this.text.length}getSection(t){return this.sections[this.sectionIndex[t]]}getSectionIndex(t){return this.sectionIndex[t]}getCharCode(t){return this.text.charCodeAt(t)}verticalizePunctuation(){this.text=function(t){let n="";for(let a=0;a<t.length;a++){const l=t.charCodeAt(a+1)||null,d=t.charCodeAt(a-1)||null;n+=l&&nc(l)&&!Ic[t[a+1]]||d&&nc(d)&&!Ic[t[a-1]]||!Ic[t[a]]?t[a]:Ic[t[a]]}return n}(this.text)}trim(){let t=0;for(let a=0;a<this.text.length&&ph[this.text.charCodeAt(a)];a++)t++;let n=this.text.length;for(let a=this.text.length-1;a>=0&&a>=t&&ph[this.text.charCodeAt(a)];a--)n--;this.text=this.text.substring(t,n),this.sectionIndex=this.sectionIndex.slice(t,n)}substring(t,n){const a=new Ho;return a.text=this.text.substring(t,n),a.sectionIndex=this.sectionIndex.slice(t,n),a.sections=this.sections,a}toString(){return this.text}getMaxScale(){return this.sectionIndex.reduce((t,n)=>Math.max(t,this.sections[n].scale),0)}getMaxImageSize(t){let n=0,a=0;for(let l=0;l<this.length();l++){const d=this.getSection(l);if(d.imageName){const p=t[d.imageName];if(!p)continue;const m=p.displaySize;n=Math.max(n,m[0]),a=Math.max(a,m[1])}}return{maxImageWidth:n,maxImageHeight:a}}addTextSection(t,n){this.text+=t.text,this.sections.push(Cc.forText(t.scale,t.fontStack||n,t.verticalAlign));const a=this.sections.length-1;for(let l=0;l<t.text.length;++l)this.sectionIndex.push(a)}addImageSection(t){const n=t.image?t.image.name:"";if(n.length===0)return void Ci("Can't add FormattedSection with an empty image.");const a=this.getNextImageSectionCharCode();a?(this.text+=String.fromCharCode(a),this.sections.push(Cc.forImage(n,t.verticalAlign)),this.sectionIndex.push(this.sections.length-1)):Ci("Reached maximum number of images 6401")}getNextImageSectionCharCode(){return this.imageSectionID?this.imageSectionID>=63743?null:++this.imageSectionID:(this.imageSectionID=57344,this.imageSectionID)}}function dh(r,t,n,a,l,d,p,m,y,v,P,S,k,R,L){const O=Ho.fromFeature(r,l);let $;S===M.ah.vertical&&O.verticalizePunctuation();const{processBidirectionalText:H,processStyledBidirectionalText:re}=Jr;if(H&&O.sections.length===1){$=[];const U=H(O.toString(),Ed(O,v,d,t,a,R));for(const J of U){const fe=new Ho;fe.text=J,fe.sections=O.sections;for(let Ce=0;Ce<J.length;Ce++)fe.sectionIndex.push(0);$.push(fe)}}else if(re){$=[];const U=re(O.text,O.sectionIndex,Ed(O,v,d,t,a,R));for(const J of U){const fe=new Ho;fe.text=J[0],fe.sectionIndex=J[1],fe.sections=O.sections,$.push(fe)}}else $=function(U,J){const fe=[],Ce=U.text;let me=0;for(const xe of J)fe.push(U.substring(me,xe)),me=xe;return me<Ce.length&&fe.push(U.substring(me,Ce.length)),fe}(O,Ed(O,v,d,t,a,R));const X=[],A={positionedLines:X,text:O.toString(),top:P[1],bottom:P[1],left:P[0],right:P[0],writingMode:S,iconsInText:!1,verticalizable:!1};return function(U,J,fe,Ce,me,xe,Re,Ee,De,Pe,$e,Qe){let Ye=0,He=0,ft=0,Ht=0;const di=Ee==="right"?1:Ee==="left"?0:.5,Ai=hi/Qe;let Tr=0;for(const Ut of me){Ut.trim();const mi=Ut.getMaxScale(),Pi={positionedGlyphs:[],lineOffset:0};U.positionedLines[Tr]=Pi;const Si=Pi.positionedGlyphs;let qi=0;if(!Ut.length()){He+=xe,++Tr;continue}const Pr=sx(Ce,Ut,Ai);for(let tr=0;tr<Ut.length();tr++){const pi=Ut.getSection(tr),_i=Ut.getSectionIndex(tr),yi=Ut.getCharCode(tr),si=ox(De,$e,yi);let Ot;if(pi.imageName){if(U.iconsInText=!0,pi.scale=pi.scale*Ai,Ot=cx(pi,si,mi,Pr,Ce),!Ot)continue;qi=Math.max(qi,Ot.imageOffset)}else if(Ot=lx(pi,yi,si,Pr,J,fe),!Ot)continue;const{rect:rn,metrics:Jo,baselineOffset:nn}=Ot;Si.push({glyph:yi,imageName:pi.imageName,x:Ye,y:He+nn+hh,vertical:si,scale:pi.scale,fontStack:pi.fontStack,sectionIndex:_i,metrics:Jo,rect:rn}),si?(U.verticalizable=!0,Ye+=(pi.imageName?Jo.advance:hi)*pi.scale+Pe):Ye+=Jo.advance*pi.scale+Pe}Si.length!==0&&(ft=Math.max(Ye-Pe,ft),ux(Si,0,Si.length-1,di)),Ye=0,Pi.lineOffset=Math.max(qi,(mi-1)*hi);const gi=xe*mi+qi;He+=gi,Ht=Math.max(gi,Ht),++Tr}const{horizontalAlign:er,verticalAlign:Ti}=zd(Re);(function(Ut,mi,Pi,Si,qi,Pr,gi,tr,pi){const _i=(mi-Pi)*qi;let yi=0;yi=Pr!==gi?-tr*Si-hh:-Si*pi*gi+.5*gi;for(const si of Ut)for(const Ot of si.positionedGlyphs)Ot.x+=_i,Ot.y+=yi})(U.positionedLines,di,er,Ti,ft,Ht,xe,He,me.length),U.top+=-Ti*He,U.bottom=U.top+He,U.left+=-er*ft,U.right=U.left+ft}(A,t,n,a,$,p,m,y,S,v,k,L),!function(U){for(const J of U)if(J.positionedGlyphs.length!==0)return!1;return!0}(X)&&A}const ph={9:!0,10:!0,11:!0,12:!0,13:!0,32:!0},rx={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},nx={40:!0};function Rf(r,t,n,a,l,d){if(t.imageName){const p=a[t.imageName];return p?p.displaySize[0]*t.scale*hi/d+l:0}{const p=n[t.fontStack],m=p&&p[r];return m?m.metrics.advance*t.scale+l:0}}function Df(r,t,n,a){const l=Math.pow(r-t,2);return a?r<t?l/2:2*l:l+Math.abs(n)*n}function ax(r,t,n){let a=0;return r===10&&(a-=1e4),n&&(a+=150),r!==40&&r!==65288||(a+=50),t!==41&&t!==65289||(a+=50),a}function Lf(r,t,n,a,l,d){let p=null,m=Df(t,n,l,d);for(const y of a){const v=Df(t-y.x,n,l,d)+y.badness;v<=m&&(p=y,m=v)}return{index:r,x:t,priorBreak:p,badness:m}}function Ff(r){return r?Ff(r.priorBreak).concat(r.index):[]}function Ed(r,t,n,a,l,d){if(!r)return[];const p=[],m=function(S,k,R,L,O,$){let H=0;for(let re=0;re<S.length();re++){const X=S.getSection(re);H+=Rf(S.getCharCode(re),X,L,O,k,$)}return H/Math.max(1,Math.ceil(H/R))}(r,t,n,a,l,d),y=r.text.indexOf("​")>=0;let v=0;for(let S=0;S<r.length();S++){const k=r.getSection(S),R=r.getCharCode(S);if(ph[R]||(v+=Rf(R,k,a,l,t,d)),S<r.length()-1){const L=!((P=R)<11904)&&(!!pt["CJK Compatibility Forms"](P)||!!pt["CJK Compatibility"](P)||!!pt["CJK Strokes"](P)||!!pt["CJK Symbols and Punctuation"](P)||!!pt["Enclosed CJK Letters and Months"](P)||!!pt["Halfwidth and Fullwidth Forms"](P)||!!pt["Ideographic Description Characters"](P)||!!pt["Vertical Forms"](P)||ic.test(String.fromCodePoint(P)));(rx[R]||L||k.imageName||S!==r.length()-2&&nx[r.getCharCode(S+1)])&&p.push(Lf(S+1,v,m,p,ax(R,r.getCharCode(S+1),L&&y),!1))}}var P;return Ff(Lf(r.length(),v,m,p,0,!0))}function zd(r){let t=.5,n=.5;switch(r){case"right":case"top-right":case"bottom-right":t=1;break;case"left":case"top-left":case"bottom-left":t=0}switch(r){case"bottom":case"bottom-right":case"bottom-left":n=1;break;case"top":case"top-right":case"top-left":n=0}return{horizontalAlign:t,verticalAlign:n}}function sx(r,t,n){const a=t.getMaxScale()*hi,{maxImageWidth:l,maxImageHeight:d}=t.getMaxImageSize(r),p=Math.max(a,d*n);return{verticalLineContentWidth:Math.max(a,l*n),horizontalLineContentHeight:p}}function Bf(r){switch(r){case"top":return 0;case"center":return .5;default:return 1}}function ox(r,t,n){return!(r===M.ah.horizontal||!t&&!rc(n)||t&&(ph[n]||(a=n,new RegExp("\\p{sc=Arab}","u").test(String.fromCodePoint(a)))));var a}function lx(r,t,n,a,l,d){const p=d[r.fontStack],m=function(v,P,S,k){if(v&&v.rect)return v;const R=P[S.fontStack],L=R&&R[k];return L?{rect:null,metrics:L.metrics}:null}(p&&p[t],l,r,t);if(m===null)return null;let y;if(n)y=a.verticalLineContentWidth-r.scale*hi;else{const v=Bf(r.verticalAlign);y=(a.horizontalLineContentHeight-r.scale*hi)*v}return{rect:m.rect,metrics:m.metrics,baselineOffset:y}}function cx(r,t,n,a,l){const d=l[r.imageName];if(!d)return null;const p=d.paddedRect,m=d.displaySize,y={width:m[0],height:m[1],left:Qi,top:-3,advance:t?m[1]:m[0]};let v;if(t)v=a.verticalLineContentWidth-m[1]*r.scale;else{const P=Bf(r.verticalAlign);v=(a.horizontalLineContentHeight-m[1]*r.scale)*P}return{rect:p,metrics:y,baselineOffset:v,imageOffset:(t?m[0]:m[1])*r.scale-hi*n}}function ux(r,t,n,a){if(a===0)return;const l=r[n],d=(r[n].x+l.metrics.advance*l.scale)*a;for(let p=t;p<=n;p++)r[p].x-=d}function hx(r,t,n){const{horizontalAlign:a,verticalAlign:l}=zd(n),d=t[0]-r.displaySize[0]*a,p=t[1]-r.displaySize[1]*l;return{image:r,top:p,bottom:p+r.displaySize[1],left:d,right:d+r.displaySize[0]}}function Of(r){var t,n;let a=r.left,l=r.top,d=r.right-a,p=r.bottom-l;const m=(t=r.image.textFitWidth)!==null&&t!==void 0?t:"stretchOrShrink",y=(n=r.image.textFitHeight)!==null&&n!==void 0?n:"stretchOrShrink",v=(r.image.content[2]-r.image.content[0])/(r.image.content[3]-r.image.content[1]);if(y==="proportional"){if(m==="stretchOnly"&&d/p<v||m==="proportional"){const P=Math.ceil(p*v);a*=P/d,d=P}}else if(m==="proportional"&&y==="stretchOnly"&&v!==0&&d/p>v){const P=Math.ceil(d/v);l*=P/p,p=P}return{x1:a,y1:l,x2:a+d,y2:l+p}}function jf(r,t,n,a,l,d){const p=r.image;let m;if(p.content){const $=p.content,H=p.pixelRatio||1;m=[$[0]/H,$[1]/H,p.displaySize[0]-$[2]/H,p.displaySize[1]-$[3]/H]}const y=t.left*d,v=t.right*d;let P,S,k,R;n==="width"||n==="both"?(R=l[0]+y-a[3],S=l[0]+v+a[1]):(R=l[0]+(y+v-p.displaySize[0])/2,S=R+p.displaySize[0]);const L=t.top*d,O=t.bottom*d;return n==="height"||n==="both"?(P=l[1]+L-a[0],k=l[1]+O+a[2]):(P=l[1]+(L+O-p.displaySize[1])/2,k=P+p.displaySize[1]),{image:p,top:P,right:S,bottom:k,left:R,collisionPadding:m}}const Ec=255,kn=128,rs=Ec*kn;function Nf(r,t){const{expression:n}=t;if(n.kind==="constant")return{kind:"constant",layoutSize:n.evaluate(new Ft(r+1))};if(n.kind==="source")return{kind:"source"};{const{zoomStops:a,interpolationType:l}=n;let d=0;for(;d<a.length&&a[d]<=r;)d++;d=Math.max(0,d-1);let p=d;for(;p<a.length&&a[p]<r+1;)p++;p=Math.min(a.length-1,p);const m=a[d],y=a[p];return n.kind==="composite"?{kind:"composite",minZoom:m,maxZoom:y,interpolationType:l}:{kind:"camera",minZoom:m,maxZoom:y,minSize:n.evaluate(new Ft(m)),maxSize:n.evaluate(new Ft(y)),interpolationType:l}}}function kd(r,t,n){let a="never";const l=r.get(t);return l?a=l:r.get(n)&&(a="always"),a}const dx=Pc.VectorTileFeature.types,px=[{name:"a_fade_opacity",components:1,type:"Uint8",offset:0}];function fh(r,t,n,a,l,d,p,m,y,v,P,S,k){const R=m?Math.min(rs,Math.round(m[0])):0,L=m?Math.min(rs,Math.round(m[1])):0;r.emplaceBack(t,n,Math.round(32*a),Math.round(32*l),d,p,(R<<1)+(y?1:0),L,16*v,16*P,256*S,256*k)}function Ad(r,t,n){r.emplaceBack(t.x,t.y,n),r.emplaceBack(t.x,t.y,n),r.emplaceBack(t.x,t.y,n),r.emplaceBack(t.x,t.y,n)}function fx(r){for(const t of r.sections)if(nd(t.text))return!0;return!1}class Rd{constructor(t){this.layoutVertexArray=new we,this.indexArray=new Me,this.programConfigurations=t,this.segments=new ut,this.dynamicLayoutVertexArray=new Se,this.opacityVertexArray=new ve,this.hasVisibleVertices=!1,this.placedSymbolArray=new I}isEmpty(){return this.layoutVertexArray.length===0&&this.indexArray.length===0&&this.dynamicLayoutVertexArray.length===0&&this.opacityVertexArray.length===0}upload(t,n,a,l){this.isEmpty()||(a&&(this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,Wy.members),this.indexBuffer=t.createIndexBuffer(this.indexArray,n),this.dynamicLayoutVertexBuffer=t.createVertexBuffer(this.dynamicLayoutVertexArray,Hy.members,!0),this.opacityVertexBuffer=t.createVertexBuffer(this.opacityVertexArray,px,!0),this.opacityVertexBuffer.itemSize=1),(a||l)&&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())}}Ve("SymbolBuffers",Rd);class Dd{constructor(t,n,a){this.layoutVertexArray=new t,this.layoutAttributes=n,this.indexArray=new a,this.segments=new ut,this.collisionVertexArray=new Le}upload(t){this.layoutVertexBuffer=t.createVertexBuffer(this.layoutVertexArray,this.layoutAttributes),this.indexBuffer=t.createIndexBuffer(this.indexArray),this.collisionVertexBuffer=t.createVertexBuffer(this.collisionVertexArray,Ky.members,!0)}destroy(){this.layoutVertexBuffer&&(this.layoutVertexBuffer.destroy(),this.indexBuffer.destroy(),this.segments.destroy(),this.collisionVertexBuffer.destroy())}}Ve("CollisionBuffers",Dd);class Ko{constructor(t){this.collisionBoxArray=t.collisionBoxArray,this.zoom=t.zoom,this.overscaling=t.overscaling,this.layers=t.layers,this.layerIds=this.layers.map(p=>p.id),this.index=t.index,this.pixelRatio=t.pixelRatio,this.sourceLayerIndex=t.sourceLayerIndex,this.hasPattern=!1,this.hasRTLText=!1,this.sortKeyRanges=[],this.collisionCircleArray=[];const n=this.layers[0]._unevaluatedLayout._values;this.textSizeData=Nf(this.zoom,n["text-size"]),this.iconSizeData=Nf(this.zoom,n["icon-size"]);const a=this.layers[0].layout,l=a.get("symbol-sort-key"),d=a.get("symbol-z-order");this.canOverlap=kd(a,"text-overlap","text-allow-overlap")!=="never"||kd(a,"icon-overlap","icon-allow-overlap")!=="never"||a.get("text-ignore-placement")||a.get("icon-ignore-placement"),this.sortFeaturesByKey=d!=="viewport-y"&&!l.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=>M.ah[p])),this.stateDependentLayerIds=this.layers.filter(p=>p.isStateDependent()).map(p=>p.id),this.sourceID=t.sourceID}createArrays(){this.text=new Rd(new ha(this.layers,this.zoom,t=>/^text/.test(t))),this.icon=new Rd(new ha(this.layers,this.zoom,t=>/^icon/.test(t))),this.glyphOffsetArray=new F,this.lineVertexArray=new N,this.symbolInstances=new C,this.textAnchorOffsets=new G}calculateGlyphDependencies(t,n,a,l,d){for(let p=0;p<t.length;p++)if(n[t.charCodeAt(p)]=!0,(a||l)&&d){const m=Ic[t.charAt(p)];m&&(n[m.charCodeAt(0)]=!0)}}populate(t,n,a){const l=this.layers[0],d=l.layout,p=d.get("text-font"),m=d.get("text-field"),y=d.get("icon-image"),v=(m.value.kind!=="constant"||m.value.value instanceof Di&&!m.value.value.isEmpty()||m.value.value.toString().length>0)&&(p.value.kind!=="constant"||p.value.value.length>0),P=y.value.kind!=="constant"||!!y.value.value||Object.keys(y.parameters).length>0,S=d.get("symbol-sort-key");if(this.features=[],!v&&!P)return;const k=n.iconDependencies,R=n.glyphDependencies,L=n.availableImages,O=new Ft(this.zoom);for(const{feature:$,id:H,index:re,sourceLayerIndex:X}of t){const A=l._featureFilter.needGeometry,U=zn($,A);if(!l._featureFilter.filter(O,U,a))continue;let J,fe;if(A||(U.geometry=En($)),v){const me=l.getValueAndResolveTokens("text-field",U,a,L),xe=Di.factory(me),Re=this.hasRTLText=this.hasRTLText||fx(xe);(!Re||Jr.getRTLTextPluginStatus()==="unavailable"||Re&&Jr.isParsed())&&(J=Yy(xe,l,U))}if(P){const me=l.getValueAndResolveTokens("icon-image",U,a,L);fe=me instanceof Zi?me:Zi.fromString(me)}if(!J&&!fe)continue;const Ce=this.sortFeaturesByKey?S.evaluate(U,{},a):void 0;if(this.features.push({id:H,text:J,icon:fe,index:re,sourceLayerIndex:X,geometry:U.geometry,properties:$.properties,type:dx[$.type],sortKey:Ce}),fe&&(k[fe.name]=!0),J){const me=p.evaluate(U,{},a).join(","),xe=d.get("text-rotation-alignment")!=="viewport"&&d.get("symbol-placement")!=="point";this.allowVerticalPlacement=this.writingModes&&this.writingModes.indexOf(M.ah.vertical)>=0;for(const Re of J.sections)if(Re.image)k[Re.image.name]=!0;else{const Ee=Fo(J.toString()),De=Re.fontStack||me,Pe=R[De]=R[De]||{};this.calculateGlyphDependencies(Re.text,Pe,xe,this.allowVerticalPlacement,Ee)}}}d.get("symbol-placement")==="line"&&(this.features=function($){const H={},re={},X=[];let A=0;function U(me){X.push($[me]),A++}function J(me,xe,Re){const Ee=re[me];return delete re[me],re[xe]=Ee,X[Ee].geometry[0].pop(),X[Ee].geometry[0]=X[Ee].geometry[0].concat(Re[0]),Ee}function fe(me,xe,Re){const Ee=H[xe];return delete H[xe],H[me]=Ee,X[Ee].geometry[0].shift(),X[Ee].geometry[0]=Re[0].concat(X[Ee].geometry[0]),Ee}function Ce(me,xe,Re){const Ee=Re?xe[0][xe[0].length-1]:xe[0][0];return`${me}:${Ee.x}:${Ee.y}`}for(let me=0;me<$.length;me++){const xe=$[me],Re=xe.geometry,Ee=xe.text?xe.text.toString():null;if(!Ee){U(me);continue}const De=Ce(Ee,Re),Pe=Ce(Ee,Re,!0);if(De in re&&Pe in H&&re[De]!==H[Pe]){const $e=fe(De,Pe,Re),Qe=J(De,Pe,X[$e].geometry);delete H[De],delete re[Pe],re[Ce(Ee,X[Qe].geometry,!0)]=Qe,X[$e].geometry=null}else De in re?J(De,Pe,Re):Pe in H?fe(De,Pe,Re):(U(me),H[De]=A-1,re[Pe]=A-1)}return X.filter(me=>me.geometry)}(this.features)),this.sortFeaturesByKey&&this.features.sort(($,H)=>$.sortKey-H.sortKey)}update(t,n,a){this.stateDependentLayers.length&&(this.text.programConfigurations.updatePaintArrays(t,n,this.layers,a),this.icon.programConfigurations.updatePaintArrays(t,n,this.layers,a))}isEmpty(){return this.symbolInstances.length===0&&!this.hasRTLText}uploadPending(){return!this.uploaded||this.text.programConfigurations.needsUpload||this.icon.programConfigurations.needsUpload}upload(t){!this.uploaded&&this.hasDebugData()&&(this.textCollisionBox.upload(t),this.iconCollisionBox.upload(t)),this.text.upload(t,this.sortFeaturesByY,!this.uploaded,this.text.programConfigurations.needsUpload),this.icon.upload(t,this.sortFeaturesByY,!this.uploaded,this.icon.programConfigurations.needsUpload),this.uploaded=!0}destroyDebugData(){this.textCollisionBox.destroy(),this.iconCollisionBox.destroy()}destroy(){this.text.destroy(),this.icon.destroy(),this.hasDebugData()&&this.destroyDebugData()}addToLineVertexArray(t,n){const a=this.lineVertexArray.length;if(t.segment!==void 0){let l=t.dist(n[t.segment+1]),d=t.dist(n[t.segment]);const p={};for(let m=t.segment+1;m<n.length;m++)p[m]={x:n[m].x,y:n[m].y,tileUnitDistanceFromAnchor:l},m<n.length-1&&(l+=n[m+1].dist(n[m]));for(let m=t.segment||0;m>=0;m--)p[m]={x:n[m].x,y:n[m].y,tileUnitDistanceFromAnchor:d},m>0&&(d+=n[m-1].dist(n[m]));for(let m=0;m<n.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,n,a,l,d,p,m,y,v,P,S,k){const R=t.indexArray,L=t.layoutVertexArray,O=t.segments.prepareSegment(4*n.length,L,R,this.canOverlap?p.sortKey:void 0),$=this.glyphOffsetArray.length,H=O.vertexLength,re=this.allowVerticalPlacement&&m===M.ah.vertical?Math.PI/2:0,X=p.text&&p.text.sections;for(let A=0;A<n.length;A++){const{tl:U,tr:J,bl:fe,br:Ce,tex:me,pixelOffsetTL:xe,pixelOffsetBR:Re,minFontScaleX:Ee,minFontScaleY:De,glyphOffset:Pe,isSDF:$e,sectionIndex:Qe}=n[A],Ye=O.vertexLength,He=Pe[1];fh(L,y.x,y.y,U.x,He+U.y,me.x,me.y,a,$e,xe.x,xe.y,Ee,De),fh(L,y.x,y.y,J.x,He+J.y,me.x+me.w,me.y,a,$e,Re.x,xe.y,Ee,De),fh(L,y.x,y.y,fe.x,He+fe.y,me.x,me.y+me.h,a,$e,xe.x,Re.y,Ee,De),fh(L,y.x,y.y,Ce.x,He+Ce.y,me.x+me.w,me.y+me.h,a,$e,Re.x,Re.y,Ee,De),Ad(t.dynamicLayoutVertexArray,y,re),R.emplaceBack(Ye,Ye+2,Ye+1),R.emplaceBack(Ye+1,Ye+2,Ye+3),O.vertexLength+=4,O.primitiveLength+=2,this.glyphOffsetArray.emplaceBack(Pe[0]),A!==n.length-1&&Qe===n[A+1].sectionIndex||t.programConfigurations.populatePaintArrays(L.length,p,p.index,{},k,X&&X[Qe])}t.placedSymbolArray.emplaceBack(y.x,y.y,$,this.glyphOffsetArray.length-$,H,v,P,y.segment,a?a[0]:0,a?a[1]:0,l[0],l[1],m,0,!1,0,S)}_addCollisionDebugVertex(t,n,a,l,d,p){return n.emplaceBack(0,0),t.emplaceBack(a.x,a.y,l,d,Math.round(p.x),Math.round(p.y))}addCollisionDebugVertices(t,n,a,l,d,p,m){const y=d.segments.prepareSegment(4,d.layoutVertexArray,d.indexArray),v=y.vertexLength,P=d.layoutVertexArray,S=d.collisionVertexArray,k=m.anchorX,R=m.anchorY;this._addCollisionDebugVertex(P,S,p,k,R,new Ze(t,n)),this._addCollisionDebugVertex(P,S,p,k,R,new Ze(a,n)),this._addCollisionDebugVertex(P,S,p,k,R,new Ze(a,l)),this._addCollisionDebugVertex(P,S,p,k,R,new Ze(t,l)),y.vertexLength+=4;const L=d.indexArray;L.emplaceBack(v,v+1),L.emplaceBack(v+1,v+2),L.emplaceBack(v+2,v+3),L.emplaceBack(v+3,v),y.primitiveLength+=4}addDebugCollisionBoxes(t,n,a,l){for(let d=t;d<n;d++){const p=this.collisionBoxArray.get(d);this.addCollisionDebugVertices(p.x1,p.y1,p.x2,p.y2,l?this.textCollisionBox:this.iconCollisionBox,p.anchorPoint,a)}}generateCollisionDebugBuffers(){this.hasDebugData()&&this.destroyDebugData(),this.textCollisionBox=new Dd(Be,If.members,We),this.iconCollisionBox=new Dd(Be,If.members,We);for(let t=0;t<this.symbolInstances.length;t++){const n=this.symbolInstances.get(t);this.addDebugCollisionBoxes(n.textBoxStartIndex,n.textBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.verticalTextBoxStartIndex,n.verticalTextBoxEndIndex,n,!0),this.addDebugCollisionBoxes(n.iconBoxStartIndex,n.iconBoxEndIndex,n,!1),this.addDebugCollisionBoxes(n.verticalIconBoxStartIndex,n.verticalIconBoxEndIndex,n,!1)}}_deserializeCollisionBoxesForSymbol(t,n,a,l,d,p,m,y,v){const P={};for(let S=n;S<a;S++){const k=t.get(S);P.textBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},P.textFeatureIndex=k.featureIndex;break}for(let S=l;S<d;S++){const k=t.get(S);P.verticalTextBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},P.verticalTextFeatureIndex=k.featureIndex;break}for(let S=p;S<m;S++){const k=t.get(S);P.iconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},P.iconFeatureIndex=k.featureIndex;break}for(let S=y;S<v;S++){const k=t.get(S);P.verticalIconBox={x1:k.x1,y1:k.y1,x2:k.x2,y2:k.y2,anchorPointX:k.anchorPointX,anchorPointY:k.anchorPointY},P.verticalIconFeatureIndex=k.featureIndex;break}return P}deserializeCollisionBoxes(t){this.collisionArrays=[];for(let n=0;n<this.symbolInstances.length;n++){const a=this.symbolInstances.get(n);this.collisionArrays.push(this._deserializeCollisionBoxesForSymbol(t,a.textBoxStartIndex,a.textBoxEndIndex,a.verticalTextBoxStartIndex,a.verticalTextBoxEndIndex,a.iconBoxStartIndex,a.iconBoxEndIndex,a.verticalIconBoxStartIndex,a.verticalIconBoxEndIndex))}}hasTextData(){return this.text.segments.get().length>0}hasIconData(){return this.icon.segments.get().length>0}hasDebugData(){return this.textCollisionBox&&this.iconCollisionBox}hasTextCollisionBoxData(){return this.hasDebugData()&&this.textCollisionBox.segments.get().length>0}hasIconCollisionBoxData(){return this.hasDebugData()&&this.iconCollisionBox.segments.get().length>0}addIndicesForPlacedSymbol(t,n){const a=t.placedSymbolArray.get(n),l=a.vertexStartIndex+4*a.numGlyphs;for(let d=a.vertexStartIndex;d<l;d+=4)t.indexArray.emplaceBack(d,d+2,d+1),t.indexArray.emplaceBack(d+1,d+2,d+3)}getSortedSymbolIndexes(t){if(this.sortedAngle===t&&this.symbolInstanceIndexes!==void 0)return this.symbolInstanceIndexes;const n=Math.sin(t),a=Math.cos(t),l=[],d=[],p=[];for(let m=0;m<this.symbolInstances.length;++m){p.push(m);const y=this.symbolInstances.get(m);l.push(0|Math.round(n*y.anchorX+a*y.anchorY)),d.push(y.featureIndex)}return p.sort((m,y)=>l[m]-l[y]||d[y]-d[m]),p}addToSortKeyRanges(t,n){const a=this.sortKeyRanges[this.sortKeyRanges.length-1];a&&a.sortKey===n?a.symbolInstanceEnd=t+1:this.sortKeyRanges.push({sortKey:n,symbolInstanceStart:t,symbolInstanceEnd:t+1})}sortFeatures(t){if(this.sortFeaturesByY&&this.sortedAngle!==t&&!(this.text.segments.get().length>1||this.icon.segments.get().length>1)){this.symbolInstanceIndexes=this.getSortedSymbolIndexes(t),this.sortedAngle=t,this.text.indexArray.clear(),this.icon.indexArray.clear(),this.featureSortOrder=[];for(const n of this.symbolInstanceIndexes){const a=this.symbolInstances.get(n);this.featureSortOrder.push(a.featureIndex),[a.rightJustifiedTextSymbolIndex,a.centerJustifiedTextSymbolIndex,a.leftJustifiedTextSymbolIndex].forEach((l,d,p)=>{l>=0&&p.indexOf(l)===d&&this.addIndicesForPlacedSymbol(this.text,l)}),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 Zf,Vf;Ve("SymbolBucket",Ko,{omit:["layers","collisionBoxArray","features","compareText"]}),Ko.MAX_GLYPHS=65535,Ko.addDynamicAttributes=Ad;var Ld={get paint(){return Vf=Vf||new $i({"icon-opacity":new tt(D.paint_symbol["icon-opacity"]),"icon-color":new tt(D.paint_symbol["icon-color"]),"icon-halo-color":new tt(D.paint_symbol["icon-halo-color"]),"icon-halo-width":new tt(D.paint_symbol["icon-halo-width"]),"icon-halo-blur":new tt(D.paint_symbol["icon-halo-blur"]),"icon-translate":new Xe(D.paint_symbol["icon-translate"]),"icon-translate-anchor":new Xe(D.paint_symbol["icon-translate-anchor"]),"text-opacity":new tt(D.paint_symbol["text-opacity"]),"text-color":new tt(D.paint_symbol["text-color"],{runtimeType:st,getOverride:r=>r.textColor,hasOverride:r=>!!r.textColor}),"text-halo-color":new tt(D.paint_symbol["text-halo-color"]),"text-halo-width":new tt(D.paint_symbol["text-halo-width"]),"text-halo-blur":new tt(D.paint_symbol["text-halo-blur"]),"text-translate":new Xe(D.paint_symbol["text-translate"]),"text-translate-anchor":new Xe(D.paint_symbol["text-translate-anchor"])})},get layout(){return Zf=Zf||new $i({"symbol-placement":new Xe(D.layout_symbol["symbol-placement"]),"symbol-spacing":new Xe(D.layout_symbol["symbol-spacing"]),"symbol-avoid-edges":new Xe(D.layout_symbol["symbol-avoid-edges"]),"symbol-sort-key":new tt(D.layout_symbol["symbol-sort-key"]),"symbol-z-order":new Xe(D.layout_symbol["symbol-z-order"]),"icon-allow-overlap":new Xe(D.layout_symbol["icon-allow-overlap"]),"icon-overlap":new Xe(D.layout_symbol["icon-overlap"]),"icon-ignore-placement":new Xe(D.layout_symbol["icon-ignore-placement"]),"icon-optional":new Xe(D.layout_symbol["icon-optional"]),"icon-rotation-alignment":new Xe(D.layout_symbol["icon-rotation-alignment"]),"icon-size":new tt(D.layout_symbol["icon-size"]),"icon-text-fit":new Xe(D.layout_symbol["icon-text-fit"]),"icon-text-fit-padding":new Xe(D.layout_symbol["icon-text-fit-padding"]),"icon-image":new tt(D.layout_symbol["icon-image"]),"icon-rotate":new tt(D.layout_symbol["icon-rotate"]),"icon-padding":new tt(D.layout_symbol["icon-padding"]),"icon-keep-upright":new Xe(D.layout_symbol["icon-keep-upright"]),"icon-offset":new tt(D.layout_symbol["icon-offset"]),"icon-anchor":new tt(D.layout_symbol["icon-anchor"]),"icon-pitch-alignment":new Xe(D.layout_symbol["icon-pitch-alignment"]),"text-pitch-alignment":new Xe(D.layout_symbol["text-pitch-alignment"]),"text-rotation-alignment":new Xe(D.layout_symbol["text-rotation-alignment"]),"text-field":new tt(D.layout_symbol["text-field"]),"text-font":new tt(D.layout_symbol["text-font"]),"text-size":new tt(D.layout_symbol["text-size"]),"text-max-width":new tt(D.layout_symbol["text-max-width"]),"text-line-height":new Xe(D.layout_symbol["text-line-height"]),"text-letter-spacing":new tt(D.layout_symbol["text-letter-spacing"]),"text-justify":new tt(D.layout_symbol["text-justify"]),"text-radial-offset":new tt(D.layout_symbol["text-radial-offset"]),"text-variable-anchor":new Xe(D.layout_symbol["text-variable-anchor"]),"text-variable-anchor-offset":new tt(D.layout_symbol["text-variable-anchor-offset"]),"text-anchor":new tt(D.layout_symbol["text-anchor"]),"text-max-angle":new Xe(D.layout_symbol["text-max-angle"]),"text-writing-mode":new Xe(D.layout_symbol["text-writing-mode"]),"text-rotate":new tt(D.layout_symbol["text-rotate"]),"text-padding":new Xe(D.layout_symbol["text-padding"]),"text-keep-upright":new Xe(D.layout_symbol["text-keep-upright"]),"text-transform":new tt(D.layout_symbol["text-transform"]),"text-offset":new tt(D.layout_symbol["text-offset"]),"text-allow-overlap":new Xe(D.layout_symbol["text-allow-overlap"]),"text-overlap":new Xe(D.layout_symbol["text-overlap"]),"text-ignore-placement":new Xe(D.layout_symbol["text-ignore-placement"]),"text-optional":new Xe(D.layout_symbol["text-optional"])})}};class Uf{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:_t,this.defaultValue=t}evaluate(t){if(t.formattedSection){const n=this.defaultValue.property.overrides;if(n&&n.hasOverride(t.formattedSection))return n.getOverride(t.formattedSection)}return t.feature&&t.featureState?this.defaultValue.evaluate(t.feature,t.featureState):this.defaultValue.property.specification.default}eachChild(t){this.defaultValue.isConstant()||t(this.defaultValue.value._styleExpression.expression)}outputDefined(){return!1}serialize(){return null}}Ve("FormatSectionOverride",Uf,{omit:["defaultValue"]});class mh extends Fi{constructor(t){super(t,Ld)}recalculate(t,n){if(super.recalculate(t,n),this.layout.get("icon-rotation-alignment")==="auto"&&(this.layout._values["icon-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-rotation-alignment")==="auto"&&(this.layout._values["text-rotation-alignment"]=this.layout.get("symbol-placement")!=="point"?"map":"viewport"),this.layout.get("text-pitch-alignment")==="auto"&&(this.layout._values["text-pitch-alignment"]=this.layout.get("text-rotation-alignment")==="map"?"map":"viewport"),this.layout.get("icon-pitch-alignment")==="auto"&&(this.layout._values["icon-pitch-alignment"]=this.layout.get("icon-rotation-alignment")),this.layout.get("symbol-placement")==="point"){const a=this.layout.get("text-writing-mode");if(a){const l=[];for(const d of a)l.indexOf(d)<0&&l.push(d);this.layout._values["text-writing-mode"]=l}else this.layout._values["text-writing-mode"]=["horizontal"]}this._setPaintOverrides()}getValueAndResolveTokens(t,n,a,l){const d=this.layout.get(t).evaluate(n,{},a,l),p=this._unevaluatedLayout._values[t];return p.isDataDriven()||As(p.value)||!d?d:function(m,y){return y.replace(/{([^{}]+)}/g,(v,P)=>m&&P in m?String(m[P]):"")}(n.properties,d)}createBucket(t){return new Ko(t)}queryRadius(){return 0}queryIntersectsFeature(){throw new Error("Should take a different path in FeatureIndex")}_setPaintOverrides(){for(const t of Ld.paint.overridableProperties){if(!mh.hasPaintOverride(this.layout,t))continue;const n=this.paint.get(t),a=new Uf(n),l=new qa(a,n.property.specification);let d=null;d=n.value.kind==="constant"||n.value.kind==="source"?new $l("source",l):new Gl("composite",l,n.value.zoomStops),this.paint._values[t]=new Dr(n.property,d,n.parameters)}}_handleOverridablePaintPropertyUpdate(t,n,a){return!(!this.layout||n.isDataDriven()||a.isDataDriven())&&mh.hasPaintOverride(this.layout,t)}static hasPaintOverride(t,n){const a=t.get("text-field"),l=Ld.paint.properties[n];let d=!1;const p=m=>{for(const y of m)if(l.overrides&&l.overrides.hasOverride(y))return void(d=!0)};if(a.value.kind==="constant"&&a.value.value instanceof Di)p(a.value.value.sections);else if(a.value.kind==="source"){const m=v=>{d||(v instanceof Tn&&Nt(v.value)===Dt?p(v.value.sections):v instanceof ja?p(v.sections):v.eachChild(m))},y=a.value;y._styleExpression&&m(y._styleExpression.expression)}return d}}let $f;var mx={get paint(){return $f=$f||new $i({"background-color":new Xe(D.paint_background["background-color"]),"background-pattern":new sc(D.paint_background["background-pattern"]),"background-opacity":new Xe(D.paint_background["background-opacity"])})}};class gx extends Fi{constructor(t){super(t,mx)}}let Gf;var _x={get paint(){return Gf=Gf||new $i({"raster-opacity":new Xe(D.paint_raster["raster-opacity"]),"raster-hue-rotate":new Xe(D.paint_raster["raster-hue-rotate"]),"raster-brightness-min":new Xe(D.paint_raster["raster-brightness-min"]),"raster-brightness-max":new Xe(D.paint_raster["raster-brightness-max"]),"raster-saturation":new Xe(D.paint_raster["raster-saturation"]),"raster-contrast":new Xe(D.paint_raster["raster-contrast"]),"raster-resampling":new Xe(D.paint_raster["raster-resampling"]),"raster-fade-duration":new Xe(D.paint_raster["raster-fade-duration"])})}};class yx extends Fi{constructor(t){super(t,_x)}}class xx extends Fi{constructor(t){super(t,{}),this.onAdd=n=>{this.implementation.onAdd&&this.implementation.onAdd(n,n.painter.context.gl)},this.onRemove=n=>{this.implementation.onRemove&&this.implementation.onRemove(n,n.painter.context.gl)},this.implementation=t}is3D(){return this.implementation.renderingMode==="3d"}hasOffscreenPass(){return this.implementation.prerender!==void 0}recalculate(){}updateTransitions(){}hasTransition(){return!1}serialize(){throw new Error("Custom layers cannot be serialized")}}class vx{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 bx={once:!0},Fd=63710088e-1;class ns{constructor(t,n){if(isNaN(t)||isNaN(n))throw new Error(`Invalid LngLat object: (${t}, ${n})`);if(this.lng=+t,this.lat=+n,this.lat>90||this.lat<-90)throw new Error("Invalid LngLat latitude value: must be between -90 and 90")}wrap(){return new ns(nr(this.lng,-180,180),this.lat)}toArray(){return[this.lng,this.lat]}toString(){return`LngLat(${this.lng}, ${this.lat})`}distanceTo(t){const n=Math.PI/180,a=this.lat*n,l=t.lat*n,d=Math.sin(a)*Math.sin(l)+Math.cos(a)*Math.cos(l)*Math.cos((t.lng-this.lng)*n);return Fd*Math.acos(Math.min(d,1))}static convert(t){if(t instanceof ns)return t;if(Array.isArray(t)&&(t.length===2||t.length===3))return new ns(Number(t[0]),Number(t[1]));if(!Array.isArray(t)&&typeof t=="object"&&t!==null)return new ns(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 qf=2*Math.PI*Fd;function Wf(r){return qf*Math.cos(r*Math.PI/180)}function Hf(r){return(180+r)/360}function Kf(r){return(180-180/Math.PI*Math.log(Math.tan(Math.PI/4+r*Math.PI/360)))/360}function Xf(r,t){return r/Wf(t)}function Bd(r){return 360/Math.PI*Math.atan(Math.exp((180-360*r)*Math.PI/180))-90}function Yf(r,t){return r*Wf(Bd(t))}class zc{constructor(t,n,a=0){this.x=+t,this.y=+n,this.z=+a}static fromLngLat(t,n=0){const a=ns.convert(t);return new zc(Hf(a.lng),Kf(a.lat),Xf(n,a.lat))}toLngLat(){return new ns(360*this.x-180,Bd(this.y))}toAltitude(){return Yf(this.z,this.y)}meterInMercatorCoordinateUnits(){return 1/qf*(t=Bd(this.y),1/Math.cos(t*Math.PI/180));var t}}function Jf(r,t,n){var a=2*Math.PI*6378137/256/Math.pow(2,n);return[r*a-2*Math.PI*6378137/2,t*a-2*Math.PI*6378137/2]}class Od{constructor(t,n,a){if(!function(l,d,p){return!(l<0||l>25||p<0||p>=Math.pow(2,l)||d<0||d>=Math.pow(2,l))}(t,n,a))throw new Error(`x=${n}, y=${a}, z=${t} outside of bounds. 0<=x<${Math.pow(2,t)}, 0<=y<${Math.pow(2,t)} 0<=z<=25 `);this.z=t,this.x=n,this.y=a,this.key=Xo(0,t,t,n,a)}equals(t){return this.z===t.z&&this.x===t.x&&this.y===t.y}url(t,n,a){const l=(p=this.y,m=this.z,y=Jf(256*(d=this.x),256*(p=Math.pow(2,m)-p-1),m),v=Jf(256*(d+1),256*(p+1),m),y[0]+","+y[1]+","+v[0]+","+v[1]);var d,p,m,y,v;const P=function(S,k,R){let L,O="";for(let $=S;$>0;$--)L=1<<$-1,O+=(k&L?1:0)+(R&L?2:0);return O}(this.z,this.x,this.y);return t[(this.x+this.y)%t.length].replace(/{prefix}/g,(this.x%16).toString(16)+(this.y%16).toString(16)).replace(/{z}/g,String(this.z)).replace(/{x}/g,String(this.x)).replace(/{y}/g,String(a==="tms"?Math.pow(2,this.z)-this.y-1:this.y)).replace(/{ratio}/g,n>1?"@2x":"").replace(/{quadkey}/g,P).replace(/{bbox-epsg-3857}/g,l)}isChildOf(t){const n=this.z-t.z;return n>0&&t.x===this.x>>n&&t.y===this.y>>n}getTilePoint(t){const n=Math.pow(2,this.z);return new Ze((t.x*n-this.x)*St,(t.y*n-this.y)*St)}toString(){return`${this.z}/${this.x}/${this.y}`}}class Qf{constructor(t,n){this.wrap=t,this.canonical=n,this.key=Xo(t,n.z,n.z,n.x,n.y)}}class wr{constructor(t,n,a,l,d){if(this.terrainRttPosMatrix32f=null,t<a)throw new Error(`overscaledZ should be >= z; overscaledZ = ${t}; z = ${a}`);this.overscaledZ=t,this.wrap=n,this.canonical=new Od(a,+l,+d),this.key=Xo(n,t,a,l,d)}clone(){return new wr(this.overscaledZ,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)}equals(t){return this.overscaledZ===t.overscaledZ&&this.wrap===t.wrap&&this.canonical.equals(t.canonical)}scaledTo(t){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const n=this.canonical.z-t;return t>this.canonical.z?new wr(t,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y):new wr(t,this.wrap,t,this.canonical.x>>n,this.canonical.y>>n)}calculateScaledKey(t,n){if(t>this.overscaledZ)throw new Error(`targetZ > this.overscaledZ; targetZ = ${t}; overscaledZ = ${this.overscaledZ}`);const a=this.canonical.z-t;return t>this.canonical.z?Xo(this.wrap*+n,t,this.canonical.z,this.canonical.x,this.canonical.y):Xo(this.wrap*+n,t,t,this.canonical.x>>a,this.canonical.y>>a)}isChildOf(t){if(t.wrap!==this.wrap)return!1;const n=this.canonical.z-t.canonical.z;return t.overscaledZ===0||t.overscaledZ<this.overscaledZ&&t.canonical.x===this.canonical.x>>n&&t.canonical.y===this.canonical.y>>n}children(t){if(this.overscaledZ>=t)return[new wr(this.overscaledZ+1,this.wrap,this.canonical.z,this.canonical.x,this.canonical.y)];const n=this.canonical.z+1,a=2*this.canonical.x,l=2*this.canonical.y;return[new wr(n,this.wrap,n,a,l),new wr(n,this.wrap,n,a+1,l),new wr(n,this.wrap,n,a,l+1),new wr(n,this.wrap,n,a+1,l+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 wr(this.overscaledZ,0,this.canonical.z,this.canonical.x,this.canonical.y)}unwrapTo(t){return new wr(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 Qf(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 Xo(r,t,n,a,l){(r*=2)<0&&(r=-1*r-1);const d=1<<n;return(d*d*r+d*l+a).toString(36)+n.toString(36)+t.toString(36)}Ve("CanonicalTileID",Od),Ve("OverscaledTileID",wr,{omit:["terrainRttPosMatrix32f"]});class em{constructor(t,n,a,l=1,d=1,p=1,m=0){if(this.uid=t,n.height!==n.width)throw new RangeError("DEM tiles must be square");if(a&&!["mapbox","terrarium","custom"].includes(a))return void Ci(`"${a}" is not a valid encoding type. Valid types include "mapbox", "terrarium" and "custom".`);this.stride=n.height;const y=this.dim=n.height-2;switch(this.data=new Uint32Array(n.data.buffer),a){case"terrarium":this.redFactor=256,this.greenFactor=1,this.blueFactor=1/256,this.baseShift=32768;break;case"custom":this.redFactor=l,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 v=0;v<y;v++)this.data[this._idx(-1,v)]=this.data[this._idx(0,v)],this.data[this._idx(y,v)]=this.data[this._idx(y-1,v)],this.data[this._idx(v,-1)]=this.data[this._idx(v,0)],this.data[this._idx(v,y)]=this.data[this._idx(v,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 v=0;v<y;v++)for(let P=0;P<y;P++){const S=this.get(v,P);S>this.max&&(this.max=S),S<this.min&&(this.min=S)}}get(t,n){const a=new Uint8Array(this.data.buffer),l=4*this._idx(t,n);return this.unpack(a[l],a[l+1],a[l+2])}getUnpackVector(){return[this.redFactor,this.greenFactor,this.blueFactor,this.baseShift]}_idx(t,n){if(t<-1||t>=this.dim+1||n<-1||n>=this.dim+1)throw new RangeError("out of range source coordinates for DEM data");return(n+1)*this.stride+(t+1)}unpack(t,n,a){return t*this.redFactor+n*this.greenFactor+a*this.blueFactor-this.baseShift}getPixels(){return new br({width:this.stride,height:this.stride},new Uint8Array(this.data.buffer))}backfillBorder(t,n,a){if(this.dim!==t.dim)throw new Error("dem dimension mismatch");let l=n*this.dim,d=n*this.dim+this.dim,p=a*this.dim,m=a*this.dim+this.dim;switch(n){case-1:l=d-1;break;case 1:d=l+1}switch(a){case-1:p=m-1;break;case 1:m=p+1}const y=-n*this.dim,v=-a*this.dim;for(let P=p;P<m;P++)for(let S=l;S<d;S++)this.data[this._idx(S,P)]=t.data[this._idx(S+y,P+v)]}}Ve("DEMData",em);class tm{constructor(t){this._stringToNumber={},this._numberToString=[];for(let n=0;n<t.length;n++){const a=t[n];this._stringToNumber[a]=n,this._numberToString[n]=a}}encode(t){return this._stringToNumber[t]}decode(t){if(t>=this._numberToString.length)throw new Error(`Out of bounds. Index requested n=${t} can't be >= this._numberToString.length ${this._numberToString.length}`);return this._numberToString[t]}}class im{constructor(t,n,a,l,d){this.type="Feature",this._vectorTileFeature=t,t._z=n,t._x=a,t._y=l,this.properties=t.properties,this.id=d}get geometry(){return this._geometry===void 0&&(this._geometry=this._vectorTileFeature.toGeoJSON(this._vectorTileFeature._x,this._vectorTileFeature._y,this._vectorTileFeature._z).geometry),this._geometry}set geometry(t){this._geometry=t}toJSON(){const t={geometry:this.geometry};for(const n in this)n!=="_geometry"&&n!=="_vectorTileFeature"&&(t[n]=this[n]);return t}}class rm{constructor(t,n){this.tileID=t,this.x=t.canonical.x,this.y=t.canonical.y,this.z=t.canonical.z,this.grid=new Fs(St,16,0),this.grid3D=new Fs(St,16,0),this.featureIndexArray=new K,this.promoteId=n}insert(t,n,a,l,d,p){const m=this.featureIndexArray.length;this.featureIndexArray.emplaceBack(a,l,d);const y=p?this.grid3D:this.grid;for(let v=0;v<n.length;v++){const P=n[v],S=[1/0,1/0,-1/0,-1/0];for(let k=0;k<P.length;k++){const R=P[k];S[0]=Math.min(S[0],R.x),S[1]=Math.min(S[1],R.y),S[2]=Math.max(S[2],R.x),S[3]=Math.max(S[3],R.y)}S[0]<St&&S[1]<St&&S[2]>=0&&S[3]>=0&&y.insert(m,S[0],S[1],S[2],S[3])}}loadVTLayers(){return this.vtLayers||(this.vtLayers=new Pc.VectorTile(new Md(this.rawTileData)).layers,this.sourceLayerCoder=new tm(this.vtLayers?Object.keys(this.vtLayers).sort():["_geojsonTileLayer"])),this.vtLayers}query(t,n,a,l){this.loadVTLayers();const d=t.params,p=St/t.tileSize/t.scale,m=ql(d.filter),y=t.queryGeometry,v=t.queryPadding*p,P=am(y),S=this.grid.query(P.minX-v,P.minY-v,P.maxX+v,P.maxY+v),k=am(t.cameraQueryGeometry),R=this.grid3D.query(k.minX-v,k.minY-v,k.maxX+v,k.maxY+v,($,H,re,X)=>function(A,U,J,fe,Ce){for(const xe of A)if(U<=xe.x&&J<=xe.y&&fe>=xe.x&&Ce>=xe.y)return!0;const me=[new Ze(U,J),new Ze(U,Ce),new Ze(fe,Ce),new Ze(fe,J)];if(A.length>2){for(const xe of me)if(Gs(A,xe))return!0}for(let xe=0;xe<A.length-1;xe++)if(cy(A[xe],A[xe+1],me))return!0;return!1}(t.cameraQueryGeometry,$-v,H-v,re+v,X+v));for(const $ of R)S.push($);S.sort(wx);const L={};let O;for(let $=0;$<S.length;$++){const H=S[$];if(H===O)continue;O=H;const re=this.featureIndexArray.get(H);let X=null;this.loadMatchingFeature(L,re.bucketIndex,re.sourceLayerIndex,re.featureIndex,m,d.layers,d.availableImages,n,a,l,(A,U,J)=>(X||(X=En(A)),U.queryIntersectsFeature({queryGeometry:y,feature:A,featureState:J,geometry:X,zoom:this.z,transform:t.transform,pixelsToTileUnits:p,pixelPosMatrix:t.pixelPosMatrix,unwrappedTileID:this.tileID.toUnwrapped(),getElevation:t.getElevation})))}return L}loadMatchingFeature(t,n,a,l,d,p,m,y,v,P,S){const k=this.bucketLayerIDs[n];if(p&&!k.some($=>p.has($)))return;const R=this.sourceLayerCoder.decode(a),L=this.vtLayers[R].feature(l);if(d.needGeometry){const $=zn(L,!0);if(!d.filter(new Ft(this.tileID.overscaledZ),$,this.tileID.canonical))return}else if(!d.filter(new Ft(this.tileID.overscaledZ),L))return;const O=this.getId(L,R);for(let $=0;$<k.length;$++){const H=k[$];if(p&&!p.has(H))continue;const re=y[H];if(!re)continue;let X={};O&&P&&(X=P.getState(re.sourceLayer||"_geojsonTileLayer",O));const A=vi({},v[H]);A.paint=nm(A.paint,re.paint,L,X,m),A.layout=nm(A.layout,re.layout,L,X,m);const U=!S||S(L,re,X);if(!U)continue;const J=new im(L,this.z,this.x,this.y,O);J.layer=A;let fe=t[H];fe===void 0&&(fe=t[H]=[]),fe.push({featureIndex:l,feature:J,intersectionZ:U})}}lookupSymbolFeatures(t,n,a,l,d,p,m,y){const v={};this.loadVTLayers();const P=ql(d);for(const S of t)this.loadMatchingFeature(v,a,l,S,P,p,m,y,n);return v}hasLayer(t){for(const n of this.bucketLayerIDs)for(const a of n)if(t===a)return!0;return!1}getId(t,n){var a;let l=t.id;return this.promoteId&&(l=t.properties[typeof this.promoteId=="string"?this.promoteId:this.promoteId[n]],typeof l=="boolean"&&(l=Number(l)),l===void 0&&(!((a=t.properties)===null||a===void 0)&&a.cluster)&&this.promoteId&&(l=Number(t.properties.cluster_id))),l}}function nm(r,t,n,a,l){return Vn(r,(d,p)=>{const m=t instanceof Ns?t.get(p):null;return m&&m.evaluate?m.evaluate(n,a,l):m})}function am(r){let t=1/0,n=1/0,a=-1/0,l=-1/0;for(const d of r)t=Math.min(t,d.x),n=Math.min(n,d.y),a=Math.max(a,d.x),l=Math.max(l,d.y);return{minX:t,minY:n,maxX:a,maxY:l}}function wx(r,t){return t-r}function sm(r,t,n,a,l){const d=[];for(let p=0;p<r.length;p++){const m=r[p];let y;for(let v=0;v<m.length-1;v++){let P=m[v],S=m[v+1];P.x<t&&S.x<t||(P.x<t?P=new Ze(t,P.y+(t-P.x)/(S.x-P.x)*(S.y-P.y))._round():S.x<t&&(S=new Ze(t,P.y+(t-P.x)/(S.x-P.x)*(S.y-P.y))._round()),P.y<n&&S.y<n||(P.y<n?P=new Ze(P.x+(n-P.y)/(S.y-P.y)*(S.x-P.x),n)._round():S.y<n&&(S=new Ze(P.x+(n-P.y)/(S.y-P.y)*(S.x-P.x),n)._round()),P.x>=a&&S.x>=a||(P.x>=a?P=new Ze(a,P.y+(a-P.x)/(S.x-P.x)*(S.y-P.y))._round():S.x>=a&&(S=new Ze(a,P.y+(a-P.x)/(S.x-P.x)*(S.y-P.y))._round()),P.y>=l&&S.y>=l||(P.y>=l?P=new Ze(P.x+(l-P.y)/(S.y-P.y)*(S.x-P.x),l)._round():S.y>=l&&(S=new Ze(P.x+(l-P.y)/(S.y-P.y)*(S.x-P.x),l)._round()),y&&P.equals(y[y.length-1])||(y=[P],d.push(y)),y.push(S)))))}}return d}Ve("FeatureIndex",rm,{omit:["rawTileData","sourceLayerCoder"]});class as extends Ze{constructor(t,n,a,l){super(t,n),this.angle=a,l!==void 0&&(this.segment=l)}clone(){return new as(this.x,this.y,this.angle,this.segment)}}function om(r,t,n,a,l){if(t.segment===void 0||n===0)return!0;let d=t,p=t.segment+1,m=0;for(;m>-n/2;){if(p--,p<0)return!1;m-=r[p].dist(d),d=r[p]}m+=r[p].dist(r[p+1]),p++;const y=[];let v=0;for(;m<n/2;){const P=r[p],S=r[p+1];if(!S)return!1;let k=r[p-1].angleTo(P)-P.angleTo(S);for(k=Math.abs((k+3*Math.PI)%(2*Math.PI)-Math.PI),y.push({distance:m,angleDelta:k}),v+=k;m-y[0].distance>a;)v-=y.shift().angleDelta;if(v>l)return!1;p++,m+=P.dist(S)}return!0}function lm(r){let t=0;for(let n=0;n<r.length-1;n++)t+=r[n].dist(r[n+1]);return t}function cm(r,t,n){return r?.6*t*n:0}function um(r,t){return Math.max(r?r.right-r.left:0,t?t.right-t.left:0)}function Tx(r,t,n,a,l,d){const p=cm(n,l,d),m=um(n,a)*d;let y=0;const v=lm(r)/2;for(let P=0;P<r.length-1;P++){const S=r[P],k=r[P+1],R=S.dist(k);if(y+R>v){const L=(v-y)/R,O=xr.number(S.x,k.x,L),$=xr.number(S.y,k.y,L),H=new as(O,$,k.angleTo(S),P);return H._round(),!p||om(r,H,m,p,t)?H:void 0}y+=R}}function Px(r,t,n,a,l,d,p,m,y){const v=cm(a,d,p),P=um(a,l),S=P*p,k=r[0].x===0||r[0].x===y||r[0].y===0||r[0].y===y;return t-S<t/4&&(t=S+t/4),hm(r,k?t/2*m%t:(P/2+2*d)*p*m%t,t,v,n,S,k,!1,y)}function hm(r,t,n,a,l,d,p,m,y){const v=d/2,P=lm(r);let S=0,k=t-n,R=[];for(let L=0;L<r.length-1;L++){const O=r[L],$=r[L+1],H=O.dist($),re=$.angleTo(O);for(;k+n<S+H;){k+=n;const X=(k-S)/H,A=xr.number(O.x,$.x,X),U=xr.number(O.y,$.y,X);if(A>=0&&A<y&&U>=0&&U<y&&k-v>=0&&k+v<=P){const J=new as(A,U,re,L);J._round(),a&&!om(r,J,d,a,l)||R.push(J)}}S+=H}return m||R.length||p||(R=hm(r,S/2,n,a,l,d,p,!0,y)),R}Ve("Anchor",as);const kc=Qi;function dm(r,t,n,a){const l=[],d=r.image,p=d.pixelRatio,m=d.paddedRect.w-2*kc,y=d.paddedRect.h-2*kc;let v={x1:r.left,y1:r.top,x2:r.right,y2:r.bottom};const P=d.stretchX||[[0,m]],S=d.stretchY||[[0,y]],k=(Pe,$e)=>Pe+$e[1]-$e[0],R=P.reduce(k,0),L=S.reduce(k,0),O=m-R,$=y-L;let H=0,re=R,X=0,A=L,U=0,J=O,fe=0,Ce=$;if(d.content&&a){const Pe=d.content,$e=Pe[2]-Pe[0],Qe=Pe[3]-Pe[1];(d.textFitWidth||d.textFitHeight)&&(v=Of(r)),H=gh(P,0,Pe[0]),X=gh(S,0,Pe[1]),re=gh(P,Pe[0],Pe[2]),A=gh(S,Pe[1],Pe[3]),U=Pe[0]-H,fe=Pe[1]-X,J=$e-re,Ce=Qe-A}const me=v.x1,xe=v.y1,Re=v.x2-me,Ee=v.y2-xe,De=(Pe,$e,Qe,Ye)=>{const He=_h(Pe.stretch-H,re,Re,me),ft=yh(Pe.fixed-U,J,Pe.stretch,R),Ht=_h($e.stretch-X,A,Ee,xe),di=yh($e.fixed-fe,Ce,$e.stretch,L),Ai=_h(Qe.stretch-H,re,Re,me),Tr=yh(Qe.fixed-U,J,Qe.stretch,R),er=_h(Ye.stretch-X,A,Ee,xe),Ti=yh(Ye.fixed-fe,Ce,Ye.stretch,L),Ut=new Ze(He,Ht),mi=new Ze(Ai,Ht),Pi=new Ze(Ai,er),Si=new Ze(He,er),qi=new Ze(ft/p,di/p),Pr=new Ze(Tr/p,Ti/p),gi=t*Math.PI/180;if(gi){const _i=Math.sin(gi),yi=Math.cos(gi),si=[yi,-_i,_i,yi];Ut._matMult(si),mi._matMult(si),Si._matMult(si),Pi._matMult(si)}const tr=Pe.stretch+Pe.fixed,pi=$e.stretch+$e.fixed;return{tl:Ut,tr:mi,bl:Si,br:Pi,tex:{x:d.paddedRect.x+kc+tr,y:d.paddedRect.y+kc+pi,w:Qe.stretch+Qe.fixed-tr,h:Ye.stretch+Ye.fixed-pi},writingMode:void 0,glyphOffset:[0,0],sectionIndex:0,pixelOffsetTL:qi,pixelOffsetBR:Pr,minFontScaleX:J/p/Re,minFontScaleY:Ce/p/Ee,isSDF:n}};if(a&&(d.stretchX||d.stretchY)){const Pe=pm(P,O,R),$e=pm(S,$,L);for(let Qe=0;Qe<Pe.length-1;Qe++){const Ye=Pe[Qe],He=Pe[Qe+1];for(let ft=0;ft<$e.length-1;ft++)l.push(De(Ye,$e[ft],He,$e[ft+1]))}}else l.push(De({fixed:0,stretch:-1},{fixed:0,stretch:-1},{fixed:0,stretch:m+1},{fixed:0,stretch:y+1}));return l}function gh(r,t,n){let a=0;for(const l of r)a+=Math.max(t,Math.min(n,l[1]))-Math.max(t,Math.min(n,l[0]));return a}function pm(r,t,n){const a=[{fixed:-1,stretch:0}];for(const[l,d]of r){const p=a[a.length-1];a.push({fixed:l-p.stretch,stretch:p.stretch}),a.push({fixed:l-p.stretch,stretch:p.stretch+(d-l)})}return a.push({fixed:t+kc,stretch:n}),a}function _h(r,t,n,a){return r/t*n+a}function yh(r,t,n,a){return r-t*n/a}class xh{constructor(t,n,a,l,d,p,m,y,v,P){var S;if(this.boxStartIndex=t.length,v){let k=p.top,R=p.bottom;const L=p.collisionPadding;L&&(k-=L[1],R+=L[3]);let O=R-k;O>0&&(O=Math.max(10,O),this.circleDiameter=O)}else{const k=!((S=p.image)===null||S===void 0)&&S.content&&(p.image.textFitWidth||p.image.textFitHeight)?Of(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 R=p.collisionPadding;if(R&&(k.x1-=R[0]*m,k.y1-=R[1]*m,k.x2+=R[2]*m,k.y2+=R[3]*m),P){const L=new Ze(k.x1,k.y1),O=new Ze(k.x2,k.y1),$=new Ze(k.x1,k.y2),H=new Ze(k.x2,k.y2),re=P*Math.PI/180;L._rotate(re),O._rotate(re),$._rotate(re),H._rotate(re),k.x1=Math.min(L.x,O.x,$.x,H.x),k.x2=Math.max(L.x,O.x,$.x,H.x),k.y1=Math.min(L.y,O.y,$.y,H.y),k.y2=Math.max(L.y,O.y,$.y,H.y)}t.emplaceBack(n.x,n.y,k.x1,k.y1,k.x2,k.y2,a,l,d)}this.boxEndIndex=t.length}}class Sx{constructor(t=[],n=(a,l)=>a<l?-1:a>l?1:0){if(this.data=t,this.length=this.data.length,this.compare=n,this.length>0)for(let a=(this.length>>1)-1;a>=0;a--)this._down(a)}push(t){this.data.push(t),this._up(this.length++)}pop(){if(this.length===0)return;const t=this.data[0],n=this.data.pop();return--this.length>0&&(this.data[0]=n,this._down(0)),t}peek(){return this.data[0]}_up(t){const{data:n,compare:a}=this,l=n[t];for(;t>0;){const d=t-1>>1,p=n[d];if(a(l,p)>=0)break;n[t]=p,t=d}n[t]=l}_down(t){const{data:n,compare:a}=this,l=this.length>>1,d=n[t];for(;t<l;){let p=1+(t<<1);const m=p+1;if(m<this.length&&a(n[m],n[p])<0&&(p=m),a(n[p],d)>=0)break;n[t]=n[p],t=p}n[t]=d}}function Mx(r,t=1,n=!1){let a=1/0,l=1/0,d=-1/0,p=-1/0;const m=r[0];for(let R=0;R<m.length;R++){const L=m[R];(!R||L.x<a)&&(a=L.x),(!R||L.y<l)&&(l=L.y),(!R||L.x>d)&&(d=L.x),(!R||L.y>p)&&(p=L.y)}const y=Math.min(d-a,p-l);let v=y/2;const P=new Sx([],Ix);if(y===0)return new Ze(a,l);for(let R=a;R<d;R+=y)for(let L=l;L<p;L+=y)P.push(new Yo(R+v,L+v,v,r));let S=function(R){let L=0,O=0,$=0;const H=R[0];for(let re=0,X=H.length,A=X-1;re<X;A=re++){const U=H[re],J=H[A],fe=U.x*J.y-J.x*U.y;O+=(U.x+J.x)*fe,$+=(U.y+J.y)*fe,L+=3*fe}return new Yo(O/L,$/L,0,R)}(r),k=P.length;for(;P.length;){const R=P.pop();(R.d>S.d||!S.d)&&(S=R,n&&console.log("found best %d after %d probes",Math.round(1e4*R.d)/1e4,k)),R.max-S.d<=t||(v=R.h/2,P.push(new Yo(R.p.x-v,R.p.y-v,v,r)),P.push(new Yo(R.p.x+v,R.p.y-v,v,r)),P.push(new Yo(R.p.x-v,R.p.y+v,v,r)),P.push(new Yo(R.p.x+v,R.p.y+v,v,r)),k+=4)}return n&&(console.log(`num probes: ${k}`),console.log(`best distance: ${S.d}`)),S.p}function Ix(r,t){return t.max-r.max}function Yo(r,t,n,a){this.p=new Ze(r,t),this.h=n,this.d=function(l,d){let p=!1,m=1/0;for(let y=0;y<d.length;y++){const v=d[y];for(let P=0,S=v.length,k=S-1;P<S;k=P++){const R=v[P],L=v[k];R.y>l.y!=L.y>l.y&&l.x<(L.x-R.x)*(l.y-R.y)/(L.y-R.y)+R.x&&(p=!p),m=Math.min(m,qp(l,R,L))}}return(p?1:-1)*Math.sqrt(m)}(this.p,a),this.max=this.d+this.h*Math.SQRT2}var ki;M.ay=void 0,(ki=M.ay||(M.ay={}))[ki.center=1]="center",ki[ki.left=2]="left",ki[ki.right=3]="right",ki[ki.top=4]="top",ki[ki.bottom=5]="bottom",ki[ki["top-left"]=6]="top-left",ki[ki["top-right"]=7]="top-right",ki[ki["bottom-left"]=8]="bottom-left",ki[ki["bottom-right"]=9]="bottom-right";const ss=7,jd=Number.POSITIVE_INFINITY;function fm(r,t){return t[1]!==jd?function(n,a,l){let d=0,p=0;switch(a=Math.abs(a),l=Math.abs(l),n){case"top-right":case"top-left":case"top":p=l-ss;break;case"bottom-right":case"bottom-left":case"bottom":p=-l+ss}switch(n){case"top-right":case"bottom-right":case"right":d=-a;break;case"top-left":case"bottom-left":case"left":d=a}return[d,p]}(r,t[0],t[1]):function(n,a){let l=0,d=0;a<0&&(a=0);const p=a/Math.SQRT2;switch(n){case"top-right":case"top-left":d=p-ss;break;case"bottom-right":case"bottom-left":d=-p+ss;break;case"bottom":d=-a+ss;break;case"top":d=a-ss}switch(n){case"top-right":case"bottom-right":l=-p;break;case"top-left":case"bottom-left":l=p;break;case"left":l=a;break;case"right":l=-a}return[l,d]}(r,t[0])}function mm(r,t,n){var a;const l=r.layout,d=(a=l.get("text-variable-anchor-offset"))===null||a===void 0?void 0:a.evaluate(t,{},n);if(d){const m=d.values,y=[];for(let v=0;v<m.length;v+=2){const P=y[v]=m[v],S=m[v+1].map(k=>k*hi);P.startsWith("top")?S[1]-=ss:P.startsWith("bottom")&&(S[1]+=ss),y[v+1]=S}return new Li(y)}const p=l.get("text-variable-anchor");if(p){let m;m=r._unevaluatedLayout.getValue("text-radial-offset")!==void 0?[l.get("text-radial-offset").evaluate(t,{},n)*hi,jd]:l.get("text-offset").evaluate(t,{},n).map(v=>v*hi);const y=[];for(const v of p)y.push(v,fm(v,m));return new Li(y)}return null}function Nd(r){switch(r){case"right":case"top-right":case"bottom-right":return"right";case"left":case"top-left":case"bottom-left":return"left"}return"center"}function Cx(r,t,n,a,l,d,p,m,y,v,P,S){let k=d.textMaxSize.evaluate(t,{});k===void 0&&(k=p);const R=r.layers[0].layout,L=R.get("icon-offset").evaluate(t,{},P),O=_m(n.horizontal),$=p/24,H=r.tilePixelRatio*$,re=r.tilePixelRatio*k/24,X=r.tilePixelRatio*m,A=r.tilePixelRatio*R.get("symbol-spacing"),U=R.get("text-padding")*r.tilePixelRatio,J=function(Qe,Ye,He,ft=1){const Ht=Qe.get("icon-padding").evaluate(Ye,{},He),di=Ht&&Ht.values;return[di[0]*ft,di[1]*ft,di[2]*ft,di[3]*ft]}(R,t,P,r.tilePixelRatio),fe=R.get("text-max-angle")/180*Math.PI,Ce=R.get("text-rotation-alignment")!=="viewport"&&R.get("symbol-placement")!=="point",me=R.get("icon-rotation-alignment")==="map"&&R.get("symbol-placement")!=="point",xe=R.get("symbol-placement"),Re=A/2,Ee=R.get("icon-text-fit");let De;a&&Ee!=="none"&&(r.allowVerticalPlacement&&n.vertical&&(De=jf(a,n.vertical,Ee,R.get("icon-text-fit-padding"),L,$)),O&&(a=jf(a,O,Ee,R.get("icon-text-fit-padding"),L,$)));const Pe=P?S.line.getGranularityForZoomLevel(P.z):1,$e=(Qe,Ye)=>{Ye.x<0||Ye.x>=St||Ye.y<0||Ye.y>=St||function(He,ft,Ht,di,Ai,Tr,er,Ti,Ut,mi,Pi,Si,qi,Pr,gi,tr,pi,_i,yi,si,Ot,rn,Jo,nn,kx){const Qo=He.addToLineVertexArray(ft,Ht);let Hs,el,tl,il,bm=0,wm=0,Tm=0,Pm=0,Hd=-1,Kd=-1;const da={};let Sm=Qr("");if(He.allowVerticalPlacement&&di.vertical){const Bi=Ti.layout.get("text-rotate").evaluate(Ot,{},nn)+90;tl=new xh(Ut,ft,mi,Pi,Si,di.vertical,qi,Pr,gi,Bi),er&&(il=new xh(Ut,ft,mi,Pi,Si,er,pi,_i,gi,Bi))}if(Ai){const Bi=Ti.layout.get("icon-rotate").evaluate(Ot,{}),Sr=Ti.layout.get("icon-text-fit")!=="none",Ks=dm(Ai,Bi,Jo,Sr),sn=er?dm(er,Bi,Jo,Sr):void 0;el=new xh(Ut,ft,mi,Pi,Si,Ai,pi,_i,!1,Bi),bm=4*Ks.length;const Xs=He.iconSizeData;let An=null;Xs.kind==="source"?(An=[kn*Ti.layout.get("icon-size").evaluate(Ot,{})],An[0]>rs&&Ci(`${He.layerIds[0]}: Value for "icon-size" is >= ${Ec}. Reduce your "icon-size".`)):Xs.kind==="composite"&&(An=[kn*rn.compositeIconSizes[0].evaluate(Ot,{},nn),kn*rn.compositeIconSizes[1].evaluate(Ot,{},nn)],(An[0]>rs||An[1]>rs)&&Ci(`${He.layerIds[0]}: Value for "icon-size" is >= ${Ec}. Reduce your "icon-size".`)),He.addSymbols(He.icon,Ks,An,si,yi,Ot,M.ah.none,ft,Qo.lineStartIndex,Qo.lineLength,-1,nn),Hd=He.icon.placedSymbolArray.length-1,sn&&(wm=4*sn.length,He.addSymbols(He.icon,sn,An,si,yi,Ot,M.ah.vertical,ft,Qo.lineStartIndex,Qo.lineLength,-1,nn),Kd=He.icon.placedSymbolArray.length-1)}const Mm=Object.keys(di.horizontal);for(const Bi of Mm){const Sr=di.horizontal[Bi];if(!Hs){Sm=Qr(Sr.text);const sn=Ti.layout.get("text-rotate").evaluate(Ot,{},nn);Hs=new xh(Ut,ft,mi,Pi,Si,Sr,qi,Pr,gi,sn)}const Ks=Sr.positionedLines.length===1;if(Tm+=gm(He,ft,Sr,Tr,Ti,gi,Ot,tr,Qo,di.vertical?M.ah.horizontal:M.ah.horizontalOnly,Ks?Mm:[Bi],da,Hd,rn,nn),Ks)break}di.vertical&&(Pm+=gm(He,ft,di.vertical,Tr,Ti,gi,Ot,tr,Qo,M.ah.vertical,["vertical"],da,Kd,rn,nn));const Ax=Hs?Hs.boxStartIndex:He.collisionBoxArray.length,Rx=Hs?Hs.boxEndIndex:He.collisionBoxArray.length,Dx=tl?tl.boxStartIndex:He.collisionBoxArray.length,Lx=tl?tl.boxEndIndex:He.collisionBoxArray.length,Fx=el?el.boxStartIndex:He.collisionBoxArray.length,Bx=el?el.boxEndIndex:He.collisionBoxArray.length,Ox=il?il.boxStartIndex:He.collisionBoxArray.length,jx=il?il.boxEndIndex:He.collisionBoxArray.length;let an=-1;const bh=(Bi,Sr)=>Bi&&Bi.circleDiameter?Math.max(Bi.circleDiameter,Sr):Sr;an=bh(Hs,an),an=bh(tl,an),an=bh(el,an),an=bh(il,an);const Im=an>-1?1:0;Im&&(an*=kx/hi),He.glyphOffsetArray.length>=Ko.MAX_GLYPHS&&Ci("Too many glyphs being rendered in a tile. See https://github.com/mapbox/mapbox-gl-js/issues/2907"),Ot.sortKey!==void 0&&He.addToSortKeyRanges(He.symbolInstances.length,Ot.sortKey);const Nx=mm(Ti,Ot,nn),[Zx,Vx]=function(Bi,Sr){const Ks=Bi.length,sn=Sr==null?void 0:Sr.values;if((sn==null?void 0:sn.length)>0)for(let Xs=0;Xs<sn.length;Xs+=2){const An=sn[Xs+1];Bi.emplaceBack(M.ay[sn[Xs]],An[0],An[1])}return[Ks,Bi.length]}(He.textAnchorOffsets,Nx);He.symbolInstances.emplaceBack(ft.x,ft.y,da.right>=0?da.right:-1,da.center>=0?da.center:-1,da.left>=0?da.left:-1,da.vertical||-1,Hd,Kd,Sm,Ax,Rx,Dx,Lx,Fx,Bx,Ox,jx,mi,Tm,Pm,bm,wm,Im,0,qi,an,Zx,Vx)}(r,Ye,Qe,n,a,l,De,r.layers[0],r.collisionBoxArray,t.index,t.sourceLayerIndex,r.index,H,[U,U,U,U],Ce,y,X,J,me,L,t,d,v,P,p)};if(xe==="line")for(const Qe of sm(t.geometry,0,0,St,St)){const Ye=Ws(Qe,Pe),He=Px(Ye,A,fe,n.vertical||O,a,24,re,r.overscaling,St);for(const ft of He)O&&Ex(r,O.text,Re,ft)||$e(Ye,ft)}else if(xe==="line-center"){for(const Qe of t.geometry)if(Qe.length>1){const Ye=Ws(Qe,Pe),He=Tx(Ye,fe,n.vertical||O,a,24,re);He&&$e(Ye,He)}}else if(t.type==="Polygon")for(const Qe of Es(t.geometry,0)){const Ye=Mx(Qe,16);$e(Ws(Qe[0],Pe,!0),new as(Ye.x,Ye.y,0))}else if(t.type==="LineString")for(const Qe of t.geometry){const Ye=Ws(Qe,Pe);$e(Ye,new as(Ye[0].x,Ye[0].y,0))}else if(t.type==="Point")for(const Qe of t.geometry)for(const Ye of Qe)$e([Ye],new as(Ye.x,Ye.y,0))}function gm(r,t,n,a,l,d,p,m,y,v,P,S,k,R,L){const O=function(re,X,A,U,J,fe,Ce,me){const xe=U.layout.get("text-rotate").evaluate(fe,{})*Math.PI/180,Re=[];for(const Ee of X.positionedLines)for(const De of Ee.positionedGlyphs){if(!De.rect)continue;const Pe=De.rect||{};let $e=ix+1,Qe=!0,Ye=1,He=0;const ft=(J||me)&&De.vertical,Ht=De.metrics.advance*De.scale/2;if(me&&X.verticalizable&&(He=Ee.lineOffset/2-(De.imageName?-(hi-De.metrics.width*De.scale)/2:(De.scale-1)*hi)),De.imageName){const _i=Ce[De.imageName];Qe=_i.sdf,Ye=_i.pixelRatio,$e=Qi/Ye}const di=J?[De.x+Ht,De.y]:[0,0];let Ai=J?[0,0]:[De.x+Ht+A[0],De.y+A[1]-He],Tr=[0,0];ft&&(Tr=Ai,Ai=[0,0]);const er=De.metrics.isDoubleResolution?2:1,Ti=(De.metrics.left-$e)*De.scale-Ht+Ai[0],Ut=(-De.metrics.top-$e)*De.scale+Ai[1],mi=Ti+Pe.w/er*De.scale/Ye,Pi=Ut+Pe.h/er*De.scale/Ye,Si=new Ze(Ti,Ut),qi=new Ze(mi,Ut),Pr=new Ze(Ti,Pi),gi=new Ze(mi,Pi);if(ft){const _i=new Ze(-Ht,Ht-hh),yi=-Math.PI/2,si=hi/2-Ht,Ot=new Ze(5-hh-si,-(De.imageName?si:0)),rn=new Ze(...Tr);Si._rotateAround(yi,_i)._add(Ot)._add(rn),qi._rotateAround(yi,_i)._add(Ot)._add(rn),Pr._rotateAround(yi,_i)._add(Ot)._add(rn),gi._rotateAround(yi,_i)._add(Ot)._add(rn)}if(xe){const _i=Math.sin(xe),yi=Math.cos(xe),si=[yi,-_i,_i,yi];Si._matMult(si),qi._matMult(si),Pr._matMult(si),gi._matMult(si)}const tr=new Ze(0,0),pi=new Ze(0,0);Re.push({tl:Si,tr:qi,bl:Pr,br:gi,tex:Pe,writingMode:X.writingMode,glyphOffset:di,sectionIndex:De.sectionIndex,isSDF:Qe,pixelOffsetTL:tr,pixelOffsetBR:pi,minFontScaleX:0,minFontScaleY:0})}return Re}(0,n,m,l,d,p,a,r.allowVerticalPlacement),$=r.textSizeData;let H=null;$.kind==="source"?(H=[kn*l.layout.get("text-size").evaluate(p,{})],H[0]>rs&&Ci(`${r.layerIds[0]}: Value for "text-size" is >= ${Ec}. Reduce your "text-size".`)):$.kind==="composite"&&(H=[kn*R.compositeTextSizes[0].evaluate(p,{},L),kn*R.compositeTextSizes[1].evaluate(p,{},L)],(H[0]>rs||H[1]>rs)&&Ci(`${r.layerIds[0]}: Value for "text-size" is >= ${Ec}. Reduce your "text-size".`)),r.addSymbols(r.text,O,H,m,d,p,v,t,y.lineStartIndex,y.lineLength,k,L);for(const re of P)S[re]=r.text.placedSymbolArray.length-1;return 4*O.length}function _m(r){for(const t in r)return r[t];return null}function Ex(r,t,n,a){const l=r.compareText;if(t in l){const d=l[t];for(let p=d.length-1;p>=0;p--)if(a.dist(d[p])<n)return!0}else l[t]=[];return l[t].push(a),!1}const ym=[Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];class Zd{static from(t){if(!(t instanceof ArrayBuffer))throw new Error("Data must be an instance of ArrayBuffer.");const[n,a]=new Uint8Array(t,0,2);if(n!==219)throw new Error("Data does not appear to be in a KDBush format.");const l=a>>4;if(l!==1)throw new Error(`Got v${l} data when expected v1.`);const d=ym[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 Zd(m,p,d,t)}constructor(t,n=64,a=Float64Array,l){if(isNaN(t)||t<0)throw new Error(`Unpexpected numItems value: ${t}.`);this.numItems=+t,this.nodeSize=Math.min(Math.max(+n,2),65535),this.ArrayType=a,this.IndexArrayType=t<65536?Uint16Array:Uint32Array;const d=ym.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}.`);l&&l instanceof ArrayBuffer?(this.data=l,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]=n,new Uint32Array(this.data,4,1)[0]=t)}add(t,n){const a=this._pos>>1;return this.ids[a]=a,this.coords[this._pos++]=t,this.coords[this._pos++]=n,a}finish(){const t=this._pos>>1;if(t!==this.numItems)throw new Error(`Added ${t} items when expected ${this.numItems}.`);return Vd(this.ids,this.coords,this.nodeSize,0,this.numItems-1,0),this._finished=!0,this}range(t,n,a,l){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],v=[];for(;y.length;){const P=y.pop()||0,S=y.pop()||0,k=y.pop()||0;if(S-k<=m){for(let $=k;$<=S;$++){const H=p[2*$],re=p[2*$+1];H>=t&&H<=a&&re>=n&&re<=l&&v.push(d[$])}continue}const R=k+S>>1,L=p[2*R],O=p[2*R+1];L>=t&&L<=a&&O>=n&&O<=l&&v.push(d[R]),(P===0?t<=L:n<=O)&&(y.push(k),y.push(R-1),y.push(1-P)),(P===0?a>=L:l>=O)&&(y.push(R+1),y.push(S),y.push(1-P))}return v}within(t,n,a){if(!this._finished)throw new Error("Data not yet indexed - call index.finish().");const{ids:l,coords:d,nodeSize:p}=this,m=[0,l.length-1,0],y=[],v=a*a;for(;m.length;){const P=m.pop()||0,S=m.pop()||0,k=m.pop()||0;if(S-k<=p){for(let $=k;$<=S;$++)vm(d[2*$],d[2*$+1],t,n)<=v&&y.push(l[$]);continue}const R=k+S>>1,L=d[2*R],O=d[2*R+1];vm(L,O,t,n)<=v&&y.push(l[R]),(P===0?t-a<=L:n-a<=O)&&(m.push(k),m.push(R-1),m.push(1-P)),(P===0?t+a>=L:n+a>=O)&&(m.push(R+1),m.push(S),m.push(1-P))}return y}}function Vd(r,t,n,a,l,d){if(l-a<=n)return;const p=a+l>>1;xm(r,t,p,a,l,d),Vd(r,t,n,a,p-1,1-d),Vd(r,t,n,p+1,l,1-d)}function xm(r,t,n,a,l,d){for(;l>a;){if(l-a>600){const v=l-a+1,P=n-a+1,S=Math.log(v),k=.5*Math.exp(2*S/3),R=.5*Math.sqrt(S*k*(v-k)/v)*(P-v/2<0?-1:1);xm(r,t,n,Math.max(a,Math.floor(n-P*k/v+R)),Math.min(l,Math.floor(n+(v-P)*k/v+R)),d)}const p=t[2*n+d];let m=a,y=l;for(Ac(r,t,a,n),t[2*l+d]>p&&Ac(r,t,a,l);m<y;){for(Ac(r,t,m,y),m++,y--;t[2*m+d]<p;)m++;for(;t[2*y+d]>p;)y--}t[2*a+d]===p?Ac(r,t,a,y):(y++,Ac(r,t,y,l)),y<=n&&(a=y+1),n<=y&&(l=y-1)}}function Ac(r,t,n,a){Ud(r,n,a),Ud(t,2*n,2*a),Ud(t,2*n+1,2*a+1)}function Ud(r,t,n){const a=r[t];r[t]=r[n],r[n]=a}function vm(r,t,n,a){const l=r-n,d=t-a;return l*l+d*d}var $d;M.ck=void 0,($d=M.ck||(M.ck={})).create="create",$d.load="load",$d.fullLoad="fullLoad";let vh=null,Rc=[];const Gd=1e3/60,qd="loadTime",Wd="fullLoadTime",zx={mark(r){performance.mark(r)},frame(r){const t=r;vh!=null&&Rc.push(t-vh),vh=t},clearMetrics(){vh=null,Rc=[],performance.clearMeasures(qd),performance.clearMeasures(Wd);for(const r in M.ck)performance.clearMarks(M.ck[r])},getPerformanceMetrics(){performance.measure(qd,M.ck.create,M.ck.load),performance.measure(Wd,M.ck.create,M.ck.fullLoad);const r=performance.getEntriesByName(qd)[0].duration,t=performance.getEntriesByName(Wd)[0].duration,n=Rc.length,a=1/(Rc.reduce((d,p)=>d+p,0)/n/1e3),l=Rc.filter(d=>d>Gd).reduce((d,p)=>d+(p-Gd)/Gd,0);return{loadTime:r,fullLoadTime:t,fps:a,percentDroppedFrames:l/(n+l)*100,totalFrames:n}}};M.$=zc,M.A=kt,M.B=xr,M.C=Ft,M.D=Xe,M.E=V,M.F=ed,M.G=function(r){if(Yt==null){const t=r.navigator?r.navigator.userAgent:null;Yt=!!r.safari||!(!t||!(/\b(iPad|iPhone|iPod)\b/.test(t)||t.match("Safari")&&!t.match("Chrome")))}return Yt},M.H=class{constructor(r,t){this.target=r,this.mapId=t,this.resolveRejects={},this.tasks={},this.taskQueue=[],this.abortControllers={},this.messageHandlers={},this.invoker=new vx(()=>this.process()),this.subscription=mr(this.target,"message",n=>this.receive(n),!1),this.globalScope=$r(self)?r:window}registerMessageHandler(r,t){this.messageHandlers[r]=t}sendAsync(r,t){return new Promise((n,a)=>{const l=Math.round(1e18*Math.random()).toString(36).substring(0,10),d=t?mr(t.signal,"abort",()=>{d==null||d.unsubscribe(),delete this.resolveRejects[l];const y={id:l,type:"<cancel>",origin:location.origin,targetMapId:r.targetMapId,sourceMapId:this.mapId};this.target.postMessage(y)},bx):null;this.resolveRejects[l]={resolve:y=>{d==null||d.unsubscribe(),n(y)},reject:y=>{d==null||d.unsubscribe(),a(y)}};const p=[],m=Object.assign(Object.assign({},r),{id:l,sourceMapId:this.mapId,origin:location.origin,data:na(r.data,p)});this.target.postMessage(m,{transfer:p})})}receive(r){const t=r.data,n=t.id;if(!(t.origin!=="file://"&&location.origin!=="file://"&&t.origin!=="resource://android"&&location.origin!=="resource://android"&&t.origin!==location.origin||t.targetMapId&&this.mapId!==t.targetMapId)){if(t.type==="<cancel>"){delete this.tasks[n];const a=this.abortControllers[n];return delete this.abortControllers[n],void(a&&a.abort())}if($r(self)||t.mustQueue)return this.tasks[n]=t,this.taskQueue.push(n),void this.invoker.trigger();this.processTask(n,t)}}process(){if(this.taskQueue.length===0)return;const r=this.taskQueue.shift(),t=this.tasks[r];delete this.tasks[r],this.taskQueue.length>0&&this.invoker.trigger(),t&&this.processTask(r,t)}processTask(r,t){return c(this,void 0,void 0,function*(){if(t.type==="<response>"){const l=this.resolveRejects[r];return delete this.resolveRejects[r],l?void(t.error?l.reject(Pn(t.error)):l.resolve(Pn(t.data))):void 0}if(!this.messageHandlers[t.type])return void this.completeTask(r,new Error(`Could not find a registered handler for ${t.type}, map ID: ${this.mapId}, available handlers: ${Object.keys(this.messageHandlers).join(", ")}`));const n=Pn(t.data),a=new AbortController;this.abortControllers[r]=a;try{const l=yield this.messageHandlers[t.type](t.sourceMapId,n,a);this.completeTask(r,null,l)}catch(l){this.completeTask(r,l)}})}completeTask(r,t,n){const a=[];delete this.abortControllers[r];const l={id:r,type:"<response>",sourceMapId:this.mapId,origin:location.origin,error:t?na(t):null,data:na(n,a)};this.target.postMessage(l,{transfer:a})}remove(){this.invoker.remove(),this.subscription.unsubscribe()}},M.I=Cd,M.J=Gr,M.K=function(){var r=new kt(16);return kt!=Float32Array&&(r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=0,r[12]=0,r[13]=0,r[14]=0),r[0]=1,r[5]=1,r[10]=1,r[15]=1,r},M.L=function(r,t,n){var a,l,d,p,m,y,v,P,S,k,R,L,O=n[0],$=n[1],H=n[2];return t===r?(r[12]=t[0]*O+t[4]*$+t[8]*H+t[12],r[13]=t[1]*O+t[5]*$+t[9]*H+t[13],r[14]=t[2]*O+t[6]*$+t[10]*H+t[14],r[15]=t[3]*O+t[7]*$+t[11]*H+t[15]):(l=t[1],d=t[2],p=t[3],m=t[4],y=t[5],v=t[6],P=t[7],S=t[8],k=t[9],R=t[10],L=t[11],r[0]=a=t[0],r[1]=l,r[2]=d,r[3]=p,r[4]=m,r[5]=y,r[6]=v,r[7]=P,r[8]=S,r[9]=k,r[10]=R,r[11]=L,r[12]=a*O+m*$+S*H+t[12],r[13]=l*O+y*$+k*H+t[13],r[14]=d*O+v*$+R*H+t[14],r[15]=p*O+P*$+L*H+t[15]),r},M.M=function(r,t,n){var a=n[0],l=n[1],d=n[2];return r[0]=t[0]*a,r[1]=t[1]*a,r[2]=t[2]*a,r[3]=t[3]*a,r[4]=t[4]*l,r[5]=t[5]*l,r[6]=t[6]*l,r[7]=t[7]*l,r[8]=t[8]*d,r[9]=t[9]*d,r[10]=t[10]*d,r[11]=t[11]*d,r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},M.N=function(r,t,n){var a=t[0],l=t[1],d=t[2],p=t[3],m=t[4],y=t[5],v=t[6],P=t[7],S=t[8],k=t[9],R=t[10],L=t[11],O=t[12],$=t[13],H=t[14],re=t[15],X=n[0],A=n[1],U=n[2],J=n[3];return r[0]=X*a+A*m+U*S+J*O,r[1]=X*l+A*y+U*k+J*$,r[2]=X*d+A*v+U*R+J*H,r[3]=X*p+A*P+U*L+J*re,r[4]=(X=n[4])*a+(A=n[5])*m+(U=n[6])*S+(J=n[7])*O,r[5]=X*l+A*y+U*k+J*$,r[6]=X*d+A*v+U*R+J*H,r[7]=X*p+A*P+U*L+J*re,r[8]=(X=n[8])*a+(A=n[9])*m+(U=n[10])*S+(J=n[11])*O,r[9]=X*l+A*y+U*k+J*$,r[10]=X*d+A*v+U*R+J*H,r[11]=X*p+A*P+U*L+J*re,r[12]=(X=n[12])*a+(A=n[13])*m+(U=n[14])*S+(J=n[15])*O,r[13]=X*l+A*y+U*k+J*$,r[14]=X*d+A*v+U*R+J*H,r[15]=X*p+A*P+U*L+J*re,r},M.O=function(r,t){const n={};for(let a=0;a<t.length;a++){const l=t[a];l in r&&(n[l]=r[l])}return n},M.P=Ze,M.Q=ns,M.R=br,M.S=Kf,M.T=js,M.U=Hf,M.V=Ri,M.W=ri,M.X=fr,M.Y=wr,M.Z=St,M._=c,M.a=yn,M.a$=function(r,t,n){var a=Math.sin(n),l=Math.cos(n),d=t[4],p=t[5],m=t[6],y=t[7],v=t[8],P=t[9],S=t[10],k=t[11];return t!==r&&(r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[4]=d*l+v*a,r[5]=p*l+P*a,r[6]=m*l+S*a,r[7]=y*l+k*a,r[8]=v*l-d*a,r[9]=P*l-p*a,r[10]=S*l-m*a,r[11]=k*l-y*a,r},M.a0=25,M.a1=Od,M.a2=r=>{const t=window.document.createElement("video");return t.muted=!0,new Promise(n=>{t.onloadstart=()=>{n(t)};for(const a of r){const l=window.document.createElement("source");ys(a)||(t.crossOrigin="Anonymous"),l.src=a,t.appendChild(l)}})},M.a3=ye,M.a4=function(){return Zn++},M.a5=x,M.a6=Ko,M.a7=ql,M.a8=zn,M.a9=im,M.aA=Nd,M.aB=zd,M.aC=Zd,M.aD=Qt,M.aE=lh,M.aF=Q,M.aG=ut,M.aH=Me,M.aI=function(r){return Math.pow(2,r)},M.aJ=85.051129,M.aK=Xf,M.aL=nr,M.aM=gr,M.aN=Yf,M.aO=function(r,t,n){return r[0]=t[0]*n,r[1]=t[1]*n,r[2]=t[2]*n,r},M.aP=function(r,t,n){return r[0]=t[0]+n[0],r[1]=t[1]+n[1],r[2]=t[2]+n[2],r},M.aQ=function(r){var t=new kt(3);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t},M.aR=function(r,t,n){return r[0]=t[0]*n[0],r[1]=t[1]*n[1],r[2]=t[2]*n[2],r[3]=t[3]*n[3],r},M.aS=function(r,t,n){return r[0]=t[0]-n[0],r[1]=t[1]-n[1],r[2]=t[2]-n[2],r},M.aT=function(r,t){var n=t[0],a=t[1],l=t[2],d=n*n+a*a+l*l;return d>0&&(d=1/Math.sqrt(d)),r[0]=t[0]*d,r[1]=t[1]*d,r[2]=t[2]*d,r},M.aU=function(r,t,n){var a=t[0],l=t[1],d=t[2],p=n[0],m=n[1],y=n[2];return r[0]=l*y-d*m,r[1]=d*p-a*y,r[2]=a*m-l*p,r},M.aV=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]},M.aW=Qf,M.aX=Xo,M.aY=function(r,t,n,a,l){var d,p=1/Math.tan(t/2);return r[0]=p/n,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=p,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[11]=-1,r[12]=0,r[13]=0,r[15]=0,l!=null&&l!==1/0?(r[10]=(l+a)*(d=1/(a-l)),r[14]=2*l*a*d):(r[10]=-1,r[14]=-2*a),r},M.aZ=function(r){var t=new kt(16);return t[0]=r[0],t[1]=r[1],t[2]=r[2],t[3]=r[3],t[4]=r[4],t[5]=r[5],t[6]=r[6],t[7]=r[7],t[8]=r[8],t[9]=r[9],t[10]=r[10],t[11]=r[11],t[12]=r[12],t[13]=r[13],t[14]=r[14],t[15]=r[15],t},M.a_=function(r,t,n){var a=Math.sin(n),l=Math.cos(n),d=t[0],p=t[1],m=t[2],y=t[3],v=t[4],P=t[5],S=t[6],k=t[7];return t!==r&&(r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=d*l+v*a,r[1]=p*l+P*a,r[2]=m*l+S*a,r[3]=y*l+k*a,r[4]=v*l-d*a,r[5]=P*l-p*a,r[6]=S*l-m*a,r[7]=k*l-y*a,r},M.aa=function(r){const t={};if(r.replace(/(?:^|(?:\s*\,\s*))([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)(?:\=(?:([^\x00-\x20\(\)<>@\,;\:\\"\/\[\]\?\=\{\}\x7F]+)|(?:\"((?:[^"\\]|\\.)*)\")))?/g,(n,a,l,d)=>{const p=l||d;return t[a]=!p||p.toLowerCase(),""}),t["max-age"]){const n=parseInt(t["max-age"],10);isNaN(n)?delete t["max-age"]:t["max-age"]=n}return t},M.ab=function(r){return Math.log(r)/Math.LN2},M.ac=function(r){var t=r[0],n=r[1];return t*t+n*n},M.ad=function(r){return r*Math.PI/180},M.ae=pr,M.af=function(r,t){const n=[];for(const a in r)a in t||n.push(a);return n},M.ag=function(r,t){let n=0,a=0;if(r.kind==="constant")a=r.layoutSize;else if(r.kind!=="source"){const{interpolationType:l,minZoom:d,maxZoom:p}=r,m=l?pr(Ei.interpolationFactor(l,t,d,p),0,1):0;r.kind==="camera"?a=xr.number(r.minSize,r.maxSize,m):n=m}return{uSizeT:n,uSize:a}},M.ai=function(r,{uSize:t,uSizeT:n},{lowerSize:a,upperSize:l}){return r.kind==="source"?a/kn:r.kind==="composite"?xr.number(a/kn,l/kn,n):t},M.aj=function(r,t){var n=t[0],a=t[1],l=t[2],d=t[3],p=t[4],m=t[5],y=t[6],v=t[7],P=t[8],S=t[9],k=t[10],R=t[11],L=t[12],O=t[13],$=t[14],H=t[15],re=n*m-a*p,X=n*y-l*p,A=n*v-d*p,U=a*y-l*m,J=a*v-d*m,fe=l*v-d*y,Ce=P*O-S*L,me=P*$-k*L,xe=P*H-R*L,Re=S*$-k*O,Ee=S*H-R*O,De=k*H-R*$,Pe=re*De-X*Ee+A*Re+U*xe-J*me+fe*Ce;return Pe?(r[0]=(m*De-y*Ee+v*Re)*(Pe=1/Pe),r[1]=(l*Ee-a*De-d*Re)*Pe,r[2]=(O*fe-$*J+H*U)*Pe,r[3]=(k*J-S*fe-R*U)*Pe,r[4]=(y*xe-p*De-v*me)*Pe,r[5]=(n*De-l*xe+d*me)*Pe,r[6]=($*A-L*fe-H*X)*Pe,r[7]=(P*fe-k*A+R*X)*Pe,r[8]=(p*Ee-m*xe+v*Ce)*Pe,r[9]=(a*xe-n*Ee-d*Ce)*Pe,r[10]=(L*J-O*A+H*re)*Pe,r[11]=(S*A-P*J-R*re)*Pe,r[12]=(m*me-p*Re-y*Ce)*Pe,r[13]=(n*Re-a*me+l*Ce)*Pe,r[14]=(O*X-L*U-$*re)*Pe,r[15]=(P*U-S*X+k*re)*Pe,r):null},M.ak=Ii,M.al=function(r){return Math.hypot(r[0],r[1])},M.am=function(r){return r[0]=0,r[1]=0,r},M.an=function(r,t,n){return r[0]=t[0]*n,r[1]=t[1]*n,r},M.ao=Ad,M.ap=Ur,M.aq=function(r,t,n,a){const l=t.y-r.y,d=t.x-r.x,p=a.y-n.y,m=a.x-n.x,y=p*d-m*l;if(y===0)return null;const v=(m*(r.y-n.y)-p*(r.x-n.x))/y;return new Ze(r.x+v*d,r.y+v*l)},M.ar=sm,M.as=$o,M.at=Vr,M.au=function(r){let t=1/0,n=1/0,a=-1/0,l=-1/0;for(const d of r)t=Math.min(t,d.x),n=Math.min(n,d.y),a=Math.max(a,d.x),l=Math.max(l,d.y);return[t,n,a,l]},M.av=hi,M.aw=wa,M.ax=function(r,t,n,a,l=!1){if(!n[0]&&!n[1])return[0,0];const d=l?a==="map"?-r.bearingInRadians:0:a==="viewport"?r.bearingInRadians:0;if(d){const p=Math.sin(d),m=Math.cos(d);n=[n[0]*m-n[1]*p,n[0]*p+n[1]*m]}return[l?n[0]:wa(t,n[0],r.zoom),l?n[1]:wa(t,n[1],r.zoom)]},M.az=kd,M.b=$n,M.b$=r=>r.type==="symbol",M.b0=function(){const r=new Float32Array(16);return Vr(r),r},M.b1=function(){const r=new Float64Array(16);return Vr(r),r},M.b2=function(){return new Float64Array(16)},M.b3=function(r,t,n){const a=new Float64Array(4);return function(l,d,p,m){var y=.5*Math.PI/180;d*=y,p*=y,m*=y;var v=Math.sin(d),P=Math.cos(d),S=Math.sin(p),k=Math.cos(p),R=Math.sin(m),L=Math.cos(m);l[0]=v*k*L-P*S*R,l[1]=P*S*L+v*k*R,l[2]=P*k*R-v*S*L,l[3]=P*k*L+v*S*R}(a,r,t-90,n),a},M.b4=function(r,t,n,a){var l,d,p,m,y,v=t[0],P=t[1],S=t[2],k=t[3],R=n[0],L=n[1],O=n[2],$=n[3];return(d=v*R+P*L+S*O+k*$)<0&&(d=-d,R=-R,L=-L,O=-O,$=-$),1-d>Rt?(l=Math.acos(d),p=Math.sin(l),m=Math.sin((1-a)*l)/p,y=Math.sin(a*l)/p):(m=1-a,y=a),r[0]=m*v+y*R,r[1]=m*P+y*L,r[2]=m*S+y*O,r[3]=m*k+y*$,r},M.b5=function(r){const t=new Float64Array(9);var n,a,l,d,p,m,y,v,P,S,k,R,L,O,$,H,re,X;S=(l=(a=r)[0])*(y=l+l),k=(d=a[1])*y,L=(p=a[2])*y,O=p*(v=d+d),H=(m=a[3])*y,re=m*v,X=m*(P=p+p),(n=t)[0]=1-(R=d*v)-($=p*P),n[3]=k-X,n[6]=L+re,n[1]=k+X,n[4]=1-S-$,n[7]=O-H,n[2]=L-re,n[5]=O+H,n[8]=1-S-R;const A=gr(-Math.asin(pr(t[2],-1,1)));let U,J;return Math.hypot(t[5],t[8])<.001?(U=0,J=-gr(Math.atan2(t[3],t[4]))):(U=gr(t[5]===0&&t[8]===0?0:Math.atan2(t[5],t[8])),J=gr(t[1]===0&&t[0]===0?0:Math.atan2(t[1],t[0]))),{roll:U,pitch:A+90,bearing:J}},M.b6=function(r,t){return r.roll==t.roll&&r.pitch==t.pitch&&r.bearing==t.bearing},M.b7=yt,M.b8=en,M.b9=Wo,M.bA=function(r,t){if(!r)return[{command:"setStyle",args:[t]}];let n=[];try{if(!ne(r.version,t.version))return[{command:"setStyle",args:[t]}];ne(r.center,t.center)||n.push({command:"setCenter",args:[t.center]}),ne(r.centerAltitude,t.centerAltitude)||n.push({command:"setCenterAltitude",args:[t.centerAltitude]}),ne(r.zoom,t.zoom)||n.push({command:"setZoom",args:[t.zoom]}),ne(r.bearing,t.bearing)||n.push({command:"setBearing",args:[t.bearing]}),ne(r.pitch,t.pitch)||n.push({command:"setPitch",args:[t.pitch]}),ne(r.roll,t.roll)||n.push({command:"setRoll",args:[t.roll]}),ne(r.sprite,t.sprite)||n.push({command:"setSprite",args:[t.sprite]}),ne(r.glyphs,t.glyphs)||n.push({command:"setGlyphs",args:[t.glyphs]}),ne(r.transition,t.transition)||n.push({command:"setTransition",args:[t.transition]}),ne(r.light,t.light)||n.push({command:"setLight",args:[t.light]}),ne(r.terrain,t.terrain)||n.push({command:"setTerrain",args:[t.terrain]}),ne(r.sky,t.sky)||n.push({command:"setSky",args:[t.sky]}),ne(r.projection,t.projection)||n.push({command:"setProjection",args:[t.projection]});const a={},l=[];(function(p,m,y,v){let P;for(P in m=m||{},p=p||{})Object.prototype.hasOwnProperty.call(p,P)&&(Object.prototype.hasOwnProperty.call(m,P)||be(P,y,v));for(P in m)Object.prototype.hasOwnProperty.call(m,P)&&(Object.prototype.hasOwnProperty.call(p,P)?ne(p[P],m[P])||(p[P].type==="geojson"&&m[P].type==="geojson"&&ue(p,m,P)?he(y,{command:"setGeoJSONSourceData",args:[P,m[P].data]}):_e(P,m,y,v)):oe(P,m,y))})(r.sources,t.sources,l,a);const d=[];r.layers&&r.layers.forEach(p=>{"source"in p&&a[p.source]?n.push({command:"removeLayer",args:[p.id]}):d.push(p)}),n=n.concat(l),function(p,m,y){m=m||[];const v=(p=p||[]).map(je),P=m.map(je),S=p.reduce(Ne,{}),k=m.reduce(Ne,{}),R=v.slice(),L=Object.create(null);let O,$,H,re,X;for(let A=0,U=0;A<v.length;A++)O=v[A],Object.prototype.hasOwnProperty.call(k,O)?U++:(he(y,{command:"removeLayer",args:[O]}),R.splice(R.indexOf(O,U),1));for(let A=0,U=0;A<P.length;A++)O=P[P.length-1-A],R[R.length-1-A]!==O&&(Object.prototype.hasOwnProperty.call(S,O)?(he(y,{command:"removeLayer",args:[O]}),R.splice(R.lastIndexOf(O,R.length-U),1)):U++,re=R[R.length-A],he(y,{command:"addLayer",args:[k[O],re]}),R.splice(R.length-A,0,O),L[O]=!0);for(let A=0;A<P.length;A++)if(O=P[A],$=S[O],H=k[O],!L[O]&&!ne($,H))if(ne($.source,H.source)&&ne($["source-layer"],H["source-layer"])&&ne($.type,H.type)){for(X in Ie($.layout,H.layout,y,O,null,"setLayoutProperty"),Ie($.paint,H.paint,y,O,null,"setPaintProperty"),ne($.filter,H.filter)||he(y,{command:"setFilter",args:[O,H.filter]}),ne($.minzoom,H.minzoom)&&ne($.maxzoom,H.maxzoom)||he(y,{command:"setLayerZoomRange",args:[O,H.minzoom,H.maxzoom]}),$)Object.prototype.hasOwnProperty.call($,X)&&X!=="layout"&&X!=="paint"&&X!=="filter"&&X!=="metadata"&&X!=="minzoom"&&X!=="maxzoom"&&(X.indexOf("paint.")===0?Ie($[X],H[X],y,O,X.slice(6),"setPaintProperty"):ne($[X],H[X])||he(y,{command:"setLayerProperty",args:[O,X,H[X]]}));for(X in H)Object.prototype.hasOwnProperty.call(H,X)&&!Object.prototype.hasOwnProperty.call($,X)&&X!=="layout"&&X!=="paint"&&X!=="filter"&&X!=="metadata"&&X!=="minzoom"&&X!=="maxzoom"&&(X.indexOf("paint.")===0?Ie($[X],H[X],y,O,X.slice(6),"setPaintProperty"):ne($[X],H[X])||he(y,{command:"setLayerProperty",args:[O,X,H[X]]}))}else he(y,{command:"removeLayer",args:[O]}),re=R[R.lastIndexOf(O)+1],he(y,{command:"addLayer",args:[H,re]})}(d,t.layers,n)}catch(a){console.warn("Unable to compute style diff:",a),n=[{command:"setStyle",args:[t]}]}return n},M.bB=function(r){const t=[],n=r.id;return n===void 0&&t.push({message:`layers.${n}: missing required property "id"`}),r.render===void 0&&t.push({message:`layers.${n}: missing required method "render"`}),r.renderingMode&&r.renderingMode!=="2d"&&r.renderingMode!=="3d"&&t.push({message:`layers.${n}: property "renderingMode" must be either "2d" or "3d"`}),t},M.bC=function r(t,n){if(Array.isArray(t)){if(!Array.isArray(n)||t.length!==n.length)return!1;for(let a=0;a<t.length;a++)if(!r(t[a],n[a]))return!1;return!0}if(typeof t=="object"&&t!==null&&n!==null){if(typeof n!="object"||Object.keys(t).length!==Object.keys(n).length)return!1;for(const a in t)if(!r(t[a],n[a]))return!1;return!0}return t===n},M.bD=Vn,M.bE=Un,M.bF=class extends Br{constructor(r,t){super(r,t),this.current=0}set(r){this.current!==r&&(this.current=r,this.gl.uniform1i(this.location,r))}},M.bG=tn,M.bH=class extends Br{constructor(r,t){super(r,t),this.current=ca}set(r){if(r[12]!==this.current[12]||r[0]!==this.current[0])return this.current=r,void this.gl.uniformMatrix4fv(this.location,!1,r);for(let t=1;t<16;t++)if(r[t]!==this.current[t]){this.current=r,this.gl.uniformMatrix4fv(this.location,!1,r);break}}},M.bI=Ji,M.bJ=class extends Br{constructor(r,t){super(r,t),this.current=[0,0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]&&r[2]===this.current[2]||(this.current=r,this.gl.uniform3f(this.location,r[0],r[1],r[2]))}},M.bK=class extends Br{constructor(r,t){super(r,t),this.current=[0,0]}set(r){r[0]===this.current[0]&&r[1]===this.current[1]||(this.current=r,this.gl.uniform2f(this.location,r[0],r[1]))}},M.bL=Zt,M.bM=function(r,t){var n=Math.sin(t),a=Math.cos(t);return r[0]=a,r[1]=n,r[2]=0,r[3]=-n,r[4]=a,r[5]=0,r[6]=0,r[7]=0,r[8]=1,r},M.bN=function(r,t,n){var a=t[0],l=t[1],d=t[2];return r[0]=a*n[0]+l*n[3]+d*n[6],r[1]=a*n[1]+l*n[4]+d*n[7],r[2]=a*n[2]+l*n[5]+d*n[8],r},M.bO=function(r,t,n,a,l,d,p){var m=1/(t-n),y=1/(a-l),v=1/(d-p);return r[0]=-2*m,r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=-2*y,r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=2*v,r[11]=0,r[12]=(t+n)*m,r[13]=(l+a)*y,r[14]=(p+d)*v,r[15]=1,r},M.bP=class extends uc{},M.bQ=Xy,M.bR=class extends $s{},M.bS=dd,M.bT=function(r){return r<=1?1:Math.pow(2,Math.ceil(Math.log(r)/Math.LN2))},M.bU=ef,M.bV=function(r,t,n){var a=t[0],l=t[1],d=t[2],p=n[3]*a+n[7]*l+n[11]*d+n[15];return r[0]=(n[0]*a+n[4]*l+n[8]*d+n[12])/(p=p||1),r[1]=(n[1]*a+n[5]*l+n[9]*d+n[13])/p,r[2]=(n[2]*a+n[6]*l+n[10]*d+n[14])/p,r},M.bW=class extends No{},M.bX=class extends h{},M.bY=function(r,t){return r[0]===t[0]&&r[1]===t[1]&&r[2]===t[2]&&r[3]===t[3]&&r[4]===t[4]&&r[5]===t[5]&&r[6]===t[6]&&r[7]===t[7]&&r[8]===t[8]&&r[9]===t[9]&&r[10]===t[10]&&r[11]===t[11]&&r[12]===t[12]&&r[13]===t[13]&&r[14]===t[14]&&r[15]===t[15]},M.bZ=function(r,t){var n=r[0],a=r[1],l=r[2],d=r[3],p=r[4],m=r[5],y=r[6],v=r[7],P=r[8],S=r[9],k=r[10],R=r[11],L=r[12],O=r[13],$=r[14],H=r[15],re=t[0],X=t[1],A=t[2],U=t[3],J=t[4],fe=t[5],Ce=t[6],me=t[7],xe=t[8],Re=t[9],Ee=t[10],De=t[11],Pe=t[12],$e=t[13],Qe=t[14],Ye=t[15];return Math.abs(n-re)<=Rt*Math.max(1,Math.abs(n),Math.abs(re))&&Math.abs(a-X)<=Rt*Math.max(1,Math.abs(a),Math.abs(X))&&Math.abs(l-A)<=Rt*Math.max(1,Math.abs(l),Math.abs(A))&&Math.abs(d-U)<=Rt*Math.max(1,Math.abs(d),Math.abs(U))&&Math.abs(p-J)<=Rt*Math.max(1,Math.abs(p),Math.abs(J))&&Math.abs(m-fe)<=Rt*Math.max(1,Math.abs(m),Math.abs(fe))&&Math.abs(y-Ce)<=Rt*Math.max(1,Math.abs(y),Math.abs(Ce))&&Math.abs(v-me)<=Rt*Math.max(1,Math.abs(v),Math.abs(me))&&Math.abs(P-xe)<=Rt*Math.max(1,Math.abs(P),Math.abs(xe))&&Math.abs(S-Re)<=Rt*Math.max(1,Math.abs(S),Math.abs(Re))&&Math.abs(k-Ee)<=Rt*Math.max(1,Math.abs(k),Math.abs(Ee))&&Math.abs(R-De)<=Rt*Math.max(1,Math.abs(R),Math.abs(De))&&Math.abs(L-Pe)<=Rt*Math.max(1,Math.abs(L),Math.abs(Pe))&&Math.abs(O-$e)<=Rt*Math.max(1,Math.abs(O),Math.abs($e))&&Math.abs($-Qe)<=Rt*Math.max(1,Math.abs($),Math.abs(Qe))&&Math.abs(H-Ye)<=Rt*Math.max(1,Math.abs(H),Math.abs(Ye))},M.b_=function(r,t){return r[0]=t[0],r[1]=t[1],r[2]=t[2],r[3]=t[3],r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[8]=t[8],r[9]=t[9],r[10]=t[10],r[11]=t[11],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15],r},M.ba=wc,M.bb=qo,M.bc=jn,M.bd=Nn,M.be=ci,M.bf=function(r,t,n,a,l){return jn(a,l,pr((r-t)/(n-t),0,1))},M.bg=mn,M.bh=function(){return new Float64Array(4)},M.bi=function(){return new Float64Array(3)},M.bj=function(r,t,n,a){var l=[],d=[];return l[0]=t[0]-n[0],l[1]=t[1]-n[1],l[2]=t[2]-n[2],d[0]=l[0]*Math.cos(a)-l[1]*Math.sin(a),d[1]=l[0]*Math.sin(a)+l[1]*Math.cos(a),d[2]=l[2],r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},M.bk=function(r,t,n,a){var l=[],d=[];return l[0]=t[0]-n[0],l[1]=t[1]-n[1],l[2]=t[2]-n[2],d[0]=l[0],d[1]=l[1]*Math.cos(a)-l[2]*Math.sin(a),d[2]=l[1]*Math.sin(a)+l[2]*Math.cos(a),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},M.bl=function(r,t,n,a){var l=[],d=[];return l[0]=t[0]-n[0],l[1]=t[1]-n[1],l[2]=t[2]-n[2],d[0]=l[2]*Math.sin(a)+l[0]*Math.cos(a),d[1]=l[1],d[2]=l[2]*Math.cos(a)-l[0]*Math.sin(a),r[0]=d[0]+n[0],r[1]=d[1]+n[1],r[2]=d[2]+n[2],r},M.bm=function(r,t,n){var a=Math.sin(n),l=Math.cos(n),d=t[0],p=t[1],m=t[2],y=t[3],v=t[8],P=t[9],S=t[10],k=t[11];return t!==r&&(r[4]=t[4],r[5]=t[5],r[6]=t[6],r[7]=t[7],r[12]=t[12],r[13]=t[13],r[14]=t[14],r[15]=t[15]),r[0]=d*l-v*a,r[1]=p*l-P*a,r[2]=m*l-S*a,r[3]=y*l-k*a,r[8]=d*a+v*l,r[9]=p*a+P*l,r[10]=m*a+S*l,r[11]=y*a+k*l,r},M.bn=function(r,t){const n=mn(r,360),a=mn(t,360),l=a-n,d=a>n?l-360:l+360;return Math.abs(l)<Math.abs(d)?l:d},M.bo=function(r){return r[0]=0,r[1]=0,r[2]=0,r},M.bp=function(r,t,n,a){const l=Math.sqrt(r*r+t*t),d=Math.sqrt(n*n+a*a);r/=l,t/=l,n/=d,a/=d;const p=Math.acos(r*n+t*a);return-t*n+r*a>0?p:-p},M.bq=function(r,t){return r[0]*t[0]+r[1]*t[1]+r[2]*t[2]+r[3]},M.br=Fd,M.bs=function(r,t){const n=mn(r,2*Math.PI),a=mn(t,2*Math.PI);return Math.min(Math.abs(n-a),Math.abs(n-a+2*Math.PI),Math.abs(n-a-2*Math.PI))},M.bt=function(r){return Math.hypot(r[0],r[1],r[2])},M.bu=function(){const r={},t=D.$version;for(const n in D.$root){const a=D.$root[n];if(a.required){let l=null;l=n==="version"?t:a.type==="array"?[]:{},l!=null&&(r[n]=l)}}return r},M.bv=tc,M.bw=qr,M.bx=function(r){r=r.slice();const t=Object.create(null);for(let n=0;n<r.length;n++)t[r[n].id]=r[n];for(let n=0;n<r.length;n++)"ref"in r[n]&&(r[n]=ae(r[n],t[r[n].ref]));return r},M.by=function(r){if(r.type==="custom")return new xx(r);switch(r.type){case"background":return new gx(r);case"circle":return new hy(r);case"fill":return new zy(r);case"fill-extrusion":return new Oy(r);case"heatmap":return new py(r);case"hillshade":return new my(r);case"line":return new qy(r);case"raster":return new yx(r);case"symbol":return new mh(r)}},M.bz=Xi,M.c=qn,M.c0=r=>r.type==="circle",M.c1=r=>r.type==="heatmap",M.c2=r=>r.type==="line",M.c3=r=>r.type==="fill",M.c4=r=>r.type==="fill-extrusion",M.c5=r=>r.type==="hillshade",M.c6=r=>r.type==="raster",M.c7=r=>r.type==="background",M.c8=r=>r.type==="custom",M.c9=Ta,M.cA=class{constructor(r){this._marks={start:[r.url,"start"].join("#"),end:[r.url,"end"].join("#"),measure:r.url.toString()},performance.mark(this._marks.start)}finish(){performance.mark(this._marks.end);let r=performance.getEntriesByName(this._marks.measure);return r.length===0&&(performance.measure(this._marks.measure,this._marks.start,this._marks.end),r=performance.getEntriesByName(this._marks.measure),performance.clearMarks(this._marks.start),performance.clearMarks(this._marks.end),performance.clearMeasures(this._marks.measure)),r}},M.cB=function(r,t,n,a,l){return c(this,void 0,void 0,function*(){if(ri())try{return yield fr(r,t,n,a,l)}catch{}return function(d,p,m,y,v){const P=d.width,S=d.height;gn&&_n||(gn=new OffscreenCanvas(P,S),_n=gn.getContext("2d",{willReadFrequently:!0})),gn.width=P,gn.height=S,_n.drawImage(d,0,0,P,S);const k=_n.getImageData(p,m,y,v);return _n.clearRect(0,0,P,S),k.data}(r,t,n,a,l)})},M.cC=em,M.cD=Te,M.cE=Ue,M.cF=yf,M.cG=zf,M.cH=Co,M.cI=Jr,M.ca=function(r,t,n){const a=ms(t.x-n.x,t.y-n.y),l=ms(r.x-n.x,r.y-n.y);var d,p;return gr(Math.atan2(a[0]*l[1]-a[1]*l[0],(d=a)[0]*(p=l)[0]+d[1]*p[1]))},M.cb=Cr,M.cc=function(r,t){return Sa[t]&&(r instanceof MouseEvent||r instanceof WheelEvent)},M.cd=function(r,t){return Pa[t]&&"touches"in r},M.ce=function(r){return Pa[r]||Sa[r]},M.cf=function(r,t,n){var a=t[0],l=t[1];return r[0]=n[0]*a+n[4]*l+n[12],r[1]=n[1]*a+n[5]*l+n[13],r},M.cg=function(r,t){const{x:n,y:a}=zc.fromLngLat(t);return!(r<0||r>25||a<0||a>=1||n<0||n>=1)},M.ch=function(r,t){return r[0]=t[0],r[1]=0,r[2]=0,r[3]=0,r[4]=0,r[5]=t[1],r[6]=0,r[7]=0,r[8]=0,r[9]=0,r[10]=t[2],r[11]=0,r[12]=0,r[13]=0,r[14]=0,r[15]=1,r},M.ci=class extends Lr{},M.cj=zx,M.cl=function(r){return r.message===_s},M.cm=Er,M.cn=function(r,t){yn.REGISTERED_PROTOCOLS[r]=t},M.co=function(r){delete yn.REGISTERED_PROTOCOLS[r]},M.cp=function(r,t){const n={};for(let l=0;l<r.length;l++){const d=t&&t[r[l].id]||Qh(r[l]);t&&(t[r[l].id]=d);let p=n[d];p||(p=n[d]=[]),p.push(r[l])}const a=[];for(const l in n)a.push(n[l]);return a},M.cq=Ve,M.cr=tm,M.cs=rm,M.ct=Af,M.cu=function(r){r.bucket.createArrays(),r.bucket.tilePixelRatio=St/(512*r.bucket.overscaling),r.bucket.compareText={},r.bucket.iconsNeedLinear=!1;const t=r.bucket.layers[0],n=t.layout,a=t._unevaluatedLayout._values,l={layoutIconSize:a["icon-size"].possiblyEvaluate(new Ft(r.bucket.zoom+1),r.canonical),layoutTextSize:a["text-size"].possiblyEvaluate(new Ft(r.bucket.zoom+1),r.canonical),textMaxSize:a["text-size"].possiblyEvaluate(new Ft(18))};if(r.bucket.textSizeData.kind==="composite"){const{minZoom:v,maxZoom:P}=r.bucket.textSizeData;l.compositeTextSizes=[a["text-size"].possiblyEvaluate(new Ft(v),r.canonical),a["text-size"].possiblyEvaluate(new Ft(P),r.canonical)]}if(r.bucket.iconSizeData.kind==="composite"){const{minZoom:v,maxZoom:P}=r.bucket.iconSizeData;l.compositeIconSizes=[a["icon-size"].possiblyEvaluate(new Ft(v),r.canonical),a["icon-size"].possiblyEvaluate(new Ft(P),r.canonical)]}const d=n.get("text-line-height")*hi,p=n.get("text-rotation-alignment")!=="viewport"&&n.get("symbol-placement")!=="point",m=n.get("text-keep-upright"),y=n.get("text-size");for(const v of r.bucket.features){const P=n.get("text-font").evaluate(v,{},r.canonical).join(","),S=y.evaluate(v,{},r.canonical),k=l.layoutTextSize.evaluate(v,{},r.canonical),R=l.layoutIconSize.evaluate(v,{},r.canonical),L={horizontal:{},vertical:void 0},O=v.text;let $,H=[0,0];if(O){const A=O.toString(),U=n.get("text-letter-spacing").evaluate(v,{},r.canonical)*hi,J=Xu(A)?U:0,fe=n.get("text-anchor").evaluate(v,{},r.canonical),Ce=mm(t,v,r.canonical);if(!Ce){const Ee=n.get("text-radial-offset").evaluate(v,{},r.canonical);H=Ee?fm(fe,[Ee*hi,jd]):n.get("text-offset").evaluate(v,{},r.canonical).map(De=>De*hi)}let me=p?"center":n.get("text-justify").evaluate(v,{},r.canonical);const xe=n.get("symbol-placement")==="point"?n.get("text-max-width").evaluate(v,{},r.canonical)*hi:1/0,Re=()=>{r.bucket.allowVerticalPlacement&&Fo(A)&&(L.vertical=dh(O,r.glyphMap,r.glyphPositions,r.imagePositions,P,xe,d,fe,"left",J,H,M.ah.vertical,!0,k,S))};if(!p&&Ce){const Ee=new Set;if(me==="auto")for(let Pe=0;Pe<Ce.values.length;Pe+=2)Ee.add(Nd(Ce.values[Pe]));else Ee.add(me);let De=!1;for(const Pe of Ee)if(!L.horizontal[Pe])if(De)L.horizontal[Pe]=L.horizontal[0];else{const $e=dh(O,r.glyphMap,r.glyphPositions,r.imagePositions,P,xe,d,"center",Pe,J,H,M.ah.horizontal,!1,k,S);$e&&(L.horizontal[Pe]=$e,De=$e.positionedLines.length===1)}Re()}else{me==="auto"&&(me=Nd(fe));const Ee=dh(O,r.glyphMap,r.glyphPositions,r.imagePositions,P,xe,d,fe,me,J,H,M.ah.horizontal,!1,k,S);Ee&&(L.horizontal[me]=Ee),Re(),Fo(A)&&p&&m&&(L.vertical=dh(O,r.glyphMap,r.glyphPositions,r.imagePositions,P,xe,d,fe,me,J,H,M.ah.vertical,!1,k,S))}}let re=!1;if(v.icon&&v.icon.name){const A=r.imageMap[v.icon.name];A&&($=hx(r.imagePositions[v.icon.name],n.get("icon-offset").evaluate(v,{},r.canonical),n.get("icon-anchor").evaluate(v,{},r.canonical)),re=!!A.sdf,r.bucket.sdfIcons===void 0?r.bucket.sdfIcons=re:r.bucket.sdfIcons!==re&&Ci("Style sheet warning: Cannot mix SDF and non-SDF icons in one buffer"),(A.pixelRatio!==r.bucket.pixelRatio||n.get("icon-rotate").constantOr(1)!==0)&&(r.bucket.iconsNeedLinear=!0))}const X=_m(L.horizontal)||L.vertical;r.bucket.iconsInText=!!X&&X.iconsInText,(X||$)&&Cx(r.bucket,v,L,$,r.imageMap,l,k,R,H,re,r.canonical,r.subdivisionGranularity)}r.showCollisionBoxes&&r.bucket.generateCollisionDebugBuffers()},M.cv=Td,M.cw=_d,M.cx=wd,M.cy=Pc,M.cz=Md,M.d=ys,M.e=vi,M.f=r=>c(void 0,void 0,void 0,function*(){if(r.byteLength===0)return createImageBitmap(new ImageData(1,1));const t=new Blob([new Uint8Array(r)],{type:"image/png"});try{return createImageBitmap(t)}catch(n){throw new Error(`Could not load image because of ${n.message}. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported.`)}}),M.g=Ma,M.h=r=>new Promise((t,n)=>{const a=new Image;a.onload=()=>{t(a),URL.revokeObjectURL(a.src),a.onload=null,window.requestAnimationFrame(()=>{a.src=Gn})},a.onerror=()=>n(new Error("Could not load image. Please make sure to use a supported image type such as PNG or JPEG. Note that SVGs are not supported."));const l=new Blob([new Uint8Array(r)],{type:"image/png"});a.src=r.byteLength?URL.createObjectURL(l):Gn}),M.i=$r,M.j=(r,t)=>Ia(vi(r,{type:"json"}),t),M.k=j,M.l=ce,M.m=Ia,M.n=(r,t)=>Ia(vi(r,{type:"arrayBuffer"}),t),M.o=function(r){return new Md(r).readFields(Qy,[])},M.p=kf,M.q=_c,M.r=$i,M.s=mr,M.t=Ql,M.u=pt,M.v=D,M.w=Ci,M.x=Qa,M.y=ra,M.z=function([r,t,n]){return t+=90,t*=Math.PI/180,n*=Math.PI/180,{x:r*Math.cos(t)*Math.sin(n),y:r*Math.sin(t)*Math.sin(n),z:r*Math.cos(n)}}}),B("worker",["./shared"],function(M){class c{constructor(j){this.keyCache={},j&&this.replace(j)}replace(j){this._layerConfigs={},this._layers={},this.update(j,[])}update(j,V){for(const Y of j){this._layerConfigs[Y.id]=Y;const ae=this._layers[Y.id]=M.by(Y);ae._featureFilter=M.a7(ae.filter),this.keyCache[Y.id]&&delete this.keyCache[Y.id]}for(const Y of V)delete this.keyCache[Y],delete this._layerConfigs[Y],delete this._layers[Y];this.familiesBySource={};const D=M.cp(Object.values(this._layerConfigs),this.keyCache);for(const Y of D){const ae=Y.map(ue=>this._layers[ue.id]),ne=ae[0];if(ne.visibility==="none")continue;const he=ne.source||"";let oe=this.familiesBySource[he];oe||(oe=this.familiesBySource[he]={});const be=ne.sourceLayer||"_geojsonTileLayer";let _e=oe[be];_e||(_e=oe[be]=[]),_e.push(ae)}}}class Te{constructor(j){const V={},D=[];for(const he in j){const oe=j[he],be=V[he]={};for(const _e in oe){const ue=oe[+_e];if(!ue||ue.bitmap.width===0||ue.bitmap.height===0)continue;const Ie={x:0,y:0,w:ue.bitmap.width+2,h:ue.bitmap.height+2};D.push(Ie),be[_e]={rect:Ie,metrics:ue.metrics}}}const{w:Y,h:ae}=M.p(D),ne=new M.q({width:Y||1,height:ae||1});for(const he in j){const oe=j[he];for(const be in oe){const _e=oe[+be];if(!_e||_e.bitmap.width===0||_e.bitmap.height===0)continue;const ue=V[he][be].rect;M.q.copy(_e.bitmap,ne,{x:0,y:0},{x:ue.x+1,y:ue.y+1},_e.bitmap)}}this.image=ne,this.positions=V}}M.cq("GlyphAtlas",Te);class ge{constructor(j){this.tileID=new M.Y(j.tileID.overscaledZ,j.tileID.wrap,j.tileID.canonical.z,j.tileID.canonical.x,j.tileID.canonical.y),this.uid=j.uid,this.zoom=j.zoom,this.pixelRatio=j.pixelRatio,this.tileSize=j.tileSize,this.source=j.source,this.overscaling=this.tileID.overscaleFactor(),this.showCollisionBoxes=j.showCollisionBoxes,this.collectResourceTiming=!!j.collectResourceTiming,this.returnDependencies=!!j.returnDependencies,this.promoteId=j.promoteId,this.inFlightDependencies=[]}parse(j,V,D,Y,ae){return M._(this,void 0,void 0,function*(){this.status="parsing",this.data=j,this.collisionBoxArray=new M.a5;const ne=new M.cr(Object.keys(j.layers).sort()),he=new M.cs(this.tileID,this.promoteId);he.bucketLayerIDs=[];const oe={},be={featureIndex:he,iconDependencies:{},patternDependencies:{},glyphDependencies:{},availableImages:D,subdivisionGranularity:ae},_e=V.familiesBySource[this.source];for(const Oe in _e){const st=j.layers[Oe];if(!st)continue;st.version===1&&M.w(`Vector tile source "${this.source}" layer "${Oe}" does not use vector tile spec v2 and therefore may have some rendering errors.`);const $t=ne.encode(Oe),Hr=[];for(let it=0;it<st.length;it++){const li=st.feature(it),Dt=he.getId(li,Oe);Hr.push({feature:li,id:Dt,index:it,sourceLayerIndex:$t})}for(const it of _e[Oe]){const li=it[0];li.source!==this.source&&M.w(`layer.source = ${li.source} does not equal this.source = ${this.source}`),li.minzoom&&this.zoom<Math.floor(li.minzoom)||li.maxzoom&&this.zoom>=li.maxzoom||li.visibility!=="none"&&(ke(it,this.zoom,D),(oe[li.id]=li.createBucket({index:he.bucketLayerIDs.length,layers:it,zoom:this.zoom,pixelRatio:this.pixelRatio,overscaling:this.overscaling,collisionBoxArray:this.collisionBoxArray,sourceLayerIndex:$t,sourceID:this.source})).populate(Hr,be,this.tileID.canonical),he.bucketLayerIDs.push(it.map(Dt=>Dt.id)))}}const ue=M.bD(be.glyphDependencies,Oe=>Object.keys(Oe).map(Number));this.inFlightDependencies.forEach(Oe=>Oe==null?void 0:Oe.abort()),this.inFlightDependencies=[];let Ie=Promise.resolve({});if(Object.keys(ue).length){const Oe=new AbortController;this.inFlightDependencies.push(Oe),Ie=Y.sendAsync({type:"GG",data:{stacks:ue,source:this.source,tileID:this.tileID,type:"glyphs"}},Oe)}const je=Object.keys(be.iconDependencies);let Ne=Promise.resolve({});if(je.length){const Oe=new AbortController;this.inFlightDependencies.push(Oe),Ne=Y.sendAsync({type:"GI",data:{icons:je,source:this.source,tileID:this.tileID,type:"icons"}},Oe)}const ye=Object.keys(be.patternDependencies);let nt=Promise.resolve({});if(ye.length){const Oe=new AbortController;this.inFlightDependencies.push(Oe),nt=Y.sendAsync({type:"GI",data:{icons:ye,source:this.source,tileID:this.tileID,type:"patterns"}},Oe)}const[Je,rt,_t]=yield Promise.all([Ie,Ne,nt]),ze=new Te(Je),qe=new M.ct(rt,_t);for(const Oe in oe){const st=oe[Oe];st instanceof M.a6?(ke(st.layers,this.zoom,D),M.cu({bucket:st,glyphMap:Je,glyphPositions:ze.positions,imageMap:rt,imagePositions:qe.iconPositions,showCollisionBoxes:this.showCollisionBoxes,canonical:this.tileID.canonical,subdivisionGranularity:be.subdivisionGranularity})):st.hasPattern&&(st instanceof M.cv||st instanceof M.cw||st instanceof M.cx)&&(ke(st.layers,this.zoom,D),st.addFeatures(be,this.tileID.canonical,qe.patternPositions))}return this.status="done",{buckets:Object.values(oe).filter(Oe=>!Oe.isEmpty()),featureIndex:he,collisionBoxArray:this.collisionBoxArray,glyphAtlasImage:ze.image,imageAtlas:qe,glyphMap:this.returnDependencies?Je:null,iconMap:this.returnDependencies?rt:null,glyphPositions:this.returnDependencies?ze.positions:null}})}}function ke(ce,j,V){const D=new M.C(j);for(const Y of ce)Y.recalculate(D,V)}class Ue{constructor(j,V,D){this.actor=j,this.layerIndex=V,this.availableImages=D,this.fetching={},this.loading={},this.loaded={}}loadVectorTile(j,V){return M._(this,void 0,void 0,function*(){const D=yield M.n(j.request,V);try{return{vectorTile:new M.cy.VectorTile(new M.cz(D.data)),rawData:D.data,cacheControl:D.cacheControl,expires:D.expires}}catch(Y){const ae=new Uint8Array(D.data);let ne=`Unable to parse the tile at ${j.request.url}, `;throw ne+=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: ${Y.message}`,new Error(ne)}})}loadTile(j){return M._(this,void 0,void 0,function*(){const V=j.uid,D=!!(j&&j.request&&j.request.collectResourceTiming)&&new M.cA(j.request),Y=new ge(j);this.loading[V]=Y;const ae=new AbortController;Y.abort=ae;try{const ne=yield this.loadVectorTile(j,ae);if(delete this.loading[V],!ne)return null;const he=ne.rawData,oe={};ne.expires&&(oe.expires=ne.expires),ne.cacheControl&&(oe.cacheControl=ne.cacheControl);const be={};if(D){const ue=D.finish();ue&&(be.resourceTiming=JSON.parse(JSON.stringify(ue)))}Y.vectorTile=ne.vectorTile;const _e=Y.parse(ne.vectorTile,this.layerIndex,this.availableImages,this.actor,j.subdivisionGranularity);this.loaded[V]=Y,this.fetching[V]={rawTileData:he,cacheControl:oe,resourceTiming:be};try{const ue=yield _e;return M.e({rawTileData:he.slice(0)},ue,oe,be)}finally{delete this.fetching[V]}}catch(ne){throw delete this.loading[V],Y.status="done",this.loaded[V]=Y,ne}})}reloadTile(j){return M._(this,void 0,void 0,function*(){const V=j.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 D=this.loaded[V];if(D.showCollisionBoxes=j.showCollisionBoxes,D.status==="parsing"){const Y=yield D.parse(D.vectorTile,this.layerIndex,this.availableImages,this.actor,j.subdivisionGranularity);let ae;if(this.fetching[V]){const{rawTileData:ne,cacheControl:he,resourceTiming:oe}=this.fetching[V];delete this.fetching[V],ae=M.e({rawTileData:ne.slice(0)},Y,he,oe)}else ae=Y;return ae}if(D.status==="done"&&D.vectorTile)return D.parse(D.vectorTile,this.layerIndex,this.availableImages,this.actor,j.subdivisionGranularity)})}abortTile(j){return M._(this,void 0,void 0,function*(){const V=this.loading,D=j.uid;V&&V[D]&&V[D].abort&&(V[D].abort.abort(),delete V[D])})}removeTile(j){return M._(this,void 0,void 0,function*(){this.loaded&&this.loaded[j.uid]&&delete this.loaded[j.uid]})}}class Ae{constructor(){this.loaded={}}loadTile(j){return M._(this,void 0,void 0,function*(){const{uid:V,encoding:D,rawImageData:Y,redFactor:ae,greenFactor:ne,blueFactor:he,baseShift:oe}=j,be=Y.width+2,_e=Y.height+2,ue=M.b(Y)?new M.R({width:be,height:_e},yield M.cB(Y,-1,-1,be,_e)):Y,Ie=new M.cC(V,ue,D,ae,ne,he,oe);return this.loaded=this.loaded||{},this.loaded[V]=Ie,Ie})}removeTile(j){const V=this.loaded,D=j.uid;V&&V[D]&&delete V[D]}}var le,Ze,Xt=function(){if(Ze)return le;function ce(V,D){if(V.length!==0){j(V[0],D);for(var Y=1;Y<V.length;Y++)j(V[Y],!D)}}function j(V,D){for(var Y=0,ae=0,ne=0,he=V.length,oe=he-1;ne<he;oe=ne++){var be=(V[ne][0]-V[oe][0])*(V[oe][1]+V[ne][1]),_e=Y+be;ae+=Math.abs(Y)>=Math.abs(be)?Y-_e+be:be-_e+Y,Y=_e}Y+ae>=0!=!!D&&V.reverse()}return Ze=1,le=function V(D,Y){var ae,ne=D&&D.type;if(ne==="FeatureCollection")for(ae=0;ae<D.features.length;ae++)V(D.features[ae],Y);else if(ne==="GeometryCollection")for(ae=0;ae<D.geometries.length;ae++)V(D.geometries[ae],Y);else if(ne==="Feature")V(D.geometry,Y);else if(ne==="Polygon")ce(D.coordinates,Y);else if(ne==="MultiPolygon")for(ae=0;ae<D.coordinates.length;ae++)ce(D.coordinates[ae],Y);return D}}(),xi=M.cD(Xt);const ji=M.cy.VectorTileFeature.prototype.toGeoJSON;class Mi{constructor(j){this._feature=j,this.extent=M.Z,this.type=j.type,this.properties=j.tags,"id"in j&&!isNaN(j.id)&&(this.id=parseInt(j.id,10))}loadGeometry(){if(this._feature.type===1){const j=[];for(const V of this._feature.geometry)j.push([new M.P(V[0],V[1])]);return j}{const j=[];for(const V of this._feature.geometry){const D=[];for(const Y of V)D.push(new M.P(Y[0],Y[1]));j.push(D)}return j}}toGeoJSON(j,V,D){return ji.call(this,j,V,D)}}class Ri{constructor(j){this.layers={_geojsonTileLayer:this},this.name="_geojsonTileLayer",this.extent=M.Z,this.length=j.length,this._features=j}feature(j){return new Mi(this._features[j])}}var ri,dr,Rt,kt={exports:{}},Zt=function(){if(Rt)return kt.exports;Rt=1;var ce=M.cG(),j=function(){if(dr)return ri;dr=1;var _e=M.cE(),ue=M.cF().VectorTileFeature;function Ie(Ne,ye){this.options=ye||{},this.features=Ne,this.length=Ne.length}function je(Ne,ye){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=ye||4096}return ri=Ie,Ie.prototype.feature=function(Ne){return new je(this.features[Ne],this.options.extent)},je.prototype.loadGeometry=function(){var Ne=this.rawGeometry;this.geometry=[];for(var ye=0;ye<Ne.length;ye++){for(var nt=Ne[ye],Je=[],rt=0;rt<nt.length;rt++)Je.push(new _e(nt[rt][0],nt[rt][1]));this.geometry.push(Je)}return this.geometry},je.prototype.bbox=function(){this.geometry||this.loadGeometry();for(var Ne=this.geometry,ye=1/0,nt=-1/0,Je=1/0,rt=-1/0,_t=0;_t<Ne.length;_t++)for(var ze=Ne[_t],qe=0;qe<ze.length;qe++){var Oe=ze[qe];ye=Math.min(ye,Oe.x),nt=Math.max(nt,Oe.x),Je=Math.min(Je,Oe.y),rt=Math.max(rt,Oe.y)}return[ye,Je,nt,rt]},je.prototype.toGeoJSON=ue.prototype.toGeoJSON,ri}();function V(_e){var ue=new ce;return function(Ie,je){for(var Ne in Ie.layers)je.writeMessage(3,D,Ie.layers[Ne])}(_e,ue),ue.finish()}function D(_e,ue){var Ie;ue.writeVarintField(15,_e.version||1),ue.writeStringField(1,_e.name||""),ue.writeVarintField(5,_e.extent||4096);var je={keys:[],values:[],keycache:{},valuecache:{}};for(Ie=0;Ie<_e.length;Ie++)je.feature=_e.feature(Ie),ue.writeMessage(2,Y,je);var Ne=je.keys;for(Ie=0;Ie<Ne.length;Ie++)ue.writeStringField(3,Ne[Ie]);var ye=je.values;for(Ie=0;Ie<ye.length;Ie++)ue.writeMessage(4,be,ye[Ie])}function Y(_e,ue){var Ie=_e.feature;Ie.id!==void 0&&ue.writeVarintField(1,Ie.id),ue.writeMessage(2,ae,_e),ue.writeVarintField(3,Ie.type),ue.writeMessage(4,oe,Ie)}function ae(_e,ue){var Ie=_e.feature,je=_e.keys,Ne=_e.values,ye=_e.keycache,nt=_e.valuecache;for(var Je in Ie.properties){var rt=Ie.properties[Je],_t=ye[Je];if(rt!==null){_t===void 0&&(je.push(Je),ye[Je]=_t=je.length-1),ue.writeVarint(_t);var ze=typeof rt;ze!=="string"&&ze!=="boolean"&&ze!=="number"&&(rt=JSON.stringify(rt));var qe=ze+":"+rt,Oe=nt[qe];Oe===void 0&&(Ne.push(rt),nt[qe]=Oe=Ne.length-1),ue.writeVarint(Oe)}}}function ne(_e,ue){return(ue<<3)+(7&_e)}function he(_e){return _e<<1^_e>>31}function oe(_e,ue){for(var Ie=_e.loadGeometry(),je=_e.type,Ne=0,ye=0,nt=Ie.length,Je=0;Je<nt;Je++){var rt=Ie[Je],_t=1;je===1&&(_t=rt.length),ue.writeVarint(ne(1,_t));for(var ze=je===3?rt.length-1:rt.length,qe=0;qe<ze;qe++){qe===1&&je!==1&&ue.writeVarint(ne(2,ze-1));var Oe=rt[qe].x-Ne,st=rt[qe].y-ye;ue.writeVarint(he(Oe)),ue.writeVarint(he(st)),Ne+=Oe,ye+=st}je===3&&ue.writeVarint(ne(7,1))}}function be(_e,ue){var Ie=typeof _e;Ie==="string"?ue.writeStringField(1,_e):Ie==="boolean"?ue.writeBooleanField(7,_e):Ie==="number"&&(_e%1!=0?ue.writeDoubleField(3,_e):_e<0?ue.writeSVarintField(6,_e):ue.writeVarintField(5,_e))}return kt.exports=V,kt.exports.fromVectorTileJs=V,kt.exports.fromGeojsonVt=function(_e,ue){ue=ue||{};var Ie={};for(var je in _e)Ie[je]=new j(_e[je].features,ue),Ie[je].name=je,Ie[je].version=ue.version,Ie[je].extent=ue.extent;return V({layers:Ie})},kt.exports.GeoJSONWrapper=j,kt.exports}(),Vr=M.cD(Zt);const ba={minZoom:0,maxZoom:16,minPoints:2,radius:40,extent:512,nodeSize:64,log:!1,generateId:!1,reduce:null,map:ce=>ce},wt=Math.fround||(Ur=new Float32Array(1),ce=>(Ur[0]=+ce,Ur[0]));var Ur;const rr=3,Ii=5,ms=6;class St{constructor(j){this.options=Object.assign(Object.create(ba),j),this.trees=new Array(this.options.maxZoom+1),this.stride=this.options.reduce?7:6,this.clusterProps=[]}load(j){const{log:V,minZoom:D,maxZoom:Y}=this.options;V&&console.time("total time");const ae=`prepare ${j.length} points`;V&&console.time(ae),this.points=j;const ne=[];for(let oe=0;oe<j.length;oe++){const be=j[oe];if(!be.geometry)continue;const[_e,ue]=be.geometry.coordinates,Ie=wt(jn(_e)),je=wt(Nn(ue));ne.push(Ie,je,1/0,oe,-1,1),this.options.reduce&&ne.push(0)}let he=this.trees[Y+1]=this._createTree(ne);V&&console.timeEnd(ae);for(let oe=Y;oe>=D;oe--){const be=+Date.now();he=this.trees[oe]=this._createTree(this._cluster(he,oe)),V&&console.log("z%d: %d clusters in %dms",oe,he.numItems,+Date.now()-be)}return V&&console.timeEnd("total time"),this}getClusters(j,V){let D=((j[0]+180)%360+360)%360-180;const Y=Math.max(-90,Math.min(90,j[1]));let ae=j[2]===180?180:((j[2]+180)%360+360)%360-180;const ne=Math.max(-90,Math.min(90,j[3]));if(j[2]-j[0]>=360)D=-180,ae=180;else if(D>ae){const ue=this.getClusters([D,Y,180,ne],V),Ie=this.getClusters([-180,Y,ae,ne],V);return ue.concat(Ie)}const he=this.trees[this._limitZoom(V)],oe=he.range(jn(D),Nn(ne),jn(ae),Nn(Y)),be=he.data,_e=[];for(const ue of oe){const Ie=this.stride*ue;_e.push(be[Ie+Ii]>1?wa(be,Ie,this.clusterProps):this.points[be[Ie+rr]])}return _e}getChildren(j){const V=this._getOriginId(j),D=this._getOriginZoom(j),Y="No cluster with the specified id.",ae=this.trees[D];if(!ae)throw new Error(Y);const ne=ae.data;if(V*this.stride>=ne.length)throw new Error(Y);const he=this.options.radius/(this.options.extent*Math.pow(2,D-1)),oe=ae.within(ne[V*this.stride],ne[V*this.stride+1],he),be=[];for(const _e of oe){const ue=_e*this.stride;ne[ue+4]===j&&be.push(ne[ue+Ii]>1?wa(ne,ue,this.clusterProps):this.points[ne[ue+rr]])}if(be.length===0)throw new Error(Y);return be}getLeaves(j,V,D){const Y=[];return this._appendLeaves(Y,j,V=V||10,D=D||0,0),Y}getTile(j,V,D){const Y=this.trees[this._limitZoom(j)],ae=Math.pow(2,j),{extent:ne,radius:he}=this.options,oe=he/ne,be=(D-oe)/ae,_e=(D+1+oe)/ae,ue={features:[]};return this._addTileFeatures(Y.range((V-oe)/ae,be,(V+1+oe)/ae,_e),Y.data,V,D,ae,ue),V===0&&this._addTileFeatures(Y.range(1-oe/ae,be,1,_e),Y.data,ae,D,ae,ue),V===ae-1&&this._addTileFeatures(Y.range(0,be,oe/ae,_e),Y.data,-1,D,ae,ue),ue.features.length?ue:null}getClusterExpansionZoom(j){let V=this._getOriginZoom(j)-1;for(;V<=this.options.maxZoom;){const D=this.getChildren(j);if(V++,D.length!==1)break;j=D[0].properties.cluster_id}return V}_appendLeaves(j,V,D,Y,ae){const ne=this.getChildren(V);for(const he of ne){const oe=he.properties;if(oe&&oe.cluster?ae+oe.point_count<=Y?ae+=oe.point_count:ae=this._appendLeaves(j,oe.cluster_id,D,Y,ae):ae<Y?ae++:j.push(he),j.length===D)break}return ae}_createTree(j){const V=new M.aC(j.length/this.stride|0,this.options.nodeSize,Float32Array);for(let D=0;D<j.length;D+=this.stride)V.add(j[D],j[D+1]);return V.finish(),V.data=j,V}_addTileFeatures(j,V,D,Y,ae,ne){for(const he of j){const oe=he*this.stride,be=V[oe+Ii]>1;let _e,ue,Ie;if(be)_e=mn(V,oe,this.clusterProps),ue=V[oe],Ie=V[oe+1];else{const ye=this.points[V[oe+rr]];_e=ye.properties;const[nt,Je]=ye.geometry.coordinates;ue=jn(nt),Ie=Nn(Je)}const je={type:1,geometry:[[Math.round(this.options.extent*(ue*ae-D)),Math.round(this.options.extent*(Ie*ae-Y))]],tags:_e};let Ne;Ne=be||this.options.generateId?V[oe+rr]:this.points[V[oe+rr]].id,Ne!==void 0&&(je.id=Ne),ne.features.push(je)}}_limitZoom(j){return Math.max(this.options.minZoom,Math.min(Math.floor(+j),this.options.maxZoom+1))}_cluster(j,V){const{radius:D,extent:Y,reduce:ae,minPoints:ne}=this.options,he=D/(Y*Math.pow(2,V)),oe=j.data,be=[],_e=this.stride;for(let ue=0;ue<oe.length;ue+=_e){if(oe[ue+2]<=V)continue;oe[ue+2]=V;const Ie=oe[ue],je=oe[ue+1],Ne=j.within(oe[ue],oe[ue+1],he),ye=oe[ue+Ii];let nt=ye;for(const Je of Ne){const rt=Je*_e;oe[rt+2]>V&&(nt+=oe[rt+Ii])}if(nt>ye&&nt>=ne){let Je,rt=Ie*ye,_t=je*ye,ze=-1;const qe=((ue/_e|0)<<5)+(V+1)+this.points.length;for(const Oe of Ne){const st=Oe*_e;if(oe[st+2]<=V)continue;oe[st+2]=V;const $t=oe[st+Ii];rt+=oe[st]*$t,_t+=oe[st+1]*$t,oe[st+4]=qe,ae&&(Je||(Je=this._map(oe,ue,!0),ze=this.clusterProps.length,this.clusterProps.push(Je)),ae(Je,this._map(oe,st)))}oe[ue+4]=qe,be.push(rt/nt,_t/nt,1/0,qe,-1,nt),ae&&be.push(ze)}else{for(let Je=0;Je<_e;Je++)be.push(oe[ue+Je]);if(nt>1)for(const Je of Ne){const rt=Je*_e;if(!(oe[rt+2]<=V)){oe[rt+2]=V;for(let _t=0;_t<_e;_t++)be.push(oe[rt+_t])}}}}return be}_getOriginId(j){return j-this.points.length>>5}_getOriginZoom(j){return(j-this.points.length)%32}_map(j,V,D){if(j[V+Ii]>1){const ne=this.clusterProps[j[V+ms]];return D?Object.assign({},ne):ne}const Y=this.points[j[V+rr]].properties,ae=this.options.map(Y);return D&&ae===Y?Object.assign({},ae):ae}}function wa(ce,j,V){return{type:"Feature",id:ce[j+rr],properties:mn(ce,j,V),geometry:{type:"Point",coordinates:[(D=ce[j],360*(D-.5)),Ta(ce[j+1])]}};var D}function mn(ce,j,V){const D=ce[j+Ii],Y=D>=1e4?`${Math.round(D/1e3)}k`:D>=1e3?Math.round(D/100)/10+"k":D,ae=ce[j+ms],ne=ae===-1?{}:Object.assign({},V[ae]);return Object.assign(ne,{cluster:!0,cluster_id:ce[j+rr],point_count:D,point_count_abbreviated:Y})}function jn(ce){return ce/360+.5}function Nn(ce){const j=Math.sin(ce*Math.PI/180),V=.5-.25*Math.log((1+j)/(1-j))/Math.PI;return V<0?0:V>1?1:V}function Ta(ce){const j=(180-360*ce)*Math.PI/180;return 360*Math.atan(Math.exp(j))/Math.PI-90}function Cr(ce,j,V,D){let Y=D;const ae=j+(V-j>>1);let ne,he=V-j;const oe=ce[j],be=ce[j+1],_e=ce[V],ue=ce[V+1];for(let Ie=j+3;Ie<V;Ie+=3){const je=pr(ce[Ie],ce[Ie+1],oe,be,_e,ue);if(je>Y)ne=Ie,Y=je;else if(je===Y){const Ne=Math.abs(Ie-ae);Ne<he&&(ne=Ie,he=Ne)}}Y>D&&(ne-j>3&&Cr(ce,j,ne,D),ce[ne+2]=Y,V-ne>3&&Cr(ce,ne,V,D))}function pr(ce,j,V,D,Y,ae){let ne=Y-V,he=ae-D;if(ne!==0||he!==0){const oe=((ce-V)*ne+(j-D)*he)/(ne*ne+he*he);oe>1?(V=Y,D=ae):oe>0&&(V+=ne*oe,D+=he*oe)}return ne=ce-V,he=j-D,ne*ne+he*he}function nr(ce,j,V,D){const Y={id:ce??null,type:j,geometry:V,tags:D,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0};if(j==="Point"||j==="MultiPoint"||j==="LineString")vi(Y,V);else if(j==="Polygon")vi(Y,V[0]);else if(j==="MultiLineString")for(const ae of V)vi(Y,ae);else if(j==="MultiPolygon")for(const ae of V)vi(Y,ae[0]);return Y}function vi(ce,j){for(let V=0;V<j.length;V+=3)ce.minX=Math.min(ce.minX,j[V]),ce.minY=Math.min(ce.minY,j[V+1]),ce.maxX=Math.max(ce.maxX,j[V]),ce.maxY=Math.max(ce.maxY,j[V+1])}function Zn(ce,j,V,D){if(!j.geometry)return;const Y=j.geometry.coordinates;if(Y&&Y.length===0)return;const ae=j.geometry.type,ne=Math.pow(V.tolerance/((1<<V.maxZoom)*V.extent),2);let he=[],oe=j.id;if(V.promoteId?oe=j.properties[V.promoteId]:V.generateId&&(oe=D||0),ae==="Point")Vn(Y,he);else if(ae==="MultiPoint")for(const be of Y)Vn(be,he);else if(ae==="LineString")Un(Y,he,ne,!1);else if(ae==="MultiLineString"){if(V.lineMetrics){for(const be of Y)he=[],Un(be,he,ne,!1),ce.push(nr(oe,"LineString",he,j.properties));return}Xi(Y,he,ne,!1)}else if(ae==="Polygon")Xi(Y,he,ne,!0);else{if(ae!=="MultiPolygon"){if(ae==="GeometryCollection"){for(const be of j.geometry.geometries)Zn(ce,{id:oe,geometry:be,properties:j.properties},V,D);return}throw new Error("Input data is not a valid GeoJSON object.")}for(const be of Y){const _e=[];Xi(be,_e,ne,!0),he.push(_e)}}ce.push(nr(oe,ae,he,j.properties))}function Vn(ce,j){j.push(gs(ce[0]),Ci(ce[1]),0)}function Un(ce,j,V,D){let Y,ae,ne=0;for(let oe=0;oe<ce.length;oe++){const be=gs(ce[oe][0]),_e=Ci(ce[oe][1]);j.push(be,_e,0),oe>0&&(ne+=D?(Y*_e-be*ae)/2:Math.sqrt(Math.pow(be-Y,2)+Math.pow(_e-ae,2))),Y=be,ae=_e}const he=j.length-3;j[2]=1,Cr(j,0,he,V),j[he+2]=1,j.size=Math.abs(ne),j.start=0,j.end=j.size}function Xi(ce,j,V,D){for(let Y=0;Y<ce.length;Y++){const ae=[];Un(ce[Y],ae,V,D),j.push(ae)}}function gs(ce){return ce/360+.5}function Ci(ce){const j=Math.sin(ce*Math.PI/180),V=.5-.25*Math.log((1+j)/(1-j))/Math.PI;return V<0?0:V>1?1:V}function oi(ce,j,V,D,Y,ae,ne,he){if(D/=j,ae>=(V/=j)&&ne<D)return ce;if(ne<V||ae>=D)return null;const oe=[];for(const be of ce){const _e=be.geometry;let ue=be.type;const Ie=Y===0?be.minX:be.minY,je=Y===0?be.maxX:be.maxY;if(Ie>=V&&je<D){oe.push(be);continue}if(je<V||Ie>=D)continue;let Ne=[];if(ue==="Point"||ue==="MultiPoint")$r(_e,Ne,V,D,Y);else if(ue==="LineString")Yt(_e,Ne,V,D,Y,!1,he.lineMetrics);else if(ue==="MultiLineString")Gn(_e,Ne,V,D,Y,!1);else if(ue==="Polygon")Gn(_e,Ne,V,D,Y,!0);else if(ue==="MultiPolygon")for(const ye of _e){const nt=[];Gn(ye,nt,V,D,Y,!0),nt.length&&Ne.push(nt)}if(Ne.length){if(he.lineMetrics&&ue==="LineString"){for(const ye of Ne)oe.push(nr(be.id,ue,ye,be.tags));continue}ue!=="LineString"&&ue!=="MultiLineString"||(Ne.length===1?(ue="LineString",Ne=Ne[0]):ue="MultiLineString"),ue!=="Point"&&ue!=="MultiPoint"||(ue=Ne.length===3?"Point":"MultiPoint"),oe.push(nr(be.id,ue,Ne,be.tags))}}return oe.length?oe:null}function $r(ce,j,V,D,Y){for(let ae=0;ae<ce.length;ae+=3){const ne=ce[ae+Y];ne>=V&&ne<=D&&fr(j,ce[ae],ce[ae+1],ce[ae+2])}}function Yt(ce,j,V,D,Y,ae,ne){let he=$n(ce);const oe=Y===0?gn:_n;let be,_e,ue=ce.start;for(let nt=0;nt<ce.length-3;nt+=3){const Je=ce[nt],rt=ce[nt+1],_t=ce[nt+2],ze=ce[nt+3],qe=ce[nt+4],Oe=Y===0?Je:rt,st=Y===0?ze:qe;let $t=!1;ne&&(be=Math.sqrt(Math.pow(Je-ze,2)+Math.pow(rt-qe,2))),Oe<V?st>V&&(_e=oe(he,Je,rt,ze,qe,V),ne&&(he.start=ue+be*_e)):Oe>D?st<D&&(_e=oe(he,Je,rt,ze,qe,D),ne&&(he.start=ue+be*_e)):fr(he,Je,rt,_t),st<V&&Oe>=V&&(_e=oe(he,Je,rt,ze,qe,V),$t=!0),st>D&&Oe<=D&&(_e=oe(he,Je,rt,ze,qe,D),$t=!0),!ae&&$t&&(ne&&(he.end=ue+be*_e),j.push(he),he=$n(ce)),ne&&(ue+=be)}let Ie=ce.length-3;const je=ce[Ie],Ne=ce[Ie+1],ye=Y===0?je:Ne;ye>=V&&ye<=D&&fr(he,je,Ne,ce[Ie+2]),Ie=he.length-3,ae&&Ie>=3&&(he[Ie]!==he[0]||he[Ie+1]!==he[1])&&fr(he,he[0],he[1],he[2]),he.length&&j.push(he)}function $n(ce){const j=[];return j.size=ce.size,j.start=ce.start,j.end=ce.end,j}function Gn(ce,j,V,D,Y,ae){for(const ne of ce)Yt(ne,j,V,D,Y,ae,!1)}function fr(ce,j,V,D){ce.push(j,V,D)}function gn(ce,j,V,D,Y,ae){const ne=(ae-j)/(D-j);return fr(ce,ae,V+(Y-V)*ne,1),ne}function _n(ce,j,V,D,Y,ae){const ne=(ae-V)/(Y-V);return fr(ce,j+(D-j)*ne,ae,1),ne}function mr(ce,j){const V=[];for(let D=0;D<ce.length;D++){const Y=ce[D],ae=Y.type;let ne;if(ae==="Point"||ae==="MultiPoint"||ae==="LineString")ne=gr(Y.geometry,j);else if(ae==="MultiLineString"||ae==="Polygon"){ne=[];for(const he of Y.geometry)ne.push(gr(he,j))}else if(ae==="MultiPolygon"){ne=[];for(const he of Y.geometry){const oe=[];for(const be of he)oe.push(gr(be,j));ne.push(oe)}}V.push(nr(Y.id,ae,ne,Y.tags))}return V}function gr(ce,j){const V=[];V.size=ce.size,ce.start!==void 0&&(V.start=ce.start,V.end=ce.end);for(let D=0;D<ce.length;D+=3)V.push(ce[D]+j,ce[D+1],ce[D+2]);return V}function Pa(ce,j){if(ce.transformed)return ce;const V=1<<ce.z,D=ce.x,Y=ce.y;for(const ae of ce.features){const ne=ae.geometry,he=ae.type;if(ae.geometry=[],he===1)for(let oe=0;oe<ne.length;oe+=2)ae.geometry.push(Sa(ne[oe],ne[oe+1],j,V,D,Y));else for(let oe=0;oe<ne.length;oe++){const be=[];for(let _e=0;_e<ne[oe].length;_e+=2)be.push(Sa(ne[oe][_e],ne[oe][_e+1],j,V,D,Y));ae.geometry.push(be)}}return ce.transformed=!0,ce}function Sa(ce,j,V,D,Y,ae){return[Math.round(V*(ce*D-Y)),Math.round(V*(j*D-ae))]}function _s(ce,j,V,D,Y){const ae=j===Y.maxZoom?0:Y.tolerance/((1<<j)*Y.extent),ne={features:[],numPoints:0,numSimplified:0,numFeatures:ce.length,source:null,x:V,y:D,z:j,transformed:!1,minX:2,minY:1,maxX:-1,maxY:0};for(const he of ce)qn(ne,he,ae,Y);return ne}function qn(ce,j,V,D){const Y=j.geometry,ae=j.type,ne=[];if(ce.minX=Math.min(ce.minX,j.minX),ce.minY=Math.min(ce.minY,j.minY),ce.maxX=Math.max(ce.maxX,j.maxX),ce.maxY=Math.max(ce.maxY,j.maxY),ae==="Point"||ae==="MultiPoint")for(let he=0;he<Y.length;he+=3)ne.push(Y[he],Y[he+1]),ce.numPoints++,ce.numSimplified++;else if(ae==="LineString")yn(ne,Y,ce,V,!1,!1);else if(ae==="MultiLineString"||ae==="Polygon")for(let he=0;he<Y.length;he++)yn(ne,Y[he],ce,V,ae==="Polygon",he===0);else if(ae==="MultiPolygon")for(let he=0;he<Y.length;he++){const oe=Y[he];for(let be=0;be<oe.length;be++)yn(ne,oe[be],ce,V,!0,be===0)}if(ne.length){let he=j.tags||null;if(ae==="LineString"&&D.lineMetrics){he={};for(const be in j.tags)he[be]=j.tags[be];he.mapbox_clip_start=Y.start/Y.size,he.mapbox_clip_end=Y.end/Y.size}const oe={geometry:ne,type:ae==="Polygon"||ae==="MultiPolygon"?3:ae==="LineString"||ae==="MultiLineString"?2:1,tags:he};j.id!==null&&(oe.id=j.id),ce.features.push(oe)}}function yn(ce,j,V,D,Y,ae){const ne=D*D;if(D>0&&j.size<(Y?ne:D))return void(V.numPoints+=j.length/3);const he=[];for(let oe=0;oe<j.length;oe+=3)(D===0||j[oe+2]>ne)&&(V.numSimplified++,he.push(j[oe],j[oe+1])),V.numPoints++;Y&&function(oe,be){let _e=0;for(let ue=0,Ie=oe.length,je=Ie-2;ue<Ie;je=ue,ue+=2)_e+=(oe[ue]-oe[je])*(oe[ue+1]+oe[je+1]);if(_e>0===be)for(let ue=0,Ie=oe.length;ue<Ie/2;ue+=2){const je=oe[ue],Ne=oe[ue+1];oe[ue]=oe[Ie-2-ue],oe[ue+1]=oe[Ie-1-ue],oe[Ie-2-ue]=je,oe[Ie-1-ue]=Ne}}(he,ae),ce.push(he)}const Ma={maxZoom:14,indexMaxZoom:5,indexMaxPoints:1e5,tolerance:3,extent:4096,buffer:64,lineMetrics:!1,promoteId:null,generateId:!1,debug:0};class Gr{constructor(j,V){const D=(V=this.options=function(ae,ne){for(const he in ne)ae[he]=ne[he];return ae}(Object.create(Ma),V)).debug;if(D&&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 Y=function(ae,ne){const he=[];if(ae.type==="FeatureCollection")for(let oe=0;oe<ae.features.length;oe++)Zn(he,ae.features[oe],ne,oe);else Zn(he,ae.type==="Feature"?ae:{geometry:ae},ne);return he}(j,V);this.tiles={},this.tileCoords=[],D&&(console.timeEnd("preprocess data"),console.log("index: maxZoom: %d, maxPoints: %d",V.indexMaxZoom,V.indexMaxPoints),console.time("generate tiles"),this.stats={},this.total=0),Y=function(ae,ne){const he=ne.buffer/ne.extent;let oe=ae;const be=oi(ae,1,-1-he,he,0,-1,2,ne),_e=oi(ae,1,1-he,2+he,0,-1,2,ne);return(be||_e)&&(oe=oi(ae,1,-he,1+he,0,-1,2,ne)||[],be&&(oe=mr(be,1).concat(oe)),_e&&(oe=oe.concat(mr(_e,-1)))),oe}(Y,V),Y.length&&this.splitTile(Y,0,0,0),D&&(Y.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(j,V,D,Y,ae,ne,he){const oe=[j,V,D,Y],be=this.options,_e=be.debug;for(;oe.length;){Y=oe.pop(),D=oe.pop(),V=oe.pop(),j=oe.pop();const ue=1<<V,Ie=Er(V,D,Y);let je=this.tiles[Ie];if(!je&&(_e>1&&console.time("creation"),je=this.tiles[Ie]=_s(j,V,D,Y,be),this.tileCoords.push({z:V,x:D,y:Y}),_e)){_e>1&&(console.log("tile z%d-%d-%d (features: %d, points: %d, simplified: %d)",V,D,Y,je.numFeatures,je.numPoints,je.numSimplified),console.timeEnd("creation"));const $t=`z${V}`;this.stats[$t]=(this.stats[$t]||0)+1,this.total++}if(je.source=j,ae==null){if(V===be.indexMaxZoom||je.numPoints<=be.indexMaxPoints)continue}else{if(V===be.maxZoom||V===ae)continue;if(ae!=null){const $t=ae-V;if(D!==ne>>$t||Y!==he>>$t)continue}}if(je.source=null,j.length===0)continue;_e>1&&console.time("clipping");const Ne=.5*be.buffer/be.extent,ye=.5-Ne,nt=.5+Ne,Je=1+Ne;let rt=null,_t=null,ze=null,qe=null,Oe=oi(j,ue,D-Ne,D+nt,0,je.minX,je.maxX,be),st=oi(j,ue,D+ye,D+Je,0,je.minX,je.maxX,be);j=null,Oe&&(rt=oi(Oe,ue,Y-Ne,Y+nt,1,je.minY,je.maxY,be),_t=oi(Oe,ue,Y+ye,Y+Je,1,je.minY,je.maxY,be),Oe=null),st&&(ze=oi(st,ue,Y-Ne,Y+nt,1,je.minY,je.maxY,be),qe=oi(st,ue,Y+ye,Y+Je,1,je.minY,je.maxY,be),st=null),_e>1&&console.timeEnd("clipping"),oe.push(rt||[],V+1,2*D,2*Y),oe.push(_t||[],V+1,2*D,2*Y+1),oe.push(ze||[],V+1,2*D+1,2*Y),oe.push(qe||[],V+1,2*D+1,2*Y+1)}}getTile(j,V,D){j=+j,V=+V,D=+D;const Y=this.options,{extent:ae,debug:ne}=Y;if(j<0||j>24)return null;const he=1<<j,oe=Er(j,V=V+he&he-1,D);if(this.tiles[oe])return Pa(this.tiles[oe],ae);ne>1&&console.log("drilling down to z%d-%d-%d",j,V,D);let be,_e=j,ue=V,Ie=D;for(;!be&&_e>0;)_e--,ue>>=1,Ie>>=1,be=this.tiles[Er(_e,ue,Ie)];return be&&be.source?(ne>1&&(console.log("found parent tile z%d-%d-%d",_e,ue,Ie),console.time("drilling down")),this.splitTile(be.source,_e,ue,Ie,j,V,D),ne>1&&console.timeEnd("drilling down"),this.tiles[oe]?Pa(this.tiles[oe],ae):null):null}}function Er(ce,j,V){return 32*((1<<ce)*V+j)+ce}function qr(ce,j){return j?ce.properties[j]:ce.id}function Ia(ce,j){if(ce==null)return!0;if(ce.type==="Feature")return qr(ce,j)!=null;if(ce.type==="FeatureCollection"){const V=new Set;for(const D of ce.features){const Y=qr(D,j);if(Y==null||V.has(Y))return!1;V.add(Y)}return!0}return!1}function ys(ce,j){const V=new Map;if(ce!=null)if(ce.type==="Feature")V.set(qr(ce,j),ce);else for(const D of ce.features)V.set(qr(D,j),D);return V}class oo extends Ue{constructor(){super(...arguments),this._dataUpdateable=new Map}loadVectorTile(j,V){return M._(this,void 0,void 0,function*(){const D=j.tileID.canonical;if(!this._geoJSONIndex)throw new Error("Unable to parse the data into a cluster or geojson");const Y=this._geoJSONIndex.getTile(D.z,D.x,D.y);if(!Y)return null;const ae=new Ri(Y.features);let ne=Vr(ae);return ne.byteOffset===0&&ne.byteLength===ne.buffer.byteLength||(ne=new Uint8Array(ne)),{vectorTile:ae,rawData:ne.buffer}})}loadData(j){return M._(this,void 0,void 0,function*(){var V;(V=this._pendingRequest)===null||V===void 0||V.abort();const D=!!(j&&j.request&&j.request.collectResourceTiming)&&new M.cA(j.request);this._pendingRequest=new AbortController;try{this._pendingData=this.loadAndProcessGeoJSON(j,this._pendingRequest),this._geoJSONIndex=j.cluster?new St(function({superclusterOptions:ne,clusterProperties:he}){if(!he||!ne)return ne;const oe={},be={},_e={accumulated:null,zoom:0},ue={properties:null},Ie=Object.keys(he);for(const je of Ie){const[Ne,ye]=he[je],nt=M.cH(ye),Je=M.cH(typeof Ne=="string"?[Ne,["accumulated"],["get",je]]:Ne);oe[je]=nt.value,be[je]=Je.value}return ne.map=je=>{ue.properties=je;const Ne={};for(const ye of Ie)Ne[ye]=oe[ye].evaluate(_e,ue);return Ne},ne.reduce=(je,Ne)=>{ue.properties=Ne;for(const ye of Ie)_e.accumulated=je[ye],je[ye]=be[ye].evaluate(_e,ue)},ne}(j)).load((yield this._pendingData).features):(Y=yield this._pendingData,new Gr(Y,j.geojsonVtOptions)),this.loaded={};const ae={};if(D){const ne=D.finish();ne&&(ae.resourceTiming={},ae.resourceTiming[j.source]=JSON.parse(JSON.stringify(ne)))}return ae}catch(ae){if(delete this._pendingRequest,M.cl(ae))return{abandoned:!0};throw ae}var Y})}getData(){return M._(this,void 0,void 0,function*(){return this._pendingData})}reloadTile(j){const V=this.loaded;return V&&V[j.uid]?super.reloadTile(j):this.loadTile(j)}loadAndProcessGeoJSON(j,V){return M._(this,void 0,void 0,function*(){let D=yield this.loadGeoJSON(j,V);if(delete this._pendingRequest,typeof D!="object")throw new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`);if(xi(D,!0),j.filter){const Y=M.cH(j.filter,{type:"boolean","property-type":"data-driven",overridable:!1,transition:!1});if(Y.result==="error")throw new Error(Y.value.map(ne=>`${ne.key}: ${ne.message}`).join(", "));D={type:"FeatureCollection",features:D.features.filter(ne=>Y.value.evaluate({zoom:0},ne))}}return D})}loadGeoJSON(j,V){return M._(this,void 0,void 0,function*(){const{promoteId:D}=j;if(j.request){const Y=yield M.j(j.request,V);return this._dataUpdateable=Ia(Y.data,D)?ys(Y.data,D):void 0,Y.data}if(typeof j.data=="string")try{const Y=JSON.parse(j.data);return this._dataUpdateable=Ia(Y,D)?ys(Y,D):void 0,Y}catch{throw new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`)}if(!j.dataDiff)throw new Error(`Input data given to '${j.source}' is not a valid GeoJSON object.`);if(!this._dataUpdateable)throw new Error(`Cannot update existing geojson data in ${j.source}`);return function(Y,ae,ne){var he,oe,be,_e;if(ae.removeAll&&Y.clear(),ae.remove)for(const ue of ae.remove)Y.delete(ue);if(ae.add)for(const ue of ae.add){const Ie=qr(ue,ne);Ie!=null&&Y.set(Ie,ue)}if(ae.update)for(const ue of ae.update){let Ie=Y.get(ue.id);if(Ie==null)continue;const je=!ue.removeAllProperties&&(((he=ue.removeProperties)===null||he===void 0?void 0:he.length)>0||((oe=ue.addOrUpdateProperties)===null||oe===void 0?void 0:oe.length)>0);if((ue.newGeometry||ue.removeAllProperties||je)&&(Ie=Object.assign({},Ie),Y.set(ue.id,Ie),je&&(Ie.properties=Object.assign({},Ie.properties))),ue.newGeometry&&(Ie.geometry=ue.newGeometry),ue.removeAllProperties)Ie.properties={};else if(((be=ue.removeProperties)===null||be===void 0?void 0:be.length)>0)for(const Ne of ue.removeProperties)Object.prototype.hasOwnProperty.call(Ie.properties,Ne)&&delete Ie.properties[Ne];if(((_e=ue.addOrUpdateProperties)===null||_e===void 0?void 0:_e.length)>0)for(const{key:Ne,value:ye}of ue.addOrUpdateProperties)Ie.properties[Ne]=ye}}(this._dataUpdateable,j.dataDiff,D),{type:"FeatureCollection",features:Array.from(this._dataUpdateable.values())}})}removeSource(j){return M._(this,void 0,void 0,function*(){this._pendingRequest&&this._pendingRequest.abort()})}getClusterExpansionZoom(j){return this._geoJSONIndex.getClusterExpansionZoom(j.clusterId)}getClusterChildren(j){return this._geoJSONIndex.getChildren(j.clusterId)}getClusterLeaves(j){return this._geoJSONIndex.getLeaves(j.clusterId,j.limit,j.offset)}}class Wr{constructor(j){this.self=j,this.actor=new M.H(j),this.layerIndexes={},this.availableImages={},this.workerSources={},this.demWorkerSources={},this.externalWorkerSourceTypes={},this.self.registerWorkerSource=(V,D)=>{if(this.externalWorkerSourceTypes[V])throw new Error(`Worker source with name "${V}" already registered.`);this.externalWorkerSourceTypes[V]=D},this.self.addProtocol=M.cn,this.self.removeProtocol=M.co,this.self.registerRTLTextPlugin=V=>{M.cI.setMethods(V)},this.actor.registerMessageHandler("LDT",(V,D)=>this._getDEMWorkerSource(V,D.source).loadTile(D)),this.actor.registerMessageHandler("RDT",(V,D)=>M._(this,void 0,void 0,function*(){this._getDEMWorkerSource(V,D.source).removeTile(D)})),this.actor.registerMessageHandler("GCEZ",(V,D)=>M._(this,void 0,void 0,function*(){return this._getWorkerSource(V,D.type,D.source).getClusterExpansionZoom(D)})),this.actor.registerMessageHandler("GCC",(V,D)=>M._(this,void 0,void 0,function*(){return this._getWorkerSource(V,D.type,D.source).getClusterChildren(D)})),this.actor.registerMessageHandler("GCL",(V,D)=>M._(this,void 0,void 0,function*(){return this._getWorkerSource(V,D.type,D.source).getClusterLeaves(D)})),this.actor.registerMessageHandler("LD",(V,D)=>this._getWorkerSource(V,D.type,D.source).loadData(D)),this.actor.registerMessageHandler("GD",(V,D)=>this._getWorkerSource(V,D.type,D.source).getData()),this.actor.registerMessageHandler("LT",(V,D)=>this._getWorkerSource(V,D.type,D.source).loadTile(D)),this.actor.registerMessageHandler("RT",(V,D)=>this._getWorkerSource(V,D.type,D.source).reloadTile(D)),this.actor.registerMessageHandler("AT",(V,D)=>this._getWorkerSource(V,D.type,D.source).abortTile(D)),this.actor.registerMessageHandler("RMT",(V,D)=>this._getWorkerSource(V,D.type,D.source).removeTile(D)),this.actor.registerMessageHandler("RS",(V,D)=>M._(this,void 0,void 0,function*(){if(!this.workerSources[V]||!this.workerSources[V][D.type]||!this.workerSources[V][D.type][D.source])return;const Y=this.workerSources[V][D.type][D.source];delete this.workerSources[V][D.type][D.source],Y.removeSource!==void 0&&Y.removeSource(D)})),this.actor.registerMessageHandler("RM",V=>M._(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,D)=>M._(this,void 0,void 0,function*(){this.referrer=D})),this.actor.registerMessageHandler("SRPS",(V,D)=>this._syncRTLPluginState(V,D)),this.actor.registerMessageHandler("IS",(V,D)=>M._(this,void 0,void 0,function*(){this.self.importScripts(D)})),this.actor.registerMessageHandler("SI",(V,D)=>this._setImages(V,D)),this.actor.registerMessageHandler("UL",(V,D)=>M._(this,void 0,void 0,function*(){this._getLayerIndex(V).update(D.layers,D.removedIds)})),this.actor.registerMessageHandler("SL",(V,D)=>M._(this,void 0,void 0,function*(){this._getLayerIndex(V).replace(D)}))}_setImages(j,V){return M._(this,void 0,void 0,function*(){this.availableImages[j]=V;for(const D in this.workerSources[j]){const Y=this.workerSources[j][D];for(const ae in Y)Y[ae].availableImages=V}})}_syncRTLPluginState(j,V){return M._(this,void 0,void 0,function*(){return yield M.cI.syncState(V,this.self.importScripts)})}_getAvailableImages(j){let V=this.availableImages[j];return V||(V=[]),V}_getLayerIndex(j){let V=this.layerIndexes[j];return V||(V=this.layerIndexes[j]=new c),V}_getWorkerSource(j,V,D){if(this.workerSources[j]||(this.workerSources[j]={}),this.workerSources[j][V]||(this.workerSources[j][V]={}),!this.workerSources[j][V][D]){const Y={sendAsync:(ae,ne)=>(ae.targetMapId=j,this.actor.sendAsync(ae,ne))};switch(V){case"vector":this.workerSources[j][V][D]=new Ue(Y,this._getLayerIndex(j),this._getAvailableImages(j));break;case"geojson":this.workerSources[j][V][D]=new oo(Y,this._getLayerIndex(j),this._getAvailableImages(j));break;default:this.workerSources[j][V][D]=new this.externalWorkerSourceTypes[V](Y,this._getLayerIndex(j),this._getAvailableImages(j))}}return this.workerSources[j][V][D]}_getDEMWorkerSource(j,V){return this.demWorkerSources[j]||(this.demWorkerSources[j]={}),this.demWorkerSources[j][V]||(this.demWorkerSources[j][V]=new Ae),this.demWorkerSources[j][V]}}return M.i(self)&&(self.worker=new Wr(self)),Wr}),B("index",["exports","./shared"],function(M,c){var Te="5.3.0";function ge(){var u=new c.A(4);return c.A!=Float32Array&&(u[1]=0,u[2]=0),u[0]=1,u[3]=1,u}let ke,Ue;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=>{o(),e(h)}),{unsubscribe:o}=c.s(u.signal,"abort",()=>{o(),cancelAnimationFrame(s),i(c.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=>(ke||(ke=document.createElement("a")),ke.href=u,ke.href),hardwareConcurrency:typeof navigator<"u"&&navigator.hardwareConcurrency||4,get prefersReducedMotion(){return!!matchMedia&&(Ue==null&&(Ue=matchMedia("(prefers-reduced-motion: reduce)")),Ue.matches)}};class le{static testProp(e){if(!le.docStyle)return e[0];for(let i=0;i<e.length;i++)if(e[i]in le.docStyle)return e[i];return e[0]}static create(e,i,s){const o=window.document.createElement(e);return i!==void 0&&(o.className=i),s&&s.appendChild(o),o}static createNS(e,i){return window.document.createElementNS(e,i)}static disableDrag(){le.docStyle&&le.selectProp&&(le.userSelect=le.docStyle[le.selectProp],le.docStyle[le.selectProp]="none")}static enableDrag(){le.docStyle&&le.selectProp&&(le.docStyle[le.selectProp]=le.userSelect)}static setTransform(e,i){e.style[le.transformProp]=i}static addEventListener(e,i,s,o={}){e.addEventListener(i,s,"passive"in o?o:o.capture)}static removeEventListener(e,i,s,o={}){e.removeEventListener(i,s,"passive"in o?o:o.capture)}static suppressClickInternal(e){e.preventDefault(),e.stopPropagation(),window.removeEventListener("click",le.suppressClickInternal,!0)}static suppressClick(){window.addEventListener("click",le.suppressClickInternal,!0),window.setTimeout(()=>{window.removeEventListener("click",le.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 o=i.boundingClientRect;return new c.P((s.clientX-o.left)/i.x-e.clientLeft,(s.clientY-o.top)/i.y-e.clientTop)}static mousePos(e,i){const s=le.getScale(e);return le.getPoint(e,s,i)}static touchPos(e,i){const s=[],o=le.getScale(e);for(let h=0;h<i.length;h++)s.push(le.getPoint(e,o,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 o of s)o.remove();return le.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)le.removeAttributes(s),le.clean(s)}static removeAttributes(e){for(const{name:i,value:s}of e.attributes)le.isPossiblyDangerous(i,s)&&e.removeAttribute(i)}}le.docStyle=typeof window<"u"&&window.document&&window.document.documentElement.style,le.selectProp=le.testProp(["userSelect","MozUserSelect","WebkitUserSelect","msUserSelect"]),le.transformProp=le.testProp(["transform","WebkitTransform"]);const Ze={supported:!1,testSupport:function(u){!ji&&xi&&(Mi?Ri(u):Xt=u)}};let Xt,xi,ji=!1,Mi=!1;function Ri(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,xi),u.isContextLost())return;Ze.supported=!0}catch{}u.deleteTexture(e),ji=!0}var ri;typeof document<"u"&&(xi=document.createElement("img"),xi.onload=()=>{Xt&&Ri(Xt),Xt=null,Mi=!0},xi.onerror=()=>{ji=!0,Xt=null},xi.src="data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAQAAAAfQ//73v/+BiOh/AAA="),function(u){let e,i,s,o;u.resetRequestQueue=()=>{e=[],i=0,s=0,o={}},u.addThrottleControl=x=>{const w=s++;return o[w]=x,w},u.removeThrottleControl=x=>{delete o[x],f()},u.getImage=(x,w,I=!0)=>new Promise((z,C)=>{Ze.supported&&(x.headers||(x.headers={}),x.headers.accept="image/webp,*/*"),c.e(x,{type:"image"}),e.push({abortController:w,requestParameters:x,supportImageRefresh:I,state:"queued",onError:F=>{C(F)},onSuccess:F=>{z(F)}}),f()});const h=x=>c._(this,void 0,void 0,function*(){x.state="running";const{requestParameters:w,supportImageRefresh:I,onError:z,onSuccess:C,abortController:F}=x,N=I===!1&&!c.i(self)&&!c.g(w.url)&&(!w.headers||Object.keys(w.headers).reduce((W,K)=>W&&K==="accept",!0));i++;const q=N?_(w,F):c.m(w,F);try{const W=yield q;delete x.abortController,x.state="completed",W.data instanceof HTMLImageElement||c.b(W.data)?C(W):W.data&&C({data:yield(G=W.data,typeof createImageBitmap=="function"?c.f(G):c.h(G)),cacheControl:W.cacheControl,expires:W.expires})}catch(W){delete x.abortController,z(W)}finally{i--,f()}var G}),f=()=>{const x=(()=>{for(const w of Object.keys(o))if(o[w]())return!0;return!1})()?c.a.MAX_PARALLEL_IMAGE_REQUESTS_PER_FRAME:c.a.MAX_PARALLEL_IMAGE_REQUESTS;for(let w=i;w<x&&e.length>0;w++){const I=e.shift();I.abortController.signal.aborted?w--:h(I)}},_=(x,w)=>new Promise((I,z)=>{const C=new Image,F=x.url,N=x.credentials;N&&N==="include"?C.crossOrigin="use-credentials":(N&&N==="same-origin"||!c.d(F))&&(C.crossOrigin="anonymous"),w.signal.addEventListener("abort",()=>{C.src="",z(c.c())}),C.fetchPriority="high",C.onload=()=>{C.onerror=C.onload=null,I({data:C})},C.onerror=()=>{C.onerror=C.onload=null,w.signal.aborted||z(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."))},C.src=F})}(ri||(ri={})),ri.resetRequestQueue();class dr{constructor(e){this._transformRequestFn=e}transformRequest(e,i){return this._transformRequestFn&&this._transformRequestFn(e,i)||{url:e}}setTransformRequest(e){this._transformRequestFn=e}}function Rt(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:o}of u){const h=`${s}${o}`;i.indexOf(h)===-1&&(i.push(h),e.push({id:s,url:o}))}}return e}function kt(u,e,i){try{const s=new URL(u);return s.pathname+=`${e}${i}`,s.toString()}catch{throw new Error(`Invalid sprite URL "${u}", must be absolute. Modify style specification directly or use TransformStyleFunction to correct the issue dynamically`)}}class Zt{constructor(e,i,s,o){this.context=e,this.format=s,this.texture=e.gl.createTexture(),this.update(i,o)}update(e,i,s){const{width:o,height:h}=e,f=!(this.size&&this.size[0]===o&&this.size[1]===h||s),{context:_}=this,{gl:x}=_;if(this.useMipmap=!!(i&&i.useMipmap),x.bindTexture(x.TEXTURE_2D,this.texture),_.pixelStoreUnpackFlipY.set(!1),_.pixelStoreUnpack.set(1),_.pixelStoreUnpackPremultiplyAlpha.set(this.format===x.RGBA&&(!i||i.premultiply!==!1)),f)this.size=[o,h],e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||c.b(e)?x.texImage2D(x.TEXTURE_2D,0,this.format,this.format,x.UNSIGNED_BYTE,e):x.texImage2D(x.TEXTURE_2D,0,this.format,o,h,0,this.format,x.UNSIGNED_BYTE,e.data);else{const{x:w,y:I}=s||{x:0,y:0};e instanceof HTMLImageElement||e instanceof HTMLCanvasElement||e instanceof HTMLVideoElement||e instanceof ImageData||c.b(e)?x.texSubImage2D(x.TEXTURE_2D,0,w,I,x.RGBA,x.UNSIGNED_BYTE,e):x.texSubImage2D(x.TEXTURE_2D,0,w,I,o,h,x.RGBA,x.UNSIGNED_BYTE,e.data)}this.useMipmap&&this.isSizePowerOfTwo()&&x.generateMipmap(x.TEXTURE_2D)}bind(e,i,s){const{context:o}=this,{gl:h}=o;h.bindTexture(h.TEXTURE_2D,this.texture),s!==h.LINEAR_MIPMAP_NEAREST||this.isSizePowerOfTwo()||(s=h.LINEAR),e!==this.filter&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MAG_FILTER,e),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_MIN_FILTER,s||e),this.filter=e),i!==this.wrap&&(h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_S,i),h.texParameteri(h.TEXTURE_2D,h.TEXTURE_WRAP_T,i),this.wrap=i)}isSizePowerOfTwo(){return this.size[0]===this.size[1]&&Math.log(this.size[0])/Math.LN2%1==0}destroy(){const{gl:e}=this.context;e.deleteTexture(this.texture),this.texture=null}}function Vr(u){const{userImage:e}=u;return!!(e&&e.render&&e.render())&&(u.data.replace(new Uint8Array(e.data.buffer)),!0)}class ba extends c.E{constructor(){super(),this.images={},this.updatedImages={},this.callbackDispatchedThisFrame={},this.loaded=!1,this.requestors=[],this.patterns={},this.atlasImage=new c.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 c.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 o=i.data||i.spriteData;return this._validateStretch(i.stretchX,o&&o.width)||(this.fire(new c.k(new Error(`Image "${e}" has invalid "stretchX" value`))),s=!1),this._validateStretch(i.stretchY,o&&o.height)||(this.fire(new c.k(new Error(`Image "${e}" has invalid "stretchY" value`))),s=!1),this._validateContent(i.content,i)||(this.fire(new c.k(new Error(`Image "${e}" has invalid "content" value`))),s=!1),s}_validateStretch(e,i){if(!e)return!0;let s=0;for(const o of e){if(o[0]<s||o[1]<o[0]||i<o[1])return!1;s=o[1]}return!0}_validateContent(e,i){if(!e)return!0;if(e.length!==4)return!1;const s=i.spriteData,o=s&&s.width||i.data.width,h=s&&s.height||i.data.height;return!(e[0]<0||o<e[0]||e[1]<0||h<e[1]||e[2]<0||o<e[2]||e[3]<0||h<e[3]||e[2]<e[0]||e[3]<e[1])}updateImage(e,i,s=!0){const o=this.getImage(e);if(s&&(o.data.width!==i.data.width||o.data.height!==i.data.height))throw new Error(`size mismatch between old image (${o.data.width}x${o.data.height}) and new image (${i.data.width}x${i.data.height}).`);i.version=o.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 o=!0;if(!this.isLoaded())for(const h of e)this.images[h]||(o=!1);this.isLoaded()||o?i(this._getImagesForIds(e)):this.requestors.push({ids:e,promiseResolve:i})})}_getImagesForIds(e){const i={};for(const s of e){let o=this.getImage(s);o||(this.fire(new c.l("styleimagemissing",{id:s})),o=this.getImage(s)),o?i[s]={data:o.data.clone(),pixelRatio:o.pixelRatio,sdf:o.sdf,version:o.version,stretchX:o.stretchX,stretchY:o.stretchY,content:o.content,textFitWidth:o.textFitWidth,textFitHeight:o.textFitHeight,hasRenderCallback:!!(o.userImage&&o.userImage.render)}:c.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 o={w:s.data.width+2,h:s.data.height+2,x:0,y:0},h=new c.I(o,s);this.patterns[e]={bin:o,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 Zt(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}=c.p(e),o=this.atlasImage;o.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,w=this.getImage(h).data,I=w.width,z=w.height;c.R.copy(w,o,{x:0,y:0},{x:_,y:x},{width:I,height:z}),c.R.copy(w,o,{x:0,y:z-1},{x:_,y:x-1},{width:I,height:1}),c.R.copy(w,o,{x:0,y:0},{x:_,y:x+z},{width:I,height:1}),c.R.copy(w,o,{x:I-1,y:0},{x:_-1,y:x},{width:1,height:z}),c.R.copy(w,o,{x:0,y:0},{x:_+I,y:x},{width:1,height:z})}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||c.w(`Image with ID: "${i}" was not found`),Vr(s)&&this.updateImage(i,s)}}}const wt=1e20;function Ur(u,e,i,s,o,h,f,_,x){for(let w=e;w<e+s;w++)rr(u,i*h+w,h,o,f,_,x);for(let w=i;w<i+o;w++)rr(u,w*h+e,1,s,f,_,x)}function rr(u,e,i,s,o,h,f){h[0]=0,f[0]=-1e20,f[1]=wt,o[0]=u[e];for(let _=1,x=0,w=0;_<s;_++){o[_]=u[e+_*i];const I=_*_;do{const z=h[x];w=(o[_]-o[z]+I-z*z)/(_-z)/2}while(w<=f[x]&&--x>-1);x++,h[x]=_,f[x]=w,f[x+1]=wt}for(let _=0,x=0;_<s;_++){for(;f[x+1]<_;)x++;const w=h[x],I=_-w;u[e+_*i]=o[w]+I*I}}class Ii{constructor(e,i){this.requestManager=e,this.localIdeographFontFamily=i,this.entries={}}setURL(e){this.url=e}getGlyphs(e){return c._(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),o={};for(const{stack:h,id:f,glyph:_}of s)o[h]||(o[h]={}),o[h][f]=_&&{id:_.id,bitmap:_.bitmap.clone(),metrics:_.metrics};return o})}_getAndCacheGlyphsPromise(e,i){return c._(this,void 0,void 0,function*(){let s=this.entries[e];s||(s=this.entries[e]={glyphs:{},requests:{},ranges:{}});let o=s.glyphs[i];if(o!==void 0)return{stack:e,id:i,glyph:o};if(o=this._tinySDF(s,e,i),o)return s.glyphs[i]=o,{stack:e,id:i,glyph:o};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:o};if(!this.url)throw new Error("glyphsUrl is not set");if(!s.requests[h]){const _=Ii.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))||c.u["CJK Unified Ideographs"](e)||c.u["Hangul Syllables"](e)||c.u.Hiragana(e)||c.u.Katakana(e)||c.u["CJK Symbols and Punctuation"](e)||c.u["Halfwidth and Fullwidth Forms"](e))}_tinySDF(e,i,s){const o=this.localIdeographFontFamily;if(!o||!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 Ii.TinySDF({fontSize:48,buffer:6,radius:16,cutoff:.25,fontFamily:o,fontWeight:_})}const f=h.draw(String.fromCharCode(s));return{id:s,bitmap:new c.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}}}}Ii.loadGlyphRange=function(u,e,i,s){return c._(this,void 0,void 0,function*(){const o=256*e,h=o+255,f=s.transformRequest(i.replace("{fontstack}",u).replace("{range}",`${o}-${h}`),"Glyphs"),_=yield c.n(f,new AbortController);if(!_||!_.data)throw new Error(`Could not load glyph range. range: ${e}, ${o}-${h}`);const x={};for(const w of c.o(_.data))x[w.id]=w;return x})},Ii.TinySDF=class{constructor({fontSize:u=24,buffer:e=3,radius:i=8,cutoff:s=.25,fontFamily:o="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(_),w=this.ctx=x.getContext("2d",{willReadFrequently:!0});w.font=`${f} ${h} ${u}px ${o}`,w.textBaseline="alphabetic",w.textAlign="left",w.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:o,actualBoundingBoxRight:h}=this.ctx.measureText(u),f=Math.ceil(i),_=Math.max(0,Math.min(this.size-this.buffer,Math.ceil(h-o))),x=Math.min(this.size-this.buffer,f+Math.ceil(s)),w=_+2*this.buffer,I=x+2*this.buffer,z=Math.max(w*I,0),C=new Uint8ClampedArray(z),F={data:C,width:w,height:I,glyphWidth:_,glyphHeight:x,glyphTop:f,glyphLeft:0,glyphAdvance:e};if(_===0||x===0)return F;const{ctx:N,buffer:q,gridInner:G,gridOuter:W}=this;N.clearRect(q,q,_,x),N.fillText(u,q,q+f);const K=N.getImageData(q,q,_,x);W.fill(wt,0,z),G.fill(0,0,z);for(let Q=0;Q<x;Q++)for(let ee=0;ee<_;ee++){const te=K.data[4*(Q*_+ee)+3]/255;if(te===0)continue;const se=(Q+q)*w+ee+q;if(te===1)W[se]=0,G[se]=wt;else{const ie=.5-te;W[se]=ie>0?ie*ie:0,G[se]=ie<0?ie*ie:0}}Ur(W,0,0,w,I,w,this.f,this.v,this.z),Ur(G,q,q,_,x,w,this.f,this.v,this.z);for(let Q=0;Q<z;Q++){const ee=Math.sqrt(W[Q])-Math.sqrt(G[Q]);C[Q]=Math.round(255-255*(ee/this.radius+this.cutoff))}return F}};class ms{constructor(){this.specification=c.v.light.position}possiblyEvaluate(e,i){return c.z(e.expression.evaluate(i))}interpolate(e,i,s){return{x:c.B.number(e.x,i.x,s),y:c.B.number(e.y,i.y,s),z:c.B.number(e.z,i.z,s)}}}let St;class wa extends c.E{constructor(e){super(),St=St||new c.r({anchor:new c.D(c.v.light.anchor),position:new ms,color:new c.D(c.v.light.color),intensity:new c.D(c.v.light.intensity)}),this._transitionable=new c.T(St),this.setLight(e),this._transitioning=this._transitionable.untransitioned()}getLight(){return this._transitionable.serialize()}setLight(e,i={}){if(!this._validate(c.t,e,i))for(const s in e){const o=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),o):this._transitionable.setValue(s,o)}}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)&&c.x(this,e.call(c.y,{value:i,style:{glyphs:!0,sprite:!0},styleSpec:c.v}))}}const mn=new c.r({"sky-color":new c.D(c.v.sky["sky-color"]),"horizon-color":new c.D(c.v.sky["horizon-color"]),"fog-color":new c.D(c.v.sky["fog-color"]),"fog-ground-blend":new c.D(c.v.sky["fog-ground-blend"]),"horizon-fog-blend":new c.D(c.v.sky["horizon-fog-blend"]),"sky-horizon-blend":new c.D(c.v.sky["sky-horizon-blend"]),"atmosphere-blend":new c.D(c.v.sky["atmosphere-blend"])});class jn extends c.E{constructor(e){super(),this._transitionable=new c.T(mn),this.setSky(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new c.C(0))}setSky(e,i={}){if(!this._validate(c.F,e,i)){e||(e={"sky-color":"transparent","horizon-color":"transparent","fog-color":"transparent","fog-ground-blend":1,"atmosphere-blend":0});for(const s in e){const o=e[s];s.endsWith("-transition")?this._transitionable.setTransition(s.slice(0,-11),o):this._transitionable.setValue(s,o)}}}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&&c.x(this,e.call(c.y,c.e({value:i,style:{glyphs:!0,sprite:!0},styleSpec:c.v})))}calculateFogBlendOpacity(e){return e<60?0:e<70?(e-60)/10:1}}class Nn{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 o=[];let h=e.length%2==1?-e[e.length-1]*s:0,f=e[0]*s,_=!0;o.push({left:h,right:f,isDash:_,zeroLength:e[0]===0});let x=e[0];for(let w=1;w<e.length;w++){_=!_;const I=e[w];h=x*s,x+=I,f=x*s,o.push({left:h,right:f,isDash:_,zeroLength:I===0})}return o}addRoundDash(e,i,s){const o=i/2;for(let h=-s;h<=s;h++){const f=this.width*(this.nextRow+s+h);let _=0,x=e[_];for(let w=0;w<this.width;w++){w/x.right>1&&(x=e[++_]);const I=Math.abs(w-x.left),z=Math.abs(w-x.right),C=Math.min(I,z);let F;const N=h/s*(o+1);if(x.isDash){const q=o-Math.abs(N);F=Math.sqrt(C*C+q*q)}else F=o-Math.sqrt(C*C+N*N);this.data[f+w]=Math.max(0,Math.min(255,F+128))}}}addRegularDash(e){for(let _=e.length-1;_>=0;--_){const x=e[_],w=e[_+1];x.zeroLength?e.splice(_,1):w&&w.isDash===x.isDash&&(w.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 o=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),w=Math.abs(_-f.right),I=Math.min(x,w);this.data[o+_]=Math.max(0,Math.min(255,(f.isDash?I:-I)+128))}}addDash(e,i){const s=i?7:0,o=2*s+1;if(this.nextRow+o>this.height)return c.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+=o,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 Ta="maplibre_preloaded_worker_pool";class Cr{constructor(){this.active={}}acquire(e){if(!this.workers)for(this.workers=[];this.workers.length<Cr.workerCount;)this.workers.push(new Worker(c.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[Ta]}numActive(){return Object.keys(this.active).length}}const pr=Math.floor(Ae.hardwareConcurrency/2);let nr,vi;function Zn(){return nr||(nr=new Cr),nr}Cr.workerCount=c.G(globalThis)?Math.max(Math.min(pr,3),1):1;class Vn{constructor(e,i){this.workerPool=e,this.actors=[],this.currentActor=0,this.id=i;const s=this.workerPool.acquire(i);for(let o=0;o<s.length;o++){const h=new c.H(s[o],i);h.name=`Worker ${o}`,this.actors.push(h)}if(!this.actors.length)throw new Error("No actors found")}broadcast(e,i){const s=[];for(const o of this.actors)s.push(o.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 Un(){return vi||(vi=new Vn(Zn(),c.J),vi.registerMessageHandler("GR",(u,e,i)=>c.m(e,i))),vi}function Xi(u,e){const i=c.K();return c.L(i,i,[1,1,0]),c.M(i,i,[.5*u.width,.5*u.height,1]),u.calculatePosMatrix?c.N(i,i,u.calculatePosMatrix(e.toUnwrapped())):i}function gs(u,e,i,s,o,h,f){var _;const x=function(C,F,N){if(C)for(const q of C){const G=F[q];if(G&&G.source===N&&G.type==="fill-extrusion")return!0}else for(const q in F){const G=F[q];if(G.source===N&&G.type==="fill-extrusion")return!0}return!1}((_=o==null?void 0:o.layers)!==null&&_!==void 0?_:null,e,u.id),w=h.maxPitchScaleFactor(),I=u.tilesIn(s,w,x);I.sort(Ci);const z=[];for(const C of I)z.push({wrappedTileID:C.tileID.wrapped().key,queryResults:C.tile.queryRenderedFeatures(e,i,u._state,C.queryGeometry,C.cameraQueryGeometry,C.scale,o,h,w,Xi(u.transform,C.tileID),f?(F,N)=>f(C.tileID,F,N):void 0)});return function(C,F){for(const N in C)for(const q of C[N])oi(q,F);return C}(function(C){const F={},N={};for(const q of C){const G=q.queryResults,W=q.wrappedTileID,K=N[W]=N[W]||{};for(const Q in G){const ee=G[Q],te=K[Q]=K[Q]||{},se=F[Q]=F[Q]||[];for(const ie of ee)te[ie.featureIndex]||(te[ie.featureIndex]=!0,se.push(ie))}}return F}(z),u)}function Ci(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 oi(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 $r(u,e,i){return c._(this,void 0,void 0,function*(){let s=u;if(u.url?s=(yield c.j(e.transformRequest(u.url,"Source"),i)).data:yield Ae.frameAsync(i),!s)return null;const o=c.O(c.e(s,u),["tiles","minzoom","maxzoom","attribution","bounds","scheme","tileSize","encoding"]);return"vector_layers"in s&&s.vector_layers&&(o.vectorLayerIds=s.vector_layers.map(h=>h.id)),o})}class Yt{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 c.Q?new c.Q(e.lng,e.lat):c.Q.convert(e),this}setSouthWest(e){return this._sw=e instanceof c.Q?new c.Q(e.lng,e.lat):c.Q.convert(e),this}extend(e){const i=this._sw,s=this._ne;let o,h;if(e instanceof c.Q)o=e,h=e;else{if(!(e instanceof Yt))return Array.isArray(e)?e.length===4||e.every(Array.isArray)?this.extend(Yt.convert(e)):this.extend(c.Q.convert(e)):e&&("lng"in e||"lon"in e)&&"lat"in e?this.extend(c.Q.convert(e)):this;if(o=e._sw,h=e._ne,!o||!h)return this}return i||s?(i.lng=Math.min(o.lng,i.lng),i.lat=Math.min(o.lat,i.lat),s.lng=Math.max(h.lng,s.lng),s.lat=Math.max(h.lat,s.lat)):(this._sw=new c.Q(o.lng,o.lat),this._ne=new c.Q(h.lng,h.lat)),this}getCenter(){return new c.Q((this._sw.lng+this._ne.lng)/2,(this._sw.lat+this._ne.lat)/2)}getSouthWest(){return this._sw}getNorthEast(){return this._ne}getNorthWest(){return new c.Q(this.getWest(),this.getNorth())}getSouthEast(){return new c.Q(this.getEast(),this.getSouth())}getWest(){return this._sw.lng}getSouth(){return this._sw.lat}getEast(){return this._ne.lng}getNorth(){return this._ne.lat}toArray(){return[this._sw.toArray(),this._ne.toArray()]}toString(){return`LngLatBounds(${this._sw.toString()}, ${this._ne.toString()})`}isEmpty(){return!(this._sw&&this._ne)}contains(e){const{lng:i,lat:s}=c.Q.convert(e);let o=this._sw.lng<=i&&i<=this._ne.lng;return this._sw.lng>this._ne.lng&&(o=this._sw.lng>=i&&i>=this._ne.lng),this._sw.lat<=s&&s<=this._ne.lat&&o}static convert(e){return e instanceof Yt?e:e&&new Yt(e)}static fromLngLat(e,i=0){const s=360*i/40075017,o=s/Math.cos(Math.PI/180*e.lat);return new Yt(new c.Q(e.lng-o,e.lat-s),new c.Q(e.lng+o,e.lat+s))}adjustAntiMeridian(){const e=new c.Q(this._sw.lng,this._sw.lat),i=new c.Q(this._ne.lng,this._ne.lat);return new Yt(e,e.lng>i.lng?new c.Q(i.lng+360,i.lat):i)}}class $n{constructor(e,i,s){this.bounds=Yt.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(c.U(this.bounds.getWest())*i),o=Math.floor(c.S(this.bounds.getNorth())*i),h=Math.ceil(c.U(this.bounds.getEast())*i),f=Math.ceil(c.S(this.bounds.getSouth())*i);return e.x>=s&&e.x<h&&e.y>=o&&e.y<f}}class Gn extends c.E{constructor(e,i,s,o){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,c.e(this,c.O(i,["url","scheme","tileSize","promoteId"])),this._options=c.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(o)}load(){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const e=yield $r(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,this.map.style.sourceCaches[this.id].clearTiles(),e&&(c.e(this,e),e.bounds&&(this.tileBounds=new $n(e.bounds,this.minzoom,this.maxzoom)),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.l("data",{dataType:"source",sourceDataType:"content"})))}catch(e){this._tileJSONRequest=null,this.fire(new c.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 c.e({},this._options)}loadTile(e){return c._(this,void 0,void 0,function*(){const i=e.tileID.canonical.url(this.tiles,this.map.getPixelRatio(),this.scheme),s={request:this.map._requestManager.transformRequest(i,"Tile"),uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,tileSize:this.tileSize*e.tileID.overscaleFactor(),type:this.type,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};s.request.collectResourceTiming=this._collectResourceTiming;let o="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(),o="LT";e.abortController=new AbortController;try{const h=yield e.actor.sendAsync({type:o,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 c._(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 c._(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 fr extends c.E{constructor(e,i,s,o){super(),this.id=e,this.dispatcher=s,this.setEventedParent(o),this.type="raster",this.minzoom=0,this.maxzoom=22,this.roundZoom=!0,this.scheme="xyz",this.tileSize=512,this._loaded=!1,this._options=c.e({type:"raster"},i),c.e(this,c.O(i,["url","scheme","tileSize"]))}load(){return c._(this,arguments,void 0,function*(e=!1){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this._tileJSONRequest=new AbortController;try{const i=yield $r(this._options,this.map._requestManager,this._tileJSONRequest);this._tileJSONRequest=null,this._loaded=!0,i&&(c.e(this,i),i.bounds&&(this.tileBounds=new $n(i.bounds,this.minzoom,this.maxzoom)),this.fire(new c.l("data",{dataType:"source",sourceDataType:"metadata"})),this.fire(new c.l("data",{dataType:"source",sourceDataType:"content",sourceDataChanged:e})))}catch(i){this._tileJSONRequest=null,this.fire(new c.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 c.e({},this._options)}hasTile(e){return!this.tileBounds||this.tileBounds.contains(e.canonical)}loadTile(e){return c._(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 ri.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 o=this.map.painter.context,h=o.gl,f=s.data;e.texture=this.map.painter.getTileTexture(f.width),e.texture?e.texture.update(f,{useMipmap:!0}):(e.texture=new Zt(o,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 c._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController)})}unloadTile(e){return c._(this,void 0,void 0,function*(){e.texture&&this.map.painter.saveTileTexture(e.texture)})}hasTransition(){return!1}}class gn extends fr{constructor(e,i,s,o){super(e,i,s,o),this.type="raster-dem",this.maxzoom=22,this._options=c.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 c._(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 o=yield ri.getImage(s,e.abortController,this.map._refreshExpiredTiles);if(delete e.abortController,e.aborted)return void(e.state="unloaded");if(o&&o.data){const h=o.data;this.map._refreshExpiredTiles&&o.cacheControl&&o.expires&&e.setExpiryData({cacheControl:o.cacheControl,expires:o.expires});const f=c.b(h)&&c.V()?h:yield this.readImageNow(h),_={type:this.type,uid:e.uid,source:this.id,rawImageData:f,encoding:this.encoding,redFactor:this.redFactor,greenFactor:this.greenFactor,blueFactor:this.blueFactor,baseShift:this.baseShift};if(!e.actor||e.state==="expired"){e.actor=this.dispatcher.getActor();const x=yield e.actor.sendAsync({type:"LDT",data:_});e.dem=x,e.needsHillshadePrepare=!0,e.needsTerrainPrepare=!0,e.state="loaded"}}}catch(o){if(delete e.abortController,e.aborted)e.state="unloaded";else if(o)throw e.state="errored",o}})}readImageNow(e){return c._(this,void 0,void 0,function*(){if(typeof VideoFrame<"u"&&c.W()){const i=e.width+2,s=e.height+2;try{return new c.R({width:i,height:s},yield c.X(e,-1,-1,i,s))}catch{}}return Ae.getImageData(e,1)})}_getNeighboringTiles(e){const i=e.canonical,s=Math.pow(2,i.z),o=(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 c.Y(e.overscaledZ,h,i.z,o,i.y).key]={backfilled:!1},x[new c.Y(e.overscaledZ,_,i.z,f,i.y).key]={backfilled:!1},i.y>0&&(x[new c.Y(e.overscaledZ,h,i.z,o,i.y-1).key]={backfilled:!1},x[new c.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y-1).key]={backfilled:!1},x[new c.Y(e.overscaledZ,_,i.z,f,i.y-1).key]={backfilled:!1}),i.y+1<s&&(x[new c.Y(e.overscaledZ,h,i.z,o,i.y+1).key]={backfilled:!1},x[new c.Y(e.overscaledZ,e.wrap,i.z,i.x,i.y+1).key]={backfilled:!1},x[new c.Y(e.overscaledZ,_,i.z,f,i.y+1).key]={backfilled:!1}),x}unloadTile(e){return c._(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 _n extends c.E{constructor(e,i,s,o){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(o),this._data=i.data,this._options=c.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&&c.w(`The maxzoom value "${this.maxzoom}" is expected to be greater than the clusterMaxZoom value "${i.clusterMaxZoom}".`),this.workerOptions=c.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:c.Z,maxZoom:this.maxzoom,lineMetrics:i.lineMetrics||!1,generateId:i.generateId||!1},superclusterOptions:{maxZoom:i.clusterMaxZoom!==void 0?i.clusterMaxZoom:this.maxzoom-1,minPoints:Math.max(2,i.clusterMinPoints||2),extent:c.Z,radius:this._pixelsToTileUnits(i.clusterRadius||50),log:!1,generateId:i.generateId||!1},clusterProperties:i.clusterProperties,filter:i.filter},i.workerOptions),typeof this.promoteId=="string"&&(this.workerOptions.promoteId=this.promoteId)}_pixelsToTileUnits(e){return e*(c.Z/this.tileSize)}load(){return c._(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 c._(this,void 0,void 0,function*(){const e=c.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 c._(this,void 0,void 0,function*(){const e=new Yt,i=yield this.getData();let s;switch(i.type){case"FeatureCollection":s=i.features.map(o=>this.getCoordinatesFromGeometry(o.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 o=0;o<s.length-1;o+=2)e.extend([s[o],s[o+1]]);return e})}setClusterOptions(e){return this.workerOptions.cluster=e.cluster,e&&(e.clusterRadius!==void 0&&(this.workerOptions.superclusterOptions.radius=this._pixelsToTileUnits(e.clusterRadius)),e.clusterMaxZoom!==void 0&&(this.workerOptions.superclusterOptions.maxZoom=e.clusterMaxZoom)),this._updateWorkerData(),this}getClusterExpansionZoom(e){return this.actor.sendAsync({type:"GCEZ",data:{type:this.type,clusterId:e,source:this.id}})}getClusterChildren(e){return this.actor.sendAsync({type:"GCC",data:{type:this.type,clusterId:e,source:this.id}})}getClusterLeaves(e,i,s){return this.actor.sendAsync({type:"GCL",data:{type:this.type,source:this.id,clusterId:e,limit:i,offset:s}})}_updateWorkerData(e){return c._(this,void 0,void 0,function*(){const i=c.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 c.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 c.l("dataabort",{dataType:"source"}));let o=null;s.resourceTiming&&s.resourceTiming[this.id]&&(o=s.resourceTiming[this.id].slice(0));const h={dataType:"source"};this._collectResourceTiming&&o&&o.length>0&&c.e(h,{resourceTiming:o}),this.fire(new c.l("data",Object.assign(Object.assign({},h),{sourceDataType:"metadata"}))),this.fire(new c.l("data",Object.assign(Object.assign({},h),{sourceDataType:"content"})))}catch(s){if(this._pendingLoads--,this._removed)return void this.fire(new c.l("dataabort",{dataType:"source"}));this.fire(new c.k(s))}})}loaded(){return this._pendingLoads===0}loadTile(e){return c._(this,void 0,void 0,function*(){const i=e.actor?"RT":"LT";e.actor=this.actor;const s={type:this.type,uid:e.uid,tileID:e.tileID,zoom:e.tileID.overscaledZ,maxZoom:this.maxzoom,tileSize:this.tileSize,source:this.id,pixelRatio:this.map.getPixelRatio(),showCollisionBoxes:this.map.showCollisionBoxes,promoteId:this.promoteId,subdivisionGranularity:this.map.style.projection.subdivisionGranularity};e.abortController=new AbortController;const o=yield this.actor.sendAsync({type:i,data:s},e.abortController);delete e.abortController,e.unloadVectorData(),e.aborted||e.loadVectorData(o,this.map.painter,i==="RT")})}abortTile(e){return c._(this,void 0,void 0,function*(){e.abortController&&(e.abortController.abort(),delete e.abortController),e.aborted=!0})}unloadTile(e){return c._(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 c.e({},this._options,{type:this.type,data:this._data})}hasTransition(){return!1}}class mr extends c.E{constructor(e,i,s,o){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(o),this.options=i}load(e){return c._(this,void 0,void 0,function*(){this._loaded=!1,this.fire(new c.l("dataloading",{dataType:"source"})),this.url=this.options.url,this._request=new AbortController;try{const i=yield ri.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 c.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 c.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(c.$.fromLngLat);var s;return this.tileID=function(o){let h=1/0,f=1/0,_=-1/0,x=-1/0;for(const C of o)h=Math.min(h,C.x),f=Math.min(f,C.y),_=Math.max(_,C.x),x=Math.max(x,C.y);const w=Math.max(_-h,x-f),I=Math.max(0,Math.floor(-Math.log(w)/Math.LN2)),z=Math.pow(2,I);return new c.a1(I,Math.floor((h+_)/2*z),Math.floor((f+x)/2*z))}(i),this.terrainTileRanges=this._getOverlappingTileRanges(i),this.minzoom=this.maxzoom=this.tileID.z,this.tileCoords=i.map(o=>this.tileID.getTilePoint(o)._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 c.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 Zt(e,this.image,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const o in this.tiles){const h=this.tiles[o];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new c.l("data",{dataType:"source",sourceDataType:"idle",sourceId:this.id}))}loadTile(e){return c._(this,void 0,void 0,function*(){this.tileID&&this.tileID.equals(e.tileID.canonical)?(this.tiles[String(e.tileID.wrap)]=e,e.buckets={}):e.state="errored"})}serialize(){return{type:"image",url:this.options.url,coordinates:this.coordinates}}hasTransition(){return!1}_getOverlappingTileRanges(e){let i=1/0,s=1/0,o=-1/0,h=-1/0;for(const _ of e)i=Math.min(i,_.x),s=Math.min(s,_.y),o=Math.max(o,_.x),h=Math.max(h,_.y);const f={};for(let _=0;_<=c.a0;_++){const x=Math.pow(2,_),w=Math.floor(i*x),I=Math.floor(s*x),z=Math.floor(o*x),C=Math.floor(h*x);f[_]={minTileX:w,minTileY:I,maxTileX:z,maxTileY:C}}return f}}class gr extends mr{constructor(e,i,s,o){super(e,i,s,o),this.roundZoom=!0,this.type="video",this.options=i}load(){return c._(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 c.a2(this.urls);if(this._loaded=!0,!i)return;this.video=i,this.video.loop=!0,this.video.addEventListener("playing",()=>{this.map.triggerRepaint()}),this.map&&this.video.play(),this._finishLoading()}catch(i){this.fire(new c.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 c.k(new c.a3(`sources.${this.id}`,null,`Playback for this video can be set only between the ${i.start(0)} and ${i.end(0)}-second mark.`))):this.video.currentTime=e}}getVideo(){return this.video}onAdd(e){this.map||(this.map=e,this.load(),this.video&&(this.video.play(),this.setCoordinates(this.coordinates)))}prepare(){if(Object.keys(this.tiles).length===0||this.video.readyState<2)return;const e=this.map.painter.context,i=e.gl;this.texture?this.video.paused||(this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE),i.texSubImage2D(i.TEXTURE_2D,0,0,0,i.RGBA,i.UNSIGNED_BYTE,this.video)):(this.texture=new Zt(e,this.video,i.RGBA),this.texture.bind(i.LINEAR,i.CLAMP_TO_EDGE));let s=!1;for(const o in this.tiles){const h=this.tiles[o];h.state!=="loaded"&&(h.state="loaded",h.texture=this.texture,s=!0)}s&&this.fire(new c.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 Pa extends mr{constructor(e,i,s,o){super(e,i,s,o),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 c.k(new c.a3(`sources.${e}`,null,'"coordinates" property must be an array of 4 longitude/latitude array pairs'))):this.fire(new c.k(new c.a3(`sources.${e}`,null,'missing required property "coordinates"'))),i.animate&&typeof i.animate!="boolean"&&this.fire(new c.k(new c.a3(`sources.${e}`,null,'optional "animate" property must be a boolean value'))),i.canvas?typeof i.canvas=="string"||i.canvas instanceof HTMLCanvasElement||this.fire(new c.k(new c.a3(`sources.${e}`,null,'"canvas" must be either a string representing the ID of the canvas element from which to read, or an HTMLCanvasElement instance'))):this.fire(new c.k(new c.a3(`sources.${e}`,null,'missing required property "canvas"'))),this.options=i,this.animate=i.animate===void 0||i.animate}load(){return c._(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 c.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 Zt(i,this.canvas,s.RGBA,{premultiply:!0});let o=!1;for(const h in this.tiles){const f=this.tiles[h];f.state!=="loaded"&&(f.state="loaded",f.texture=this.texture,o=!0)}o&&this.fire(new c.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 Sa={},_s=u=>{switch(u){case"geojson":return _n;case"image":return mr;case"raster":return fr;case"raster-dem":return gn;case"vector":return Gn;case"video":return gr;case"canvas":return Pa}return Sa[u]},qn="RTLPluginLoaded";class yn extends c.E{constructor(){super(...arguments),this.status="unavailable",this.url=null,this.dispatcher=Un()}_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 c._(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 c._(this,void 0,void 0,function*(){yield this._syncState("loading"),this.status="loaded",this.fire(new c.l(qn))})}lazyLoad(){this.status==="unavailable"?this.status="requested":this.status==="deferred"&&this._requestImport()}}let Ma=null;function Gr(){return Ma||(Ma=new yn),Ma}class Er{constructor(e,i){this.timeAdded=0,this.fadeEndTime=0,this.tileID=e,this.uid=c.a4(),this.uses=0,this.tileSize=i,this.buckets={},this.expirationTime=null,this.queryPadding=0,this.hasSymbolBuckets=!1,this.hasRTLText=!1,this.dependencies={},this.rtt=[],this.rttCoords={},this.expiredRequestCount=0,this.state="loading"}registerFadeDuration(e){const i=e+this.timeAdded;i<this.fadeEndTime||(this.fadeEndTime=i)}wasRequested(){return this.state==="errored"||this.state==="loaded"||this.state==="reloading"}clearTextures(e){this.demTexture&&e.saveTileTexture(this.demTexture),this.demTexture=null}loadVectorData(e,i,s){if(this.hasData()&&this.unloadVectorData(),this.state="loaded",e){e.featureIndex&&(this.latestFeatureIndex=e.featureIndex,e.rawTileData?(this.latestRawTileData=e.rawTileData,this.latestFeatureIndex.rawTileData=e.rawTileData):this.latestRawTileData&&(this.latestFeatureIndex.rawTileData=this.latestRawTileData)),this.collisionBoxArray=e.collisionBoxArray,this.buckets=function(o,h){const f={};if(!h)return f;for(const _ of o){const x=_.layerIds.map(w=>h.getLayer(w)).filter(Boolean);if(x.length!==0){_.layers=x,_.stateDependentLayerIds&&(_.stateDependentLayers=_.stateDependentLayerIds.map(w=>x.filter(I=>I.id===w)[0]));for(const w of x)f[w.id]=_}}return f}(e.buckets,i==null?void 0:i.style),this.hasSymbolBuckets=!1;for(const o in this.buckets){const h=this.buckets[o];if(h instanceof c.a6){if(this.hasSymbolBuckets=!0,!s)break;h.justReloaded=!0}}if(this.hasRTLText=!1,this.hasSymbolBuckets)for(const o in this.buckets){const h=this.buckets[o];if(h instanceof c.a6&&h.hasRTLText){this.hasRTLText=!0,Gr().lazyLoad();break}}this.queryPadding=0;for(const o in this.buckets){const h=this.buckets[o];this.queryPadding=Math.max(this.queryPadding,i.style.getLayer(o).queryRadius(h))}e.imageAtlas&&(this.imageAtlas=e.imageAtlas),e.glyphAtlasImage&&(this.glyphAtlasImage=e.glyphAtlasImage)}else this.collisionBoxArray=new c.a5}unloadVectorData(){for(const e in this.buckets)this.buckets[e].destroy();this.buckets={},this.imageAtlasTexture&&this.imageAtlasTexture.destroy(),this.imageAtlas&&(this.imageAtlas=null),this.glyphAtlasTexture&&this.glyphAtlasTexture.destroy(),this.latestFeatureIndex=null,this.state="unloaded"}getBucket(e){return this.buckets[e.id]}upload(e){for(const s in this.buckets){const o=this.buckets[s];o.uploadPending()&&o.upload(e)}const i=e.gl;this.imageAtlas&&!this.imageAtlas.uploaded&&(this.imageAtlasTexture=new Zt(e,this.imageAtlas.image,i.RGBA),this.imageAtlas.uploaded=!0),this.glyphAtlasImage&&(this.glyphAtlasTexture=new Zt(e,this.glyphAtlasImage,i.ALPHA),this.glyphAtlasImage=null)}prepare(e){this.imageAtlas&&this.imageAtlas.patchUpdatedImages(e,this.imageAtlasTexture)}queryRenderedFeatures(e,i,s,o,h,f,_,x,w,I,z){return this.latestFeatureIndex&&this.latestFeatureIndex.rawTileData?this.latestFeatureIndex.query({queryGeometry:o,cameraQueryGeometry:h,scale:f,tileSize:this.tileSize,pixelPosMatrix:I,transform:x,params:_,queryPadding:this.queryPadding*w,getElevation:z},e,i,s):{}}querySourceFeatures(e,i){const s=this.latestFeatureIndex;if(!s||!s.rawTileData)return;const o=s.loadVTLayers(),h=i&&i.sourceLayer?i.sourceLayer:"",f=o._geojsonTileLayer||o[h];if(!f)return;const _=c.a7(i&&i.filter),{z:x,x:w,y:I}=this.tileID.canonical,z={z:x,x:w,y:I};for(let C=0;C<f.length;C++){const F=f.feature(C);if(_.needGeometry){const G=c.a8(F,!0);if(!_.filter(new c.C(this.tileID.overscaledZ),G,this.tileID.canonical))continue}else if(!_.filter(new c.C(this.tileID.overscaledZ),F))continue;const N=s.getId(F,h),q=new c.a9(F,x,w,I,N);q.tile=z,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=c.aa(e.cacheControl);s["max-age"]&&(this.expirationTime=Date.now()+1e3*s["max-age"])}else e.expires&&(this.expirationTime=new Date(e.expires).getTime());if(this.expirationTime){const s=Date.now();let o=!1;if(this.expirationTime>s)o=!1;else if(i)if(this.expirationTime<i)o=!0;else{const h=this.expirationTime-i;h?this.expirationTime=s+Math.max(h,3e4):o=!0}else o=!0;o?(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 o in this.buckets){if(!i.style.hasLayer(o))continue;const h=this.buckets[o],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 w=i&&i.style&&i.style.getLayer(o);w&&(this.queryPadding=Math.max(this.queryPadding,w.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 o of i)s[o]=!0;this.dependencies[e]=s}hasDependency(e,i){for(const s of e){const o=this.dependencies[s];if(o){for(const h of i)if(o[h])return!0}}return!1}}class qr{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 o=e.wrapped().key;this.data[o]===void 0&&(this.data[o]=[]);const h={value:i,timeout:void 0};if(s!==void 0&&(h.timeout=setTimeout(()=>{this.remove(e,h)},s)),this.data[o].push(h),this.order.push(o),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,o=i===void 0?0:this.data[s].indexOf(i),h=this.data[s][o];return this.data[s].splice(o,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 o of this.data[s])e(o.value)||i.push(o);for(const s of i)this.remove(s.value.tileID,s)}}class Ia{constructor(){this.state={},this.stateChanges={},this.deletedStates={}}updateState(e,i,s){const o=String(i);if(this.stateChanges[e]=this.stateChanges[e]||{},this.stateChanges[e][o]=this.stateChanges[e][o]||{},c.e(this.stateChanges[e][o],s),this.deletedStates[e]===null){this.deletedStates[e]={};for(const h in this.state[e])h!==o&&(this.deletedStates[e][h]=null)}else if(this.deletedStates[e]&&this.deletedStates[e][o]===null){this.deletedStates[e][o]={};for(const h in this.state[e][o])s[h]||(this.deletedStates[e][o][h]=null)}else for(const h in s)this.deletedStates[e]&&this.deletedStates[e][o]&&this.deletedStates[e][o][h]===null&&delete this.deletedStates[e][o][h]}removeFeatureState(e,i,s){if(this.deletedStates[e]===null)return;const o=String(i);if(this.deletedStates[e]=this.deletedStates[e]||{},s&&i!==void 0)this.deletedStates[e][o]!==null&&(this.deletedStates[e][o]=this.deletedStates[e][o]||{},this.deletedStates[e][o][s]=null);else if(i!==void 0)if(this.stateChanges[e]&&this.stateChanges[e][o])for(s in this.deletedStates[e][o]={},this.stateChanges[e][o])this.deletedStates[e][o][s]=null;else this.deletedStates[e][o]=null;else this.deletedStates[e]=null}getState(e,i){const s=String(i),o=c.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 o[f]}return o}initializeTileState(e,i){e.setFeatureState(this.state,i)}coalesceChanges(e,i){const s={};for(const o in this.stateChanges){this.state[o]=this.state[o]||{};const h={};for(const f in this.stateChanges[o])this.state[o][f]||(this.state[o][f]={}),c.e(this.state[o][f],this.stateChanges[o][f]),h[f]=this.state[o][f];s[o]=h}for(const o in this.deletedStates){this.state[o]=this.state[o]||{};const h={};if(this.deletedStates[o]===null)for(const f in this.state[o])h[f]={},this.state[o][f]={};else for(const f in this.deletedStates[o]){if(this.deletedStates[o][f]===null)this.state[o][f]={};else for(const _ of Object.keys(this.deletedStates[o][f]))delete this.state[o][f][_];h[f]=this.state[o][f]}s[o]=s[o]||{},c.e(s[o],h)}if(this.stateChanges={},this.deletedStates={},Object.keys(s).length!==0)for(const o in e)e[o].setFeatureState(s,i)}}function ys(u,e,i){const s=e.intersectsFrustum(u);if(!i)return s;const o=e.intersectsPlane(i);return s===0||o===0?0:s===2&&o===2?2:1}function oo(u,e,i,s,o){let h=u;const f=Math.atan(e/i),_=Math.hypot(e,i);return h=u+c.ab(s/_/Math.max(.5,Math.cos(c.ad(o/2)))),h+=1*c.ab(Math.cos(f))/2,h+=c.ae(u-h,-0,0),h}function Wr(u,e){const i=(e.roundZoom?Math.round:Math.floor)(u.zoom+c.ab(u.tileSize/e.tileSize));return Math.max(0,i)}function ce(u,e){const i=u.getCameraFrustum(),s=u.getClippingPlane(),o=u.screenPointToMercatorCoordinate(u.getCameraPoint()),h=c.$.fromLngLat(u.center,u.elevation);o.z=h.z+Math.cos(u.pitchInRadians)*u.cameraToCenterDistance/u.worldSize;const f=u.getCoveringTilesDetailsProvider(),_=f.allowVariableZoom(u,e),x=Wr(u,e),w=e.minzoom||0,I=e.maxzoom!==void 0?e.maxzoom:u.maxZoom,z=Math.min(Math.max(0,x),I),C=Math.pow(2,z),F=[C*o.x,C*o.y,0],N=[C*h.x,C*h.y,0],q=Math.hypot(h.x-o.x,h.y-o.y),G=Math.abs(h.z-o.z),W=Math.hypot(q,G),K=te=>({zoom:0,x:0,y:0,wrap:te,fullyVisible:!1}),Q=[],ee=[];if(u.renderWorldCopies&&f.allowWorldCopies())for(let te=1;te<=3;te++)Q.push(K(-te)),Q.push(K(te));for(Q.push(K(0));Q.length>0;){const te=Q.pop(),se=te.x,ie=te.y;let pe=te.fullyVisible;const de={x:se,y:ie,z:te.zoom},we=f.getTileAABB(de,te.wrap,u.elevation,e);if(!pe){const Le=ys(i,we,s);if(Le===0)continue;pe=Le===2}const Se=f.distanceToTile2d(o.x,o.y,de,we);let ve=x;_&&(ve=(e.calculateTileZoom||oo)(u.zoom+c.ab(u.tileSize/e.tileSize),Se,G,W,u.fov)),ve=(e.roundZoom?Math.round:Math.floor)(ve),ve=Math.max(0,ve);const Be=Math.min(ve,I);if(te.wrap=f.getWrap(h,de,te.wrap),te.zoom>=Be){if(te.zoom<w)continue;const Le=z-te.zoom,Me=F[0]-.5-(se<<Le),We=F[1]-.5-(ie<<Le),lt=e.reparseOverscaled?Math.max(te.zoom,ve):te.zoom;ee.push({tileID:new c.Y(te.zoom===I?lt:te.zoom,te.wrap,te.zoom,se,ie),distanceSq:c.ac([N[0]-.5-se,N[1]-.5-ie]),tileDistanceToCamera:Math.sqrt(Me*Me+We*We)})}else for(let Le=0;Le<4;Le++)Q.push({zoom:te.zoom+1,x:(se<<1)+Le%2,y:(ie<<1)+(Le>>1),wrap:te.wrap,fullyVisible:pe})}return ee.sort((te,se)=>te.distanceSq-se.distanceSq).map(te=>te.tileID)}class j extends c.E{constructor(e,i,s){super(),this.id=e,this.dispatcher=s,this.on("data",o=>this._dataHandler(o)),this.on("dataloading",()=>{this._sourceErrored=!1}),this.on("error",()=>{this._sourceErrored=this._source.loaded()}),this._source=((o,h,f,_)=>{const x=new(_s(h.type))(o,h,f,_);if(x.id!==o)throw new Error(`Expected Source id to be ${o} instead of ${x.id}`);return x})(e,i,s,this),this._tiles={},this._cache=new qr(0,o=>this._unloadTile(o)),this._timers={},this._cacheTimers={},this._maxTileCacheSize=null,this._maxTileCacheZoomLevels=null,this._loadedParentTiles={},this._coveredTiles={},this._state=new Ia,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 c._(this,void 0,void 0,function*(){try{yield this._source.loadTile(e),this._tileLoaded(e,i,s)}catch(o){e.state="errored",o.status!==404?this._source.fire(new c.k(o,{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 c.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(V).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,o)=>{const h=s.tileID,f=o.tileID,_=new c.P(h.canonical.x,h.canonical.y)._rotate(-this.transform.bearingInRadians),x=new c.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(V).map(s=>s.key)}hasRenderableParent(e){const i=this.findLoadedParent(e,0);return!!i&&this._isIdRenderable(i.tileID.key)}_isIdRenderable(e,i){return this._tiles[e]&&this._tiles[e].hasData()&&!this._coveredTiles[e]&&(i||!this._tiles[e].holdingForFade())}reload(e){if(this._paused)this._shouldReloadOnResume=!0;else{this._cache.reset();for(const i in this._tiles)(e||this._tiles[i].state!=="errored")&&this._reloadTile(i,"reloading")}}_reloadTile(e,i){return c._(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 c.l("data",{dataType:"source",tile:e,coord:e.tileID}))}_backfillDEM(e){const i=this.getRenderableIds();for(let o=0;o<i.length;o++){const h=i[o];if(e.neighboringTiles&&e.neighboringTiles[h]){const f=this.getTileByID(h);s(e,f),s(f,e)}}function s(o,h){o.needsHillshadePrepare=!0,o.needsTerrainPrepare=!0;let f=h.tileID.canonical.x-o.tileID.canonical.x;const _=h.tileID.canonical.y-o.tileID.canonical.y,x=Math.pow(2,o.tileID.canonical.z),w=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&&o.dem&&(o.dem.backfillBorder(h.dem,f,_),o.neighboringTiles&&o.neighboringTiles[w]&&(o.neighboringTiles[w].backfilled=!0)))}}getTile(e){return this.getTileByID(e.key)}getTileByID(e){return this._tiles[e]}_retainLoadedChildren(e,i,s,o){for(const h in this._tiles){let f=this._tiles[h];if(o[h]||!f.hasData()||f.tileID.overscaledZ<=i||f.tileID.overscaledZ>s)continue;let _=f.tileID;for(;f&&f.tileID.overscaledZ>i+1;){const w=f.tileID.scaledTo(f.tileID.overscaledZ-1);f=this._tiles[w.key],f&&f.hasData()&&(_=w)}let x=_;for(;x.overscaledZ>i;)if(x=x.scaledTo(x.overscaledZ-1),e[x.key]||e[x.canonical.key]){o[_.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 o=e.scaledTo(s),h=this._getLoadedTile(o);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,o=Math.floor(i*s*(this._maxTileCacheZoomLevels===null?c.a.MAX_TILE_CACHE_ZOOM_LEVELS:this._maxTileCacheZoomLevels)),h=typeof this._maxTileCacheSize=="number"?Math.min(this._maxTileCacheSize,o):o;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 o in this._tiles){const h=this._tiles[o];h.tileID=h.tileID.unwrapTo(h.tileID.wrap+i),s[h.tileID.key]=h}this._tiles=s;for(const o in this._timers)clearTimeout(this._timers[o]),delete this._timers[o];for(const o in this._tiles)this._setTileReloadTimer(o,this._tiles[o])}}_updateCoveredAndRetainedTiles(e,i,s,o,h,f){const _={},x={},w=Object.keys(e),I=Ae.now();for(const z of w){const C=e[z],F=this._tiles[z];if(!F||F.fadeEndTime!==0&&F.fadeEndTime<=I)continue;const N=this.findLoadedParent(C,i),q=this.findLoadedSibling(C),G=N||q||null;G&&(this._addTile(G.tileID),_[G.tileID.key]=G.tileID),x[z]=C}this._retainLoadedChildren(x,o,s,e);for(const z in _)e[z]||(this._coveredTiles[z]=!0,e[z]=_[z]);if(f){const z={},C={};for(const F of h)this._tiles[F.key].hasData()?z[F.key]=F:C[F.key]=F;for(const F in C){const N=C[F].children(this._source.maxzoom);this._tiles[N[0].key]&&this._tiles[N[1].key]&&this._tiles[N[2].key]&&this._tiles[N[3].key]&&(z[N[0].key]=e[N[0].key]=N[0],z[N[1].key]=e[N[1].key]=N[1],z[N[2].key]=e[N[2].key]=N[2],z[N[3].key]=e[N[3].key]=N[3],delete C[F])}for(const F in C){const N=C[F],q=this.findLoadedParent(N,this._source.minzoom),G=this.findLoadedSibling(N),W=q||G||null;if(W){z[W.tileID.key]=e[W.tileID.key]=W.tileID;for(const K in z)z[K].isChildOf(W.tileID)&&delete z[K]}}for(const F in this._tiles)z[F]||(this._coveredTiles[F]=!0)}}update(e,i){if(!this._sourceLoaded||this._paused)return;let s;this.transform=e,this.terrain=i,this.updateCacheSize(e),this.handleWrapJump(this.transform.center.lng),this._coveredTiles={},this.used||this.usedForTerrain?this._source.tileID?s=e.getVisibleUnwrappedCoordinates(this._source.tileID).map(I=>new c.Y(I.canonical.z,I.wrap,I.canonical.z,I.canonical.x,I.canonical.y)):(s=ce(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(I=>this._source.hasTile(I)))):s=[];const o=Wr(e,this._source),h=Math.max(o-j.maxOverzooming,this._source.minzoom),f=Math.max(o+j.maxUnderzooming,this._source.minzoom);if(this.usedForTerrain){const I={};for(const z of s)if(z.canonical.z>this._source.minzoom){const C=z.scaledTo(z.canonical.z-1);I[C.key]=C;const F=z.scaledTo(Math.max(this._source.minzoom,Math.min(z.canonical.z,5)));I[F.key]=F}s=s.concat(Object.values(I))}const _=s.length===0&&!this._updated&&this._didEmitContent;this._updated=!0,_&&this.fire(new c.l("data",{sourceDataType:"idle",dataType:"source",sourceId:this.id}));const x=this._updateRetainedTiles(s,o);D(this._source.type)&&this._updateCoveredAndRetainedTiles(x,h,f,o,s,i);for(const I in x)this._tiles[I].clearFadeHold();const w=c.af(this._tiles,x);for(const I of w){const z=this._tiles[I];z.hasSymbolBuckets&&!z.holdingForFade()?z.setHoldDuration(this.map._fadeDuration):z.hasSymbolBuckets&&!z.symbolFadeFinished()||this._removeTile(I)}this._updateLoadedParentTileCache(),this._updateLoadedSiblingTileCache()}releaseSymbolFadeTiles(){for(const e in this._tiles)this._tiles[e].holdingForFade()&&this._removeTile(e)}_updateRetainedTiles(e,i){var s;const o={},h={},f=Math.max(i-j.maxOverzooming,this._source.minzoom),_=Math.max(i+j.maxUnderzooming,this._source.minzoom),x={};for(const w of e){const I=this._addTile(w);o[w.key]=w,I.hasData()||i<this._source.maxzoom&&(x[w.key]=w)}this._retainLoadedChildren(x,i,_,o);for(const w of e){let I=this._tiles[w.key];if(I.hasData())continue;if(i+1>this._source.maxzoom){const C=w.children(this._source.maxzoom)[0],F=this.getTile(C);if(F&&F.hasData()){o[C.key]=C;continue}}else{const C=w.children(this._source.maxzoom);if(o[C[0].key]&&o[C[1].key]&&o[C[2].key]&&o[C[3].key])continue}let z=I.wasRequested();for(let C=w.overscaledZ-1;C>=f;--C){const F=w.scaledTo(C);if(h[F.key])break;if(h[F.key]=!0,I=this.getTile(F),!I&&z&&(I=this._addTile(F)),I){const N=I.hasData();if((N||!(!((s=this.map)===null||s===void 0)&&s.cancelPendingTileRequestsWhileZooming)||z)&&(o[F.key]=F),z=I.wasRequested(),N)break}}}return o}_updateLoadedParentTileCache(){this._loadedParentTiles={};for(const e in this._tiles){const i=[];let s,o=this._tiles[e].tileID;for(;o.overscaledZ>0;){if(o.key in this._loadedParentTiles){s=this._loadedParentTiles[o.key];break}i.push(o.key);const h=o.scaledTo(o.overscaledZ-1);if(s=this._getLoadedTile(h),s)break;o=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 Er(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 c.l("dataloading",{tile:i,coord:i.tileID,dataType:"source"})),i}_setTileReloadTimer(e,i){e in this._timers&&(clearTimeout(this._timers[e]),delete this._timers[e]);const s=i.getExpiryTimeout();s&&(this._timers[e]=setTimeout(()=>{this._reloadTile(e,"expired"),delete this._timers[e]},s))}_removeTile(e){const i=this._tiles[e];i&&(i.uses--,delete this._tiles[e],this._timers[e]&&(clearTimeout(this._timers[e]),delete this._timers[e]),i.uses>0||(i.hasData()&&i.state!=="reloading"?this._cache.add(i.tileID,i,i.getExpiryTimeout()):(i.aborted=!0,this._abortTile(i),this._unloadTile(i))))}_dataHandler(e){const i=e.sourceDataType;e.dataType==="source"&&i==="metadata"&&(this._sourceLoaded=!0),this._sourceLoaded&&!this._paused&&e.dataType==="source"&&i==="content"&&(this.reload(e.sourceDataChanged),this.transform&&this.update(this.transform,this.terrain),this._didEmitContent=!0)}clearTiles(){this._shouldReloadOnResume=!1,this._paused=!1;for(const e in this._tiles)this._removeTile(e);this._cache.reset()}tilesIn(e,i,s){const o=[],h=this.transform;if(!h)return o;const f=s?h.getCameraQueryGeometry(e):e,_=e.map(N=>h.screenPointToMercatorCoordinate(N,this.terrain)),x=f.map(N=>h.screenPointToMercatorCoordinate(N,this.terrain)),w=this.getIds();let I=1/0,z=1/0,C=-1/0,F=-1/0;for(const N of x)I=Math.min(I,N.x),z=Math.min(z,N.y),C=Math.max(C,N.x),F=Math.max(F,N.y);for(let N=0;N<w.length;N++){const q=this._tiles[w[N]];if(q.holdingForFade())continue;const G=q.tileID,W=Math.pow(2,h.zoom-q.tileID.overscaledZ),K=i*q.queryPadding*c.Z/q.tileSize/W,Q=[G.getTilePoint(new c.$(I,z)),G.getTilePoint(new c.$(C,F))];if(Q[0].x-K<c.Z&&Q[0].y-K<c.Z&&Q[1].x+K>=0&&Q[1].y+K>=0){const ee=_.map(se=>G.getTilePoint(se)),te=x.map(se=>G.getTilePoint(se));o.push({tile:q,tileID:G,queryGeometry:ee,cameraQueryGeometry:te,scale:W})}}return o}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(D(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 o=this._tiles[e];o&&o.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 V(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 D(u){return u==="raster"||u==="image"||u==="video"}j.maxOverzooming=10,j.maxUnderzooming=3;class Y{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=c.ae(e,0,1);let i=1,s=this._distances[i];const o=e*this.paddedLength+this.padding;for(;s<o&&i<this._distances.length;)s=this._distances[++i];const h=i-1,f=this._distances[h],_=s-f,x=_>0?(o-f)/_:0;return this.points[h].mult(1-x).add(this.points[i].mult(x))}}function ae(u,e){let i=!0;return u==="always"||u!=="never"&&e!=="never"||(i=!1),i}class ne{constructor(e,i,s){const o=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++)o.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,o,h){this._forEachCell(i,s,o,h,this._insertBoxCell,this.boxUid++),this.boxKeys.push(e),this.bboxes.push(i),this.bboxes.push(s),this.bboxes.push(o),this.bboxes.push(h)}insertCircle(e,i,s,o){this._forEachCell(i-o,s-o,i+o,s+o,this._insertCircleCell,this.circleUid++),this.circleKeys.push(e),this.circles.push(i),this.circles.push(s),this.circles.push(o)}_insertBoxCell(e,i,s,o,h,f){this.boxCells[h].push(f)}_insertCircleCell(e,i,s,o,h,f){this.circleCells[h].push(f)}_query(e,i,s,o,h,f,_){if(s<0||e>this.width||o<0||i>this.height)return[];const x=[];if(e<=0&&i<=0&&this.width<=s&&this.height<=o){if(h)return[{key:null,x1:e,y1:i,x2:s,y2:o}];for(let w=0;w<this.boxKeys.length;w++)x.push({key:this.boxKeys[w],x1:this.bboxes[4*w],y1:this.bboxes[4*w+1],x2:this.bboxes[4*w+2],y2:this.bboxes[4*w+3]});for(let w=0;w<this.circleKeys.length;w++){const I=this.circles[3*w],z=this.circles[3*w+1],C=this.circles[3*w+2];x.push({key:this.circleKeys[w],x1:I-C,y1:z-C,x2:I+C,y2:z+C})}}else this._forEachCell(e,i,s,o,this._queryCell,x,{hitTest:h,overlapMode:f,seenUids:{box:{},circle:{}}},_);return x}query(e,i,s,o){return this._query(e,i,s,o,!1,null)}hitTest(e,i,s,o,h,f){return this._query(e,i,s,o,!0,h,f).length>0}hitTestCircle(e,i,s,o,h){const f=e-s,_=e+s,x=i-s,w=i+s;if(_<0||f>this.width||w<0||x>this.height)return!1;const I=[];return this._forEachCell(f,x,_,w,this._queryCellCircle,I,{hitTest:!0,overlapMode:o,circle:{x:e,y:i,radius:s},seenUids:{box:{},circle:{}}},h),I.length>0}_queryCell(e,i,s,o,h,f,_,x){const{seenUids:w,hitTest:I,overlapMode:z}=_,C=this.boxCells[h];if(C!==null){const N=this.bboxes;for(const q of C)if(!w.box[q]){w.box[q]=!0;const G=4*q,W=this.boxKeys[q];if(e<=N[G+2]&&i<=N[G+3]&&s>=N[G+0]&&o>=N[G+1]&&(!x||x(W))&&(!I||!ae(z,W.overlapMode))&&(f.push({key:W,x1:N[G],y1:N[G+1],x2:N[G+2],y2:N[G+3]}),I))return!0}}const F=this.circleCells[h];if(F!==null){const N=this.circles;for(const q of F)if(!w.circle[q]){w.circle[q]=!0;const G=3*q,W=this.circleKeys[q];if(this._circleAndRectCollide(N[G],N[G+1],N[G+2],e,i,s,o)&&(!x||x(W))&&(!I||!ae(z,W.overlapMode))){const K=N[G],Q=N[G+1],ee=N[G+2];if(f.push({key:W,x1:K-ee,y1:Q-ee,x2:K+ee,y2:Q+ee}),I)return!0}}}return!1}_queryCellCircle(e,i,s,o,h,f,_,x){const{circle:w,seenUids:I,overlapMode:z}=_,C=this.boxCells[h];if(C!==null){const N=this.bboxes;for(const q of C)if(!I.box[q]){I.box[q]=!0;const G=4*q,W=this.boxKeys[q];if(this._circleAndRectCollide(w.x,w.y,w.radius,N[G+0],N[G+1],N[G+2],N[G+3])&&(!x||x(W))&&!ae(z,W.overlapMode))return f.push(!0),!0}}const F=this.circleCells[h];if(F!==null){const N=this.circles;for(const q of F)if(!I.circle[q]){I.circle[q]=!0;const G=3*q,W=this.circleKeys[q];if(this._circlesCollide(N[G],N[G+1],N[G+2],w.x,w.y,w.radius)&&(!x||x(W))&&!ae(z,W.overlapMode))return f.push(!0),!0}}}_forEachCell(e,i,s,o,h,f,_,x){const w=this._convertToXCellCoord(e),I=this._convertToYCellCoord(i),z=this._convertToXCellCoord(s),C=this._convertToYCellCoord(o);for(let F=w;F<=z;F++)for(let N=I;N<=C;N++)if(h.call(this,e,i,s,o,this.xCellCount*N+F,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,o,h,f){const _=o-e,x=h-i,w=s+f;return w*w>_*_+x*x}_circleAndRectCollide(e,i,s,o,h,f,_){const x=(f-o)/2,w=Math.abs(e-(o+x));if(w>x+s)return!1;const I=(_-h)/2,z=Math.abs(i-(h+I));if(z>I+s)return!1;if(w<=x||z<=I)return!0;const C=w-x,F=z-I;return C*C+F*F<=s*s}}function he(u,e,i){const s=c.K();if(!u){const{vecSouth:z,vecEast:C}=be(e),F=ge();F[0]=C[0],F[1]=C[1],F[2]=z[0],F[3]=z[1],o=F,(I=(f=(h=F)[0])*(w=h[3])-(x=h[2])*(_=h[1]))&&(o[0]=w*(I=1/I),o[1]=-_*I,o[2]=-x*I,o[3]=f*I),s[0]=F[0],s[1]=F[1],s[4]=F[2],s[5]=F[3]}var o,h,f,_,x,w,I;return c.M(s,s,[1/i,1/i,1]),s}function oe(u,e,i,s){if(u){const o=c.K();if(!e){const{vecSouth:h,vecEast:f}=be(i);o[0]=f[0],o[1]=f[1],o[4]=h[0],o[5]=h[1]}return c.M(o,o,[s,s,1]),o}return i.pixelsToClipSpaceMatrix}function be(u){const e=Math.cos(u.rollInRadians),i=Math.sin(u.rollInRadians),s=Math.cos(u.pitchInRadians),o=Math.cos(u.bearingInRadians),h=Math.sin(u.bearingInRadians),f=c.ak();f[0]=-o*s*i-h*e,f[1]=-h*s*i+o*e;const _=c.al(f);_<1e-9?c.am(f):c.an(f,f,1/_);const x=c.ak();x[0]=o*s*e-h*i,x[1]=h*s*e+o*i;const w=c.al(x);return w<1e-9?c.am(x):c.an(x,x,1/w),{vecEast:x,vecSouth:f}}function _e(u,e,i,s){let o;s?(o=[u,e,s(u,e),1],c.ap(o,o,i)):(o=[u,e,0,1],li(o,o,i));const h=o[3];return{point:new c.P(o[0]/h,o[1]/h),signedDistanceFromCamera:h,isOccluded:!1}}function ue(u,e){return .5+u/e*.5}function Ie(u,e){return u.x>=-e[0]&&u.x<=e[0]&&u.y>=-e[1]&&u.y<=e[1]}function je(u,e,i,s,o,h,f,_,x,w,I,z,C){const F=i?u.textSizeData:u.iconSizeData,N=c.ag(F,e.transform.zoom),q=[256/e.width*2+1,256/e.height*2+1],G=i?u.text.dynamicLayoutVertexArray:u.icon.dynamicLayoutVertexArray;G.clear();const W=u.lineVertexArray,K=i?u.text.placedSymbolArray:u.icon.placedSymbolArray,Q=e.transform.width/e.transform.height;let ee=!1;for(let te=0;te<K.length;te++){const se=K.get(te);if(se.hidden||se.writingMode===c.ah.vertical&&!ee){it(se.numGlyphs,G);continue}ee=!1;const ie=new c.P(se.anchorX,se.anchorY),pe={getElevation:C,pitchedLabelPlaneMatrix:s,lineVertexArray:W,pitchWithMap:h,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:e.transform,tileAnchorPoint:ie,unwrappedTileID:x,width:w,height:I,translation:z},de=qe(se.anchorX,se.anchorY,pe);if(!Ie(de.point,q)){it(se.numGlyphs,G);continue}const we=ue(e.transform.cameraToCenterDistance,de.signedDistanceFromCamera),Se=c.ai(F,N,se),ve=h?Se*e.transform.getPitchedTextCorrection(se.anchorX,se.anchorY,x)/we:Se*we,Be=nt({projectionContext:pe,pitchedLabelPlaneMatrixInverse:o,symbol:se,fontSize:ve,flip:!1,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:G,aspectRatio:Q,rotateToLine:_});ee=Be.useVertical,(Be.notEnoughRoom||ee||Be.needsFlipping&&nt({projectionContext:pe,pitchedLabelPlaneMatrixInverse:o,symbol:se,fontSize:ve,flip:!0,keepUpright:f,glyphOffsetArray:u.glyphOffsetArray,dynamicLayoutVertexArray:G,aspectRatio:Q,rotateToLine:_}).notEnoughRoom)&&it(se.numGlyphs,G)}i?u.text.dynamicLayoutVertexBuffer.updateData(G):u.icon.dynamicLayoutVertexBuffer.updateData(G)}function Ne(u,e,i,s,o,h,f,_){const x=h.glyphStartIndex+h.numGlyphs,w=h.lineStartIndex,I=h.lineStartIndex+h.lineLength,z=e.getoffsetX(h.glyphStartIndex),C=e.getoffsetX(x-1),F=$t(u*z,i,s,o,h.segment,w,I,_,f);if(!F)return null;const N=$t(u*C,i,s,o,h.segment,w,I,_,f);return N?_.projectionCache.anyProjectionOccluded?null:{first:F,last:N}:null}function ye(u,e,i,s){return u===c.ah.horizontal&&Math.abs(i.y-e.y)>Math.abs(i.x-e.x)*s?{useVertical:!0}:(u===c.ah.vertical?e.y<i.y:e.x>i.x)?{needsFlipping:!0}:null}function nt(u){const{projectionContext:e,pitchedLabelPlaneMatrixInverse:i,symbol:s,fontSize:o,flip:h,keepUpright:f,glyphOffsetArray:_,dynamicLayoutVertexArray:x,aspectRatio:w,rotateToLine:I}=u,z=o/24,C=s.lineOffsetX*z,F=s.lineOffsetY*z;let N;if(s.numGlyphs>1){const q=s.glyphStartIndex+s.numGlyphs,G=s.lineStartIndex,W=s.lineStartIndex+s.lineLength,K=Ne(z,_,C,F,h,s,I,e);if(!K)return{notEnoughRoom:!0};const Q=ze(K.first.point.x,K.first.point.y,e,i),ee=ze(K.last.point.x,K.last.point.y,e,i);if(f&&!h){const te=ye(s.writingMode,Q,ee,w);if(te)return te}N=[K.first];for(let te=s.glyphStartIndex+1;te<q-1;te++)N.push($t(z*_.getoffsetX(te),C,F,h,s.segment,G,W,e,I));N.push(K.last)}else{if(f&&!h){const G=_t(e.tileAnchorPoint.x,e.tileAnchorPoint.y,e).point,W=s.lineStartIndex+s.segment+1,K=new c.P(e.lineVertexArray.getx(W),e.lineVertexArray.gety(W)),Q=_t(K.x,K.y,e),ee=Q.signedDistanceFromCamera>0?Q.point:Je(e.tileAnchorPoint,K,G,1,e),te=ze(G.x,G.y,e,i),se=ze(ee.x,ee.y,e,i),ie=ye(s.writingMode,te,se,w);if(ie)return ie}const q=$t(z*_.getoffsetX(s.glyphStartIndex),C,F,h,s.segment,s.lineStartIndex,s.lineStartIndex+s.lineLength,e,I);if(!q||e.projectionCache.anyProjectionOccluded)return{notEnoughRoom:!0};N=[q]}for(const q of N)c.ao(x,q.point,q.angle);return{}}function Je(u,e,i,s,o){const h=u.add(u.sub(e)._unit()),f=_t(h.x,h.y,o).point,_=i.sub(f);return i.add(_._mult(s/_.mag()))}function rt(u,e,i){const s=e.projectionCache;if(s.projections[u])return s.projections[u];const o=new c.P(e.lineVertexArray.getx(u),e.lineVertexArray.gety(u)),h=_t(o.x,o.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 Je(i.distanceFromAnchor===0?e.tileAnchorPoint:new c.P(e.lineVertexArray.getx(f),e.lineVertexArray.gety(f)),o,i.previousVertex,i.absOffsetX-i.distanceFromAnchor+1,e)}function _t(u,e,i){const s=u+i.translation[0],o=e+i.translation[1];let h;return i.pitchWithMap?(h=_e(s,o,i.pitchedLabelPlaneMatrix,i.getElevation),h.isOccluded=!1):(h=i.transform.projectTileCoordinates(s,o,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 ze(u,e,i,s){if(i.pitchWithMap){const o=[u,e,0,1];return c.ap(o,o,s),i.transform.projectTileCoordinates(o[0]/o[3],o[1]/o[3],i.unwrappedTileID,i.getElevation).point}return{x:u/i.width*2-1,y:e/i.height*2-1}}function qe(u,e,i){return i.transform.projectTileCoordinates(u,e,i.unwrappedTileID,i.getElevation)}function Oe(u,e,i){return u._unit()._perp()._mult(e*i)}function st(u,e,i,s,o,h,f,_,x){if(_.projectionCache.offsets[u])return _.projectionCache.offsets[u];const w=i.add(e);if(u+x.direction<s||u+x.direction>=o)return _.projectionCache.offsets[u]=w,w;const I=rt(u+x.direction,_,x),z=Oe(I.sub(i),f,x.direction),C=i.add(z),F=I.add(z);return _.projectionCache.offsets[u]=c.aq(h,w,C,F)||w,_.projectionCache.offsets[u]}function $t(u,e,i,s,o,h,f,_,x){const w=s?u-e:u+e;let I=w>0?1:-1,z=0;s&&(I*=-1,z=Math.PI),I<0&&(z+=Math.PI);let C,F=I>0?h+o:h+o+1;_.projectionCache.cachedAnchorPoint?C=_.projectionCache.cachedAnchorPoint:(C=_t(_.tileAnchorPoint.x,_.tileAnchorPoint.y,_).point,_.projectionCache.cachedAnchorPoint=C);let N,q,G=C,W=C,K=0,Q=0;const ee=Math.abs(w),te=[];let se;for(;K+Q<=ee;){if(F+=I,F<h||F>=f)return null;K+=Q,W=G,q=N;const de={absOffsetX:ee,direction:I,distanceFromAnchor:K,previousVertex:W};if(G=rt(F,_,de),i===0)te.push(W),se=G.sub(W);else{let we;const Se=G.sub(W);we=Se.mag()===0?Oe(rt(F+I,_,de).sub(G),i,I):Oe(Se,i,I),q||(q=W.add(we)),N=st(F,we,G,h,f,q,i,_,de),te.push(q),se=N.sub(q)}Q=se.mag()}const ie=se._mult((ee-K)/Q)._add(q||W),pe=z+Math.atan2(G.y-W.y,G.x-W.x);return te.push(ie),{point:ie,angle:x?pe:0,path:te}}const Hr=new Float32Array([-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0,-1/0,-1/0,0]);function it(u,e){for(let i=0;i<u;i++){const s=e.length;e.resize(s+4),e.float32.set(Hr,3*s)}}function li(u,e,i){const s=e[0],o=e[1];return u[0]=i[0]*s+i[4]*o+i[12],u[1]=i[1]*s+i[5]*o+i[13],u[3]=i[3]*s+i[7]*o+i[15],u}const Dt=100;class lo{constructor(e,i=new ne(e.width+200,e.height+200,25),s=new ne(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+Dt,this.screenBottomBoundary=e.height+Dt,this.gridRightBoundary=e.width+200,this.gridBottomBoundary=e.height+200,this.perspectiveRatioCutoff=.6}placeCollisionBox(e,i,s,o,h,f,_,x,w,I,z,C){const F=this.projectAndGetPerspectiveRatio(e.anchorPointX+x[0],e.anchorPointY+x[1],h,I,C),N=s*F.perspectiveRatio;let q;if(f||_)q=this._projectCollisionBox(e,N,o,h,f,_,x,F,I,z,C);else{const se=F.x+(z?z.x*N:0),ie=F.y+(z?z.y*N:0);q={allPointsOccluded:!1,box:[se+e.x1*N,ie+e.y1*N,se+e.x2*N,ie+e.y2*N]}}const[G,W,K,Q]=q.box,ee=f?q.allPointsOccluded:F.isOccluded;let te=ee;return te||(te=F.perspectiveRatio<this.perspectiveRatioCutoff),te||(te=!this.isInsideGrid(G,W,K,Q)),te||i!=="always"&&this.grid.hitTest(G,W,K,Q,i,w)?{box:[G,W,K,Q],placeable:!1,offscreen:!1,occluded:ee}:{box:[G,W,K,Q],placeable:!0,offscreen:this.isOffscreen(G,W,K,Q),occluded:ee}}placeCollisionCircles(e,i,s,o,h,f,_,x,w,I,z,C,F,N){const q=[],G=new c.P(i.anchorX,i.anchorY),W=this.getPerspectiveRatio(G.x,G.y,f,N),K=(w?h*this.transform.getPitchedTextCorrection(i.anchorX,i.anchorY,f)/W:h*W)/c.av,Q={getElevation:N,pitchedLabelPlaneMatrix:_,lineVertexArray:s,pitchWithMap:w,projectionCache:{projections:{},offsets:{},cachedAnchorPoint:void 0,anyProjectionOccluded:!1},transform:this.transform,tileAnchorPoint:G,unwrappedTileID:f,width:this.transform.width,height:this.transform.height,translation:F},ee=Ne(K,o,i.lineOffsetX*K,i.lineOffsetY*K,!1,i,!1,Q);let te=!1,se=!1,ie=!0;if(ee){const pe=.5*z*W+C,de=new c.P(-100,-100),we=new c.P(this.screenRightBoundary,this.screenBottomBoundary),Se=new Y,ve=ee.first,Be=ee.last;let Le=[];for(let lt=ve.path.length-1;lt>=1;lt--)Le.push(ve.path[lt]);for(let lt=1;lt<Be.path.length;lt++)Le.push(Be.path[lt]);const Me=2.5*pe;if(w){const lt=this.projectPathToScreenSpace(Le,Q);Le=lt.some(Tt=>Tt.signedDistanceFromCamera<=0)?[]:lt.map(Tt=>Tt.point)}let We=[];if(Le.length>0){const lt=Le[0].clone(),Tt=Le[0].clone();for(let ut=1;ut<Le.length;ut++)lt.x=Math.min(lt.x,Le[ut].x),lt.y=Math.min(lt.y,Le[ut].y),Tt.x=Math.max(Tt.x,Le[ut].x),Tt.y=Math.max(Tt.y,Le[ut].y);We=lt.x>=de.x&&Tt.x<=we.x&&lt.y>=de.y&&Tt.y<=we.y?[Le]:Tt.x<de.x||lt.x>we.x||Tt.y<de.y||lt.y>we.y?[]:c.ar([Le],de.x,de.y,we.x,we.y)}for(const lt of We){Se.reset(lt,.25*pe);let Tt=0;Tt=Se.length<=.5*pe?1:Math.ceil(Se.paddedLength/Me)+1;for(let ut=0;ut<Tt;ut++){const It=ut/Math.max(Tt-1,1),At=Se.lerp(It),Bt=At.x+Dt,Mt=At.y+Dt;q.push(Bt,Mt,pe,0);const Ct=Bt-pe,ti=Mt-pe,ui=Bt+pe,fi=Mt+pe;if(ie=ie&&this.isOffscreen(Ct,ti,ui,fi),se=se||this.isInsideGrid(Ct,ti,ui,fi),e!=="always"&&this.grid.hitTestCircle(Bt,Mt,pe,e,I)&&(te=!0,!x))return{circles:[],offscreen:!1,collisionDetected:te}}}}return{circles:!x&&te||!se||W<this.perspectiveRatioCutoff?[]:q,offscreen:ie,collisionDetected:te}}projectPathToScreenSpace(e,i){const s=function(o,h){const f=c.K();return c.aj(f,h.pitchedLabelPlaneMatrix),o.map(_=>{const x=_e(_.x,_.y,f,h.getElevation),w=h.transform.projectTileCoordinates(x.point.x,x.point.y,h.unwrappedTileID,h.getElevation);return w.point.x=(.5*w.point.x+.5)*h.width,w.point.y=(.5*-w.point.y+.5)*h.height,w})}(e,i);return function(o){let h=0,f=0,_=0,x=0;for(let w=0;w<o.length;w++)o[w].isOccluded?(_=w+1,x=0):(x++,x>f&&(f=x,h=_));return o.slice(h,h+f)}(s)}queryRenderedSymbols(e){if(e.length===0||this.grid.keysLength()===0&&this.ignoredGrid.keysLength()===0)return{};const i=[];let s=1/0,o=1/0,h=-1/0,f=-1/0;for(const I of e){const z=new c.P(I.x+Dt,I.y+Dt);s=Math.min(s,z.x),o=Math.min(o,z.y),h=Math.max(h,z.x),f=Math.max(f,z.y),i.push(z)}const _=this.grid.query(s,o,h,f).concat(this.ignoredGrid.query(s,o,h,f)),x={},w={};for(const I of _){const z=I.key;if(x[z.bucketInstanceId]===void 0&&(x[z.bucketInstanceId]={}),x[z.bucketInstanceId][z.featureIndex])continue;const C=[new c.P(I.x1,I.y1),new c.P(I.x2,I.y1),new c.P(I.x2,I.y2),new c.P(I.x1,I.y2)];c.as(i,C)&&(x[z.bucketInstanceId][z.featureIndex]=!0,w[z.bucketInstanceId]===void 0&&(w[z.bucketInstanceId]=[]),w[z.bucketInstanceId].push(z.featureIndex))}return w}insertCollisionBox(e,i,s,o,h,f){(s?this.ignoredGrid:this.grid).insert({bucketInstanceId:o,featureIndex:h,collisionGroupID:f,overlapMode:i},e[0],e[1],e[2],e[3])}insertCollisionCircles(e,i,s,o,h,f){const _=s?this.ignoredGrid:this.grid,x={bucketInstanceId:o,featureIndex:h,collisionGroupID:f,overlapMode:i};for(let w=0;w<e.length;w+=4)_.insertCircle(x,e[w],e[w+1],e[w+2])}projectAndGetPerspectiveRatio(e,i,s,o,h){if(h){let f;o?(f=[e,i,o(e,i),1],c.ap(f,f,h)):(f=[e,i,0,1],li(f,f,h));const _=f[3];return{x:(f[0]/_+1)/2*this.transform.width+Dt,y:(-f[1]/_+1)/2*this.transform.height+Dt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/_*.5,isOccluded:!1,signedDistanceFromCamera:_}}{const f=this.transform.projectTileCoordinates(e,i,s,o);return{x:(f.point.x+1)/2*this.transform.width+Dt,y:(1-f.point.y)/2*this.transform.height+Dt,perspectiveRatio:.5+this.transform.cameraToCenterDistance/f.signedDistanceFromCamera*.5,isOccluded:f.isOccluded,signedDistanceFromCamera:f.signedDistanceFromCamera}}}getPerspectiveRatio(e,i,s,o){const h=this.transform.projectTileCoordinates(e,i,s,o);return .5+this.transform.cameraToCenterDistance/h.signedDistanceFromCamera*.5}isOffscreen(e,i,s,o){return s<Dt||e>=this.screenRightBoundary||o<Dt||i>this.screenBottomBoundary}isInsideGrid(e,i,s,o){return s>=0&&e<this.gridRightBoundary&&o>=0&&i<this.gridBottomBoundary}getViewportMatrix(){const e=c.at([]);return c.L(e,e,[-100,-100,0]),e}_projectCollisionBox(e,i,s,o,h,f,_,x,w,I,z){let C=1,F=0,N=0,q=1;const G=e.anchorPointX+_[0],W=e.anchorPointY+_[1];if(f&&!h){const Le=this.projectAndGetPerspectiveRatio(G+1,W,o,w,z),Me=Le.x-x.x,We=Math.atan((Le.y-x.y)/Me)+(Me<0?Math.PI:0),lt=Math.sin(We),Tt=Math.cos(We);C=Tt,F=lt,N=-lt,q=Tt}else if(!f&&h){const Le=be(this.transform);C=Le.vecEast[0],F=Le.vecEast[1],N=Le.vecSouth[0],q=Le.vecSouth[1]}let K=x.x,Q=x.y,ee=i;h&&(K=G,Q=W,ee=Math.pow(2,-(this.transform.zoom-s.overscaledZ)),ee*=this.transform.getPitchedTextCorrection(G,W,o),I||(ee*=c.ae(.5+x.signedDistanceFromCamera/this.transform.cameraToCenterDistance*.5,0,4))),I&&(K+=C*I.x*ee+N*I.y*ee,Q+=F*I.x*ee+q*I.y*ee);const te=e.x1*ee,se=e.x2*ee,ie=(te+se)/2,pe=e.y1*ee,de=e.y2*ee,we=(pe+de)/2,Se=[{offsetX:te,offsetY:pe},{offsetX:ie,offsetY:pe},{offsetX:se,offsetY:pe},{offsetX:se,offsetY:we},{offsetX:se,offsetY:de},{offsetX:ie,offsetY:de},{offsetX:te,offsetY:de},{offsetX:te,offsetY:we}];let ve=[];for(const{offsetX:Le,offsetY:Me}of Se)ve.push(new c.P(K+C*Le+N*Me,Q+F*Le+q*Me));let Be=!1;if(h){const Le=ve.map(Me=>this.projectAndGetPerspectiveRatio(Me.x,Me.y,o,w,z));Be=Le.some(Me=>!Me.isOccluded),ve=Le.map(Me=>new c.P(Me.x,Me.y))}else Be=!0;return{box:c.au(ve),allPointsOccluded:!Be}}}class Ca{constructor(e,i,s,o){this.opacity=e?Math.max(0,Math.min(1,e.opacity+(e.placed?i:-i))):o&&s?1:0,this.placed=s}isHidden(){return this.opacity===0&&!this.placed}}class xn{constructor(e,i,s,o,h){this.text=new Ca(e?e.text:null,i,s,h),this.icon=new Ca(e?e.icon:null,i,o,h)}isHidden(){return this.text.isHidden()&&this.icon.isHidden()}}class Ni{constructor(e,i,s){this.text=e,this.icon=i,this.skipFade=s}}class Vt{constructor(e,i,s,o,h){this.bucketInstanceId=e,this.featureIndex=i,this.sourceLayerIndex=s,this.bucketIndex=o,this.tileID=h}}class Bh{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 Ea(u,e,i,s,o){const{horizontalAlign:h,verticalAlign:f}=c.aB(u);return new c.P(-(h-.5)*e+s[0]*o,-(f-.5)*i+s[1]*o)}class Tl{constructor(e,i,s,o,h){this.transform=e.clone(),this.terrain=i,this.collisionIndex=new lo(this.transform),this.placements={},this.opacities={},this.variableOffsets={},this.stale=!1,this.commitTime=0,this.fadeDuration=s,this.retainedQueryData={},this.collisionGroups=new Bh(o),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,o)=>i.getElevation(e,s,o):null}getBucketParts(e,i,s,o){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,w=h.layers[0].paint,I=Math.pow(2,this.transform.zoom-s.tileID.overscaledZ),z=s.tileSize/c.Z,C=s.tileID.toUnwrapped(),F=x.get("text-rotation-alignment")==="map",N=c.aw(s,1,this.transform.zoom),q=c.ax(this.collisionIndex.transform,s,w.get("text-translate"),w.get("text-translate-anchor")),G=c.ax(this.collisionIndex.transform,s,w.get("icon-translate"),w.get("icon-translate-anchor")),W=he(F,this.transform,N);this.retainedQueryData[h.bucketInstanceId]=new Vt(h.bucketInstanceId,f,h.sourceLayerIndex,h.index,s.tileID);const K={bucket:h,layout:x,translationText:q,translationIcon:G,unwrappedTileID:C,pitchedLabelPlaneMatrix:W,scale:I,textPixelRatio:z,holdingForFade:s.holdingForFade(),collisionBoxArray:_,partiallyEvaluatedTextSize:c.ag(h.textSizeData,this.transform.zoom),collisionGroup:this.collisionGroups.get(h.sourceID)};if(o)for(const Q of h.sortKeyRanges){const{sortKey:ee,symbolInstanceStart:te,symbolInstanceEnd:se}=Q;e.push({sortKey:ee,symbolInstanceStart:te,symbolInstanceEnd:se,parameters:K})}else e.push({symbolInstanceStart:0,symbolInstanceEnd:h.symbolInstances.length,parameters:K})}attemptAnchorPlacement(e,i,s,o,h,f,_,x,w,I,z,C,F,N,q,G,W,K,Q,ee){const te=c.ay[e.textAnchor],se=[e.textOffset0,e.textOffset1],ie=Ea(te,s,o,se,h),pe=this.collisionIndex.placeCollisionBox(i,C,x,w,I,_,f,G,z.predicate,Q,ie,ee);if((!K||this.collisionIndex.placeCollisionBox(K,C,x,w,I,_,f,W,z.predicate,Q,ie,ee).placeable)&&pe.placeable){let de;if(this.prevPlacement&&this.prevPlacement.variableOffsets[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID]&&this.prevPlacement.placements[F.crossTileID].text&&(de=this.prevPlacement.variableOffsets[F.crossTileID].anchor),F.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");return this.variableOffsets[F.crossTileID]={textOffset:se,width:s,height:o,anchor:te,textBoxScale:h,prevAnchor:de},this.markUsedJustification(N,te,F,q),N.allowVerticalPlacement&&(this.markUsedOrientation(N,q,F),this.placedOrientations[F.crossTileID]=q),{shift:ie,placedGlyphBoxes:pe}}}placeLayerBucketPart(e,i,s){const{bucket:o,layout:h,translationText:f,translationIcon:_,unwrappedTileID:x,pitchedLabelPlaneMatrix:w,textPixelRatio:I,holdingForFade:z,collisionBoxArray:C,partiallyEvaluatedTextSize:F,collisionGroup:N}=e.parameters,q=h.get("text-optional"),G=h.get("icon-optional"),W=c.az(h,"text-overlap","text-allow-overlap"),K=W==="always",Q=c.az(h,"icon-overlap","icon-allow-overlap"),ee=Q==="always",te=h.get("text-rotation-alignment")==="map",se=h.get("text-pitch-alignment")==="map",ie=h.get("icon-text-fit")!=="none",pe=h.get("symbol-z-order")==="viewport-y",de=K&&(ee||!o.hasIconData()||G),we=ee&&(K||!o.hasTextData()||q);!o.collisionArrays&&C&&o.deserializeCollisionBoxes(C);const Se=this.retainedQueryData[o.bucketInstanceId].tileID,ve=this._getTerrainElevationFunc(Se),Be=this.transform.getFastPathSimpleProjectionMatrix(Se),Le=(Me,We,lt)=>{var Tt,ut;if(i[Me.crossTileID])return;if(z)return void(this.placements[Me.crossTileID]=new Ni(!1,!1,!1));let It=!1,At=!1,Bt=!0,Mt=null,Ct={box:null,placeable:!1,offscreen:null,occluded:!1},ti={placeable:!1},ui=null,fi=null,Gi=null,Qr=0,Fr=0,Sn=0;We.textFeatureIndex?Qr=We.textFeatureIndex:Me.useRuntimeCollisionCircles&&(Qr=Me.featureIndex),We.verticalTextFeatureIndex&&(Fr=We.verticalTextFeatureIndex);const Mn=We.textBox;if(Mn){const Ji=qt=>{let Wt=c.ah.horizontal;if(o.allowVerticalPlacement&&!qt&&this.prevPlacement){const ai=this.prevPlacement.placedOrientations[Me.crossTileID];ai&&(this.placedOrientations[Me.crossTileID]=ai,Wt=ai,this.markUsedOrientation(o,Wt,Me))}return Wt},tn=(qt,Wt)=>{if(o.allowVerticalPlacement&&Me.numVerticalGlyphVertices>0&&We.verticalTextBox){for(const ai of o.writingModes)if(ai===c.ah.vertical?(Ct=Wt(),ti=Ct):Ct=qt(),Ct&&Ct.placeable)break}else Ct=qt()},ca=Me.textAnchorOffsetStartIndex,ua=Me.textAnchorOffsetEndIndex;if(ua===ca){const qt=(Wt,ai)=>{const zt=this.collisionIndex.placeCollisionBox(Wt,W,I,Se,x,se,te,f,N.predicate,ve,void 0,Be);return zt&&zt.placeable&&(this.markUsedOrientation(o,ai,Me),this.placedOrientations[Me.crossTileID]=ai),zt};tn(()=>qt(Mn,c.ah.horizontal),()=>{const Wt=We.verticalTextBox;return o.allowVerticalPlacement&&Me.numVerticalGlyphVertices>0&&Wt?qt(Wt,c.ah.vertical):{box:null,offscreen:null}}),Ji(Ct&&Ct.placeable)}else{let qt=c.ay[(ut=(Tt=this.prevPlacement)===null||Tt===void 0?void 0:Tt.variableOffsets[Me.crossTileID])===null||ut===void 0?void 0:ut.anchor];const Wt=(zt,In,ih)=>{const ha=zt.x2-zt.x1,od=zt.y2-zt.y1,rh=Me.textBoxScale,pc=ie&&Q==="never"?In:null;let Cn=null,En=W==="never"?1:2,zn="never";qt&&En++;for(let fc=0;fc<En;fc++){for(let mc=ca;mc<ua;mc++){const Uo=o.textAnchorOffsets.get(mc);if(qt&&Uo.textAnchor!==qt)continue;const $o=this.attemptAnchorPlacement(Uo,zt,ha,od,rh,te,se,I,Se,x,N,zn,Me,o,ih,f,_,pc,ve);if($o&&(Cn=$o.placedGlyphBoxes,Cn&&Cn.placeable))return It=!0,Mt=$o.shift,Cn}qt?qt=null:zn=W}return s&&!Cn&&(Cn={box:this.collisionIndex.placeCollisionBox(Mn,"always",I,Se,x,se,te,f,N.predicate,ve,void 0,Be).box,offscreen:!1,placeable:!1,occluded:!1}),Cn};tn(()=>Wt(Mn,We.iconBox,c.ah.horizontal),()=>{const zt=We.verticalTextBox;return o.allowVerticalPlacement&&(!Ct||!Ct.placeable)&&Me.numVerticalGlyphVertices>0&&zt?Wt(zt,We.verticalIconBox,c.ah.vertical):{box:null,occluded:!0,offscreen:null}}),Ct&&(It=Ct.placeable,Bt=Ct.offscreen);const ai=Ji(Ct&&Ct.placeable);if(!It&&this.prevPlacement){const zt=this.prevPlacement.variableOffsets[Me.crossTileID];zt&&(this.variableOffsets[Me.crossTileID]=zt,this.markUsedJustification(o,zt.anchor,Me,ai))}}}if(ui=Ct,It=ui&&ui.placeable,Bt=ui&&ui.offscreen,Me.useRuntimeCollisionCircles){const Ji=o.text.placedSymbolArray.get(Me.centerJustifiedTextSymbolIndex),tn=c.ai(o.textSizeData,F,Ji),ca=h.get("text-padding");fi=this.collisionIndex.placeCollisionCircles(W,Ji,o.lineVertexArray,o.glyphOffsetArray,tn,x,w,s,se,N.predicate,Me.collisionCircleDiameter,ca,f,ve),fi.circles.length&&fi.collisionDetected&&!s&&c.w("Collisions detected, but collision boxes are not shown"),It=K||fi.circles.length>0&&!fi.collisionDetected,Bt=Bt&&fi.offscreen}if(We.iconFeatureIndex&&(Sn=We.iconFeatureIndex),We.iconBox){const Ji=tn=>this.collisionIndex.placeCollisionBox(tn,Q,I,Se,x,se,te,_,N.predicate,ve,ie&&Mt?Mt:void 0,Be);ti&&ti.placeable&&We.verticalIconBox?(Gi=Ji(We.verticalIconBox),At=Gi.placeable):(Gi=Ji(We.iconBox),At=Gi.placeable),Bt=Bt&&Gi.offscreen}const la=q||Me.numHorizontalGlyphVertices===0&&Me.numVerticalGlyphVertices===0,Br=G||Me.numIconVertices===0;la||Br?Br?la||(At=At&&It):It=At&&It:At=It=At&&It;const en=At&&Gi.placeable;if(It&&ui.placeable&&this.collisionIndex.insertCollisionBox(ui.box,W,h.get("text-ignore-placement"),o.bucketInstanceId,ti&&ti.placeable&&Fr?Fr:Qr,N.ID),en&&this.collisionIndex.insertCollisionBox(Gi.box,Q,h.get("icon-ignore-placement"),o.bucketInstanceId,Sn,N.ID),fi&&It&&this.collisionIndex.insertCollisionCircles(fi.circles,W,h.get("text-ignore-placement"),o.bucketInstanceId,Qr,N.ID),s&&this.storeCollisionData(o.bucketInstanceId,lt,We,ui,Gi,fi),Me.crossTileID===0)throw new Error("symbolInstance.crossTileID can't be 0");if(o.bucketInstanceId===0)throw new Error("bucket.bucketInstanceId can't be 0");this.placements[Me.crossTileID]=new Ni((It||de)&&!(ui!=null&&ui.occluded),(At||we)&&!(Gi!=null&&Gi.occluded),Bt||o.justReloaded),i[Me.crossTileID]=!0};if(pe){if(e.symbolInstanceStart!==0)throw new Error("bucket.bucketInstanceId should be 0");const Me=o.getSortedSymbolIndexes(-this.transform.bearingInRadians);for(let We=Me.length-1;We>=0;--We){const lt=Me[We];Le(o.symbolInstances.get(lt),o.collisionArrays[lt],lt)}}else for(let Me=e.symbolInstanceStart;Me<e.symbolInstanceEnd;Me++)Le(o.symbolInstances.get(Me),o.collisionArrays[Me],Me);o.justReloaded=!1}storeCollisionData(e,i,s,o,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=o.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]-Dt),_.push(f.circles[x+1]-Dt),_.push(f.circles[x+2]),_.push(f.collisionDetected?1:0)}}markUsedJustification(e,i,s,o){let h;h=o===c.ah.vertical?s.verticalPlacedTextSymbolIndex:{left:s.leftJustifiedTextSymbolIndex,center:s.centerJustifiedTextSymbolIndex,right:s.rightJustifiedTextSymbolIndex}[c.aA(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 o=i===c.ah.horizontal||i===c.ah.horizontalOnly?i:0,h=i===c.ah.vertical?i:0,f=[s.leftJustifiedTextSymbolIndex,s.centerJustifiedTextSymbolIndex,s.rightJustifiedTextSymbolIndex];for(const _ of f)e.text.placedSymbolArray.get(_).placedOrientation=o;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 o=i?i.symbolFadeChange(e):1,h=i?i.opacities:{},f=i?i.variableOffsets:{},_=i?i.placedOrientations:{};for(const x in this.placements){const w=this.placements[x],I=h[x];I?(this.opacities[x]=new xn(I,o,w.text,w.icon),s=s||w.text!==I.text.placed||w.icon!==I.icon.placed):(this.opacities[x]=new xn(null,o,w.text,w.icon,w.skipFade),s=s||w.text||w.icon)}for(const x in h){const w=h[x];if(!this.opacities[x]){const I=new xn(w,o,!1,!1);I.isHidden()||(this.opacities[x]=I,s=s||w.text.placed||w.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 o of i){const h=o.getBucket(e);h&&o.latestFeatureIndex&&e.id===h.layerIds[0]&&this.updateBucketOpacities(h,o.tileID,s,o.collisionBoxArray)}}updateBucketOpacities(e,i,s,o){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 xn(null,0,!1,!1,!0),x=f.get("text-allow-overlap"),w=f.get("icon-allow-overlap"),I=h._unevaluatedLayout.hasValue("text-variable-anchor")||h._unevaluatedLayout.hasValue("text-variable-anchor-offset"),z=f.get("text-rotation-alignment")==="map",C=f.get("text-pitch-alignment")==="map",F=f.get("icon-text-fit")!=="none",N=new xn(null,0,x&&(w||!e.hasIconData()||f.get("icon-optional")),w&&(x||!e.hasTextData()||f.get("text-optional")),!0);!e.collisionArrays&&o&&(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData())&&e.deserializeCollisionBoxes(o);const q=(W,K,Q)=>{for(let ee=0;ee<K/4;ee++)W.opacityVertexArray.emplaceBack(Q);W.hasVisibleVertices=W.hasVisibleVertices||Q!==xs},G=this.collisionBoxArrays.get(e.bucketInstanceId);for(let W=0;W<e.symbolInstances.length;W++){const K=e.symbolInstances.get(W),{numHorizontalGlyphVertices:Q,numVerticalGlyphVertices:ee,crossTileID:te}=K;let se=this.opacities[te];s[te]?se=_:se||(se=N,this.opacities[te]=se),s[te]=!0;const ie=K.numIconVertices>0,pe=this.placedOrientations[K.crossTileID],de=pe===c.ah.vertical,we=pe===c.ah.horizontal||pe===c.ah.horizontalOnly;if(Q>0||ee>0){const ve=cu(se.text);q(e.text,Q,de?xs:ve),q(e.text,ee,we?xs:ve);const Be=se.text.isHidden();[K.rightJustifiedTextSymbolIndex,K.centerJustifiedTextSymbolIndex,K.leftJustifiedTextSymbolIndex].forEach(We=>{We>=0&&(e.text.placedSymbolArray.get(We).hidden=Be||de?1:0)}),K.verticalPlacedTextSymbolIndex>=0&&(e.text.placedSymbolArray.get(K.verticalPlacedTextSymbolIndex).hidden=Be||we?1:0);const Le=this.variableOffsets[K.crossTileID];Le&&this.markUsedJustification(e,Le.anchor,K,pe);const Me=this.placedOrientations[K.crossTileID];Me&&(this.markUsedJustification(e,"left",K,Me),this.markUsedOrientation(e,Me,K))}if(ie){const ve=cu(se.icon),Be=!(F&&K.verticalPlacedIconSymbolIndex&&de);K.placedIconSymbolIndex>=0&&(q(e.icon,K.numIconVertices,Be?ve:xs),e.icon.placedSymbolArray.get(K.placedIconSymbolIndex).hidden=se.icon.isHidden()),K.verticalPlacedIconSymbolIndex>=0&&(q(e.icon,K.numVerticalIconVertices,Be?xs:ve),e.icon.placedSymbolArray.get(K.verticalPlacedIconSymbolIndex).hidden=se.icon.isHidden())}const Se=G&&G.has(W)?G.get(W):{text:null,icon:null};if(e.hasIconCollisionBoxData()||e.hasTextCollisionBoxData()){const ve=e.collisionArrays[W];if(ve){let Be=new c.P(0,0);if(ve.textBox||ve.verticalTextBox){let Le=!0;if(I){const Me=this.variableOffsets[te];Me?(Be=Ea(Me.anchor,Me.width,Me.height,Me.textOffset,Me.textBoxScale),z&&Be._rotate(C?-this.transform.bearingInRadians:this.transform.bearingInRadians)):Le=!1}if(ve.textBox||ve.verticalTextBox){let Me;ve.textBox&&(Me=de),ve.verticalTextBox&&(Me=we),vn(e.textCollisionBox.collisionVertexArray,se.text.placed,!Le||Me,Se.text,Be.x,Be.y)}}if(ve.iconBox||ve.verticalIconBox){const Le=!!(!we&&ve.verticalIconBox);let Me;ve.iconBox&&(Me=Le),ve.verticalIconBox&&(Me=!Le),vn(e.iconCollisionBox.collisionVertexArray,se.icon.placed,Me,Se.icon,F?Be.x:0,F?Be.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 vn(u,e,i,s,o,h){s&&s.length!==0||(s=[0,0,0,0]);const f=s[0]-Dt,_=s[1]-Dt,x=s[2]-Dt,w=s[3]-Dt;u.emplaceBack(e?1:0,i?1:0,o||0,h||0,f,_),u.emplaceBack(e?1:0,i?1:0,o||0,h||0,x,_),u.emplaceBack(e?1:0,i?1:0,o||0,h||0,x,w),u.emplaceBack(e?1:0,i?1:0,o||0,h||0,f,w)}const za=Math.pow(2,25),au=Math.pow(2,24),su=Math.pow(2,17),ou=Math.pow(2,16),ka=Math.pow(2,9),lu=Math.pow(2,8),Oh=Math.pow(2,1);function cu(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*za+e*au+i*su+e*ou+i*ka+e*lu+i*Oh+e}const xs=0;class uu{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,o,h){const f=this._bucketParts;for(;this._currentTileIndex<e.length;)if(i.getBucketParts(f,o,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 hu{constructor(e,i,s,o,h,f,_,x){this.placement=new Tl(e,i,f,_,x),this._currentPlacementIndex=s.length-1,this._forceFullPlacement=o,this._showCollisionBoxes=h,this._done=!1}isDone(){return this._done}continuePlacement(e,i,s){const o=Ae.now(),h=()=>!this._forceFullPlacement&&Ae.now()-o>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 uu(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 Wn=512/c.Z/2;class Pl{constructor(e,i,s){this.tileID=e,this.bucketInstanceId=s,this._symbolsByKey={};const o=new Map;for(let h=0;h<i.length;h++){const f=i.get(h),_=f.key,x=o.get(_);x?x.push(f):o.set(_,[f])}for(const[h,f]of o){const _={positions:f.map(x=>({x:Math.floor(x.anchorX*Wn),y:Math.floor(x.anchorY*Wn)})),crossTileIDs:f.map(x=>x.crossTileID)};if(_.positions.length>128){const x=new c.aC(_.positions.length,16,Uint16Array);for(const{x:w,y:I}of _.positions)x.add(w,I);x.finish(),delete _.positions,_.index=x}this._symbolsByKey[h]=_}}getScaledCoordinates(e,i){const{x:s,y:o,z:h}=this.tileID.canonical,{x:f,y:_,z:x}=i.canonical,w=Wn/Math.pow(2,x-h),I=(_*c.Z+e.anchorY)*w,z=o*c.Z*Wn;return{x:Math.floor((f*c.Z+e.anchorX)*w-s*c.Z*Wn),y:Math.floor(I-z)}}findMatches(e,i,s){const o=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 w=_.index.range(x.x-o,x.y-o,x.x+o,x.y+o).sort();for(const I of w){const z=_.crossTileIDs[I];if(!s[z]){s[z]=!0,f.crossTileID=z;break}}}else if(_.positions)for(let w=0;w<_.positions.length;w++){const I=_.positions[w],z=_.crossTileIDs[w];if(Math.abs(I.x-x.x)<=o&&Math.abs(I.y-x.y)<=o&&!s[z]){s[z]=!0,f.crossTileID=z;break}}}}getCrossTileIDsLists(){return Object.values(this._symbolsByKey).map(({crossTileIDs:e})=>e)}}class du{constructor(){this.maxCrossTileID=0}generate(){return++this.maxCrossTileID}}class Sl{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 o=this.indexes[s],h={};for(const f in o){const _=o[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 o=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,o)}else{const _=f[e.scaledTo(Number(h)).key];_&&_.findMatches(i.symbolInstances,e,o)}}for(let h=0;h<i.symbolInstances.length;h++){const f=i.symbolInstances.get(h);f.crossTileID||(f.crossTileID=s.generate(),o[f.crossTileID]=!0)}return this.indexes[e.overscaledZ]===void 0&&(this.indexes[e.overscaledZ]={}),this.indexes[e.overscaledZ][e.key]=new Pl(e,i.symbolInstances,i.bucketInstanceId),!0}removeBucketCrossTileIDs(e,i){for(const s of i.getCrossTileIDsLists())for(const o of s)delete this.usedCrossTileIDs[e][o]}removeStaleBuckets(e){let i=!1;for(const s in this.indexes){const o=this.indexes[s];for(const h in o)e[o[h].bucketInstanceId]||(this.removeBucketCrossTileIDs(s,o[h]),delete o[h],i=!0)}return i}}class co{constructor(){this.layerIndexes={},this.crossTileIDs=new du,this.maxBucketInstanceId=0,this.bucketsInCurrentPlacement={}}addLayer(e,i,s){let o=this.layerIndexes[e.id];o===void 0&&(o=this.layerIndexes[e.id]=new Sl);let h=!1;const f={};o.handleWrapJump(s);for(const _ of i){const x=_.getBucket(e);x&&e.id===x.layerIds[0]&&(x.bucketInstanceId||(x.bucketInstanceId=++this.maxBucketInstanceId),o.addBucket(_.tileID,x,this.crossTileIDs)&&(h=!0),f[x.bucketInstanceId]=!0)}return o.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 vs="void main() {fragColor=vec4(1.0);}";const _r={prelude:dt(`#ifdef GL_ES
6
- precision mediump float;
7
- #else
8
- #if !defined(lowp)
9
- #define lowp
10
- #endif
11
- #if !defined(mediump)
12
- #define mediump
13
- #endif
14
- #if !defined(highp)
15
- #define highp
16
- #endif
17
- #endif
18
- out highp vec4 fragColor;`,`#ifdef GL_ES
19
- precision highp float;
20
- #else
21
- #if !defined(lowp)
22
- #define lowp
23
- #endif
24
- #if !defined(mediump)
25
- #define mediump
26
- #endif
27
- #if !defined(highp)
28
- #define highp
29
- #endif
30
- #endif
31
- 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
32
- );}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
33
- );}
34
- #ifdef TERRAIN3D
35
- 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;
36
- #endif
37
- 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) {
38
- #ifdef TERRAIN3D
39
- 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));
40
- #else
41
- return 1.0;
42
- #endif
43
- }float calculate_visibility(vec4 pos) {
44
- #ifdef TERRAIN3D
45
- 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;
46
- #else
47
- return 1.0;
48
- #endif
49
- }float ele(vec2 pos) {
50
- #ifdef TERRAIN3D
51
- vec4 rgb=(texture(u_terrain,pos)*255.0)*u_terrain_unpack;return rgb.r+rgb.g+rgb.b-u_terrain_unpack.a;
52
- #else
53
- return 0.0;
54
- #endif
55
- }float get_elevation(vec2 pos) {
56
- #ifdef TERRAIN3D
57
- #ifdef GLOBE
58
- if ((pos.y <-32767.5) || (pos.y > 32766.5)) {return 0.0;}
59
- #endif
60
- 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;
61
- #else
62
- return 0.0;
63
- #endif
64
- }const float PI=3.141592653589793;uniform mat4 u_projection_matrix;`),projectionMercator:dt("","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:dt("",`#define GLOBE_RADIUS 6371008.8
65
- 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
66
- );}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);
67
- 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
68
- );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:dt(`uniform vec4 u_color;uniform float u_opacity;void main() {fragColor=u_color*u_opacity;
69
- #ifdef OVERDRAW_INSPECTOR
70
- fragColor=vec4(1.0);
71
- #endif
72
- }`,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),backgroundPattern:dt(`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;
73
- #ifdef OVERDRAW_INSPECTOR
74
- fragColor=vec4(1.0);
75
- #endif
76
- }`,"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:dt(`in vec3 v_data;in float v_visibility;
77
- #pragma mapbox: define highp vec4 color
78
- #pragma mapbox: define mediump float radius
79
- #pragma mapbox: define lowp float blur
80
- #pragma mapbox: define lowp float opacity
81
- #pragma mapbox: define highp vec4 stroke_color
82
- #pragma mapbox: define mediump float stroke_width
83
- #pragma mapbox: define lowp float stroke_opacity
84
- void main() {
85
- #pragma mapbox: initialize highp vec4 color
86
- #pragma mapbox: initialize mediump float radius
87
- #pragma mapbox: initialize lowp float blur
88
- #pragma mapbox: initialize lowp float opacity
89
- #pragma mapbox: initialize highp vec4 stroke_color
90
- #pragma mapbox: initialize mediump float stroke_width
91
- #pragma mapbox: initialize lowp float stroke_opacity
92
- 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;}
93
- #ifdef OVERDRAW_INSPECTOR
94
- fragColor=vec4(1.0);
95
- #endif
96
- }`,`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;
97
- #pragma mapbox: define highp vec4 color
98
- #pragma mapbox: define mediump float radius
99
- #pragma mapbox: define lowp float blur
100
- #pragma mapbox: define lowp float opacity
101
- #pragma mapbox: define highp vec4 stroke_color
102
- #pragma mapbox: define mediump float stroke_width
103
- #pragma mapbox: define lowp float stroke_opacity
104
- void main(void) {
105
- #pragma mapbox: initialize highp vec4 color
106
- #pragma mapbox: initialize mediump float radius
107
- #pragma mapbox: initialize lowp float blur
108
- #pragma mapbox: initialize lowp float opacity
109
- #pragma mapbox: initialize highp vec4 stroke_color
110
- #pragma mapbox: initialize mediump float stroke_width
111
- #pragma mapbox: initialize lowp float stroke_opacity
112
- 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) {
113
- #ifdef GLOBE
114
- vec3 center_vector=projectToSphere(circle_center);
115
- #endif
116
- 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 {
117
- #ifdef GLOBE
118
- vec4 projected_center=interpolateProjection(circle_center,center_vector,ele);
119
- #else
120
- vec4 projected_center=projectTileWithElevation(circle_center,ele);
121
- #endif
122
- 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);}
123
- #ifdef GLOBE
124
- vec2 angles=extrude*angle_scale;vec3 corner_vector=globeRotateVector(center_vector,angles);gl_Position=interpolateProjection(corner_position,corner_vector,ele);
125
- #else
126
- gl_Position=projectTileWithElevation(corner_position,ele);
127
- #endif
128
- } 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:dt(vs,"in vec2 a_pos;void main() {gl_Position=projectTile(a_pos);}"),heatmap:dt(`uniform highp float u_intensity;in vec2 v_extrude;
129
- #pragma mapbox: define highp float weight
130
- #define GAUSS_COEF 0.3989422804014327
131
- void main() {
132
- #pragma mapbox: initialize highp float weight
133
- 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);
134
- #ifdef OVERDRAW_INSPECTOR
135
- fragColor=vec4(1.0);
136
- #endif
137
- }`,`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;
138
- #pragma mapbox: define highp float weight
139
- #pragma mapbox: define mediump float radius
140
- const highp float ZERO=1.0/255.0/16.0;
141
- #define GAUSS_COEF 0.3989422804014327
142
- void main(void) {
143
- #pragma mapbox: initialize highp float weight
144
- #pragma mapbox: initialize mediump float radius
145
- 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);
146
- #ifdef GLOBE
147
- 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);
148
- #else
149
- gl_Position=projectTileFor3D(circle_center+extrude,get_elevation(circle_center));
150
- #endif
151
- }`),heatmapTexture:dt(`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;
152
- #ifdef OVERDRAW_INSPECTOR
153
- fragColor=vec4(0.0);
154
- #endif
155
- }`,"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:dt("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:dt("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);}"),debug:dt("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:dt(vs,`in vec2 a_pos;void main() {
156
- #ifdef GLOBE
157
- gl_Position=projectTileFor3D(a_pos,0.0);
158
- #else
159
- gl_Position=u_projection_matrix*vec4(a_pos,0.0,1.0);
160
- #endif
161
- }`),fill:dt(`#pragma mapbox: define highp vec4 color
162
- #pragma mapbox: define lowp float opacity
163
- void main() {
164
- #pragma mapbox: initialize highp vec4 color
165
- #pragma mapbox: initialize lowp float opacity
166
- fragColor=color*opacity;
167
- #ifdef OVERDRAW_INSPECTOR
168
- fragColor=vec4(1.0);
169
- #endif
170
- }`,`uniform vec2 u_fill_translate;in vec2 a_pos;
171
- #pragma mapbox: define highp vec4 color
172
- #pragma mapbox: define lowp float opacity
173
- void main() {
174
- #pragma mapbox: initialize highp vec4 color
175
- #pragma mapbox: initialize lowp float opacity
176
- gl_Position=projectTile(a_pos+u_fill_translate,a_pos);}`),fillOutline:dt(`in vec2 v_pos;
177
- #ifdef GLOBE
178
- in float v_depth;
179
- #endif
180
- #pragma mapbox: define highp vec4 outline_color
181
- #pragma mapbox: define lowp float opacity
182
- void main() {
183
- #pragma mapbox: initialize highp vec4 outline_color
184
- #pragma mapbox: initialize lowp float opacity
185
- float dist=length(v_pos-gl_FragCoord.xy);float alpha=1.0-smoothstep(0.0,1.0,dist);fragColor=outline_color*(alpha*opacity);
186
- #ifdef GLOBE
187
- if (v_depth > 1.0) {discard;}
188
- #endif
189
- #ifdef OVERDRAW_INSPECTOR
190
- fragColor=vec4(1.0);
191
- #endif
192
- }`,`uniform vec2 u_world;uniform vec2 u_fill_translate;in vec2 a_pos;out vec2 v_pos;
193
- #ifdef GLOBE
194
- out float v_depth;
195
- #endif
196
- #pragma mapbox: define highp vec4 outline_color
197
- #pragma mapbox: define lowp float opacity
198
- void main() {
199
- #pragma mapbox: initialize highp vec4 outline_color
200
- #pragma mapbox: initialize lowp float opacity
201
- gl_Position=projectTile(a_pos+u_fill_translate,a_pos);v_pos=(gl_Position.xy/gl_Position.w+1.0)/2.0*u_world;
202
- #ifdef GLOBE
203
- v_depth=gl_Position.z/gl_Position.w;
204
- #endif
205
- }`),fillOutlinePattern:dt(`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;
206
- #ifdef GLOBE
207
- in float v_depth;
208
- #endif
209
- #pragma mapbox: define lowp float opacity
210
- #pragma mapbox: define lowp vec4 pattern_from
211
- #pragma mapbox: define lowp vec4 pattern_to
212
- void main() {
213
- #pragma mapbox: initialize lowp float opacity
214
- #pragma mapbox: initialize mediump vec4 pattern_from
215
- #pragma mapbox: initialize mediump vec4 pattern_to
216
- 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;
217
- #ifdef GLOBE
218
- if (v_depth > 1.0) {discard;}
219
- #endif
220
- #ifdef OVERDRAW_INSPECTOR
221
- fragColor=vec4(1.0);
222
- #endif
223
- }`,`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;
224
- #ifdef GLOBE
225
- out float v_depth;
226
- #endif
227
- #pragma mapbox: define lowp float opacity
228
- #pragma mapbox: define lowp vec4 pattern_from
229
- #pragma mapbox: define lowp vec4 pattern_to
230
- #pragma mapbox: define lowp float pixel_ratio_from
231
- #pragma mapbox: define lowp float pixel_ratio_to
232
- void main() {
233
- #pragma mapbox: initialize lowp float opacity
234
- #pragma mapbox: initialize mediump vec4 pattern_from
235
- #pragma mapbox: initialize mediump vec4 pattern_to
236
- #pragma mapbox: initialize lowp float pixel_ratio_from
237
- #pragma mapbox: initialize lowp float pixel_ratio_to
238
- 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;
239
- #ifdef GLOBE
240
- v_depth=gl_Position.z/gl_Position.w;
241
- #endif
242
- }`),fillPattern:dt(`#ifdef GL_ES
243
- precision highp float;
244
- #endif
245
- uniform vec2 u_texsize;uniform float u_fade;uniform sampler2D u_image;in vec2 v_pos_a;in vec2 v_pos_b;
246
- #pragma mapbox: define lowp float opacity
247
- #pragma mapbox: define lowp vec4 pattern_from
248
- #pragma mapbox: define lowp vec4 pattern_to
249
- void main() {
250
- #pragma mapbox: initialize lowp float opacity
251
- #pragma mapbox: initialize mediump vec4 pattern_from
252
- #pragma mapbox: initialize mediump vec4 pattern_to
253
- 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;
254
- #ifdef OVERDRAW_INSPECTOR
255
- fragColor=vec4(1.0);
256
- #endif
257
- }`,`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;
258
- #pragma mapbox: define lowp float opacity
259
- #pragma mapbox: define lowp vec4 pattern_from
260
- #pragma mapbox: define lowp vec4 pattern_to
261
- #pragma mapbox: define lowp float pixel_ratio_from
262
- #pragma mapbox: define lowp float pixel_ratio_to
263
- void main() {
264
- #pragma mapbox: initialize lowp float opacity
265
- #pragma mapbox: initialize mediump vec4 pattern_from
266
- #pragma mapbox: initialize mediump vec4 pattern_to
267
- #pragma mapbox: initialize lowp float pixel_ratio_from
268
- #pragma mapbox: initialize lowp float pixel_ratio_to
269
- 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:dt(`in vec4 v_color;void main() {fragColor=v_color;
270
- #ifdef OVERDRAW_INSPECTOR
271
- fragColor=vec4(1.0);
272
- #endif
273
- }`,`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;
274
- #ifdef TERRAIN3D
275
- in vec2 a_centroid;
276
- #endif
277
- out vec4 v_color;
278
- #pragma mapbox: define highp float base
279
- #pragma mapbox: define highp float height
280
- #pragma mapbox: define highp vec4 color
281
- void main() {
282
- #pragma mapbox: initialize highp float base
283
- #pragma mapbox: initialize highp float height
284
- #pragma mapbox: initialize highp vec4 color
285
- vec3 normal=a_normal_ed.xyz;
286
- #ifdef TERRAIN3D
287
- float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
288
- #else
289
- float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
290
- #endif
291
- 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;
292
- #ifdef GLOBE
293
- vec3 spherePos=projectToSphere(posInTile,a_pos);gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
294
- #else
295
- gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
296
- #endif
297
- 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);
298
- #ifdef GLOBE
299
- mat3 rotMatrix=globeGetRotationMatrix(spherePos);normalForLighting=rotMatrix*normalForLighting;directional=mix(directional,clamp(dot(normalForLighting,u_lightpos_globe),0.0,1.0),u_projection_transition);
300
- #endif
301
- 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:dt(`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;
302
- #pragma mapbox: define lowp float base
303
- #pragma mapbox: define lowp float height
304
- #pragma mapbox: define lowp vec4 pattern_from
305
- #pragma mapbox: define lowp vec4 pattern_to
306
- #pragma mapbox: define lowp float pixel_ratio_from
307
- #pragma mapbox: define lowp float pixel_ratio_to
308
- void main() {
309
- #pragma mapbox: initialize lowp float base
310
- #pragma mapbox: initialize lowp float height
311
- #pragma mapbox: initialize mediump vec4 pattern_from
312
- #pragma mapbox: initialize mediump vec4 pattern_to
313
- #pragma mapbox: initialize lowp float pixel_ratio_from
314
- #pragma mapbox: initialize lowp float pixel_ratio_to
315
- 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;
316
- #ifdef OVERDRAW_INSPECTOR
317
- fragColor=vec4(1.0);
318
- #endif
319
- }`,`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;
320
- #ifdef TERRAIN3D
321
- in vec2 a_centroid;
322
- #endif
323
- #ifdef GLOBE
324
- out vec3 v_sphere_pos;
325
- #endif
326
- out vec2 v_pos_a;out vec2 v_pos_b;out vec4 v_lighting;
327
- #pragma mapbox: define lowp float base
328
- #pragma mapbox: define lowp float height
329
- #pragma mapbox: define lowp vec4 pattern_from
330
- #pragma mapbox: define lowp vec4 pattern_to
331
- #pragma mapbox: define lowp float pixel_ratio_from
332
- #pragma mapbox: define lowp float pixel_ratio_to
333
- void main() {
334
- #pragma mapbox: initialize lowp float base
335
- #pragma mapbox: initialize lowp float height
336
- #pragma mapbox: initialize mediump vec4 pattern_from
337
- #pragma mapbox: initialize mediump vec4 pattern_to
338
- #pragma mapbox: initialize lowp float pixel_ratio_from
339
- #pragma mapbox: initialize lowp float pixel_ratio_to
340
- 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;
341
- #ifdef TERRAIN3D
342
- float height_terrain3d_offset=get_elevation(a_centroid);float base_terrain3d_offset=height_terrain3d_offset-(base > 0.0 ? 0.0 : 10.0);
343
- #else
344
- float height_terrain3d_offset=0.0;float base_terrain3d_offset=0.0;
345
- #endif
346
- 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;
347
- #ifdef GLOBE
348
- vec3 spherePos=projectToSphere(posInTile,a_pos);vec3 elevatedPos=spherePos*(1.0+elevation/GLOBE_RADIUS);v_sphere_pos=elevatedPos;gl_Position=interpolateProjectionFor3D(posInTile,spherePos,elevation);
349
- #else
350
- gl_Position=u_projection_matrix*vec4(posInTile,elevation,1.0);
351
- #endif
352
- vec2 pos=normal.x==1.0 && normal.y==0.0 && normal.z==16384.0
353
- ? a_pos
354
- : 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:dt(`#ifdef GL_ES
355
- precision highp float;
356
- #endif
357
- 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)/4.0;}void main() {vec2 epsilon=1.0/u_dimension;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))/pow(2.0,exaggeration+(19.2562-u_zoom));fragColor=clamp(vec4(deriv.x/2.0+0.5,deriv.y/2.0+0.5,1.0,1.0),0.0,1.0);
358
- #ifdef OVERDRAW_INSPECTOR
359
- fragColor=vec4(1.0);
360
- #endif
361
- }`,"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:dt(`uniform sampler2D u_image;in vec2 v_pos;uniform vec2 u_latrange;uniform vec2 u_light;uniform vec4 u_shadow;uniform vec4 u_highlight;uniform vec4 u_accent;
362
- #define PI 3.141592653589793
363
- void main() {vec4 pixel=texture(u_image,v_pos);vec2 deriv=((pixel.rg*2.0)-1.0);float scaleFactor=cos(radians((u_latrange[0]-u_latrange[1])*(1.0-v_pos.y)+u_latrange[1]));float slope=atan(1.25*length(deriv)/scaleFactor);float aspect=deriv.x !=0.0 ? atan(deriv.y,-deriv.x) : PI/2.0*(deriv.y > 0.0 ? 1.0 :-1.0);float intensity=u_light.x;float azimuth=u_light.y+PI;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_shadow,u_highlight,shade)*sin(scaledSlope)*clamp(intensity*2.0,0.0,1.0);fragColor=accent_color*(1.0-shade_color.a)+shade_color;
364
- #ifdef OVERDRAW_INSPECTOR
365
- fragColor=vec4(1.0);
366
- #endif
367
- }`,"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:dt(`uniform lowp float u_device_pixel_ratio;in vec2 v_width2;in vec2 v_normal;in float v_gamma_scale;
368
- #ifdef GLOBE
369
- in float v_depth;
370
- #endif
371
- #pragma mapbox: define highp vec4 color
372
- #pragma mapbox: define lowp float blur
373
- #pragma mapbox: define lowp float opacity
374
- void main() {
375
- #pragma mapbox: initialize highp vec4 color
376
- #pragma mapbox: initialize lowp float blur
377
- #pragma mapbox: initialize lowp float opacity
378
- 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);
379
- #ifdef GLOBE
380
- if (v_depth > 1.0) {discard;}
381
- #endif
382
- #ifdef OVERDRAW_INSPECTOR
383
- fragColor=vec4(1.0);
384
- #endif
385
- }`,`
386
- #define scale 0.015873016
387
- 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;
388
- #ifdef GLOBE
389
- out float v_depth;
390
- #endif
391
- #pragma mapbox: define highp vec4 color
392
- #pragma mapbox: define lowp float blur
393
- #pragma mapbox: define lowp float opacity
394
- #pragma mapbox: define mediump float gapwidth
395
- #pragma mapbox: define lowp float offset
396
- #pragma mapbox: define mediump float width
397
- void main() {
398
- #pragma mapbox: initialize highp vec4 color
399
- #pragma mapbox: initialize lowp float blur
400
- #pragma mapbox: initialize lowp float opacity
401
- #pragma mapbox: initialize mediump float gapwidth
402
- #pragma mapbox: initialize lowp float offset
403
- #pragma mapbox: initialize mediump float width
404
- 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;
405
- #ifdef GLOBE
406
- v_depth=gl_Position.z/gl_Position.w;
407
- #endif
408
- #ifdef TERRAIN3D
409
- v_gamma_scale=1.0;
410
- #else
411
- 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;
412
- #endif
413
- v_width2=vec2(outset,inset);}`),lineGradient:dt(`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;
414
- #ifdef GLOBE
415
- in float v_depth;
416
- #endif
417
- #pragma mapbox: define lowp float blur
418
- #pragma mapbox: define lowp float opacity
419
- void main() {
420
- #pragma mapbox: initialize lowp float blur
421
- #pragma mapbox: initialize lowp float opacity
422
- 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);
423
- #ifdef GLOBE
424
- if (v_depth > 1.0) {discard;}
425
- #endif
426
- #ifdef OVERDRAW_INSPECTOR
427
- fragColor=vec4(1.0);
428
- #endif
429
- }`,`
430
- #define scale 0.015873016
431
- 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;
432
- #ifdef GLOBE
433
- out float v_depth;
434
- #endif
435
- #pragma mapbox: define lowp float blur
436
- #pragma mapbox: define lowp float opacity
437
- #pragma mapbox: define mediump float gapwidth
438
- #pragma mapbox: define lowp float offset
439
- #pragma mapbox: define mediump float width
440
- void main() {
441
- #pragma mapbox: initialize lowp float blur
442
- #pragma mapbox: initialize lowp float opacity
443
- #pragma mapbox: initialize mediump float gapwidth
444
- #pragma mapbox: initialize lowp float offset
445
- #pragma mapbox: initialize mediump float width
446
- 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;
447
- #ifdef GLOBE
448
- v_depth=gl_Position.z/gl_Position.w;
449
- #endif
450
- #ifdef TERRAIN3D
451
- v_gamma_scale=1.0;
452
- #else
453
- 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;
454
- #endif
455
- v_width2=vec2(outset,inset);}`),linePattern:dt(`#ifdef GL_ES
456
- precision highp float;
457
- #endif
458
- 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;
459
- #ifdef GLOBE
460
- in float v_depth;
461
- #endif
462
- #pragma mapbox: define lowp vec4 pattern_from
463
- #pragma mapbox: define lowp vec4 pattern_to
464
- #pragma mapbox: define lowp float pixel_ratio_from
465
- #pragma mapbox: define lowp float pixel_ratio_to
466
- #pragma mapbox: define lowp float blur
467
- #pragma mapbox: define lowp float opacity
468
- void main() {
469
- #pragma mapbox: initialize mediump vec4 pattern_from
470
- #pragma mapbox: initialize mediump vec4 pattern_to
471
- #pragma mapbox: initialize lowp float pixel_ratio_from
472
- #pragma mapbox: initialize lowp float pixel_ratio_to
473
- #pragma mapbox: initialize lowp float blur
474
- #pragma mapbox: initialize lowp float opacity
475
- 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;
476
- #ifdef GLOBE
477
- if (v_depth > 1.0) {discard;}
478
- #endif
479
- #ifdef OVERDRAW_INSPECTOR
480
- fragColor=vec4(1.0);
481
- #endif
482
- }`,`
483
- #define scale 0.015873016
484
- #define LINE_DISTANCE_SCALE 2.0
485
- 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;
486
- #ifdef GLOBE
487
- out float v_depth;
488
- #endif
489
- #pragma mapbox: define lowp float blur
490
- #pragma mapbox: define lowp float opacity
491
- #pragma mapbox: define lowp float offset
492
- #pragma mapbox: define mediump float gapwidth
493
- #pragma mapbox: define mediump float width
494
- #pragma mapbox: define lowp float floorwidth
495
- #pragma mapbox: define lowp vec4 pattern_from
496
- #pragma mapbox: define lowp vec4 pattern_to
497
- #pragma mapbox: define lowp float pixel_ratio_from
498
- #pragma mapbox: define lowp float pixel_ratio_to
499
- void main() {
500
- #pragma mapbox: initialize lowp float blur
501
- #pragma mapbox: initialize lowp float opacity
502
- #pragma mapbox: initialize lowp float offset
503
- #pragma mapbox: initialize mediump float gapwidth
504
- #pragma mapbox: initialize mediump float width
505
- #pragma mapbox: initialize lowp float floorwidth
506
- #pragma mapbox: initialize mediump vec4 pattern_from
507
- #pragma mapbox: initialize mediump vec4 pattern_to
508
- #pragma mapbox: initialize lowp float pixel_ratio_from
509
- #pragma mapbox: initialize lowp float pixel_ratio_to
510
- 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;
511
- #ifdef GLOBE
512
- v_depth=gl_Position.z/gl_Position.w;
513
- #endif
514
- #ifdef TERRAIN3D
515
- v_gamma_scale=1.0;
516
- #else
517
- 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;
518
- #endif
519
- v_linesofar=a_linesofar;v_width2=vec2(outset,inset);v_width=floorwidth;}`),lineSDF:dt(`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;
520
- #ifdef GLOBE
521
- in float v_depth;
522
- #endif
523
- #pragma mapbox: define highp vec4 color
524
- #pragma mapbox: define lowp float blur
525
- #pragma mapbox: define lowp float opacity
526
- #pragma mapbox: define mediump float width
527
- #pragma mapbox: define lowp float floorwidth
528
- void main() {
529
- #pragma mapbox: initialize highp vec4 color
530
- #pragma mapbox: initialize lowp float blur
531
- #pragma mapbox: initialize lowp float opacity
532
- #pragma mapbox: initialize mediump float width
533
- #pragma mapbox: initialize lowp float floorwidth
534
- 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);
535
- #ifdef GLOBE
536
- if (v_depth > 1.0) {discard;}
537
- #endif
538
- #ifdef OVERDRAW_INSPECTOR
539
- fragColor=vec4(1.0);
540
- #endif
541
- }`,`
542
- #define scale 0.015873016
543
- #define LINE_DISTANCE_SCALE 2.0
544
- 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;
545
- #ifdef GLOBE
546
- out float v_depth;
547
- #endif
548
- #pragma mapbox: define highp vec4 color
549
- #pragma mapbox: define lowp float blur
550
- #pragma mapbox: define lowp float opacity
551
- #pragma mapbox: define mediump float gapwidth
552
- #pragma mapbox: define lowp float offset
553
- #pragma mapbox: define mediump float width
554
- #pragma mapbox: define lowp float floorwidth
555
- void main() {
556
- #pragma mapbox: initialize highp vec4 color
557
- #pragma mapbox: initialize lowp float blur
558
- #pragma mapbox: initialize lowp float opacity
559
- #pragma mapbox: initialize mediump float gapwidth
560
- #pragma mapbox: initialize lowp float offset
561
- #pragma mapbox: initialize mediump float width
562
- #pragma mapbox: initialize lowp float floorwidth
563
- 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;
564
- #ifdef GLOBE
565
- v_depth=gl_Position.z/gl_Position.w;
566
- #endif
567
- #ifdef TERRAIN3D
568
- v_gamma_scale=1.0;
569
- #else
570
- 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;
571
- #endif
572
- 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:dt(`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);
573
- #ifdef OVERDRAW_INSPECTOR
574
- fragColor=vec4(1.0);
575
- #endif
576
- }`,`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;
577
- #ifdef GLOBE
578
- if (a_pos.y <-32767.5) {v_pos0.y=0.0;}if (a_pos.y > 32766.5) {v_pos0.y=1.0;}
579
- #endif
580
- v_pos1=(v_pos0*u_scale_parent)+u_tl_parent;}`),symbolIcon:dt(`uniform sampler2D u_texture;in vec2 v_tex;in float v_fade_opacity;
581
- #pragma mapbox: define lowp float opacity
582
- void main() {
583
- #pragma mapbox: initialize lowp float opacity
584
- lowp float alpha=opacity*v_fade_opacity;fragColor=texture(u_texture,v_tex)*alpha;
585
- #ifdef OVERDRAW_INSPECTOR
586
- fragColor=vec4(1.0);
587
- #endif
588
- }`,`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;
589
- #pragma mapbox: define lowp float opacity
590
- void main() {
591
- #pragma mapbox: initialize lowp float opacity
592
- 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 ?
593
- camera_to_anchor_distance/u_camera_to_center_distance :
594
- 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;
595
- #ifdef GLOBE
596
- 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);}
597
- #endif
598
- 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:dt(`#define SDF_PX 8.0
599
- 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;
600
- #pragma mapbox: define highp vec4 fill_color
601
- #pragma mapbox: define highp vec4 halo_color
602
- #pragma mapbox: define lowp float opacity
603
- #pragma mapbox: define lowp float halo_width
604
- #pragma mapbox: define lowp float halo_blur
605
- void main() {
606
- #pragma mapbox: initialize highp vec4 fill_color
607
- #pragma mapbox: initialize highp vec4 halo_color
608
- #pragma mapbox: initialize lowp float opacity
609
- #pragma mapbox: initialize lowp float halo_width
610
- #pragma mapbox: initialize lowp float halo_blur
611
- 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);
612
- #ifdef OVERDRAW_INSPECTOR
613
- fragColor=vec4(1.0);
614
- #endif
615
- }`,`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;
616
- #pragma mapbox: define highp vec4 fill_color
617
- #pragma mapbox: define highp vec4 halo_color
618
- #pragma mapbox: define lowp float opacity
619
- #pragma mapbox: define lowp float halo_width
620
- #pragma mapbox: define lowp float halo_blur
621
- void main() {
622
- #pragma mapbox: initialize highp vec4 fill_color
623
- #pragma mapbox: initialize highp vec4 halo_color
624
- #pragma mapbox: initialize lowp float opacity
625
- #pragma mapbox: initialize lowp float halo_width
626
- #pragma mapbox: initialize lowp float halo_blur
627
- 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 ?
628
- camera_to_anchor_distance/u_camera_to_center_distance :
629
- 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;
630
- #ifdef GLOBE
631
- 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);}
632
- #endif
633
- 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:dt(`#define SDF_PX 8.0
634
- #define SDF 1.0
635
- #define ICON 0.0
636
- 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;
637
- #pragma mapbox: define highp vec4 fill_color
638
- #pragma mapbox: define highp vec4 halo_color
639
- #pragma mapbox: define lowp float opacity
640
- #pragma mapbox: define lowp float halo_width
641
- #pragma mapbox: define lowp float halo_blur
642
- void main() {
643
- #pragma mapbox: initialize highp vec4 fill_color
644
- #pragma mapbox: initialize highp vec4 halo_color
645
- #pragma mapbox: initialize lowp float opacity
646
- #pragma mapbox: initialize lowp float halo_width
647
- #pragma mapbox: initialize lowp float halo_blur
648
- 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;
649
- #ifdef OVERDRAW_INSPECTOR
650
- fragColor=vec4(1.0);
651
- #endif
652
- 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);
653
- #ifdef OVERDRAW_INSPECTOR
654
- fragColor=vec4(1.0);
655
- #endif
656
- }`,`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;
657
- #pragma mapbox: define highp vec4 fill_color
658
- #pragma mapbox: define highp vec4 halo_color
659
- #pragma mapbox: define lowp float opacity
660
- #pragma mapbox: define lowp float halo_width
661
- #pragma mapbox: define lowp float halo_blur
662
- void main() {
663
- #pragma mapbox: initialize highp vec4 fill_color
664
- #pragma mapbox: initialize highp vec4 halo_color
665
- #pragma mapbox: initialize lowp float opacity
666
- #pragma mapbox: initialize lowp float halo_width
667
- #pragma mapbox: initialize lowp float halo_blur
668
- 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 ?
669
- camera_to_anchor_distance/u_camera_to_center_distance :
670
- 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;
671
- #ifdef GLOBE
672
- 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);}
673
- #endif
674
- 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:dt("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:dt("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:dt("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:dt("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:dt(`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
675
- );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:dt("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 dt(u,e){const i=/#pragma mapbox: ([\w]+) ([\w]+) ([\w]+) ([\w]+)/g,s=e.match(/in ([\w]+) ([\w]+)/g),o=u.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),h=e.match(/uniform ([\w]+) ([\w]+)([\s]*)([\w]*)/g),f=h?h.concat(o):o,_={};return{fragmentSource:u=u.replace(i,(x,w,I,z,C)=>(_[C]=!0,w==="define"?`
676
- #ifndef HAS_UNIFORM_u_${C}
677
- in ${I} ${z} ${C};
678
- #else
679
- uniform ${I} ${z} u_${C};
680
- #endif
681
- `:`
682
- #ifdef HAS_UNIFORM_u_${C}
683
- ${I} ${z} ${C} = u_${C};
684
- #endif
685
- `)),vertexSource:e=e.replace(i,(x,w,I,z,C)=>{const F=z==="float"?"vec2":"vec4",N=C.match(/color/)?"color":F;return _[C]?w==="define"?`
686
- #ifndef HAS_UNIFORM_u_${C}
687
- uniform lowp float u_${C}_t;
688
- in ${I} ${F} a_${C};
689
- out ${I} ${z} ${C};
690
- #else
691
- uniform ${I} ${z} u_${C};
692
- #endif
693
- `:N==="vec4"?`
694
- #ifndef HAS_UNIFORM_u_${C}
695
- ${C} = a_${C};
696
- #else
697
- ${I} ${z} ${C} = u_${C};
698
- #endif
699
- `:`
700
- #ifndef HAS_UNIFORM_u_${C}
701
- ${C} = unpack_mix_${N}(a_${C}, u_${C}_t);
702
- #else
703
- ${I} ${z} ${C} = u_${C};
704
- #endif
705
- `:w==="define"?`
706
- #ifndef HAS_UNIFORM_u_${C}
707
- uniform lowp float u_${C}_t;
708
- in ${I} ${F} a_${C};
709
- #else
710
- uniform ${I} ${z} u_${C};
711
- #endif
712
- `:N==="vec4"?`
713
- #ifndef HAS_UNIFORM_u_${C}
714
- ${I} ${z} ${C} = a_${C};
715
- #else
716
- ${I} ${z} ${C} = u_${C};
717
- #endif
718
- `:`
719
- #ifndef HAS_UNIFORM_u_${C}
720
- ${I} ${z} ${C} = unpack_mix_${N}(a_${C}, u_${C}_t);
721
- #else
722
- ${I} ${z} ${C} = u_${C};
723
- #endif
724
- `}),staticAttributes:s,staticUniforms:f}}class Hn{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 bn=c.aD([{name:"a_pos",type:"Int16",components:2}]);const Kr="#define PROJECTION_MERCATOR",Aa="mercator";class yt{constructor(){this._cachedMesh=null}get name(){return"mercator"}get useSubdivision(){return!1}get shaderVariantName(){return Aa}get shaderDefine(){return Kr}get shaderPreludeCode(){return _r.projectionMercator}get vertexShaderPreludeCode(){return _r.projectionMercator.vertexSource}get subdivisionGranularity(){return c.aE.noSubdivision}get useGlobeControls(){return!1}get transitionState(){return 0}get latitudeErrorCorrectionRadians(){return 0}destroy(){}updateGPUdependent(e){}getMeshFromTileID(e,i,s,o,h){if(this._cachedMesh)return this._cachedMesh;const f=new c.aF;f.emplaceBack(0,0),f.emplaceBack(c.Z,0),f.emplaceBack(0,c.Z),f.emplaceBack(c.Z,c.Z);const _=e.createVertexBuffer(f,bn.members),x=c.aG.simpleSegment(0,0,4,2),w=new c.aH;w.emplaceBack(1,0,2),w.emplaceBack(1,2,3);const I=e.createIndexBuffer(w);return this._cachedMesh=new Hn(_,I,x),this._cachedMesh}recalculate(){}hasTransition(){return!1}setErrorQueryLatitudeDegrees(e){}}function ar(u,e){const i=c.ae(e.lat,-85.051129,c.aJ);return new c.P(c.U(e.lng)*u,c.S(i)*u)}function bs(u,e){return new c.$(e.x/u,e.y/u).toLngLat()}function Ra(u){return u.cameraToCenterDistance*Math.min(.85*Math.tan(c.ad(90-u.pitch)),Math.tan(c.ad(89.25-u.pitch)))}function Di(u,e){const i=u.canonical,s=e/c.aI(i.z),o=i.x+Math.pow(2,i.z)*u.wrap,h=c.at(new Float64Array(16));return c.L(h,h,[o*s,i.y*s,0]),c.M(h,h,[s/c.Z,s/c.Z,1]),h}function bi(u,e,i,s,o){const h=c.$.fromLngLat(u,e),f=o*c.aK(1,u.lat),_=f*Math.cos(c.ad(i)),x=Math.sqrt(f*f-_*_),w=x*Math.sin(c.ad(-s)),I=x*Math.cos(c.ad(-s));return new c.$(h.x+w,h.y+I,h.z+_)}class jt{constructor(e=0,i=0,s=0,o=0){if(isNaN(e)||e<0||isNaN(i)||i<0||isNaN(s)||s<0||isNaN(o)||o<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=o}interpolate(e,i,s){return i.top!=null&&e.top!=null&&(this.top=c.B.number(e.top,i.top,s)),i.bottom!=null&&e.bottom!=null&&(this.bottom=c.B.number(e.bottom,i.bottom,s)),i.left!=null&&e.left!=null&&(this.left=c.B.number(e.left,i.left,s)),i.right!=null&&e.right!=null&&(this.right=c.B.number(e.right,i.right,s)),this}getCenter(e,i){const s=c.ae((this.left+e-this.right)/2,0,e),o=c.ae((this.top+i-this.bottom)/2,0,i);return new c.P(s,o)}equals(e){return this.top===e.top&&this.bottom===e.bottom&&this.left===e.left&&this.right===e.right}clone(){return new jt(this.top,this.bottom,this.left,this.right)}toJSON(){return{top:this.top,bottom:this.bottom,left:this.left,right:this.right}}}function uo(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 Li(u){return Math.max(0,Math.floor(u))}class Zi{constructor(e,i,s,o,h,f){this._callbacks=e,this._tileSize=512,this._renderWorldCopies=f===void 0||!!f,this._minZoom=i||0,this._maxZoom=s||22,this._minPitch=o??0,this._maxPitch=h??60,this.setMaxBounds(),this._width=0,this._height=0,this._center=new c.Q(0,0),this._elevation=0,this._zoom=0,this._tileZoom=Li(this._zoom),this._scale=c.aI(this._zoom),this._bearingInRadians=0,this._fovInRadians=.6435011087932844,this._pitchInRadians=0,this._rollInRadians=0,this._unmodified=!0,this._edgeInsets=new jt,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=Li(this._zoom),this._scale=c.aI(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 jt(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 c.P(this._width,this._height)}get bearing(){return this._bearingInRadians/Math.PI*180}setBearing(e){const i=c.aL(e,-180,180)*Math.PI/180;var s,o,h,f,_,x,w,I,z;this._bearingInRadians!==i&&(this._unmodified=!1,this._bearingInRadians=i,this._calcMatrices(),this._rotationMatrix=ge(),s=this._rotationMatrix,h=-this._bearingInRadians,f=(o=this._rotationMatrix)[0],_=o[1],x=o[2],w=o[3],I=Math.sin(h),z=Math.cos(h),s[0]=f*z+x*I,s[1]=_*z+w*I,s[2]=f*-I+x*z,s[3]=_*-I+w*z)}get rotationMatrix(){return this._rotationMatrix}get pitchInRadians(){return this._pitchInRadians}get pitch(){return this._pitchInRadians/Math.PI*180}setPitch(e){const i=c.ae(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 c.aM(this._fovInRadians)}setFov(e){e=c.ae(e,.1,150),this.fov!==e&&(this._unmodified=!1,this._fovInRadians=c.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=c.aI(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 Yt([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,c.aJ])}getConstrained(e,i){return this._callbacks.getConstrained(e,i)}getCameraQueryGeometry(e,i){if(i.length===1)return[i[0],e];{let s=e.x,o=e.y,h=e.x,f=e.y;for(const _ of i)s=Math.min(s,_.x),o=Math.min(o,_.y),h=Math.max(h,_.x),f=Math.max(f,_.y);return[new c.P(s,o),new c.P(h,o),new c.P(h,f),new c.P(s,f),new c.P(s,o)]}}_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=c.at(new Float64Array(16));c.M(e,e,[this._width/2,-this._height/2,1]),c.L(e,e,[1,-1,0]),this._clipSpaceToPixelsMatrix=e,e=c.at(new Float64Array(16)),c.M(e,e,[1,-1,1]),c.L(e,e,[-1,-1,0]),c.M(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,o){const h=s!==void 0?s:this.bearing,f=o=o!==void 0?o:this.pitch,_=c.$.fromLngLat(e,i),x=-Math.cos(c.ad(f)),w=Math.sin(c.ad(f)),I=w*Math.sin(c.ad(h)),z=-w*Math.cos(c.ad(h));let C=this.elevation;const F=i-C;let N;x*F>=0||Math.abs(x)<.1?(N=1e4,C=i+N*x):N=-F/x;let q,G,W=c.aN(1,_.y),K=0;do{if(K+=1,K>10)break;G=N/W,q=new c.$(_.x+I*G,_.y+z*G),W=1/q.meterInMercatorCoordinateUnits()}while(Math.abs(N-G*W)>1e-12);return{center:q.toLngLat(),elevation:C,zoom:c.ab(this.height/2/Math.tan(this.fovInRadians/2)/G/this.tileSize)}}recalculateZoomAndCenter(e){if(this.elevation-e==0)return;const i=c.aK(1,this.center.lat)*this.worldSize,s=this.cameraToCenterDistance/i,o=c.$.fromLngLat(this.center,this.elevation),h=bi(this.center,this.elevation,this.pitch,this.bearing,s);this._elevation=e;const f=this.calculateCenterFromCameraLngLatAlt(h.toLngLat(),c.aN(h.z,o.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 c.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=c.aK(1,this.center.lat)*this.worldSize;return bi(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/c.Z,1/i/c.Z]}}class ci{constructor(e,i){this.min=e,this.max=i,this.center=c.aO([],c.aP([],this.min,this.max),.5)}quadrant(e){const i=[e%2==0,e<2],s=c.aQ(this.min),o=c.aQ(this.max);for(let h=0;h<i.length;h++)s[h]=i[h]?this.min[h]:this.center[h],o[h]=i[h]?this.center[h]:this.max[h];return o[2]=this.max[2],new ci(s,o)}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 o=this.intersectsPlane(e.planes[s]);if(o===0)return 0;o===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 o=0;o<3;o++)e[o]>0?(i+=e[o]*this.min[o],s+=e[o]*this.max[o]):(s+=e[o]*this.min[o],i+=e[o]*this.max[o]);return i>=0?2:s<0?0:1}}class pu{distanceToTile2d(e,i,s,o){const h=o.distanceX([e,i]),f=o.distanceY([e,i]);return Math.hypot(h,f)}getWrap(e,i,s){return s}getTileAABB(e,i,s,o){var h,f;let _=s,x=s;if(o.terrain){const I=new c.Y(e.z,i,e.z,e.x,e.y),z=o.terrain.getMinMaxElevation(I);_=(h=z.minElevation)!==null&&h!==void 0?h:s,x=(f=z.maxElevation)!==null&&f!==void 0?f:s}const w=1<<e.z;return new ci([i+e.x/w,e.y/w,_],[i+(e.x+1)/w,(e.y+1)/w,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,o=c.ae(78.5-s/2,0,60);return!!i.terrain||e.pitch>o}allowWorldCopies(){return!0}recalculateCache(){}}class wn{constructor(e,i,s){this.points=e,this.planes=i,this.aabb=s}static fromInvProjectionMatrix(e,i=1,s=0){const o=Math.pow(2,s),h=[[-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(w=>{const I=1/(w=c.ap([],w,e))[3]/i*o;return c.aR(w,w,[I,I,1/w[3],I])}),f=[[0,1,2],[6,5,4],[0,3,7],[2,1,5],[3,2,6],[0,4,5]].map(w=>{const I=c.aS([],h[w[0]],h[w[1]]),z=c.aS([],h[w[2]],h[w[1]]),C=c.aT([],c.aU([],I,z)),F=-c.aV(C,h[w[1]]);return C.concat(F)}),_=[Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY,Number.POSITIVE_INFINITY],x=[Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY,Number.NEGATIVE_INFINITY];for(const w of h)for(let I=0;I<3;I++)_[I]=Math.min(_[I],w[I]),x[I]=Math.max(x[I],w[I]);return new wn(h,f,new ci(_,x))}}class Nt{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,o,h){this._posMatrixCache=new Map,this._alignedPosMatrixCache=new Map,this._fogMatrixCacheF32=new Map,this._helper=new Zi({calcMatrices:()=>{this._calcMatrices()},getConstrained:(f,_)=>this.getConstrained(f,_)},e,i,s,o,h),this._coveringTilesDetailsProvider=new pu}clone(){const e=new Nt;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 c.aW(0,e)];if(this._helper._renderWorldCopies){const s=this.screenPointToMercatorCoordinate(new c.P(0,0)),o=this.screenPointToMercatorCoordinate(new c.P(this._helper._width,0)),h=this.screenPointToMercatorCoordinate(new c.P(this._helper._width,this._helper._height)),f=this.screenPointToMercatorCoordinate(new c.P(0,this._helper._height)),_=Math.floor(Math.min(s.x,o.x,h.x,f.x)),x=Math.floor(Math.max(s.x,o.x,h.x,f.x)),w=1;for(let I=_-w;I<=x+w;I++)I!==0&&i.push(new c.aW(I,e))}return i}getCameraFrustum(){return wn.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=c.aK(this.elevation,this.center.lat),o=this.screenPointToMercatorCoordinateAtZ(i,s),h=this.screenPointToMercatorCoordinateAtZ(this.centerPoint,s),f=c.$.fromLngLat(e),_=new c.$(f.x-(o.x-h.x),f.y-(o.y-h.y));this.setCenter(_==null?void 0:_.toLngLat()),this._helper._renderWorldCopies&&this.setCenter(this.center.wrap())}locationToScreenPoint(e,i){return i?this.coordinatePoint(c.$.fromLngLat(e),i.getElevationForLngLatZoom(e,this._helper._tileZoom),this._pixelMatrix3D):this.coordinatePoint(c.$.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,o=[e.x,e.y,0,1],h=[e.x,e.y,1,1];c.ap(o,o,this._pixelMatrixInverse),c.ap(h,h,this._pixelMatrixInverse);const f=o[3],_=h[3],x=o[1]/f,w=h[1]/_,I=o[2]/f,z=h[2]/_,C=I===z?0:(s-I)/(z-I);return new c.$(c.B.number(o[0]/f,h[0]/_,C)/this.worldSize,c.B.number(x,w,C)/this.worldSize,s)}coordinatePoint(e,i=0,s=this._pixelMatrix){const o=[e.x*this.worldSize,e.y*this.worldSize,i,1];return c.ap(o,o,s),new c.P(o[0]/o[3],o[1]/o[3])}getBounds(){const e=Math.max(0,this._helper._height/2-Ra(this));return new Yt().extend(this.screenPointToLocation(new c.P(0,e))).extend(this.screenPointToLocation(new c.P(this._helper._width,e))).extend(this.screenPointToLocation(new c.P(this._helper._width,this._helper._height))).extend(this.screenPointToLocation(new c.P(0,this._helper._height)))}isPointOnMapSurface(e,i){return i?i.pointCoordinate(e)!=null:e.y>this.height/2-Ra(this)}calculatePosMatrix(e,i=!1,s){var o;const h=(o=e.key)!==null&&o!==void 0?o:c.aX(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 w=f.get(h);return s?w.f32:w.f64}const _=Di(e,this.worldSize);c.N(_,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 o=Di(e,this.worldSize);return c.N(o,this._fogMatrix,o),s.set(i,new Float32Array(o)),s.get(i)}getConstrained(e,i){i=c.ae(+i,this.minZoom,this.maxZoom);const s={center:new c.Q(e.lng,e.lat),zoom:i};let o=this._helper._lngRange;this._helper._renderWorldCopies||o!==null||(o=[-179.9999999999,180-1e-10]);const h=this.tileSize*c.aI(s.zoom);let f=0,_=h,x=0,w=h,I=0,z=0;const{x:C,y:F}=this.size;if(this._helper._latRange){const Q=this._helper._latRange;f=c.S(Q[1])*h,_=c.S(Q[0])*h,_-f<F&&(I=F/(_-f))}o&&(x=c.aL(c.U(o[0])*h,0,h),w=c.aL(c.U(o[1])*h,0,h),w<x&&(w+=h),w-x<C&&(z=C/(w-x)));const{x:N,y:q}=ar(h,e);let G,W;const K=Math.max(z||0,I||0);if(K){const Q=new c.P(z?(w+x)/2:N,I?(_+f)/2:q);return s.center=bs(h,Q).wrap(),s.zoom+=c.ab(K),s}if(this._helper._latRange){const Q=F/2;q-Q<f&&(W=f+Q),q+Q>_&&(W=_-Q)}if(o){const Q=(x+w)/2;let ee=N;this._helper._renderWorldCopies&&(ee=c.aL(N,Q-h/2,Q+h/2));const te=C/2;ee-te<x&&(G=x+te),ee+te>w&&(G=w-te)}if(G!==void 0||W!==void 0){const Q=new c.P(G??N,W??q);s.center=bs(h,Q).wrap()}return s}calculateCenterFromCameraLngLatAlt(e,i,s,o){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,s,o)}_calculateNearFarZIfNeeded(e,i,s){if(!this._helper.autoCalculateNearFarZ)return;const o=Math.min(this.elevation,this.minElevationForCurrentTile,this.getCameraAltitude()-100),h=e-o*this._helper._pixelPerMeter/Math.cos(i),f=o<0?h:e,_=Math.PI/2+this.pitchInRadians,x=c.ad(this.fov)*(Math.abs(Math.cos(c.ad(this.roll)))*this.height+Math.abs(Math.sin(c.ad(this.roll)))*this.width)/this.height*(.5+s.y/this.height),w=Math.sin(x)*f/Math.sin(c.ae(Math.PI-_-x,.01,Math.PI-.01)),I=Ra(this),z=Math.atan(I/this._helper.cameraToCenterDistance),C=c.ad(.75),F=z>C?2*z*(.5+s.y/(2*I)):C,N=Math.sin(F)*f/Math.sin(c.ae(Math.PI-_-F,.01,Math.PI-.01)),q=Math.min(w,N);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=ar(this.worldSize,this.center),s=i.x,o=i.y;this._helper._pixelPerMeter=c.aK(1,this.center.lat)*this.worldSize;const h=c.ad(Math.min(this.pitch,89.25)),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),c.aY(_,this.fovInRadians,this._helper._width/this._helper._height,this._helper._nearZ,this._helper._farZ),this._invProjMatrix=new Float64Array(16),c.aj(this._invProjMatrix,_),_[8]=2*-e.x/this._helper._width,_[9]=2*e.y/this._helper._height,this._projectionMatrix=c.aZ(_),c.M(_,_,[1,-1,1]),c.L(_,_,[0,0,-this._helper.cameraToCenterDistance]),c.a_(_,_,-this.rollInRadians),c.a$(_,_,this.pitchInRadians),c.a_(_,_,-this.bearingInRadians),c.L(_,_,[-s,-o,0]),this._mercatorMatrix=c.M([],_,[this.worldSize,this.worldSize,this.worldSize]),c.M(_,_,[1,1,this._helper._pixelPerMeter]),this._pixelMatrix=c.N(new Float64Array(16),this.clipSpaceToPixelsMatrix,_),c.L(_,_,[0,0,-this.elevation]),this._viewProjMatrix=_,this._invViewProjMatrix=c.aj([],_);const x=[0,0,-1,1];c.ap(x,x,this._invViewProjMatrix),this._cameraPosition=[x[0]/x[3],x[1]/x[3],x[2]/x[3]],this._fogMatrix=new Float64Array(16),c.aY(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,c.M(this._fogMatrix,this._fogMatrix,[1,-1,1]),c.L(this._fogMatrix,this._fogMatrix,[0,0,-this.cameraToCenterDistance]),c.a_(this._fogMatrix,this._fogMatrix,-this.rollInRadians),c.a$(this._fogMatrix,this._fogMatrix,this.pitchInRadians),c.a_(this._fogMatrix,this._fogMatrix,-this.bearingInRadians),c.L(this._fogMatrix,this._fogMatrix,[-s,-o,0]),c.M(this._fogMatrix,this._fogMatrix,[1,1,this._helper._pixelPerMeter]),c.L(this._fogMatrix,this._fogMatrix,[0,0,-this.elevation]),this._pixelMatrix3D=c.N(new Float64Array(16),this.clipSpaceToPixelsMatrix,_);const w=this._helper._width%2/2,I=this._helper._height%2/2,z=Math.cos(this.bearingInRadians),C=Math.sin(-this.bearingInRadians),F=s-Math.round(s)+z*w+C*I,N=o-Math.round(o)+z*I+C*w,q=new Float64Array(_);if(c.L(q,q,[F>.5?F-1:F,N>.5?N-1:N,0]),this._alignedProjMatrix=q,_=c.aj(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 c.P(0,0)),i=[e.x*this.worldSize,e.y*this.worldSize,0,1];return c.ap(i,i,this._pixelMatrix)[3]/this._helper.cameraToCenterDistance}getCameraPoint(){return this._helper.getCameraPoint()}getCameraAltitude(){return this._helper.getCameraAltitude()}getCameraLngLat(){const e=c.aK(1,this.center.lat)*this.worldSize;return bi(this.center,this.elevation,this.pitch,this.bearing,this._helper.cameraToCenterDistance/e).toLngLat()}lngLatToCameraDepth(e,i){const s=c.$.fromLngLat(e),o=[s.x*this.worldSize,s.y*this.worldSize,i,1];return c.ap(o,o,this._viewProjMatrix),o[2]/o[3]}getProjectionData(e){const{overscaledTileID:i,aligned:s,applyTerrainMatrix:o}=e,h=this._helper.getMercatorTileCoordinates(i),f=i?this.calculatePosMatrix(i,s,!0):null;let _;return _=i&&i.terrainRttPosMatrix32f&&o?i.terrainRttPosMatrix32f:f||c.b0(),{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 c.aQ(e)}getRayDirectionFromPixel(e){throw new Error("Not implemented.")}projectTileCoordinates(e,i,s,o){const h=this.calculatePosMatrix(s);let f;o?(f=[e,i,o(e,i),1],c.ap(f,f,h)):(f=[e,i,0,1],li(f,f,h));const _=f[3];return{point:new c.P(f[0]/_,f[1]/_),signedDistanceFromCamera:_,isOccluded:!1}}populateCache(e){for(const i of e)this.calculatePosMatrix(i)}getMatrixForModel(e,i){const s=c.$.fromLngLat(e,i),o=s.meterInMercatorCoordinateUnits(),h=c.b1();return c.L(h,h,[s.x,s.y,s.z]),c.a_(h,h,Math.PI),c.a$(h,h,Math.PI/2),c.M(h,h,[-o,o,o]),h}getProjectionDataForCustomLayer(e=!0){const i=new c.Y(0,0,0,0,0),s=this.getProjectionData({overscaledTileID:i,applyGlobeMatrix:e}),o=Di(i,this.worldSize);c.N(o,this._viewProjMatrix,o),s.tileMercatorCoords=[0,0,1,1];const h=[c.Z,c.Z,this.worldSize/this._helper.pixelsPerMeter],f=c.b2();return c.M(f,o,h),s.fallbackMatrix=f,s.mainMatrix=f,s}getFastPathSimpleProjectionMatrix(e){return this.calculatePosMatrix(e)}}function Da(){c.w("Map cannot fit within canvas with the given bounds, padding, and/or offset.")}function Tn(u){if(u.useSlerp)if(u.k<1){const e=c.b3(u.startEulerAngles.roll,u.startEulerAngles.pitch,u.startEulerAngles.bearing),i=c.b3(u.endEulerAngles.roll,u.endEulerAngles.pitch,u.endEulerAngles.bearing),s=new Float64Array(4);c.b4(s,e,i,u.k);const o=c.b5(s);u.tr.setRoll(o.roll),u.tr.setPitch(o.pitch),u.tr.setBearing(o.bearing)}else u.tr.setRoll(u.endEulerAngles.roll),u.tr.setPitch(u.endEulerAngles.pitch),u.tr.setBearing(u.endEulerAngles.bearing);else u.tr.setRoll(c.B.number(u.startEulerAngles.roll,u.endEulerAngles.roll,u.k)),u.tr.setPitch(c.B.number(u.startEulerAngles.pitch,u.endEulerAngles.pitch,u.k)),u.tr.setBearing(c.B.number(u.startEulerAngles.bearing,u.endEulerAngles.bearing,u.k))}function ws(u,e,i,s,o){const h=o.padding,f=ar(o.worldSize,i.getNorthWest()),_=ar(o.worldSize,i.getNorthEast()),x=ar(o.worldSize,i.getSouthEast()),w=ar(o.worldSize,i.getSouthWest()),I=c.ad(-s),z=f.rotate(I),C=_.rotate(I),F=x.rotate(I),N=w.rotate(I),q=new c.P(Math.max(z.x,C.x,N.x,F.x),Math.max(z.y,C.y,N.y,F.y)),G=new c.P(Math.min(z.x,C.x,N.x,F.x),Math.min(z.y,C.y,N.y,F.y)),W=q.sub(G),K=(o.width-(h.left+h.right+e.left+e.right))/W.x,Q=(o.height-(h.top+h.bottom+e.top+e.bottom))/W.y;if(Q<0||K<0)return void Da();const ee=Math.min(c.ab(o.scale*Math.min(K,Q)),u.maxZoom),te=c.P.convert(u.offset),se=new c.P((e.left-e.right)/2,(e.top-e.bottom)/2).rotate(c.ad(s)),ie=te.add(se).mult(o.scale/c.aI(ee));return{center:bs(o.worldSize,f.add(x).div(2).sub(ie)),zoom:ee,bearing:s}}class Vi{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,o,h){return ws(e,i,s,o,h)}handleJumpToCenterZoom(e,i){e.zoom!==(i.zoom!==void 0?+i.zoom:e.zoom)&&e.setZoom(+i.zoom),i.center!==void 0&&e.setCenter(c.Q.convert(i.center))}handleEaseTo(e,i){const s=e.zoom,o=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 w=!1;const I=_?+i.zoom:e.zoom;let z=e.centerPoint.add(i.offsetAsPoint);const C=e.screenPointToLocation(z),{center:F,zoom:N}=e.getConstrained(c.Q.convert(i.center||C),I??s);uo(e,F);const q=ar(e.worldSize,C),G=ar(e.worldSize,F).sub(q),W=c.aI(N-s);return w=N!==s,{easeFunc:K=>{if(w&&e.setZoom(c.B.number(s,N,K)),c.b6(h,f)||Tn({startEulerAngles:h,endEulerAngles:f,tr:e,k:K,useSlerp:h.roll!=f.roll}),x&&(e.interpolatePadding(o,i.padding,K),z=e.centerPoint.add(i.offsetAsPoint)),i.around)e.setLocationAtPoint(i.around,i.aroundPoint);else{const Q=c.aI(e.zoom-s),ee=N>s?Math.min(2,W):Math.max(.5,W),te=Math.pow(ee,1-K),se=bs(e.worldSize,q.add(G.mult(K*te)).mult(Q));e.setLocationAtPoint(e.renderWorldCopies?se.wrap():se,z)}},isZooming:w,elevationCenter:F}}handleFlyTo(e,i){const s=i.zoom!==void 0,o=e.zoom,h=e.getConstrained(c.Q.convert(i.center||i.locationAtOffset),s?+i.zoom:o),f=h.center,_=h.zoom;uo(e,f);const x=ar(e.worldSize,i.locationAtOffset),w=ar(e.worldSize,f).sub(x),I=w.mag(),z=c.aI(_-o);let C;if(i.minZoom!==void 0){const F=Math.min(+i.minZoom,o,_),N=e.getConstrained(f,F).zoom;C=c.aI(N-o)}return{easeFunc:(F,N,q,G)=>{e.setZoom(F===1?_:o+c.ab(N));const W=F===1?f:bs(e.worldSize,x.add(w.mult(q)).mult(N));e.setLocationAtPoint(e.renderWorldCopies?W.wrap():W,G)},scaleOfZoom:z,targetCenter:f,scaleOfMinZoom:C,pixelPathLength:I}}}class Lt{constructor(e,i,s){this.blendFunction=e,this.blendColor=i,this.mask=s}}Lt.Replace=[1,0],Lt.disabled=new Lt(Lt.Replace,c.b7.transparent,[!1,!1,!1,!1]),Lt.unblended=new Lt(Lt.Replace,c.b7.transparent,[!0,!0,!0,!0]),Lt.alphaBlended=new Lt([1,771],c.b7.transparent,[!0,!0,!0,!0]);const zr=2305;class vt{constructor(e,i,s){this.enable=e,this.mode=i,this.frontFace=s}}vt.disabled=new vt(!1,1029,zr),vt.backCCW=new vt(!0,1029,zr),vt.frontCCW=new vt(!0,1028,zr);class ct{constructor(e,i,s){this.func=e,this.mask=i,this.range=s}}ct.ReadOnly=!1,ct.ReadWrite=!0,ct.disabled=new ct(519,ct.ReadOnly,[0,1]);const La=7680;class gt{constructor(e,i,s,o,h,f){this.test=e,this.ref=i,this.mask=s,this.fail=o,this.depthFail=h,this.pass=f}}gt.disabled=new gt({func:519,mask:0},0,0,La,La,La);const Fa=new WeakMap;function yr(u){var e;if(Fa.has(u))return Fa.get(u);{const i=(e=u.getParameter(u.VERSION))===null||e===void 0?void 0:e.startsWith("WebGL 2.0");return Fa.set(u,i),i}}class Ts{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 o=new c.aF;o.emplaceBack(-1,-1),o.emplaceBack(2,-1),o.emplaceBack(-1,2);const h=new c.aH;h.emplaceBack(0,1,2),this._fullscreenTriangle=new Hn(i.createVertexBuffer(o,bn.members),i.createIndexBuffer(h),c.aG.simpleSegment(0,0,o.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),yr(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,o=s.gl;if(this._bindFramebuffer(),s.viewport.set([0,0,this._texWidth,this._texHeight]),s.clear({color:c.b7.transparent}),this._cachedRenderContext.useProgram("projectionErrorMeasurement").draw(s,o.TRIANGLES,ct.disabled,gt.disabled,Lt.unblended,vt.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&&yr(o)){o.bindBuffer(o.PIXEL_PACK_BUFFER,this._pbo),o.readBuffer(o.COLOR_ATTACHMENT0),o.readPixels(0,0,this._texWidth,this._texHeight,this._texFormat,this._texType,0),o.bindBuffer(o.PIXEL_PACK_BUFFER,null);const h=o.fenceSync(o.SYNC_GPU_COMMANDS_COMPLETE,0);o.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&&yr(e)){const i=e.clientWaitSync(this._readbackQueue.sync,0,0);if(i===e.WAIT_FAILED)return c.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=Ts._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 Ps=c.Z/128;function ho(u,e){const i=u.granularity!==void 0?Math.max(u.granularity,1):1,s=i+(u.generateBorders?2:0),o=i+(u.extendToNorthPole||u.generateBorders?1:0)+(u.extendToSouthPole||u.generateBorders?1:0),h=s+1,f=o+1,_=u.generateBorders?-1:0,x=u.generateBorders||u.extendToNorthPole?-1:0,w=i+(u.generateBorders?1:0),I=i+(u.generateBorders||u.extendToSouthPole?1:0),z=h*f,C=s*o*6,F=h*f>65536;if(F&&e==="16bit")throw new Error("Granularity is too large and meshes would not fit inside 16 bit vertex indices.");const N=F||e==="32bit",q=new Int16Array(2*z);let G=0;for(let Q=x;Q<=I;Q++)for(let ee=_;ee<=w;ee++){let te=ee/i*c.Z;ee===-1&&(te=-64),ee===i+1&&(te=c.Z+Ps);let se=Q/i*c.Z;Q===-1&&(se=u.extendToNorthPole?c.b9:-64),Q===i+1&&(se=u.extendToSouthPole?c.ba:c.Z+Ps),q[G++]=te,q[G++]=se}const W=N?new Uint32Array(C):new Uint16Array(C);let K=0;for(let Q=0;Q<o;Q++)for(let ee=0;ee<s;ee++){const te=ee+1+Q*h,se=ee+(Q+1)*h,ie=ee+1+(Q+1)*h;W[K++]=ee+Q*h,W[K++]=se,W[K++]=te,W[K++]=te,W[K++]=se,W[K++]=ie}return{vertices:q.buffer.slice(0),indices:W.buffer.slice(0),uses32bitIndices:N}}const Ss=new c.aE({fill:new c.bb(128,2),line:new c.bb(512,0),tile:new c.bb(128,32),stencil:new c.bb(128,1),circle:3});class Ms{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 _r.projectionGlobe}get vertexShaderPreludeCode(){return _r.projectionMercator.vertexSource}get subdivisionGranularity(){return Ss}get useGlobeControls(){return!0}get latitudeErrorCorrectionRadians(){return this._errorCorrectionUsable}destroy(){this._errorMeasurement&&this._errorMeasurement.destroy()}updateGPUdependent(e){this._errorMeasurement||(this._errorMeasurement=new Ts(e));const i=c.S(this._errorQueryLatitudeDegrees),s=2*Math.atan(Math.exp(Math.PI-i*Math.PI*2))-.5*Math.PI,o=this._errorMeasurement.updateErrorLoop(i,s),h=Ae.now();o!==this._errorMeasurementLastValue&&(this._errorCorrectionPreviousValue=this._errorCorrectionUsable,this._errorMeasurementLastValue=o,this._errorMeasurementLastChangeTime=h);const f=Math.min(Math.max((h-this._errorMeasurementLastChangeTime)/1e3/.5,0),1);this._errorCorrectionUsable=c.bc(this._errorCorrectionPreviousValue,-this._errorMeasurementLastValue,c.bd(f))}_getMeshKey(e){return`${e.granularity.toString(36)}_${e.generateBorders?"b":""}${e.extendToNorthPole?"n":""}${e.extendToSouthPole?"s":""}`}getMeshFromTileID(e,i,s,o,h){const f=(h==="stencil"?Ss.stencil:Ss.tile).getGranularityForZoomLevel(i.z);return this._getMesh(e,{granularity:f,generateBorders:s,extendToNorthPole:i.y===0&&o,extendToSouthPole:i.y===(1<<i.z)-1&&o})}_getMesh(e,i){const s=this._getMeshKey(i);if(s in this._tileMeshCache)return this._tileMeshCache[s];const o=function(h,f){const _=ho(f,"16bit"),x=c.aF.deserialize({arrayBuffer:_.vertices,length:_.vertices.byteLength/2/2}),w=c.aH.deserialize({arrayBuffer:_.indices,length:_.indices.byteLength/2/3});return new Hn(h.createVertexBuffer(x,bn.members),h.createIndexBuffer(w),c.aG.simpleSegment(0,0,x.length,w.length))}(e,i);return this._tileMeshCache[s]=o,o}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 po=new c.r({type:new c.D(c.v.projection.type)});class Ba extends c.E{constructor(e){super(),this._transitionable=new c.T(po),this.setProjection(e),this._transitioning=this._transitionable.untransitioned(),this.recalculate(new c.C(0)),this._mercatorProjection=new yt,this._verticalPerspectiveProjection=new Ms}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 c.be){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,o,h){return this.currentProjection.getMeshFromTileID(e,i,s,o,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 fu(u){const e=fo(u.worldSize,u.center.lat);return 2*Math.PI*e}function Kn(u,e,i,s,o){const h=1/(1<<o),f=e/c.Z*h+s*h,_=c.bg((u/c.Z*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,w=Math.cos(x),I=new Float64Array(3);return I[0]=Math.sin(_)*w,I[1]=Math.sin(x),I[2]=Math.cos(_)*w,I}function wi(u){return function(e,i){const s=Math.cos(i),o=new Float64Array(3);return o[0]=Math.sin(e)*s,o[1]=Math.sin(i),o[2]=Math.cos(e)*s,o}(u.lng*Math.PI/180,u.lat*Math.PI/180)}function fo(u,e){return u/(2*Math.PI)/Math.cos(e*Math.PI/180)}function mu(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,o=Math.acos(u[2]/i),h=(s>0?o:-o)/Math.PI*180;return new c.Q(c.aL(h,-180,180),e)}return new c.Q(0,e)}function Ei(u){return Math.cos(u*Math.PI/180)}function ni(u,e){const i=Ei(u),s=Ei(e);return c.ab(s/i)}function xr(u,e){const i=u.rotate(e.bearingInRadians),s=e.zoom+ni(e.center.lat,0),o=c.bc(1/Ei(e.center.lat),1/Ei(Math.min(Math.abs(e.center.lat),60)),c.bf(s,7,3,0,1)),h=360/fu({worldSize:e.worldSize,center:{lat:e.center.lat}});return new c.Q(e.center.lng-i.x*h*o,c.ae(e.center.lat+i.y*h,-85.051129,c.aJ))}function Oa(u){const e=.5*u,i=Math.sin(e),s=Math.cos(e);return Math.log(i+s)-Math.log(s-i)}function Ml(u,e,i,s){const o=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,_=Oa(h+s*(f-h)),x=Oa(h),w=Oa(f);return new c.Q(u.lng+e*((_-x)/(w-x)),o)}return new c.Q(u.lng+e*s,o)}class gu{constructor(e){this._cachePrevious=new Map,this._cache=new Map,this._hadAnyChanges=!1,this._aabbFactory=e}recalculateCache(){if(!this._hadAnyChanges)return;const e=this._cachePrevious;this._cachePrevious=this._cache,this._cache=e,this._cache.clear(),this._hadAnyChanges=!1}getTileAABB(e,i,s,o){const h=`${e.z}_${e.x}_${e.y}`,f=this._cache.get(h);if(f)return f;const _=this._cachePrevious.get(h);if(_)return this._cache.set(h,_),_;const x=this._aabbFactory(e,i,s,o);return this._cache.set(h,x),this._hadAnyChanges=!0,x}}function Xr(u,e,i){const s=u-e;return s<0?-s:Math.max(0,s-i)}function Il(u,e,i,s,o){const h=u-i;let f;return f=h<0?Math.min(-h,1+h-o):h>1?Math.min(Math.max(h-o,0),1-h):0,Math.max(f,Xr(e,s,o))}class jh{constructor(){this._aabbCache=new gu(this._computeTileAABB)}recalculateCache(){this._aabbCache.recalculateCache()}distanceToTile2d(e,i,s,o){const h=1<<s.z,f=1/h,_=s.x/h,x=s.y/h;let w=2;return w=Math.min(w,Il(e,i,_,x,f)),w=Math.min(w,Il(e,i,_+.5,-x-f,f)),w=Math.min(w,Il(e,i,_+.5,2-x-f,f)),w}getWrap(e,i,s){const o=1<<i.z,h=1/o,f=i.x/o,_=Xr(e.x,f,h),x=Xr(e.x,f-1,h),w=Xr(e.x,f+1,h),I=Math.min(_,x,w);return I===w?1:I===x?-1:0}allowVariableZoom(e,i){return Wr(e,i)>4}allowWorldCopies(){return!1}getTileAABB(e,i,s,o){return this._aabbCache.getTileAABB(e,i,s,o)}_computeTileAABB(e,i,s,o){if(e.z<=0)return new ci([-1,-1,-1],[1,1,1]);if(e.z===1)return new ci([e.x===0?-1:0,e.y===0?0:-1,-1],[e.x===0?0:1,e.y===0?1:0,1]);{const h=[Kn(0,0,e.x,e.y,e.z),Kn(c.Z,0,e.x,e.y,e.z),Kn(c.Z,c.Z,e.x,e.y,e.z),Kn(0,c.Z,e.x,e.y,e.z)],f=[1,1,1],_=[-1,-1,-1];for(const x of h)for(let w=0;w<3;w++)f[w]=Math.min(f[w],x[w]),_[w]=Math.max(_[w],x[w]);if(e.y===0||e.y===(1<<e.z)-1){const x=[0,e.y===0?1:-1,0];for(let w=0;w<3;w++)f[w]=Math.min(f[w],x[w]),_[w]=Math.max(_[w],x[w])}return new ci(f,_)}}}class mo{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=c.bh(),this._projectionMatrix=c.b1(),this._globeViewProjMatrix32f=c.b0(),this._globeViewProjMatrixNoCorrection=c.b1(),this._globeViewProjMatrixNoCorrectionInverted=c.b1(),this._globeProjMatrixInverted=c.b1(),this._cameraPosition=c.bi(),this._globeLatitudeErrorCorrectionRadians=0,this._helper=new Zi({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._coveringTilesDetailsProvider=new jh}clone(){const e=new mo;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=c.bi();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,o=this._helper.getMercatorTileCoordinates(i);return{mainMatrix:this._globeViewProjMatrix32f,tileMercatorCoords:o,clippingPlane:this._cachedClippingPlane,projectionTransition:s?1:0,fallbackMatrix:this._globeViewProjMatrix32f}}_computeClippingPlane(e){const i=this.pitchInRadians,s=this.cameraToCenterDistance/e,o=Math.sin(i)*s,h=Math.cos(i)*s+1,f=1/Math.sqrt(o*o+h*h)*1;let _=-o,x=h;const w=Math.sqrt(_*_+x*x);_/=w,x/=w;const I=[0,_,x];return c.bj(I,I,[0,0,0],-this.bearingInRadians),c.bk(I,I,[0,0,0],-1*this.center.lat*Math.PI/180),c.bl(I,I,[0,0,0],this.center.lng*Math.PI/180),c.aO(I,I,.25),[...I,.25*-f]}isLocationOccluded(e){return!this.isSurfacePointVisible(wi(e))}transformLightDirection(e){const i=this._helper._center.lng*Math.PI/180,s=this._helper._center.lat*Math.PI/180,o=Math.cos(s),h=[Math.sin(i)*o,Math.sin(s),Math.cos(i)*o],f=[h[2],0,-h[0]],_=[0,0,0];c.aU(_,f,h),c.aT(f,f),c.aT(_,_);const x=[0,0,0];return c.aT(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 o=function(_,x,w){const I=1/(1<<w.z);return new c.$(_/c.Z*I+w.x*I,x/c.Z*I+w.y*I)}(e,i,s.canonical),h=(f=o.y,[c.bg(o.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,o){const h=s.canonical,f=Kn(e,i,h.x,h.y,h.z),_=1+(o?o(e,i):0)/c.br,x=[f[0]*_,f[1]*_,f[2]*_,1];c.ap(x,x,this._globeViewProjMatrixNoCorrection);const w=this._cachedClippingPlane,I=w[0]*f[0]+w[1]*f[1]+w[2]*f[2]+w[3]<0;return{point:new c.P(x[0]/x[3],x[1]/x[3]),signedDistanceFromCamera:x[3],isOccluded:I}}_calcMatrices(){if(!this._helper._width||!this._helper._height)return;const e=fo(this.worldSize,this.center.lat),i=c.b2(),s=c.b2();this._helper.autoCalculateNearFarZ&&(this._helper._nearZ=.5,this._helper._farZ=this.cameraToCenterDistance+2*e),c.aY(i,this.fovInRadians,this.width/this.height,this._helper._nearZ,this._helper._farZ);const o=this.centerOffset;i[8]=2*-o.x/this._helper._width,i[9]=2*o.y/this._helper._height,this._projectionMatrix=c.aZ(i),this._globeProjMatrixInverted=c.b2(),c.aj(this._globeProjMatrixInverted,i),c.L(i,i,[0,0,-this.cameraToCenterDistance]),c.a_(i,i,this.rollInRadians),c.a$(i,i,-this.pitchInRadians),c.a_(i,i,this.bearingInRadians),c.L(i,i,[0,0,-e]);const h=c.bi();h[0]=e,h[1]=e,h[2]=e,c.a$(s,i,this.center.lat*Math.PI/180),c.bm(s,s,-this.center.lng*Math.PI/180),c.M(s,s,h),this._globeViewProjMatrixNoCorrection=s,c.a$(i,i,this.center.lat*Math.PI/180-this._globeLatitudeErrorCorrectionRadians),c.bm(i,i,-this.center.lng*Math.PI/180),c.M(i,i,h),this._globeViewProjMatrix32f=new Float32Array(i),this._globeViewProjMatrixNoCorrectionInverted=c.b2(),c.aj(this._globeViewProjMatrixNoCorrectionInverted,s);const f=c.bi();this._cameraPosition=c.bi(),this._cameraPosition[2]=this.cameraToCenterDistance/e,c.bj(this._cameraPosition,this._cameraPosition,f,-this.rollInRadians),c.bk(this._cameraPosition,this._cameraPosition,f,this.pitchInRadians),c.bj(this._cameraPosition,this._cameraPosition,f,-this.bearingInRadians),c.aP(this._cameraPosition,this._cameraPosition,[0,0,1]),c.bk(this._cameraPosition,this._cameraPosition,f,-this.center.lat*Math.PI/180),c.bl(this._cameraPosition,this._cameraPosition,f,this.center.lng*Math.PI/180),this._cachedClippingPlane=this._computeClippingPlane(e);const _=c.aZ(this._globeViewProjMatrixNoCorrectionInverted);c.M(_,_,[1,1,-1]),this._cachedFrustum=wn.fromInvProjectionMatrix(_)}calculateFogMatrix(e){c.w("calculateFogMatrix is not supported on globe projection.");const i=c.b2();return c.at(i),i}getVisibleUnwrappedCoordinates(e){return[new c.aW(0,e)]}getCameraFrustum(){return this._cachedFrustum}getClippingPlane(){return this._cachedClippingPlane}getCoveringTilesDetailsProvider(){return this._coveringTilesDetailsProvider}recalculateZoomAndCenter(e){e&&c.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=wi(e);c.aO(s,s,1+i/c.br);const o=c.bh();return c.ap(o,[s[0],s[1],s[2],1],this._globeViewProjMatrixNoCorrection),o[2]/o[3]}populateCache(e){}getBounds(){const e=.5*this.width,i=.5*this.height,s=[new c.P(0,0),new c.P(e,0),new c.P(this.width,0),new c.P(this.width,i),new c.P(this.width,this.height),new c.P(e,this.height),new c.P(0,this.height),new c.P(0,i)],o=[];for(const z of s)o.push(this.unprojectScreenPoint(z));let h=0,f=0,_=0,x=0;const w=this.center;for(const z of o){const C=c.bn(w.lng,z.lng),F=c.bn(w.lat,z.lat);C<f&&(f=C),C>h&&(h=C),F<x&&(x=F),F>_&&(_=F)}const I=[w.lng+f,w.lat+x,w.lng+h,w.lat+_];return this.isSurfacePointOnScreen([0,1,0])&&(I[3]=90,I[0]=-180,I[2]=180),this.isSurfacePointOnScreen([0,-1,0])&&(I[1]=-90,I[0]=-180,I[2]=180),new Yt(I)}getConstrained(e,i){const s=c.ae(e.lat,-85.051129,c.aJ),o=c.ae(+i,this.minZoom+ni(0,s),this.maxZoom);return{center:new c.Q(e.lng,s),zoom:o}}calculateCenterFromCameraLngLatAlt(e,i,s,o){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,s,o)}setLocationAtPoint(e,i){const s=wi(this.unprojectScreenPoint(i)),o=wi(e),h=c.bi();c.bo(h);const f=c.bi();c.bl(f,s,h,-this.center.lng*Math.PI/180),c.bk(f,f,h,this.center.lat*Math.PI/180);const _=o[0]*o[0]+o[2]*o[2],x=f[0]*f[0];if(_<x)return;const w=Math.sqrt(_-x),I=-w,z=c.bp(o[0],o[2],f[0],w),C=c.bp(o[0],o[2],f[0],I),F=c.bi();c.bl(F,o,h,-z);const N=c.bp(F[1],F[2],f[1],f[2]),q=c.bi();c.bl(q,o,h,-C);const G=c.bp(q[1],q[2],f[1],f[2]),W=.5*Math.PI,K=N>=-W&&N<=W,Q=G>=-W&&G<=W;let ee,te;if(K&&Q){const de=this.center.lng*Math.PI/180,we=this.center.lat*Math.PI/180;c.bs(z,de)+c.bs(N,we)<c.bs(C,de)+c.bs(G,we)?(ee=z,te=N):(ee=C,te=G)}else if(K)ee=z,te=N;else{if(!Q)return;ee=C,te=G}const se=ee/Math.PI*180,ie=te/Math.PI*180,pe=this.center.lat;this.setCenter(new c.Q(se,c.ae(ie,-90,90))),this.setZoom(this.zoom+ni(pe,this.center.lat))}locationToScreenPoint(e,i){const s=wi(e);if(i){const o=i.getElevationForLngLatZoom(e,this._helper._tileZoom);c.aO(s,s,1+o/c.br)}return this._projectSurfacePointToScreen(s)}_projectSurfacePointToScreen(e){const i=c.bh();return c.ap(i,[...e,1],this._globeViewProjMatrixNoCorrection),i[0]/=i[3],i[1]/=i[3],new c.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 c.$.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,o=this.getRayDirectionFromPixel(e);return!!this.rayPlanetIntersection(s,o)}getRayDirectionFromPixel(e){const i=c.bh();i[0]=e.x/this.width*2-1,i[1]=-1*(e.y/this.height*2-1),i[2]=1,i[3]=1,c.ap(i,i,this._globeViewProjMatrixNoCorrectionInverted),i[0]/=i[3],i[1]/=i[3],i[2]/=i[3];const s=c.bi();s[0]=i[0]-this._cameraPosition[0],s[1]=i[1]-this._cameraPosition[1],s[2]=i[2]-this._cameraPosition[2];const o=c.bi();return c.aT(o,s),o}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=c.bh();return c.ap(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=c.aV(e,i),o=c.bi(),h=c.bi();c.aO(h,i,s),c.aS(o,e,h);const f=1-c.aV(o,o);if(f<0)return null;const _=c.aV(e,e)-1,x=-s+(s<0?1:-1)*Math.sqrt(f),w=_/x,I=x;return{tMin:Math.min(w,I),tMax:Math.max(w,I)}}unprojectScreenPoint(e){const i=this._cameraPosition,s=this.getRayDirectionFromPixel(e),o=this.rayPlanetIntersection(i,s);if(o){const w=c.bi();c.aP(w,i,[s[0]*o.tMin,s[1]*o.tMin,s[2]*o.tMin]);const I=c.bi();return c.aT(I,w),mu(I)}const h=this._cachedClippingPlane[0]*s[0]+this._cachedClippingPlane[1]*s[1]+this._cachedClippingPlane[2]*s[2],f=-c.bq(this._cachedClippingPlane,i)/h,_=c.bi();if(f>0)c.aP(_,i,[s[0]*f,s[1]*f,s[2]*f]);else{const w=c.bi();c.aP(w,i,[2*s[0],2*s[1],2*s[2]]);const I=c.bq(this._cachedClippingPlane,w);c.aS(_,w,[this._cachedClippingPlane[0]*I,this._cachedClippingPlane[1]*I,this._cachedClippingPlane[2]*I])}const x=c.bi();return c.aT(x,_),mu(x)}getMatrixForModel(e,i){const s=c.Q.convert(e),o=1/c.br,h=c.b1();return c.bm(h,h,s.lng/180*Math.PI),c.a$(h,h,-s.lat/180*Math.PI),c.L(h,h,[0,0,1+i/c.br]),c.a$(h,h,.5*Math.PI),c.M(h,h,[o,o,o]),h}getProjectionDataForCustomLayer(e=!0){const i=this.getProjectionData({overscaledTileID:new c.Y(0,0,0,0,0),applyGlobeMatrix:e});return i.tileMercatorCoords=[0,0,1,1],i}getFastPathSimpleProjectionMatrix(e){}}class go{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().recalculateCache(),this._mercatorTransform.getCoveringTilesDetailsProvider().recalculateCache()}get currentTransform(){return this.isGlobeRendering?this._verticalPerspectiveTransform:this._mercatorTransform}constructor(){this._globeLatitudeErrorCorrectionRadians=0,this._globeness=1,this._helper=new Zi({calcMatrices:()=>{this._calcMatrices()},getConstrained:(e,i)=>this.getConstrained(e,i)}),this._globeness=1,this._mercatorTransform=new Nt,this._verticalPerspectiveTransform=new mo}clone(){const e=new go;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 c.bc(this._mercatorTransform.getPixelScale(),this._verticalPerspectiveTransform.getPixelScale(),this._globeness)}getCircleRadiusCorrection(){return c.bc(this._mercatorTransform.getCircleRadiusCorrection(),this._verticalPerspectiveTransform.getCircleRadiusCorrection(),this._globeness)}getPitchedTextCorrection(e,i,s){const o=this._mercatorTransform.getPitchedTextCorrection(e,i,s),h=this._verticalPerspectiveTransform.getPitchedTextCorrection(e,i,s);return c.bc(o,h,this._globeness)}projectTileCoordinates(e,i,s,o){return this.currentTransform.projectTileCoordinates(e,i,s,o)}_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,o){return this._helper.calculateCenterFromCameraLngLatAlt(e,i,s,o)}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 vr{get useGlobeControls(){return!0}handlePanInertia(e,i){const s=xr(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 c.P(0,0)}}handleMapControlsRollPitchBearingZoom(e,i){const s=e.around,o=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 _=c.bn(i.center.lng,o.lng),x=_/(Math.abs(_/180)+1),w=c.bn(i.center.lat,o.lat),I=i.getRayDirectionFromPixel(s),z=i.cameraPosition,C=-1*c.aV(z,I),F=c.bi();c.aP(F,z,[I[0]*C,I[1]*C,I[2]*C]);const N=c.bt(F)-1,q=Math.exp(.5*-Math.max(N-.3,0)),G=fo(i.worldSize,i.center.lat)/Math.min(i.width,i.height),W=c.bf(G,.9,.5,1,.25),K=(1-c.aI(-f))*Math.min(q,W),Q=i.center.lat,ee=i.zoom,te=new c.Q(i.center.lng+x*K,c.ae(i.center.lat+w*K,-85.051129,c.aJ));i.setLocationAtPoint(o,s);const se=i.center,ie=c.bf(Math.abs(_),45,85,0,1),pe=c.bf(G,.75,.35,0,1),de=Math.pow(Math.max(ie,pe),.25),we=c.bn(se.lng,te.lng),Se=c.bn(se.lat,te.lat);i.setCenter(new c.Q(se.lng+we*de,se.lat+Se*de).wrap()),i.setZoom(ee+ni(Q,i.center.lat))}handleMapControlsPan(e,i,s){if(!e.panDelta)return;const o=i.center.lat,h=i.zoom;i.setCenter(xr(e.panDelta,i).wrap()),i.setZoom(h+ni(o,i.center.lat))}cameraForBoxAndBearing(e,i,s,o,h){const f=ws(e,i,s,o,h),_=i.left/h.width*2-1,x=(h.width-i.right)/h.width*2-1,w=i.top/h.height*-2+1,I=(h.height-i.bottom)/h.height*-2+1,z=c.bn(s.getWest(),s.getEast())<0,C=z?s.getEast():s.getWest(),F=z?s.getWest():s.getEast(),N=Math.max(s.getNorth(),s.getSouth()),q=Math.min(s.getNorth(),s.getSouth()),G=C+.5*c.bn(C,F),W=N+.5*c.bn(N,q),K=h.clone();K.setCenter(f.center),K.setBearing(f.bearing),K.setPitch(0),K.setRoll(0),K.setZoom(f.zoom);const Q=K.modelViewProjectionMatrix,ee=[wi(s.getNorthWest()),wi(s.getNorthEast()),wi(s.getSouthWest()),wi(s.getSouthEast()),wi(new c.Q(F,W)),wi(new c.Q(C,W)),wi(new c.Q(G,N)),wi(new c.Q(G,q))],te=wi(f.center);let se=Number.POSITIVE_INFINITY;for(const ie of ee)_<0&&(se=vr.getLesserNonNegativeNonNull(se,vr.solveVectorScale(ie,te,Q,"x",_))),x>0&&(se=vr.getLesserNonNegativeNonNull(se,vr.solveVectorScale(ie,te,Q,"x",x))),w>0&&(se=vr.getLesserNonNegativeNonNull(se,vr.solveVectorScale(ie,te,Q,"y",w))),I<0&&(se=vr.getLesserNonNegativeNonNull(se,vr.solveVectorScale(ie,te,Q,"y",I)));if(Number.isFinite(se)&&se!==0)return f.zoom=K.zoom+c.ab(se),f;Da()}handleJumpToCenterZoom(e,i){const s=e.center.lat,o=e.getConstrained(i.center?c.Q.convert(i.center):e.center,e.zoom).center;e.setCenter(o.wrap());const h=i.zoom!==void 0?+i.zoom:e.zoom+ni(s,o.lat);e.zoom!==h&&e.setZoom(h)}handleEaseTo(e,i){const s=e.zoom,o=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,w=!e.isPaddingEqual(i.padding);let I=!1;const z=i.center?c.Q.convert(i.center):o,C=e.getConstrained(z,s).center;uo(e,C);const F=e.clone();F.setCenter(C),F.setZoom(x?+i.zoom:s+ni(o.lat,z.lat)),F.setBearing(i.bearing);const N=new c.P(c.ae(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),c.ae(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));F.setLocationAtPoint(C,N);const q=(i.offset&&i.offsetAsPoint.mag())>0?F.center:C,G=x?+i.zoom:s+ni(o.lat,q.lat),W=s+ni(o.lat,0),K=G+ni(q.lat,0),Q=c.bn(o.lng,q.lng),ee=c.bn(o.lat,q.lat),te=c.aI(K-W);return I=G!==s,{easeFunc:se=>{if(c.b6(f,_)||Tn({startEulerAngles:f,endEulerAngles:_,tr:e,k:se,useSlerp:f.roll!=_.roll}),w&&e.interpolatePadding(h,i.padding,se),i.around)c.w("Easing around a point is not supported under globe projection."),e.setLocationAtPoint(i.around,i.aroundPoint);else{const ie=K>W?Math.min(2,te):Math.max(.5,te),pe=Math.pow(ie,1-se),de=Ml(o,Q,ee,se*pe);e.setCenter(de.wrap())}if(I){const ie=c.B.number(W,K,se)+ni(0,e.center.lat);e.setZoom(ie)}},isZooming:I,elevationCenter:q}}handleFlyTo(e,i){const s=i.zoom!==void 0,o=e.center,h=e.zoom,f=e.padding,_=!e.isPaddingEqual(i.padding),x=e.getConstrained(c.Q.convert(i.center||i.locationAtOffset),h).center,w=s?+i.zoom:e.zoom+ni(e.center.lat,x.lat),I=e.clone();I.setCenter(x),I.setZoom(w),I.setBearing(i.bearing);const z=new c.P(c.ae(e.centerPoint.x+i.offsetAsPoint.x,0,e.width),c.ae(e.centerPoint.y+i.offsetAsPoint.y,0,e.height));I.setLocationAtPoint(x,z);const C=I.center;uo(e,C);const F=function(ee,te,se){const ie=wi(te),pe=wi(se),de=c.aV(ie,pe),we=Math.acos(de),Se=fu(ee);return we/(2*Math.PI)*Se}(e,o,C),N=h+ni(o.lat,0),q=w+ni(C.lat,0),G=c.aI(q-N);let W;if(typeof i.minZoom=="number"){const ee=+i.minZoom+ni(C.lat,0),te=Math.min(ee,N,q)+ni(0,C.lat),se=e.getConstrained(C,te).zoom+ni(C.lat,0);W=c.aI(se-N)}const K=c.bn(o.lng,C.lng),Q=c.bn(o.lat,C.lat);return{easeFunc:(ee,te,se,ie)=>{const pe=Ml(o,K,Q,se);_&&e.interpolatePadding(f,i.padding,ee);const de=ee===1?C:pe;e.setCenter(de.wrap());const we=N+c.ab(te);e.setZoom(ee===1?w:we+ni(0,de.lat))},scaleOfZoom:G,targetCenter:C,scaleOfMinZoom:W,pixelPathLength:F}}static solveVectorScale(e,i,s,o,h){const f=o==="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],w=e[0]*_[0]+e[1]*_[1]+e[2]*_[2],I=i[0]*f[0]+i[1]*f[1]+i[2]*f[2],z=i[0]*_[0]+i[1]*_[1]+i[2]*_[2];return I+h*w===x+h*z||_[3]*(x-I)+f[3]*(z-w)+x*z==I*w?null:(I+f[3]-h*z-h*_[3])/(I-x-h*z+h*w)}static getLesserNonNegativeNonNull(e,i){return i!==null&&i>=0&&i<e?i:e}}class _u{constructor(e){this._globe=e,this._mercatorCameraHelper=new Vi,this._verticalPerspectiveCameraHelper=new vr}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,o,h){return this.currentHelper.cameraForBoxAndBearing(e,i,s,o,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 Xn=(u,e)=>c.x(u,e&&e.filter(i=>i.identifier!=="source.canvas")),Cl=c.bu();class ja extends c.E{constructor(e,i={}){super(),this._rtlPluginLoaded=()=>{for(const s in this.sourceCaches){const o=this.sourceCaches[s].getSource().type;o!=="vector"&&o!=="geojson"||this.sourceCaches[s].reload()}},this.map=e,this.dispatcher=new Vn(Zn(),e._getMapId()),this.dispatcher.registerMessageHandler("GG",(s,o)=>this.getGlyphs(s,o)),this.dispatcher.registerMessageHandler("GI",(s,o)=>this.getImages(s,o)),this.imageManager=new ba,this.imageManager.setEventedParent(this),this.glyphManager=new Ii(e._requestManager,i.localIdeographFontFamily),this.lineAtlas=new Nn(256,512),this.crossTileSymbolIndex=new co,this._spritesImagesIds={},this._layers={},this._order=[],this.sourceCaches={},this.zoomHistory=new c.bv,this._loaded=!1,this._availableImages=[],this._resetUpdates(),this.dispatcher.broadcast("SR",c.bw()),Gr().on(qn,this._rtlPluginLoaded),this.on("data",s=>{if(s.dataType!=="source"||s.sourceDataType!=="metadata")return;const o=this.sourceCaches[s.sourceId];if(!o)return;const h=o.getSource();if(h&&h.vectorLayerIds)for(const f in this._layers){const _=this._layers[f];_.source===h.id&&this._validateLayer(_)}})}loadURL(e,i={},s){this.fire(new c.l("dataloading",{dataType:"style"})),i.validate=typeof i.validate!="boolean"||i.validate;const o=this.map._requestManager.transformRequest(e,"Style");this._loadStyleRequest=new AbortController;const h=this._loadStyleRequest;c.j(o,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 c.k(f))})}loadJSON(e,i={},s){this.fire(new c.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 c.l("dataloading",{dataType:"style"})),this._load(Cl,{validate:!1})}_load(e,i,s){var o,h;const f=i.transformStyle?i.transformStyle(s,e):e;if(!i.validate||!Xn(this,c.y(f))){this._loaded=!0,this.stylesheet=f;for(const _ in f.sources)this.addSource(_,f.sources[_],{validate:!1});f.sprite?this._loadSprite(f.sprite):this.imageManager.setLoaded(!0),this.glyphManager.setURL(f.glyphs),this._createLayers(),this.light=new wa(this.stylesheet.light),this._setProjectionInternal(((o=this.stylesheet.projection)===null||o===void 0?void 0:o.type)||"mercator"),this.sky=new jn(this.stylesheet.sky),this.map.setTerrain((h=this.stylesheet.terrain)!==null&&h!==void 0?h:null),this.fire(new c.l("data",{dataType:"style"})),this.fire(new c.l("style.load"))}}_createLayers(){const e=c.bx(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=c.by(i);s.setEventedParent(this,{layer:{id:i.id}}),this._layers[i.id]=s}}_loadSprite(e,i=!1,s=void 0){let o;this.imageManager.setLoaded(!1),this._spriteRequest=new AbortController,function(h,f,_,x){return c._(this,void 0,void 0,function*(){const w=Rt(h),I=_>1?"@2x":"",z={},C={};for(const{id:F,url:N}of w){const q=f.transformRequest(kt(N,I,".json"),"SpriteJSON");z[F]=c.j(q,x);const G=f.transformRequest(kt(N,I,".png"),"SpriteImage");C[F]=ri.getImage(G,x)}return yield Promise.all([...Object.values(z),...Object.values(C)]),function(F,N){return c._(this,void 0,void 0,function*(){const q={};for(const G in F){q[G]={};const W=Ae.getImageCanvasContext((yield N[G]).data),K=(yield F[G]).data;for(const Q in K){const{width:ee,height:te,x:se,y:ie,sdf:pe,pixelRatio:de,stretchX:we,stretchY:Se,content:ve,textFitWidth:Be,textFitHeight:Le}=K[Q];q[G][Q]={data:null,pixelRatio:de,sdf:pe,stretchX:we,stretchY:Se,content:ve,textFitWidth:Be,textFitHeight:Le,spriteData:{width:ee,height:te,x:se,y:ie,context:W}}}}return q})}(z,C)})}(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 w=f==="default"?x:`${f}:${x}`;this._spritesImagesIds[f].push(w),w in this.imageManager.images?this.imageManager.updateImage(w,h[f][x],!1):this.imageManager.addImage(w,h[f][x]),i&&(this._changedImages[w]=!0)}}}).catch(h=>{this._spriteRequest=null,o=h,this.fire(new c.k(o))}).finally(()=>{this.imageManager.setLoaded(!0),this._availableImages=this.imageManager.listImages(),i&&(this._changed=!0),this.dispatcher.broadcast("SI",this._availableImages),this.fire(new c.l("data",{dataType:"style"})),s&&s(o)})}_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 c.l("data",{dataType:"style"}))}_validateLayer(e){const i=this.sourceCaches[e.source];if(!i)return;const s=e.sourceLayer;if(!s)return;const o=i.getSource();(o.type==="geojson"||o.vectorLayerIds&&o.vectorLayerIds.indexOf(s)===-1)&&this.fire(new c.k(new Error(`Source layer "${s}" does not exist on source "${o.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?c.bz(s):s);const o=[];for(const h of e)if(s[h]){const f=i?c.bz(s[h]):s[h];o.push(f)}return o}_serializedAllLayers(){let e=this._serializedLayers;if(e)return e;e=this._serializedLayers={};const i=Object.keys(this._layers);for(const s of i){const o=this._layers[s];o.type!=="custom"&&(e[s]=o.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 o in this.sourceCaches)if(this.sourceCaches[o].hasTransition())return!0;for(const o in this._layers)if(this._layers[o].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 o=Object.keys(this._updatedLayers),h=Object.keys(this._removedLayers);(o.length||h.length)&&this._updateWorkerLayers(o,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 o in this.sourceCaches){const h=this.sourceCaches[o];s[o]=h.used,h.used=!1}for(const o of this._order){const h=this._layers[o];h.recalculate(e,this._availableImages),!h.isHidden(e.zoom)&&h.source&&(this.sourceCaches[h.source].used=!0)}for(const o in s){const h=this.sourceCaches[o];!!s[o]!=!!h.used&&h.fire(new c.l("data",{sourceDataType:"visibility",dataType:"source",sourceId:o}))}this.light.recalculate(e),this.sky.recalculate(e),this.projection.recalculate(e),this.z=e.zoom,i&&this.fire(new c.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 o=this.serialize();if(e=i.transformStyle?i.transformStyle(o,e):e,((s=i.validate)===null||s===void 0||s)&&Xn(this,c.y(e)))return!1;(e=c.bz(e)).layers=c.bx(e.layers);const h=c.bA(o,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 o of e)switch(o.command){case"setCenter":case"setZoom":case"setBearing":case"setPitch":case"setRoll":continue;case"addLayer":i.push(()=>this.addLayer.apply(this,o.args));break;case"removeLayer":i.push(()=>this.removeLayer.apply(this,o.args));break;case"setPaintProperty":i.push(()=>this.setPaintProperty.apply(this,o.args));break;case"setLayoutProperty":i.push(()=>this.setLayoutProperty.apply(this,o.args));break;case"setFilter":i.push(()=>this.setFilter.apply(this,o.args));break;case"addSource":i.push(()=>this.addSource.apply(this,o.args));break;case"removeSource":i.push(()=>this.removeSource.apply(this,o.args));break;case"setLayerZoomRange":i.push(()=>this.setLayerZoomRange.apply(this,o.args));break;case"setLight":i.push(()=>this.setLight.apply(this,o.args));break;case"setGeoJSONSourceData":i.push(()=>this.setGeoJSONSourceData.apply(this,o.args));break;case"setGlyphs":i.push(()=>this.setGlyphs.apply(this,o.args));break;case"setSprite":i.push(()=>this.setSprite.apply(this,o.args));break;case"setTerrain":i.push(()=>this.map.setTerrain.apply(this,o.args));break;case"setSky":i.push(()=>this.setSky.apply(this,o.args));break;case"setProjection":this.setProjection.apply(this,o.args);break;case"setTransition":i.push(()=>{});break;default:s.push(o.command)}return{operations:i,unimplemented:s}}addImage(e,i){if(this.getImage(e))return this.fire(new c.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 c.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 c.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(c.y.source,`sources.${e}`,i,null,s))return;this.map&&this.map._collectResourceTiming&&(i.collectResourceTiming=!0);const o=this.sourceCaches[e]=new j(e,i,this.dispatcher);o.style=this,o.setEventedParent(this,()=>({isSourceLoaded:o.loaded(),source:o.serialize(),sourceId:e})),o.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 c.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 c.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 o=e.id;if(this.getLayer(o))return void this.fire(new c.k(new Error(`Layer "${o}" already exists on this map.`)));let h;if(e.type==="custom"){if(Xn(this,c.bB(e)))return;h=c.by(e)}else{if("source"in e&&typeof e.source=="object"&&(this.addSource(o,e.source),e=c.bz(e),e=c.e(e,{source:o})),this._validate(c.y.layer,`layers.${o}`,e,{arrayIndex:-1},s))return;h=c.by(e),this._validateLayer(h),h.setEventedParent(this,{layer:{id:o}})}const f=i?this._order.indexOf(i):this._order.length;if(i&&f===-1)this.fire(new c.k(new Error(`Cannot add layer "${o}" before non-existing layer "${i}".`)));else{if(this._order.splice(f,0,o),this._layerOrderChanged=!0,this._layers[o]=h,this._removedLayers[o]&&h.source&&h.type!=="custom"){const _=this._removedLayers[o];delete this._removedLayers[o],_.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 c.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 o=i?this._order.indexOf(i):this._order.length;i&&o===-1?this.fire(new c.k(new Error(`Cannot move layer "${e}" before non-existing layer "${i}".`))):(this._order.splice(o,0,e),this._layerOrderChanged=!0)}removeLayer(e){this._checkLoaded();const i=this._layers[e];if(!i)return void this.fire(new c.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 o=this.getLayer(e);o?o.minzoom===i&&o.maxzoom===s||(i!=null&&(o.minzoom=i),s!=null&&(o.maxzoom=s),this._updateLayer(o)):this.fire(new c.k(new Error(`Cannot set the zoom range of non-existing layer "${e}".`)))}setFilter(e,i,s={}){this._checkLoaded();const o=this.getLayer(e);if(o){if(!c.bC(o.filter,i))return i==null?(o.filter=void 0,void this._updateLayer(o)):void(this._validate(c.y.filter,`layers.${o.id}.filter`,i,null,s)||(o.filter=c.bz(i),this._updateLayer(o)))}else this.fire(new c.k(new Error(`Cannot filter non-existing layer "${e}".`)))}getFilter(e){return c.bz(this.getLayer(e).filter)}setLayoutProperty(e,i,s,o={}){this._checkLoaded();const h=this.getLayer(e);h?c.bC(h.getLayoutProperty(i),s)||(h.setLayoutProperty(i,s,o),this._updateLayer(h)):this.fire(new c.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 c.k(new Error(`Cannot get style of non-existing layer "${e}".`)))}setPaintProperty(e,i,s,o={}){this._checkLoaded();const h=this.getLayer(e);h?c.bC(h.getPaintProperty(i),s)||(h.setPaintProperty(i,s,o)&&this._updateLayer(h),this._changed=!0,this._updatedPaintProps[e]=!0,this._serializedLayers=null):this.fire(new c.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,o=e.sourceLayer,h=this.sourceCaches[s];if(h===void 0)return void this.fire(new c.k(new Error(`The source '${s}' does not exist in the map's style.`)));const f=h.getSource().type;f==="geojson"&&o?this.fire(new c.k(new Error("GeoJSON sources cannot have a sourceLayer parameter."))):f!=="vector"||o?(e.id===void 0&&this.fire(new c.k(new Error("The feature id parameter must be provided."))),h.setFeatureState(o,e.id,i)):this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}removeFeatureState(e,i){this._checkLoaded();const s=e.source,o=this.sourceCaches[s];if(o===void 0)return void this.fire(new c.k(new Error(`The source '${s}' does not exist in the map's style.`)));const h=o.getSource().type,f=h==="vector"?e.sourceLayer:void 0;h!=="vector"||f?i&&typeof e.id!="string"&&typeof e.id!="number"?this.fire(new c.k(new Error("A feature id is required to remove its specific state property."))):o.removeFeatureState(f,e.id,i):this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")))}getFeatureState(e){this._checkLoaded();const i=e.source,s=e.sourceLayer,o=this.sourceCaches[i];if(o!==void 0)return o.getSource().type!=="vector"||s?(e.id===void 0&&this.fire(new c.k(new Error("The feature id parameter must be provided."))),o.getFeatureState(s,e.id)):void this.fire(new c.k(new Error("The sourceLayer parameter must be provided for vector source types.")));this.fire(new c.k(new Error(`The source '${i}' does not exist in the map's style.`)))}getTransition(){return c.e({duration:300,delay:0},this.stylesheet&&this.stylesheet.transition)}serialize(){if(!this._loaded)return;const e=c.bD(this.sourceCaches,h=>h.serialize()),i=this._serializeByIds(this._order,!0),s=this.map.getTerrain()||void 0,o=this.stylesheet;return c.bE({version:o.version,name:o.name,metadata:o.metadata,light:o.light,sky:o.sky,center:o.center,zoom:o.zoom,bearing:o.bearing,pitch:o.pitch,sprite:o.sprite,glyphs:o.glyphs,transition:o.transition,projection:o.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={},o=[];for(let f=this._order.length-1;f>=0;f--){const _=this._order[f];if(i(_)){s[_]=f;for(const x of e){const w=x[_];if(w)for(const I of w)o.push(I)}}}o.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=o.length-1;x>=0;x--){const w=o[x].feature;if(s[w.layer.id]<f)break;h.push(w),o.pop()}else for(const x of e){const w=x[_];if(w)for(const I of w)h.push(I.feature)}}return h}queryRenderedFeatures(e,i,s){i&&i.filter&&this._validate(c.y.filter,"queryRenderedFeatures.filter",i.filter,null,i);const o={};if(i&&i.layers){if(!(Array.isArray(i.layers)||i.layers instanceof Set))return this.fire(new c.k(new Error("parameters.layers must be an Array or a Set of strings"))),[];for(const w of i.layers){const I=this._layers[w];if(!I)return this.fire(new c.k(new Error(`The layer '${w}' does not exist in the map's style and cannot be queried for features.`))),[];o[I.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 w in this.sourceCaches)i.layers&&!o[w]||h.push(gs(this.sourceCaches[w],this._layers,f,e,x,s,this.map.terrain?(I,z,C)=>this.map.terrain.getElevation(I,z,C):void 0));return this.placement&&h.push(function(w,I,z,C,F,N,q){const G={},W=N.queryRenderedSymbols(C),K=[];for(const Q of Object.keys(W).map(Number))K.push(q[Q]);K.sort(Ci);for(const Q of K){const ee=Q.featureIndex.lookupSymbolFeatures(W[Q.bucketInstanceId],I,Q.bucketIndex,Q.sourceLayerIndex,F.filter,F.layers,F.availableImages,w);for(const te in ee){const se=G[te]=G[te]||[],ie=ee[te];ie.sort((pe,de)=>{const we=Q.featureSortOrder;if(we){const Se=we.indexOf(pe.featureIndex);return we.indexOf(de.featureIndex)-Se}return de.featureIndex-pe.featureIndex});for(const pe of ie)se.push(pe)}}return function(Q,ee,te){for(const se in Q)for(const ie of Q[se])oi(ie,te[ee[se].source]);return Q}(G,w,z)}(this._layers,f,this.sourceCaches,e,x,this.placement.collisionIndex,this.placement.retainedQueryData)),this._flattenAndSortRenderedFeatures(h)}querySourceFeatures(e,i){i&&i.filter&&this._validate(c.y.filter,"querySourceFeatures.filter",i.filter,null,i);const s=this.sourceCaches[e];return s?function(o,h){const f=o.getRenderableIds().map(w=>o.getTileByID(w)),_=[],x={};for(let w=0;w<f.length;w++){const I=f[w],z=I.tileID.canonical.key;x[z]||(x[z]=!0,I.querySourceFeatures(_,h))}return _}(s,i):[]}getLight(){return this.light.getLight()}setLight(e,i={}){this._checkLoaded();const s=this.light.getLight();let o=!1;for(const f in e)if(!c.bC(e[f],s[f])){o=!0;break}if(!o)return;const h={now:Ae.now(),transition:c.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 o=!1;if(!e&&!s)return;if(e&&!s)o=!0;else if(!e&&s)o=!0;else for(const f in e)if(!c.bC(e[f],s[f])){o=!0;break}if(!o)return;const h={now:Ae.now(),transition:c.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 o=new Ba({type:s});return{projection:o,transform:new go,cameraHelper:new _u(o)}}switch(s){case"mercator":return{projection:new yt,transform:new Nt,cameraHelper:new Vi};case"globe":{const o=new Ba({type:["interpolate",["linear"],["zoom"],11,"vertical-perspective",12,"mercator"]});return{projection:o,transform:new go,cameraHelper:new _u(o)}}case"vertical-perspective":return{projection:new Ms,transform:new mo,cameraHelper:new vr};default:return c.w(`Unknown projection name: ${s}. Falling back to mercator projection.`),{projection:new yt,transform:new Nt,cameraHelper:new Vi}}}(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,o,h={}){return(!h||h.validate!==!1)&&Xn(this,e.call(c.y,c.e({key:i,style:this.serialize(),value:s,styleSpec:c.v},o)))}_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),Gr().off(qn,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,o,h=!1){let f=!1,_=!1;const x={};for(const w of this._order){const I=this._layers[w];if(I.type!=="symbol")continue;if(!x[I.source]){const C=this.sourceCaches[I.source];x[I.source]=C.getRenderableIds(!0).map(F=>C.getTileByID(F)).sort((F,N)=>N.tileID.overscaledZ-F.tileID.overscaledZ||(F.tileID.isLessThan(N.tileID)?-1:1))}const z=this.crossTileSymbolIndex.addLayer(I,x[I.source],e.center.lng);f=f||z}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 hu(e,this.map.terrain,this._order,h,i,s,o,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 w of this._order){const I=this._layers[w];I.type==="symbol"&&this.placement.updateLayerOpacities(I,x[I.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 c._(this,void 0,void 0,function*(){const s=yield this.imageManager.getImages(i.icons);this._updateTilesForChangedImages();const o=this.sourceCaches[i.source];return o&&o.setDependencies(i.tileID.key,i.type,i.icons),s})}getGlyphs(e,i){return c._(this,void 0,void 0,function*(){const s=yield this.glyphManager.getGlyphs(i.stacks),o=this.sourceCaches[i.source];return o&&o.setDependencies(i.tileID.key,i.type,[""]),s})}getGlyphsUrl(){return this.stylesheet.glyphs||null}setGlyphs(e,i={}){this._checkLoaded(),e&&this._validate(c.y.glyphs,"glyphs",e,null,i)||(this._glyphsDidChange=!0,this.stylesheet.glyphs=e,this.glyphManager.entries={},this.glyphManager.setURL(e))}addSprite(e,i,s={},o){this._checkLoaded();const h=[{id:e,url:i}],f=[...Rt(this.stylesheet.sprite),...h];this._validate(c.y.sprite,"sprite",f,null,s)||(this.stylesheet.sprite=f,this._loadSprite(h,!0,o))}removeSprite(e){this._checkLoaded();const i=Rt(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 c.l("data",{dataType:"style"}))}else this.fire(new c.k(new Error(`Sprite "${e}" doesn't exists on this map.`)))}getSprite(){return Rt(this.stylesheet.sprite)}setSprite(e,i={},s){this._checkLoaded(),e&&this._validate(c.y.sprite,"sprite",e,null,i)||(this.stylesheet.sprite=e,e?this._loadSprite(e,!0,s):(this._unloadSprite(),s&&s(null)))}}var El=c.aD([{name:"a_pos",type:"Int16",components:2},{name:"a_texture_pos",type:"Int16",components:2}]);class zl{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,o,h,f,_,x,w){this.context=e;let I=this.boundPaintVertexBuffers.length!==o.length;for(let z=0;!I&&z<o.length;z++)this.boundPaintVertexBuffers[z]!==o[z]&&(I=!0);!this.vao||this.boundProgram!==i||this.boundLayoutVertexBuffer!==s||I||this.boundIndexBuffer!==h||this.boundVertexOffset!==f||this.boundDynamicVertexBuffer!==_||this.boundDynamicVertexBuffer2!==x||this.boundDynamicVertexBuffer3!==w?this.freshBind(i,s,o,h,f,_,x,w):(e.bindVertexArray.set(this.vao),_&&_.bind(),h&&h.dynamicDraw&&h.bind(),x&&x.bind(),w&&w.bind())}freshBind(e,i,s,o,h,f,_,x){const w=e.numAttributes,I=this.context,z=I.gl;this.vao&&this.destroy(),this.vao=I.createVertexArray(),I.bindVertexArray.set(this.vao),this.boundProgram=e,this.boundLayoutVertexBuffer=i,this.boundPaintVertexBuffers=s,this.boundIndexBuffer=o,this.boundVertexOffset=h,this.boundDynamicVertexBuffer=f,this.boundDynamicVertexBuffer2=_,this.boundDynamicVertexBuffer3=x,i.enableAttributes(z,e);for(const C of s)C.enableAttributes(z,e);f&&f.enableAttributes(z,e),_&&_.enableAttributes(z,e),x&&x.enableAttributes(z,e),i.bind(),i.setVertexAttribPointers(z,e,h);for(const C of s)C.bind(),C.setVertexAttribPointers(z,e,h);f&&(f.bind(),f.setVertexAttribPointers(z,e,h)),o&&o.bind(),_&&(_.bind(),_.setVertexAttribPointers(z,e,h)),x&&(x.bind(),x.setVertexAttribPointers(z,e,h)),I.currentNumAttributes=w}destroy(){this.vao&&(this.context.deleteVertexArray(this.vao),this.vao=null)}}const kr=(u,e,i,s,o)=>({u_texture:0,u_ele_delta:u,u_fog_matrix:e,u_fog_color:i?i.properties.get("fog-color"):c.b7.white,u_fog_ground_blend:i?i.properties.get("fog-ground-blend"):1,u_fog_ground_blend_opacity:o?0:i?i.calculateFogBlendOpacity(s):0,u_horizon_color:i?i.properties.get("horizon-color"):c.b7.white,u_horizon_fog_blend:i?i.properties.get("horizon-fog-blend"):1,u_is_globe_mode:o?1:0}),Nh={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 Na(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 Is{constructor(e,i,s,o,h,f,_,x){const w=e.gl;this.program=w.createProgram();const I=Na(i.staticAttributes),z=s?s.getBinderAttributes():[],C=I.concat(z),F=_r.prelude.staticUniforms?Na(_r.prelude.staticUniforms):[],N=_.staticUniforms?Na(_.staticUniforms):[],q=i.staticUniforms?Na(i.staticUniforms):[],G=s?s.getBinderUniforms():[],W=F.concat(N).concat(q).concat(G),K=[];for(const de of W)K.indexOf(de)<0&&K.push(de);const Q=s?s.defines():[];yr(w)&&Q.unshift("#version 300 es"),h&&Q.push("#define OVERDRAW_INSPECTOR;"),f&&Q.push("#define TERRAIN3D;"),x&&Q.push(x);let ee=Q.concat(_r.prelude.fragmentSource,_.fragmentSource,i.fragmentSource).join(`
725
- `),te=Q.concat(_r.prelude.vertexSource,_.vertexSource,i.vertexSource).join(`
726
- `);yr(w)||(ee=function(de){return de.replace(/\bin\s/g,"varying ").replace("out highp vec4 fragColor;","").replace(/fragColor/g,"gl_FragColor").replace(/texture\(/g,"texture2D(")}(ee),te=function(de){return de.replace(/\bin\s/g,"attribute ").replace(/\bout\s/g,"varying ").replace(/texture\(/g,"texture2D(")}(te));const se=w.createShader(w.FRAGMENT_SHADER);if(w.isContextLost())return void(this.failedToCreate=!0);if(w.shaderSource(se,ee),w.compileShader(se),!w.getShaderParameter(se,w.COMPILE_STATUS))throw new Error(`Could not compile fragment shader: ${w.getShaderInfoLog(se)}`);w.attachShader(this.program,se);const ie=w.createShader(w.VERTEX_SHADER);if(w.isContextLost())return void(this.failedToCreate=!0);if(w.shaderSource(ie,te),w.compileShader(ie),!w.getShaderParameter(ie,w.COMPILE_STATUS))throw new Error(`Could not compile vertex shader: ${w.getShaderInfoLog(ie)}`);w.attachShader(this.program,ie),this.attributes={};const pe={};this.numAttributes=C.length;for(let de=0;de<this.numAttributes;de++)C[de]&&(w.bindAttribLocation(this.program,de,C[de]),this.attributes[C[de]]=de);if(w.linkProgram(this.program),!w.getProgramParameter(this.program,w.LINK_STATUS))throw new Error(`Program failed to link: ${w.getProgramInfoLog(this.program)}`);w.deleteShader(ie),w.deleteShader(se);for(let de=0;de<K.length;de++){const we=K[de];if(we&&!pe[we]){const Se=w.getUniformLocation(this.program,we);Se&&(pe[we]=Se)}}this.fixedUniforms=o(e,pe),this.terrainUniforms=((de,we)=>({u_depth:new c.bF(de,we.u_depth),u_terrain:new c.bF(de,we.u_terrain),u_terrain_dim:new c.b8(de,we.u_terrain_dim),u_terrain_matrix:new c.bH(de,we.u_terrain_matrix),u_terrain_unpack:new c.bI(de,we.u_terrain_unpack),u_terrain_exaggeration:new c.b8(de,we.u_terrain_exaggeration)}))(e,pe),this.projectionUniforms=((de,we)=>({u_projection_matrix:new c.bH(de,we.u_projection_matrix),u_projection_tile_mercator_coords:new c.bI(de,we.u_projection_tile_mercator_coords),u_projection_clipping_plane:new c.bI(de,we.u_projection_clipping_plane),u_projection_transition:new c.b8(de,we.u_projection_transition),u_projection_fallback_matrix:new c.bH(de,we.u_projection_fallback_matrix)}))(e,pe),this.binderUniforms=s?s.getUniforms(e,pe):[]}draw(e,i,s,o,h,f,_,x,w,I,z,C,F,N,q,G,W,K,Q){const ee=e.gl;if(this.failedToCreate)return;if(e.program.set(this.program),e.setDepthMode(s),e.setStencilMode(o),e.setColorMode(h),e.setCullFace(f),x){e.activeTexture.set(ee.TEXTURE2),ee.bindTexture(ee.TEXTURE_2D,x.depthTexture),e.activeTexture.set(ee.TEXTURE3),ee.bindTexture(ee.TEXTURE_2D,x.texture);for(const se in this.terrainUniforms)this.terrainUniforms[se].set(x[se])}if(w)for(const se in w)this.projectionUniforms[Nh[se]].set(w[se]);if(_)for(const se in this.fixedUniforms)this.fixedUniforms[se].set(_[se]);G&&G.setUniforms(e,this.binderUniforms,N,{zoom:q});let te=0;switch(i){case ee.LINES:te=2;break;case ee.TRIANGLES:te=3;break;case ee.LINE_STRIP:te=1}for(const se of F.get()){const ie=se.vaos||(se.vaos={});(ie[I]||(ie[I]=new zl)).bind(e,this,z,G?G.getPaintVertexBuffers():[],C,se.vertexOffset,W,K,Q),ee.drawElements(i,se.primitiveLength*te,ee.UNSIGNED_SHORT,se.primitiveOffset*te*2)}}}function Za(u,e,i){const s=1/c.aw(i,1,e.transform.tileZoom),o=Math.pow(2,i.tileID.overscaledZ),h=i.tileSize*Math.pow(2,e.transform.tileZoom)/o,f=h*(i.tileID.canonical.x+i.tileID.wrap*o),_=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 yu=(u,e,i,s)=>{const o=u.style.light,h=o.properties.get("position"),f=[h.x,h.y,h.z],_=c.bL();o.properties.get("anchor")==="viewport"&&c.bM(_,u.transform.bearingInRadians),c.bN(f,f,_);const x=u.transform.transformLightDirection(f),w=o.properties.get("color");return{u_lightpos:f,u_lightpos_globe:x,u_lightintensity:o.properties.get("intensity"),u_lightcolor:[w.r,w.g,w.b],u_vertical_gradient:+e,u_opacity:i,u_fill_translate:s}},_o=(u,e,i,s,o,h,f)=>c.e(yu(u,e,i,s),Za(h,u,f),{u_height_factor:-Math.pow(2,o.overscaledZ)/f.tileSize/8}),xu=(u,e,i,s)=>c.e(Za(e,u,i),{u_fill_translate:s}),Va=(u,e)=>({u_world:u,u_fill_translate:e}),Zh=(u,e,i,s,o)=>c.e(xu(u,e,i,o),{u_world:s}),vu=(u,e,i,s,o)=>{const h=u.transform;let f,_,x=0;if(i.paint.get("circle-pitch-alignment")==="map"){const w=c.aw(e,1,h.zoom);f=!0,_=[w,w],x=w/(c.Z*Math.pow(2,e.tileID.overscaledZ))*2*Math.PI*o}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}},Vh=u=>({u_pixel_extrude_scale:[1/u.width,1/u.height]}),bu=u=>({u_viewport_size:[u.width,u.height]}),yo=(u,e=1)=>({u_color:u,u_overlay:0,u_overlay_scale:e}),kl=(u,e,i,s)=>{const o=c.aw(u,1,e)/(c.Z*Math.pow(2,u.tileID.overscaledZ))*2*Math.PI*s;return{u_extrude_scale:c.aw(u,1,e),u_intensity:i,u_globe_extrude_scale:o}},Al=(u,e,i,s)=>{const o=c.K();c.bO(o,0,u.width,u.height,0,0,1);const h=u.context.gl;return{u_matrix:o,u_world:[h.drawingBufferWidth,h.drawingBufferHeight],u_image:i,u_color_ramp:s,u_opacity:e.paint.get("heatmap-opacity")}},wu=(u,e,i)=>{const s=i.paint.get("hillshade-shadow-color"),o=i.paint.get("hillshade-highlight-color"),h=i.paint.get("hillshade-accent-color");let f=i.paint.get("hillshade-illumination-direction")*(Math.PI/180);return i.paint.get("hillshade-illumination-anchor")==="viewport"&&(f+=u.transform.bearingInRadians),{u_image:0,u_latrange:Yn(0,e.tileID),u_light:[i.paint.get("hillshade-exaggeration"),f],u_shadow:s,u_highlight:o,u_accent:h}},Tu=(u,e)=>{const i=e.stride,s=c.K();return c.bO(s,0,c.Z,-8192,0,0,1),c.L(s,s,[0,-8192,0]),{u_matrix:s,u_image:1,u_dimension:[i,i],u_zoom:u.overscaledZ,u_unpack:e.getUnpackVector()}};function Yn(u,e){const i=Math.pow(2,e.canonical.z),s=e.canonical.y;return[new c.$(0,s/i).toLngLat().lat,new c.$(0,(s+1)/i).toLngLat().lat]}const xo=(u,e,i,s)=>{const o=u.transform;return{u_translation:Su(u,e,i),u_ratio:s/c.aw(e,1,o.zoom),u_device_pixel_ratio:u.pixelRatio,u_units_to_pixels:[1/o.pixelsToGLUnits[0],1/o.pixelsToGLUnits[1]]}},Pu=(u,e,i,s,o)=>c.e(xo(u,e,i,s),{u_image:0,u_image_height:o}),Cs=(u,e,i,s,o)=>{const h=u.transform,f=Es(e,h);return{u_translation:Su(u,e,i),u_texsize:e.imageAtlasTexture.size,u_ratio:s/c.aw(e,1,h.zoom),u_device_pixel_ratio:u.pixelRatio,u_image:0,u_scale:[f,o.fromScale,o.toScale],u_fade:o.t,u_units_to_pixels:[1/h.pixelsToGLUnits[0],1/h.pixelsToGLUnits[1]]}},Uh=(u,e,i,s,o,h)=>{const f=u.lineAtlas,_=Es(e,u.transform),x=i.layout.get("line-cap")==="round",w=f.getDash(o.from,x),I=f.getDash(o.to,x),z=w.width*h.fromScale,C=I.width*h.toScale;return c.e(xo(u,e,i,s),{u_patternscale_a:[_/z,-w.height/2],u_patternscale_b:[_/C,-I.height/2],u_sdfgamma:f.width/(256*Math.min(z,C)*u.pixelRatio)/2,u_image:0,u_tex_y_a:w.y,u_tex_y_b:I.y,u_mix:h.t})};function Es(u,e){return 1/c.aw(u,1,e.tileZoom)}function Su(u,e,i){return c.ax(u.transform,e,i.paint.get("line-translate"),i.paint.get("line-translate-anchor"))}const $h=(u,e,i,s,o)=>{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:Mu(s.paint.get("raster-hue-rotate")),u_coords_top:[o[0].x,o[0].y,o[1].x,o[1].y],u_coords_bottom:[o[3].x,o[3].y,o[2].x,o[2].y]};var h,f};function Mu(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 Rl=(u,e,i,s,o,h,f,_,x,w,I,z,C)=>{const F=f.transform;return{u_is_size_zoom_constant:+(u==="constant"||u==="source"),u_is_size_feature_constant:+(u==="constant"||u==="camera"),u_size_t:e?e.uSizeT:0,u_size:e?e.uSize:0,u_camera_to_center_distance:F.cameraToCenterDistance,u_pitch:F.pitch/360*2*Math.PI,u_rotate_symbol:+i,u_aspect_ratio:F.width/F.height,u_fade_change:f.options.fadeDuration?f.symbolFadeChange:1,u_label_plane_matrix:_,u_coord_matrix:x,u_is_text:+I,u_pitch_with_map:+s,u_is_along_line:o,u_is_variable_anchor:h,u_texsize:z,u_texture:0,u_translation:w,u_pitched_scale:C}},Dl=(u,e,i,s,o,h,f,_,x,w,I,z,C,F)=>{const N=f.transform;return c.e(Rl(u,e,i,s,o,h,f,_,x,w,I,z,F),{u_gamma_scale:s?Math.cos(N.pitch*Math.PI/180)*N.cameraToCenterDistance:1,u_device_pixel_ratio:f.pixelRatio,u_is_halo:1})},Ll=(u,e,i,s,o,h,f,_,x,w,I,z,C)=>c.e(Dl(u,e,i,s,o,h,f,_,x,w,!0,I,0,C),{u_texsize_icon:z,u_texture_icon:1}),Iu=(u,e)=>({u_opacity:u,u_color:e}),vo=(u,e,i,s,o)=>c.e(function(h,f,_,x){const w=_.imageManager.getPattern(h.from.toString()),I=_.imageManager.getPattern(h.to.toString()),{width:z,height:C}=_.imageManager.getPixelSize(),F=Math.pow(2,x.tileID.overscaledZ),N=x.tileSize*Math.pow(2,_.transform.tileZoom)/F,q=N*(x.tileID.canonical.x+x.tileID.wrap*F),G=N*x.tileID.canonical.y;return{u_image:0,u_pattern_tl_a:w.tl,u_pattern_br_a:w.br,u_pattern_tl_b:I.tl,u_pattern_br_b:I.br,u_texsize:[z,C],u_mix:f.t,u_pattern_size_a:w.displaySize,u_pattern_size_b:I.displaySize,u_scale_a:f.fromScale,u_scale_b:f.toScale,u_tile_units_to_pixels:1/c.aw(x,1,_.transform.tileZoom),u_pixel_coord_upper:[q>>16,G>>16],u_pixel_coord_lower:[65535&q,65535&G]}}(i,o,e,s),{u_opacity:u}),Ar=(u,e)=>{},Fl={fillExtrusion:(u,e)=>({u_lightpos:new c.bJ(u,e.u_lightpos),u_lightpos_globe:new c.bJ(u,e.u_lightpos_globe),u_lightintensity:new c.b8(u,e.u_lightintensity),u_lightcolor:new c.bJ(u,e.u_lightcolor),u_vertical_gradient:new c.b8(u,e.u_vertical_gradient),u_opacity:new c.b8(u,e.u_opacity),u_fill_translate:new c.bK(u,e.u_fill_translate)}),fillExtrusionPattern:(u,e)=>({u_lightpos:new c.bJ(u,e.u_lightpos),u_lightpos_globe:new c.bJ(u,e.u_lightpos_globe),u_lightintensity:new c.b8(u,e.u_lightintensity),u_lightcolor:new c.bJ(u,e.u_lightcolor),u_vertical_gradient:new c.b8(u,e.u_vertical_gradient),u_height_factor:new c.b8(u,e.u_height_factor),u_opacity:new c.b8(u,e.u_opacity),u_fill_translate:new c.bK(u,e.u_fill_translate),u_image:new c.bF(u,e.u_image),u_texsize:new c.bK(u,e.u_texsize),u_pixel_coord_upper:new c.bK(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.bK(u,e.u_pixel_coord_lower),u_scale:new c.bJ(u,e.u_scale),u_fade:new c.b8(u,e.u_fade)}),fill:(u,e)=>({u_fill_translate:new c.bK(u,e.u_fill_translate)}),fillPattern:(u,e)=>({u_image:new c.bF(u,e.u_image),u_texsize:new c.bK(u,e.u_texsize),u_pixel_coord_upper:new c.bK(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.bK(u,e.u_pixel_coord_lower),u_scale:new c.bJ(u,e.u_scale),u_fade:new c.b8(u,e.u_fade),u_fill_translate:new c.bK(u,e.u_fill_translate)}),fillOutline:(u,e)=>({u_world:new c.bK(u,e.u_world),u_fill_translate:new c.bK(u,e.u_fill_translate)}),fillOutlinePattern:(u,e)=>({u_world:new c.bK(u,e.u_world),u_image:new c.bF(u,e.u_image),u_texsize:new c.bK(u,e.u_texsize),u_pixel_coord_upper:new c.bK(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.bK(u,e.u_pixel_coord_lower),u_scale:new c.bJ(u,e.u_scale),u_fade:new c.b8(u,e.u_fade),u_fill_translate:new c.bK(u,e.u_fill_translate)}),circle:(u,e)=>({u_camera_to_center_distance:new c.b8(u,e.u_camera_to_center_distance),u_scale_with_map:new c.bF(u,e.u_scale_with_map),u_pitch_with_map:new c.bF(u,e.u_pitch_with_map),u_extrude_scale:new c.bK(u,e.u_extrude_scale),u_device_pixel_ratio:new c.b8(u,e.u_device_pixel_ratio),u_globe_extrude_scale:new c.b8(u,e.u_globe_extrude_scale),u_translate:new c.bK(u,e.u_translate)}),collisionBox:(u,e)=>({u_pixel_extrude_scale:new c.bK(u,e.u_pixel_extrude_scale)}),collisionCircle:(u,e)=>({u_viewport_size:new c.bK(u,e.u_viewport_size)}),debug:(u,e)=>({u_color:new c.bG(u,e.u_color),u_overlay:new c.bF(u,e.u_overlay),u_overlay_scale:new c.b8(u,e.u_overlay_scale)}),depth:Ar,clippingMask:Ar,heatmap:(u,e)=>({u_extrude_scale:new c.b8(u,e.u_extrude_scale),u_intensity:new c.b8(u,e.u_intensity),u_globe_extrude_scale:new c.b8(u,e.u_globe_extrude_scale)}),heatmapTexture:(u,e)=>({u_matrix:new c.bH(u,e.u_matrix),u_world:new c.bK(u,e.u_world),u_image:new c.bF(u,e.u_image),u_color_ramp:new c.bF(u,e.u_color_ramp),u_opacity:new c.b8(u,e.u_opacity)}),hillshade:(u,e)=>({u_image:new c.bF(u,e.u_image),u_latrange:new c.bK(u,e.u_latrange),u_light:new c.bK(u,e.u_light),u_shadow:new c.bG(u,e.u_shadow),u_highlight:new c.bG(u,e.u_highlight),u_accent:new c.bG(u,e.u_accent)}),hillshadePrepare:(u,e)=>({u_matrix:new c.bH(u,e.u_matrix),u_image:new c.bF(u,e.u_image),u_dimension:new c.bK(u,e.u_dimension),u_zoom:new c.b8(u,e.u_zoom),u_unpack:new c.bI(u,e.u_unpack)}),line:(u,e)=>({u_translation:new c.bK(u,e.u_translation),u_ratio:new c.b8(u,e.u_ratio),u_device_pixel_ratio:new c.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new c.bK(u,e.u_units_to_pixels)}),lineGradient:(u,e)=>({u_translation:new c.bK(u,e.u_translation),u_ratio:new c.b8(u,e.u_ratio),u_device_pixel_ratio:new c.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new c.bK(u,e.u_units_to_pixels),u_image:new c.bF(u,e.u_image),u_image_height:new c.b8(u,e.u_image_height)}),linePattern:(u,e)=>({u_translation:new c.bK(u,e.u_translation),u_texsize:new c.bK(u,e.u_texsize),u_ratio:new c.b8(u,e.u_ratio),u_device_pixel_ratio:new c.b8(u,e.u_device_pixel_ratio),u_image:new c.bF(u,e.u_image),u_units_to_pixels:new c.bK(u,e.u_units_to_pixels),u_scale:new c.bJ(u,e.u_scale),u_fade:new c.b8(u,e.u_fade)}),lineSDF:(u,e)=>({u_translation:new c.bK(u,e.u_translation),u_ratio:new c.b8(u,e.u_ratio),u_device_pixel_ratio:new c.b8(u,e.u_device_pixel_ratio),u_units_to_pixels:new c.bK(u,e.u_units_to_pixels),u_patternscale_a:new c.bK(u,e.u_patternscale_a),u_patternscale_b:new c.bK(u,e.u_patternscale_b),u_sdfgamma:new c.b8(u,e.u_sdfgamma),u_image:new c.bF(u,e.u_image),u_tex_y_a:new c.b8(u,e.u_tex_y_a),u_tex_y_b:new c.b8(u,e.u_tex_y_b),u_mix:new c.b8(u,e.u_mix)}),raster:(u,e)=>({u_tl_parent:new c.bK(u,e.u_tl_parent),u_scale_parent:new c.b8(u,e.u_scale_parent),u_buffer_scale:new c.b8(u,e.u_buffer_scale),u_fade_t:new c.b8(u,e.u_fade_t),u_opacity:new c.b8(u,e.u_opacity),u_image0:new c.bF(u,e.u_image0),u_image1:new c.bF(u,e.u_image1),u_brightness_low:new c.b8(u,e.u_brightness_low),u_brightness_high:new c.b8(u,e.u_brightness_high),u_saturation_factor:new c.b8(u,e.u_saturation_factor),u_contrast_factor:new c.b8(u,e.u_contrast_factor),u_spin_weights:new c.bJ(u,e.u_spin_weights),u_coords_top:new c.bI(u,e.u_coords_top),u_coords_bottom:new c.bI(u,e.u_coords_bottom)}),symbolIcon:(u,e)=>({u_is_size_zoom_constant:new c.bF(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bF(u,e.u_is_size_feature_constant),u_size_t:new c.b8(u,e.u_size_t),u_size:new c.b8(u,e.u_size),u_camera_to_center_distance:new c.b8(u,e.u_camera_to_center_distance),u_pitch:new c.b8(u,e.u_pitch),u_rotate_symbol:new c.bF(u,e.u_rotate_symbol),u_aspect_ratio:new c.b8(u,e.u_aspect_ratio),u_fade_change:new c.b8(u,e.u_fade_change),u_label_plane_matrix:new c.bH(u,e.u_label_plane_matrix),u_coord_matrix:new c.bH(u,e.u_coord_matrix),u_is_text:new c.bF(u,e.u_is_text),u_pitch_with_map:new c.bF(u,e.u_pitch_with_map),u_is_along_line:new c.bF(u,e.u_is_along_line),u_is_variable_anchor:new c.bF(u,e.u_is_variable_anchor),u_texsize:new c.bK(u,e.u_texsize),u_texture:new c.bF(u,e.u_texture),u_translation:new c.bK(u,e.u_translation),u_pitched_scale:new c.b8(u,e.u_pitched_scale)}),symbolSDF:(u,e)=>({u_is_size_zoom_constant:new c.bF(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bF(u,e.u_is_size_feature_constant),u_size_t:new c.b8(u,e.u_size_t),u_size:new c.b8(u,e.u_size),u_camera_to_center_distance:new c.b8(u,e.u_camera_to_center_distance),u_pitch:new c.b8(u,e.u_pitch),u_rotate_symbol:new c.bF(u,e.u_rotate_symbol),u_aspect_ratio:new c.b8(u,e.u_aspect_ratio),u_fade_change:new c.b8(u,e.u_fade_change),u_label_plane_matrix:new c.bH(u,e.u_label_plane_matrix),u_coord_matrix:new c.bH(u,e.u_coord_matrix),u_is_text:new c.bF(u,e.u_is_text),u_pitch_with_map:new c.bF(u,e.u_pitch_with_map),u_is_along_line:new c.bF(u,e.u_is_along_line),u_is_variable_anchor:new c.bF(u,e.u_is_variable_anchor),u_texsize:new c.bK(u,e.u_texsize),u_texture:new c.bF(u,e.u_texture),u_gamma_scale:new c.b8(u,e.u_gamma_scale),u_device_pixel_ratio:new c.b8(u,e.u_device_pixel_ratio),u_is_halo:new c.bF(u,e.u_is_halo),u_translation:new c.bK(u,e.u_translation),u_pitched_scale:new c.b8(u,e.u_pitched_scale)}),symbolTextAndIcon:(u,e)=>({u_is_size_zoom_constant:new c.bF(u,e.u_is_size_zoom_constant),u_is_size_feature_constant:new c.bF(u,e.u_is_size_feature_constant),u_size_t:new c.b8(u,e.u_size_t),u_size:new c.b8(u,e.u_size),u_camera_to_center_distance:new c.b8(u,e.u_camera_to_center_distance),u_pitch:new c.b8(u,e.u_pitch),u_rotate_symbol:new c.bF(u,e.u_rotate_symbol),u_aspect_ratio:new c.b8(u,e.u_aspect_ratio),u_fade_change:new c.b8(u,e.u_fade_change),u_label_plane_matrix:new c.bH(u,e.u_label_plane_matrix),u_coord_matrix:new c.bH(u,e.u_coord_matrix),u_is_text:new c.bF(u,e.u_is_text),u_pitch_with_map:new c.bF(u,e.u_pitch_with_map),u_is_along_line:new c.bF(u,e.u_is_along_line),u_is_variable_anchor:new c.bF(u,e.u_is_variable_anchor),u_texsize:new c.bK(u,e.u_texsize),u_texsize_icon:new c.bK(u,e.u_texsize_icon),u_texture:new c.bF(u,e.u_texture),u_texture_icon:new c.bF(u,e.u_texture_icon),u_gamma_scale:new c.b8(u,e.u_gamma_scale),u_device_pixel_ratio:new c.b8(u,e.u_device_pixel_ratio),u_is_halo:new c.bF(u,e.u_is_halo),u_translation:new c.bK(u,e.u_translation),u_pitched_scale:new c.b8(u,e.u_pitched_scale)}),background:(u,e)=>({u_opacity:new c.b8(u,e.u_opacity),u_color:new c.bG(u,e.u_color)}),backgroundPattern:(u,e)=>({u_opacity:new c.b8(u,e.u_opacity),u_image:new c.bF(u,e.u_image),u_pattern_tl_a:new c.bK(u,e.u_pattern_tl_a),u_pattern_br_a:new c.bK(u,e.u_pattern_br_a),u_pattern_tl_b:new c.bK(u,e.u_pattern_tl_b),u_pattern_br_b:new c.bK(u,e.u_pattern_br_b),u_texsize:new c.bK(u,e.u_texsize),u_mix:new c.b8(u,e.u_mix),u_pattern_size_a:new c.bK(u,e.u_pattern_size_a),u_pattern_size_b:new c.bK(u,e.u_pattern_size_b),u_scale_a:new c.b8(u,e.u_scale_a),u_scale_b:new c.b8(u,e.u_scale_b),u_pixel_coord_upper:new c.bK(u,e.u_pixel_coord_upper),u_pixel_coord_lower:new c.bK(u,e.u_pixel_coord_lower),u_tile_units_to_pixels:new c.b8(u,e.u_tile_units_to_pixels)}),terrain:(u,e)=>({u_texture:new c.bF(u,e.u_texture),u_ele_delta:new c.b8(u,e.u_ele_delta),u_fog_matrix:new c.bH(u,e.u_fog_matrix),u_fog_color:new c.bG(u,e.u_fog_color),u_fog_ground_blend:new c.b8(u,e.u_fog_ground_blend),u_fog_ground_blend_opacity:new c.b8(u,e.u_fog_ground_blend_opacity),u_horizon_color:new c.bG(u,e.u_horizon_color),u_horizon_fog_blend:new c.b8(u,e.u_horizon_fog_blend),u_is_globe_mode:new c.b8(u,e.u_is_globe_mode)}),terrainDepth:(u,e)=>({u_ele_delta:new c.b8(u,e.u_ele_delta)}),terrainCoords:(u,e)=>({u_texture:new c.bF(u,e.u_texture),u_terrain_coords_id:new c.b8(u,e.u_terrain_coords_id),u_ele_delta:new c.b8(u,e.u_ele_delta)}),projectionErrorMeasurement:(u,e)=>({u_input:new c.b8(u,e.u_input),u_output_expected:new c.b8(u,e.u_output_expected)}),atmosphere:(u,e)=>({u_sun_pos:new c.bJ(u,e.u_sun_pos),u_atmosphere_blend:new c.b8(u,e.u_atmosphere_blend),u_globe_position:new c.bJ(u,e.u_globe_position),u_globe_radius:new c.b8(u,e.u_globe_radius),u_inv_proj_matrix:new c.bH(u,e.u_inv_proj_matrix)}),sky:(u,e)=>({u_sky_color:new c.bG(u,e.u_sky_color),u_horizon_color:new c.bG(u,e.u_horizon_color),u_horizon:new c.bK(u,e.u_horizon),u_horizon_normal:new c.bK(u,e.u_horizon_normal),u_sky_horizon_blend:new c.b8(u,e.u_sky_horizon_blend),u_sky_blend:new c.b8(u,e.u_sky_blend)})};class Bl{constructor(e,i,s){this.context=e;const o=e.gl;this.buffer=o.createBuffer(),this.dynamicDraw=!!s,this.context.unbindVAO(),e.bindElementBuffer.set(this.buffer),o.bufferData(o.ELEMENT_ARRAY_BUFFER,i.arrayBuffer,this.dynamicDraw?o.DYNAMIC_DRAW:o.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 Ol={Int8:"BYTE",Uint8:"UNSIGNED_BYTE",Int16:"SHORT",Uint16:"UNSIGNED_SHORT",Int32:"INT",Uint32:"UNSIGNED_INT",Float32:"FLOAT"};class Cu{constructor(e,i,s,o){this.length=i.length,this.attributes=s,this.itemSize=i.bytesPerElement,this.dynamicDraw=o,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 o=i.attributes[this.attributes[s].name];o!==void 0&&e.enableVertexAttribArray(o)}}setVertexAttribPointers(e,i,s){for(let o=0;o<this.attributes.length;o++){const h=this.attributes[o],f=i.attributes[h.name];f!==void 0&&e.vertexAttribPointer(f,h.components,e[Ol[h.type]],!1,this.itemSize,h.offset+this.itemSize*(s||0))}}destroy(){this.buffer&&(this.context.gl.deleteBuffer(this.buffer),delete this.buffer)}}class bt{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 Jn extends bt{getDefault(){return c.b7.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.clearColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class jl extends bt{getDefault(){return 1}set(e){(e!==this.current||this.dirty)&&(this.gl.clearDepth(e),this.current=e,this.dirty=!1)}}class Gh extends bt{getDefault(){return 0}set(e){(e!==this.current||this.dirty)&&(this.gl.clearStencil(e),this.current=e,this.dirty=!1)}}class qh extends bt{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 Wh extends bt{getDefault(){return!0}set(e){(e!==this.current||this.dirty)&&(this.gl.depthMask(e),this.current=e,this.dirty=!1)}}class Hh extends bt{getDefault(){return 255}set(e){(e!==this.current||this.dirty)&&(this.gl.stencilMask(e),this.current=e,this.dirty=!1)}}class Eu extends bt{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 Kh extends bt{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 zu extends bt{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 bo extends bt{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 wo extends bt{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 To extends bt{getDefault(){return this.gl.LESS}set(e){(e!==this.current||this.dirty)&&(this.gl.depthFunc(e),this.current=e,this.dirty=!1)}}class Nl extends bt{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 Qn extends bt{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 Ua extends bt{getDefault(){return c.b7.transparent}set(e){const i=this.current;(e.r!==i.r||e.g!==i.g||e.b!==i.b||e.a!==i.a||this.dirty)&&(this.gl.blendColor(e.r,e.g,e.b,e.a),this.current=e,this.dirty=!1)}}class sr extends bt{getDefault(){return this.gl.FUNC_ADD}set(e){(e!==this.current||this.dirty)&&(this.gl.blendEquation(e),this.current=e,this.dirty=!1)}}class ku extends bt{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 Au extends bt{getDefault(){return this.gl.BACK}set(e){(e!==this.current||this.dirty)&&(this.gl.cullFace(e),this.current=e,this.dirty=!1)}}class Zl extends bt{getDefault(){return this.gl.CCW}set(e){(e!==this.current||this.dirty)&&(this.gl.frontFace(e),this.current=e,this.dirty=!1)}}class ea extends bt{getDefault(){return null}set(e){(e!==this.current||this.dirty)&&(this.gl.useProgram(e),this.current=e,this.dirty=!1)}}class Po extends bt{getDefault(){return this.gl.TEXTURE0}set(e){(e!==this.current||this.dirty)&&(this.gl.activeTexture(e),this.current=e,this.dirty=!1)}}class So extends bt{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 zs extends bt{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 Mo extends bt{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 Ru extends bt{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 $a extends bt{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 Ga extends bt{getDefault(){return null}set(e){const i=this.gl;i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,e),this.current=e,this.dirty=!1}}class Du extends bt{getDefault(){return null}set(e){var i;if(e===this.current&&!this.dirty)return;const s=this.gl;yr(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 Vl extends bt{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 xt extends bt{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 Io extends bt{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 Ul extends bt{constructor(e,i){super(e),this.context=e,this.parent=i}getDefault(){return null}}class Lu extends Ul{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 ks extends Ul{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 Xh extends Ul{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 Fu="Framebuffer is not complete";class Bu{constructor(e,i,s,o,h){this.context=e,this.width=i,this.height=s;const f=e.gl,_=this.framebuffer=f.createFramebuffer();if(this.colorAttachment=new Lu(e,_),o)this.depthAttachment=h?new Xh(e,_):new ks(e,_);else if(h)throw new Error("Stencil cannot be set without depth");if(f.checkFramebufferStatus(f.FRAMEBUFFER)!==f.FRAMEBUFFER_COMPLETE)throw new Error(Fu)}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 Yh{constructor(e){var i,s;if(this.gl=e,this.clearColor=new Jn(this),this.clearDepth=new jl(this),this.clearStencil=new Gh(this),this.colorMask=new qh(this),this.depthMask=new Wh(this),this.stencilMask=new Hh(this),this.stencilFunc=new Eu(this),this.stencilOp=new Kh(this),this.stencilTest=new zu(this),this.depthRange=new bo(this),this.depthTest=new wo(this),this.depthFunc=new To(this),this.blend=new Nl(this),this.blendFunc=new Qn(this),this.blendColor=new Ua(this),this.blendEquation=new sr(this),this.cullFace=new ku(this),this.cullFaceSide=new Au(this),this.frontFace=new Zl(this),this.program=new ea(this),this.activeTexture=new Po(this),this.viewport=new So(this),this.bindFramebuffer=new zs(this),this.bindRenderbuffer=new Mo(this),this.bindTexture=new Ru(this),this.bindVertexBuffer=new $a(this),this.bindElementBuffer=new Ga(this),this.bindVertexArray=new Du(this),this.pixelStoreUnpack=new Vl(this),this.pixelStoreUnpackPremultiplyAlpha=new xt(this),this.pixelStoreUnpackFlipY=new Io(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),yr(e)){this.HALF_FLOAT=e.HALF_FLOAT;const o=e.getExtension("EXT_color_buffer_half_float");this.RGBA16F=(i=e.RGBA16F)!==null&&i!==void 0?i:o==null?void 0:o.RGBA16F_EXT,this.RGB16F=(s=e.RGB16F)!==null&&s!==void 0?s:o==null?void 0:o.RGB16F_EXT,e.getExtension("EXT_color_buffer_float")}else{e.getExtension("EXT_color_buffer_half_float"),e.getExtension("OES_texture_half_float_linear");const o=e.getExtension("OES_texture_half_float");this.HALF_FLOAT=o==null?void 0:o.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 Bl(this,e,i)}createVertexBuffer(e,i,s){return new Cu(this,e,i,s)}createRenderbuffer(e,i,s){const o=this.gl,h=o.createRenderbuffer();return this.bindRenderbuffer.set(h),o.renderbufferStorage(o.RENDERBUFFER,e,i,s),this.bindRenderbuffer.set(null),h}createFramebuffer(e,i,s,o){return new Bu(this,e,i,s,o)}clear({color:e,depth:i,stencil:s}){const o=this.gl;let h=0;e&&(h|=o.COLOR_BUFFER_BIT,this.clearColor.set(e),this.colorMask.set([!0,!0,!0,!0])),i!==void 0&&(h|=o.DEPTH_BUFFER_BIT,this.depthRange.set([0,1]),this.clearDepth.set(i),this.depthMask.set(!0)),s!==void 0&&(h|=o.STENCIL_BUFFER_BIT,this.clearStencil.set(s),this.stencilMask.set(255)),o.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){c.bC(e.blendFunction,Lt.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 yr(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 yr(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 qa;function As(u,e,i,s,o){const h=u.context,f=u.transform,_=h.gl,x=u.useProgram("collisionBox"),w=[];let I=0,z=0;for(let W=0;W<s.length;W++){const K=s[W],Q=e.getTile(K).getBucket(i);if(!Q)continue;const ee=o?Q.textCollisionBox:Q.iconCollisionBox,te=Q.collisionCircleArray;te.length>0&&(w.push({circleArray:te,circleOffset:z,coord:K}),I+=te.length/4,z=I),ee&&x.draw(h,_.LINES,ct.disabled,gt.disabled,u.colorModeForRenderPass(),vt.disabled,Vh(u.transform),u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),f.getProjectionData({overscaledTileID:K,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),i.id,ee.layoutVertexBuffer,ee.indexBuffer,ee.segments,null,u.transform.zoom,null,null,ee.collisionVertexBuffer)}if(!o||!w.length)return;const C=u.useProgram("collisionCircle"),F=new c.bP;F.resize(4*I),F._trim();let N=0;for(const W of w)for(let K=0;K<W.circleArray.length/4;K++){const Q=4*K,ee=W.circleArray[Q+0],te=W.circleArray[Q+1],se=W.circleArray[Q+2],ie=W.circleArray[Q+3];F.emplace(N++,ee,te,se,ie,0),F.emplace(N++,ee,te,se,ie,1),F.emplace(N++,ee,te,se,ie,2),F.emplace(N++,ee,te,se,ie,3)}(!qa||qa.length<2*I)&&(qa=function(W){const K=2*W,Q=new c.bR;Q.resize(K),Q._trim();for(let ee=0;ee<K;ee++){const te=6*ee;Q.uint16[te+0]=4*ee+0,Q.uint16[te+1]=4*ee+1,Q.uint16[te+2]=4*ee+2,Q.uint16[te+3]=4*ee+2,Q.uint16[te+4]=4*ee+3,Q.uint16[te+5]=4*ee+0}return Q}(I));const q=h.createIndexBuffer(qa,!0),G=h.createVertexBuffer(F,c.bQ.members,!0);for(const W of w){const K=bu(u.transform);C.draw(h,_.TRIANGLES,ct.disabled,gt.disabled,u.colorModeForRenderPass(),vt.disabled,K,u.style.map.terrain&&u.style.map.terrain.getTerrainData(W.coord),null,i.id,G,q,c.aG.simpleSegment(0,2*W.circleOffset,W.circleArray.length,W.circleArray.length/2),null,u.transform.zoom,null,null,null)}G.destroy(),q.destroy()}const Co=c.at(new Float32Array(16));function $l(u,e,i,s,o,h){const{horizontalAlign:f,verticalAlign:_}=c.aB(u);return new c.P((-(f-.5)*e/o+s[0])*h,(-(_-.5)*i/o+s[1])*h)}function Gl(u,e,i,s,o,h){const f=e.tileAnchorPoint.add(new c.P(e.translation[0],e.translation[1]));if(e.pitchWithMap){let _=s.mult(h);i||(_=_.rotate(-o));const x=f.add(_);return _e(x.x,x.y,e.pitchedLabelPlaneMatrix,e.getElevation).point}if(i){const _=_t(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 Ou(u,e,i,s,o,h,f,_,x,w,I,z){const C=u.text.placedSymbolArray,F=u.text.dynamicLayoutVertexArray,N=u.icon.dynamicLayoutVertexArray,q={};F.clear();for(let G=0;G<C.length;G++){const W=C.get(G),K=W.hidden||!W.crossTileID||u.allowVerticalPlacement&&!W.placedOrientation?null:s[W.crossTileID];if(K){const Q=new c.P(W.anchorX,W.anchorY),ee={getElevation:z,width:o.width,height:o.height,pitchedLabelPlaneMatrix:h,pitchWithMap:i,transform:o,tileAnchorPoint:Q,translation:w,unwrappedTileID:I},te=i?qe(Q.x,Q.y,ee):_t(Q.x,Q.y,ee),se=ue(o.cameraToCenterDistance,te.signedDistanceFromCamera);let ie=c.ai(u.textSizeData,_,W)*se/c.av;i&&(ie*=u.tilePixelRatio/f);const{width:pe,height:de,anchor:we,textOffset:Se,textBoxScale:ve}=K,Be=$l(we,pe,de,Se,ve,ie),Le=o.getPitchedTextCorrection(Q.x+w[0],Q.y+w[1],I),Me=Gl(te.point,ee,e,Be,-o.bearingInRadians,Le),We=u.allowVerticalPlacement&&W.placedOrientation===c.ah.vertical?Math.PI/2:0;for(let lt=0;lt<W.numGlyphs;lt++)c.ao(F,Me,We);x&&W.associatedIconIndex>=0&&(q[W.associatedIconIndex]={shiftedAnchor:Me,angle:We})}else it(W.numGlyphs,F)}if(x){N.clear();const G=u.icon.placedSymbolArray;for(let W=0;W<G.length;W++){const K=G.get(W);if(K.hidden)it(K.numGlyphs,N);else{const Q=q[W];if(Q)for(let ee=0;ee<K.numGlyphs;ee++)c.ao(N,Q.shiftedAnchor,Q.angle);else it(K.numGlyphs,N)}}u.icon.dynamicLayoutVertexBuffer.updateData(N)}u.text.dynamicLayoutVertexBuffer.updateData(F)}function Eo(u,e,i){return i.iconsInText&&e?"symbolTextAndIcon":u?"symbolSDF":"symbolIcon"}function Rs(u,e,i,s,o,h,f,_,x,w,I,z,C){const F=u.context,N=F.gl,q=u.transform,G=_==="map",W=x==="map",K=_!=="viewport"&&i.layout.get("symbol-placement")!=="point",Q=G&&!W&&!K,ee=!i.layout.get("symbol-sort-key").isConstant();let te=!1;const se=u.getDepthModeForSublayer(0,ct.ReadOnly),ie=i._unevaluatedLayout.hasValue("text-variable-anchor")||i._unevaluatedLayout.hasValue("text-variable-anchor-offset"),pe=[],de=q.getCircleRadiusCorrection();for(const we of s){const Se=e.getTile(we),ve=Se.getBucket(i);if(!ve)continue;const Be=o?ve.text:ve.icon;if(!Be||!Be.segments.get().length||!Be.hasVisibleVertices)continue;const Le=Be.programConfigurations.get(i.id),Me=o||ve.sdfIcons,We=o?ve.textSizeData:ve.iconSizeData,lt=W||q.pitch!==0,Tt=u.useProgram(Eo(Me,o,ve),Le),ut=c.ag(We,q.zoom),It=u.style.map.terrain&&u.style.map.terrain.getTerrainData(we);let At,Bt,Mt,Ct,ti=[0,0],ui=null;if(o)Bt=Se.glyphAtlasTexture,Mt=N.LINEAR,At=Se.glyphAtlasTexture.size,ve.iconsInText&&(ti=Se.imageAtlasTexture.size,ui=Se.imageAtlasTexture,Ct=lt||u.options.rotating||u.options.zooming||We.kind==="composite"||We.kind==="camera"?N.LINEAR:N.NEAREST);else{const qt=i.layout.get("icon-size").constantOr(0)!==1||ve.iconsNeedLinear;Bt=Se.imageAtlasTexture,Mt=Me||u.options.rotating||u.options.zooming||qt||lt?N.LINEAR:N.NEAREST,At=Se.imageAtlasTexture.size}const fi=c.aw(Se,1,u.transform.zoom),Gi=he(G,u.transform,fi),Qr=c.K();c.aj(Qr,Gi);const Fr=oe(W,G,u.transform,fi),Sn=c.ax(q,Se,h,f),Mn=q.getProjectionData({overscaledTileID:we,applyGlobeMatrix:!C,applyTerrainMatrix:!0}),la=ie&&ve.hasTextData(),Br=i.layout.get("icon-text-fit")!=="none"&&la&&ve.hasIconData();if(K){const qt=u.style.map.terrain?(ai,zt)=>u.style.map.terrain.getElevation(we,ai,zt):null,Wt=i.layout.get("text-rotation-alignment")==="map";je(ve,u,o,Gi,Qr,W,w,Wt,we.toUnwrapped(),q.width,q.height,Sn,qt)}const en=o&&ie||Br,Ji=K||en?Co:W?Gi:u.transform.clipSpaceToPixelsMatrix,tn=Me&&i.paint.get(o?"text-halo-width":"icon-halo-width").constantOr(1)!==0;let ca;ca=Me?ve.iconsInText?Ll(We.kind,ut,Q,W,K,en,u,Ji,Fr,Sn,At,ti,de):Dl(We.kind,ut,Q,W,K,en,u,Ji,Fr,Sn,o,At,0,de):Rl(We.kind,ut,Q,W,K,en,u,Ji,Fr,Sn,o,At,de);const ua={program:Tt,buffers:Be,uniformValues:ca,projectionData:Mn,atlasTexture:Bt,atlasTextureIcon:ui,atlasInterpolation:Mt,atlasInterpolationIcon:Ct,isSDF:Me,hasHalo:tn};if(ee&&ve.canOverlap){te=!0;const qt=Be.segments.get();for(const Wt of qt)pe.push({segments:new c.aG([Wt]),sortKey:Wt.sortKey,state:ua,terrainData:It})}else pe.push({segments:Be.segments,sortKey:0,state:ua,terrainData:It})}te&&pe.sort((we,Se)=>we.sortKey-Se.sortKey);for(const we of pe){const Se=we.state;if(F.activeTexture.set(N.TEXTURE0),Se.atlasTexture.bind(Se.atlasInterpolation,N.CLAMP_TO_EDGE),Se.atlasTextureIcon&&(F.activeTexture.set(N.TEXTURE1),Se.atlasTextureIcon&&Se.atlasTextureIcon.bind(Se.atlasInterpolationIcon,N.CLAMP_TO_EDGE)),Se.isSDF){const ve=Se.uniformValues;Se.hasHalo&&(ve.u_is_halo=1,zo(Se.buffers,we.segments,i,u,Se.program,se,I,z,ve,Se.projectionData,we.terrainData)),ve.u_is_halo=0}zo(Se.buffers,we.segments,i,u,Se.program,se,I,z,Se.uniformValues,Se.projectionData,we.terrainData)}}function zo(u,e,i,s,o,h,f,_,x,w,I){const z=s.context;o.draw(z,z.gl.TRIANGLES,h,f,_,vt.backCCW,x,I,w,i.id,u.layoutVertexBuffer,u.indexBuffer,e,i.paint,s.transform.zoom,u.programConfigurations.get(i.id),u.dynamicLayoutVertexBuffer,u.opacityVertexBuffer)}function Jh(u,e,i,s,o){const h=u.context,f=h.gl,_=gt.disabled,x=new Lt([f.ONE,f.ONE],c.b7.transparent,[!0,!0,!0,!0]),w=e.getBucket(i);if(!w)return;const I=s.key;let z=i.heatmapFbos.get(I);z||(z=ju(h,e.tileSize,e.tileSize),i.heatmapFbos.set(I,z)),h.bindFramebuffer.set(z.framebuffer),h.viewport.set([0,0,e.tileSize,e.tileSize]),h.clear({color:c.b7.transparent});const C=w.programConfigurations.get(i.id),F=u.useProgram("heatmap",C,!o),N=u.transform.getProjectionData({overscaledTileID:e.tileID,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),q=u.style.map.terrain.getTerrainData(s);F.draw(h,f.TRIANGLES,ct.disabled,_,x,vt.disabled,kl(e,u.transform.zoom,i.paint.get("heatmap-intensity"),1),q,N,i.id,w.layoutVertexBuffer,w.indexBuffer,w.segments,i.paint,u.transform.zoom,C)}function ql(u,e,i,s,o){const h=u.context,f=h.gl,_=u.transform;h.setColorMode(u.colorModeForRenderPass());const x=Wl(h,e),w=i.key,I=e.heatmapFbos.get(w);if(!I)return;h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,I.colorAttachment.get()),h.activeTexture.set(f.TEXTURE1),x.bind(f.LINEAR,f.CLAMP_TO_EDGE);const z=_.getProjectionData({overscaledTileID:i,applyTerrainMatrix:o,applyGlobeMatrix:!s});u.useProgram("heatmapTexture").draw(h,f.TRIANGLES,ct.disabled,gt.disabled,u.colorModeForRenderPass(),vt.disabled,Al(u,e,0,1),null,z,e.id,u.rasterBoundsBuffer,u.quadTriangleIndexBuffer,u.rasterBoundsSegments,e.paint,_.zoom),I.destroy(),e.heatmapFbos.delete(w)}function ju(u,e,i){var s,o;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=(o=u.RGBA16F)!==null&&o!==void 0?o:h.RGBA;h.texImage2D(h.TEXTURE_2D,0,x,e,i,0,h.RGBA,_,null);const w=u.createFramebuffer(e,i,!1,!1);return w.colorAttachment.set(f),w}function Wl(u,e){return e.colorRampTexture||(e.colorRampTexture=new Zt(u,e.colorRamp,u.gl.RGBA)),e.colorRampTexture}function Ds(u,e,i,s,o){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=o.getPaintProperty(e);f=h[x],_=h[x]}f&&_&&u.setConstantPatternPositions(f,_)}function ko(u,e,i,s,o,h,f,_){const x=u.context.gl,w="fill-pattern",I=i.paint.get(w),z=I&&I.constantOr(1),C=i.getCrossfadeParameters();let F,N,q,G,W;const K=u.transform,Q=i.paint.get("fill-translate"),ee=i.paint.get("fill-translate-anchor");f?(N=z&&!i.getPaintProperty("fill-outline-color")?"fillOutlinePattern":"fillOutline",F=x.LINES):(N=z?"fillPattern":"fill",F=x.TRIANGLES);const te=I.constantOr(null);for(const se of s){const ie=e.getTile(se);if(z&&!ie.patternsLoaded())continue;const pe=ie.getBucket(i);if(!pe)continue;const de=pe.programConfigurations.get(i.id),we=u.useProgram(N,de),Se=u.style.map.terrain&&u.style.map.terrain.getTerrainData(se);z&&(u.context.activeTexture.set(x.TEXTURE0),ie.imageAtlasTexture.bind(x.LINEAR,x.CLAMP_TO_EDGE),de.updatePaintBuffers(C)),Ds(de,w,te,ie,i);const ve=K.getProjectionData({overscaledTileID:se,applyGlobeMatrix:!_,applyTerrainMatrix:!0}),Be=c.ax(K,ie,Q,ee);if(f){G=pe.indexBuffer2,W=pe.segments2;const Me=[x.drawingBufferWidth,x.drawingBufferHeight];q=N==="fillOutlinePattern"&&z?Zh(u,C,ie,Me,Be):Va(Me,Be)}else G=pe.indexBuffer,W=pe.segments,q=z?xu(u,C,ie,Be):{u_fill_translate:Be};let Le;if(u.renderPass==="translucent"&&_){const[Me]=u.getStencilConfigForOverlapAndUpdateStencilID(s);Le=Me[se.overscaledZ]}else Le=u.stencilModeForClipping(se);we.draw(u.context,F,o,Le,h,vt.backCCW,q,Se,ve,i.id,pe.layoutVertexBuffer,G,W,i.paint,u.transform.zoom,de)}}function Ao(u,e,i,s,o,h,f,_){const x=u.context,w=x.gl,I="fill-extrusion-pattern",z=i.paint.get(I),C=z.constantOr(1),F=i.getCrossfadeParameters(),N=i.paint.get("fill-extrusion-opacity"),q=z.constantOr(null),G=u.transform;for(const W of s){const K=e.getTile(W),Q=K.getBucket(i);if(!Q)continue;const ee=u.style.map.terrain&&u.style.map.terrain.getTerrainData(W),te=Q.programConfigurations.get(i.id),se=u.useProgram(C?"fillExtrusionPattern":"fillExtrusion",te);C&&(u.context.activeTexture.set(w.TEXTURE0),K.imageAtlasTexture.bind(w.LINEAR,w.CLAMP_TO_EDGE),te.updatePaintBuffers(F));const ie=G.getProjectionData({overscaledTileID:W,applyGlobeMatrix:!_,applyTerrainMatrix:!0});Ds(te,I,q,K,i);const pe=c.ax(G,K,i.paint.get("fill-extrusion-translate"),i.paint.get("fill-extrusion-translate-anchor")),de=i.paint.get("fill-extrusion-vertical-gradient"),we=C?_o(u,de,N,pe,W,F,K):yu(u,de,N,pe);se.draw(x,x.gl.TRIANGLES,o,h,f,vt.backCCW,we,ee,ie,i.id,Q.layoutVertexBuffer,Q.indexBuffer,Q.segments,i.paint,u.transform.zoom,te,u.style.map.terrain&&Q.centroidVertexBuffer)}}function Ro(u,e,i,s,o,h,f,_,x){var w;const I=u.style.projection,z=u.context,C=u.transform,F=z.gl,N=u.useProgram("hillshade"),q=!u.options.moving;for(const G of s){const W=e.getTile(G),K=W.fbo;if(!K)continue;const Q=I.getMeshFromTileID(z,G.canonical,_,!0,"raster"),ee=(w=u.style.map.terrain)===null||w===void 0?void 0:w.getTerrainData(G);z.activeTexture.set(F.TEXTURE0),F.bindTexture(F.TEXTURE_2D,K.colorAttachment.get());const te=C.getProjectionData({overscaledTileID:G,aligned:q,applyGlobeMatrix:!x,applyTerrainMatrix:!0});N.draw(z,F.TRIANGLES,h,o[G.overscaledZ],f,vt.backCCW,wu(u,W,i),ee,te,i.id,Q.vertexBuffer,Q.indexBuffer,Q.segments)}}const Wa=[new c.P(0,0),new c.P(c.Z,0),new c.P(c.Z,c.Z),new c.P(0,c.Z)];function Ha(u,e,i,s,o,h,f,_,x=!1,w=!1){const I=s[s.length-1].overscaledZ,z=u.context,C=z.gl,F=u.useProgram("raster"),N=u.transform,q=u.style.projection,G=u.colorModeForRenderPass(),W=!u.options.moving;for(const K of s){const Q=u.getDepthModeForSublayer(K.overscaledZ-I,i.paint.get("raster-opacity")===1?ct.ReadWrite:ct.ReadOnly,C.LESS),ee=e.getTile(K);ee.registerFadeDuration(i.paint.get("raster-fade-duration"));const te=e.findLoadedParent(K,0),se=e.findLoadedSibling(K),ie=Qh(ee,te||se||null,e,i,u.transform,u.style.map.terrain);let pe,de;const we=i.paint.get("raster-resampling")==="nearest"?C.NEAREST:C.LINEAR;z.activeTexture.set(C.TEXTURE0),ee.texture.bind(we,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),z.activeTexture.set(C.TEXTURE1),te?(te.texture.bind(we,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),pe=Math.pow(2,te.tileID.overscaledZ-ee.tileID.overscaledZ),de=[ee.tileID.canonical.x*pe%1,ee.tileID.canonical.y*pe%1]):ee.texture.bind(we,C.CLAMP_TO_EDGE,C.LINEAR_MIPMAP_NEAREST),ee.texture.useMipmap&&z.extTextureFilterAnisotropic&&u.transform.pitch>20&&C.texParameterf(C.TEXTURE_2D,z.extTextureFilterAnisotropic.TEXTURE_MAX_ANISOTROPY_EXT,z.extTextureFilterAnisotropicMax);const Se=u.style.map.terrain&&u.style.map.terrain.getTerrainData(K),ve=N.getProjectionData({overscaledTileID:K,aligned:W,applyGlobeMatrix:!w,applyTerrainMatrix:!0}),Be=$h(de||[0,0],pe||1,ie,i,_),Le=q.getMeshFromTileID(z,K.canonical,h,f,"raster");F.draw(z,C.TRIANGLES,Q,o?o[K.overscaledZ]:gt.disabled,G,x?vt.frontCCW:vt.backCCW,Be,Se,ve,i.id,Le.vertexBuffer,Le.indexBuffer,Le.segments)}}function Qh(u,e,i,s,o,h){const f=s.paint.get("raster-fade-duration");if(!h&&f>0){const _=Ae.now(),x=(_-u.timeAdded)/f,w=e?(_-e.timeAdded)/f:-1,I=i.getSource(),z=Wr(o,{tileSize:I.tileSize,roundZoom:I.roundZoom}),C=!e||Math.abs(e.tileID.overscaledZ-z)>Math.abs(u.tileID.overscaledZ-z),F=C&&u.refreshedUponExpiration?1:c.ae(C?x:1-w,0,1);return u.refreshedUponExpiration&&x>=1&&(u.refreshedUponExpiration=!1),e?{opacity:1,mix:1-F}:{opacity:F,mix:0}}return{opacity:1,mix:0}}const Nu=new c.b7(1,0,0,1),Jt=new c.b7(0,1,0,1),ta=new c.b7(0,0,1,1),or=new c.b7(1,0,1,1),Hl=new c.b7(0,1,1,1);function Do(u,e,i,s){Yr(u,0,e+i/2,u.transform.width,i,s)}function Kl(u,e,i,s){Yr(u,e-i/2,0,i,u.transform.height,s)}function Yr(u,e,i,s,o,h){const f=u.context,_=f.gl;_.enable(_.SCISSOR_TEST),_.scissor(e*u.pixelRatio,i*u.pixelRatio,s*u.pixelRatio,o*u.pixelRatio),f.clear({color:h}),_.disable(_.SCISSOR_TEST)}function Ls(u,e,i){const s=u.context,o=s.gl,h=u.useProgram("debug"),f=ct.disabled,_=gt.disabled,x=u.colorModeForRenderPass(),w="$debug",I=u.style.map.terrain&&u.style.map.terrain.getTerrainData(i);s.activeTexture.set(o.TEXTURE0);const z=e.getTileByID(i.key).latestRawTileData,C=Math.floor((z&&z.byteLength||0)/1024),F=e.getTile(i).tileSize,N=512/Math.min(F,512)*(i.overscaledZ/u.transform.zoom)*.5;let q=i.canonical.toString();i.overscaledZ!==i.canonical.z&&(q+=` => ${i.overscaledZ}`),function(W,K){W.initDebugOverlayCanvas();const Q=W.debugOverlayCanvas,ee=W.context.gl,te=W.debugOverlayCanvas.getContext("2d");te.clearRect(0,0,Q.width,Q.height),te.shadowColor="white",te.shadowBlur=2,te.lineWidth=1.5,te.strokeStyle="white",te.textBaseline="top",te.font="bold 36px Open Sans, sans-serif",te.fillText(K,5,5),te.strokeText(K,5,5),W.debugOverlayTexture.update(Q),W.debugOverlayTexture.bind(ee.LINEAR,ee.CLAMP_TO_EDGE)}(u,`${q} ${C}kB`);const G=u.transform.getProjectionData({overscaledTileID:i,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(s,o.TRIANGLES,f,_,Lt.alphaBlended,vt.disabled,yo(c.b7.transparent,N),null,G,w,u.debugBuffer,u.quadTriangleIndexBuffer,u.debugSegments),h.draw(s,o.LINE_STRIP,f,_,x,vt.disabled,yo(c.b7.red),I,G,w,u.debugBuffer,u.tileBorderIndexBuffer,u.debugSegments)}function Lo(u,e,i,s){const{isRenderingGlobe:o}=s,h=u.context,f=h.gl,_=u.transform,x=u.colorModeForRenderPass(),w=u.getDepthModeFor3D(),I=u.useProgram("terrain");h.bindFramebuffer.set(null),h.viewport.set([0,0,u.width,u.height]);for(const z of i){const C=e.getTerrainMesh(z.tileID),F=u.renderToTexture.getTexture(z),N=e.getTerrainData(z.tileID);h.activeTexture.set(f.TEXTURE0),f.bindTexture(f.TEXTURE_2D,F.texture);const q=e.getMeshFrameDelta(_.zoom),G=_.calculateFogMatrix(z.tileID.toUnwrapped()),W=kr(q,G,u.style.sky,_.pitch,o),K=_.getProjectionData({overscaledTileID:z.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});I.draw(h,f.TRIANGLES,w,gt.disabled,x,vt.backCCW,W,N,K,"terrain",C.vertexBuffer,C.indexBuffer,C.segments)}}function Xl(u,e){if(!e.mesh){const i=new c.aF;i.emplaceBack(-1,-1),i.emplaceBack(1,-1),i.emplaceBack(1,1),i.emplaceBack(-1,1);const s=new c.aH;s.emplaceBack(0,1,2),s.emplaceBack(0,2,3),e.mesh=new Hn(u.createVertexBuffer(i,bn.members),u.createIndexBuffer(s),c.aG.simpleSegment(0,0,i.length,s.length))}return e.mesh}class Zu{constructor(e,i){this.context=new Yh(e),this.transform=i,this._tileTextures={},this.terrainFacilitator={dirty:!0,matrix:c.at(new Float64Array(16)),renderTime:0},this.setup(),this.numSublayers=j.maxUnderzooming+j.maxOverzooming+1,this.depthEpsilon=1/Math.pow(2,16),this.crossTileSymbolIndex=new co}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 o of this.style._order)this.style._layers[o].resize()}setup(){const e=this.context,i=new c.aF;i.emplaceBack(0,0),i.emplaceBack(c.Z,0),i.emplaceBack(0,c.Z),i.emplaceBack(c.Z,c.Z),this.tileExtentBuffer=e.createVertexBuffer(i,bn.members),this.tileExtentSegments=c.aG.simpleSegment(0,0,4,2);const s=new c.aF;s.emplaceBack(0,0),s.emplaceBack(c.Z,0),s.emplaceBack(0,c.Z),s.emplaceBack(c.Z,c.Z),this.debugBuffer=e.createVertexBuffer(s,bn.members),this.debugSegments=c.aG.simpleSegment(0,0,4,5);const o=new c.bW;o.emplaceBack(0,0,0,0),o.emplaceBack(c.Z,0,c.Z,0),o.emplaceBack(0,c.Z,0,c.Z),o.emplaceBack(c.Z,c.Z,c.Z,c.Z),this.rasterBoundsBuffer=e.createVertexBuffer(o,El.members),this.rasterBoundsSegments=c.aG.simpleSegment(0,0,4,2);const h=new c.aF;h.emplaceBack(0,0),h.emplaceBack(c.Z,0),h.emplaceBack(0,c.Z),h.emplaceBack(c.Z,c.Z),this.rasterBoundsBufferPosOnly=e.createVertexBuffer(h,bn.members),this.rasterBoundsSegmentsPosOnly=c.aG.simpleSegment(0,0,4,5);const f=new c.aF;f.emplaceBack(0,0),f.emplaceBack(1,0),f.emplaceBack(0,1),f.emplaceBack(1,1),this.viewportBuffer=e.createVertexBuffer(f,bn.members),this.viewportSegments=c.aG.simpleSegment(0,0,4,2);const _=new c.bX;_.emplaceBack(0),_.emplaceBack(1),_.emplaceBack(3),_.emplaceBack(2),_.emplaceBack(0),this.tileBorderIndexBuffer=e.createIndexBuffer(_);const x=new c.aH;x.emplaceBack(1,0,2),x.emplaceBack(1,2,3),this.quadTriangleIndexBuffer=e.createIndexBuffer(x);const w=this.context.gl;this.stencilClearMode=new gt({func:w.ALWAYS,mask:0},0,255,w.ZERO,w.ZERO,w.ZERO),this.tileExtentMesh=new Hn(this.tileExtentBuffer,this.quadTriangleIndexBuffer,this.tileExtentSegments)}clearStencil(){const e=this.context,i=e.gl;this.nextStencilID=1,this.currentStencilSource=void 0;const s=c.K();c.bO(s,0,this.width,this.height,0,0,1),c.M(s,s,[i.drawingBufferWidth,i.drawingBufferHeight,0]);const o={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,ct.disabled,this.stencilClearMode,Lt.disabled,vt.disabled,null,null,o,"$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 o=this.context;o.setColorMode(Lt.disabled),o.setDepthMode(ct.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,o){const h=this.context,f=h.gl,_=this.style.projection,x=this.transform,w=this.useProgram("clippingMask");for(const I of i){const z=e[I.key],C=this.style.map.terrain&&this.style.map.terrain.getTerrainData(I),F=_.getMeshFromTileID(this.context,I.canonical,o,!0,"stencil"),N=x.getProjectionData({overscaledTileID:I,applyGlobeMatrix:!0,applyTerrainMatrix:!0});w.draw(h,f.TRIANGLES,ct.disabled,new gt({func:f.ALWAYS,mask:0},z,255,f.KEEP,f.KEEP,f.REPLACE),Lt.disabled,s?vt.disabled:vt.backCCW,null,C,N,"$clipping",F.vertexBuffer,F.indexBuffer,F.segments)}}_renderTilesDepthBuffer(){const e=this.context,i=e.gl,s=this.style.projection,o=this.transform,h=this.useProgram("depth"),f=this.getDepthModeFor3D(),_=ce(o,{tileSize:o.tileSize});for(const x of _){const w=this.style.map.terrain&&this.style.map.terrain.getTerrainData(x),I=s.getMeshFromTileID(this.context,x.canonical,!0,!0,"raster"),z=o.getProjectionData({overscaledTileID:x,applyGlobeMatrix:!0,applyTerrainMatrix:!0});h.draw(e,i.TRIANGLES,f,gt.disabled,Lt.disabled,vt.backCCW,null,w,z,"$clipping",I.vertexBuffer,I.indexBuffer,I.segments)}}stencilModeFor3D(){this.currentStencilSource=void 0,this.nextStencilID+1>256&&this.clearStencil();const e=this.nextStencilID++,i=this.context.gl;return new gt({func:i.NOTEQUAL,mask:255},e,255,i.KEEP,i.KEEP,i.REPLACE)}stencilModeForClipping(e){const i=this.context.gl;return new gt({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),o=s[s.length-1].overscaledZ,h=s[0].overscaledZ-o+1;if(h>1){this.currentStencilSource=void 0,this.nextStencilID+h>256&&this.clearStencil();const f={};for(let _=0;_<h;_++)f[_+o]=new gt({func:i.GEQUAL,mask:255},_+this.nextStencilID,255,i.KEEP,i.KEEP,i.REPLACE);return this.nextStencilID+=h,[f,s]}return[{[o]:gt.disabled},s]}stencilConfigForOverlapTwoPass(e){const i=this.context.gl,s=e.sort((f,_)=>_.overscaledZ-f.overscaledZ),o=s[s.length-1].overscaledZ,h=s[0].overscaledZ-o+1;if(this.clearStencil(),h>1){const f={},_={};for(let x=0;x<h;x++)f[x+o]=new gt({func:i.GREATER,mask:255},h+1+x,255,i.KEEP,i.KEEP,i.REPLACE),_[x+o]=new gt({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,[{[o]:new gt({func:i.GREATER,mask:255},2,255,i.KEEP,i.KEEP,i.REPLACE)},{[o]:new gt({func:i.GREATER,mask:255},1,255,i.KEEP,i.KEEP,i.REPLACE)},s]}colorModeForRenderPass(){const e=this.context.gl;return this._showOverdrawInspector?new Lt([e.CONSTANT_COLOR,e.ONE],new c.b7(.125,.125,.125,0),[!0,!0,!0,!0]):this.renderPass==="opaque"?Lt.unblended:Lt.alphaBlended}getDepthModeForSublayer(e,i,s){if(!this.opaquePassEnabledForLayer())return ct.disabled;const o=1-((1+this.currentLayer)*this.numSublayers+e)*this.depthEpsilon;return new ct(s||this.context.gl.LEQUAL,i,[o,o])}getDepthModeFor3D(){return new ct(this.context.gl.LEQUAL,ct.ReadWrite,this.depthRangeFor3D)}opaquePassEnabledForLayer(){return this.currentLayer<this.opaquePassCutoff}render(e,i){var s,o;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={},w={},I={isRenderingToTexture:!1,isRenderingGlobe:((s=e.projection)===null||s===void 0?void 0:s.transitionState)>0};for(const C in f){const F=f[C];F.used&&F.prepare(this.context),_[C]=F.getVisibleCoordinates(!1),x[C]=_[C].slice().reverse(),w[C]=F.getVisibleCoordinates(!0).reverse()}this.opaquePassCutoff=1/0;for(let C=0;C<h.length;C++)if(this.style._layers[h[C]].is3D()){this.opaquePassCutoff=C;break}this.maybeDrawDepthAndCoords(!1),this.renderToTexture&&(this.renderToTexture.prepareForRender(this.style,this.transform.zoom),this.opaquePassCutoff=0),this.renderPass="offscreen";for(const C of h){const F=this.style._layers[C];if(!F.hasOffscreenPass()||F.isHidden(this.transform.zoom))continue;const N=x[F.source];(F.type==="custom"||N.length)&&this.renderLayer(this,f[F.source],F,N,I)}if((o=this.style.projection)===null||o===void 0||o.updateGPUdependent({context:this.context,useProgram:C=>this.useProgram(C)}),this.context.viewport.set([0,0,this.width,this.height]),this.context.bindFramebuffer.set(null),this.context.clear({color:i.showOverdrawInspector?c.b7.black:c.b7.transparent,depth:1}),this.clearStencil(),this.style.sky&&function(C,F){const N=C.context,q=N.gl,G=((se,ie,pe)=>{const de=Math.cos(ie.rollInRadians),we=Math.sin(ie.rollInRadians),Se=Ra(ie),ve=ie.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}).projectionTransition;return{u_sky_color:se.properties.get("sky-color"),u_horizon_color:se.properties.get("horizon-color"),u_horizon:[(ie.width/2-Se*we)*pe,(ie.height/2+Se*de)*pe],u_horizon_normal:[-we,de],u_sky_horizon_blend:se.properties.get("sky-horizon-blend")*ie.height/2*pe,u_sky_blend:ve}})(F,C.style.map.transform,C.pixelRatio),W=new ct(q.LEQUAL,ct.ReadWrite,[0,1]),K=gt.disabled,Q=C.colorModeForRenderPass(),ee=C.useProgram("sky"),te=Xl(N,F);ee.draw(N,q.TRIANGLES,W,K,Q,vt.disabled,G,null,void 0,"sky",te.vertexBuffer,te.indexBuffer,te.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 C=this.style._layers[h[this.currentLayer]],F=f[C.source],N=_[C.source];this._renderTileClippingMasks(C,N,!1),this.renderLayer(this,F,C,N,I)}this.renderPass="translucent";let z=!1;for(this.currentLayer=0;this.currentLayer<h.length;this.currentLayer++){const C=this.style._layers[h[this.currentLayer]],F=f[C.source];if(this.renderToTexture&&this.renderToTexture.renderLayer(C,I))continue;this.opaquePassEnabledForLayer()||z||(z=!0,I.isRenderingGlobe&&!this.style.map.terrain&&this._renderTilesDepthBuffer());const N=(C.type==="symbol"?w:x)[C.source];this._renderTileClippingMasks(C,_[C.source],!1),this.renderLayer(this,F,C,N,I)}if(I.isRenderingGlobe&&function(C,F,N){const q=C.context,G=q.gl,W=C.useProgram("atmosphere"),K=new ct(G.LEQUAL,ct.ReadOnly,[0,1]),Q=C.transform,ee=function(ve,Be){const Le=ve.properties.get("position"),Me=[-Le.x,-Le.y,-Le.z],We=c.at(new Float64Array(16));return ve.properties.get("anchor")==="map"&&(c.a_(We,We,Be.rollInRadians),c.a$(We,We,-Be.pitchInRadians),c.a_(We,We,Be.bearingInRadians),c.a$(We,We,Be.center.lat*Math.PI/180),c.bm(We,We,-Be.center.lng*Math.PI/180)),c.bV(Me,Me,We),Me}(N,C.transform),te=Q.getProjectionData({overscaledTileID:null,applyGlobeMatrix:!0,applyTerrainMatrix:!0}),se=F.properties.get("atmosphere-blend")*te.projectionTransition;if(se===0)return;const ie=fo(Q.worldSize,Q.center.lat),pe=Q.inverseProjectionMatrix,de=new Float64Array(4);de[3]=1,c.ap(de,de,Q.modelViewProjectionMatrix),de[0]/=de[3],de[1]/=de[3],de[2]/=de[3],de[3]=1,c.ap(de,de,pe),de[0]/=de[3],de[1]/=de[3],de[2]/=de[3],de[3]=1;const we=((ve,Be,Le,Me,We)=>({u_sun_pos:ve,u_atmosphere_blend:Be,u_globe_position:Le,u_globe_radius:Me,u_inv_proj_matrix:We}))(ee,se,[de[0],de[1],de[2]],ie,pe),Se=Xl(q,F);W.draw(q,G.TRIANGLES,K,gt.disabled,Lt.alphaBlended,vt.disabled,we,null,null,"atmosphere",Se.vertexBuffer,Se.indexBuffer,Se.segments)}(this,this.style.sky,this.style.light),this.options.showTileBoundaries){const C=function(F,N){let q=null;const G=Object.values(F._layers).flatMap(ee=>ee.source&&!ee.isHidden(N)?[F.sourceCaches[ee.source]]:[]),W=G.filter(ee=>ee.getSource().type==="vector"),K=G.filter(ee=>ee.getSource().type!=="vector"),Q=ee=>{(!q||q.getSource().maxzoom<ee.getSource().maxzoom)&&(q=ee)};return W.forEach(ee=>Q(ee)),q||K.forEach(ee=>Q(ee)),q}(this.style,this.transform.zoom);C&&function(F,N,q){for(let G=0;G<q.length;G++)Ls(F,N,q[G])}(this,C,C.getVisibleCoordinates())}this.options.showPadding&&function(C){const F=C.transform.padding;Do(C,C.transform.height-(F.top||0),3,Nu),Do(C,F.bottom||0,3,Jt),Kl(C,F.left||0,3,ta),Kl(C,C.transform.width-(F.right||0),3,or);const N=C.transform.centerPoint;(function(q,G,W,K){Yr(q,G-1,W-10,2,20,K),Yr(q,G-10,W-1,20,2,K)})(C,N.x,C.transform.height-N.y,Hl)}(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 o=this.terrainFacilitator.dirty;o||(o=e?!c.bY(i,s):!c.bZ(i,s)),o||(o=this.style.map.terrain.sourceCache.anyTilesAfterTime(this.terrainFacilitator.renderTime)),o&&(c.b_(i,s),this.terrainFacilitator.renderTime=Date.now(),this.terrainFacilitator.dirty=!1,function(h,f){const _=h.context,x=_.gl,w=h.transform,I=Lt.unblended,z=new ct(x.LEQUAL,ct.ReadWrite,[0,1]),C=f.sourceCache.getRenderableTiles(),F=h.useProgram("terrainDepth");_.bindFramebuffer.set(f.getFramebuffer("depth").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:c.b7.transparent,depth:1});for(const N of C){const q=f.getTerrainMesh(N.tileID),G=f.getTerrainData(N.tileID),W=w.getProjectionData({overscaledTileID:N.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0}),K={u_ele_delta:f.getMeshFrameDelta(w.zoom)};F.draw(_,x.TRIANGLES,z,gt.disabled,I,vt.backCCW,K,G,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,w=h.transform,I=Lt.unblended,z=new ct(x.LEQUAL,ct.ReadWrite,[0,1]),C=f.getCoordsTexture(),F=f.sourceCache.getRenderableTiles(),N=h.useProgram("terrainCoords");_.bindFramebuffer.set(f.getFramebuffer("coords").framebuffer),_.viewport.set([0,0,h.width/devicePixelRatio,h.height/devicePixelRatio]),_.clear({color:c.b7.transparent,depth:1}),f.coordsIndex=[];for(const q of F){const G=f.getTerrainMesh(q.tileID),W=f.getTerrainData(q.tileID);_.activeTexture.set(x.TEXTURE0),x.bindTexture(x.TEXTURE_2D,C.texture);const K={u_terrain_coords_id:(255-f.coordsIndex.length)/255,u_texture:0,u_ele_delta:f.getMeshFrameDelta(w.zoom)},Q=w.getProjectionData({overscaledTileID:q.tileID,applyTerrainMatrix:!1,applyGlobeMatrix:!0});N.draw(_,x.TRIANGLES,z,gt.disabled,I,vt.backCCW,K,W,Q,"terrain",G.vertexBuffer,G.indexBuffer,G.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,o,h){s.isHidden(this.transform.zoom)||(s.type==="background"||s.type==="custom"||(o||[]).length)&&(this.id=s.id,c.b$(s)?function(f,_,x,w,I,z){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:C}=z,F=gt.disabled,N=f.colorModeForRenderPass();(x._unevaluatedLayout.hasValue("text-variable-anchor")||x._unevaluatedLayout.hasValue("text-variable-anchor-offset"))&&function(q,G,W,K,Q,ee,te,se,ie){const pe=G.transform,de=G.style.map.terrain,we=Q==="map",Se=ee==="map";for(const ve of q){const Be=K.getTile(ve),Le=Be.getBucket(W);if(!Le||!Le.text||!Le.text.segments.get().length)continue;const Me=c.ag(Le.textSizeData,pe.zoom),We=c.aw(Be,1,G.transform.zoom),lt=he(we,G.transform,We),Tt=W.layout.get("icon-text-fit")!=="none"&&Le.hasIconData();if(Me){const ut=Math.pow(2,pe.zoom-Be.tileID.overscaledZ),It=de?(At,Bt)=>de.getElevation(ve,At,Bt):null;Ou(Le,we,Se,ie,pe,lt,ut,Me,Tt,c.ax(pe,Be,te,se),ve.toUnwrapped(),It)}}}(w,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"),I),x.paint.get("icon-opacity").constantOr(1)!==0&&Rs(f,_,x,w,!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"),F,N,C),x.paint.get("text-opacity").constantOr(1)!==0&&Rs(f,_,x,w,!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"),F,N,C),_.map.showCollisionBoxes&&(As(f,_,x,w,!0),As(f,_,x,w,!1))}(e,i,s,o,this.style.placement.variableOffsets,h):c.c0(s)?function(f,_,x,w,I){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:z}=I,C=x.paint.get("circle-opacity"),F=x.paint.get("circle-stroke-width"),N=x.paint.get("circle-stroke-opacity"),q=!x.layout.get("circle-sort-key").isConstant();if(C.constantOr(1)===0&&(F.constantOr(1)===0||N.constantOr(1)===0))return;const G=f.context,W=G.gl,K=f.transform,Q=f.getDepthModeForSublayer(0,ct.ReadOnly),ee=gt.disabled,te=f.colorModeForRenderPass(),se=[],ie=K.getCircleRadiusCorrection();for(let pe=0;pe<w.length;pe++){const de=w[pe],we=_.getTile(de),Se=we.getBucket(x);if(!Se)continue;const ve=x.paint.get("circle-translate"),Be=x.paint.get("circle-translate-anchor"),Le=c.ax(K,we,ve,Be),Me=Se.programConfigurations.get(x.id),We=f.useProgram("circle",Me),lt=Se.layoutVertexBuffer,Tt=Se.indexBuffer,ut=f.style.map.terrain&&f.style.map.terrain.getTerrainData(de),It={programConfiguration:Me,program:We,layoutVertexBuffer:lt,indexBuffer:Tt,uniformValues:vu(f,we,x,Le,ie),terrainData:ut,projectionData:K.getProjectionData({overscaledTileID:de,applyGlobeMatrix:!z,applyTerrainMatrix:!0})};if(q){const At=Se.segments.get();for(const Bt of At)se.push({segments:new c.aG([Bt]),sortKey:Bt.sortKey,state:It})}else se.push({segments:Se.segments,sortKey:0,state:It})}q&&se.sort((pe,de)=>pe.sortKey-de.sortKey);for(const pe of se){const{programConfiguration:de,program:we,layoutVertexBuffer:Se,indexBuffer:ve,uniformValues:Be,terrainData:Le,projectionData:Me}=pe.state;we.draw(G,W.TRIANGLES,Q,ee,te,vt.backCCW,Be,Le,Me,x.id,Se,ve,pe.segments,x.paint,f.transform.zoom,de)}}(e,i,s,o,h):c.c1(s)?function(f,_,x,w,I){if(x.paint.get("heatmap-opacity")===0)return;const z=f.context,{isRenderingToTexture:C,isRenderingGlobe:F}=I;if(f.style.map.terrain){for(const N of w){const q=_.getTile(N);_.hasRenderableParent(N)||(f.renderPass==="offscreen"?Jh(f,q,x,N,F):f.renderPass==="translucent"&&ql(f,x,N,C,F))}z.viewport.set([0,0,f.width,f.height])}else f.renderPass==="offscreen"?function(N,q,G,W){const K=N.context,Q=K.gl,ee=N.transform,te=gt.disabled,se=new Lt([Q.ONE,Q.ONE],c.b7.transparent,[!0,!0,!0,!0]);(function(ie,pe,de){const we=ie.gl;ie.activeTexture.set(we.TEXTURE1),ie.viewport.set([0,0,pe.width/4,pe.height/4]);let Se=de.heatmapFbos.get(c.bS);Se?(we.bindTexture(we.TEXTURE_2D,Se.colorAttachment.get()),ie.bindFramebuffer.set(Se.framebuffer)):(Se=ju(ie,pe.width/4,pe.height/4),de.heatmapFbos.set(c.bS,Se))})(K,N,G),K.clear({color:c.b7.transparent});for(let ie=0;ie<W.length;ie++){const pe=W[ie];if(q.hasRenderableParent(pe))continue;const de=q.getTile(pe),we=de.getBucket(G);if(!we)continue;const Se=we.programConfigurations.get(G.id),ve=N.useProgram("heatmap",Se),Be=ee.getProjectionData({overscaledTileID:pe,applyGlobeMatrix:!0,applyTerrainMatrix:!1}),Le=ee.getCircleRadiusCorrection();ve.draw(K,Q.TRIANGLES,ct.disabled,te,se,vt.backCCW,kl(de,ee.zoom,G.paint.get("heatmap-intensity"),Le),null,Be,G.id,we.layoutVertexBuffer,we.indexBuffer,we.segments,G.paint,ee.zoom,Se)}K.viewport.set([0,0,N.width,N.height])}(f,_,x,w):f.renderPass==="translucent"&&function(N,q){const G=N.context,W=G.gl;G.setColorMode(N.colorModeForRenderPass());const K=q.heatmapFbos.get(c.bS);K&&(G.activeTexture.set(W.TEXTURE0),W.bindTexture(W.TEXTURE_2D,K.colorAttachment.get()),G.activeTexture.set(W.TEXTURE1),Wl(G,q).bind(W.LINEAR,W.CLAMP_TO_EDGE),N.useProgram("heatmapTexture").draw(G,W.TRIANGLES,ct.disabled,gt.disabled,N.colorModeForRenderPass(),vt.disabled,Al(N,q,0,1),null,null,q.id,N.viewportBuffer,N.quadTriangleIndexBuffer,N.viewportSegments,q.paint,N.transform.zoom))}(f,x)}(e,i,s,o,h):c.c2(s)?function(f,_,x,w,I){if(f.renderPass!=="translucent")return;const{isRenderingToTexture:z}=I,C=x.paint.get("line-opacity"),F=x.paint.get("line-width");if(C.constantOr(1)===0||F.constantOr(1)===0)return;const N=f.getDepthModeForSublayer(0,ct.ReadOnly),q=f.colorModeForRenderPass(),G=x.paint.get("line-dasharray"),W=x.paint.get("line-pattern"),K=W.constantOr(1),Q=x.paint.get("line-gradient"),ee=x.getCrossfadeParameters(),te=K?"linePattern":G?"lineSDF":Q?"lineGradient":"line",se=f.context,ie=se.gl,pe=f.transform;let de=!0;for(const we of w){const Se=_.getTile(we);if(K&&!Se.patternsLoaded())continue;const ve=Se.getBucket(x);if(!ve)continue;const Be=ve.programConfigurations.get(x.id),Le=f.context.program.get(),Me=f.useProgram(te,Be),We=de||Me.program!==Le,lt=f.style.map.terrain&&f.style.map.terrain.getTerrainData(we),Tt=W.constantOr(null);if(Tt&&Se.imageAtlas){const Mt=Se.imageAtlas,Ct=Mt.patternPositions[Tt.to.toString()],ti=Mt.patternPositions[Tt.from.toString()];Ct&&ti&&Be.setConstantPatternPositions(Ct,ti)}const ut=pe.getProjectionData({overscaledTileID:we,applyGlobeMatrix:!z,applyTerrainMatrix:!0}),It=pe.getPixelScale(),At=K?Cs(f,Se,x,It,ee):G?Uh(f,Se,x,It,G,ee):Q?Pu(f,Se,x,It,ve.lineClipsArray.length):xo(f,Se,x,It);if(K)se.activeTexture.set(ie.TEXTURE0),Se.imageAtlasTexture.bind(ie.LINEAR,ie.CLAMP_TO_EDGE),Be.updatePaintBuffers(ee);else if(G&&(We||f.lineAtlas.dirty))se.activeTexture.set(ie.TEXTURE0),f.lineAtlas.bind(se);else if(Q){const Mt=ve.gradients[x.id];let Ct=Mt.texture;if(x.gradientVersion!==Mt.version){let ti=256;if(x.stepInterpolant){const ui=_.getSource().maxzoom,fi=we.canonical.z===ui?Math.ceil(1<<f.transform.maxZoom-we.canonical.z):1;ti=c.ae(c.bT(ve.maxLineLength/c.Z*1024*fi),256,se.maxTextureSize)}Mt.gradient=c.bU({expression:x.gradientExpression(),evaluationKey:"lineProgress",resolution:ti,image:Mt.gradient||void 0,clips:ve.lineClipsArray}),Mt.texture?Mt.texture.update(Mt.gradient):Mt.texture=new Zt(se,Mt.gradient,ie.RGBA),Mt.version=x.gradientVersion,Ct=Mt.texture}se.activeTexture.set(ie.TEXTURE0),Ct.bind(x.stepInterpolant?ie.NEAREST:ie.LINEAR,ie.CLAMP_TO_EDGE)}let Bt;if(z){const[Mt]=f.getStencilConfigForOverlapAndUpdateStencilID(w);Bt=Mt[we.overscaledZ]}else Bt=f.stencilModeForClipping(we);Me.draw(se,ie.TRIANGLES,N,Bt,q,vt.disabled,At,lt,ut,x.id,ve.layoutVertexBuffer,ve.indexBuffer,ve.segments,x.paint,f.transform.zoom,Be,ve.layoutVertexBuffer2),de=!1}}(e,i,s,o,h):c.c3(s)?function(f,_,x,w,I){const z=x.paint.get("fill-color"),C=x.paint.get("fill-opacity");if(C.constantOr(1)===0)return;const{isRenderingToTexture:F}=I,N=f.colorModeForRenderPass(),q=x.paint.get("fill-pattern"),G=f.opaquePassEnabledForLayer()&&!q.constantOr(1)&&z.constantOr(c.b7.transparent).a===1&&C.constantOr(0)===1?"opaque":"translucent";if(f.renderPass===G){const W=f.getDepthModeForSublayer(1,f.renderPass==="opaque"?ct.ReadWrite:ct.ReadOnly);ko(f,_,x,w,W,N,!1,F)}if(f.renderPass==="translucent"&&x.paint.get("fill-antialias")){const W=f.getDepthModeForSublayer(x.getPaintProperty("fill-outline-color")?2:0,ct.ReadOnly);ko(f,_,x,w,W,N,!0,F)}}(e,i,s,o,h):c.c4(s)?function(f,_,x,w,I){const z=x.paint.get("fill-extrusion-opacity");if(z===0)return;const{isRenderingToTexture:C}=I;if(f.renderPass==="translucent"){const F=new ct(f.context.gl.LEQUAL,ct.ReadWrite,f.depthRangeFor3D);if(z!==1||x.paint.get("fill-extrusion-pattern").constantOr(1))Ao(f,_,x,w,F,gt.disabled,Lt.disabled,C),Ao(f,_,x,w,F,f.stencilModeFor3D(),f.colorModeForRenderPass(),C);else{const N=f.colorModeForRenderPass();Ao(f,_,x,w,F,gt.disabled,N,C)}}}(e,i,s,o,h):c.c5(s)?function(f,_,x,w,I){if(f.renderPass!=="offscreen"&&f.renderPass!=="translucent")return;const{isRenderingToTexture:z}=I,C=f.context,F=f.style.projection.useSubdivision,N=f.getDepthModeForSublayer(0,ct.ReadOnly),q=f.colorModeForRenderPass();if(f.renderPass==="offscreen")(function(G,W,K,Q,ee,te,se){const ie=G.context,pe=ie.gl;for(const de of K){const we=W.getTile(de),Se=we.dem;if(!Se||!Se.data||!we.needsHillshadePrepare)continue;const ve=Se.dim,Be=Se.stride,Le=Se.getPixels();if(ie.activeTexture.set(pe.TEXTURE1),ie.pixelStoreUnpackPremultiplyAlpha.set(!1),we.demTexture=we.demTexture||G.getTileTexture(Be),we.demTexture){const We=we.demTexture;We.update(Le,{premultiply:!1}),We.bind(pe.NEAREST,pe.CLAMP_TO_EDGE)}else we.demTexture=new Zt(ie,Le,pe.RGBA,{premultiply:!1}),we.demTexture.bind(pe.NEAREST,pe.CLAMP_TO_EDGE);ie.activeTexture.set(pe.TEXTURE0);let Me=we.fbo;if(!Me){const We=new Zt(ie,{width:ve,height:ve,data:null},pe.RGBA);We.bind(pe.LINEAR,pe.CLAMP_TO_EDGE),Me=we.fbo=ie.createFramebuffer(ve,ve,!0,!1),Me.colorAttachment.set(We.texture)}ie.bindFramebuffer.set(Me.framebuffer),ie.viewport.set([0,0,ve,ve]),G.useProgram("hillshadePrepare").draw(ie,pe.TRIANGLES,ee,te,se,vt.disabled,Tu(we.tileID,Se),null,null,Q.id,G.rasterBoundsBuffer,G.quadTriangleIndexBuffer,G.rasterBoundsSegments),we.needsHillshadePrepare=!1}})(f,_,w,x,N,gt.disabled,q),C.viewport.set([0,0,f.width,f.height]);else if(f.renderPass==="translucent")if(F){const[G,W,K]=f.stencilConfigForOverlapTwoPass(w);Ro(f,_,x,K,G,N,q,!1,z),Ro(f,_,x,K,W,N,q,!0,z)}else{const[G,W]=f.getStencilConfigForOverlapAndUpdateStencilID(w);Ro(f,_,x,W,G,N,q,!1,z)}}(e,i,s,o,h):c.c6(s)?function(f,_,x,w,I){if(f.renderPass!=="translucent"||x.paint.get("raster-opacity")===0||!w.length)return;const{isRenderingToTexture:z}=I,C=_.getSource(),F=f.style.projection.useSubdivision;if(C instanceof mr)Ha(f,_,x,w,null,!1,!1,C.tileCoords,C.flippedWindingOrder,z);else if(F){const[N,q,G]=f.stencilConfigForOverlapTwoPass(w);Ha(f,_,x,G,N,!1,!0,Wa,!1,z),Ha(f,_,x,G,q,!0,!0,Wa,!1,z)}else{const[N,q]=f.getStencilConfigForOverlapAndUpdateStencilID(w);Ha(f,_,x,q,N,!1,!0,Wa,!1,z)}}(e,i,s,o,h):c.c7(s)?function(f,_,x,w,I){const z=x.paint.get("background-color"),C=x.paint.get("background-opacity");if(C===0)return;const{isRenderingToTexture:F}=I,N=f.context,q=N.gl,G=f.style.projection,W=f.transform,K=W.tileSize,Q=x.paint.get("background-pattern");if(f.isPatternMissing(Q))return;const ee=!Q&&z.a===1&&C===1&&f.opaquePassEnabledForLayer()?"opaque":"translucent";if(f.renderPass!==ee)return;const te=gt.disabled,se=f.getDepthModeForSublayer(0,ee==="opaque"?ct.ReadWrite:ct.ReadOnly),ie=f.colorModeForRenderPass(),pe=f.useProgram(Q?"backgroundPattern":"background"),de=w||ce(W,{tileSize:K,terrain:f.style.map.terrain});Q&&(N.activeTexture.set(q.TEXTURE0),f.imageManager.bind(f.context));const we=x.getCrossfadeParameters();for(const Se of de){const ve=W.getProjectionData({overscaledTileID:Se,applyGlobeMatrix:!F,applyTerrainMatrix:!0}),Be=Q?vo(C,f,Q,{tileID:Se,tileSize:K},we):Iu(C,z),Le=f.style.map.terrain&&f.style.map.terrain.getTerrainData(Se),Me=G.getMeshFromTileID(N,Se.canonical,!1,!0,"raster");pe.draw(N,q.TRIANGLES,se,te,ie,vt.backCCW,Be,Le,ve,x.id,Me.vertexBuffer,Me.indexBuffer,Me.segments)}}(e,0,s,o,h):c.c8(s)&&function(f,_,x,w){const{isRenderingGlobe:I}=w,z=f.context,C=x.implementation,F=f.style.projection,N=f.transform,q=N.getProjectionDataForCustomLayer(I),G={farZ:N.farZ,nearZ:N.nearZ,fov:N.fov*Math.PI/180,modelViewProjectionMatrix:N.modelViewProjectionMatrix,projectionMatrix:N.projectionMatrix,shaderData:{variantName:F.shaderVariantName,vertexShaderPrelude:`const float PI = 3.141592653589793;
727
- uniform mat4 u_projection_matrix;
728
- ${F.shaderPreludeCode.vertexSource}`,define:F.shaderDefine},defaultProjectionData:q},W=C.renderingMode?C.renderingMode:"2d";if(f.renderPass==="offscreen"){const K=C.prerender;K&&(f.setCustomLayerDefaults(),z.setColorMode(f.colorModeForRenderPass()),K.call(C,z.gl,G),z.setDirty(),f.setBaseState())}else if(f.renderPass==="translucent"){f.setCustomLayerDefaults(),z.setColorMode(f.colorModeForRenderPass()),z.setStencilMode(gt.disabled);const K=W==="3d"?f.getDepthModeFor3D():f.getDepthModeForSublayer(0,ct.ReadOnly);z.setDepthMode(K),C.render(z.gl,G),z.setDirty(),f.setBaseState(),z.bindFramebuffer.set(null)}}(e,0,s,h))}saveTileTexture(e){const i=this._tileTextures[e.size[0]];i?i.push(e):this._tileTextures[e.size[0]]=[e]}getTileTexture(e){const i=this._tileTextures[e];return i&&i.length>0?i.pop():null}isPatternMissing(e){if(!e)return!1;if(!e.from||!e.to)return!0;const i=this.imageManager.getPattern(e.from.toString()),s=this.imageManager.getPattern(e.to.toString());return!i||!s}useProgram(e,i,s=!1){this.cache=this.cache||{};const o=!!this.style.map.terrain,h=this.style.projection,f=e+(i?i.cacheKey:"")+`/${s?Aa:h.shaderVariantName}`+(this._showOverdrawInspector?"/overdraw":"")+(o?"/terrain":"");return this.cache[f]||(this.cache[f]=new Is(this.context,_r[e],i,Fl[e],this._showOverdrawInspector,o,s?_r.projectionMercator:h.shaderPreludeCode,s?Kr:h.shaderDefine)),this.cache[f]}setCustomLayerDefaults(){this.context.unbindVAO(),this.context.cullFace.setDefault(),this.context.activeTexture.setDefault(),this.context.pixelStoreUnpack.setDefault(),this.context.pixelStoreUnpackPremultiplyAlpha.setDefault(),this.context.pixelStoreUnpackFlipY.setDefault()}setBaseState(){const e=this.context.gl;this.context.cullFace.set(!1),this.context.viewport.set([0,0,this.width,this.height]),this.context.blendEquation.set(e.FUNC_ADD)}initDebugOverlayCanvas(){this.debugOverlayCanvas==null&&(this.debugOverlayCanvas=document.createElement("canvas"),this.debugOverlayCanvas.width=512,this.debugOverlayCanvas.height=512,this.debugOverlayTexture=new Zt(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 Yl(u,e){let i,s=!1,o=null,h=null;const f=()=>{o=null,s&&(u.apply(h,i),o=setTimeout(f,e),s=!1)};return(..._)=>(s=!0,h=this,i=_,o||f(),o)}class Jl{constructor(e){this._getCurrentHash=()=>{const i=window.location.hash.replace("#","");if(this._hashName){let s;return i.split("&").map(o=>o.split("=")).forEach(o=>{o[0]===this._hashName&&(s=o)}),(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 o=s;o.split("&").length>0&&(o=o.split("&")[0]),this._hashName&&(o=`${this._hashName}=${s}`);let h=window.location.hash.replace(o,"");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=Yl(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,o=Math.ceil((s*Math.LN2+Math.log(512/360/.5))/Math.LN10),h=Math.pow(10,o),f=Math.round(i.lng*h)/h,_=Math.round(i.lat*h)/h,x=this._map.getBearing(),w=this._map.getPitch();let I="";if(I+=e?`/${f}/${_}/${s}`:`${s}/${_}/${f}`,(x||w)&&(I+="/"+Math.round(10*x)/10),w&&(I+=`/${Math.round(w)}`),this._hashName){const z=this._hashName;let C=!1;const F=window.location.hash.slice(1).split("&").map(N=>{const q=N.split("=")[0];return q===z?(C=!0,`${q}=${I}`):N}).filter(N=>N);return C||F.push(`${z}=${I}`),`#${F.join("&")}`}return`#${I}`}_isValidHash(e){if(e.length<3||e.some(isNaN))return!1;try{new c.Q(+e[2],+e[1])}catch{return!1}const i=+e[0],s=+(e[3]||0),o=+(e[4]||0);return i>=this._map.getMinZoom()&&i<=this._map.getMaxZoom()&&s>=-180&&s<=180&&o>=this._map.getMinPitch()&&o<=this._map.getMaxPitch()}}const Ka={linearity:.3,easing:c.c9(0,0,.3,1)},ia=c.e({deceleration:2500,maxSpeed:1400},Ka),Vu=c.e({deceleration:20,maxSpeed:1400},Ka),Uu=c.e({deceleration:1e3,maxSpeed:360},Ka),$u=c.e({deceleration:1e3,maxSpeed:90},Ka),Gu=c.e({deceleration:1e3,maxSpeed:360},Ka);class qu{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 c.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,o={};if(i.pan.mag()){const h=Ya(i.pan.mag(),s,c.e({},ia,e||{})),f=i.pan.mult(h.amount/i.pan.mag()),_=this._map.cameraHelper.handlePanInertia(f,this._map.transform);o.center=_.easingCenter,o.offset=_.easingOffset,Xa(o,h)}if(i.zoom){const h=Ya(i.zoom,s,Vu);o.zoom=this._map.transform.zoom+h.amount,Xa(o,h)}if(i.bearing){const h=Ya(i.bearing,s,Uu);o.bearing=this._map.transform.bearing+c.ae(h.amount,-179,179),Xa(o,h)}if(i.pitch){const h=Ya(i.pitch,s,$u);o.pitch=this._map.transform.pitch+h.amount,Xa(o,h)}if(i.roll){const h=Ya(i.roll,s,Gu);o.roll=this._map.transform.roll+c.ae(h.amount,-179,179),Xa(o,h)}if(o.zoom||o.bearing){const h=i.pinchAround===void 0?i.around:i.pinchAround;o.around=h?this._map.unproject(h):this._map.getCenter()}return this.clear(),c.e(o,{noMoveStart:!0})}}function Xa(u,e){(!u.duration||u.duration<e.duration)&&(u.duration=e.duration,u.easing=e.easing)}function Ya(u,e,i){const{maxSpeed:s,linearity:o,deceleration:h}=i,f=c.ae(u*o/(e/1e3),-s,s),_=Math.abs(f)/(h*o);return{easing:i.easing,duration:1e3*_,amount:f*(_/2)}}class zi extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s,o={}){s=s instanceof MouseEvent?s:new MouseEvent(e,s);const h=le.mousePos(i.getCanvas(),s),f=i.unproject(h);super(e,c.e({point:h,lngLat:f,originalEvent:s},o)),this._defaultPrevented=!1,this.target=i}}class Ja extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){const o=e==="touchend"?s.changedTouches:s.touches,h=le.touchPos(i.getCanvasContainer(),o),f=h.map(x=>i.unproject(x)),_=h.reduce((x,w,I,z)=>x.add(w.div(z.length)),new c.P(0,0));super(e,{points:h,point:_,lngLats:f,lngLat:i.unproject(_),originalEvent:s}),this._defaultPrevented=!1}}class lr extends c.l{preventDefault(){this._defaultPrevented=!0}get defaultPrevented(){return this._defaultPrevented}constructor(e,i,s){super(e,{originalEvent:s}),this._defaultPrevented=!1}}class Rr{constructor(e,i){this._map=e,this._clickTolerance=i.clickTolerance}reset(){delete this._mousedownPos}wheel(e){return this._firePreventable(new lr(e.type,this._map,e))}mousedown(e,i){return this._mousedownPos=i,this._firePreventable(new zi(e.type,this._map,e))}mouseup(e){this._map.fire(new zi(e.type,this._map,e))}click(e,i){this._mousedownPos&&this._mousedownPos.dist(i)>=this._clickTolerance||this._map.fire(new zi(e.type,this._map,e))}dblclick(e){return this._firePreventable(new zi(e.type,this._map,e))}mouseover(e){this._map.fire(new zi(e.type,this._map,e))}mouseout(e){this._map.fire(new zi(e.type,this._map,e))}touchstart(e){return this._firePreventable(new Ja(e.type,this._map,e))}touchmove(e){this._map.fire(new Ja(e.type,this._map,e))}touchend(e){this._map.fire(new Ja(e.type,this._map,e))}touchcancel(e){this._map.fire(new Ja(e.type,this._map,e))}_firePreventable(e){if(this._map.fire(e),e.defaultPrevented)return{}}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Wu{constructor(e){this._map=e}reset(){this._delayContextMenu=!1,this._ignoreContextMenu=!0,delete this._contextMenuEvent}mousemove(e){this._map.fire(new zi(e.type,this._map,e))}mousedown(){this._delayContextMenu=!0,this._ignoreContextMenu=!1}mouseup(){this._delayContextMenu=!1,this._contextMenuEvent&&(this._map.fire(new zi("contextmenu",this._map,this._contextMenuEvent)),delete this._contextMenuEvent)}contextmenu(e){this._delayContextMenu?this._contextMenuEvent=e:this._ignoreContextMenu||this._map.fire(new zi(e.type,this._map,e)),this._map.listens("contextmenu")&&e.preventDefault()}isEnabled(){return!0}isActive(){return!1}enable(){}disable(){}}class Ui{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(c.P.convert(e),this._map.terrain)}}class ra{constructor(e,i){this._map=e,this._tr=new Ui(e),this._el=e.getCanvasContainer(),this._container=e.getContainer(),this._clickTolerance=i.clickTolerance||1}isEnabled(){return!!this._enabled}isActive(){return!!this._active}enable(){this.isEnabled()||(this._enabled=!0)}disable(){this.isEnabled()&&(this._enabled=!1)}mousedown(e,i){this.isEnabled()&&e.shiftKey&&e.button===0&&(le.disableDrag(),this._startPos=this._lastPos=i,this._active=!0)}mousemoveWindow(e,i){if(!this._active)return;const s=i;if(this._lastPos.equals(s)||!this._box&&s.dist(this._startPos)<this._clickTolerance)return;const o=this._startPos;this._lastPos=s,this._box||(this._box=le.create("div","maplibregl-boxzoom",this._container),this._container.classList.add("maplibregl-crosshair"),this._fireEvent("boxzoomstart",e));const h=Math.min(o.x,s.x),f=Math.max(o.x,s.x),_=Math.min(o.y,s.y),x=Math.max(o.y,s.y);le.setTransform(this._box,`translate(${h}px,${_}px)`),this._box.style.width=f-h+"px",this._box.style.height=x-_+"px"}mouseupWindow(e,i){if(!this._active||e.button!==0)return;const s=this._startPos,o=i;if(this.reset(),le.suppressClick(),s.x!==o.x||s.y!==o.y)return this._map.fire(new c.l("boxzoomend",{originalEvent:e})),{cameraAnimation:h=>h.fitScreenCoordinates(s,o,this._tr.bearing,{linear:!0})};this._fireEvent("boxzoomcancel",e)}keydown(e){this._active&&e.keyCode===27&&(this.reset(),this._fireEvent("boxzoomcancel",e))}reset(){this._active=!1,this._container.classList.remove("maplibregl-crosshair"),this._box&&(le.remove(this._box),this._box=null),le.enableDrag(),delete this._startPos,delete this._lastPos}_fireEvent(e,i){return this._map.fire(new c.l(e,{originalEvent:i}))}}function Ql(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 ed{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(o){const h=new c.P(0,0);for(const f of o)h._add(f);return h.div(o.length)}(i),this.touches=Ql(s,i)))}touchmove(e,i,s){if(this.aborted||!this.centroid)return;const o=Ql(s,i);for(const h in this.touches){const f=o[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 o=!this.aborted&&this.centroid;if(this.reset(),o)return o}}}class ec{constructor(e){this.singleTap=new ed(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 o=this.singleTap.touchend(e,i,s);if(o){const h=e.timeStamp-this.lastTime<500,f=!this.lastTap||this.lastTap.dist(o)<30;if(h&&f||this.reset(),this.count++,this.lastTime=e.timeStamp,this.lastTap=o,this.count===this.numTaps)return this.reset(),o}}}class td{constructor(e){this._tr=new Ui(e),this._zoomIn=new ec({numTouches:1,numTaps:2}),this._zoomOut=new ec({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 o=this._zoomIn.touchend(e,i,s),h=this._zoomOut.touchend(e,i,s),f=this._tr;return o?(this._active=!0,e.preventDefault(),setTimeout(()=>this.reset(),0),{cameraAnimation:_=>_.easeTo({duration:300,zoom:f.zoom+1,around:f.unproject(o)},{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 Qa{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 o=Array.isArray(i)?i[0]:i;return!this._moved&&o.dist(s)<this._clickTolerance?void 0:(this._moved=!0,this._lastPoint=o,this._move(s,o))}dragEnd(e){this.isEnabled()&&this._lastPoint&&this._moveStateManager.isValidEndEvent(e)&&(this._moved&&le.suppressClick(),this.reset(e))}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}getClickTolerance(){return this._clickTolerance}}const Fs={0:1,2:2};class Yi{constructor(e){this._correctEvent=e.checkCorrectEvent}startMove(e){const i=le.mouseButton(e);this._eventButton=i}endMove(e){delete this._eventButton}isValidStartEvent(e){return this._correctEvent(e)}isValidMoveEvent(e){return!function(i,s){const o=Fs[s];return i.buttons===void 0||(i.buttons&o)!==o}(e,this._eventButton)}isValidEndEvent(e){return le.mouseButton(e)===this._eventButton}}class Ve{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 Hu{constructor(e=new Yi({checkCorrectEvent:()=>!0}),i=new Ve){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 es=u=>{u.mousedown=u.dragStart,u.mousemoveWindow=u.dragMove,u.mouseup=u.dragEnd,u.contextmenu=e=>{e.preventDefault()}};class Ku{constructor(e,i){this._clickTolerance=e.clickTolerance||1,this._map=i,this.reset()}reset(){this._active=!1,this._touches={},this._sum=new c.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 o=Ql(s,i),h=new c.P(0,0),f=new c.P(0,0);let _=0;for(const w in o){const I=o[w],z=this._touches[w];z&&(h._add(I),f._add(I.sub(z)),_++,o[w]=I)}if(this._touches=o,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 na{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[o,h]=this._firstTwoTouches,f=Pn(s,i,o),_=Pn(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[o,h]=this._firstTwoTouches,f=Pn(s,i,o),_=Pn(s,i,h);f&&_||(this._active&&le.suppressClick(),this.reset())}touchcancel(){this.reset()}enable(e){this._enabled=!0,this._aroundCenter=!!e&&e.around==="center"}disable(){this._enabled=!1,this.reset()}isEnabled(){return!!this._enabled}isActive(){return!!this._active}}function Pn(u,e,i){for(let s=0;s<u.length;s++)if(u[s].identifier===i)return e[s]}function tc(u,e){return Math.log(u/e)/Math.LN2}class pt extends na{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(tc(this._distance,this._startDistance))<.1))return this._active=!0,{zoomDelta:tc(this._distance,s),pinchAround:i}}}function Fo(u,e){return 180*u.angleWith(e)/Math.PI}class Xu extends na{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 o=this._vector;if(this._vector=e[0].sub(e[1]),this._active||!this._isBelowThreshold(this._vector))return this._active=!0,{bearingDelta:Fo(this._vector,o),pinchAround:i}}_isBelowThreshold(e){this._minDiameter=Math.min(this._minDiameter,e.mag());const i=25/(Math.PI*this._minDiameter)*360,s=Fo(e,this._startVector);return Math.abs(s)<i}}function Bs(u){return Math.abs(u.y)>Math.abs(u.x)}class Yu extends na{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,Bs(e[0].sub(e[1]))&&(this._valid=!1)}_move(e,i,s){if(this._map.cooperativeGestures.isEnabled()&&this._currentTouchCount<3)return;const o=e[0].sub(this._lastPoints[0]),h=e[1].sub(this._lastPoints[1]);return this._valid=this.gestureBeginsVertically(o,h,s.timeStamp),this._valid?(this._lastPoints=e,this._active=!0,{pitchDelta:(o.y+h.y)/2*-.5}):void 0}gestureBeginsVertically(e,i,s){if(this._valid!==void 0)return this._valid;const o=e.mag()>=2,h=i.mag()>=2;if(!o&&!h)return;if(!o||!h)return this._firstMove===void 0&&(this._firstMove=s),s-this._firstMove<100&&void 0;const f=e.y>0==i.y>0;return Bs(e)&&Bs(i)&&f}}const id={panStep:100,bearingStep:15,pitchStep:10};class ic{constructor(e){this._tr=new Ui(e);const i=id;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,o=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?o=1:(e.preventDefault(),f=-1);break;case 40:e.shiftKey?o=-1:(e.preventDefault(),f=1);break;default:return}return this._rotationDisabled&&(s=0,o=0),{cameraAnimation:_=>{const x=this._tr;_.easeTo({duration:300,easeId:"keyboardHandler",easing:rc,zoom:i?Math.round(x.zoom)+i*(e.shiftKey?2:1):x.zoom,bearing:x.bearing+s*this._bearingStep,pitch:x.pitch+o*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 rc(u){return u*(2-u)}const nc=4.000244140625;class Ju{constructor(e,i){this._onTimeout=s=>{this._type="wheel",this._delta-=this._lastValue,this._active||this._start(s)},this._map=e,this._tr=new Ui(e),this._triggerRenderFrame=i,this._delta=0,this._defaultZoomRate=.01,this._wheelZoomRate=.0022222222222222222}setZoomRate(e){this._defaultZoomRate=e}setWheelZoomRate(e){this._wheelZoomRate=e}isEnabled(){return!!this._enabled}isActive(){return!!this._active||this._finishTimeout!==void 0}isZooming(){return!!this._zooming}enable(e){this.isEnabled()||(this._enabled=!0,this._aroundCenter=!!e&&e.around==="center")}disable(){this.isEnabled()&&(this._enabled=!1)}_shouldBePrevented(e){return!!this._map.cooperativeGestures.isEnabled()&&!(e.ctrlKey||this._map.cooperativeGestures.isBypassed(e))}wheel(e){if(!this.isEnabled())return;if(this._shouldBePrevented(e))return void this._map.cooperativeGestures.notifyGestureBlocked("wheel_zoom",e);let i=e.deltaMode===WheelEvent.DOM_DELTA_LINE?40*e.deltaY:e.deltaY;const s=Ae.now(),o=s-(this._lastWheelEventTime||0);this._lastWheelEventTime=s,i!==0&&i%nc==0?this._type="wheel":i!==0&&Math.abs(i)<4?this._type="trackpad":o>400?(this._type=null,this._lastValue=i,this._timeout=setTimeout(this._onTimeout,40,e)):this._type||(this._type=Math.abs(o*i)<200?"trackpad":"wheel",this._timeout&&(clearTimeout(this._timeout),this._timeout=null,i+=this._lastValue)),e.shiftKey&&i&&(i/=4),this._type&&(this._lastWheelEvent=e,this._delta-=i,this._active||this._start(e)),e.preventDefault()}_start(e){if(!this._delta)return;this._frameId&&(this._frameId=null),this._active=!0,this.isZooming()||(this._zooming=!0),this._finishTimeout&&(clearTimeout(this._finishTimeout),delete this._finishTimeout);const i=le.mousePos(this._map.getCanvas(),e),s=this._tr;this._aroundPoint=this._aroundCenter?s.transform.locationToScreenPoint(c.Q.convert(s.center)):i,this._frameId||(this._frameId=!0,this._triggerRenderFrame())}renderFrame(){if(!this._frameId||(this._frameId=null,!this.isActive()))return;const e=this._tr.transform;if(typeof this._lastExpectedZoom=="number"){const _=e.zoom-this._lastExpectedZoom;typeof this._startZoom=="number"&&(this._startZoom+=_),typeof this._targetZoom=="number"&&(this._targetZoom+=_)}if(this._delta!==0){const _=this._type==="wheel"&&Math.abs(this._delta)>nc?this._wheelZoomRate:this._defaultZoomRate;let x=2/(1+Math.exp(-Math.abs(this._delta*_)));this._delta<0&&x!==0&&(x=1/x);const w=typeof this._targetZoom!="number"?e.scale:c.aI(this._targetZoom);this._targetZoom=Math.min(e.maxZoom,Math.max(e.minZoom,c.ab(w*x))),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,o=this._easing;let h,f=!1;if(this._type==="wheel"&&s&&o){const _=Ae.now()-this._lastWheelEventTime,x=Math.min((_+5)/200,1),w=o(x);h=c.B.number(s,i,w),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=c.cb;if(this._prevEase){const s=this._prevEase,o=(Ae.now()-s.start)/s.duration,h=s.easing(o+.01)-s.easing(o),f=.27/Math.sqrt(h*h+1e-4)*.01,_=Math.sqrt(.0729-f*f);i=c.c9(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 ac{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 rd{constructor(e){this._tr=new Ui(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 nd{constructor(){this._tap=new ec({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 o=i[0],h=e.timeStamp-this._tapTime<500,f=this._tapPoint.dist(o)<30;h&&f?s.length>0&&(this._swipePoint=o,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 o=i[0],h=o.y-this._swipePoint.y;return this._swipePoint=o,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 o=this._tap.touchend(e,i,s);o&&(this._tapTime=e.timeStamp,this._tapPoint=o)}}touchcancel(){this.reset()}enable(){this._enabled=!0}disable(){this._enabled=!1,this.reset()}isEnabled(){return this._enabled}isActive(){return this._active}}class Jr{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 Ft{constructor(e,i,s,o){this._pitchWithRotate=e.pitchWithRotate,this._rollEnabled=e.rollEnabled,this._mouseRotate=i,this._mousePitch=s,this._mouseRoll=o}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 Os{constructor(e,i,s,o){this._el=e,this._touchZoom=i,this._touchRotate=s,this._tapDragZoom=o,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 Bo{constructor(e,i){this._bypassKey=navigator.userAgent.indexOf("Mac")!==-1?"metaKey":"ctrlKey",this._map=e,this._options=i,this._enabled=!1}isActive(){return!1}reset(){}_setupUI(){if(this._container)return;const e=this._map.getCanvasContainer();e.classList.add("maplibregl-cooperative-gestures"),this._container=le.create("div","maplibregl-cooperative-gesture-screen",e);let i=this._map._getUIString("CooperativeGesturesHandler.WindowsHelpText");this._bypassKey==="metaKey"&&(i=this._map._getUIString("CooperativeGesturesHandler.MacHelpText"));const s=this._map._getUIString("CooperativeGesturesHandler.MobileHelpText"),o=document.createElement("div");o.className="maplibregl-desktop-message",o.textContent=i,this._container.appendChild(o);const h=document.createElement("div");h.className="maplibregl-mobile-message",h.textContent=s,this._container.appendChild(h),this._container.setAttribute("aria-hidden","true")}_destroyUI(){this._container&&(le.remove(this._container),this._map.getCanvasContainer().classList.remove("maplibregl-cooperative-gestures")),delete this._container}enable(){this._setupUI(),this._enabled=!0}disable(){this._enabled=!1,this._destroyUI()}isEnabled(){return this._enabled}isBypassed(e){return e[this._bypassKey]}notifyGestureBlocked(e,i){this._enabled&&(this._map.fire(new c.l("cooperativegestureprevented",{gestureType:e,originalEvent:i})),this._container.classList.add("maplibregl-show"),setTimeout(()=>{this._container.classList.remove("maplibregl-show")},100))}}const js=u=>u.zoom||u.drag||u.roll||u.pitch||u.rotate;class Qu extends c.l{}function Oo(u){return u.panDelta&&u.panDelta.mag()||u.zoomDelta||u.bearingDelta||u.pitchDelta||u.rollDelta}class ad{constructor(e,i){this.handleWindowEvent=o=>{this.handleEvent(o,`${o.type}Window`)},this.handleEvent=(o,h)=>{if(o.type==="blur")return void this.stop(!0);this._updatingCamera=!0;const f=o.type==="renderFrame"?void 0:o,_={needsRenderFrame:!1},x={},w={};for(const{handlerName:C,handler:F,allowed:N}of this._handlers){if(!F.isEnabled())continue;let q;if(this._blockedByActive(w,N,C))F.reset();else if(F[h||o.type]){if(c.cc(o,h||o.type)){const G=le.mousePos(this._map.getCanvas(),o);q=F[h||o.type](o,G)}else if(c.cd(o,h||o.type)){const G=this._getMapTouches(o.touches),W=le.touchPos(this._map.getCanvas(),G);q=F[h||o.type](o,W,G)}else c.ce(h||o.type)||(q=F[h||o.type](o));this.mergeHandlerResult(_,x,q,C,f),q&&q.needsRenderFrame&&this._triggerRenderFrame()}(q||F.isActive())&&(w[C]=F)}const I={};for(const C in this._previousActiveHandlers)w[C]||(I[C]=f);this._previousActiveHandlers=w,(Object.keys(I).length||Oo(_))&&(this._changes.push([_,x,I]),this._triggerRenderFrame()),(Object.keys(w).length||Oo(_))&&this._map._stop(!0),this._updatingCamera=!1;const{cameraAnimation:z}=_;z&&(this._inertia.clear(),this._fireEvents({},{},!0),this._changes=[],z(this._map))},this._map=e,this._el=this._map.getCanvasContainer(),this._handlers=[],this._handlersById={},this._changes=[],this._inertia=new qu(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[o,h,f]of this._listeners)le.addEventListener(o,h,o===document?this.handleWindowEvent:this.handleEvent,f)}destroy(){for(const[e,i,s]of this._listeners)le.removeEventListener(e,i,e===document?this.handleWindowEvent:this.handleEvent,s)}_addDefaultHandlers(e){const i=this._map,s=i.getCanvasContainer();this._add("mapEvent",new Rr(i,e));const o=i.boxZoom=new ra(i,e);this._add("boxZoom",o),e.interactive&&e.boxZoom&&o.enable();const h=i.cooperativeGestures=new Bo(i,e.cooperativeGestures);this._add("cooperativeGestures",h),e.cooperativeGestures&&h.enable();const f=new td(i),_=new rd(i);i.doubleClickZoom=new ac(_,f),this._add("tapZoom",f),this._add("clickZoom",_),e.interactive&&e.doubleClickZoom&&i.doubleClickZoom.enable();const x=new nd;this._add("tapDragZoom",x);const w=i.touchPitch=new Yu(i);this._add("touchPitch",w),e.interactive&&e.touchPitch&&i.touchPitch.enable(e.touchPitch);const I=()=>i.project(i.getCenter()),z=function({enable:ee,clickTolerance:te,aroundCenter:se=!0,minPixelCenterThreshold:ie=100,rotateDegreesPerPixelMoved:pe=.8},de){const we=new Yi({checkCorrectEvent:Se=>le.mouseButton(Se)===0&&Se.ctrlKey||le.mouseButton(Se)===2&&!Se.ctrlKey});return new Qa({clickTolerance:te,move:(Se,ve)=>{const Be=de();if(se&&Math.abs(Be.y-Se.y)>ie)return{bearingDelta:c.ca(new c.P(Se.x,ve.y),ve,Be)};let Le=(ve.x-Se.x)*pe;return se&&ve.y<Be.y&&(Le=-Le),{bearingDelta:Le}},moveStateManager:we,enable:ee,assignEvents:es})}(e,I),C=function({enable:ee,clickTolerance:te,pitchDegreesPerPixelMoved:se=-.5}){const ie=new Yi({checkCorrectEvent:pe=>le.mouseButton(pe)===0&&pe.ctrlKey||le.mouseButton(pe)===2});return new Qa({clickTolerance:te,move:(pe,de)=>({pitchDelta:(de.y-pe.y)*se}),moveStateManager:ie,enable:ee,assignEvents:es})}(e),F=function({enable:ee,clickTolerance:te,rollDegreesPerPixelMoved:se=.3},ie){const pe=new Yi({checkCorrectEvent:de=>le.mouseButton(de)===2&&de.ctrlKey});return new Qa({clickTolerance:te,move:(de,we)=>{const Se=ie();let ve=(we.x-de.x)*se;return we.y<Se.y&&(ve=-ve),{rollDelta:ve}},moveStateManager:pe,enable:ee,assignEvents:es})}(e,I);i.dragRotate=new Ft(e,z,C,F),this._add("mouseRotate",z,["mousePitch"]),this._add("mousePitch",C,["mouseRotate","mouseRoll"]),this._add("mouseRoll",F,["mousePitch"]),e.interactive&&e.dragRotate&&i.dragRotate.enable();const N=function({enable:ee,clickTolerance:te}){const se=new Yi({checkCorrectEvent:ie=>le.mouseButton(ie)===0&&!ie.ctrlKey});return new Qa({clickTolerance:te,move:(ie,pe)=>({around:pe,panDelta:pe.sub(ie)}),activateOnStart:!0,moveStateManager:se,enable:ee,assignEvents:es})}(e),q=new Ku(e,i);i.dragPan=new Jr(s,N,q),this._add("mousePan",N),this._add("touchPan",q,["touchZoom","touchRotate"]),e.interactive&&e.dragPan&&i.dragPan.enable(e.dragPan);const G=new Xu,W=new pt;i.touchZoomRotate=new Os(s,W,G,x),this._add("touchRotate",G,["touchPan","touchZoom"]),this._add("touchZoom",W,["touchPan","touchRotate"]),e.interactive&&e.touchZoomRotate&&i.touchZoomRotate.enable(e.touchZoomRotate);const K=i.scrollZoom=new Ju(i,()=>this._triggerRenderFrame());this._add("scrollZoom",K,["mousePan"]),e.interactive&&e.scrollZoom&&i.scrollZoom.enable(e.scrollZoom);const Q=i.keyboard=new ic(i);this._add("keyboard",Q),e.interactive&&e.keyboard&&i.keyboard.enable(),this._add("blockableMapEvent",new Wu(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!!js(this._eventsInProgress)||this.isZooming()}_blockedByActive(e,i,s){for(const o in e)if(o!==s&&(!i||i.indexOf(o)<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,o,h){if(!s)return;c.e(e,s);const f={handlerName:o,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[o,h,f]of this._changes)o.panDelta&&(e.panDelta=(e.panDelta||new c.P(0,0))._add(o.panDelta)),o.zoomDelta&&(e.zoomDelta=(e.zoomDelta||0)+o.zoomDelta),o.bearingDelta&&(e.bearingDelta=(e.bearingDelta||0)+o.bearingDelta),o.pitchDelta&&(e.pitchDelta=(e.pitchDelta||0)+o.pitchDelta),o.rollDelta&&(e.rollDelta=(e.rollDelta||0)+o.rollDelta),o.around!==void 0&&(e.around=o.around),o.pinchAround!==void 0&&(e.pinchAround=o.pinchAround),o.noInertia&&(e.noInertia=o.noInertia),c.e(i,h),c.e(s,f);this._updateMapTransform(e,i,s),this._changes=[]}_updateMapTransform(e,i,s){const o=this._map,h=o._getTransformForUpdate(),f=o.terrain;if(!(Oo(e)||f&&this._terrainMovement))return this._fireEvents(i,s,!0);o._stop(!0);let{panDelta:_,zoomDelta:x,bearingDelta:w,pitchDelta:I,rollDelta:z,around:C,pinchAround:F}=e;F!==void 0&&(C=F),C=C||o.transform.centerPoint,f&&!h.isPointOnMapSurface(C)&&(C=h.centerPoint);const N={panDelta:_,zoomDelta:x,rollDelta:z,pitchDelta:I,bearingDelta:w,around:C};this._map.cameraHelper.useGlobeControls&&!h.isPointOnMapSurface(C)&&(C=h.centerPoint);const q=C.distSqr(h.centerPoint)<.01?h.center:h.screenPointToLocation(_?C.sub(_):C);f?(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(N,h),this._terrainMovement||!i.drag&&!i.zoom?i.drag&&this._terrainMovement?h.setCenter(h.screenPointToLocation(h.centerPoint.sub(_))):this._map.cameraHelper.handleMapControlsPan(N,h,q):(this._terrainMovement=!0,this._map._elevationFreeze=!0,this._map.cameraHelper.handleMapControlsPan(N,h,q))):(this._map.cameraHelper.handleMapControlsRollPitchBearingZoom(N,h),this._map.cameraHelper.handleMapControlsPan(N,h,q)),o._applyUpdatedTransform(h),this._map._update(),e.noInertia||this._inertia.record(e),this._fireEvents(i,s,!0)}_fireEvents(e,i,s){const o=js(this._eventsInProgress),h=js(e),f={};for(const z in e){const{originalEvent:C}=e[z];this._eventsInProgress[z]||(f[`${z}start`]=C),this._eventsInProgress[z]=e[z]}!o&&h&&this._fireEvent("movestart",h.originalEvent);for(const z in f)this._fireEvent(z,f[z]);h&&this._fireEvent("move",h.originalEvent);for(const z in e){const{originalEvent:C}=e[z];this._fireEvent(z,C)}const _={};let x;for(const z in this._eventsInProgress){const{handlerName:C,originalEvent:F}=this._eventsInProgress[z];this._handlersById[C].isActive()||(delete this._eventsInProgress[z],x=i[C]||F,_[`${z}end`]=x)}for(const z in _)this._fireEvent(z,_[z]);const w=js(this._eventsInProgress),I=(o||h)&&!w;if(I&&this._terrainMovement){this._map._elevationFreeze=!1,this._terrainMovement=!1;const z=this._map._getTransformForUpdate();this._map.getCenterClampedToGround()&&z.recalculateZoomAndCenter(this._map.terrain),this._map._applyUpdatedTransform(z)}if(s&&I){this._updatingCamera=!0;const z=this._inertia._onMoveEnd(this._map.dragPan._inertiaOptions),C=F=>F!==0&&-this._bearingSnap<F&&F<this._bearingSnap;!z||!z.essential&&Ae.prefersReducedMotion?(this._map.fire(new c.l("moveend",{originalEvent:x})),C(this._map.getBearing())&&this._map.resetNorth()):(C(z.bearing||this._map.getBearing())&&(z.bearing=0),z.freezeElevation=!0,this._map.easeTo(z,{originalEvent:x})),this._updatingCamera=!1}}_fireEvent(e,i){this._map.fire(new c.l(e,i?{originalEvent:i}:{}))}_requestFrame(){return this._map.triggerRepaint(),this._map._renderTaskQueue.add(e=>{delete this._frameId,this.handleEvent(new Qu("renderFrame",{timeStamp:e})),this._applyChanges()})}_triggerRenderFrame(){this._frameId===void 0&&(this._frameId=this._requestFrame())}}class Dr extends c.E{constructor(e,i,s){super(),this._renderFrameCallback=()=>{const o=Math.min((Ae.now()-this._easeStart)/this._easeOptions.duration,1);this._onEaseFrame(this._easeOptions.easing(o)),o<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 c.Q(this.transform.center.lng,this.transform.center.lat)}setCenter(e,i){return this.jumpTo({center:e},i)}getCenterElevation(){return this.transform.elevation}setCenterElevation(e,i){return this.jumpTo({elevation:e},i),this}getCenterClampedToGround(){return this._centerClampedToGround}setCenterClampedToGround(e){this._centerClampedToGround=e}panBy(e,i,s){return e=c.P.convert(e).mult(-1),this.panTo(this.transform.center,c.e({offset:e},i),s)}panTo(e,i,s){return this.easeTo(c.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(c.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 c.l("movestart",i)).fire(new c.l("move",i)).fire(new c.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(c.e({bearing:e},i),s)}resetNorth(e,i){return this.rotateTo(0,c.e({duration:1e3},e),i),this}resetNorthPitch(e,i){return this.easeTo(c.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=Yt.convert(e).adjustAntiMeridian();const s=i&&i.bearing||0;return this._cameraForBoxAndBearing(e.getNorthWest(),e.getSouthEast(),s,i)}_cameraForBoxAndBearing(e,i,s,o){const h={top:0,bottom:0,right:0,left:0};if(typeof(o=c.e({padding:h,offset:[0,0],maxZoom:this.transform.maxZoom},o)).padding=="number"){const w=o.padding;o.padding={top:w,bottom:w,right:w,left:w}}const f=c.e(h,o.padding);o.padding=f;const _=this.transform,x=new Yt(e,i);return this.cameraHelper.cameraForBoxAndBearing(o,f,x,s,_)}fitBounds(e,i,s){return this._fitInternal(this.cameraForBounds(e,i),i,s)}fitScreenCoordinates(e,i,s,o,h){return this._fitInternal(this._cameraForBoxAndBearing(this.transform.screenPointToLocation(c.P.convert(e)),this.transform.screenPointToLocation(c.P.convert(i)),s,o),o,h)}_fitInternal(e,i,s){return e?(delete(i=c.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 o=!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&&(o=!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 c.l("movestart",i)).fire(new c.l("move",i)),x&&this.fire(new c.l("zoomstart",i)).fire(new c.l("zoom",i)).fire(new c.l("zoomend",i)),o&&this.fire(new c.l("rotatestart",i)).fire(new c.l("rotate",i)).fire(new c.l("rotateend",i)),h&&this.fire(new c.l("pitchstart",i)).fire(new c.l("pitch",i)).fire(new c.l("pitchend",i)),f&&this.fire(new c.l("rollstart",i)).fire(new c.l("roll",i)).fire(new c.l("rollend",i)),this.fire(new c.l("moveend",i))}calculateCameraOptionsFromTo(e,i,s,o=0){const h=c.$.fromLngLat(e,i),f=c.$.fromLngLat(s,o),_=f.x-h.x,x=f.y-h.y,w=f.z-h.z,I=Math.hypot(_,x,w);if(I===0)throw new Error("Can't calculate camera options with same From and To");const z=Math.hypot(_,x),C=c.ab(this.transform.cameraToCenterDistance/I/this.transform.tileSize),F=180*Math.atan2(_,-x)/Math.PI;let N=180*Math.acos(z/I)/Math.PI;return N=w<0?90-N:90+N,{center:f.toLngLat(),elevation:o,zoom:C,pitch:N,bearing:F}}calculateCameraOptionsFromCameraLngLatAltRotation(e,i,s,o,h){const f=this.transform.calculateCenterFromCameraLngLatAlt(e,i,s,o);return{center:f.center,elevation:f.elevation,zoom:f.zoom,bearing:s,pitch:o,roll:h}}easeTo(e,i){this._stop(!1,e.easeId),((e=c.e({offset:[0,0],duration:500,easing:c.cb},e)).animate===!1||!e.essential&&Ae.prefersReducedMotion)&&(e.duration=0);const s=this._getTransformForUpdate(),o=this.getBearing(),h=s.pitch,f=s.roll,_="bearing"in e?this._normalizeBearing(e.bearing,o):o,x="pitch"in e?+e.pitch:h,w="roll"in e?this._normalizeBearing(e.roll,f):f,I="padding"in e?e.padding:s.padding,z=c.P.convert(e.offset);let C,F;e.around&&(C=c.Q.convert(e.around),F=s.locationToScreenPoint(C));const N={moving:this._moving,zooming:this._zooming,rotating:this._rotating,pitching:this._pitching,rolling:this._rolling},q=this.cameraHelper.handleEaseTo(s,{bearing:_,pitch:x,roll:w,padding:I,around:C,aroundPoint:F,offsetAsPoint:z,offset:e.offset,zoom:e.zoom,center:e.center});return this._rotating=this._rotating||o!==_,this._pitching=this._pitching||x!==h,this._rolling=this._rolling||w!==f,this._padding=!s.isPaddingEqual(I),this._zooming=this._zooming||q.isZooming,this._easeId=e.easeId,this._prepareEase(i,e.noMoveStart,N),this.terrain&&this._prepareElevation(q.elevationCenter),this._ease(G=>{q.easeFunc(G),this.terrain&&!e.freezeElevation&&this._updateElevation(G),this._applyUpdatedTransform(s),this._fireMoveEvents(i)},G=>{this.terrain&&e.freezeElevation&&this._finalizeElevation(),this._afterEase(i,G)},e),this}_prepareEase(e,i,s={}){this._moving=!0,i||s.moving||this.fire(new c.l("movestart",e)),this._zooming&&!s.zooming&&this.fire(new c.l("zoomstart",e)),this._rotating&&!s.rotating&&this.fire(new c.l("rotatestart",e)),this._pitching&&!s.pitching&&this.fire(new c.l("pitchstart",e)),this._rolling&&!s.rolling&&this.fire(new c.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(c.B.number(this._elevationStart,this._elevationTarget,e))}_finalizeElevation(){this._elevationFreeze=!1,this.getCenterClampedToGround()&&this.transform.recalculateZoomAndCenter(this.terrain)}_getTransformForUpdate(){return this.transformCameraUpdate||this.terrain?(this._requestedCameraState||(this._requestedCameraState=this.transform.clone()),this._requestedCameraState):this.transform}_elevateCameraIfInsideTerrain(e){if(!this.terrain&&e.elevation>=0&&e.pitch<=90)return{};const i=e.getCameraLngLat(),s=e.getCameraAltitude(),o=this.terrain?this.terrain.getElevationForLngLatZoom(i,e.zoom):0;if(s<o){const h=this.calculateCameraOptionsFromTo(i,o,e.center,e.elevation);return{pitch:h.pitch,zoom:h.zoom}}return{}}_applyUpdatedTransform(e){const i=[];if(i.push(o=>this._elevateCameraIfInsideTerrain(o)),this.transformCameraUpdate&&i.push(o=>this.transformCameraUpdate(o)),!i.length)return;const s=e.clone();for(const o of i){const h=s.clone(),{center:f,zoom:_,roll:x,pitch:w,bearing:I,elevation:z}=o(h);f&&h.setCenter(f),z!==void 0&&h.setElevation(z),_!==void 0&&h.setZoom(_),x!==void 0&&h.setRoll(x),w!==void 0&&h.setPitch(w),I!==void 0&&h.setBearing(I),s.apply(h)}this.transform.apply(s)}_fireMoveEvents(e){this.fire(new c.l("move",e)),this._zooming&&this.fire(new c.l("zoom",e)),this._rotating&&this.fire(new c.l("rotate",e)),this._pitching&&this.fire(new c.l("pitch",e)),this._rolling&&this.fire(new c.l("roll",e))}_afterEase(e,i){if(this._easeId&&i&&this._easeId===i)return;delete this._easeId;const s=this._zooming,o=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 c.l("zoomend",e)),o&&this.fire(new c.l("rotateend",e)),h&&this.fire(new c.l("pitchend",e)),f&&this.fire(new c.l("rollend",e)),this.fire(new c.l("moveend",e))}flyTo(e,i){if(!e.essential&&Ae.prefersReducedMotion){const ve=c.O(e,["center","zoom","bearing","pitch","roll","elevation"]);return this.jumpTo(ve,i)}this.stop(),e=c.e({offset:[0,0],speed:1.2,curve:1.42,easing:c.cb},e);const s=this._getTransformForUpdate(),o=s.bearing,h=s.pitch,f=s.roll,_=s.padding,x="bearing"in e?this._normalizeBearing(e.bearing,o):o,w="pitch"in e?+e.pitch:h,I="roll"in e?this._normalizeBearing(e.roll,f):f,z="padding"in e?e.padding:s.padding,C=c.P.convert(e.offset);let F=s.centerPoint.add(C);const N=s.screenPointToLocation(F),q=this.cameraHelper.handleFlyTo(s,{bearing:x,pitch:w,roll:I,padding:z,locationAtOffset:N,offsetAsPoint:C,center:e.center,minZoom:e.minZoom,zoom:e.zoom});let G=e.curve;const W=Math.max(s.width,s.height),K=W/q.scaleOfZoom,Q=q.pixelPathLength;typeof q.scaleOfMinZoom=="number"&&(G=Math.sqrt(W/q.scaleOfMinZoom/Q*2));const ee=G*G;function te(ve){const Be=(K*K-W*W+(ve?-1:1)*ee*ee*Q*Q)/(2*(ve?K:W)*ee*Q);return Math.log(Math.sqrt(Be*Be+1)-Be)}function se(ve){return(Math.exp(ve)-Math.exp(-ve))/2}function ie(ve){return(Math.exp(ve)+Math.exp(-ve))/2}const pe=te(!1);let de=function(ve){return ie(pe)/ie(pe+G*ve)},we=function(ve){return W*((ie(pe)*(se(Be=pe+G*ve)/ie(Be))-se(pe))/ee)/Q;var Be},Se=(te(!0)-pe)/G;if(Math.abs(Q)<2e-6||!isFinite(Se)){if(Math.abs(W-K)<1e-6)return this.easeTo(e,i);const ve=K<W?-1:1;Se=Math.abs(Math.log(K/W))/G,we=()=>0,de=Be=>Math.exp(ve*G*Be)}return e.duration="duration"in e?+e.duration:1e3*Se/("screenSpeed"in e?+e.screenSpeed/G:+e.speed),e.maxDuration&&e.duration>e.maxDuration&&(e.duration=0),this._zooming=!0,this._rotating=o!==x,this._pitching=w!==h,this._rolling=I!==f,this._padding=!s.isPaddingEqual(z),this._prepareEase(i,!1),this.terrain&&this._prepareElevation(q.targetCenter),this._ease(ve=>{const Be=ve*Se,Le=1/de(Be),Me=we(Be);this._rotating&&s.setBearing(c.B.number(o,x,ve)),this._pitching&&s.setPitch(c.B.number(h,w,ve)),this._rolling&&s.setRoll(c.B.number(f,I,ve)),this._padding&&(s.interpolatePadding(_,z,ve),F=s.centerPoint.add(C)),q.easeFunc(ve,Le,Me,F),this.terrain&&!e.freezeElevation&&this._updateElevation(ve),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 o=this._onEaseEnd;delete this._onEaseEnd,o.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=c.aL(e,-180,180);const s=Math.abs(e-i);return Math.abs(e-360-i)<s&&(e-=360),Math.abs(e+360-i)<s&&(e+=360),e}queryTerrainElevation(e){return this.terrain?this.terrain.getElevationForLngLatZoom(c.Q.convert(e),this.transform.tileZoom):null}}const Ns={compact:!0,customAttribution:'<a href="https://maplibre.org/" target="_blank">MapLibre</a>'};class Xe{constructor(e=Ns){this._toggleAttribution=()=>{this._container.classList.contains("maplibregl-compact")&&(this._container.classList.contains("maplibregl-compact-show")?(this._container.setAttribute("open",""),this._container.classList.remove("maplibregl-compact-show")):(this._container.classList.add("maplibregl-compact-show"),this._container.removeAttribute("open")))},this._updateData=i=>{!i||i.sourceDataType!=="metadata"&&i.sourceDataType!=="visibility"&&i.dataType!=="style"&&i.type!=="terrain"||this._updateAttributions()},this._updateCompact=()=>{this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact===!1?this._container.setAttribute("open",""):this._container.classList.contains("maplibregl-compact")||this._container.classList.contains("maplibregl-attrib-empty")||(this._container.setAttribute("open",""),this._container.classList.add("maplibregl-compact","maplibregl-compact-show")):(this._container.setAttribute("open",""),this._container.classList.contains("maplibregl-compact")&&this._container.classList.remove("maplibregl-compact","maplibregl-compact-show"))},this._updateCompactMinimize=()=>{this._container.classList.contains("maplibregl-compact")&&this._container.classList.contains("maplibregl-compact-show")&&this._container.classList.remove("maplibregl-compact-show")},this.options=e}getDefaultPosition(){return"bottom-right"}onAdd(e){return this._map=e,this._compact=this.options.compact,this._container=le.create("details","maplibregl-ctrl maplibregl-ctrl-attrib"),this._compactButton=le.create("summary","maplibregl-ctrl-attrib-button",this._container),this._compactButton.addEventListener("click",this._toggleAttribution),this._setElementTitle(this._compactButton,"ToggleAttribution"),this._innerContainer=le.create("div","maplibregl-ctrl-attrib-inner",this._container),this._updateAttributions(),this._updateCompact(),this._map.on("styledata",this._updateData),this._map.on("sourcedata",this._updateData),this._map.on("terrain",this._updateData),this._map.on("resize",this._updateCompact),this._map.on("drag",this._updateCompactMinimize),this._container}onRemove(){le.remove(this._container),this._map.off("styledata",this._updateData),this._map.off("sourcedata",this._updateData),this._map.off("terrain",this._updateData),this._map.off("resize",this._updateCompact),this._map.off("drag",this._updateCompactMinimize),this._map=void 0,this._compact=void 0,this._attribHTML=void 0}_setElementTitle(e,i){const s=this._map._getUIString(`AttributionControl.${i}`);e.title=s,e.setAttribute("aria-label",s)}_updateAttributions(){if(!this._map.style)return;let e=[];if(this.options.customAttribution&&(Array.isArray(this.options.customAttribution)?e=e.concat(this.options.customAttribution.map(o=>typeof o!="string"?"":o)):typeof this.options.customAttribution=="string"&&e.push(this.options.customAttribution)),this._map.style.stylesheet){const o=this._map.style.stylesheet;this.styleOwner=o.owner,this.styleId=o.id}const i=this._map.style.sourceCaches;for(const o in i){const h=i[o];if(h.used||h.usedForTerrain){const f=h.getSource();f.attribution&&e.indexOf(f.attribution)<0&&e.push(f.attribution)}}e=e.filter(o=>String(o).trim()),e.sort((o,h)=>o.length-h.length),e=e.filter((o,h)=>{for(let f=h+1;f<e.length;f++)if(e[f].indexOf(o)>=0)return!1;return!0});const s=e.join(" | ");s!==this._attribHTML&&(this._attribHTML=s,e.length?(this._innerContainer.innerHTML=le.sanitize(s),this._container.classList.remove("maplibregl-attrib-empty")):this._container.classList.add("maplibregl-attrib-empty"),this._updateCompact(),this._editLink=null)}}class tt{constructor(e={}){this._updateCompact=()=>{const i=this._container.children;if(i.length){const s=i[0];this._map.getCanvasContainer().offsetWidth<=640||this._compact?this._compact!==!1&&s.classList.add("maplibregl-compact"):s.classList.remove("maplibregl-compact")}},this.options=e}getDefaultPosition(){return"bottom-left"}onAdd(e){this._map=e,this._compact=this.options&&this.options.compact,this._container=le.create("div","maplibregl-ctrl");const i=le.create("a","maplibregl-ctrl-logo");return i.target="_blank",i.rel="noopener nofollow",i.href="https://maplibre.org/",i.setAttribute("aria-label",this._map._getUIString("LogoControl.Title")),i.setAttribute("rel","noopener nofollow"),this._container.appendChild(i),this._container.style.display="block",this._map.on("resize",this._updateCompact),this._updateCompact(),this._container}onRemove(){le.remove(this._container),this._map.off("resize",this._updateCompact),this._map=void 0,this._compact=void 0}}class jo{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 o of s)if(o.id===e)return void(o.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 sc=c.aD([{name:"a_pos3d",type:"Int16",components:3}]);class oc extends c.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 o of ce(e,{tileSize:this.tileSize,minzoom:this.minzoom,maxzoom:this.maxzoom,reparseOverscaled:!1,terrain:i,calculateTileZoom:this.sourceCache._source.calculateTileZoom}))s[o.key]=!0,this._renderableTilesKeys.push(o.key),this._tiles[o.key]||(o.terrainRttPosMatrix32f=new Float64Array(16),c.bO(o.terrainRttPosMatrix32f,0,c.Z,c.Z,0,0,1),this._tiles[o.key]=new Er(o,this.tileSize),this._lastTilesetChange=Ae.now());for(const o in this._tiles)s[o]||delete this._tiles[o]}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 o=this._tiles[s].tileID,h=e.clone(),f=c.b2();if(o.canonical.equals(e.canonical))c.bO(f,0,c.Z,c.Z,0,0,1);else if(o.canonical.isChildOf(e.canonical)){const _=o.canonical.z-e.canonical.z,x=o.canonical.x-(o.canonical.x>>_<<_),w=o.canonical.y-(o.canonical.y>>_<<_),I=c.Z>>_;c.bO(f,0,I,I,0,0,1),c.L(f,f,[-x*I,-w*I,0])}else{if(!e.canonical.isChildOf(o.canonical))continue;{const _=e.canonical.z-o.canonical.z,x=e.canonical.x-(e.canonical.x>>_<<_),w=e.canonical.y-(e.canonical.y>>_<<_),I=c.Z>>_;c.bO(f,0,c.Z,c.Z,0,0,1),c.L(f,f,[x*I,w*I,0]),c.M(f,f,[1/2**_,1/2**_,0])}}h.terrainRttPosMatrix32f=new Float32Array(f),i[s]=h}return i}_getTerrainCoordsForTileRanges(e,i){const s={};for(const o of this._renderableTilesKeys){const h=this._tiles[o].tileID;if(!this._isWithinTileRanges(h,i))continue;const f=e.clone(),_=c.b2();if(h.canonical.z===e.canonical.z){const x=e.canonical.x-h.canonical.x,w=e.canonical.y-h.canonical.y;c.bO(_,0,c.Z,c.Z,0,0,1),c.L(_,_,[x*c.Z,w*c.Z,0])}else if(h.canonical.z>e.canonical.z){const x=h.canonical.z-e.canonical.z,w=h.canonical.x-(h.canonical.x>>x<<x),I=h.canonical.y-(h.canonical.y>>x<<x),z=e.canonical.x-(h.canonical.x>>x),C=e.canonical.y-(h.canonical.y>>x),F=c.Z>>x;c.bO(_,0,F,F,0,0,1),c.L(_,_,[-w*F+z*c.Z,-I*F+C*c.Z,0])}else{const x=e.canonical.z-h.canonical.z,w=e.canonical.x-(e.canonical.x>>x<<x),I=e.canonical.y-(e.canonical.y>>x<<x),z=(e.canonical.x>>x)-h.canonical.x,C=(e.canonical.y>>x)-h.canonical.y,F=c.Z<<x;c.bO(_,0,F,F,0,0,1),c.L(_,_,[w*c.Z+z*F,I*c.Z+C*F,0])}f.terrainRttPosMatrix32f=new Float32Array(_),s[o]=f}return s}getSourceTile(e,i){const s=this.sourceCache._source;let o=e.overscaledZ-this.deltaZoom;if(o>s.maxzoom&&(o=s.maxzoom),o<s.minzoom)return null;this._sourceTileCache[e.key]||(this._sourceTileCache[e.key]=e.scaledTo(o).key);let h=this.sourceCache.getTileByID(this._sourceTileCache[e.key]);if((!h||!h.dem)&&i)for(;o>=s.minzoom&&(!h||!h.dem);)h=this.sourceCache.getTileByID(e.scaledTo(o--).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 $i{constructor(e,i,s){this._meshCache={},this.painter=e,this.sourceCache=new oc(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,o=c.Z){var h;if(!(i>=0&&i<o&&s>=0&&s<o))return 0;const f=this.getTerrainData(e),_=(h=f.tile)===null||h===void 0?void 0:h.dem;if(!_)return 0;const x=c.cf([],[i/o*c.Z,s/o*c.Z],f.u_terrain_matrix),w=[x[0]*_.dim,x[1]*_.dim],I=Math.floor(w[0]),z=Math.floor(w[1]),C=w[0]-I,F=w[1]-z;return _.get(I,z)*(1-C)*(1-F)+_.get(I+1,z)*C*(1-F)+_.get(I,z+1)*(1-C)*F+_.get(I+1,z+1)*C*F}getElevationForLngLatZoom(e,i){if(!c.cg(i,e.wrap()))return 0;const{tileID:s,mercatorX:o,mercatorY:h}=this._getOverscaledTileIDFromLngLatZoom(e,i);return this.getElevation(s,o%c.Z,h%c.Z,c.Z)}getElevation(e,i,s,o=c.Z){return this.getDEMElevation(e,i,s,o)*this.exaggeration}getTerrainData(e){if(!this._emptyDemTexture){const o=this.painter.context,h=new c.R({width:1,height:1},new Uint8Array(4));this._emptyDepthTexture=new Zt(o,h,o.gl.RGBA,{premultiply:!1}),this._emptyDemUnpack=[0,0,0,0],this._emptyDemTexture=new Zt(o,new c.R({width:1,height:1}),o.gl.RGBA,{premultiply:!1}),this._emptyDemTexture.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),this._emptyDemMatrix=c.at([])}const i=this.sourceCache.getSourceTile(e,!0);if(i&&i.dem&&(!i.demTexture||i.needsTerrainPrepare)){const o=this.painter.context;i.demTexture=this.painter.getTileTexture(i.dem.stride),i.demTexture?i.demTexture.update(i.dem.getPixels(),{premultiply:!1}):i.demTexture=new Zt(o,i.dem.getPixels(),o.gl.RGBA,{premultiply:!1}),i.demTexture.bind(o.gl.NEAREST,o.gl.CLAMP_TO_EDGE),i.needsTerrainPrepare=!1}const s=i&&i+i.tileID.key+e.key;if(s&&!this._demMatrixCache[s]){const o=this.sourceCache.sourceCache._source.maxzoom;let h=e.canonical.z-i.tileID.canonical.z;e.overscaledZ>e.canonical.z&&(e.canonical.z>=o?h=e.canonical.z-o:c.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=c.ch(new Float64Array(16),[1/(c.Z<<h),1/(c.Z<<h),0]);c.L(x,x,[f*c.Z,_*c.Z,0]),this._demMatrixCache[e.key]={matrix:x,coord:e}}return{u_depth:2,u_terrain:3,u_terrain_dim:i&&i.dem&&i.dem.dim||1,u_terrain_matrix:s?this._demMatrixCache[e.key].matrix:this._emptyDemMatrix,u_terrain_unpack:i&&i.dem&&i.dem.getUnpackVector()||this._emptyDemUnpack,u_terrain_exaggeration:this.exaggeration,texture:(i&&i.demTexture||this._emptyDemTexture).texture,depthTexture:(this._fboDepthTexture||this._emptyDepthTexture).texture,tile:i}}getFramebuffer(e){const i=this.painter,s=i.width/devicePixelRatio,o=i.height/devicePixelRatio;return!this._fbo||this._fbo.width===s&&this._fbo.height===o||(this._fbo.destroy(),this._fboCoordsTexture.destroy(),this._fboDepthTexture.destroy(),delete this._fbo,delete this._fboDepthTexture,delete this._fboCoordsTexture),this._fboCoordsTexture||(this._fboCoordsTexture=new Zt(i.context,{width:s,height:o,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 Zt(i.context,{width:s,height:o,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,o,!0,!1),this._fbo.depthAttachment.set(i.context.createRenderbuffer(i.context.gl.DEPTH_COMPONENT16,s,o))),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 c.R({width:this._coordsTextureSize,height:this._coordsTextureSize},new Uint8Array(i.buffer)),o=new Zt(e,s,e.gl.RGBA,{premultiply:!1});return o.bind(e.gl.NEAREST,e.gl.CLAMP_TO_EDGE),this._coordsTexture=o,o}pointCoordinate(e){this.painter.maybeDrawDepthAndCoords(!0);const i=new Uint8Array(4),s=this.painter.context,o=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),o.readPixels(h,_-f-1,1,1,o.RGBA,o.UNSIGNED_BYTE,i),s.bindFramebuffer.set(null);const x=i[0]+(i[2]>>4<<8),w=i[1]+((15&i[2])<<8),I=this.coordsIndex[255-i[3]],z=I&&this.sourceCache.getTileByID(I);if(!z)return null;const C=this._coordsTextureSize,F=(1<<z.tileID.canonical.z)*C;return new c.$((z.tileID.canonical.x*C+x)/F+z.tileID.wrap,(z.tileID.canonical.y*C+w)/F,this.getElevation(z.tileID,x,w,C))}depthAtPoint(e){const i=new Uint8Array(4),s=this.painter.context,o=s.gl;return s.bindFramebuffer.set(this.getFramebuffer("depth").framebuffer),o.readPixels(e.x,this.painter.height/devicePixelRatio-e.y-1,1,1,o.RGBA,o.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,o=s&&e.canonical.y===0,h=s&&e.canonical.y===(1<<e.canonical.z)-1,f=`m_${o?"n":""}_${h?"s":""}`;if(this._meshCache[f])return this._meshCache[f];const _=this.painter.context,x=new c.ci,w=new c.aH,I=this.meshSize,z=c.Z/I,C=I*I;for(let ie=0;ie<=I;ie++)for(let pe=0;pe<=I;pe++)x.emplaceBack(pe*z,ie*z,0);for(let ie=0;ie<C;ie+=I+1)for(let pe=0;pe<I;pe++)w.emplaceBack(pe+ie,I+pe+ie+1,I+pe+ie+2),w.emplaceBack(pe+ie,I+pe+ie+2,pe+ie+1);const F=x.length,N=F+(I+1),q=(I+1)*I,G=o?c.b9:0,W=o?0:1,K=h?c.ba:c.Z,Q=h?0:1;for(let ie=0;ie<=I;ie++)x.emplaceBack(ie*z,G,W);for(let ie=0;ie<=I;ie++)x.emplaceBack(ie*z,K,Q);for(let ie=0;ie<I;ie++)w.emplaceBack(q+ie,N+ie,N+ie+1),w.emplaceBack(q+ie,N+ie+1,q+ie+1),w.emplaceBack(0+ie,F+ie+1,F+ie),w.emplaceBack(0+ie,0+ie+1,F+ie+1);const ee=x.length,te=ee+2*(I+1);for(const ie of[0,1])for(let pe=0;pe<=I;pe++)for(const de of[0,1])x.emplaceBack(ie*c.Z,pe*z,de);for(let ie=0;ie<2*I;ie+=2)w.emplaceBack(ee+ie,ee+ie+1,ee+ie+3),w.emplaceBack(ee+ie,ee+ie+3,ee+ie+2),w.emplaceBack(te+ie,te+ie+3,te+ie+1),w.emplaceBack(te+ie,te+ie+2,te+ie+3);const se=new Hn(_.createVertexBuffer(x,sc.members),_.createIndexBuffer(w),c.aG.simpleSegment(0,0,x.length,w.length));return this._meshCache[f]=se,se}getMeshFrameDelta(e){return 2*Math.PI*c.br/Math.pow(2,Math.max(e,0))/5}getMinTileElevationForLngLatZoom(e,i){var s;const{tileID:o}=this._getOverscaledTileIDFromLngLatZoom(e,i);return(s=this.getMinMaxElevation(o).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=c.$.fromLngLat(e.wrap()),o=(1<<i)*c.Z,h=s.x*o,f=s.y*o,_=Math.floor(h/c.Z),x=Math.floor(f/c.Z);return{tileID:new c.Y(i,0,i,_,x),mercatorX:h,mercatorY:f}}}class eh{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 Zt(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 Fi={background:!0,fill:!0,line:!0,raster:!0,hillshade:!0};class sd{constructor(e,i){this.painter=e,this.terrain=i,this.pool=new eh(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 o=e.sourceCaches[s].getVisibleCoordinates(),h=e.sourceCaches[s].getSource(),f=h instanceof mr?h.terrainTileRanges:null;for(const _ of o){const x=this.terrain.sourceCache.getTerrainCoords(_,f);for(const w in x)this._coordsAscending[s][w]||(this._coordsAscending[s][w]=[]),this._coordsAscending[s][w].push(x[w])}}this._coordsAscendingStr={};for(const s of e._order){const o=e._layers[s],h=o.source;if(Fi[o.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 o in this._coordsAscendingStr){const h=this._coordsAscendingStr[o][s.tileID.key];h&&h!==s.rttCoords[o]&&(s.rtt=[])}}renderLayer(e,i){if(e.isHidden(this.painter.transform.zoom))return!1;const s=Object.assign(Object.assign({},i),{isRenderingToTexture:!0}),o=e.type,h=this.painter,f=this._renderableLayerIds[this._renderableLayerIds.length-1]===e.id;if(Fi[o]&&(this._prevType&&Fi[this._prevType]||this._stacks.push([]),this._prevType=o,this._stacks[this._stacks.length-1].push(e.id),!f))return!0;if(Fi[this._prevType]||Fi[o]&&f){this._prevType=o;const _=this._stacks.length-1,x=this._stacks[_]||[];for(const w of this._renderableTiles){if(this.pool.isFull()&&(Lo(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects()),this._rttTiles.push(w),w.rtt[_]){const z=this.pool.getObjectForId(w.rtt[_].id);if(z.stamp===w.rtt[_].stamp){this.pool.useObject(z);continue}}const I=this.pool.getOrCreateFreeObject();this.pool.useObject(I),this.pool.stampObject(I),w.rtt[_]={id:I.id,stamp:I.stamp},h.context.bindFramebuffer.set(I.fbo.framebuffer),h.context.clear({color:c.b7.transparent,stencil:0}),h.currentStencilSource=void 0;for(let z=0;z<x.length;z++){const C=h.style._layers[x[z]],F=C.source?this._coordsAscending[C.source][w.tileID.key]:[w.tileID];h.context.viewport.set([0,0,I.fbo.width,I.fbo.height]),h._renderTileClippingMasks(C,F,!0),h.renderLayer(h,h.style.sourceCaches[C.source],C,F,s),C.source&&(w.rttCoords[C.source]=this._coordsAscendingStr[C.source][w.tileID.key])}}return Lo(this.painter,this.terrain,this._rttTiles,s),this._rttTiles=[],this.pool.freeAllObjects(),Fi[o]}return!1}}const Zs={"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"},Gt=Te,Qt={hash:!1,interactive:!0,bearingSnap:7,attributionControl:Ns,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:c.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},th={showCompass:!0,showZoom:!0,visualizePitch:!1,visualizeRoll:!0};class Vs{constructor(e,i,s=!1){this.mousedown=h=>{this.startMove(h,le.mousePos(this.element,h)),le.addEventListener(window,"mousemove",this.mousemove),le.addEventListener(window,"mouseup",this.mouseup)},this.mousemove=h=>{this.move(h,le.mousePos(this.element,h))},this.mouseup=h=>{this._rotatePitchHanlder.dragEnd(h),this.offTemp()},this.touchstart=h=>{h.targetTouches.length!==1?this.reset():(this._startPos=this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.startMove(h,this._startPos),le.addEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.addEventListener(window,"touchend",this.touchend))},this.touchmove=h=>{h.targetTouches.length!==1?this.reset():(this._lastPos=le.touchPos(this.element,h.targetTouches)[0],this.move(h,this._lastPos))},this.touchend=h=>{h.targetTouches.length===0&&this._startPos&&this._lastPos&&this._startPos.dist(this._lastPos)<this._clickTolerance&&this.element.click(),delete this._startPos,delete this._lastPos,this.offTemp()},this.reset=()=>{this._rotatePitchHanlder.reset(),delete this._startPos,delete this._lastPos,this.offTemp()},this._clickTolerance=10,this.element=i;const o=new Hu;this._rotatePitchHanlder=new Qa({clickTolerance:3,move:(h,f)=>{const _=i.getBoundingClientRect(),x=new c.P((_.bottom-_.top)/2,(_.right-_.left)/2);return{bearingDelta:c.ca(new c.P(h.x,f.y),f,x),pitchDelta:s?-.5*(f.y-h.y):void 0}},moveStateManager:o,enable:!0,assignEvents:()=>{}}),this.map=e,le.addEventListener(i,"mousedown",this.mousedown),le.addEventListener(i,"touchstart",this.touchstart,{passive:!1}),le.addEventListener(i,"touchcancel",this.reset)}startMove(e,i){this._rotatePitchHanlder.dragStart(e,i),le.disableDrag()}move(e,i){const s=this.map,{bearingDelta:o,pitchDelta:h}=this._rotatePitchHanlder.dragMove(e,i)||{};o&&s.setBearing(s.getBearing()+o),h&&s.setPitch(s.getPitch()+h)}off(){const e=this.element;le.removeEventListener(e,"mousedown",this.mousedown),le.removeEventListener(e,"touchstart",this.touchstart,{passive:!1}),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend),le.removeEventListener(e,"touchcancel",this.reset),this.offTemp()}offTemp(){le.enableDrag(),le.removeEventListener(window,"mousemove",this.mousemove),le.removeEventListener(window,"mouseup",this.mouseup),le.removeEventListener(window,"touchmove",this.touchmove,{passive:!1}),le.removeEventListener(window,"touchend",this.touchend)}}let Lr;function No(u,e,i){const s=new c.Q(u.lng,u.lat);if(u=new c.Q(u.lng,u.lat),e){const o=new c.Q(u.lng-360,u.lat),h=new c.Q(u.lng+360,u.lat),f=i.locationToScreenPoint(u).distSqr(e);i.locationToScreenPoint(o).distSqr(e)<f?u=o:i.locationToScreenPoint(h).distSqr(e)<f&&(u=h)}for(;Math.abs(u.lng-i.center.lng)>180;){const o=i.locationToScreenPoint(u);if(o.x>=0&&o.y>=0&&o.x<=i.width&&o.y<=i.height)break;u.lng>i.center.lng?u.lng-=360:u.lng+=360}return u.lng!==s.lng&&i.isPointOnMapSurface(i.locationToScreenPoint(u))?u:s}const Us={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 Zo(u,e,i){const s=u.classList;for(const o in Us)s.remove(`maplibregl-${i}-anchor-${o}`);s.add(`maplibregl-${i}-anchor-${e}`)}class aa extends c.E{constructor(e){if(super(),this._onKeyPress=i=>{const s=i.code,o=i.charCode||i.keyCode;s!=="Space"&&s!=="Enter"&&o!==32&&o!==13||this.togglePopup()},this._onMapClick=i=>{const s=i.originalEvent.target,o=this._element;this._popup&&(s===o||o.contains(s))&&this.togglePopup()},this._update=i=>{var s;if(!this._map)return;const o=this._map.loaded()&&!this._map.isMoving();((i==null?void 0:i.type)==="terrain"||(i==null?void 0:i.type)==="render"&&!o)&&this._map.once("render",this._update),this._lngLat=this._map.transform.renderWorldCopies?No(this._lngLat,this._flatPos,this._map.transform):(s=this._lngLat)===null||s===void 0?void 0:s.wrap(),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 h="";this._rotationAlignment==="viewport"||this._rotationAlignment==="auto"?h=`rotateZ(${this._rotation}deg)`:this._rotationAlignment==="map"&&(h=`rotateZ(${this._rotation-this._map.getBearing()}deg)`);let f="";this._pitchAlignment==="viewport"||this._pitchAlignment==="auto"?f="rotateX(0deg)":this._pitchAlignment==="map"&&(f=`rotateX(${this._map.getPitch()}deg)`),this._subpixelPositioning||i&&i.type!=="moveend"||(this._pos=this._pos.round()),le.setTransform(this._element,`${Us[this._anchor]} translate(${this._pos.x}px, ${this._pos.y}px) ${f} ${h}`),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 c.l("dragstart"))),this.fire(new c.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 c.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=c.P.convert(e&&e.offset||[0,0]);else{this._defaultMarker=!0,this._element=le.create("div");const i=le.createNS("http://www.w3.org/2000/svg","svg"),s=41,o=27;i.setAttributeNS(null,"display","block"),i.setAttributeNS(null,"height",`${s}px`),i.setAttributeNS(null,"width",`${o}px`),i.setAttributeNS(null,"viewBox",`0 0 ${o} ${s}`);const h=le.createNS("http://www.w3.org/2000/svg","g");h.setAttributeNS(null,"stroke","none"),h.setAttributeNS(null,"stroke-width","1"),h.setAttributeNS(null,"fill","none"),h.setAttributeNS(null,"fill-rule","evenodd");const f=le.createNS("http://www.w3.org/2000/svg","g");f.setAttributeNS(null,"fill-rule","nonzero");const _=le.createNS("http://www.w3.org/2000/svg","g");_.setAttributeNS(null,"transform","translate(3.0, 29.0)"),_.setAttributeNS(null,"fill","#000000");const x=[{rx:"10.5",ry:"5.25002273"},{rx:"10.5",ry:"5.25002273"},{rx:"9.5",ry:"4.77275007"},{rx:"8.5",ry:"4.29549936"},{rx:"7.5",ry:"3.81822308"},{rx:"6.5",ry:"3.34094679"},{rx:"5.5",ry:"2.86367051"},{rx:"4.5",ry:"2.38636864"}];for(const W of x){const K=le.createNS("http://www.w3.org/2000/svg","ellipse");K.setAttributeNS(null,"opacity","0.04"),K.setAttributeNS(null,"cx","10.5"),K.setAttributeNS(null,"cy","5.80029008"),K.setAttributeNS(null,"rx",W.rx),K.setAttributeNS(null,"ry",W.ry),_.appendChild(K)}const w=le.createNS("http://www.w3.org/2000/svg","g");w.setAttributeNS(null,"fill",this._color);const I=le.createNS("http://www.w3.org/2000/svg","path");I.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"),w.appendChild(I);const z=le.createNS("http://www.w3.org/2000/svg","g");z.setAttributeNS(null,"opacity","0.25"),z.setAttributeNS(null,"fill","#000000");const C=le.createNS("http://www.w3.org/2000/svg","path");C.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"),z.appendChild(C);const F=le.createNS("http://www.w3.org/2000/svg","g");F.setAttributeNS(null,"transform","translate(6.0, 7.0)"),F.setAttributeNS(null,"fill","#FFFFFF");const N=le.createNS("http://www.w3.org/2000/svg","g");N.setAttributeNS(null,"transform","translate(8.0, 8.0)");const q=le.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 G=le.createNS("http://www.w3.org/2000/svg","circle");G.setAttributeNS(null,"fill","#FFFFFF"),G.setAttributeNS(null,"cx","5.5"),G.setAttributeNS(null,"cy","5.5"),G.setAttributeNS(null,"r","5.4999962"),N.appendChild(q),N.appendChild(G),f.appendChild(_),f.appendChild(w),f.appendChild(z),f.appendChild(F),f.appendChild(N),i.appendChild(f),i.setAttributeNS(null,"height",s*this._scale+"px"),i.setAttributeNS(null,"width",o*this._scale+"px"),this._element.appendChild(i),this._offset=c.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()}),Zo(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.setAttribute("aria-label",e._getUIString("Marker.Title")),e.getCanvasContainer().appendChild(this._element),e.on("move",this._update),e.on("moveend",this._update),e.on("terrain",this._update),e.on("projectiontransition",this._update),this.setDraggable(this._draggable),this._update(),this._map.on("click",this._onMapClick),this}remove(){return this._opacityTimeout&&(clearTimeout(this._opacityTimeout),delete this._opacityTimeout),this._map&&(this._map.off("click",this._onMapClick),this._map.off("move",this._update),this._map.off("moveend",this._update),this._map.off("terrain",this._update),this._map.off("projectiontransition",this._update),this._map.off("mousedown",this._addDragHandler),this._map.off("touchstart",this._addDragHandler),this._map.off("mouseup",this._onUp),this._map.off("touchend",this._onUp),this._map.off("mousemove",this._onMove),this._map.off("touchmove",this._onMove),delete this._map),le.remove(this._element),this._popup&&this._popup.remove(),this}getLngLat(){return this._lngLat}setLngLat(e){return this._lngLat=c.Q.convert(e),this._pos=null,this._popup&&this._popup.setLngLat(this._lngLat),this._update(),this}getElement(){return this._element}setPopup(e){if(this._popup&&(this._popup.remove(),this._popup=null,this._element.removeEventListener("keypress",this._onKeyPress),this._originalTabIndex||this._element.removeAttribute("tabindex")),e){if(!("offset"in e.options)){const o=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":[o,-1*(38.1-13.5+o)],"bottom-right":[-o,-1*(38.1-13.5+o)],left:[13.5,-1*(38.1-13.5)],right:[-13.5,-1*(38.1-13.5)]}:this._offset}this._popup=e,this._originalTabIndex=this._element.getAttribute("tabindex"),this._originalTabIndex||this._element.setAttribute("tabindex","0"),this._element.addEventListener("keypress",this._onKeyPress)}return this}setSubpixelPositioning(e){return this._subpixelPositioning=e,this}getPopup(){return this._popup}togglePopup(){const e=this._popup;return this._element.style.opacity===this._opacityWhenCovered?this:e?(e.isOpen()?e.remove():(e.setLngLat(this._lngLat),e.addTo(this._map)),this):this}_updateOpacity(e=!1){var i,s;if(!(!((i=this._map)===null||i===void 0)&&i.terrain)){const z=this._map.transform.isLocationOccluded(this._lngLat)?this._opacityWhenCovered:this._opacity;return void(this._element.style.opacity!==z&&(this._element.style.opacity=z))}if(e)this._opacityTimeout=null;else{if(this._opacityTimeout)return;this._opacityTimeout=setTimeout(()=>{this._opacityTimeout=null},100)}const o=this._map,h=o.terrain.depthAtPoint(this._pos),f=o.terrain.getElevationForLngLatZoom(this._lngLat,o.transform.tileZoom);if(o.transform.lngLatToCameraDepth(this._lngLat,f)-h<.006)return void(this._element.style.opacity=this._opacity);const _=-this._offset.y/o.transform.pixelsPerMeter,x=Math.sin(o.getPitch()*Math.PI/180)*_,w=o.terrain.depthAtPoint(new c.P(this._pos.x,this._pos.y-this._offset.y)),I=o.transform.lngLatToCameraDepth(this._lngLat,f+x)-w>.006;!((s=this._popup)===null||s===void 0)&&s.isOpen()&&I&&this._popup.remove(),this._element.style.opacity=I?this._opacityWhenCovered:this._opacity}getOffset(){return this._offset}setOffset(e){return this._offset=c.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 lc={positionOptions:{enableHighAccuracy:!1,maximumAge:0,timeout:6e3},fitBoundsOptions:{maxZoom:15},trackUserLocation:!1,showAccuracyCircle:!0,showUserLocation:!0};let ts=0,sa=!1;const cc={maxWidth:100,unit:"metric"};function Vo(u,e,i){const s=i&&i.maxWidth||100,o=u._container.clientHeight/2,h=u._container.clientWidth/2,f=u.unproject([h-s/2,o]),_=u.unproject([h+s/2,o]),x=Math.round(u.project(_).x-u.project(f).x),w=Math.min(s,x,u._container.clientWidth),I=f.distanceTo(_);if(i&&i.unit==="imperial"){const z=3.2808*I;z>5280?oa(e,w,z/5280,u._getUIString("ScaleControl.Miles")):oa(e,w,z,u._getUIString("ScaleControl.Feet"))}else i&&i.unit==="nautical"?oa(e,w,I/1852,u._getUIString("ScaleControl.NauticalMiles")):I>=1e3?oa(e,w,I/1e3,u._getUIString("ScaleControl.Kilometers")):oa(e,w,I,u._getUIString("ScaleControl.Meters"))}function oa(u,e,i,s){const o=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 w=Math.pow(10,Math.ceil(-Math.log(x)/Math.LN10));return Math.round(x*w)/w}(_),f*_}(i);u.style.width=e*(o/i)+"px",u.innerHTML=`${o}&nbsp;${s}`}const uc={closeButton:!0,closeOnClick:!0,focusAfterOpen:!0,className:"",maxWidth:"240px",subpixelPositioning:!1,locationOccludedOpacity:void 0},hc=["a[href]","[tabindex]:not([tabindex='-1'])","[contenteditable]:not([contenteditable='false'])","button:not([disabled])","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].join(", ");function $s(u){if(u){if(typeof u=="number"){const e=Math.round(Math.abs(u)/Math.SQRT2);return{center:new c.P(0,0),top:new c.P(0,u),"top-left":new c.P(e,e),"top-right":new c.P(-e,e),bottom:new c.P(0,-u),"bottom-left":new c.P(e,-e),"bottom-right":new c.P(-e,-e),left:new c.P(u,0),right:new c.P(-u,0)}}if(u instanceof c.P||Array.isArray(u)){const e=c.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:c.P.convert(u.center||[0,0]),top:c.P.convert(u.top||[0,0]),"top-left":c.P.convert(u["top-left"]||[0,0]),"top-right":c.P.convert(u["top-right"]||[0,0]),bottom:c.P.convert(u.bottom||[0,0]),"bottom-left":c.P.convert(u["bottom-left"]||[0,0]),"bottom-right":c.P.convert(u["bottom-right"]||[0,0]),left:c.P.convert(u.left||[0,0]),right:c.P.convert(u.right||[0,0])}}return $s(new c.P(0,0))}const dc=Te;M.AJAXError=c.cm,M.Event=c.l,M.Evented=c.E,M.LngLat=c.Q,M.MercatorCoordinate=c.$,M.Point=c.P,M.addProtocol=c.cn,M.config=c.a,M.removeProtocol=c.co,M.AttributionControl=Xe,M.BoxZoomHandler=ra,M.CanvasSource=Pa,M.CooperativeGesturesHandler=Bo,M.DoubleClickZoomHandler=ac,M.DragPanHandler=Jr,M.DragRotateHandler=Ft,M.EdgeInsets=jt,M.FullscreenControl=class extends c.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:c.w("Full screen control 'container' must be a DOM element.")),"onfullscreenchange"in document?this._fullscreenchange="fullscreenchange":"onmozfullscreenchange"in document?this._fullscreenchange="mozfullscreenchange":"onwebkitfullscreenchange"in document?this._fullscreenchange="webkitfullscreenchange":"onmsfullscreenchange"in document&&(this._fullscreenchange="MSFullscreenChange")}onAdd(u){return this._map=u,this._container||(this._container=this._map.getContainer()),this._controlContainer=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),this._controlContainer}onRemove(){le.remove(this._controlContainer),this._map=null,window.document.removeEventListener(this._fullscreenchange,this._onFullscreenChange)}_setupUI(){const u=this._fullscreenButton=le.create("button","maplibregl-ctrl-fullscreen",this._controlContainer);le.create("span","maplibregl-ctrl-icon",u).setAttribute("aria-hidden","true"),u.type="button",this._updateTitle(),this._fullscreenButton.addEventListener("click",this._onClickFullscreen),window.document.addEventListener(this._fullscreenchange,this._onFullscreenChange)}_updateTitle(){const u=this._getTitle();this._fullscreenButton.setAttribute("aria-label",u),this._fullscreenButton.title=u}_getTitle(){return this._map._getUIString(this._isFullscreen()?"FullscreenControl.Exit":"FullscreenControl.Enter")}_isFullscreen(){return this._fullscreen}_handleFullscreenChange(){this._fullscreen=!this._fullscreen,this._fullscreenButton.classList.toggle("maplibregl-ctrl-shrink"),this._fullscreenButton.classList.toggle("maplibregl-ctrl-fullscreen"),this._updateTitle(),this._fullscreen?(this.fire(new c.l("fullscreenstart")),this._prevCooperativeGesturesEnabled=this._map.cooperativeGestures.isEnabled(),this._map.cooperativeGestures.disable()):(this.fire(new c.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()}},M.GeoJSONSource=_n,M.GeolocateControl=class extends c.E{constructor(u){super(),this._onSuccess=e=>{if(this._map){if(this._isOutOfMapMaxBounds(e))return this._setErrorState(),this.fire(new c.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 c.l("geolocate",e)),this._finish()}},this._updateCamera=e=>{const i=new c.Q(e.coords.longitude,e.coords.latitude),s=e.coords.accuracy,o=this._map.getBearing(),h=c.e({bearing:o},this.options.fitBoundsOptions),f=Yt.fromLngLat(i,s);this._map.fitBounds(f,h,{geolocateSource:!0})},this._updateMarker=e=>{if(e){const i=new c.Q(e.coords.longitude,e.coords.latitude);this._accuracyCircleMarker.setLngLat(i).addTo(this._map),this._userLocationDotMarker.setLngLat(i).addTo(this._map),this._accuracy=e.coords.accuracy,this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()}else this._userLocationDotMarker.remove(),this._accuracyCircleMarker.remove()},this._onZoom=()=>{this.options.showUserLocation&&this.options.showAccuracyCircle&&this._updateCircleRadius()},this._onError=e=>{if(this._map){if(this.options.trackUserLocation)if(e.code===1){this._watchState="OFF",this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-waiting"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-active-error"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background"),this._geolocateButton.classList.remove("maplibregl-ctrl-geolocate-background-error"),this._geolocateButton.disabled=!0;const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i),this._geolocationWatchID!==void 0&&this._clearWatch()}else{if(e.code===3&&sa)return;this._setErrorState()}this._watchState!=="OFF"&&this.options.showUserLocation&&this._dotElement.classList.add("maplibregl-user-location-dot-stale"),this.fire(new c.l("error",e)),this._finish()}},this._finish=()=>{this._timeoutId&&clearTimeout(this._timeoutId),this._timeoutId=void 0},this._setupUI=()=>{this._map&&(this._container.addEventListener("contextmenu",e=>e.preventDefault()),this._geolocateButton=le.create("button","maplibregl-ctrl-geolocate",this._container),le.create("span","maplibregl-ctrl-icon",this._geolocateButton).setAttribute("aria-hidden","true"),this._geolocateButton.type="button",this._geolocateButton.disabled=!0)},this._finishSetupUI=e=>{if(this._map){if(e===!1){c.w("Geolocation support is not available so the GeolocateControl will be disabled.");const i=this._map._getUIString("GeolocateControl.LocationNotAvailable");this._geolocateButton.disabled=!0,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}else{const i=this._map._getUIString("GeolocateControl.FindMyLocation");this._geolocateButton.disabled=!1,this._geolocateButton.title=i,this._geolocateButton.setAttribute("aria-label",i)}this.options.trackUserLocation&&(this._geolocateButton.setAttribute("aria-pressed","false"),this._watchState="OFF"),this.options.showUserLocation&&(this._dotElement=le.create("div","maplibregl-user-location-dot"),this._userLocationDotMarker=new aa({element:this._dotElement}),this._circleElement=le.create("div","maplibregl-user-location-accuracy-circle"),this._accuracyCircleMarker=new aa({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 c.l("trackuserlocationend")),this.fire(new c.l("userlocationlostfocus")))})}},this.options=c.e({},lc,u)}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._setupUI(),function(){return c._(this,arguments,void 0,function*(e=!1){if(Lr!==void 0&&!e)return Lr;if(window.navigator.permissions===void 0)return Lr=!!window.navigator.geolocation,Lr;try{Lr=(yield window.navigator.permissions.query({name:"geolocation"})).state!=="denied"}catch{Lr=!!window.navigator.geolocation}return Lr})}().then(e=>this._finishSetupUI(e)),this._container}onRemove(){this._geolocationWatchID!==void 0&&(window.navigator.geolocation.clearWatch(this._geolocationWatchID),this._geolocationWatchID=void 0),this.options.showUserLocation&&this._userLocationDotMarker&&this._userLocationDotMarker.remove(),this.options.showAccuracyCircle&&this._accuracyCircleMarker&&this._accuracyCircleMarker.remove(),le.remove(this._container),this._map.off("zoom",this._onZoom),this._map=void 0,ts=0,sa=!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),o=Math.ceil(this._accuracy/(s/this._map._container.clientHeight)*2);this._circleElement.style.width=`${o}px`,this._circleElement.style.height=`${o}px`}trigger(){if(!this._setup)return c.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 c.l("trackuserlocationstart"));break;case"WAITING_ACTIVE":case"ACTIVE_LOCK":case"ACTIVE_ERROR":case"BACKGROUND_ERROR":ts--,sa=!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 c.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 c.l("trackuserlocationstart")),this.fire(new c.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"),ts++,ts>1?(u={maximumAge:6e5,timeout:0},sa=!0):(u=this.options.positionOptions,sa=!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)}},M.GlobeControl=class{constructor(){this._toggleProjection=()=>{var u;const e=(u=this._map.getProjection())===null||u===void 0?void 0:u.type;this._map.setProjection(e!=="mercator"&&e?{type:"mercator"}:{type:"globe"}),this._updateGlobeIcon()},this._updateGlobeIcon=()=>{var u;this._globeButton.classList.remove("maplibregl-ctrl-globe"),this._globeButton.classList.remove("maplibregl-ctrl-globe-enabled"),((u=this._map.getProjection())===null||u===void 0?void 0:u.type)==="globe"?(this._globeButton.classList.add("maplibregl-ctrl-globe-enabled"),this._globeButton.title=this._map._getUIString("GlobeControl.Disable")):(this._globeButton.classList.add("maplibregl-ctrl-globe"),this._globeButton.title=this._map._getUIString("GlobeControl.Enable"))}}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._globeButton=le.create("button","maplibregl-ctrl-globe",this._container),le.create("span","maplibregl-ctrl-icon",this._globeButton).setAttribute("aria-hidden","true"),this._globeButton.type="button",this._globeButton.addEventListener("click",this._toggleProjection),this._updateGlobeIcon(),this._map.on("styledata",this._updateGlobeIcon),this._container}onRemove(){le.remove(this._container),this._map.off("styledata",this._updateGlobeIcon),this._globeButton.removeEventListener("click",this._toggleProjection),this._map=void 0}},M.Hash=Jl,M.ImageSource=mr,M.KeyboardHandler=ic,M.LngLatBounds=Yt,M.LogoControl=tt,M.Map=class extends Dr{constructor(u){var e,i;c.cj.mark(c.ck.create);const s=Object.assign(Object.assign(Object.assign({},Qt),u),{canvasContextAttributes:Object.assign(Object.assign({},Qt.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 o=new Nt,h=new Vi;if(s.minZoom!==void 0&&o.setMinZoom(s.minZoom),s.maxZoom!==void 0&&o.setMaxZoom(s.maxZoom),s.minPitch!==void 0&&o.setMinPitch(s.minPitch),s.maxPitch!==void 0&&o.setMaxPitch(s.maxPitch),s.renderWorldCopies!==void 0&&o.setRenderWorldCopies(s.renderWorldCopies),super(o,h,{bearingSnap:s.bearingSnap}),this._idleTriggered=!1,this._crossFadingFactor=1,this._renderTaskQueue=new jo,this._controls=[],this._mapId=c.a4(),this._contextLost=_=>{_.preventDefault(),this._frameRequest&&(this._frameRequest.abort(),this._frameRequest=null),this.fire(new c.l("webglcontextlost",{originalEvent:_}))},this._contextRestored=_=>{this._setupPainter(),this.resize(),this._update(),this.fire(new c.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({},Zs),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=ri.addThrottleControl(()=>this.isMoving()),this._requestManager=new dr(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=Yl(w=>{this._trackResize&&!this._removed&&(this.resize(w),this.redraw())},50);this._resizeObserver=new ResizeObserver(w=>{_?x(w):_=!0}),this._resizeObserver.observe(this._container)}this.handlers=new ad(this,s),this._hash=s.hash&&new Jl(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,c.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 Xe(typeof s.attributionControl=="boolean"?void 0:s.attributionControl)),s.maplibreLogo&&this.addControl(new tt,s.logoPosition),this.on("style.load",()=>{if(f||this._resizeTransform(),this.transform.unmodified){const _=c.O(this.style.stylesheet,["center","zoom","bearing","pitch","roll"]);this.jumpTo(_)}}),this.on("data",_=>{this._update(_.dataType==="style"),this.fire(new c.l(`${_.dataType}data`,_))}),this.on("dataloading",_=>{this.fire(new c.l(`${_.dataType}dataloading`,_))}),this.on("dataabort",_=>{this.fire(new c.l("sourcedataabort",_))})}_getMapId(){return this._mapId}addControl(u,e){if(e===void 0&&(e=u.getDefaultPosition?u.getDefaultPosition():"top-right"),!u||!u.onAdd)return this.fire(new c.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 c.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(),o=this._getClampedPixelRatio(i,s);if(this._resizeCanvas(i,s,o),this.painter.resize(i,s,o),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 c.l("movestart",u)).fire(new c.l("move",u))),this.fire(new c.l("resize",u)),h&&this.fire(new c.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,o=this.getPixelRatio(),h=u*o,f=e*o;return Math.min(h>i?i/h:1,f>s?s/f:1)*o}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(Yt.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(c.Q.convert(u),this.style&&this.terrain)}unproject(u){return this.transform.screenPointToLocation(c.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 zi(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 zi(u,this,f.originalEvent)))},mouseout:f=>{s&&(s=!1,i.call(this,new zi(u,this,f.originalEvent)))}}}}{const s=o=>{const h=e.filter(_=>this.getLayer(_)),f=h.length!==0?this.queryRenderedFeatures(o.point,{layers:h}):[];f.length&&(o.features=f,i.call(this,o),delete o.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 o=0;o<s.length;o++){const h=s[o];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(o,1)}}}on(u,e,i){if(i===void 0)return super.on(u,e);const s=typeof e=="string"?[e]:e,o=this._createDelegatedListener(u,s,i);this._saveDelegatedListener(u,o);for(const h in o.delegates)this.on(h,o.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,o=this._createDelegatedListener(u,s,i);for(const h in o.delegates){const f=o.delegates[h];o.delegates[h]=(..._)=>{this._removeDelegatedListener(u,s,i),f(..._)}}this._saveDelegatedListener(u,o);for(const h in o.delegates)this.once(h,o.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 c.P||Array.isArray(u),o=s?u:[[0,0],[this.transform.width,this.transform.height]];if(e=e||(s?{}:u)||{},o instanceof c.P||typeof o[0]=="number")i=[c.P.convert(o)];else{const h=c.P.convert(o[0]),f=c.P.convert(o[1]);i=[h,new c.P(f.x,h.y),f,new c.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=c.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 o=this.style&&e.transformStyle?this.style.serialize():void 0;return this.style&&(this.style.setEventedParent(null),this.style._remove(!u)),u?(this.style=new ja(this,e||{}),this.style.setEventedParent(this,{style:this.style}),typeof u=="string"?this.style.loadURL(u,e,o):this.style.loadJSON(u,e,o),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 ja(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");c.j(i,new AbortController).then(s=>{this._updateDiff(s.data,e)}).catch(s=>{s&&this.fire(new c.k(s))})}else typeof u=="object"&&this._updateDiff(u,e)}_updateDiff(u,e){try{this.style.setState(u,e)&&this._update(!0)}catch(i){c.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():c.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 c.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&&c.w("You are using the same source for a hillshade layer and for 3D terrain. Please consider using two separate sources to improve rendering quality.")}this.terrain=new $i(this.painter,e,u),this.painter.renderToTexture=new sd(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 c.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 o=i[s];if(o.state!=="loaded"&&o.state!=="errored")return!1}}return!0}removeSource(u){return this.style.removeSource(u),this._update(!0)}getSource(u){return this.style.getSource(u)}addImage(u,e,i={}){const{pixelRatio:s=1,sdf:o=!1,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:w}=i;if(this._lazyInitEmptyStyle(),!(e instanceof HTMLImageElement||c.b(e))){if(e.width===void 0||e.height===void 0)return this.fire(new c.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:I,height:z,data:C}=e,F=e;return this.style.addImage(u,{data:new c.R({width:I,height:z},new Uint8Array(C)),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:w,sdf:o,version:0,userImage:F}),F.onAdd&&F.onAdd(this,u),this}}{const{width:I,height:z,data:C}=Ae.getImageData(e);this.style.addImage(u,{data:new c.R({width:I,height:z},C),pixelRatio:s,stretchX:h,stretchY:f,content:_,textFitWidth:x,textFitHeight:w,sdf:o,version:0})}}updateImage(u,e){const i=this.style.getImage(u);if(!i)return this.fire(new c.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||c.b(e)?Ae.getImageData(e):e,{width:o,height:h,data:f}=s;if(o===void 0||h===void 0)return this.fire(new c.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(o!==i.data.width||h!==i.data.height)return this.fire(new c.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||c.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 c.k(new Error("Missing required image id"))),!1)}removeImage(u){this.style.removeImage(u)}loadImage(u){return ri.getImage(this._requestManager.transformRequest(u,"Image"),new AbortController)}listImages(){return this.style.listImages()}addLayer(u,e){return this._lazyInitEmptyStyle(),this.style.addLayer(u,e),this._update(!0)}moveLayer(u,e){return this.style.moveLayer(u,e),this._update(!0)}removeLayer(u){return this.style.removeLayer(u),this._update(!0)}getLayer(u){return this.style.getLayer(u)}getLayersOrder(){return this.style.getLayersOrder()}setLayerZoomRange(u,e,i){return this.style.setLayerZoomRange(u,e,i),this._update(!0)}setFilter(u,e,i={}){return this.style.setFilter(u,e,i),this._update(!0)}getFilter(u){return this.style.getFilter(u)}setPaintProperty(u,e,i,s={}){return this.style.setPaintProperty(u,e,i,s),this._update(!0)}getPaintProperty(u,e){return this.style.getPaintProperty(u,e)}setLayoutProperty(u,e,i,s={}){return this.style.setLayoutProperty(u,e,i,s),this._update(!0)}getLayoutProperty(u,e){return this.style.getLayoutProperty(u,e)}setGlyphs(u,e={}){return this._lazyInitEmptyStyle(),this.style.setGlyphs(u,e),this._update(!0)}getGlyphs(){return this.style.getGlyphsUrl()}addSprite(u,e,i={}){return this._lazyInitEmptyStyle(),this.style.addSprite(u,e,i,s=>{s||this._update(!0)}),this}removeSprite(u){return this._lazyInitEmptyStyle(),this.style.removeSprite(u),this._update(!0)}getSprite(){return this.style.getSprite()}setSprite(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSprite(u,e,i=>{i||this._update(!0)}),this}setLight(u,e={}){return this._lazyInitEmptyStyle(),this.style.setLight(u,e),this._update(!0)}getLight(){return this.style.getLight()}setSky(u,e={}){return this._lazyInitEmptyStyle(),this.style.setSky(u,e),this._update(!0)}getSky(){return this.style.getSky()}setFeatureState(u,e){return this.style.setFeatureState(u,e),this._update()}removeFeatureState(u,e){return this.style.removeFeatureState(u,e),this._update()}getFeatureState(u){return this.style.getFeatureState(u)}getContainer(){return this._container}getCanvasContainer(){return this._canvasContainer}getCanvas(){return this._canvas}_containerDimensions(){let u=0,e=0;return this._container&&(u=this._container.clientWidth||400,e=this._container.clientHeight||300),[u,e]}_setupContainer(){const u=this._container;u.classList.add("maplibregl-map");const e=this._canvasContainer=le.create("div","maplibregl-canvas-container",u);this._interactive&&e.classList.add("maplibregl-interactive"),this._canvas=le.create("canvas","maplibregl-canvas",e),this._canvas.addEventListener("webglcontextlost",this._contextLost,!1),this._canvas.addEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.setAttribute("tabindex",this._interactive?"0":"-1"),this._canvas.setAttribute("aria-label",this._getUIString("Map.Title")),this._canvas.setAttribute("role","region");const i=this._containerDimensions(),s=this._getClampedPixelRatio(i[0],i[1]);this._resizeCanvas(i[0],i[1],s);const o=this._controlContainer=le.create("div","maplibregl-control-container",u),h=this._controlPositions={};["top-left","top-right","bottom-left","bottom-right"].forEach(f=>{h[f]=le.create("div",`maplibregl-ctrl-${f} `,o)}),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 Zu(i,this.transform),Ze.testSupport(i)}migrateProjection(u,e){super.migrateProjection(u,e),this.painter.transform=u,this.fire(new c.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,o,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 z=this.transform.zoom,C=Ae.now();this.style.zoomHistory.update(z,C);const F=new c.C(z,{now:C,fadeDuration:f,zoomHistory:this.style.zoomHistory,transition:this.style.getTransition()}),N=F.crossFadingFactor();N===1&&N===this._crossFadingFactor||(x=!0,this._crossFadingFactor=N),this.style.update(F)}const w=((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((o=this.style.projection)===null||o===void 0?void 0:o.transitionState,(h=this.style.projection)===null||h===void 0?void 0:h.latitudeErrorCorrectionRadians),this.style&&(this._sourcesDirty||w)&&(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,w),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 c.l("render")),this.loaded()&&!this._loaded&&(this._loaded=!0,c.cj.mark(c.ck.load),this.fire(new c.l("load"))),this.style&&(this.style.hasTransitions()||x)&&(this._styleDirty=!0),this.style&&!this._placementDirty&&this.style._releaseSymbolFadeTiles();const I=this._sourcesDirty||this._styleDirty||this._placementDirty;return I||this._repaint?this.triggerRepaint():!this.isMoving()&&this.loaded()&&this.fire(new c.l("idle")),!this._loaded||this._fullyLoaded||I||(this._fullyLoaded=!0,c.cj.mark(c.ck.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),ri.removeThrottleControl(this._imageQueueHandle),(u=this._resizeObserver)===null||u===void 0||u.disconnect();const e=this.painter.context.gl.getExtension("WEBGL_lose_context");e!=null&&e.loseContext&&e.loseContext(),this._canvas.removeEventListener("webglcontextrestored",this._contextRestored,!1),this._canvas.removeEventListener("webglcontextlost",this._contextLost,!1),le.remove(this._canvasContainer),le.remove(this._controlContainer),this._container.removeEventListener("scroll",this._onMapScroll,!1),this._container.classList.remove("maplibregl-map"),c.cj.clearMetrics(),this._removed=!0,this.fire(new c.l("remove"))}triggerRepaint(){this.style&&!this._frameRequest&&(this._frameRequest=new AbortController,Ae.frame(this._frameRequest,u=>{c.cj.frame(u),this._frameRequest=null;try{this._render(u)}catch(e){if(!c.cl(e)&&!function(i){return i.message===Fu}(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 Gt}getCameraTargetElevation(){return this.transform.elevation}getProjection(){return this.style.getProjection()}setProjection(u){return this._lazyInitEmptyStyle(),this.style.setProjection(u),this._update(!0)}},M.MapMouseEvent=zi,M.MapTouchEvent=Ja,M.MapWheelEvent=lr,M.Marker=aa,M.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=c.e({},th,u),this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._container.addEventListener("contextmenu",e=>e.preventDefault()),this.options.showZoom&&(this._zoomInButton=this._createButton("maplibregl-ctrl-zoom-in",e=>this._map.zoomIn({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomInButton).setAttribute("aria-hidden","true"),this._zoomOutButton=this._createButton("maplibregl-ctrl-zoom-out",e=>this._map.zoomOut({},{originalEvent:e})),le.create("span","maplibregl-ctrl-icon",this._zoomOutButton).setAttribute("aria-hidden","true")),this.options.showCompass&&(this._compass=this._createButton("maplibregl-ctrl-compass",e=>{this.options.visualizePitch?this._map.resetNorthPitch({},{originalEvent:e}):this._map.resetNorth({},{originalEvent:e})}),this._compassIcon=le.create("span","maplibregl-ctrl-icon",this._compass),this._compassIcon.setAttribute("aria-hidden","true"))}onAdd(u){return this._map=u,this.options.showZoom&&(this._setButtonTitle(this._zoomInButton,"ZoomIn"),this._setButtonTitle(this._zoomOutButton,"ZoomOut"),this._map.on("zoom",this._updateZoomButtons),this._updateZoomButtons()),this.options.showCompass&&(this._setButtonTitle(this._compass,"ResetBearing"),this.options.visualizePitch&&this._map.on("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.on("roll",this._rotateCompassArrow),this._map.on("rotate",this._rotateCompassArrow),this._rotateCompassArrow(),this._handler=new Vs(this._map,this._compass,this.options.visualizePitch)),this._container}onRemove(){le.remove(this._container),this.options.showZoom&&this._map.off("zoom",this._updateZoomButtons),this.options.showCompass&&(this.options.visualizePitch&&this._map.off("pitch",this._rotateCompassArrow),this.options.visualizeRoll&&this._map.off("roll",this._rotateCompassArrow),this._map.off("rotate",this._rotateCompassArrow),this._handler.off(),delete this._handler),delete this._map}_createButton(u,e){const i=le.create("button",u,this._container);return i.type="button",i.addEventListener("click",e),i}},M.Popup=class extends c.E{constructor(u){super(),this._updateOpacity=()=>{this.options.locationOccludedOpacity!==void 0&&(this._container.style.opacity=this._map.transform.isLocationOccluded(this.getLngLat())?`${this.options.locationOccludedOpacity}`:void 0)},this.remove=()=>(this._content&&le.remove(this._content),this._container&&(le.remove(this._container),delete this._container),this._closeButton&&this._closeButton.removeEventListener("click",this._onClose),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 c.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=>{var i;if(!this._map||!this._lngLat&&!this._trackPointer||!this._content)return;if(!this._container){if(this._container=le.create("div","maplibregl-popup",this._map.getContainer()),this._tip=le.create("div","maplibregl-popup-tip",this._container),this._container.appendChild(this._content),this.options.className)for(const _ of this.options.className.split(" "))this._container.classList.add(_);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=this._map.transform.renderWorldCopies&&!this._trackPointer?No(this._lngLat,this._flatPos,this._map.transform):(i=this._lngLat)===null||i===void 0?void 0:i.wrap(),this._trackPointer&&!e)return;const s=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 o=this.options.anchor;const h=$s(this.options.offset);if(!o){const _=this._container.offsetWidth,x=this._container.offsetHeight;let w;w=s.y+h.bottom.y<x?["top"]:s.y>this._map.transform.height-x?["bottom"]:[],s.x<_/2?w.push("left"):s.x>this._map.transform.width-_/2&&w.push("right"),o=w.length===0?"bottom":w.join("-")}let f=s.add(h[o]);this.options.subpixelPositioning||(f=f.round()),le.setTransform(this._container,`${Us[o]} translate(${f.x}px,${f.y}px)`),Zo(this._container,o,"popup"),this._updateOpacity()},this._onClose=()=>{this.remove()},this.options=c.e(Object.create(uc),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 c.l("open")),this}isOpen(){return!!this._map}getLngLat(){return this._lngLat}setLngLat(u){return this._lngLat=c.Q.convert(u),this._pos=null,this._flatPos=null,this._trackPointer=!1,this._update(),this._map&&(this._map.on("move",this._update),this._map.off("mousemove",this._onMouseMove),this._container&&this._container.classList.remove("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.remove("maplibregl-track-pointer")),this}trackPointer(){return this._trackPointer=!0,this._pos=null,this._flatPos=null,this._update(),this._map&&(this._map.off("move",this._update),this._map.on("mousemove",this._onMouseMove),this._map.on("drag",this._onDrag),this._container&&this._container.classList.add("maplibregl-popup-track-pointer"),this._map._canvasContainer.classList.add("maplibregl-track-pointer")),this}getElement(){return this._container}setText(u){return this.setDOMContent(document.createTextNode(u))}setHTML(u){const e=document.createDocumentFragment(),i=document.createElement("body");let s;for(i.innerHTML=u;s=i.firstChild,s;)e.appendChild(s);return this.setDOMContent(e)}getMaxWidth(){var u;return(u=this._container)===null||u===void 0?void 0:u.style.maxWidth}setMaxWidth(u){return this.options.maxWidth=u,this._update(),this}setDOMContent(u){if(this._content)for(;this._content.hasChildNodes();)this._content.firstChild&&this._content.removeChild(this._content.firstChild);else this._content=le.create("div","maplibregl-popup-content",this._container);return this._content.appendChild(u),this._createCloseButton(),this._update(),this._focusFirstElement(),this}addClassName(u){return this._container&&this._container.classList.add(u),this}removeClassName(u){return this._container&&this._container.classList.remove(u),this}setOffset(u){return this.options.offset=u,this._update(),this}toggleClassName(u){if(this._container)return this._container.classList.toggle(u)}setSubpixelPositioning(u){this.options.subpixelPositioning=u}_createCloseButton(){this.options.closeButton&&(this._closeButton=le.create("button","maplibregl-popup-close-button",this._content),this._closeButton.type="button",this._closeButton.innerHTML="&#215;",this._closeButton.addEventListener("click",this._onClose))}_focusFirstElement(){if(!this.options.focusAfterOpen||!this._container)return;const u=this._container.querySelector(hc);u&&u.focus()}},M.RasterDEMTileSource=gn,M.RasterTileSource=fr,M.ScaleControl=class{constructor(u){this._onMove=()=>{Vo(this._map,this._container,this.options)},this.setUnit=e=>{this.options.unit=e,Vo(this._map,this._container,this.options)},this.options=Object.assign(Object.assign({},cc),u)}getDefaultPosition(){return"bottom-left"}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-scale",u.getContainer()),this._map.on("move",this._onMove),this._onMove(),this._container}onRemove(){le.remove(this._container),this._map.off("move",this._onMove),this._map=void 0}},M.ScrollZoomHandler=Ju,M.Style=ja,M.TerrainControl=class{constructor(u){this._toggleTerrain=()=>{this._map.getTerrain()?this._map.setTerrain(null):this._map.setTerrain(this.options),this._updateTerrainIcon()},this._updateTerrainIcon=()=>{this._terrainButton.classList.remove("maplibregl-ctrl-terrain"),this._terrainButton.classList.remove("maplibregl-ctrl-terrain-enabled"),this._map.terrain?(this._terrainButton.classList.add("maplibregl-ctrl-terrain-enabled"),this._terrainButton.title=this._map._getUIString("TerrainControl.Disable")):(this._terrainButton.classList.add("maplibregl-ctrl-terrain"),this._terrainButton.title=this._map._getUIString("TerrainControl.Enable"))},this.options=u}onAdd(u){return this._map=u,this._container=le.create("div","maplibregl-ctrl maplibregl-ctrl-group"),this._terrainButton=le.create("button","maplibregl-ctrl-terrain",this._container),le.create("span","maplibregl-ctrl-icon",this._terrainButton).setAttribute("aria-hidden","true"),this._terrainButton.type="button",this._terrainButton.addEventListener("click",this._toggleTerrain),this._updateTerrainIcon(),this._map.on("terrain",this._updateTerrainIcon),this._container}onRemove(){le.remove(this._container),this._map.off("terrain",this._updateTerrainIcon),this._map=void 0}},M.TwoFingersTouchPitchHandler=Yu,M.TwoFingersTouchRotateHandler=Xu,M.TwoFingersTouchZoomHandler=pt,M.TwoFingersTouchZoomRotateHandler=Os,M.VectorTileSource=Gn,M.VideoSource=gr,M.addSourceType=(u,e)=>c._(void 0,void 0,void 0,function*(){if(_s(u))throw new Error(`A source type called "${u}" already exists.`);((i,s)=>{Sa[i]=s})(u,e)}),M.clearPrewarmedResources=function(){const u=nr;u&&(u.isPreloaded()&&u.numActive()===1?(u.release(Ta),nr=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()"))},M.createTileMesh=ho,M.getMaxParallelImageRequests=function(){return c.a.MAX_PARALLEL_IMAGE_REQUESTS},M.getRTLTextPluginStatus=function(){return Gr().getRTLTextPluginStatus()},M.getVersion=function(){return dc},M.getWorkerCount=function(){return Cr.workerCount},M.getWorkerUrl=function(){return c.a.WORKER_URL},M.importScriptInWorkers=function(u){return Un().broadcast("IS",u)},M.prewarm=function(){Zn().acquire(Ta)},M.setMaxParallelImageRequests=function(u){c.a.MAX_PARALLEL_IMAGE_REQUESTS=u},M.setRTLTextPlugin=function(u,e){return Gr().setRTLTextPlugin(u,e)},M.setWorkerCount=function(u){Cr.workerCount=u},M.setWorkerUrl=function(u){c.a.WORKER_URL=u}});var Z=T;return Z})}(nu)),nu.exports}var ty=ey();const iy=J_(ty);var ry=Rg('<div><div class="map svelte-132x4ps"></div></div>');function Up(b,g){rp(g,!0);let T,E,B=0,Z=ln(!1);Zg(()=>{H_.parse(g.options),M(),c()});function M(){const wt=g.options.position;T=new iy.Map({style:dr(g.options.theme),center:{lat:wt.center.lat,lng:wt.center.lng},zoom:wt.zoom,minZoom:le(),maxZoom:Y_,container:E,pitchWithRotate:!1,attributionControl:{compact:!1}})}function c(){T.on("load",Te),T.on("move",ge),T.on("idle",ke),T.on("click",Ue),T.dragRotate.disable(),T.keyboard.disable(),T.touchZoomRotate.disableRotation(),T.touchPitch.disable()}function Te(){cn(Z,!0)}function ge(){}function ke(){}function Ue(wt){}function Ae(){Ze(le())}function le(){const Ur=Math.ceil(Math.log2(B/K_));return Math.max(X_,Ur)}function Ze(wt){T==null||T.setMinZoom(wt)}function Xt(){const wt=T==null?void 0:T.getCenter();if(wt)return{lat:wt.lat,lng:wt.lng}}function xi(){const wt=T==null?void 0:T.getBounds();if(wt)return{sw:{lat:wt.getSouthWest().lat,lng:wt.getSouthWest().lng},ne:{lat:wt.getNorthEast().lat,lng:wt.getNorthEast().lng}}}function ji(){return(T==null?void 0:T.getZoom())??g.options.position.zoom}function Mi(){T==null||T.zoomIn()}function Ri(){T==null||T.zoomOut()}let ri=ln(ls(g.options.theme));mp(()=>{Rn(Z)&&T.setStyle(dr(Rn(ri)),{diff:!0})});function dr(wt){switch(wt){case"light":return $g;case"dark":return Ug}}function Rt(){return qm(Rn(ri))}function kt(wt){cn(ri,wt,!0),T.setStyle(Rt())}function Zt(wt){}var Vr=ry();zg("resize",Sh,Ae);var ba=Qm(Vr);return Ng(ba,wt=>E=wt,()=>E),og(()=>jg(Vr,1,`container ${Rn(ri)??""}`,"svelte-132x4ps")),Dg(b,Vr),np({getCenter:Xt,getBounds:xi,getZoom:ji,zoomIn:Mi,zoomOut:Ri,getTheme:Rt,setTheme:kt,addMarkers:Zt})}function ny(b){const g=document.getElementById(b.container);if(!g)throw new Error(`Container not found: ${b.container}`);return Lg(Up,{target:g,props:{options:b}})}function ay(b){Bg(b)}pa.Map=Up,pa.mountMap=ny,pa.unmountMap=ay,Object.defineProperty(pa,Symbol.toStringTag,{value:"Module"})});